gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/trunk r10794: add --enable-python option,


From: rob
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r10794: add --enable-python option, make building pythonmodule optional based on this, and find the flags needed for python development. task#9300
Date: Wed, 15 Apr 2009 18:11:19 -0600
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 10794
committer: address@hidden
branch nick: trunk
timestamp: Wed 2009-04-15 18:11:19 -0600
message:
  add --enable-python option, make building pythonmodule optional based on 
this, and find the flags needed for python development. task#9300
added:
  macros/python.m4
modified:
  Makefile.am
  configure.ac
  packaging/snapshot.am
  pythonmodule/Makefile.am
=== modified file 'Makefile.am'
--- a/Makefile.am       2009-04-15 16:13:42 +0000
+++ b/Makefile.am       2009-04-16 00:11:19 +0000
@@ -53,7 +53,6 @@
        utilities \
        gui \
        plugin \
-       pythonmodule \
        doc \
        po \
        $(NULL)
@@ -76,6 +75,10 @@
 SUBDIRS += extensions
 endif
 
+if USE_PYTHON
+SUBDIRS += pythonmodule
+endif
+
 # man_MANS = doc/gnash.1 doc/gprocessor.1 doc/dumpshm.1 soldumper.1
 
 DIST_SUBDIRS = $(LIBLTDLDIR) $(STD_DIRS) cygnal extensions testsuite
@@ -155,7 +158,7 @@
            echo "Using existing bzrversion.h"; \
        else \
            echo "Generating bzrversion.h"; \
-           echo 'static const char *BRANCH_REVNO  = "none";\nstatic const char 
*BRANCH_NICK = "none";\n' > bzrversion.h; \
+           echo "static const char *BRANCH_REVNO  = "none";\nstatic const char 
*BRANCH_NICK = "none";\n" > bzrversion.h; \
          fi; \
        fi
 
@@ -433,6 +436,11 @@
 else
        @echo " NPAPI (Mozilla) plugin disabled"
 endif
+if USE_PYTHON
+       @echo " PYTHON support enabled"
+else
+       @echo " PYTHON support disabled"
+endif
 
 if TESTSUITE
 check: check-recursive 

=== modified file 'configure.ac'
--- a/configure.ac      2009-04-14 18:24:56 +0000
+++ b/configure.ac      2009-04-16 00:11:19 +0000
@@ -219,6 +219,14 @@
 LC_KEY=${lckey}
 AC_SUBST(LC_KEY)
 
+AC_ARG_ENABLE(python,
+  AC_HELP_STRING([--enable-python],[Enable python for the python wrapper]),
+[case "${enableval}" in
+  yes) python=yes ;;
+  no)  python=no ;;
+  *)   AC_MSG_ERROR([bad value ${enableval} for --enable-python option]) ;;
+esac],python=no)
+
 # Maybe use jemalloc, which handles memory fragmentation for
 # ECAMscript languages better than the regular system malloc.
 # This seems like a good idea, as both the other player and
@@ -1100,8 +1108,11 @@
 dnl Check for PKG_CONFIG before any GNASH_PATH call
 PKG_PROG_PKG_CONFIG
 
-AC_PATH_PROG(PYTHON, python, ,[${pathlist}])
-AM_CONDITIONAL([ENABLE_GNASH_PYTHON_MODULE], false)
+dnl If python support is enabled, look for the flags and libs
+if test x"$python" = xyes; then
+  GNASH_PATH_PYTHON
+fi
+AM_CONDITIONAL([USE_PYTHON], test x"$python" != xno)
 
 AC_PATH_PROG(PERL, perl)
 AM_CONDITIONAL(HAVE_PERL, test x"$PERL" != x)
@@ -3043,13 +3054,6 @@
   fi
 fi
 
-  if test x"$PYTHON" != x; then
-    echo "        PYTHON is $PYTHON"
-  else
-    echo "        WARNING: You need to have python installed" >&4
-    echo "                 to run some of the tests in Gnash testsuite." >&4
-  fi
-
   if test x"$PERL" != x; then
     echo "        PERL is $PERL"
   else
@@ -3183,6 +3187,15 @@
     echo "        ERROR: No NSPR development package is installed." >&3
   fi
 fi
+if test x"$python" = x"yes"; then
+  if test x"$has_python" = x"yes"; then
+    echo "        PYTHON flags are: $PYTHON_CFLAGS"
+    echo "        PYTHON libs are: $PYTHON_LIBS"
+    echo "        PYTHON executable is are: $PYTHON"
+  else
+    echo "        ERROR: No Python development package is installed, but it's 
enabled." >&3
+  fi
+fi
 
 if test x$cross_compiling = xyes; then
   AC_MSG_NOTICE([This build is setup for cross compiling])

=== added file 'macros/python.m4'
--- a/macros/python.m4  1970-01-01 00:00:00 +0000
+++ b/macros/python.m4  2009-04-16 00:11:19 +0000
@@ -0,0 +1,139 @@
+dnl  
+dnl    Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+dnl  
+dnl  This program is free software; you can redistribute it and/or modify
+dnl  it under the terms of the GNU General Public License as published by
+dnl  the Free Software Foundation; either version 3 of the License, or
+dnl  (at your option) any later version.
+dnl  
+dnl  This program is distributed in the hope that it will be useful,
+dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+dnl  GNU General Public License for more details.
+dnl  You should have received a copy of the GNU General Public License
+dnl  along with this program; if not, write to the Free Software
+dnl  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+
+AC_DEFUN([GNASH_PATH_PYTHON],
+[
+
+  dnl Look for the header
+  AC_ARG_WITH(python_incl, AC_HELP_STRING([--with-python-incl], [directory 
where libpython header is (w/out the python/ prefix)]), 
with_python_incl=${withval})
+    AC_CACHE_VAL(ac_cv_path_python_incl,[
+    if test x"${with_python_incl}" != x ; then
+      if test -f ${with_python_incl}/python/python.h ; then
+             ac_cv_path_python_incl="`(cd ${with_python_incl}; pwd)`"
+      else
+             AC_MSG_ERROR([${with_python_incl} directory doesn't contain 
python/python.h])
+      fi
+    fi
+  ])
+
+  # Look for the python-config script
+  pythonconfig=""
+  AC_PATH_PROG(pythonconfig, python-config, ,[${pathlist}])
+
+  dnl If the path hasn't been specified, go look for it.
+  if test x"${ac_cv_path_python_incl}" = x; then
+    if test x"${pythonconfig}" != "x"; then
+      ac_cv_path_python_incl="`${pythonconfig} --include`"
+    else
+      for i in $incllist; do
+        if test -f $i/pythonrun.h; then
+          ac_cv_path_python_incl="-I$i"
+         break
+        fi
+      done
+    fi
+
+    if test x"${ac_cv_path_python_incl}" = x ; then
+      AC_CHECK_HEADERS(pythonrun.h)
+    fi
+
+    AC_MSG_CHECKING([for libpython header])
+    if test x"${ac_cv_path_python_incl}" != x ; then
+      AC_MSG_RESULT(yes)
+    else
+      AC_MSG_RESULT(no)
+    fi
+  fi
+
+
+  if test x"${ac_cv_path_python_incl}" != x"/usr/include"; then
+    ac_cv_path_python_incl="${ac_cv_path_python_incl}"
+  else
+    ac_cv_path_python_incl=""
+  fi
+
+  dnl Look for the library
+  AC_ARG_WITH(python_lib, AC_HELP_STRING([--with-python-lib], [directory where 
python library is]), with_python_lib=${withval})
+    AC_CACHE_VAL(ac_cv_path_python_lib,[
+    if test x"${with_python_lib}" != x ; then # {
+      if test -f ${with_python_lib}/libpython.a -o -f 
${with_python_lib}/libpython.${shlibext}; then # {
+        ac_cv_path_python_lib="-L`(cd ${with_python_lib}; pwd)`"
+      else # }{
+        AC_MSG_ERROR([${with_python_lib} directory doesn't contain libpython.])
+      fi # }
+    fi # }
+  ])
+
+  dnl If the path hasn't been specified, go look for it.
+  if test x"${ac_cv_path_python_lib}" = x; then # {
+    if test x"${pythonconfig}" != "x" -a x"${darwin}" = xno; then # {
+      dnl python-config gives us way to many libraries, which create nasty 
linking
+      dnl dependancy issue, so we strip them off here. The real dependencies 
are
+      dnl are taken care of by other config tests.
+      ac_cv_path_python_lib=`${pythonconfig} --libs`
+    else # }{
+      AC_MSG_CHECKING([for libpython library])
+      for i in $libslist; do # {
+        if test -f $i/libpython.a -o -f $i/libpython.${shlibext}; then # {
+          if test ! x"$i" = x"/usr/lib" -a ! x"$i" = x"/usr/lib64"; then # {
+            ac_cv_path_python_lib="-L$i -lpython"
+            AC_MSG_RESULT(${ac_cv_path_python_lib})
+            break
+          else # }{
+            ac_cv_path_python_lib="-lpython2.5"
+            AC_MSG_RESULT(yes)
+            break
+          fi # }
+        fi # }
+      done # }
+      if test x"${ac_cv_path_python_lib}" = x; then # {
+        AC_MSG_RESULT(no)
+      fi # }
+    fi # }
+
+  fi # }
+
+  if test x"${ac_cv_path_python_incl}" != x ; then
+    PYTHON_CFLAGS="${ac_cv_path_python_incl}"
+  else
+    PYTHON_CFLAGS=""
+  fi
+
+  if test x"${ac_cv_path_python_lib}" != x ; then
+    PYTHON_LIBS="${ac_cv_path_python_lib}"
+  else
+    PYTHON_LIBS=""
+  fi
+
+  if test -n "$PYTHON_LIBS"; then
+    AC_DEFINE(HAS_PYTHON, [1], [Define this if you want to enable python 
usage])
+    has_python=yes
+  else
+    has_python=no
+  fi
+
+  AC_PATH_PROG(PYTHON, python, ,[${pathlist}])
+
+  AC_SUBST(PYTHON_CFLAGS)  
+  AC_SUBST(PYTHON_LIBS)
+])
+
+# Local Variables:
+# c-basic-offset: 2
+# tab-width: 2
+# indent-tabs-mode: nil
+# End:

=== modified file 'packaging/snapshot.am'
--- a/packaging/snapshot.am     2009-04-14 19:15:30 +0000
+++ b/packaging/snapshot.am     2009-04-16 00:11:19 +0000
@@ -124,5 +124,5 @@
 snapshot-clean:
        address@hidden -fr snapshot-* $(SNAPSHOT_BUILD) $(SNAPSHOT_TMP) 
gnash*$(VERSION)*.ipk
 
-.PHONY : snapshot snapshot-build snapshot-install snapshot-clean
+.PHONY : snapshot snapshot-build snapshot-install snapshot-clean snapshot-src
 

=== modified file 'pythonmodule/Makefile.am'
--- a/pythonmodule/Makefile.am  2009-02-27 06:46:40 +0000
+++ b/pythonmodule/Makefile.am  2009-04-16 00:11:19 +0000
@@ -17,14 +17,14 @@
 
 AUTOMAKE_OPTIONS = 
 
-if ENABLE_GNASH_PYTHON_MODULE
+if USE_PYTHON
 
 pkglib_LTLIBRARIES = libgnashpython.la gnash.la
 
 EXTRA_DIST = gnashPythonExample.py
 
-BOOSTPYTHON_LIBS = -lboost_python 
-BOOSTPYTHON_CFLAGS = -I/usr/include/python2.5
+BOOSTPYTHON_LIBS = -lboost_python  $(PYTHON_LIBS)
+BOOSTPYTHON_CFLAGS = $(PYTHON_CFLAGS)
 
 libgnashpython_la_SOURCES = \
        gnashpython.cpp \
@@ -40,7 +40,7 @@
        $(BOOST_LIBS) \
        $(PTHREAD_LIBS) \
        $(NULL)
-               
+
 libgnashpython_la_CPPFLAGS = \
         -I$(top_srcdir)/libcore \
         -I$(top_srcdir)/libcore/parser \


reply via email to

[Prev in Thread] Current Thread [Next in Thread]