1 dnl Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 dnl Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 dnl This library is free software; you can redistribute it and/or
7 dnl modify it under the terms of the GNU Lesser General Public
8 dnl License as published by the Free Software Foundation; either
9 dnl version 2.1 of the License.
11 dnl This library is distributed in the hope that it will be useful,
12 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
13 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 dnl Lesser General Public License for more details.
16 dnl You should have received a copy of the GNU Lesser General Public
17 dnl License along with this library; if not, write to the Free Software
18 dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
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
26 AC_DEFUN([AM_INIT_PYTHON_EMBED],
27 [AC_REQUIRE([AM_PATH_PYTHON])
28 AC_REQUIRE([AM_INIT_PYEXEC_MOD])
30 AC_MSG_CHECKING(for flags used to embed python interpreter)
32 py_makefile="`$PYTHON -c '
34 print \"%s/lib/python%s/config/Makefile\"%(sys.exec_prefix, sys.version[:3])'`"
36 if test ! -f "$py_makefile"; then
37 AC_MSG_ERROR([*** Couldn't find the python config makefile. Maybe you are
38 *** missing the development portion of the python installation])
46 print \"-L%s/lib/python%s/config\" % (pre, ver),
48 print \"-lPython -lObjects -lParser\"
50 print \"-lpython\" + ver
54 py_ldflags=`sed -n -e 's/^LDFLAGS=\(.*\)/\1/p' $py_makefile`
55 py_linkforshared=`sed -n -e 's/^LINKFORSHARED=\(.*\)/\1/p' $py_makefile`
57 PYTHON_EMBED_LDFLAGS="$py_ldflags $py_linkforshared"
59 py_localmodlibs=`sed -n -e 's/^LOCALMODLIBS=\(.*\)/\1/p' $py_makefile`
60 py_basemodlibs=`sed -n -e 's/^BASEMODLIBS=\(.*\)/\1/p' $py_makefile`
61 py_other_libs=`sed -n -e 's/^LIBS=\(.*\)/\1/p' $py_makefile`
63 PYTHON_EMBED_LIBS="$py_lib $py_localmodlibs $py_basemodlibs $py_other_libs"
65 PYTHON_EMBED_CFLAGS="$PYTHON_INCLUDES"
69 AC_SUBST(PYTHON_EMBED_CFLAGS)
70 AC_SUBST(PYTHON_EMBED_LDFLAGS)
71 AC_SUBST(PYTHON_EMBED_LIBS)
74 dnl creates a config.c file, which holds the builtin module initialisation
75 dnl table for python. The first argument should be the output filename.
76 dnl The second argument gives the names of all the modules you want to build
77 dnl into the executable.
78 dnl AM_PYTHON_CREATE_CONFIG_C(CONFIG_C, MODULE ...)
79 AC_DEFUN([AM_PYTHON_CREATE_CONFIG_C],
80 [AC_REQUIRE([AM_INIT_PYTHON_EMBED])
81 AC_MSG_CHECKING(for config.c.in)
83 py_config_in="`$PYTHON -c '
85 print \"%s/lib/python%s/config/config.c.in\"%(sys.exec_prefix, sys.version[:3])'`"
87 if test ! -f "$py_config_in"; then
88 AC_MSG_ERROR([*** Couldn't find the config.c.in file. Maybe you are
89 *** missing the development portion of the python installation])
97 if test "$mod" != .; then
98 py_cnf_decls="${py_cnf_decls}extern void init$mod();$py_nl"
99 py_cnf_inits="${py_cnf_inits} {\"$mod\", init$mod},$py_nl"
103 /MARKER 1/i$py_nl$py_cnf_decls
104 /MARKER 2/i$py_nl$py_cnf_inits
106 AC_MSG_RESULT(created $1)
109 s page was automatically generated Contact Matt Wilson with any comments
110 the LXR engine written by Arne or questions about LXR on gnome.org.
111 rg Gleditsch and Per Kristian Do not contact Matt Wilson concerning
112 rmshus. any software on this site.