summaryrefslogtreecommitdiffstats
path: root/meta-extras/packages/python/python-pygtk2/acinclude.m4
diff options
context:
space:
mode:
Diffstat (limited to 'meta-extras/packages/python/python-pygtk2/acinclude.m4')
-rw-r--r--meta-extras/packages/python/python-pygtk2/acinclude.m484
1 files changed, 84 insertions, 0 deletions
diff --git a/meta-extras/packages/python/python-pygtk2/acinclude.m4 b/meta-extras/packages/python/python-pygtk2/acinclude.m4
new file mode 100644
index 0000000000..eec3758afc
--- /dev/null
+++ b/meta-extras/packages/python/python-pygtk2/acinclude.m4
@@ -0,0 +1,84 @@
1## this one is commonly used with AM_PATH_PYTHONDIR ...
2dnl AM_CHECK_PYMOD(MODNAME [,SYMBOL [,ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]]])
3dnl Check if a module containing a given symbol is visible to python.
4AC_DEFUN(AM_CHECK_PYMOD,
5[AC_REQUIRE([AM_PATH_PYTHON])
6py_mod_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'`
7AC_MSG_CHECKING(for ifelse([$2],[],,[$2 in ])python module $1)
8AC_CACHE_VAL(py_cv_mod_$py_mod_var, [
9ifelse([$2],[], [prog="
10import sys
11try:
12 import $1
13except ImportError:
14 sys.exit(1)
15except:
16 sys.exit(0)
17sys.exit(0)"], [prog="
18import $1
19$1.$2"])
20if $PYTHON -c "$prog" 1>&AC_FD_CC 2>&AC_FD_CC
21 then
22 eval "py_cv_mod_$py_mod_var=yes"
23 else
24 eval "py_cv_mod_$py_mod_var=no"
25 fi
26])
27py_val=`eval "echo \`echo '$py_cv_mod_'$py_mod_var\`"`
28if test "x$py_val" != xno; then
29 AC_MSG_RESULT(yes)
30 ifelse([$3], [],, [$3
31])dnl
32else
33 AC_MSG_RESULT(no)
34 ifelse([$4], [],, [$4
35])dnl
36fi
37])
38
39dnl a macro to check for ability to create python extensions
40dnl AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
41dnl function also defines PYTHON_INCLUDES
42AC_DEFUN([AM_CHECK_PYTHON_HEADERS],
43[AC_REQUIRE([AM_PATH_PYTHON])
44AC_MSG_CHECKING(for headers required to compile python extensions)
45dnl deduce PYTHON_INCLUDES
46py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
47py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
48PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
49if test "$py_prefix" != "$py_exec_prefix"; then
50 PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
51fi
52AC_SUBST(PYTHON_INCLUDES)
53dnl check if the headers exist:
54save_CPPFLAGS="$CPPFLAGS"
55CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
56AC_TRY_CPP([#include <Python.h>],dnl
57[AC_MSG_RESULT(found)
58$1],dnl
59[AC_MSG_RESULT(not found)
60$2])
61CPPFLAGS="$save_CPPFLAGS"
62])
63
64dnl
65dnl JH_ADD_CFLAG(FLAG)
66dnl checks whether the C compiler supports the given flag, and if so, adds
67dnl it to $CFLAGS. If the flag is already present in the list, then the
68dnl check is not performed.
69AC_DEFUN([JH_ADD_CFLAG],
70[
71case " $CFLAGS " in
72*@<:@\ \ @:>@$1@<:@\ \ @:>@*)
73 ;;
74*)
75 save_CFLAGS="$CFLAGS"
76 CFLAGS="$CFLAGS $1"
77 AC_MSG_CHECKING([whether [$]CC understands $1])
78 AC_TRY_COMPILE([], [], [jh_has_option=yes], [jh_has_option=no])
79 AC_MSG_RESULT($jh_has_option)
80 if test $jh_has_option = no; then
81 CFLAGS="$save_CFLAGS"
82 fi
83 ;;
84esac])