10ea1a209SEike Rathke# generated automatically by aclocal 1.11.1 -*- Autoconf -*- 2cdf0e10cSrcweir 30ea1a209SEike Rathke# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 40ea1a209SEike Rathke# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. 5cdf0e10cSrcweir# This file is free software; the Free Software Foundation 6cdf0e10cSrcweir# gives unlimited permission to copy and/or distribute it, 7cdf0e10cSrcweir# with or without modifications, as long as this notice is preserved. 8cdf0e10cSrcweir 9cdf0e10cSrcweir# This program is distributed in the hope that it will be useful, 10cdf0e10cSrcweir# but WITHOUT ANY WARRANTY, to the extent permitted by law; without 11cdf0e10cSrcweir# even the implied warranty of MERCHANTABILITY or FITNESS FOR A 12cdf0e10cSrcweir# PARTICULAR PURPOSE. 13cdf0e10cSrcweir 140ea1a209SEike Rathke# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- 150ea1a209SEike Rathke# serial 1 (pkg-config-0.24) 160ea1a209SEike Rathke# 170ea1a209SEike Rathke# Copyright © 2004 Scott James Remnant <scott@netsplit.com>. 180ea1a209SEike Rathke# 19cdf0e10cSrcweir# This program is free software; you can redistribute it and/or modify 20cdf0e10cSrcweir# it under the terms of the GNU General Public License as published by 210ea1a209SEike Rathke# the Free Software Foundation; either version 2 of the License, or 220ea1a209SEike Rathke# (at your option) any later version. 230ea1a209SEike Rathke# 240ea1a209SEike Rathke# This program is distributed in the hope that it will be useful, but 250ea1a209SEike Rathke# WITHOUT ANY WARRANTY; without even the implied warranty of 260ea1a209SEike Rathke# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 270ea1a209SEike Rathke# General Public License for more details. 280ea1a209SEike Rathke# 29cdf0e10cSrcweir# You should have received a copy of the GNU General Public License 30cdf0e10cSrcweir# along with this program; if not, write to the Free Software 310ea1a209SEike Rathke# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 320ea1a209SEike Rathke# 330ea1a209SEike Rathke# As a special exception to the GNU General Public License, if you 340ea1a209SEike Rathke# distribute this file as part of a program that contains a 350ea1a209SEike Rathke# configuration script generated by Autoconf, you may include it under 360ea1a209SEike Rathke# the same distribution terms that you use for the rest of that program. 370ea1a209SEike Rathke 380ea1a209SEike Rathke# PKG_PROG_PKG_CONFIG([MIN-VERSION]) 390ea1a209SEike Rathke# ---------------------------------- 400ea1a209SEike RathkeAC_DEFUN([PKG_PROG_PKG_CONFIG], 410ea1a209SEike Rathke[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) 420ea1a209SEike Rathkem4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) 430ea1a209SEike Rathkem4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) 440ea1a209SEike RathkeAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) 450ea1a209SEike RathkeAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) 460ea1a209SEike RathkeAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) 470ea1a209SEike Rathke 480ea1a209SEike Rathkeif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then 490ea1a209SEike Rathke AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) 500ea1a209SEike Rathkefi 510ea1a209SEike Rathkeif test -n "$PKG_CONFIG"; then 520ea1a209SEike Rathke _pkg_min_version=m4_default([$1], [0.9.0]) 530ea1a209SEike Rathke AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) 540ea1a209SEike Rathke if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then 550ea1a209SEike Rathke AC_MSG_RESULT([yes]) 560ea1a209SEike Rathke else 570ea1a209SEike Rathke AC_MSG_RESULT([no]) 580ea1a209SEike Rathke PKG_CONFIG="" 590ea1a209SEike Rathke fi 600ea1a209SEike Rathkefi[]dnl 610ea1a209SEike Rathke])# PKG_PROG_PKG_CONFIG 620ea1a209SEike Rathke 630ea1a209SEike Rathke# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) 640ea1a209SEike Rathke# 650ea1a209SEike Rathke# Check to see whether a particular set of modules exists. Similar 660ea1a209SEike Rathke# to PKG_CHECK_MODULES(), but does not set variables or print errors. 670ea1a209SEike Rathke# 680ea1a209SEike Rathke# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) 69*07a3d7f1SPedro Giffuni# only at the first occurrence in configure.ac, so if the first place 700ea1a209SEike Rathke# it's called might be skipped (such as if it is within an "if", you 710ea1a209SEike Rathke# have to call PKG_CHECK_EXISTS manually 720ea1a209SEike Rathke# -------------------------------------------------------------- 730ea1a209SEike RathkeAC_DEFUN([PKG_CHECK_EXISTS], 740ea1a209SEike Rathke[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl 750ea1a209SEike Rathkeif test -n "$PKG_CONFIG" && \ 760ea1a209SEike Rathke AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then 770ea1a209SEike Rathke m4_default([$2], [:]) 780ea1a209SEike Rathkem4_ifvaln([$3], [else 790ea1a209SEike Rathke $3])dnl 800ea1a209SEike Rathkefi]) 810ea1a209SEike Rathke 820ea1a209SEike Rathke# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) 830ea1a209SEike Rathke# --------------------------------------------- 840ea1a209SEike Rathkem4_define([_PKG_CONFIG], 850ea1a209SEike Rathke[if test -n "$$1"; then 860ea1a209SEike Rathke pkg_cv_[]$1="$$1" 870ea1a209SEike Rathke elif test -n "$PKG_CONFIG"; then 880ea1a209SEike Rathke PKG_CHECK_EXISTS([$3], 890ea1a209SEike Rathke [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` 900ea1a209SEike Rathke test "x$?" != "x0" && pkg_failed=yes ], 910ea1a209SEike Rathke [pkg_failed=yes]) 920ea1a209SEike Rathke else 930ea1a209SEike Rathke pkg_failed=untried 940ea1a209SEike Rathkefi[]dnl 950ea1a209SEike Rathke])# _PKG_CONFIG 960ea1a209SEike Rathke 970ea1a209SEike Rathke# _PKG_SHORT_ERRORS_SUPPORTED 980ea1a209SEike Rathke# ----------------------------- 990ea1a209SEike RathkeAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], 1000ea1a209SEike Rathke[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) 1010ea1a209SEike Rathkeif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then 1020ea1a209SEike Rathke _pkg_short_errors_supported=yes 1030ea1a209SEike Rathkeelse 1040ea1a209SEike Rathke _pkg_short_errors_supported=no 1050ea1a209SEike Rathkefi[]dnl 1060ea1a209SEike Rathke])# _PKG_SHORT_ERRORS_SUPPORTED 1070ea1a209SEike Rathke 1080ea1a209SEike Rathke 1090ea1a209SEike Rathke# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], 1100ea1a209SEike Rathke# [ACTION-IF-NOT-FOUND]) 1110ea1a209SEike Rathke# 1120ea1a209SEike Rathke# 1130ea1a209SEike Rathke# Note that if there is a possibility the first call to 1140ea1a209SEike Rathke# PKG_CHECK_MODULES might not happen, you should be sure to include an 1150ea1a209SEike Rathke# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac 1160ea1a209SEike Rathke# 1170ea1a209SEike Rathke# 1180ea1a209SEike Rathke# -------------------------------------------------------------- 1190ea1a209SEike RathkeAC_DEFUN([PKG_CHECK_MODULES], 1200ea1a209SEike Rathke[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl 1210ea1a209SEike RathkeAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl 1220ea1a209SEike RathkeAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl 1230ea1a209SEike Rathke 1240ea1a209SEike Rathkepkg_failed=no 1250ea1a209SEike RathkeAC_MSG_CHECKING([for $1]) 1260ea1a209SEike Rathke 1270ea1a209SEike Rathke_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) 1280ea1a209SEike Rathke_PKG_CONFIG([$1][_LIBS], [libs], [$2]) 1290ea1a209SEike Rathke 1300ea1a209SEike Rathkem4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS 1310ea1a209SEike Rathkeand $1[]_LIBS to avoid the need to call pkg-config. 1320ea1a209SEike RathkeSee the pkg-config man page for more details.]) 1330ea1a209SEike Rathke 1340ea1a209SEike Rathkeif test $pkg_failed = yes; then 1350ea1a209SEike Rathke AC_MSG_RESULT([no]) 1360ea1a209SEike Rathke _PKG_SHORT_ERRORS_SUPPORTED 1370ea1a209SEike Rathke if test $_pkg_short_errors_supported = yes; then 1380ea1a209SEike Rathke $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` 1390ea1a209SEike Rathke else 1400ea1a209SEike Rathke $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` 1410ea1a209SEike Rathke fi 1420ea1a209SEike Rathke # Put the nasty error message in config.log where it belongs 1430ea1a209SEike Rathke echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD 1440ea1a209SEike Rathke 1450ea1a209SEike Rathke m4_default([$4], [AC_MSG_ERROR( 1460ea1a209SEike Rathke[Package requirements ($2) were not met: 1470ea1a209SEike Rathke 1480ea1a209SEike Rathke$$1_PKG_ERRORS 1490ea1a209SEike Rathke 1500ea1a209SEike RathkeConsider adjusting the PKG_CONFIG_PATH environment variable if you 1510ea1a209SEike Rathkeinstalled software in a non-standard prefix. 1520ea1a209SEike Rathke 1530ea1a209SEike Rathke_PKG_TEXT])[]dnl 1540ea1a209SEike Rathke ]) 1550ea1a209SEike Rathkeelif test $pkg_failed = untried; then 1560ea1a209SEike Rathke AC_MSG_RESULT([no]) 1570ea1a209SEike Rathke m4_default([$4], [AC_MSG_FAILURE( 1580ea1a209SEike Rathke[The pkg-config script could not be found or is too old. Make sure it 1590ea1a209SEike Rathkeis in your PATH or set the PKG_CONFIG environment variable to the full 1600ea1a209SEike Rathkepath to pkg-config. 1610ea1a209SEike Rathke 1620ea1a209SEike Rathke_PKG_TEXT 1630ea1a209SEike Rathke 1640ea1a209SEike RathkeTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl 1650ea1a209SEike Rathke ]) 1660ea1a209SEike Rathkeelse 1670ea1a209SEike Rathke $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS 1680ea1a209SEike Rathke $1[]_LIBS=$pkg_cv_[]$1[]_LIBS 1690ea1a209SEike Rathke AC_MSG_RESULT([yes]) 1700ea1a209SEike Rathke $3 1710ea1a209SEike Rathkefi[]dnl 1720ea1a209SEike Rathke])# PKG_CHECK_MODULES 1730ea1a209SEike Rathke 1740ea1a209SEike Rathke# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009 1750ea1a209SEike Rathke# Free Software Foundation, Inc. 1760ea1a209SEike Rathke# 1770ea1a209SEike Rathke# This file is free software; the Free Software Foundation 1780ea1a209SEike Rathke# gives unlimited permission to copy and/or distribute it, 1790ea1a209SEike Rathke# with or without modifications, as long as this notice is preserved. 180cdf0e10cSrcweir 181cdf0e10cSrcweir# AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) 1820ea1a209SEike Rathke# --------------------------------------------------------------------------- 183cdf0e10cSrcweir# Adds support for distributing Python modules and packages. To 184cdf0e10cSrcweir# install modules, copy them to $(pythondir), using the python_PYTHON 185cdf0e10cSrcweir# automake variable. To install a package with the same name as the 186cdf0e10cSrcweir# automake package, install to $(pkgpythondir), or use the 187cdf0e10cSrcweir# pkgpython_PYTHON automake variable. 1880ea1a209SEike Rathke# 189cdf0e10cSrcweir# The variables $(pyexecdir) and $(pkgpyexecdir) are provided as 190cdf0e10cSrcweir# locations to install python extension modules (shared libraries). 191cdf0e10cSrcweir# Another macro is required to find the appropriate flags to compile 192cdf0e10cSrcweir# extension modules. 1930ea1a209SEike Rathke# 194cdf0e10cSrcweir# If your package is configured with a different prefix to python, 195cdf0e10cSrcweir# users will have to add the install directory to the PYTHONPATH 196cdf0e10cSrcweir# environment variable, or create a .pth file (see the python 197cdf0e10cSrcweir# documentation for details). 1980ea1a209SEike Rathke# 199cdf0e10cSrcweir# If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will 200cdf0e10cSrcweir# cause an error if the version of python installed on the system 201cdf0e10cSrcweir# doesn't meet the requirement. MINIMUM-VERSION should consist of 202cdf0e10cSrcweir# numbers and dots only. 203cdf0e10cSrcweirAC_DEFUN([AM_PATH_PYTHON], 204cdf0e10cSrcweir [ 2050ea1a209SEike Rathke dnl Find a Python interpreter. Python versions prior to 2.0 are not 2060ea1a209SEike Rathke dnl supported. (2.0 was released on October 16, 2000). 2070ea1a209SEike Rathke m4_define_default([_AM_PYTHON_INTERPRETER_LIST], 2080ea1a209SEike Rathke [python python2 python3 python3.0 python2.5 python2.4 python2.3 python2.2 dnl 2090ea1a209SEike Rathkepython2.1 python2.0]) 210cdf0e10cSrcweir 211cdf0e10cSrcweir m4_if([$1],[],[ 212cdf0e10cSrcweir dnl No version check is needed. 213cdf0e10cSrcweir # Find any Python interpreter. 214cdf0e10cSrcweir if test -z "$PYTHON"; then 2150ea1a209SEike Rathke AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :) 216cdf0e10cSrcweir fi 217cdf0e10cSrcweir am_display_PYTHON=python 218cdf0e10cSrcweir ], [ 219cdf0e10cSrcweir dnl A version check is needed. 220cdf0e10cSrcweir if test -n "$PYTHON"; then 221cdf0e10cSrcweir # If the user set $PYTHON, use it and don't search something else. 222cdf0e10cSrcweir AC_MSG_CHECKING([whether $PYTHON version >= $1]) 223cdf0e10cSrcweir AM_PYTHON_CHECK_VERSION([$PYTHON], [$1], 224cdf0e10cSrcweir [AC_MSG_RESULT(yes)], 225cdf0e10cSrcweir [AC_MSG_ERROR(too old)]) 226cdf0e10cSrcweir am_display_PYTHON=$PYTHON 227cdf0e10cSrcweir else 228cdf0e10cSrcweir # Otherwise, try each interpreter until we find one that satisfies 229cdf0e10cSrcweir # VERSION. 230cdf0e10cSrcweir AC_CACHE_CHECK([for a Python interpreter with version >= $1], 231cdf0e10cSrcweir [am_cv_pathless_PYTHON],[ 232cdf0e10cSrcweir for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do 233cdf0e10cSrcweir test "$am_cv_pathless_PYTHON" = none && break 234cdf0e10cSrcweir AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break]) 235cdf0e10cSrcweir done]) 236cdf0e10cSrcweir # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON. 237cdf0e10cSrcweir if test "$am_cv_pathless_PYTHON" = none; then 238cdf0e10cSrcweir PYTHON=: 239cdf0e10cSrcweir else 240cdf0e10cSrcweir AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON]) 241cdf0e10cSrcweir fi 242cdf0e10cSrcweir am_display_PYTHON=$am_cv_pathless_PYTHON 243cdf0e10cSrcweir fi 244cdf0e10cSrcweir ]) 245cdf0e10cSrcweir 246cdf0e10cSrcweir if test "$PYTHON" = :; then 247cdf0e10cSrcweir dnl Run any user-specified action, or abort. 248cdf0e10cSrcweir m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])]) 249cdf0e10cSrcweir else 250cdf0e10cSrcweir 251cdf0e10cSrcweir dnl Query Python for its version number. Getting [:3] seems to be 252cdf0e10cSrcweir dnl the best way to do this; it's what "site.py" does in the standard 253cdf0e10cSrcweir dnl library. 254cdf0e10cSrcweir 255cdf0e10cSrcweir AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version], 2560ea1a209SEike Rathke [am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[[:3]])"`]) 257cdf0e10cSrcweir AC_SUBST([PYTHON_VERSION], [$am_cv_python_version]) 258cdf0e10cSrcweir 259cdf0e10cSrcweir dnl Use the values of $prefix and $exec_prefix for the corresponding 260cdf0e10cSrcweir dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX. These are made 261cdf0e10cSrcweir dnl distinct variables so they can be overridden if need be. However, 262cdf0e10cSrcweir dnl general consensus is that you shouldn't need this ability. 263cdf0e10cSrcweir 264cdf0e10cSrcweir AC_SUBST([PYTHON_PREFIX], ['${prefix}']) 265cdf0e10cSrcweir AC_SUBST([PYTHON_EXEC_PREFIX], ['${exec_prefix}']) 266cdf0e10cSrcweir 267cdf0e10cSrcweir dnl At times (like when building shared libraries) you may want 268cdf0e10cSrcweir dnl to know which OS platform Python thinks this is. 269cdf0e10cSrcweir 270cdf0e10cSrcweir AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform], 2710ea1a209SEike Rathke [am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`]) 272cdf0e10cSrcweir AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform]) 273cdf0e10cSrcweir 274cdf0e10cSrcweir 275cdf0e10cSrcweir dnl Set up 4 directories: 276cdf0e10cSrcweir 277cdf0e10cSrcweir dnl pythondir -- where to install python scripts. This is the 278cdf0e10cSrcweir dnl site-packages directory, not the python standard library 279cdf0e10cSrcweir dnl directory like in previous automake betas. This behavior 280cdf0e10cSrcweir dnl is more consistent with lispdir.m4 for example. 281cdf0e10cSrcweir dnl Query distutils for this directory. distutils does not exist in 282cdf0e10cSrcweir dnl Python 1.5, so we fall back to the hardcoded directory if it 283cdf0e10cSrcweir dnl doesn't work. 284cdf0e10cSrcweir AC_CACHE_CHECK([for $am_display_PYTHON script directory], 285cdf0e10cSrcweir [am_cv_python_pythondir], 2860ea1a209SEike Rathke [if test "x$prefix" = xNONE 2870ea1a209SEike Rathke then 2880ea1a209SEike Rathke am_py_prefix=$ac_default_prefix 2890ea1a209SEike Rathke else 2900ea1a209SEike Rathke am_py_prefix=$prefix 2910ea1a209SEike Rathke fi 2920ea1a209SEike Rathke am_cv_python_pythondir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(0,0,prefix='$am_py_prefix'))" 2>/dev/null || 2930ea1a209SEike Rathke echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"` 2940ea1a209SEike Rathke case $am_cv_python_pythondir in 2950ea1a209SEike Rathke $am_py_prefix*) 2960ea1a209SEike Rathke am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'` 2970ea1a209SEike Rathke am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"` 2980ea1a209SEike Rathke ;; 2990ea1a209SEike Rathke *) 3000ea1a209SEike Rathke case $am_py_prefix in 3010ea1a209SEike Rathke /usr|/System*) ;; 3020ea1a209SEike Rathke *) 3030ea1a209SEike Rathke am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages 3040ea1a209SEike Rathke ;; 3050ea1a209SEike Rathke esac 3060ea1a209SEike Rathke ;; 3070ea1a209SEike Rathke esac 3080ea1a209SEike Rathke ]) 309cdf0e10cSrcweir AC_SUBST([pythondir], [$am_cv_python_pythondir]) 310cdf0e10cSrcweir 311cdf0e10cSrcweir dnl pkgpythondir -- $PACKAGE directory under pythondir. Was 312cdf0e10cSrcweir dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is 313cdf0e10cSrcweir dnl more consistent with the rest of automake. 314cdf0e10cSrcweir 315cdf0e10cSrcweir AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE]) 316cdf0e10cSrcweir 317cdf0e10cSrcweir dnl pyexecdir -- directory for installing python extension modules 318cdf0e10cSrcweir dnl (shared libraries) 319cdf0e10cSrcweir dnl Query distutils for this directory. distutils does not exist in 320cdf0e10cSrcweir dnl Python 1.5, so we fall back to the hardcoded directory if it 321cdf0e10cSrcweir dnl doesn't work. 322cdf0e10cSrcweir AC_CACHE_CHECK([for $am_display_PYTHON extension module directory], 323cdf0e10cSrcweir [am_cv_python_pyexecdir], 3240ea1a209SEike Rathke [if test "x$exec_prefix" = xNONE 3250ea1a209SEike Rathke then 3260ea1a209SEike Rathke am_py_exec_prefix=$am_py_prefix 3270ea1a209SEike Rathke else 3280ea1a209SEike Rathke am_py_exec_prefix=$exec_prefix 3290ea1a209SEike Rathke fi 3300ea1a209SEike Rathke am_cv_python_pyexecdir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(1,0,prefix='$am_py_exec_prefix'))" 2>/dev/null || 3310ea1a209SEike Rathke echo "$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages"` 3320ea1a209SEike Rathke case $am_cv_python_pyexecdir in 3330ea1a209SEike Rathke $am_py_exec_prefix*) 3340ea1a209SEike Rathke am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'` 3350ea1a209SEike Rathke am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"` 3360ea1a209SEike Rathke ;; 3370ea1a209SEike Rathke *) 3380ea1a209SEike Rathke case $am_py_exec_prefix in 3390ea1a209SEike Rathke /usr|/System*) ;; 3400ea1a209SEike Rathke *) 3410ea1a209SEike Rathke am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages 3420ea1a209SEike Rathke ;; 3430ea1a209SEike Rathke esac 3440ea1a209SEike Rathke ;; 3450ea1a209SEike Rathke esac 3460ea1a209SEike Rathke ]) 347cdf0e10cSrcweir AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir]) 348cdf0e10cSrcweir 349cdf0e10cSrcweir dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE) 350cdf0e10cSrcweir 351cdf0e10cSrcweir AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE]) 352cdf0e10cSrcweir 353cdf0e10cSrcweir dnl Run any user-specified action. 354cdf0e10cSrcweir $2 355cdf0e10cSrcweir fi 356cdf0e10cSrcweir 357cdf0e10cSrcweir]) 358cdf0e10cSrcweir 359cdf0e10cSrcweir 360cdf0e10cSrcweir# AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) 361cdf0e10cSrcweir# --------------------------------------------------------------------------- 362cdf0e10cSrcweir# Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION. 363cdf0e10cSrcweir# Run ACTION-IF-FALSE otherwise. 364cdf0e10cSrcweir# This test uses sys.hexversion instead of the string equivalent (first 365cdf0e10cSrcweir# word of sys.version), in order to cope with versions such as 2.2c1. 3660ea1a209SEike Rathke# This supports Python 2.0 or higher. (2.0 was released on October 16, 2000). 367cdf0e10cSrcweirAC_DEFUN([AM_PYTHON_CHECK_VERSION], 3680ea1a209SEike Rathke [prog="import sys 369cdf0e10cSrcweir# split strings by '.' and convert to numeric. Append some zeros 370cdf0e10cSrcweir# because we need at least 4 digits for the hex conversion. 3710ea1a209SEike Rathke# map returns an iterator in Python 3.0 and a list in 2.x 3720ea1a209SEike Rathkeminver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]] 373cdf0e10cSrcweirminverhex = 0 3740ea1a209SEike Rathke# xrange is not present in Python 3.0 and range returns an iterator 3750ea1a209SEike Rathkefor i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]] 376cdf0e10cSrcweirsys.exit(sys.hexversion < minverhex)" 377cdf0e10cSrcweir AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])]) 378cdf0e10cSrcweir 3790ea1a209SEike Rathke# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. 3800ea1a209SEike Rathke# 3810ea1a209SEike Rathke# This file is free software; the Free Software Foundation 3820ea1a209SEike Rathke# gives unlimited permission to copy and/or distribute it, 3830ea1a209SEike Rathke# with or without modifications, as long as this notice is preserved. 384cdf0e10cSrcweir 385cdf0e10cSrcweir# AM_RUN_LOG(COMMAND) 386cdf0e10cSrcweir# ------------------- 387cdf0e10cSrcweir# Run COMMAND, save the exit status in ac_status, and log it. 388cdf0e10cSrcweir# (This has been adapted from Autoconf's _AC_RUN_LOG macro.) 389cdf0e10cSrcweirAC_DEFUN([AM_RUN_LOG], 390cdf0e10cSrcweir[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD 391cdf0e10cSrcweir ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD 392cdf0e10cSrcweir ac_status=$? 393cdf0e10cSrcweir echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD 394cdf0e10cSrcweir (exit $ac_status); }]) 395