added HAVE_AVIFILE #define.
[swftools.git] / m4 / python.m4
1 AC_DEFUN(RFX_CHECK_PYTHON,
2 [
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
6     PY_VERSION=2.2
7 fi
8 if test -f "/usr/lib/python2.3/site-packages/PIL/_imaging.so" -a -f "/usr/include/python2.3/Python.h";then
9     PY_VERSION=2.3
10 fi
11 if test -f "/usr/lib/python2.4/site-packages/PIL/_imaging.so" -a -f "/usr/include/python2.4/Python.h";then
12     PY_VERSION=2.4
13 fi
14
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"
19     fi
20     if test "x$PYTHON_INCLUDES" = "x";then
21         PYTHON_INCLUDES="-I/usr/include/python$PY_VERSION"
22     fi
23     export PYTHON_INCLUDES PYTHON_LIB
24     AC_SUBST(PYTHON_LIB)
25     AC_SUBST(PYTHON_INCLUDES)
26     AC_MSG_CHECKING([whether we can compile the python test program])
27     
28     cat > conftest.c << EOF
29 #include <Python.h>
30 #include <Imaging.h>
31
32 int main(int argn, char*argv[])
33 {
34     int ret;
35     ret = Py_Main(argn, argv);
36     int x; // check also for gcc 2.95.x incompatibilities
37     return ret;
38 }
39 EOF
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
42         AC_MSG_RESULT(yes)
43         PYTHON_OK=yes
44     else
45         echo "configure: failed program was:" >&5
46         cat conftest.c >&5
47         AC_MSG_RESULT(no)
48     fi
49     rm -f conftest*
50 else
51     AC_MSG_RESULT(nope)
52 fi
53 ])