2000-06-11 02:02:12 +08:00
|
|
|
#
|
|
|
|
# Autoconf macros for configuring the build of Python extension modules
|
|
|
|
#
|
2004-10-06 17:20:41 +08:00
|
|
|
# $PostgreSQL: pgsql/config/python.m4,v 1.9 2004/10/06 09:20:40 momjian Exp $
|
2000-06-11 02:02:12 +08:00
|
|
|
#
|
|
|
|
|
2001-05-13 01:49:32 +08:00
|
|
|
# PGAC_PATH_PYTHON
|
2000-06-11 02:02:12 +08:00
|
|
|
# ----------------
|
2002-03-30 01:32:55 +08:00
|
|
|
# Look for Python and set the output variable 'PYTHON'
|
|
|
|
# to 'python' if found, empty otherwise.
|
2001-05-13 01:49:32 +08:00
|
|
|
AC_DEFUN([PGAC_PATH_PYTHON],
|
|
|
|
[AC_PATH_PROG(PYTHON, python)
|
|
|
|
if test x"$PYTHON" = x""; then
|
|
|
|
AC_MSG_ERROR([Python not found])
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
# _PGAC_CHECK_PYTHON_DIRS
|
|
|
|
# -----------------------
|
|
|
|
# Determine the name of various directory of a given Python installation.
|
|
|
|
AC_DEFUN([_PGAC_CHECK_PYTHON_DIRS],
|
|
|
|
[AC_REQUIRE([PGAC_PATH_PYTHON])
|
2004-09-17 07:30:30 +08:00
|
|
|
AC_MSG_CHECKING([for Python distutils module])
|
|
|
|
if "${PYTHON}" 2>&- -c 'import distutils'
|
|
|
|
then
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
AC_MSG_ERROR([distutils module not found])
|
|
|
|
fi
|
2001-07-11 00:33:02 +08:00
|
|
|
AC_MSG_CHECKING([Python installation directories])
|
2001-05-13 01:49:32 +08:00
|
|
|
python_version=`${PYTHON} -c "import sys; print sys.version[[:3]]"`
|
|
|
|
python_prefix=`${PYTHON} -c "import sys; print sys.prefix"`
|
|
|
|
python_execprefix=`${PYTHON} -c "import sys; print sys.exec_prefix"`
|
2004-09-17 07:30:30 +08:00
|
|
|
python_configdir=`${PYTHON} -c "from distutils.sysconfig import get_python_lib as f; import os; print os.path.join(f(plat_specific=1,standard_lib=1),'config')"`
|
2004-10-06 17:20:41 +08:00
|
|
|
python_includespec=`${PYTHON} -c "import distutils.sysconfig; print '-I'+distutils.sysconfig.get_python_inc()"`
|
2001-05-13 01:49:32 +08:00
|
|
|
|
|
|
|
AC_SUBST(python_prefix)[]dnl
|
|
|
|
AC_SUBST(python_execprefix)[]dnl
|
|
|
|
AC_SUBST(python_configdir)[]dnl
|
2001-07-11 00:33:02 +08:00
|
|
|
AC_SUBST(python_includespec)[]dnl
|
2004-10-06 17:20:41 +08:00
|
|
|
AC_SUBST(python_version)[]dnl
|
2001-07-11 00:33:02 +08:00
|
|
|
# This should be enough of a message.
|
|
|
|
if test "$python_prefix" != "$python_execprefix"; then
|
|
|
|
AC_MSG_RESULT([$python_prefix/lib/python${python_version} and $python_execprefix/lib/python${python_version}])
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([$python_prefix/lib/python${python_version}])
|
|
|
|
fi
|
2001-05-13 01:49:32 +08:00
|
|
|
])# _PGAC_CHECK_PYTHON_DIRS
|
2000-06-11 02:02:12 +08:00
|
|
|
|
|
|
|
|
2001-05-13 01:49:32 +08:00
|
|
|
# PGAC_CHECK_PYTHON_EMBED_SETUP
|
|
|
|
# -----------------------------
|
|
|
|
AC_DEFUN([PGAC_CHECK_PYTHON_EMBED_SETUP],
|
|
|
|
[AC_REQUIRE([_PGAC_CHECK_PYTHON_DIRS])
|
|
|
|
AC_MSG_CHECKING([how to link an embedded Python application])
|
|
|
|
|
2004-10-06 17:20:41 +08:00
|
|
|
python_libspec=`${PYTHON} -c "import distutils.sysconfig,string;print string.join(filter(None,distutils.sysconfig.get_config_vars('LIBS','LIBC','LIBM','LOCALMODLIBS','BASEMODLIBS')))"`
|
2001-05-13 01:49:32 +08:00
|
|
|
|
|
|
|
AC_MSG_RESULT([${python_libspec}])
|
|
|
|
|
|
|
|
AC_SUBST(python_libspec)[]dnl
|
|
|
|
])# PGAC_CHECK_PYTHON_EMBED_SETUP
|