1 dnl Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 dnl This library is free software; you can redistribute it and/or
5 dnl modify it under the terms of the GNU Lesser General Public
6 dnl License as published by the Free Software Foundation; either
7 dnl version 2.1 of the License.
9 dnl This library 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 GNU
12 dnl Lesser General Public License for more details.
14 dnl You should have received a copy of the GNU Lesser General Public
15 dnl License along with this library; if not, write to the Free Software
16 dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 dnl See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
22 dnl This macro defines the PYTHON_EMBED_{CFLAGS,LDFLAGS,LIBS} substitutions
23 dnl that should be used when embedding the python interpreter into a program.
24 dnl AM_INIT_PYTHON_EMBED
25 AC_DEFUN(AM_INIT_PYTHON_EMBED,
26 [AC_REQUIRE([AM_PATH_PYTHON])
27 AC_REQUIRE([AM_INIT_PYEXEC_MOD])
29 AC_MSG_CHECKING(for flags used to embed python interpreter)
31 py_makefile="`$PYTHON -c '
33 print \"%s/lib/python%s/config/Makefile\"%(sys.exec_prefix, sys.version[:3])'`"
35 if test ! -f "$py_makefile"; then
36 AC_MSG_ERROR([*** Couldn't find the python config makefile. Maybe you are
37 *** missing the development portion of the python installation])
45 print \"-L%s/lib/python%s/config\" % (pre, ver),
47 print \"-lPython -lObjects -lParser\"
49 print \"-lpython\" + ver
53 py_ldflags=`sed -n -e 's/^LDFLAGS=\(.*\)/\1/p' $py_makefile`
54 py_linkforshared=`sed -n -e 's/^LINKFORSHARED=\(.*\)/\1/p' $py_makefile`
56 PYTHON_EMBED_LDFLAGS="$py_ldflags $py_linkforshared"
58 py_localmodlibs=`sed -n -e 's/^LOCALMODLIBS=\(.*\)/\1/p' $py_makefile`
59 py_basemodlibs=`sed -n -e 's/^BASEMODLIBS=\(.*\)/\1/p' $py_makefile`
60 py_other_libs=`sed -n -e 's/^LIBS=\(.*\)/\1/p' $py_makefile`
62 PYTHON_EMBED_LIBS="$py_lib $py_localmodlibs $py_basemodlibs $py_other_libs"
64 PYTHON_EMBED_CFLAGS="$PYTHON_INCLUDES"
68 AC_SUBST(PYTHON_EMBED_CFLAGS)
69 AC_SUBST(PYTHON_EMBED_LDFLAGS)
70 AC_SUBST(PYTHON_EMBED_LIBS)
73 dnl creates a config.c file, which holds the builtin module initialisation
74 dnl table for python. The first argument should be the output filename.
75 dnl The second argument gives the names of all the modules you want to build
76 dnl into the executable.
77 dnl AM_PYTHON_CREATE_CONFIG_C(CONFIG_C, MODULE ...)
78 AC_DEFUN(AM_PYTHON_CREATE_CONFIG_C,
79 [AC_REQUIRE([AM_INIT_PYTHON_EMBED])
80 AC_MSG_CHECKING(for config.c.in)
82 py_config_in="`$PYTHON -c '
84 print \"%s/lib/python%s/config/config.c.in\"%(sys.exec_prefix, sys.version[:3])'`"
86 if test ! -f "$py_config_in"; then
87 AC_MSG_ERROR([*** Couldn't find the config.c.in file. Maybe you are
88 *** missing the development portion of the python installation])
96 if test "$mod" != .; then
97 py_cnf_decls="${py_cnf_decls}extern void init$mod();$py_nl"
98 py_cnf_inits="${py_cnf_inits} {\"$mod\", init$mod},$py_nl"
102 /MARKER 1/i$py_nl$py_cnf_decls
103 /MARKER 2/i$py_nl$py_cnf_inits
105 AC_MSG_RESULT(created $1)
108 s page was automatically generated Contact Matt Wilson with any comments
109 the LXR engine written by Arne or questions about LXR on gnome.org.
110 rg Gleditsch and Per Kristian Do not contact Matt Wilson concerning
111 rmshus. any software on this site.