if test -x ${PYTHON}-config; then
PYTHON_INCLUDES=`${PYTHON}-config --includes`
- for flag in `${PYTHON}-config --ldflags`; do
+ # make a copy of python-config --ldflags, removing any spaces and tabs
+ # between "-L" and its argument (some instances of python-config
+ # insert a space, which would confuse the code below)
+ python_config_ldflags=`${PYTHON}-config --ldflags | sed -ne 's/\([ \t]*-L\)[ ]*\([^ \t]*[ \t]*\)/\1\2/pg'`
+ for flag in $python_config_ldflags; do
# add any '-L..." flags to PYTHON_LDFLAGS
flag=`echo $flag | sed -ne 's/^\(\-L.*\)$/\1/p'`
if test "X${flag}" != X; then