Skip to content

Commit

Permalink
Detect Python compiled as framework on Darwin.
Browse files Browse the repository at this point in the history
Submitted by: Justin Erenkrantz
  • Loading branch information
grisha committed Dec 2, 2002
1 parent 2ffa5bd commit 42bfc0a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
24 changes: 16 additions & 8 deletions configure
Expand Up @@ -1293,20 +1293,27 @@ PyLIBPL=${PyLIBP}/config
PyPYTHONLIBS=${PyLIBPL}/libpython${PyVERSION}.a
PyLIBS=`grep "^LIB[SMC]=" ${PyLIBPL}/Makefile | cut -f2 -d= | tr '\011\012\015' ' '`
PyMODLIBS=`grep "^LOCALMODLIBS=" ${PyLIBPL}/Makefile | cut -f2 -d= | tr '\011\012\015' ' '`
PyFRAMEWORK=`grep "^PYTHONFRAMEWORK=" ${PyLIBPL}/Makefile | cut -f2 -d= | tr '\011\012\015' ' '`
PyFRAMEWORKDIR=`grep "^PYTHONFRAMEWORKDIR=" ${PyLIBPL}/Makefile | cut -f2 -d= | tr '\011\012\015' ' ' | sed 's/ //g'`

save_LDFLAGS="$LDFLAGS"
save_LIBS="$LIBS"
LDFLAGS="${LDFLAGS} -L${PyLIBPL}"
echo $ac_n "checking for Py_NewInterpreter in -lpython${PyVERSION}""... $ac_c" 1>&6
echo "configure:1302: checking for Py_NewInterpreter in -lpython${PyVERSION}" >&5
if test "$PyFRAMEWORKDIR" != "no-framework"; then
if test -n "$PyFRAMEWORK"; then
PyPYTHONLIBS="-framework $PyFRAMEWORK"
fi
else
LDFLAGS="${LDFLAGS} -L${PyLIBPL}"
echo $ac_n "checking for Py_NewInterpreter in -lpython${PyVERSION}""... $ac_c" 1>&6
echo "configure:1309: checking for Py_NewInterpreter in -lpython${PyVERSION}" >&5
ac_lib_var=`echo python${PyVERSION}'_'Py_NewInterpreter | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-lpython${PyVERSION} ${PyLIBS} ${PyMODLIBS} $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1310 "configure"
#line 1317 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
Expand All @@ -1317,7 +1324,7 @@ int main() {
Py_NewInterpreter()
; return 0; }
EOF
if { (eval echo configure:1321: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1328: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
Expand All @@ -1344,11 +1351,12 @@ else

fi

fi
LIBS="$save_LIBS"

# (actually this check already just happened above)
echo $ac_n "checking what libraries Python was linked with""... $ac_c" 1>&6
echo "configure:1352: checking what libraries Python was linked with" >&5
echo "configure:1360: checking what libraries Python was linked with" >&5
PY_LIBS="${PyPYTHONLIBS} ${PyLIBS} ${PyMODLIBS}"

## XXX this is a small work around for a weird RedHat problem
Expand All @@ -1361,7 +1369,7 @@ LIBS="${LIBS} ${PY_LIBS}"
echo "$ac_t""$PY_LIBS" 1>&6

echo $ac_n "checking linker flags used to link Python""... $ac_c" 1>&6
echo "configure:1365: checking linker flags used to link Python" >&5
echo "configure:1373: checking linker flags used to link Python" >&5

PyLFS=`grep "^LINKFORSHARED=" ${PyLIBPL}/Makefile | cut -f2 -d= | tr '\011\012\015' ' '`
PyLDFLAGS=`grep "^LDFLAGS=" ${PyLIBPL}/Makefile | cut -f2 -d= | tr '\011\012\015' ' '`
Expand All @@ -1370,7 +1378,7 @@ LDFLAGS="${LDFLAGS} ${PY_LDFLAGS}"
echo "$ac_t""$PY_LDFLAGS" 1>&6

echo $ac_n "checking where Python include files are""... $ac_c" 1>&6
echo "configure:1374: checking where Python include files are" >&5
echo "configure:1382: checking where Python include files are" >&5

PY_INCLUDES="-I${PyEXEC_INSTALLDIR}/include/python${PyVERSION}"
INCLUDES="${INCLUDES} ${AP_INCLUDES} ${PY_INCLUDES}"
Expand Down
12 changes: 10 additions & 2 deletions configure.in
Expand Up @@ -256,11 +256,18 @@ PyLIBPL=${PyLIBP}/config
PyPYTHONLIBS=${PyLIBPL}/libpython${PyVERSION}.a
PyLIBS=`grep "^LIB[[SMC]]=" ${PyLIBPL}/Makefile | cut -f2 -d= | tr '\011\012\015' ' '`
PyMODLIBS=`grep "^LOCALMODLIBS=" ${PyLIBPL}/Makefile | cut -f2 -d= | tr '\011\012\015' ' '`
PyFRAMEWORK=`grep "^PYTHONFRAMEWORK=" ${PyLIBPL}/Makefile | cut -f2 -d= | tr '\011\012\015' ' '`
PyFRAMEWORKDIR=`grep "^PYTHONFRAMEWORKDIR=" ${PyLIBPL}/Makefile | cut -f2 -d= | tr '\011\012\015' ' ' | sed 's/ //g'`

save_LDFLAGS="$LDFLAGS"
save_LIBS="$LIBS"
LDFLAGS="${LDFLAGS} -L${PyLIBPL}"
AC_CHECK_LIB(python${PyVERSION}, Py_NewInterpreter,
if test "$PyFRAMEWORKDIR" != "no-framework"; then
if test -n "$PyFRAMEWORK"; then
PyPYTHONLIBS="-framework $PyFRAMEWORK"
fi
else
LDFLAGS="${LDFLAGS} -L${PyLIBPL}"
AC_CHECK_LIB(python${PyVERSION}, Py_NewInterpreter,
[ PyPYTHONLIBS="-lpython${PyVERSION}" ],
[ LDFLAGS="$save_LDFLAGS"
if test -f ${PyLIBPL}/libpython${PyVERSION}.a; then
Expand All @@ -270,6 +277,7 @@ AC_CHECK_LIB(python${PyVERSION}, Py_NewInterpreter,
fi
],
[ ${PyLIBS} ${PyMODLIBS} ] )
fi
LIBS="$save_LIBS"

# (actually this check already just happened above)
Expand Down

0 comments on commit 42bfc0a

Please sign in to comment.