Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbbc3920

Browse files
committed
PL/Python should build portably now, if you can get over the fact that
there's no shared libpython. Test suite works as well. Also, add somedocumentation.
1 parent02549a2 commitbbc3920

File tree

12 files changed

+739
-499
lines changed

12 files changed

+739
-499
lines changed

‎config/python.m4

Lines changed: 74 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,88 @@
11
#
22
# Autoconf macros for configuring the build of Python extension modules
33
#
4-
# $Header: /cvsroot/pgsql/config/python.m4,v 1.1 2000/06/10 18:01:35 petere Exp $
4+
# $Header: /cvsroot/pgsql/config/python.m4,v 1.2 2001/05/12 17:49:32 petere Exp $
55
#
66

7-
#PGAC_PROG_PYTHON
7+
#PGAC_PATH_PYTHON
88
# ----------------
99
# Look for Python and set the output variable `PYTHON'
1010
# to `python' if found, empty otherwise.
11-
AC_DEFUN([PGAC_PROG_PYTHON],
12-
[AC_CHECK_PROG(PYTHON,python,python)])
11+
AC_DEFUN([PGAC_PATH_PYTHON],
12+
[AC_PATH_PROG(PYTHON,python)
13+
if test x"$PYTHON" = x""; then
14+
AC_MSG_ERROR([Python not found])
15+
fi
16+
])
17+
18+
19+
# _PGAC_CHECK_PYTHON_DIRS
20+
# -----------------------
21+
# Determine the name of various directory of a given Python installation.
22+
AC_DEFUN([_PGAC_CHECK_PYTHON_DIRS],
23+
[AC_REQUIRE([PGAC_PATH_PYTHON])
24+
python_version=`${PYTHON} -c "import sys; print sys.version[[:3]]"`
25+
python_prefix=`${PYTHON} -c "import sys; print sys.prefix"`
26+
python_execprefix=`${PYTHON} -c "import sys; print sys.exec_prefix"`
27+
python_configdir="${python_execprefix}/lib/python${python_version}/config"
28+
python_moduledir="${python_prefix}/lib/python${python_version}"
29+
python_includedir="${python_prefix}/include/python${python_version}"
30+
python_dynlibdir="${python_execprefix}/lib/python${python_version}/lib-dynload"
31+
32+
AC_SUBST(python_version)[]dnl
33+
AC_SUBST(python_prefix)[]dnl
34+
AC_SUBST(python_execprefix)[]dnl
35+
AC_SUBST(python_configdir)[]dnl
36+
AC_SUBST(python_moduledir)[]dnl
37+
AC_SUBST(python_includedir)[]dnl
38+
AC_SUBST(python_dynlibdir)[]dnl
39+
])# _PGAC_CHECK_PYTHON_DIRS
1340

1441

15-
#PGAC_PATH_PYTHONDIR
16-
# -------------------
17-
# Findsthe names of various install dirs and helper files
18-
#necessary to build a Python extension module.
42+
#PGAC_CHECK_PYTHON_MODULE_SETUP
43+
# ------------------------------
44+
# Findsthings required to build a Python extension module, in
45+
#particular the makefile.
1946
#
2047
# It would be nice if we could check whether the current setup allows
2148
# the build of the shared module. Future project.
22-
AC_DEFUN([PGAC_PATH_PYTHONDIR],
23-
[AC_REQUIRE([PGAC_PROG_PYTHON])
24-
[if test "${PYTHON+set}" = set ; then
25-
python_version=`${PYTHON} -c "import sys; print sys.version[:3]"`
26-
python_prefix=`${PYTHON} -c "import sys; print sys.prefix"`
27-
python_execprefix=`${PYTHON} -c "import sys; print sys.exec_prefix"`
28-
python_configdir="${python_execprefix}/lib/python${python_version}/config"
29-
python_moduledir="${python_prefix}/lib/python${python_version}"
30-
python_extmakefile="${python_configdir}/Makefile.pre.in"]
31-
32-
AC_MSG_CHECKING(forPythonextensionmakefile)
33-
if test -f "${python_extmakefile}" ; then
34-
AC_MSG_RESULT(found)
35-
else
36-
AC_MSG_RESULT(no)
37-
AC_MSG_ERROR(
38-
[The Python extension makefile was expected at \`${python_extmakefile}\'
39-
but does not exist. This means the Python module cannot be built automatically.])
40-
fi
41-
42-
AC_SUBST(python_version)
43-
AC_SUBST(python_prefix)
44-
AC_SUBST(python_execprefix)
45-
AC_SUBST(python_configdir)
46-
AC_SUBST(python_moduledir)
47-
AC_SUBST(python_extmakefile)
49+
AC_DEFUN([PGAC_CHECK_PYTHON_MODULE_SETUP],
50+
[AC_REQUIRE([_PGAC_CHECK_PYTHON_DIRS])
51+
AC_MSG_CHECKING([for makefile to build Python module])
52+
python_makefile_pre_in="${python_configdir}/Makefile.pre.in"
53+
54+
if test -f "${python_makefile_pre_in}" ; then
55+
AC_MSG_RESULT([${python_makefile_pre_in}])
4856
else
49-
AC_MSG_ERROR([Python not found])
50-
fi])# PGAC_PATH_PYTHONDIR
57+
AC_MSG_RESULT(no)
58+
AC_MSG_ERROR(
59+
[The file
60+
${python_makefile_pre_in}
61+
required to build Python modules does not exist. Make sure that you have
62+
a full Python installation and that this is the right location.])
63+
fi
64+
65+
AC_SUBST(python_makefile_pre_in)[]dnl
66+
])# PGAC_CHECK_PYTHON_MODULE_SETUP
67+
68+
69+
# PGAC_CHECK_PYTHON_EMBED_SETUP
70+
# -----------------------------
71+
# Courtesy of the INN 2.3.1 package...
72+
AC_DEFUN([PGAC_CHECK_PYTHON_EMBED_SETUP],
73+
[AC_REQUIRE([_PGAC_CHECK_PYTHON_DIRS])
74+
AC_MSG_CHECKING([how to link an embedded Python application])
75+
76+
_python_libs=`grep '^LIBS=' $python_configdir/Makefile | sed 's/^.*=//'`
77+
_python_libc=`grep '^LIBC=' $python_configdir/Makefile | sed 's/^.*=//'`
78+
_python_libm=`grep '^LIBM=' $python_configdir/Makefile | sed 's/^.*=//'`
79+
_python_liblocalmod=`grep '^LOCALMODLIBS=' $python_configdir/Makefile | sed 's/^.*=//'`
80+
_python_libbasemod=`grep '^BASEMODLIBS=' $python_configdir/Makefile | sed 's/^.*=//'`
81+
82+
pgac_tab="" # tab character
83+
python_libspec=`echo X"-L$python_configdir $_python_libs $_python_libc $_python_libm -lpython$python_version $_python_liblocalmod $_python_libbasemod" | sed -e 's/^X//' -e "s/[[ $pgac_tab]][[ $pgac_tab]]*/ /g"`
84+
85+
AC_MSG_RESULT([${python_libspec}])
86+
87+
AC_SUBST(python_libspec)[]dnl
88+
])# PGAC_CHECK_PYTHON_EMBED_SETUP

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp