1 dnl Copyright (C) 2007-2020 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, or (at your option) any later version.
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
23 dnl This macro defines the PYTHON_EMBED_{CFLAGS,LDFLAGS,LIBS} substitutions
24 dnl that should be used when embedding the python interpreter into a program.
25 dnl AM_INIT_PYTHON_EMBED
27 AC_DEFUN([AM_INIT_PYTHON_EMBED],
28 [AC_REQUIRE([AM_PATH_PYTHON])
29 AC_REQUIRE([AM_INIT_PYEXEC_MOD])
31 AC_MSG_CHECKING(for flags used to embed python interpreter)
33 py_makefile="`$PYTHON -c '
35 print(\"%s/lib/python%s/config/Makefile\"%(sys.exec_prefix, sys.version[:3]))'`"
37 if test ! -f "$py_makefile"; then
38 AC_MSG_ERROR([*** Couldn't find the python config makefile. Maybe you are
39 *** missing the development portion of the python installation])
47 print(\"-L%s/lib/python%s/config\" % (pre, ver)),
49 print(\"-lPython -lObjects -lParser\")
51 print(\"-lpython\" + ver)
55 py_ldflags=`sed -n -e 's/^LDFLAGS=\(.*\)/\1/p' $py_makefile`
56 py_linkforshared=`sed -n -e 's/^LINKFORSHARED=\(.*\)/\1/p' $py_makefile`
58 PYTHON_EMBED_LDFLAGS="$py_ldflags $py_linkforshared"
60 py_localmodlibs=`sed -n -e 's/^LOCALMODLIBS=\(.*\)/\1/p' $py_makefile`
61 py_basemodlibs=`sed -n -e 's/^BASEMODLIBS=\(.*\)/\1/p' $py_makefile`
62 py_other_libs=`sed -n -e 's/^LIBS=\(.*\)/\1/p' $py_makefile`
64 PYTHON_EMBED_LIBS="$py_lib $py_localmodlibs $py_basemodlibs $py_other_libs"
66 PYTHON_EMBED_CFLAGS="$PYTHON_INCLUDES"
70 AC_SUBST(PYTHON_EMBED_CFLAGS)
71 AC_SUBST(PYTHON_EMBED_LDFLAGS)
72 AC_SUBST(PYTHON_EMBED_LIBS)
75 dnl creates a config.c file, which holds the builtin module initialisation
76 dnl table for python. The first argument should be the output filename.
77 dnl The second argument gives the names of all the modules you want to build
78 dnl into the executable.
79 dnl AM_PYTHON_CREATE_CONFIG_C(CONFIG_C, MODULE ...)
80 AC_DEFUN([AM_PYTHON_CREATE_CONFIG_C],
81 [AC_REQUIRE([AM_INIT_PYTHON_EMBED])
82 AC_MSG_CHECKING(for config.c.in)
84 py_config_in="`$PYTHON -c '
86 print(\"%s/lib/python%s/config/config.c.in\"%(sys.exec_prefix, sys.version[:3]))'`"
88 if test ! -f "$py_config_in"; then
89 AC_MSG_ERROR([*** Couldn't find the config.c.in file. Maybe you are
90 *** missing the development portion of the python installation])
98 if test "$mod" != .; then
99 py_cnf_decls="${py_cnf_decls}extern void init$mod();$py_nl"
100 py_cnf_inits="${py_cnf_inits} {\"$mod\", init$mod},$py_nl"
104 /MARKER 1/i$py_nl$py_cnf_decls
105 /MARKER 2/i$py_nl$py_cnf_inits
107 AC_MSG_RESULT(created $1)
110 s page was automatically generated Contact Matt Wilson with any comments
111 the LXR engine written by Arne or questions about LXR on gnome.org.
112 rg Gleditsch and Per Kristian Do not contact Matt Wilson concerning
113 rmshus. any software on this site.