]> granicus.if.org Git - graphviz/commitdiff
Fix bug#756 - automatically detect prefix for python includes and libs
authorellson <devnull@localhost>
Tue, 18 Oct 2005 18:22:22 +0000 (18:22 +0000)
committerellson <devnull@localhost>
Tue, 18 Oct 2005 18:22:22 +0000 (18:22 +0000)
        - using code suggested by: Javier Cardona <javier@cozybit.com>

configure.ac

index ddf0e8a8863676a344b64254b1515782cb6fd057..c3c58a6eea4d7f59c8eaa3e8094ced7e83f335b1 100644 (file)
@@ -401,15 +401,15 @@ else
       fi
     fi
   fi
-fi
-AC_CHECK_HEADER(python$PYTHON_VERSION_SHORT/Python.h,,[
-  AC_MSG_WARN([Unable to find header Python.h. The Python packages will not be built])
-  HAVE_PYTHON=0])
-AC_SUBST(PYTHON_VERSION)
-AC_SUBST(HAVE_PYTHON)
-if test "x$HAVE_PYTHON" = "x1"; then
-  PYTHON_INCLUDES=-I/usr/include/python$PYTHON_VERSION_SHORT
-  PYTHON_LIBS=-lpython$PYTHON_VERSION_SHORT
+  PYTHON_PREFIX=`python -c "import sys; print sys.prefix"`
+  PYTHON_INCLUDES=-I$PYTHON_PREFIX/include/python$PYTHON_VERSION_SHORT
+  PYTHON_LIBS="-L$PYTHON_PREFIX/lib -lpython$PYTHON_VERSION_SHORT"
+  save_CPPFLAGS=$CPPFLAGS
+  CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
+  AC_CHECK_HEADER(Python.h,,[
+    AC_MSG_WARN([Unable to find header Python.h. The Python packages will not be built])
+    HAVE_PYTHON=0])
+  CPPFLAGS=$save_CPPFLAGS
 fi
 AM_CONDITIONAL(WITH_PYTHON, [test "x$HAVE_PYTHON" = "x1"])
 AC_SUBST(HAVE_PYTHON)