added logging of glyph bounding boxes.
[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     pythonrfxswf="lib/python/Makefile"
18     if test "x$PYTHON_LIB" = "x";then
19         PYTHON_LIB="-lpython$PY_VERSION /usr/lib/python$PY_VERSION/site-packages/PIL/_imaging.so"
20     fi
21     if test "x$PYTHON_INCLUDES" = "x";then
22         PYTHON_INCLUDES="-I/usr/include/python$PY_VERSION"
23     fi
24     export PYTHON_INCLUDES PYTHON_LIB
25     AC_SUBST(PYTHON_LIB)
26     AC_SUBST(PYTHON_INCLUDES)
27     AC_MSG_CHECKING([whether we can compile the python test program])
28     
29     cat > conftest.c << EOF
30 #include <Python.h>
31 #include <Imaging.h>
32
33 int main(int argn, char*argv[])
34 {
35     return Py_Main(argn, argv);
36 }
37 EOF
38     ac_link='$CC $CPPFLAGS $CFLAGS $PYTHON_INCLUDES conftest.c $LDFLAGS $PYTHON_LIB $LIBS -o conftest${ac_exeext}'
39     if { (eval echo python.m4: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
40         AC_MSG_RESULT(yes)
41         PYTHON_OK=yes
42     else
43         echo "configure: failed program was:" >&5
44         cat conftest.c >&5
45         AC_MSG_RESULT(no)
46     fi
47     rm -f conftest*
48 else
49     AC_MSG_RESULT(nope)
50 fi
51 ])