1*0ea1a209SEike Rathke# generated automatically by aclocal 1.11.1 -*- Autoconf -*- 2cdf0e10cSrcweir 3*0ea1a209SEike Rathke# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 4*0ea1a209SEike 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 14*0ea1a209SEike Rathke# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- 15*0ea1a209SEike Rathke# serial 1 (pkg-config-0.24) 16*0ea1a209SEike Rathke# 17*0ea1a209SEike Rathke# Copyright © 2004 Scott James Remnant <scott@netsplit.com>. 18*0ea1a209SEike 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 21*0ea1a209SEike Rathke# the Free Software Foundation; either version 2 of the License, or 22*0ea1a209SEike Rathke# (at your option) any later version. 23*0ea1a209SEike Rathke# 24*0ea1a209SEike Rathke# This program is distributed in the hope that it will be useful, but 25*0ea1a209SEike Rathke# WITHOUT ANY WARRANTY; without even the implied warranty of 26*0ea1a209SEike Rathke# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27*0ea1a209SEike Rathke# General Public License for more details. 28*0ea1a209SEike 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 31*0ea1a209SEike Rathke# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 32*0ea1a209SEike Rathke# 33*0ea1a209SEike Rathke# As a special exception to the GNU General Public License, if you 34*0ea1a209SEike Rathke# distribute this file as part of a program that contains a 35*0ea1a209SEike Rathke# configuration script generated by Autoconf, you may include it under 36*0ea1a209SEike Rathke# the same distribution terms that you use for the rest of that program. 37*0ea1a209SEike Rathke 38*0ea1a209SEike Rathke# PKG_PROG_PKG_CONFIG([MIN-VERSION]) 39*0ea1a209SEike Rathke# ---------------------------------- 40*0ea1a209SEike RathkeAC_DEFUN([PKG_PROG_PKG_CONFIG], 41*0ea1a209SEike Rathke[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) 42*0ea1a209SEike Rathkem4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) 43*0ea1a209SEike Rathkem4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) 44*0ea1a209SEike RathkeAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) 45*0ea1a209SEike RathkeAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) 46*0ea1a209SEike RathkeAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) 47*0ea1a209SEike Rathke 48*0ea1a209SEike Rathkeif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then 49*0ea1a209SEike Rathke AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) 50*0ea1a209SEike Rathkefi 51*0ea1a209SEike Rathkeif test -n "$PKG_CONFIG"; then 52*0ea1a209SEike Rathke _pkg_min_version=m4_default([$1], [0.9.0]) 53*0ea1a209SEike Rathke AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) 54*0ea1a209SEike Rathke if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then 55*0ea1a209SEike Rathke AC_MSG_RESULT([yes]) 56*0ea1a209SEike Rathke else 57*0ea1a209SEike Rathke AC_MSG_RESULT([no]) 58*0ea1a209SEike Rathke PKG_CONFIG="" 59*0ea1a209SEike Rathke fi 60*0ea1a209SEike Rathkefi[]dnl 61*0ea1a209SEike Rathke])# PKG_PROG_PKG_CONFIG 62*0ea1a209SEike Rathke 63*0ea1a209SEike Rathke# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) 64*0ea1a209SEike Rathke# 65*0ea1a209SEike Rathke# Check to see whether a particular set of modules exists. Similar 66*0ea1a209SEike Rathke# to PKG_CHECK_MODULES(), but does not set variables or print errors. 67*0ea1a209SEike Rathke# 68*0ea1a209SEike Rathke# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) 69*0ea1a209SEike Rathke# only at the first occurence in configure.ac, so if the first place 70*0ea1a209SEike Rathke# it's called might be skipped (such as if it is within an "if", you 71*0ea1a209SEike Rathke# have to call PKG_CHECK_EXISTS manually 72*0ea1a209SEike Rathke# -------------------------------------------------------------- 73*0ea1a209SEike RathkeAC_DEFUN([PKG_CHECK_EXISTS], 74*0ea1a209SEike Rathke[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl 75*0ea1a209SEike Rathkeif test -n "$PKG_CONFIG" && \ 76*0ea1a209SEike Rathke AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then 77*0ea1a209SEike Rathke m4_default([$2], [:]) 78*0ea1a209SEike Rathkem4_ifvaln([$3], [else 79*0ea1a209SEike Rathke $3])dnl 80*0ea1a209SEike Rathkefi]) 81*0ea1a209SEike Rathke 82*0ea1a209SEike Rathke# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) 83*0ea1a209SEike Rathke# --------------------------------------------- 84*0ea1a209SEike Rathkem4_define([_PKG_CONFIG], 85*0ea1a209SEike Rathke[if test -n "$$1"; then 86*0ea1a209SEike Rathke pkg_cv_[]$1="$$1" 87*0ea1a209SEike Rathke elif test -n "$PKG_CONFIG"; then 88*0ea1a209SEike Rathke PKG_CHECK_EXISTS([$3], 89*0ea1a209SEike Rathke [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` 90*0ea1a209SEike Rathke test "x$?" != "x0" && pkg_failed=yes ], 91*0ea1a209SEike Rathke [pkg_failed=yes]) 92*0ea1a209SEike Rathke else 93*0ea1a209SEike Rathke pkg_failed=untried 94*0ea1a209SEike Rathkefi[]dnl 95*0ea1a209SEike Rathke])# _PKG_CONFIG 96*0ea1a209SEike Rathke 97*0ea1a209SEike Rathke# _PKG_SHORT_ERRORS_SUPPORTED 98*0ea1a209SEike Rathke# ----------------------------- 99*0ea1a209SEike RathkeAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], 100*0ea1a209SEike Rathke[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) 101*0ea1a209SEike Rathkeif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then 102*0ea1a209SEike Rathke _pkg_short_errors_supported=yes 103*0ea1a209SEike Rathkeelse 104*0ea1a209SEike Rathke _pkg_short_errors_supported=no 105*0ea1a209SEike Rathkefi[]dnl 106*0ea1a209SEike Rathke])# _PKG_SHORT_ERRORS_SUPPORTED 107*0ea1a209SEike Rathke 108*0ea1a209SEike Rathke 109*0ea1a209SEike Rathke# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], 110*0ea1a209SEike Rathke# [ACTION-IF-NOT-FOUND]) 111*0ea1a209SEike Rathke# 112*0ea1a209SEike Rathke# 113*0ea1a209SEike Rathke# Note that if there is a possibility the first call to 114*0ea1a209SEike Rathke# PKG_CHECK_MODULES might not happen, you should be sure to include an 115*0ea1a209SEike Rathke# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac 116*0ea1a209SEike Rathke# 117*0ea1a209SEike Rathke# 118*0ea1a209SEike Rathke# -------------------------------------------------------------- 119*0ea1a209SEike RathkeAC_DEFUN([PKG_CHECK_MODULES], 120*0ea1a209SEike Rathke[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl 121*0ea1a209SEike RathkeAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl 122*0ea1a209SEike RathkeAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl 123*0ea1a209SEike Rathke 124*0ea1a209SEike Rathkepkg_failed=no 125*0ea1a209SEike RathkeAC_MSG_CHECKING([for $1]) 126*0ea1a209SEike Rathke 127*0ea1a209SEike Rathke_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) 128*0ea1a209SEike Rathke_PKG_CONFIG([$1][_LIBS], [libs], [$2]) 129*0ea1a209SEike Rathke 130*0ea1a209SEike Rathkem4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS 131*0ea1a209SEike Rathkeand $1[]_LIBS to avoid the need to call pkg-config. 132*0ea1a209SEike RathkeSee the pkg-config man page for more details.]) 133*0ea1a209SEike Rathke 134*0ea1a209SEike Rathkeif test $pkg_failed = yes; then 135*0ea1a209SEike Rathke AC_MSG_RESULT([no]) 136*0ea1a209SEike Rathke _PKG_SHORT_ERRORS_SUPPORTED 137*0ea1a209SEike Rathke if test $_pkg_short_errors_supported = yes; then 138*0ea1a209SEike Rathke $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` 139*0ea1a209SEike Rathke else 140*0ea1a209SEike Rathke $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` 141*0ea1a209SEike Rathke fi 142*0ea1a209SEike Rathke # Put the nasty error message in config.log where it belongs 143*0ea1a209SEike Rathke echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD 144*0ea1a209SEike Rathke 145*0ea1a209SEike Rathke m4_default([$4], [AC_MSG_ERROR( 146*0ea1a209SEike Rathke[Package requirements ($2) were not met: 147*0ea1a209SEike Rathke 148*0ea1a209SEike Rathke$$1_PKG_ERRORS 149*0ea1a209SEike Rathke 150*0ea1a209SEike RathkeConsider adjusting the PKG_CONFIG_PATH environment variable if you 151*0ea1a209SEike Rathkeinstalled software in a non-standard prefix. 152*0ea1a209SEike Rathke 153*0ea1a209SEike Rathke_PKG_TEXT])[]dnl 154*0ea1a209SEike Rathke ]) 155*0ea1a209SEike Rathkeelif test $pkg_failed = untried; then 156*0ea1a209SEike Rathke AC_MSG_RESULT([no]) 157*0ea1a209SEike Rathke m4_default([$4], [AC_MSG_FAILURE( 158*0ea1a209SEike Rathke[The pkg-config script could not be found or is too old. Make sure it 159*0ea1a209SEike Rathkeis in your PATH or set the PKG_CONFIG environment variable to the full 160*0ea1a209SEike Rathkepath to pkg-config. 161*0ea1a209SEike Rathke 162*0ea1a209SEike Rathke_PKG_TEXT 163*0ea1a209SEike Rathke 164*0ea1a209SEike RathkeTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl 165*0ea1a209SEike Rathke ]) 166*0ea1a209SEike Rathkeelse 167*0ea1a209SEike Rathke $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS 168*0ea1a209SEike Rathke $1[]_LIBS=$pkg_cv_[]$1[]_LIBS 169*0ea1a209SEike Rathke AC_MSG_RESULT([yes]) 170*0ea1a209SEike Rathke $3 171*0ea1a209SEike Rathkefi[]dnl 172*0ea1a209SEike Rathke])# PKG_CHECK_MODULES 173*0ea1a209SEike Rathke 174*0ea1a209SEike Rathke# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009 175*0ea1a209SEike Rathke# Free Software Foundation, Inc. 176*0ea1a209SEike Rathke# 177*0ea1a209SEike Rathke# This file is free software; the Free Software Foundation 178*0ea1a209SEike Rathke# gives unlimited permission to copy and/or distribute it, 179*0ea1a209SEike 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]) 182*0ea1a209SEike 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. 188*0ea1a209SEike 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. 193*0ea1a209SEike 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). 198*0ea1a209SEike 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 [ 205*0ea1a209SEike Rathke dnl Find a Python interpreter. Python versions prior to 2.0 are not 206*0ea1a209SEike Rathke dnl supported. (2.0 was released on October 16, 2000). 207*0ea1a209SEike Rathke m4_define_default([_AM_PYTHON_INTERPRETER_LIST], 208*0ea1a209SEike Rathke [python python2 python3 python3.0 python2.5 python2.4 python2.3 python2.2 dnl 209*0ea1a209SEike 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 215*0ea1a209SEike 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], 256*0ea1a209SEike 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], 271*0ea1a209SEike 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], 286*0ea1a209SEike Rathke [if test "x$prefix" = xNONE 287*0ea1a209SEike Rathke then 288*0ea1a209SEike Rathke am_py_prefix=$ac_default_prefix 289*0ea1a209SEike Rathke else 290*0ea1a209SEike Rathke am_py_prefix=$prefix 291*0ea1a209SEike Rathke fi 292*0ea1a209SEike 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 || 293*0ea1a209SEike Rathke echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"` 294*0ea1a209SEike Rathke case $am_cv_python_pythondir in 295*0ea1a209SEike Rathke $am_py_prefix*) 296*0ea1a209SEike Rathke am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'` 297*0ea1a209SEike Rathke am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"` 298*0ea1a209SEike Rathke ;; 299*0ea1a209SEike Rathke *) 300*0ea1a209SEike Rathke case $am_py_prefix in 301*0ea1a209SEike Rathke /usr|/System*) ;; 302*0ea1a209SEike Rathke *) 303*0ea1a209SEike Rathke am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages 304*0ea1a209SEike Rathke ;; 305*0ea1a209SEike Rathke esac 306*0ea1a209SEike Rathke ;; 307*0ea1a209SEike Rathke esac 308*0ea1a209SEike 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], 324*0ea1a209SEike Rathke [if test "x$exec_prefix" = xNONE 325*0ea1a209SEike Rathke then 326*0ea1a209SEike Rathke am_py_exec_prefix=$am_py_prefix 327*0ea1a209SEike Rathke else 328*0ea1a209SEike Rathke am_py_exec_prefix=$exec_prefix 329*0ea1a209SEike Rathke fi 330*0ea1a209SEike 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 || 331*0ea1a209SEike Rathke echo "$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages"` 332*0ea1a209SEike Rathke case $am_cv_python_pyexecdir in 333*0ea1a209SEike Rathke $am_py_exec_prefix*) 334*0ea1a209SEike Rathke am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'` 335*0ea1a209SEike Rathke am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"` 336*0ea1a209SEike Rathke ;; 337*0ea1a209SEike Rathke *) 338*0ea1a209SEike Rathke case $am_py_exec_prefix in 339*0ea1a209SEike Rathke /usr|/System*) ;; 340*0ea1a209SEike Rathke *) 341*0ea1a209SEike Rathke am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages 342*0ea1a209SEike Rathke ;; 343*0ea1a209SEike Rathke esac 344*0ea1a209SEike Rathke ;; 345*0ea1a209SEike Rathke esac 346*0ea1a209SEike 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. 366*0ea1a209SEike Rathke# This supports Python 2.0 or higher. (2.0 was released on October 16, 2000). 367cdf0e10cSrcweirAC_DEFUN([AM_PYTHON_CHECK_VERSION], 368*0ea1a209SEike 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. 371*0ea1a209SEike Rathke# map returns an iterator in Python 3.0 and a list in 2.x 372*0ea1a209SEike Rathkeminver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]] 373cdf0e10cSrcweirminverhex = 0 374*0ea1a209SEike Rathke# xrange is not present in Python 3.0 and range returns an iterator 375*0ea1a209SEike 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 379*0ea1a209SEike Rathke# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. 380*0ea1a209SEike Rathke# 381*0ea1a209SEike Rathke# This file is free software; the Free Software Foundation 382*0ea1a209SEike Rathke# gives unlimited permission to copy and/or distribute it, 383*0ea1a209SEike 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); }]) 395cdf0e10cSrcweir 396