1 AC_DEFUN(RFX_CHECK_PYTHON,
3 AC_MSG_CHECKING([for Python.h and PIL])
5 if test "x$PYTHON_LIB" '!=' "x" -a "x$PYTHON_INCLUDES" '!=' "x";then
8 if test "x$PYTHON_LIB" '!=' "x" -o "x$PYTHON_INCLUDES" '!=' "x";then
9 echo "Set both PYTHON_LIB and PYTHON_INCLUDES, or none at all"
11 # iterate through version 2.2 to 2.4
14 if test -f "/usr/lib/python2.$v/site-packages/PIL/_imaging.so" -a -f "/usr/include/python2.$v/Python.h";then
16 PYTHON_LIB="-lpython$PY_VERSION /usr/lib/python$PY_VERSION/site-packages/PIL/_imaging.so"
17 PYTHON_INCLUDES="-I/usr/include/python$PY_VERSION"
20 if test -f "/Library/Python/2.$v/PIL/_imaging.so" \
21 -a "/System/Library/Frameworks/Python.framework/Versions/2.$v/include/python2.$v/Python.h";then
23 PYTHON_LIB="-lpython$PY_VERSION /Library/Python/2.$v/PIL/_imaging.so"
24 PYTHON_INCLUDES="-I/System/Library/Frameworks/Python.framework/Versions/2.$v/include/python2.$v/"
29 if test "x$PY_VERSION" "!=" "x"; then
30 AC_MSG_RESULT($PY_VERSION)
31 export PYTHON_INCLUDES PYTHON_LIB
33 AC_SUBST(PYTHON_INCLUDES)
34 AC_MSG_CHECKING([whether we can compile the python test program])
36 cat > conftest.c << EOF
44 int x; // check also for gcc 2.95.x incompatibilities
48 ac_link='$CC $CPPFLAGS $CFLAGS $PYTHON_INCLUDES conftest.c $LDFLAGS $PYTHON_LIB $LIBS -o conftest${ac_exeext}'
49 if { (eval echo python.m4: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
53 echo "configure: failed program was:" >&5