X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=m4%2Fpython.m4;h=7131543bfb4a3a97195fc1bd504e1b1889f6d447;hb=b6575ae3d3fe12fdefe00dcbd0086d09923d2c69;hp=ac535522567bb827658cf1a8cac512dd6cee1d7f;hpb=8b255033a90c323dde6d0e13ba1ab6c5808b6dfe;p=swftools.git diff --git a/m4/python.m4 b/m4/python.m4 index ac53552..7131543 100644 --- a/m4/python.m4 +++ b/m4/python.m4 @@ -1,24 +1,32 @@ AC_DEFUN(RFX_CHECK_PYTHON, [ AC_MSG_CHECKING([for Python.h and PIL]) -# should we support python versions below 2.2? -if test -f "/usr/lib/python2.2/site-packages/PIL/_imaging.so" -a -f "/usr/include/python2.2/Python.h";then - PY_VERSION=2.2 -fi -if test -f "/usr/lib/python2.3/site-packages/PIL/_imaging.so" -a -f "/usr/include/python2.3/Python.h";then - PY_VERSION=2.3 -fi -if test -f "/usr/lib/python2.4/site-packages/PIL/_imaging.so" -a -f "/usr/include/python2.4/Python.h";then - PY_VERSION=2.4 + +if test "x$PYTHON_LIB" '!=' "x" -a "x$PYTHON_INCLUDES" '!=' "x";then + PY_VERSION=unknown +else + # should we support python versions below 2.2? + if test -f "/usr/lib/python2.2/site-packages/PIL/_imaging.so" -a -f "/usr/include/python2.2/Python.h";then + PY_VERSION=2.2 + fi + if test -f "/usr/lib/python2.3/site-packages/PIL/_imaging.so" -a -f "/usr/include/python2.3/Python.h";then + PY_VERSION=2.3 + fi + if test -f "/usr/lib/python2.4/site-packages/PIL/_imaging.so" -a -f "/usr/include/python2.4/Python.h";then + PY_VERSION=2.4 + fi + # OS X: + # /System/Library/Frameworks/Python.framework/Versions/2.3/include/python2.3/Python.h + # /Library/Python/2.3/_imaging.so fi if test "x$PY_VERSION" "!=" "x"; then - AC_MSG_RESULT(python$PY_VERSION) + AC_MSG_RESULT($PY_VERSION) if test "x$PYTHON_LIB" = "x";then - PYTHON_LIB="-lpython$PY_VERSION /usr/lib/python$PY_VERSION/site-packages/PIL/_imaging.so" + PYTHON_LIB="-l$PY_VERSION /usr/lib/$PY_VERSION/site-packages/PIL/_imaging.so" fi if test "x$PYTHON_INCLUDES" = "x";then - PYTHON_INCLUDES="-I/usr/include/python$PY_VERSION" + PYTHON_INCLUDES="-I/usr/include/$PY_VERSION" fi export PYTHON_INCLUDES PYTHON_LIB AC_SUBST(PYTHON_LIB) @@ -29,11 +37,13 @@ if test "x$PY_VERSION" "!=" "x"; then #include #include -int main(int argn, char*argv[]) +int main() { - return Py_Main(argn, argv); + int ret; + ret = Py_Main(0, 0); + int x; // check also for gcc 2.95.x incompatibilities + return ret; } -bli bla blo EOF ac_link='$CC $CPPFLAGS $CFLAGS $PYTHON_INCLUDES conftest.c $LDFLAGS $PYTHON_LIB $LIBS -o conftest${ac_exeext}' if { (eval echo python.m4: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then