1 dnl This macro defines the PYTHON_EMBED_{CFLAGS,LDFLAGS,LIBS} substitutions
2 dnl that should be used when embedding the python interpreter into a program.
3 dnl AM_INIT_PYTHON_EMBED
4 AC_DEFUN(AM_INIT_PYTHON_EMBED,
5 [AC_REQUIRE([AM_PATH_PYTHON])
6 AC_REQUIRE([AM_INIT_PYEXEC_MOD])
8 AC_MSG_CHECKING(for flags used to embed python interpreter)
10 py_makefile="`$PYTHON -c '
12 print \"%s/lib/python%s/config/Makefile\"%(sys.exec_prefix, sys.version[:3])'`"
14 if test ! -f "$py_makefile"; then
15 AC_MSG_ERROR([*** Couldn't find the python config makefile. Maybe you are
16 *** missing the development portion of the python installation])
24 print \"-L%s/lib/python%s/config\" % (pre, ver),
26 print \"-lPython -lObjects -lParser\"
28 print \"-lpython\" + ver
32 py_ldflags=`sed -n -e 's/^LDFLAGS=\(.*\)/\1/p' $py_makefile`
33 py_linkforshared=`sed -n -e 's/^LINKFORSHARED=\(.*\)/\1/p' $py_makefile`
35 PYTHON_EMBED_LDFLAGS="$py_ldflags $py_linkforshared"
37 py_localmodlibs=`sed -n -e 's/^LOCALMODLIBS=\(.*\)/\1/p' $py_makefile`
38 py_basemodlibs=`sed -n -e 's/^BASEMODLIBS=\(.*\)/\1/p' $py_makefile`
39 py_other_libs=`sed -n -e 's/^LIBS=\(.*\)/\1/p' $py_makefile`
41 PYTHON_EMBED_LIBS="$py_lib $py_localmodlibs $py_basemodlibs $py_other_libs"
43 PYTHON_EMBED_CFLAGS="$PYTHON_INCLUDES"
47 AC_SUBST(PYTHON_EMBED_CFLAGS)
48 AC_SUBST(PYTHON_EMBED_LDFLAGS)
49 AC_SUBST(PYTHON_EMBED_LIBS)
52 dnl creates a config.c file, which holds the builtin module initialisation
53 dnl table for python. The first argument should be the output filename.
54 dnl The second argument gives the names of all the modules you want to build
55 dnl into the executable.
56 dnl AM_PYTHON_CREATE_CONFIG_C(CONFIG_C, MODULE ...)
57 AC_DEFUN(AM_PYTHON_CREATE_CONFIG_C,
58 [AC_REQUIRE([AM_INIT_PYTHON_EMBED])
59 AC_MSG_CHECKING(for config.c.in)
61 py_config_in="`$PYTHON -c '
63 print \"%s/lib/python%s/config/config.c.in\"%(sys.exec_prefix, sys.version[:3])'`"
65 if test ! -f "$py_config_in"; then
66 AC_MSG_ERROR([*** Couldn't find the config.c.in file. Maybe you are
67 *** missing the development portion of the python installation])
75 if test "$mod" != .; then
76 py_cnf_decls="${py_cnf_decls}extern void init$mod();$py_nl"
77 py_cnf_inits="${py_cnf_inits} {\"$mod\", init$mod},$py_nl"
81 /MARKER 1/i$py_nl$py_cnf_decls
82 /MARKER 2/i$py_nl$py_cnf_inits
84 AC_MSG_RESULT(created $1)
87 s page was automatically generated Contact Matt Wilson with any comments
88 the LXR engine written by Arne or questions about LXR on gnome.org.
89 rg Gleditsch and Per Kristian Do not contact Matt Wilson concerning
90 rmshus. any software on this site.