Update the AC_PYTHON_DEVEL macro to support also Python 3.0.

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1336 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2009-02-07 11:17:00 +00:00
parent 97ae368042
commit 0ff989f891
4 changed files with 53 additions and 34 deletions

View File

@ -88,12 +88,12 @@ AC_ARG_ENABLE([visibility-support],
[enable_gcc_visibility="$enableval"], [enable_gcc_visibility="$enableval"],
[enable_gcc_visibility="no"]) [enable_gcc_visibility="no"])
AC_MSG_CHECKING([whether to use new GCC visibility attributes]) AC_MSG_CHECKING([whether to use new GCC visibility attributes])
AC_MSG_RESULT([$enable_gcc_visibility])
if test "x$enable_gcc_visibility" = "xno"; then if test "x$enable_gcc_visibility" = "xno"; then
CPPFLAGS="${CPPFLAGS} -DDISABLE_VISIBILITY_SUPPORT" CPPFLAGS="${CPPFLAGS} -DDISABLE_VISIBILITY_SUPPORT"
else else
AC_CHECK_CXXFLAG([CXXFLAGS], [fvisibility-inlines-hidden]) AC_CHECK_CXXFLAG([CXXFLAGS], [fvisibility-inlines-hidden])
fi fi
AC_MSG_RESULT([$enable_gcc_visibility])
AC_PROG_INSTALL AC_PROG_INSTALL

View File

@ -63,7 +63,9 @@ AC_CHECK_CXXFLAG([CXXFLAGS], [pedantic])
AC_CHECK_CXXFLAG([CXXFLAGS], [Wextra]) AC_CHECK_CXXFLAG([CXXFLAGS], [Wextra])
AC_CHECK_CXXFLAG([CXXFLAGS], [Wno-long-long]) AC_CHECK_CXXFLAG([CXXFLAGS], [Wno-long-long])
AC_CHECK_CXXFLAG([CXXFLAGS], [fvisibility-inlines-hidden]) AC_CHECK_CXXFLAG([CXXFLAGS], [fvisibility-inlines-hidden])
AC_CHECK_LDFLAG([LDFLAGS], [--as-needed])
dnl Python3.0 doesn't seem to like this (in 2009!!)
dnl AC_CHECK_LDFLAG([LDFLAGS], [--as-needed])
dnl see if we've to enable debug flags dnl see if we've to enable debug flags
AC_ARG_ENABLE([debug], AC_ARG_ENABLE([debug],
@ -86,12 +88,12 @@ AC_ARG_ENABLE([visibility-support],
[enable_gcc_visibility="$enableval"], [enable_gcc_visibility="$enableval"],
[enable_gcc_visibility="no"]) [enable_gcc_visibility="no"])
AC_MSG_CHECKING([whether to use new GCC visibility attributes]) AC_MSG_CHECKING([whether to use new GCC visibility attributes])
AC_MSG_RESULT([$enable_gcc_visibility])
if test "x$enable_gcc_visibility" = "xno"; then if test "x$enable_gcc_visibility" = "xno"; then
CPPFLAGS="${CPPFLAGS} -DDISABLE_VISIBILITY_SUPPORT" CPPFLAGS="${CPPFLAGS} -DDISABLE_VISIBILITY_SUPPORT"
else else
AC_CHECK_CXXFLAG([CXXFLAGS], [fvisibility-inlines-hidden]) AC_CHECK_CXXFLAG([CXXFLAGS], [fvisibility-inlines-hidden])
fi fi
AC_MSG_RESULT([$enable_gcc_visibility])
AC_PROG_INSTALL AC_PROG_INSTALL

View File

@ -32,7 +32,7 @@ dnl @author Rafael Laboissiere <laboissiere@psy.mpg.de>
dnl @author Andrew Collier <colliera@nu.ac.za> dnl @author Andrew Collier <colliera@nu.ac.za>
dnl @author Matteo Settenvini <matteo@member.fsf.org> dnl @author Matteo Settenvini <matteo@member.fsf.org>
dnl @author Horst Knorr <hk_classes@knoda.org> dnl @author Horst Knorr <hk_classes@knoda.org>
dnl @version 2008-01-16 dnl @version 2009-02-07
dnl @license GPLWithACException dnl @license GPLWithACException
AC_DEFUN([AC_PYTHON_DEVEL],[ AC_DEFUN([AC_PYTHON_DEVEL],[
@ -54,9 +54,9 @@ AC_DEFUN([AC_PYTHON_DEVEL],[
# Check for a version of Python >= 2.1.0 # Check for a version of Python >= 2.1.0
# #
AC_MSG_CHECKING([for a version of Python >= '2.1.0']) AC_MSG_CHECKING([for a version of Python >= '2.1.0'])
ac_supports_python_ver=`$PYTHON -c "import sys, string; \ ac_supports_python_ver=`$PYTHON -c "import sys; \
ver = string.split(sys.version)[[0]]; \ ver = sys.version.split ()[[0]]; \
print ver >= '2.1.0'"` print (ver >= '2.1.0')"`
if test "$ac_supports_python_ver" != "True"; then if test "$ac_supports_python_ver" != "True"; then
if test -z "$PYTHON_NOVERSIONCHECK"; then if test -z "$PYTHON_NOVERSIONCHECK"; then
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
@ -81,9 +81,9 @@ to something else than an empty string.
# #
if test -n "$1"; then if test -n "$1"; then
AC_MSG_CHECKING([for a version of Python $1]) AC_MSG_CHECKING([for a version of Python $1])
ac_supports_python_ver=`$PYTHON -c "import sys, string; \ ac_supports_python_ver=`$PYTHON -c "import sys; \
ver = string.split(sys.version)[[0]]; \ ver = sys.version.split ()[[0]]; \
print ver $1"` print (ver $1)"`
if test "$ac_supports_python_ver" = "True"; then if test "$ac_supports_python_ver" = "True"; then
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
else else
@ -118,7 +118,7 @@ $ac_distutils_result])
AC_MSG_CHECKING([for Python include path]) AC_MSG_CHECKING([for Python include path])
if test -z "$PYTHON_CPPFLAGS"; then if test -z "$PYTHON_CPPFLAGS"; then
python_path=`$PYTHON -c "import distutils.sysconfig; \ python_path=`$PYTHON -c "import distutils.sysconfig; \
print distutils.sysconfig.get_python_inc();"` print (distutils.sysconfig.get_python_inc ());"`
if test -n "${python_path}"; then if test -n "${python_path}"; then
python_path="-I$python_path" python_path="-I$python_path"
fi fi
@ -134,36 +134,53 @@ $ac_distutils_result])
if test -z "$PYTHON_LDFLAGS"; then if test -z "$PYTHON_LDFLAGS"; then
# (makes two attempts to ensure we've got a version number # (makes two attempts to ensure we've got a version number
# from the interpreter) # from the interpreter)
ac_python_version=`$PYTHON -c "from distutils.sysconfig import *; \ ac_python_version=`cat<<EOD | $PYTHON -
from string import join; \
print join(get_config_vars('VERSION'))"` # join all versioning strings, on some systems
if test "$ac_python_version" = "[None]"; then # major/minor numbers could be in different list elements
from distutils.sysconfig import *
ret = ''
for e in get_config_vars ('VERSION'):
if (e != None):
ret += e
print (ret)
EOD`
if test -z "$ac_python_version"; then
if test -n "$PYTHON_VERSION"; then if test -n "$PYTHON_VERSION"; then
ac_python_version=$PYTHON_VERSION ac_python_version=$PYTHON_VERSION
else else
ac_python_version=`$PYTHON -c "import sys; \ ac_python_version=`$PYTHON -c "import sys; \
print sys.version[[:3]]"` print (sys.version[[:3]])"`
fi fi
fi fi
# Make the versioning information available to the compiler
AC_DEFINE_UNQUOTED([HAVE_PYTHON], ["$ac_python_version"],
[If available, contains the Python version number currently in use.])
# First, the library directory: # First, the library directory:
ac_python_libdir=`$PYTHON -c \ ac_python_libdir=`cat<<EOD | $PYTHON -
"import distutils.sysconfig,string; \
print string.join(filter(None, \ # There should be only one
distutils.sysconfig.get_config_vars('LIBDIR')))"` import distutils.sysconfig
for e in distutils.sysconfig.get_config_vars ('LIBDIR'):
if e != None:
print (e)
break
EOD`
# Before checking for libpythonX.Y, we need to know # Before checking for libpythonX.Y, we need to know
# the extension the OS we're on uses for libraries: # the extension the OS we're on uses for libraries
# (we take the first one, if there's more than one fix me!):
ac_python_soext=`$PYTHON -c \ ac_python_soext=`$PYTHON -c \
"import distutils.sysconfig, string; \ "import distutils.sysconfig; \
print string.join(filter(None, \ print (distutils.sysconfig.get_config_vars('SO')[[0]])"`
distutils.sysconfig.get_config_vars('SO')))"`
# Now, for the library: # Now, for the library:
ac_python_soname=`$PYTHON -c \ ac_python_soname=`$PYTHON -c \
"import distutils.sysconfig,string; \ "import distutils.sysconfig; \
print string.join(filter(None, \ print (distutils.sysconfig.get_config_vars('LDLIBRARY')[[0]])"`
distutils.sysconfig.get_config_vars('LDLIBRARY')))"`
# Strip away extension from the end to canonicalize its name: # Strip away extension from the end to canonicalize its name:
ac_python_library=`echo "$ac_python_soname" | sed "s/${ac_python_soext}$//"` ac_python_library=`echo "$ac_python_soname" | sed "s/${ac_python_soext}$//"`
@ -183,7 +200,7 @@ $ac_distutils_result])
ac_python_libdir=`$PYTHON -c \ ac_python_libdir=`$PYTHON -c \
"from distutils.sysconfig import get_python_lib as f; \ "from distutils.sysconfig import get_python_lib as f; \
import os; \ import os; \
print os.path.join(f(plat_specific=1,standard_lib=1),'config');"` print (os.path.join(f(plat_specific=1, standard_lib=1), 'config'));"`
PYTHON_LDFLAGS="-L$ac_python_libdir -lpython$ac_python_version" PYTHON_LDFLAGS="-L$ac_python_libdir -lpython$ac_python_version"
fi fi
@ -203,7 +220,7 @@ $ac_distutils_result])
AC_MSG_CHECKING([for Python site-packages path]) AC_MSG_CHECKING([for Python site-packages path])
if test -z "$PYTHON_SITE_PKG"; then if test -z "$PYTHON_SITE_PKG"; then
PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \ PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \
print distutils.sysconfig.get_python_lib(0,0);"` print (distutils.sysconfig.get_python_lib(0,0));"`
fi fi
AC_MSG_RESULT([$PYTHON_SITE_PKG]) AC_MSG_RESULT([$PYTHON_SITE_PKG])
AC_SUBST([PYTHON_SITE_PKG]) AC_SUBST([PYTHON_SITE_PKG])
@ -215,7 +232,7 @@ $ac_distutils_result])
if test -z "$PYTHON_EXTRA_LIBS"; then if test -z "$PYTHON_EXTRA_LIBS"; then
PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \ PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
conf = distutils.sysconfig.get_config_var; \ conf = distutils.sysconfig.get_config_var; \
print conf('LOCALMODLIBS'), conf('LIBS')"` print (conf('LOCALMODLIBS') + ' ' + conf('LIBS'))"`
fi fi
AC_MSG_RESULT([$PYTHON_EXTRA_LIBS]) AC_MSG_RESULT([$PYTHON_EXTRA_LIBS])
AC_SUBST(PYTHON_EXTRA_LIBS) AC_SUBST(PYTHON_EXTRA_LIBS)
@ -227,7 +244,7 @@ $ac_distutils_result])
if test -z "$PYTHON_EXTRA_LDFLAGS"; then if test -z "$PYTHON_EXTRA_LDFLAGS"; then
PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \ PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \
conf = distutils.sysconfig.get_config_var; \ conf = distutils.sysconfig.get_config_var; \
print conf('LINKFORSHARED')"` print (conf('LINKFORSHARED'))"`
fi fi
AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS]) AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS])
AC_SUBST(PYTHON_EXTRA_LDFLAGS) AC_SUBST(PYTHON_EXTRA_LDFLAGS)
@ -237,7 +254,7 @@ $ac_distutils_result])
# #
AC_MSG_CHECKING([consistency of all components of python development environment]) AC_MSG_CHECKING([consistency of all components of python development environment])
# save current global flags # save current global flags
LIBS="$ac_save_LIBS $PYTHON_LDFLAGS" LIBS="$ac_save_LIBS $PYTHON_LDFLAGS $PYTHON_EXTRA_LDFLAGS $PYTHON_EXTRA_LIBS"
CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS" CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS"
AC_LANG_PUSH([C]) AC_LANG_PUSH([C])
AC_LINK_IFELSE([ AC_LINK_IFELSE([

View File

@ -85,12 +85,12 @@ AC_ARG_ENABLE([visibility-support],
[enable_gcc_visibility="$enableval"], [enable_gcc_visibility="$enableval"],
[enable_gcc_visibility="no"]) [enable_gcc_visibility="no"])
AC_MSG_CHECKING([whether to use new GCC visibility attributes]) AC_MSG_CHECKING([whether to use new GCC visibility attributes])
AC_MSG_RESULT([$enable_gcc_visibility])
if test "x$enable_gcc_visibility" = "xno"; then if test "x$enable_gcc_visibility" = "xno"; then
CPPFLAGS="${CPPFLAGS} -DDISABLE_VISIBILITY_SUPPORT" CPPFLAGS="${CPPFLAGS} -DDISABLE_VISIBILITY_SUPPORT"
else else
AC_CHECK_CXXFLAG([CXXFLAGS], [fvisibility-inlines-hidden]) AC_CHECK_CXXFLAG([CXXFLAGS], [fvisibility-inlines-hidden])
fi fi
AC_MSG_RESULT([$enable_gcc_visibility])
AC_PROG_INSTALL AC_PROG_INSTALL