xref: /aoo41x/main/aclocal.m4 (revision 8ba2f6f7)
1# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
2
3# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
5# This file is free software; the Free Software Foundation
6# gives unlimited permission to copy and/or distribute it,
7# with or without modifications, as long as this notice is preserved.
8
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12# PARTICULAR PURPOSE.
13
14# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
15# serial 1 (pkg-config-0.24)
16#
17# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
18#
19# This program is free software; you can redistribute it and/or modify
20# it under the terms of the GNU General Public License as published by
21# the Free Software Foundation; either version 2 of the License, or
22# (at your option) any later version.
23#
24# This program is distributed in the hope that it will be useful, but
25# WITHOUT ANY WARRANTY; without even the implied warranty of
26# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
27# General Public License for more details.
28#
29# You should have received a copy of the GNU General Public License
30# along with this program; if not, write to the Free Software
31# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
32#
33# As a special exception to the GNU General Public License, if you
34# distribute this file as part of a program that contains a
35# configuration script generated by Autoconf, you may include it under
36# the same distribution terms that you use for the rest of that program.
37
38# PKG_PROG_PKG_CONFIG([MIN-VERSION])
39# ----------------------------------
40AC_DEFUN([PKG_PROG_PKG_CONFIG],
41[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
42m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
43m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
44AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
45AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
46AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
47
48if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
49	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
50fi
51if test -n "$PKG_CONFIG"; then
52	_pkg_min_version=m4_default([$1], [0.9.0])
53	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
54	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
55		AC_MSG_RESULT([yes])
56	else
57		AC_MSG_RESULT([no])
58		PKG_CONFIG=""
59	fi
60fi[]dnl
61])# PKG_PROG_PKG_CONFIG
62
63# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
64#
65# Check to see whether a particular set of modules exists.  Similar
66# to PKG_CHECK_MODULES(), but does not set variables or print errors.
67#
68# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
69# only at the first occurence in configure.ac, so if the first place
70# it's called might be skipped (such as if it is within an "if", you
71# have to call PKG_CHECK_EXISTS manually
72# --------------------------------------------------------------
73AC_DEFUN([PKG_CHECK_EXISTS],
74[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
75if test -n "$PKG_CONFIG" && \
76    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
77  m4_default([$2], [:])
78m4_ifvaln([$3], [else
79  $3])dnl
80fi])
81
82# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
83# ---------------------------------------------
84m4_define([_PKG_CONFIG],
85[if test -n "$$1"; then
86    pkg_cv_[]$1="$$1"
87 elif test -n "$PKG_CONFIG"; then
88    PKG_CHECK_EXISTS([$3],
89                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
90		      test "x$?" != "x0" && pkg_failed=yes ],
91		     [pkg_failed=yes])
92 else
93    pkg_failed=untried
94fi[]dnl
95])# _PKG_CONFIG
96
97# _PKG_SHORT_ERRORS_SUPPORTED
98# -----------------------------
99AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
100[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
101if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
102        _pkg_short_errors_supported=yes
103else
104        _pkg_short_errors_supported=no
105fi[]dnl
106])# _PKG_SHORT_ERRORS_SUPPORTED
107
108
109# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
110# [ACTION-IF-NOT-FOUND])
111#
112#
113# Note that if there is a possibility the first call to
114# PKG_CHECK_MODULES might not happen, you should be sure to include an
115# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
116#
117#
118# --------------------------------------------------------------
119AC_DEFUN([PKG_CHECK_MODULES],
120[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
121AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
122AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
123
124pkg_failed=no
125AC_MSG_CHECKING([for $1])
126
127_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
128_PKG_CONFIG([$1][_LIBS], [libs], [$2])
129
130m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
131and $1[]_LIBS to avoid the need to call pkg-config.
132See the pkg-config man page for more details.])
133
134if test $pkg_failed = yes; then
135   	AC_MSG_RESULT([no])
136        _PKG_SHORT_ERRORS_SUPPORTED
137        if test $_pkg_short_errors_supported = yes; then
138	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
139        else
140	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
141        fi
142	# Put the nasty error message in config.log where it belongs
143	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
144
145	m4_default([$4], [AC_MSG_ERROR(
146[Package requirements ($2) were not met:
147
148$$1_PKG_ERRORS
149
150Consider adjusting the PKG_CONFIG_PATH environment variable if you
151installed software in a non-standard prefix.
152
153_PKG_TEXT])[]dnl
154        ])
155elif test $pkg_failed = untried; then
156     	AC_MSG_RESULT([no])
157	m4_default([$4], [AC_MSG_FAILURE(
158[The pkg-config script could not be found or is too old.  Make sure it
159is in your PATH or set the PKG_CONFIG environment variable to the full
160path to pkg-config.
161
162_PKG_TEXT
163
164To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
165        ])
166else
167	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
168	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
169        AC_MSG_RESULT([yes])
170	$3
171fi[]dnl
172])# PKG_CHECK_MODULES
173
174# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
175# Free Software Foundation, Inc.
176#
177# This file is free software; the Free Software Foundation
178# gives unlimited permission to copy and/or distribute it,
179# with or without modifications, as long as this notice is preserved.
180
181# AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
182# ---------------------------------------------------------------------------
183# Adds support for distributing Python modules and packages.  To
184# install modules, copy them to $(pythondir), using the python_PYTHON
185# automake variable.  To install a package with the same name as the
186# automake package, install to $(pkgpythondir), or use the
187# pkgpython_PYTHON automake variable.
188#
189# The variables $(pyexecdir) and $(pkgpyexecdir) are provided as
190# locations to install python extension modules (shared libraries).
191# Another macro is required to find the appropriate flags to compile
192# extension modules.
193#
194# If your package is configured with a different prefix to python,
195# users will have to add the install directory to the PYTHONPATH
196# environment variable, or create a .pth file (see the python
197# documentation for details).
198#
199# If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will
200# cause an error if the version of python installed on the system
201# doesn't meet the requirement.  MINIMUM-VERSION should consist of
202# numbers and dots only.
203AC_DEFUN([AM_PATH_PYTHON],
204 [
205  dnl Find a Python interpreter.  Python versions prior to 2.0 are not
206  dnl supported. (2.0 was released on October 16, 2000).
207  m4_define_default([_AM_PYTHON_INTERPRETER_LIST],
208                    [python python2 python3 python3.0 python2.5 python2.4 python2.3 python2.2 dnl
209python2.1 python2.0])
210
211  m4_if([$1],[],[
212    dnl No version check is needed.
213    # Find any Python interpreter.
214    if test -z "$PYTHON"; then
215      AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :)
216    fi
217    am_display_PYTHON=python
218  ], [
219    dnl A version check is needed.
220    if test -n "$PYTHON"; then
221      # If the user set $PYTHON, use it and don't search something else.
222      AC_MSG_CHECKING([whether $PYTHON version >= $1])
223      AM_PYTHON_CHECK_VERSION([$PYTHON], [$1],
224			      [AC_MSG_RESULT(yes)],
225			      [AC_MSG_ERROR(too old)])
226      am_display_PYTHON=$PYTHON
227    else
228      # Otherwise, try each interpreter until we find one that satisfies
229      # VERSION.
230      AC_CACHE_CHECK([for a Python interpreter with version >= $1],
231	[am_cv_pathless_PYTHON],[
232	for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do
233	  test "$am_cv_pathless_PYTHON" = none && break
234	  AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break])
235	done])
236      # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON.
237      if test "$am_cv_pathless_PYTHON" = none; then
238	PYTHON=:
239      else
240        AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON])
241      fi
242      am_display_PYTHON=$am_cv_pathless_PYTHON
243    fi
244  ])
245
246  if test "$PYTHON" = :; then
247  dnl Run any user-specified action, or abort.
248    m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])])
249  else
250
251  dnl Query Python for its version number.  Getting [:3] seems to be
252  dnl the best way to do this; it's what "site.py" does in the standard
253  dnl library.
254
255  AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version],
256    [am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[[:3]])"`])
257  AC_SUBST([PYTHON_VERSION], [$am_cv_python_version])
258
259  dnl Use the values of $prefix and $exec_prefix for the corresponding
260  dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX.  These are made
261  dnl distinct variables so they can be overridden if need be.  However,
262  dnl general consensus is that you shouldn't need this ability.
263
264  AC_SUBST([PYTHON_PREFIX], ['${prefix}'])
265  AC_SUBST([PYTHON_EXEC_PREFIX], ['${exec_prefix}'])
266
267  dnl At times (like when building shared libraries) you may want
268  dnl to know which OS platform Python thinks this is.
269
270  AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform],
271    [am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`])
272  AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform])
273
274
275  dnl Set up 4 directories:
276
277  dnl pythondir -- where to install python scripts.  This is the
278  dnl   site-packages directory, not the python standard library
279  dnl   directory like in previous automake betas.  This behavior
280  dnl   is more consistent with lispdir.m4 for example.
281  dnl Query distutils for this directory.  distutils does not exist in
282  dnl Python 1.5, so we fall back to the hardcoded directory if it
283  dnl doesn't work.
284  AC_CACHE_CHECK([for $am_display_PYTHON script directory],
285    [am_cv_python_pythondir],
286    [if test "x$prefix" = xNONE
287     then
288       am_py_prefix=$ac_default_prefix
289     else
290       am_py_prefix=$prefix
291     fi
292     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     echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"`
294     case $am_cv_python_pythondir in
295     $am_py_prefix*)
296       am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'`
297       am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"`
298       ;;
299     *)
300       case $am_py_prefix in
301         /usr|/System*) ;;
302         *)
303	  am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages
304	  ;;
305       esac
306       ;;
307     esac
308    ])
309  AC_SUBST([pythondir], [$am_cv_python_pythondir])
310
311  dnl pkgpythondir -- $PACKAGE directory under pythondir.  Was
312  dnl   PYTHON_SITE_PACKAGE in previous betas, but this naming is
313  dnl   more consistent with the rest of automake.
314
315  AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE])
316
317  dnl pyexecdir -- directory for installing python extension modules
318  dnl   (shared libraries)
319  dnl Query distutils for this directory.  distutils does not exist in
320  dnl Python 1.5, so we fall back to the hardcoded directory if it
321  dnl doesn't work.
322  AC_CACHE_CHECK([for $am_display_PYTHON extension module directory],
323    [am_cv_python_pyexecdir],
324    [if test "x$exec_prefix" = xNONE
325     then
326       am_py_exec_prefix=$am_py_prefix
327     else
328       am_py_exec_prefix=$exec_prefix
329     fi
330     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     echo "$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages"`
332     case $am_cv_python_pyexecdir in
333     $am_py_exec_prefix*)
334       am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'`
335       am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"`
336       ;;
337     *)
338       case $am_py_exec_prefix in
339         /usr|/System*) ;;
340         *)
341	   am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages
342	   ;;
343       esac
344       ;;
345     esac
346    ])
347  AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir])
348
349  dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE)
350
351  AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE])
352
353  dnl Run any user-specified action.
354  $2
355  fi
356
357])
358
359
360# AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
361# ---------------------------------------------------------------------------
362# Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION.
363# Run ACTION-IF-FALSE otherwise.
364# This test uses sys.hexversion instead of the string equivalent (first
365# word of sys.version), in order to cope with versions such as 2.2c1.
366# This supports Python 2.0 or higher. (2.0 was released on October 16, 2000).
367AC_DEFUN([AM_PYTHON_CHECK_VERSION],
368 [prog="import sys
369# split strings by '.' and convert to numeric.  Append some zeros
370# because we need at least 4 digits for the hex conversion.
371# map returns an iterator in Python 3.0 and a list in 2.x
372minver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]]
373minverhex = 0
374# xrange is not present in Python 3.0 and range returns an iterator
375for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]]
376sys.exit(sys.hexversion < minverhex)"
377  AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])])
378
379# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
380#
381# This file is free software; the Free Software Foundation
382# gives unlimited permission to copy and/or distribute it,
383# with or without modifications, as long as this notice is preserved.
384
385# AM_RUN_LOG(COMMAND)
386# -------------------
387# Run COMMAND, save the exit status in ac_status, and log it.
388# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
389AC_DEFUN([AM_RUN_LOG],
390[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
391   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
392   ac_status=$?
393   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
394   (exit $ac_status); }])
395
396