2 dnl Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
4 dnl This program is free software; you can redistribute it and/or modify
5 dnl it under the terms of the GNU General Public License as published by
6 dnl the Free Software Foundation; either version 3 of the License, or
7 dnl (at your option) any later version.
9 dnl This program is distributed in the hope that it will be useful,
10 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 dnl GNU General Public License for more details.
13 dnl You should have received a copy of the GNU General Public License
14 dnl along with this program; if not, write to the Free Software
15 dnl Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 AC_DEFUN([GNASH_PATH_PYTHON],
21 dnl Look for the header
22 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})
23 AC_CACHE_VAL(ac_cv_path_python_incl,[
24 if test x"${with_python_incl}" != x ; then
25 if test -f ${with_python_incl}/python/python.h ; then
26 ac_cv_path_python_incl="`(cd ${with_python_incl}; pwd)`"
28 AC_MSG_ERROR([${with_python_incl} directory doesn't contain python/python.h])
33 if test x"${python}" = x"yes"; then
34 # Look for the python-config script
36 AC_PATH_PROG(pythonconfig, python-config, ,[${pathlist}])
38 dnl If the path hasn't been specified, go look for it.
39 if test x"${ac_cv_path_python_incl}" = x; then
40 if test x"${pythonconfig}" != "x"; then
41 ac_cv_path_python_incl="`${pythonconfig} --include`"
43 for i in $incllist; do
44 if test -f $i/pythonrun.h; then
45 ac_cv_path_python_incl="-I$i"
51 if test x"${ac_cv_path_python_incl}" = x ; then
52 AC_CHECK_HEADERS(pythonrun.h)
55 AC_MSG_CHECKING([for libpython header])
56 if test x"${ac_cv_path_python_incl}" != x ; then
64 if test x"${ac_cv_path_python_incl}" != x"/usr/include"; then
65 ac_cv_path_python_incl="${ac_cv_path_python_incl}"
67 ac_cv_path_python_incl=""
70 dnl Look for the library
71 AC_ARG_WITH(python_lib, AC_HELP_STRING([--with-python-lib], [directory where python library is]), with_python_lib=${withval})
72 AC_CACHE_VAL(ac_cv_path_python_lib,[
73 if test x"${with_python_lib}" != x ; then # {
74 if test -f ${with_python_lib}/libpython.a -o -f ${with_python_lib}/libpython.${shlibext}; then # {
75 ac_cv_path_python_lib="-L`(cd ${with_python_lib}; pwd)`"
77 AC_MSG_ERROR([${with_python_lib} directory doesn't contain libpython.])
82 dnl If the path hasn't been specified, go look for it.
83 if test x"${ac_cv_path_python_lib}" = x; then # {
84 if test x"${pythonconfig}" != "x" -a x"${darwin}" = xno; then # {
85 dnl python-config gives us way to many libraries, which create nasty linking
86 dnl dependancy issue, so we strip them off here. The real dependencies are
87 dnl are taken care of by other config tests.
88 ac_cv_path_python_lib=`${pythonconfig} --libs`
90 AC_MSG_CHECKING([for libpython library])
91 for i in $libslist; do # {
92 if test -f $i/libpython.a -o -f $i/libpython.${shlibext}; then # {
93 if test ! x"$i" = x"/usr/lib" -a ! x"$i" = x"/usr/lib64"; then # {
94 ac_cv_path_python_lib="-L$i -lpython"
95 AC_MSG_RESULT(${ac_cv_path_python_lib})
98 ac_cv_path_python_lib="-lpython2.5"
104 if test x"${ac_cv_path_python_lib}" = x; then # {
110 if test x"${ac_cv_path_python_incl}" != x ; then
111 PYTHON_CFLAGS="${ac_cv_path_python_incl}"
116 if test x"${ac_cv_path_python_lib}" != x ; then
117 PYTHON_LIBS="${ac_cv_path_python_lib}"
122 if test -n "$PYTHON_LIBS"; then
123 AC_DEFINE(HAS_PYTHON, [1], [Define this if you want to enable python usage])
130 AC_PATH_PROG(PYGOBJECT_CODEGEN, pygobject-codegen-2.0, no)
131 if test x"${PYGOBJECT_CODEGEN}" = xno; then
132 AC_MSG_WARN(could not find pygobject-codegen-2.0 script)
133 AC_PATH_PROG(PYGTK_CODEGEN, pygtk-codegen-2.0, no)
134 if test x"${PYGTK_CODEGEN}" = xno; then
135 AC_MSG_ERROR(could not find pygtk-codegen-2.0 script)
139 PKG_CHECK_MODULES(PYGTK, pygtk-2.0)
141 PYGTK_DEFSDIR=`$PKG_CONFIG --variable=defsdir pygtk-2.0`
144 AC_SUBST(PYGOBJECT_CODEGEN)
145 AC_SUBST(PYGTK_CODEGEN)
146 AC_SUBST(PYGTK_DEFSDIR)
147 AC_SUBST(PYTHON_CFLAGS)
148 AC_SUBST(PYTHON_LIBS)
154 # indent-tabs-mode: nil