]> granicus.if.org Git - graphviz/commitdiff
try supporting python2.[345] as distinct languages:
authorellson <devnull@localhost>
Wed, 31 Oct 2007 02:44:35 +0000 (02:44 +0000)
committerellson <devnull@localhost>
Wed, 31 Oct 2007 02:44:35 +0000 (02:44 +0000)
      --enable-python=yes     python language bindings
      --enable-python23=no    python23 language bindings
      --enable-python24=no    python24 language bindings
      --enable-python25=no    python25 language bindings

configure.ac
tclpkg/gv/Makefile.am

index 6c2d105ced05151d39808762c411a07b7e3a4099..3705b7c5d2ccf68213d96d57e5e44bc8fe683be9 100644 (file)
@@ -858,6 +858,165 @@ fi
 fi
 AM_CONDITIONAL(WITH_PYTHON, [test "x$PYTHON" != "x"])
 
+dnl -----------------------------------
+dnl INCLUDES and LIBS for PYTHON23
+
+if test "x$SWIG" != "x"; then
+AC_ARG_ENABLE(python23,
+  [AC_HELP_STRING([--enable-python23=no], [python23 language bindings])],
+  [], [enable_python23=no])
+if test "x$enable_python23" = "xyes"; then
+if test `$SWIG -help 2>&1 | $GREP -c '\-python *- Generate'` = 0; then
+       PYTHON23=
+       AC_MSG_WARN([swig does not support python23. The PYTHON23 packages will not be built])
+else
+AC_CHECK_PROG(PYTHON23,python2.3,python2.3)
+if test "x$PYTHON23" != "x"; then
+  PYTHON23_VERSION=`$PYTHON23 -V 2>&1 | $GREP Python | cut -d ' ' -f 2`
+  if test "x$PYTHON23_VERSION" = "x"; then
+    PYTHON23=
+  else
+    PYTHON23_VERSION_MAJOR=`echo $PYTHON23_VERSION | cut -d '.' -f 1`
+    PYTHON23_VERSION_MINOR=`echo $PYTHON23_VERSION | cut -d '.' -f 2`
+    PYTHON23_VERSION_SHORT=$PYTHON23_VERSION_MAJOR.$PYTHON23_VERSION_MINOR
+    if test $PYTHON23_VERSION_MAJOR -lt 3; then
+      if test $PYTHON23_VERSION_MAJOR -lt 2; then
+       PYTHON23=
+      else
+        if test $PYTHON23_VERSION_MINOR -lt 3; then
+         PYTHON23=
+        fi
+      fi
+    fi
+  fi
+  if test "x$PYTHON23" = "x"; then
+      AC_MSG_WARN([Can't use Python version $PYTHON23_VERSION  The Python packages will not be built])
+  else
+    PYTHON23_PREFIX=`$PYTHON23 -c "import sys; print sys.prefix"`
+    PYTHON23_INCLUDES=-I$PYTHON23_PREFIX/include/python$PYTHON23_VERSION_SHORT
+    PYTHON23_LIBS="-L$PYTHON23_PREFIX/lib$LIBPOSTFIX"
+    save_CPPFLAGS=$CPPFLAGS
+    CPPFLAGS="$CPPFLAGS $PYTHON23_INCLUDES"
+    AC_CHECK_HEADER(Python.h,,[
+      AC_MSG_WARN([Unable to find header Python.h. The Python packages will not be built])
+      PYTHON23=
+      ])
+    CPPFLAGS=$save_CPPFLAGS
+  fi
+fi
+AC_SUBST(PYTHON23_INCLUDES)
+AC_SUBST(PYTHON23_LIBS)
+fi
+fi
+fi
+AM_CONDITIONAL(WITH_PYTHON23, [test "x$PYTHON23" != "x"])
+
+dnl -----------------------------------
+dnl INCLUDES and LIBS for PYTHON24
+
+if test "x$SWIG" != "x"; then
+AC_ARG_ENABLE(python24,
+  [AC_HELP_STRING([--enable-python24=no], [python24 language bindings])],
+  [], [enable_python24=no])
+if test "x$enable_python24" = "xyes"; then
+if test `$SWIG -help 2>&1 | $GREP -c '\-python *- Generate'` = 0; then
+       PYTHON24=
+       AC_MSG_WARN([swig does not support python24. The PYTHON24 packages will not be built])
+else
+AC_CHECK_PROG(PYTHON24,python2.4,python2.4)
+if test "x$PYTHON24" != "x"; then
+  PYTHON24_VERSION=`$PYTHON24 -V 2>&1 | $GREP Python | cut -d ' ' -f 2`
+  if test "x$PYTHON24_VERSION" = "x"; then
+    PYTHON24=
+  else
+    PYTHON24_VERSION_MAJOR=`echo $PYTHON24_VERSION | cut -d '.' -f 1`
+    PYTHON24_VERSION_MINOR=`echo $PYTHON24_VERSION | cut -d '.' -f 2`
+    PYTHON24_VERSION_SHORT=$PYTHON24_VERSION_MAJOR.$PYTHON24_VERSION_MINOR
+    if test $PYTHON24_VERSION_MAJOR -lt 3; then
+      if test $PYTHON24_VERSION_MAJOR -lt 2; then
+       PYTHON24=
+      else
+        if test $PYTHON24_VERSION_MINOR -lt 3; then
+         PYTHON24=
+        fi
+      fi
+    fi
+  fi
+  if test "x$PYTHON24" = "x"; then
+      AC_MSG_WARN([Can't use Python version $PYTHON24_VERSION  The Python packages will not be built])
+  else
+    PYTHON24_PREFIX=`$PYTHON24 -c "import sys; print sys.prefix"`
+    PYTHON24_INCLUDES=-I$PYTHON24_PREFIX/include/python$PYTHON24_VERSION_SHORT
+    PYTHON24_LIBS="-L$PYTHON24_PREFIX/lib$LIBPOSTFIX"
+    save_CPPFLAGS=$CPPFLAGS
+    CPPFLAGS="$CPPFLAGS $PYTHON24_INCLUDES"
+    AC_CHECK_HEADER(Python.h,,[
+      AC_MSG_WARN([Unable to find header Python.h. The Python packages will not be built])
+      PYTHON24=
+      ])
+    CPPFLAGS=$save_CPPFLAGS
+  fi
+fi
+AC_SUBST(PYTHON24_INCLUDES)
+AC_SUBST(PYTHON24_LIBS)
+fi
+fi
+fi
+AM_CONDITIONAL(WITH_PYTHON24, [test "x$PYTHON24" != "x"])
+
+dnl -----------------------------------
+dnl INCLUDES and LIBS for PYTHON25
+
+if test "x$SWIG" != "x"; then
+AC_ARG_ENABLE(python25,
+  [AC_HELP_STRING([--enable-python25=no], [python25 language bindings])],
+  [], [enable_python25=no])
+if test "x$enable_python25" = "xyes"; then
+if test `$SWIG -help 2>&1 | $GREP -c '\-python *- Generate'` = 0; then
+       PYTHON25=
+       AC_MSG_WARN([swig does not support python25. The PYTHON25 packages will not be built])
+else
+AC_CHECK_PROG(PYTHON25,python2.5,python2.5)
+if test "x$PYTHON25" != "x"; then
+  PYTHON25_VERSION=`$PYTHON25 -V 2>&1 | $GREP Python | cut -d ' ' -f 2`
+  if test "x$PYTHON25_VERSION" = "x"; then
+    PYTHON25=
+  else
+    PYTHON25_VERSION_MAJOR=`echo $PYTHON25_VERSION | cut -d '.' -f 1`
+    PYTHON25_VERSION_MINOR=`echo $PYTHON25_VERSION | cut -d '.' -f 2`
+    PYTHON25_VERSION_SHORT=$PYTHON25_VERSION_MAJOR.$PYTHON25_VERSION_MINOR
+    if test $PYTHON25_VERSION_MAJOR -lt 3; then
+      if test $PYTHON25_VERSION_MAJOR -lt 2; then
+       PYTHON25=
+      else
+        if test $PYTHON25_VERSION_MINOR -lt 3; then
+         PYTHON25=
+        fi
+      fi
+    fi
+  fi
+  if test "x$PYTHON25" = "x"; then
+      AC_MSG_WARN([Can't use Python version $PYTHON25_VERSION  The Python packages will not be built])
+  else
+    PYTHON25_PREFIX=`$PYTHON25 -c "import sys; print sys.prefix"`
+    PYTHON25_INCLUDES=-I$PYTHON25_PREFIX/include/python$PYTHON25_VERSION_SHORT
+    PYTHON25_LIBS="-L$PYTHON25_PREFIX/lib$LIBPOSTFIX"
+    save_CPPFLAGS=$CPPFLAGS
+    CPPFLAGS="$CPPFLAGS $PYTHON25_INCLUDES"
+    AC_CHECK_HEADER(Python.h,,[
+      AC_MSG_WARN([Unable to find header Python.h. The Python packages will not be built])
+      PYTHON25=
+      ])
+    CPPFLAGS=$save_CPPFLAGS
+  fi
+fi
+AC_SUBST(PYTHON25_INCLUDES)
+AC_SUBST(PYTHON25_LIBS)
+fi
+fi
+fi
+AM_CONDITIONAL(WITH_PYTHON25, [test "x$PYTHON25" != "x"])
+
 dnl -----------------------------------
 dnl INCLUDES and LIBS for RUBY
 
index c8f68b1cddc39a2020735b7040b29d74eb491785..8038bb123b379f3713a64fb237bd2f093ad7c6b1 100644 (file)
@@ -118,6 +118,33 @@ libgv_python_la_LDFLAGS = -module -avoid-version
 gv_python.cpp $(PYTHON_data): gv.i
        $(SWIG) -c++ -python -o gv_python.cpp $(srcdir)/gv.i
 
+pkgpython23dir = $(pkglibdir)/python23
+PYTHON23_data = gv.py
+nodist_libgv_python23_la_SOURCES = gv_python23.cpp $(PYTHON23_data)
+libgv_python23_la_SOURCES = $(BASESOURCES)
+libgv_python23_la_LIBADD = $(BASELIBS) @PYTHON23_LIBS@
+libgv_python23_la_LDFLAGS = -module -avoid-version
+gv_python23.cpp $(PYTHON23_data): gv.i
+       $(SWIG) -c++ -python -o gv_python23.cpp $(srcdir)/gv.i
+
+pkgpython24dir = $(pkglibdir)/python24
+PYTHON24_data = gv.py
+nodist_libgv_python24_la_SOURCES = gv_python24.cpp $(PYTHON24_data)
+libgv_python24_la_SOURCES = $(BASESOURCES)
+libgv_python24_la_LIBADD = $(BASELIBS) @PYTHON24_LIBS@
+libgv_python24_la_LDFLAGS = -module -avoid-version
+gv_python24.cpp $(PYTHON24_data): gv.i
+       $(SWIG) -c++ -python -o gv_python24.cpp $(srcdir)/gv.i
+
+pkgpython25dir = $(pkglibdir)/python25
+PYTHON25_data = gv.py
+nodist_libgv_python25_la_SOURCES = gv_python25.cpp $(PYTHON25_data)
+libgv_python25_la_SOURCES = $(BASESOURCES)
+libgv_python25_la_LIBADD = $(BASELIBS) @PYTHON25_LIBS@
+libgv_python25_la_LDFLAGS = -module -avoid-version
+gv_python25.cpp $(PYTHON25_data): gv.i
+       $(SWIG) -c++ -python -o gv_python25.cpp $(srcdir)/gv.i
+
 pkgrubydir = $(pkglibdir)/ruby
 RUBY_data = 
 nodist_libgv_ruby_la_SOURCES = gv_ruby.cpp $(RUBY_data)
@@ -207,6 +234,27 @@ man_MANS += gv_python.n
 pkgpython_LTLIBRARIES = libgv_python.la
 TESTS += test_python
 endif
+if WITH_PYTHON23
+pkgpython23_DATA = $(PYTHON23_data)
+man_MANS += gv_python.n
+#pdf_DATA += gv_python.pdf
+pkgpython23_LTLIBRARIES = libgv_python23.la
+#TESTS += test_python23
+endif
+if WITH_PYTHON24
+pkgpython24_DATA = $(PYTHON24_data)
+man_MANS += gv_python.n
+#pdf_DATA += gv_python.pdf
+pkgpython24_LTLIBRARIES = libgv_python24.la
+#TESTS += test_python24
+endif
+if WITH_PYTHON25
+pkgpython25_DATA = $(PYTHON25_data)
+man_MANS += gv_python.n
+#pdf_DATA += gv_python.pdf
+pkgpython25_LTLIBRARIES = libgv_python25.la
+#TESTS += test_python25
+endif
 if WITH_RUBY
 pkgruby_DATA = $(RUBY_data)
 man_MANS += gv_ruby.n
@@ -244,6 +292,9 @@ install-data-hook:
        (cd $(DESTDIR)$(pkgluadir);    rm -f gv.so;  $(LN_S) libgv_lua.so gv.so;)
        (cd $(DESTDIR)$(pkgperldir);   rm -f gv.so;  $(LN_S) libgv_perl.so gv.so;)
        (cd $(DESTDIR)$(pkgpythondir); rm -f _gv.so; $(LN_S) libgv_python.so _gv.so;)
+       (cd $(DESTDIR)$(pkgpython23dir); rm -f _gv.so; $(LN_S) libgv_python.so _gv.so;)
+       (cd $(DESTDIR)$(pkgpython24dir); rm -f _gv.so; $(LN_S) libgv_python.so _gv.so;)
+       (cd $(DESTDIR)$(pkgpython25dir); rm -f _gv.so; $(LN_S) libgv_python.so _gv.so;)
        (cd $(DESTDIR)$(pkgrubydir);   rm -f gv.so;  $(LN_S) libgv_ruby.so gv.so;)
        (cd $(DESTDIR)$(pkgtcldir);    rm -f gv.so;  $(LN_S) libgv_tcl.so gv.so;)
 
@@ -251,6 +302,9 @@ uninstall-hook:
        (cd $(DESTDIR)$(pkgluadir);    rm -f gv.so;)
        (cd $(DESTDIR)$(pkgperldir);   rm -f gv.so;)
        (cd $(DESTDIR)$(pkgpythondir); rm -f _gv.so;)
+       (cd $(DESTDIR)$(pkgpython23dir); rm -f _gv.so;)
+       (cd $(DESTDIR)$(pkgpython24dir); rm -f _gv.so;)
+       (cd $(DESTDIR)$(pkgpython25dir); rm -f _gv.so;)
        (cd $(DESTDIR)$(pkgrubydir);   rm -f gv.so;)
        (cd $(DESTDIR)$(pkgtcldir);    rm -f gv.so;)
 
@@ -349,6 +403,9 @@ CLEANFILES = test_*/* pkgIndex.tcl \
        gv_perl.cpp $(PERL_data) \
        gv_php.cpp $(PHP_data) \
        gv_python.cpp $(PYTHON_data) gv.pyc \
+       gv_python23.cpp $(PYTHON23_data) gv.pyc \
+       gv_python24.cpp $(PYTHON24_data) gv.pyc \
+       gv_python25.cpp $(PYTHON25_data) gv.pyc \
        gv_ruby.cpp $(RUBY_data) \
        gv_tcl.cpp $(TCL_data) pkgIndex.tcl