1 AC_DEFUN(RFX_CHECK_PYTHON,
3 AC_MSG_CHECKING([for Python.h and PIL])
4 # should we support python versions below 2.2?
5 if test -f "/usr/lib/python2.2/site-packages/PIL/_imaging.so" -a -f "/usr/include/python2.2/Python.h";then
8 if test -f "/usr/lib/python2.3/site-packages/PIL/_imaging.so" -a -f "/usr/include/python2.3/Python.h";then
11 if test -f "/usr/lib/python2.4/site-packages/PIL/_imaging.so" -a -f "/usr/include/python2.4/Python.h";then
15 if test "x$PY_VERSION" "!=" "x"; then
16 AC_MSG_RESULT(python$PY_VERSION)
17 if test "x$PYTHON_LIB" = "x";then
18 PYTHON_LIB="-lpython$PY_VERSION /usr/lib/python$PY_VERSION/site-packages/PIL/_imaging.so"
20 if test "x$PYTHON_INCLUDES" = "x";then
21 PYTHON_INCLUDES="-I/usr/include/python$PY_VERSION"
23 export PYTHON_INCLUDES PYTHON_LIB
25 AC_SUBST(PYTHON_INCLUDES)
26 AC_MSG_CHECKING([whether we can compile the python test program])
28 cat > conftest.c << EOF
32 int main(int argn, char*argv[])
35 ret = Py_Main(argn, argv);
36 int x; // check also for gcc 2.95.x incompatibilities
40 ac_link='$CC $CPPFLAGS $CFLAGS $PYTHON_INCLUDES conftest.c $LDFLAGS $PYTHON_LIB $LIBS -o conftest${ac_exeext}'
41 if { (eval echo python.m4: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
45 echo "configure: failed program was:" >&5