reenable InvalidatedRegions for AGG in a framebuffer
[gnash.git] / macros / python.m4
blob652f5ede678ededd693d49d1a50c99401b2260c5
1 dnl  
2 dnl  Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010,
3 dnl  2011 Free Software Foundation, Inc.
4 dnl  
5 dnl  This program is free software; you can redistribute it and/or modify
6 dnl  it under the terms of the GNU General Public License as published by
7 dnl  the Free Software Foundation; either version 3 of the License, or
8 dnl  (at your option) any later version.
9 dnl  
10 dnl  This program is distributed in the hope that it will be useful,
11 dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 dnl  GNU General Public License for more details.
14 dnl  You should have received a copy of the GNU General Public License
15 dnl  along with this program; if not, write to the Free Software
16 dnl  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19 AC_DEFUN([GNASH_PATH_PYTHON],
22   dnl Look for the header
23   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})
24     AC_CACHE_VAL(ac_cv_path_python_incl,[
25     if test x"${with_python_incl}" != x ; then
26       if test -f ${with_python_incl}/python/python.h ; then
27               ac_cv_path_python_incl="`(cd ${with_python_incl}; pwd)`"
28       else
29               AC_MSG_ERROR([${with_python_incl} directory doesn't contain python/python.h])
30       fi
31     fi
32   ])
34   if test x"${python}" = x"yes"; then
35     # Look for the python-config script
36     pythonconfig=""
37     AC_PATH_PROG(pythonconfig, python-config, ,[${pathlist}])
38     if  test x"${pythonconfig}" = x; then
39       AC_MSG_CHECKING([for versioned python-config])
40       for i in `echo ${pathlist} | sed  's|:| |g' 2>/dev/null`; do
41         pythonconfig="`ls ${i}/python2.*-config 2>/dev/null | head -1`"
42         if test x"${pythonconfig}" != x; then
43           break
44         fi
45       done
46       if test x"${pythonconfig}" != x; then
47         AC_MSG_RESULT([${pythonconfig}])
48       else
49         AC_MSG_RESULT([no])
50       fi
51     fi
54     dnl If the path hasn't been specified, go look for it.
55     if test x"${ac_cv_path_python_incl}" = x; then
56       if test x"${pythonconfig}" != "x"; then
57         ac_cv_path_python_incl="`${pythonconfig} --include`"
58       else
59         for i in $incllist; do
60           for j in `ls -dr $i/python2.* 2>/dev/null`;do
61             if test -f $j/pythonrun.h; then
62               ac_cv_path_python_incl="-I$j"
63               break 2
64             fi
65           done
66         done
67       fi
69       if test x"${ac_cv_path_python_incl}" = x ; then
70         AC_CHECK_HEADERS(pythonrun.h)
71       fi
73       AC_MSG_CHECKING([for libpython header])
74       if test x"${ac_cv_path_python_incl}" != x ; then
75         AC_MSG_RESULT(yes)
76       else
77         AC_MSG_RESULT(no)
78       fi
79     fi
82     if test x"${ac_cv_path_python_incl}" != x"/usr/include"; then
83       ac_cv_path_python_incl="${ac_cv_path_python_incl}"
84     else
85       ac_cv_path_python_incl=""
86     fi
88     dnl Look for the library
89     AC_ARG_WITH(python_lib, AC_HELP_STRING([--with-python-lib], [directory where python library is]), with_python_lib=${withval})
90       AC_CACHE_VAL(ac_cv_path_python_lib,[
91       if test x"${with_python_lib}" != x ; then # {
92         if test -f ${with_python_lib}/libpython.a -o -f ${with_python_lib}/libpython.${shlibext}; then # {
93           ac_cv_path_python_lib="-L`(cd ${with_python_lib}; pwd)`"
94         else # }{
95           AC_MSG_ERROR([${with_python_lib} directory doesn't contain libpython.])
96         fi # }
97       fi # }
98     ])
100     dnl If the path hasn't been specified, go look for it.
101     if test x"${ac_cv_path_python_lib}" = x; then # {
102       if test x"${pythonconfig}" != "x" -a x"${darwin}" = xno; then # {
103         dnl python-config gives us way to many libraries, which create nasty linking
104         dnl dependancy issue, so we strip them off here. The real dependencies are
105         dnl are taken care of by other config tests.
106         ac_cv_path_python_lib=`${pythonconfig} --libs`
107       else # }{
108         AC_MSG_CHECKING([for libpython library])
109         for i in $libslist; do # {
110           if test -f $i/libpython.a -o -f $i/libpython.${shlibext}; then # {
111             if test ! x"$i" = x"/usr/lib" -a ! x"$i" = x"/usr/lib64"; then # {
112               ac_cv_path_python_lib="-L$i -lpython"
113               AC_MSG_RESULT(${ac_cv_path_python_lib})
114               break
115             else # }{
116               ac_cv_path_python_lib="-lpython2.5"
117               AC_MSG_RESULT(yes)
118               break
119             fi # }
120           fi # }
121         done # }
122         if test x"${ac_cv_path_python_lib}" = x; then # {
123           AC_MSG_RESULT(no)
124         fi # }
125       fi # }
126     fi # }
128     if test x"${ac_cv_path_python_incl}" != x ; then
129       PYTHON_CFLAGS="${ac_cv_path_python_incl}"
130     else
131       PYTHON_CFLAGS=""
132     fi
134     if test x"${ac_cv_path_python_lib}" != x ; then
135       PYTHON_LIBS="${ac_cv_path_python_lib}"
136     else
137       PYTHON_LIBS=""
138     fi
140     if test -n "$PYTHON_LIBS"; then
141       AC_DEFINE(HAS_PYTHON, [1], [Define this if you want to enable python usage])
142       has_python=yes
143     else
144       has_python=no
145     fi
147     AM_PATH_PYTHON
148     AC_PATH_PROG(PYGOBJECT_CODEGEN, pygobject-codegen-2.0, no)
149     if test x"${PYGOBJECT_CODEGEN}" = xno; then
150       AC_MSG_WARN(could not find pygobject-codegen-2.0 script)
151       AC_PATH_PROG(PYGTK_CODEGEN, pygtk-codegen-2.0, no)
152       if test x"${PYGTK_CODEGEN}" = xno; then
153         AC_MSG_ERROR(could not find pygtk-codegen-2.0 script)
154        fi
155      fi
157     PKG_CHECK_MODULES(PYGTK, pygtk-2.0)
159     PYGTK_DEFSDIR=`$PKG_CONFIG --variable=defsdir pygtk-2.0`
160   fi
162   AC_SUBST(PYGOBJECT_CODEGEN)
163   AC_SUBST(PYGTK_CODEGEN)
164   AC_SUBST(PYGTK_DEFSDIR)
165   AC_SUBST(PYTHON_CFLAGS)  
166   AC_SUBST(PYTHON_LIBS)
169 # Local Variables:
170 # c-basic-offset: 2
171 # tab-width: 2
172 # indent-tabs-mode: nil
173 # End: