1 # generated automatically by aclocal 1.9.6 -*- Autoconf -*-
3 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 # 2005 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.
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
14 # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
16 # Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
18 # This program is free software; you can redistribute it and/or modify
19 # it under the terms of the GNU General Public License as published by
20 # the Free Software Foundation; either version 2 of the License, or
21 # (at your option) any later version.
23 # This program is distributed in the hope that it will be useful, but
24 # WITHOUT ANY WARRANTY; without even the implied warranty of
25 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26 # General Public License for more details.
28 # You should have received a copy of the GNU General Public License
29 # along with this program; if not, write to the Free Software
30 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
32 # As a special exception to the GNU General Public License, if you
33 # distribute this file as part of a program that contains a
34 # configuration script generated by Autoconf, you may include it under
35 # the same distribution terms that you use for the rest of that program.
37 # PKG_PROG_PKG_CONFIG([MIN-VERSION])
38 # ----------------------------------
39 AC_DEFUN([PKG_PROG_PKG_CONFIG],
40 [m4_pattern_forbid([^_?PKG_[A-Z_]+$])
41 m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
42 AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
43 if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
44 AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
46 if test -n "$PKG_CONFIG"; then
47 _pkg_min_version=m4_default([$1], [0.9.0])
48 AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
49 if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
57 ])# PKG_PROG_PKG_CONFIG
59 # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
61 # Check to see whether a particular set of modules exists. Similar
62 # to PKG_CHECK_MODULES(), but does not set variables or print errors.
65 # Similar to PKG_CHECK_MODULES, make sure that the first instance of
66 # this or PKG_CHECK_MODULES is called, or make sure to call
67 # PKG_CHECK_EXISTS manually
68 # --------------------------------------------------------------
69 AC_DEFUN([PKG_CHECK_EXISTS],
70 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
71 if test -n "$PKG_CONFIG" && \
72 AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
73 m4_ifval([$2], [$2], [:])
79 # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
80 # ---------------------------------------------
81 m4_define([_PKG_CONFIG],
82 [if test -n "$PKG_CONFIG"; then
83 if test -n "$$1"; then
86 PKG_CHECK_EXISTS([$3],
87 [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
95 # _PKG_SHORT_ERRORS_SUPPORTED
96 # -----------------------------
97 AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
98 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])
99 if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
100 _pkg_short_errors_supported=yes
102 _pkg_short_errors_supported=no
104 ])# _PKG_SHORT_ERRORS_SUPPORTED
107 # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
108 # [ACTION-IF-NOT-FOUND])
111 # Note that if there is a possibility the first call to
112 # PKG_CHECK_MODULES might not happen, you should be sure to include an
113 # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
116 # --------------------------------------------------------------
117 AC_DEFUN([PKG_CHECK_MODULES],
118 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
119 AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
120 AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
123 AC_MSG_CHECKING([for $1])
125 _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
126 _PKG_CONFIG([$1][_LIBS], [libs], [$2])
128 m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
129 and $1[]_LIBS to avoid the need to call pkg-config.
130 See the pkg-config man page for more details.])
132 if test $pkg_failed = yes; then
133 _PKG_SHORT_ERRORS_SUPPORTED
134 if test $_pkg_short_errors_supported = yes; then
135 $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
137 $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
139 # Put the nasty error message in config.log where it belongs
140 echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
142 ifelse([$4], , [AC_MSG_ERROR(dnl
143 [Package requirements ($2) were not met:
147 Consider adjusting the PKG_CONFIG_PATH environment variable if you
148 installed software in a non-standard prefix.
153 elif test $pkg_failed = untried; then
154 ifelse([$4], , [AC_MSG_FAILURE(dnl
155 [The pkg-config script could not be found or is too old. Make sure it
156 is in your PATH or set the PKG_CONFIG environment variable to the full
161 To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.])],
164 $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
165 $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
167 ifelse([$3], , :, [$3])
169 ])# PKG_CHECK_MODULES
171 # Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
173 # This file is free software; the Free Software Foundation
174 # gives unlimited permission to copy and/or distribute it,
175 # with or without modifications, as long as this notice is preserved.
177 # AM_AUTOMAKE_VERSION(VERSION)
178 # ----------------------------
179 # Automake X.Y traces this macro to ensure aclocal.m4 has been
180 # generated from the m4 files accompanying Automake X.Y.
181 AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
183 # AM_SET_CURRENT_AUTOMAKE_VERSION
184 # -------------------------------
185 # Call AM_AUTOMAKE_VERSION so it can be traced.
186 # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
187 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
188 [AM_AUTOMAKE_VERSION([1.9.6])])
190 # AM_AUX_DIR_EXPAND -*- Autoconf -*-
192 # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
194 # This file is free software; the Free Software Foundation
195 # gives unlimited permission to copy and/or distribute it,
196 # with or without modifications, as long as this notice is preserved.
198 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
199 # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
200 # `$srcdir', `$srcdir/..', or `$srcdir/../..'.
202 # Of course, Automake must honor this variable whenever it calls a
203 # tool from the auxiliary directory. The problem is that $srcdir (and
204 # therefore $ac_aux_dir as well) can be either absolute or relative,
205 # depending on how configure is run. This is pretty annoying, since
206 # it makes $ac_aux_dir quite unusable in subdirectories: in the top
207 # source directory, any form will work fine, but in subdirectories a
208 # relative path needs to be adjusted first.
210 # $ac_aux_dir/missing
211 # fails when called from a subdirectory if $ac_aux_dir is relative
212 # $top_srcdir/$ac_aux_dir/missing
213 # fails if $ac_aux_dir is absolute,
214 # fails when called from a subdirectory in a VPATH build with
215 # a relative $ac_aux_dir
217 # The reason of the latter failure is that $top_srcdir and $ac_aux_dir
218 # are both prefixed by $srcdir. In an in-source build this is usually
219 # harmless because $srcdir is `.', but things will broke when you
220 # start a VPATH build or use an absolute $srcdir.
222 # So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
223 # iff we strip the leading $srcdir from $ac_aux_dir. That would be:
224 # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
225 # and then we would define $MISSING as
226 # MISSING="\${SHELL} $am_aux_dir/missing"
227 # This will work as long as MISSING is not called from configure, because
228 # unfortunately $(top_srcdir) has no meaning in configure.
229 # However there are other variables, like CC, which are often used in
230 # configure, and could therefore not use this "fixed" $ac_aux_dir.
232 # Another solution, used here, is to always expand $ac_aux_dir to an
233 # absolute PATH. The drawback is that using absolute paths prevent a
234 # configured tree to be moved without reconfiguration.
236 AC_DEFUN([AM_AUX_DIR_EXPAND],
237 [dnl Rely on autoconf to set up CDPATH properly.
239 # expand $ac_aux_dir to an absolute path
240 am_aux_dir=`cd $ac_aux_dir && pwd`
243 # AM_CONDITIONAL -*- Autoconf -*-
245 # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
246 # Free Software Foundation, Inc.
248 # This file is free software; the Free Software Foundation
249 # gives unlimited permission to copy and/or distribute it,
250 # with or without modifications, as long as this notice is preserved.
254 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
255 # -------------------------------------
256 # Define a conditional.
257 AC_DEFUN([AM_CONDITIONAL],
259 ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
260 [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
270 AC_CONFIG_COMMANDS_PRE(
271 [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
272 AC_MSG_ERROR([[conditional "$1" was never defined.
273 Usually this means the macro was only invoked conditionally.]])
276 # Do all the work for Automake. -*- Autoconf -*-
278 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
279 # Free Software Foundation, Inc.
281 # This file is free software; the Free Software Foundation
282 # gives unlimited permission to copy and/or distribute it,
283 # with or without modifications, as long as this notice is preserved.
287 # This macro actually does too much. Some checks are only needed if
288 # your package does certain things. But this isn't really a big deal.
290 # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
291 # AM_INIT_AUTOMAKE([OPTIONS])
292 # -----------------------------------------------
293 # The call with PACKAGE and VERSION arguments is the old style
294 # call (pre autoconf-2.50), which is being phased out. PACKAGE
295 # and VERSION should now be passed to AC_INIT and removed from
296 # the call to AM_INIT_AUTOMAKE.
297 # We support both call styles for the transition. After
298 # the next Automake release, Autoconf can make the AC_INIT
299 # arguments mandatory, and then we can depend on a new Autoconf
300 # release and drop the old call support.
301 AC_DEFUN([AM_INIT_AUTOMAKE],
302 [AC_PREREQ([2.58])dnl
303 dnl Autoconf wants to disallow AM_ names. We explicitly allow
304 dnl the ones we care about.
305 m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
306 AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
307 AC_REQUIRE([AC_PROG_INSTALL])dnl
308 # test to see if srcdir already configured
309 if test "`cd $srcdir && pwd`" != "`pwd`" &&
310 test -f $srcdir/config.status; then
311 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
314 # test whether we have cygpath
315 if test -z "$CYGPATH_W"; then
316 if (cygpath --version) >/dev/null 2>/dev/null; then
317 CYGPATH_W='cygpath -w'
322 AC_SUBST([CYGPATH_W])
324 # Define the identity of the package.
325 dnl Distinguish between old-style and new-style calls.
327 [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
328 AC_SUBST([PACKAGE], [$1])dnl
329 AC_SUBST([VERSION], [$2])],
330 [_AM_SET_OPTIONS([$1])dnl
331 AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
332 AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
334 _AM_IF_OPTION([no-define],,
335 [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
336 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
338 # Some tools Automake needs.
339 AC_REQUIRE([AM_SANITY_CHECK])dnl
340 AC_REQUIRE([AC_ARG_PROGRAM])dnl
341 AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
342 AM_MISSING_PROG(AUTOCONF, autoconf)
343 AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
344 AM_MISSING_PROG(AUTOHEADER, autoheader)
345 AM_MISSING_PROG(MAKEINFO, makeinfo)
347 AM_PROG_INSTALL_STRIP
348 AC_REQUIRE([AM_PROG_MKDIR_P])dnl
349 # We need awk for the "check" target. The system "awk" is bad on
351 AC_REQUIRE([AC_PROG_AWK])dnl
352 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
353 AC_REQUIRE([AM_SET_LEADING_DOT])dnl
354 _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
355 [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
356 [_AM_PROG_TAR([v7])])])
357 _AM_IF_OPTION([no-dependencies],,
358 [AC_PROVIDE_IFELSE([AC_PROG_CC],
359 [_AM_DEPENDENCIES(CC)],
360 [define([AC_PROG_CC],
361 defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
362 AC_PROVIDE_IFELSE([AC_PROG_CXX],
363 [_AM_DEPENDENCIES(CXX)],
364 [define([AC_PROG_CXX],
365 defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
370 # When config.status generates a header, we must update the stamp-h file.
371 # This file resides in the same directory as the config header
372 # that is generated. The stamp files are numbered to have different names.
374 # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
375 # loop where config.status creates the headers, so we can generate
376 # our stamp files there.
377 AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
378 [# Compute $1's index in $config_headers.
380 for _am_header in $config_headers :; do
385 _am_stamp_count=`expr $_am_stamp_count + 1` ;;
388 echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
390 # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
392 # This file is free software; the Free Software Foundation
393 # gives unlimited permission to copy and/or distribute it,
394 # with or without modifications, as long as this notice is preserved.
398 # Define $install_sh.
399 AC_DEFUN([AM_PROG_INSTALL_SH],
400 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
401 install_sh=${install_sh-"$am_aux_dir/install-sh"}
402 AC_SUBST(install_sh)])
404 # Copyright (C) 2003, 2005 Free Software Foundation, Inc.
406 # This file is free software; the Free Software Foundation
407 # gives unlimited permission to copy and/or distribute it,
408 # with or without modifications, as long as this notice is preserved.
412 # Check whether the underlying file-system supports filenames
413 # with a leading dot. For instance MS-DOS doesn't.
414 AC_DEFUN([AM_SET_LEADING_DOT],
415 [rm -rf .tst 2>/dev/null
416 mkdir .tst 2>/dev/null
417 if test -d .tst; then
422 rmdir .tst 2>/dev/null
423 AC_SUBST([am__leading_dot])])
425 # Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
428 # Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005
429 # Free Software Foundation, Inc.
431 # This file is free software; the Free Software Foundation
432 # gives unlimited permission to copy and/or distribute it,
433 # with or without modifications, as long as this notice is preserved.
437 AC_DEFUN([AM_MAINTAINER_MODE],
438 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
439 dnl maintainer-mode is disabled by default
440 AC_ARG_ENABLE(maintainer-mode,
441 [ --enable-maintainer-mode enable make rules and dependencies not useful
442 (and sometimes confusing) to the casual installer],
443 USE_MAINTAINER_MODE=$enableval,
444 USE_MAINTAINER_MODE=no)
445 AC_MSG_RESULT([$USE_MAINTAINER_MODE])
446 AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes])
447 MAINT=$MAINTAINER_MODE_TRUE
452 AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
454 # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
456 # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
457 # Free Software Foundation, Inc.
459 # This file is free software; the Free Software Foundation
460 # gives unlimited permission to copy and/or distribute it,
461 # with or without modifications, as long as this notice is preserved.
465 # AM_MISSING_PROG(NAME, PROGRAM)
466 # ------------------------------
467 AC_DEFUN([AM_MISSING_PROG],
468 [AC_REQUIRE([AM_MISSING_HAS_RUN])
469 $1=${$1-"${am_missing_run}$2"}
475 # Define MISSING if not defined so far and test if it supports --run.
476 # If it does, set am_missing_run to use it, otherwise, to nothing.
477 AC_DEFUN([AM_MISSING_HAS_RUN],
478 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
479 test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
480 # Use eval to expand $SHELL
481 if eval "$MISSING --run true"; then
482 am_missing_run="$MISSING --run "
485 AC_MSG_WARN([`missing' script is too old or missing])
489 # Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
491 # This file is free software; the Free Software Foundation
492 # gives unlimited permission to copy and/or distribute it,
493 # with or without modifications, as long as this notice is preserved.
497 # Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
499 # Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
500 # created by `make install' are always world readable, even if the
501 # installer happens to have an overly restrictive umask (e.g. 077).
502 # This was a mistake. There are at least two reasons why we must not
504 # - it causes special bits like SGID to be ignored,
505 # - it may be too restrictive (some setups expect 775 directories).
507 # Do not use -m 0755 and let people choose whatever they expect by
510 # We cannot accept any implementation of `mkdir' that recognizes `-p'.
511 # Some implementations (such as Solaris 8's) are not thread-safe: if a
512 # parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
513 # concurrently, both version can detect that a/ is missing, but only
514 # one can create it and the other will error out. Consequently we
515 # restrict ourselves to GNU make (using the --version option ensures
517 AC_DEFUN([AM_PROG_MKDIR_P],
518 [if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
519 # We used to keeping the `.' as first argument, in order to
520 # allow $(mkdir_p) to be used without argument. As in
521 # $(mkdir_p) $(somedir)
522 # where $(somedir) is conditionally defined. However this is wrong
524 # 1. if the package is installed by a user who cannot write `.'
525 # make install will fail,
526 # 2. the above comment should most certainly read
527 # $(mkdir_p) $(DESTDIR)$(somedir)
528 # so it does not work when $(somedir) is undefined and
530 # To support the latter case, we have to write
531 # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
532 # so the `.' trick is pointless.
533 mkdir_p='mkdir -p --'
535 # On NextStep and OpenStep, the `mkdir' command does not
536 # recognize any option. It will interpret all options as
537 # directories to create, and then abort because `.' already
539 for d in ./-p ./--version;
541 test -d $d && rmdir $d
543 # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
544 if test -f "$ac_aux_dir/mkinstalldirs"; then
545 mkdir_p='$(mkinstalldirs)'
547 mkdir_p='$(install_sh) -d'
550 AC_SUBST([mkdir_p])])
552 # Helper functions for option handling. -*- Autoconf -*-
554 # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
556 # This file is free software; the Free Software Foundation
557 # gives unlimited permission to copy and/or distribute it,
558 # with or without modifications, as long as this notice is preserved.
562 # _AM_MANGLE_OPTION(NAME)
563 # -----------------------
564 AC_DEFUN([_AM_MANGLE_OPTION],
565 [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
567 # _AM_SET_OPTION(NAME)
568 # ------------------------------
569 # Set option NAME. Presently that only means defining a flag for this option.
570 AC_DEFUN([_AM_SET_OPTION],
571 [m4_define(_AM_MANGLE_OPTION([$1]), 1)])
573 # _AM_SET_OPTIONS(OPTIONS)
574 # ----------------------------------
575 # OPTIONS is a space-separated list of Automake options.
576 AC_DEFUN([_AM_SET_OPTIONS],
577 [AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
579 # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
580 # -------------------------------------------
581 # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
582 AC_DEFUN([_AM_IF_OPTION],
583 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
585 # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
586 # Free Software Foundation, Inc.
588 # This file is free software; the Free Software Foundation
589 # gives unlimited permission to copy and/or distribute it,
590 # with or without modifications, as long as this notice is preserved.
592 # AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
593 # ---------------------------------------------------------------------------
594 # Adds support for distributing Python modules and packages. To
595 # install modules, copy them to $(pythondir), using the python_PYTHON
596 # automake variable. To install a package with the same name as the
597 # automake package, install to $(pkgpythondir), or use the
598 # pkgpython_PYTHON automake variable.
600 # The variables $(pyexecdir) and $(pkgpyexecdir) are provided as
601 # locations to install python extension modules (shared libraries).
602 # Another macro is required to find the appropriate flags to compile
605 # If your package is configured with a different prefix to python,
606 # users will have to add the install directory to the PYTHONPATH
607 # environment variable, or create a .pth file (see the python
608 # documentation for details).
610 # If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will
611 # cause an error if the version of python installed on the system
612 # doesn't meet the requirement. MINIMUM-VERSION should consist of
613 # numbers and dots only.
614 AC_DEFUN([AM_PATH_PYTHON],
616 dnl Find a Python interpreter. Python versions prior to 1.5 are not
617 dnl supported because the default installation locations changed from
618 dnl $prefix/lib/site-python in 1.4 to $prefix/lib/python1.5/site-packages
620 m4_define_default([_AM_PYTHON_INTERPRETER_LIST],
621 [python python2 python2.5 python2.4 python2.3 python2.2 dnl
622 python2.1 python2.0 python1.6 python1.5])
625 dnl No version check is needed.
626 # Find any Python interpreter.
627 if test -z "$PYTHON"; then
628 AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :)
630 am_display_PYTHON=python
632 dnl A version check is needed.
633 if test -n "$PYTHON"; then
634 # If the user set $PYTHON, use it and don't search something else.
635 AC_MSG_CHECKING([whether $PYTHON version >= $1])
636 AM_PYTHON_CHECK_VERSION([$PYTHON], [$1],
637 [AC_MSG_RESULT(yes)],
638 [AC_MSG_ERROR(too old)])
639 am_display_PYTHON=$PYTHON
641 # Otherwise, try each interpreter until we find one that satisfies
643 AC_CACHE_CHECK([for a Python interpreter with version >= $1],
644 [am_cv_pathless_PYTHON],[
645 for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do
646 test "$am_cv_pathless_PYTHON" = none && break
647 AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break])
649 # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON.
650 if test "$am_cv_pathless_PYTHON" = none; then
653 AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON])
655 am_display_PYTHON=$am_cv_pathless_PYTHON
659 if test "$PYTHON" = :; then
660 dnl Run any user-specified action, or abort.
661 m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])])
664 dnl Query Python for its version number. Getting [:3] seems to be
665 dnl the best way to do this; it's what "site.py" does in the standard
668 AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version],
669 [am_cv_python_version=`$PYTHON -c "import sys; print sys.version[[:3]]"`])
670 AC_SUBST([PYTHON_VERSION], [$am_cv_python_version])
672 dnl Use the values of $prefix and $exec_prefix for the corresponding
673 dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX. These are made
674 dnl distinct variables so they can be overridden if need be. However,
675 dnl general consensus is that you shouldn't need this ability.
677 AC_SUBST([PYTHON_PREFIX], ['${prefix}'])
678 AC_SUBST([PYTHON_EXEC_PREFIX], ['${exec_prefix}'])
680 dnl At times (like when building shared libraries) you may want
681 dnl to know which OS platform Python thinks this is.
683 AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform],
684 [am_cv_python_platform=`$PYTHON -c "import sys; print sys.platform"`])
685 AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform])
688 dnl Set up 4 directories:
690 dnl pythondir -- where to install python scripts. This is the
691 dnl site-packages directory, not the python standard library
692 dnl directory like in previous automake betas. This behavior
693 dnl is more consistent with lispdir.m4 for example.
694 dnl Query distutils for this directory. distutils does not exist in
695 dnl Python 1.5, so we fall back to the hardcoded directory if it
697 AC_CACHE_CHECK([for $am_display_PYTHON script directory],
698 [am_cv_python_pythondir],
699 [am_cv_python_pythondir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFIX')" 2>/dev/null ||
700 echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"`])
701 AC_SUBST([pythondir], [$am_cv_python_pythondir])
703 dnl pkgpythondir -- $PACKAGE directory under pythondir. Was
704 dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is
705 dnl more consistent with the rest of automake.
707 AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE])
709 dnl pyexecdir -- directory for installing python extension modules
710 dnl (shared libraries)
711 dnl Query distutils for this directory. distutils does not exist in
712 dnl Python 1.5, so we fall back to the hardcoded directory if it
714 AC_CACHE_CHECK([for $am_display_PYTHON extension module directory],
715 [am_cv_python_pyexecdir],
716 [am_cv_python_pyexecdir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(1,0,prefix='$PYTHON_EXEC_PREFIX')" 2>/dev/null ||
717 echo "${PYTHON_EXEC_PREFIX}/lib/python${PYTHON_VERSION}/site-packages"`])
718 AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir])
720 dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE)
722 AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE])
724 dnl Run any user-specified action.
731 # AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
732 # ---------------------------------------------------------------------------
733 # Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION.
734 # Run ACTION-IF-FALSE otherwise.
735 # This test uses sys.hexversion instead of the string equivalent (first
736 # word of sys.version), in order to cope with versions such as 2.2c1.
737 # hexversion has been introduced in Python 1.5.2; it's probably not
738 # worth to support older versions (1.5.1 was released on October 31, 1998).
739 AC_DEFUN([AM_PYTHON_CHECK_VERSION],
740 [prog="import sys, string
741 # split strings by '.' and convert to numeric. Append some zeros
742 # because we need at least 4 digits for the hex conversion.
743 minver = map(int, string.split('$2', '.')) + [[0, 0, 0]]
745 for i in xrange(0, 4): minverhex = (minverhex << 8) + minver[[i]]
746 sys.exit(sys.hexversion < minverhex)"
747 AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])])
749 # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
751 # This file is free software; the Free Software Foundation
752 # gives unlimited permission to copy and/or distribute it,
753 # with or without modifications, as long as this notice is preserved.
755 # AM_RUN_LOG(COMMAND)
756 # -------------------
757 # Run COMMAND, save the exit status in ac_status, and log it.
758 # (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
759 AC_DEFUN([AM_RUN_LOG],
760 [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
761 ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
763 echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
764 (exit $ac_status); }])
766 # Check to make sure that the build environment is sane. -*- Autoconf -*-
768 # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
769 # Free Software Foundation, Inc.
771 # This file is free software; the Free Software Foundation
772 # gives unlimited permission to copy and/or distribute it,
773 # with or without modifications, as long as this notice is preserved.
779 AC_DEFUN([AM_SANITY_CHECK],
780 [AC_MSG_CHECKING([whether build environment is sane])
783 echo timestamp > conftest.file
784 # Do `set' in a subshell so we don't clobber the current shell's
785 # arguments. Must try -L first in case configure is actually a
786 # symlink; some systems play weird games with the mod time of symlinks
787 # (eg FreeBSD returns the mod time of the symlink's containing
790 set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
791 if test "$[*]" = "X"; then
793 set X `ls -t $srcdir/configure conftest.file`
796 if test "$[*]" != "X $srcdir/configure conftest.file" \
797 && test "$[*]" != "X conftest.file $srcdir/configure"; then
799 # If neither matched, then we have a broken ls. This can happen
800 # if, for instance, CONFIG_SHELL is bash and it inherits a
801 # broken ls alias from the environment. This has actually
802 # happened. Such a system could not be considered "sane".
803 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
804 alias in your environment])
807 test "$[2]" = conftest.file
813 AC_MSG_ERROR([newly created file is older than distributed files!
814 Check your system clock])
818 # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
820 # This file is free software; the Free Software Foundation
821 # gives unlimited permission to copy and/or distribute it,
822 # with or without modifications, as long as this notice is preserved.
824 # AM_PROG_INSTALL_STRIP
825 # ---------------------
826 # One issue with vendor `install' (even GNU) is that you can't
827 # specify the program used to strip binaries. This is especially
828 # annoying in cross-compiling environments, where the build's strip
829 # is unlikely to handle the host's binaries.
830 # Fortunately install-sh will honor a STRIPPROG variable, so we
831 # always use install-sh in `make install-strip', and initialize
832 # STRIPPROG with the value of the STRIP variable (set by the user).
833 AC_DEFUN([AM_PROG_INSTALL_STRIP],
834 [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
835 # Installed binaries are usually stripped using `strip' when the user
836 # run `make install-strip'. However `strip' might not be the right
837 # tool to use in cross-compilation environments, therefore Automake
838 # will honor the `STRIP' environment variable to overrule this program.
839 dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
840 if test "$cross_compiling" != no; then
841 AC_CHECK_TOOL([STRIP], [strip], :)
843 INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
844 AC_SUBST([INSTALL_STRIP_PROGRAM])])
846 # Check how to create a tarball. -*- Autoconf -*-
848 # Copyright (C) 2004, 2005 Free Software Foundation, Inc.
850 # This file is free software; the Free Software Foundation
851 # gives unlimited permission to copy and/or distribute it,
852 # with or without modifications, as long as this notice is preserved.
856 # _AM_PROG_TAR(FORMAT)
857 # --------------------
858 # Check how to create a tarball in format FORMAT.
859 # FORMAT should be one of `v7', `ustar', or `pax'.
861 # Substitute a variable $(am__tar) that is a command
862 # writing to stdout a FORMAT-tarball containing the directory
864 # tardir=directory && $(am__tar) > result.tar
866 # Substitute a variable $(am__untar) that extract such
867 # a tarball read from stdin.
868 # $(am__untar) < result.tar
869 AC_DEFUN([_AM_PROG_TAR],
870 [# Always define AMTAR for backward compatibility.
871 AM_MISSING_PROG([AMTAR], [tar])
873 [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
874 [m4_case([$1], [ustar],, [pax],,
875 [m4_fatal([Unknown tar format])])
876 AC_MSG_CHECKING([how to create a $1 tar archive])
877 # Loop over all known methods to create a tar archive until one works.
878 _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
879 _am_tools=${am_cv_prog_tar_$1-$_am_tools}
880 # Do not fold the above two line into one, because Tru64 sh and
881 # Solaris sh will not grok spaces in the rhs of `-'.
882 for _am_tool in $_am_tools
886 for _am_tar in tar gnutar gtar;
888 AM_RUN_LOG([$_am_tar --version]) && break
890 am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
891 am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
892 am__untar="$_am_tar -xf -"
895 # Must skip GNU tar: if it does not support --format= it doesn't create
896 # ustar tarball either.
897 (tar --version) >/dev/null 2>&1 && continue
898 am__tar='tar chf - "$$tardir"'
899 am__tar_='tar chf - "$tardir"'
903 am__tar='pax -L -x $1 -w "$$tardir"'
904 am__tar_='pax -L -x $1 -w "$tardir"'
908 am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
909 am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
910 am__untar='cpio -i -H $1 -d'
919 # If the value was cached, stop now. We just wanted to have am__tar
921 test -n "${am_cv_prog_tar_$1}" && break
923 # tar/untar a dummy directory, and stop if the command works
926 echo GrepMe > conftest.dir/file
927 AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
929 if test -s conftest.tar; then
930 AM_RUN_LOG([$am__untar <conftest.tar])
931 grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
936 AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
937 AC_MSG_RESULT([$am_cv_prog_tar_$1])])
939 AC_SUBST([am__untar])
942 m4_include([acinclude.m4])