- AC_DEFINE([DECL_ENVIRON], [1],
- [Define if environ is declared somewhere sensible.])
-fi])
-
-dnl --- *@-mdw_CHECK_MANYLIBS-@* ---
-dnl
-dnl Author: Mark Wooding
-dnl
-dnl Synopsis: mdw_CHECK_MANYLIBS(FUNC, LIBS, [IF-FOUND], [IF-NOT-FOUND],
-dnl [INCLUDES], [ARGS])
-dnl
-dnl Arguments: FUNC = a function to try to find
-dnl LIBS = a whitespace-separated list of libraries to search
-dnl IF-FOUND = what to do when the function is found
-dnl IF-NOT-FOUND = what to do when the function isn't found
-dnl INCLUDES = other include files to add
-dnl ARGS = arguments to pass the function
-dnl
-dnl Use: Searches for a library which defines FUNC. It first tries
-dnl without any libraries; then it tries each library specified
-dnl in LIBS in turn. If it finds a match, it adds the
-dnl appropriate library to `LIBS'.
-dnl
-dnl This is particularly handy under DIREIX: if you link with
-dnl `-lnsl' then you get non-NIS-aware versions of getpwnam and
-dnl so on, which is clearly a Bad Thing.
-
-AC_DEFUN([mdw_CHECK_MANYLIBS],
-[AC_CACHE_CHECK([for library containing $1], [mdw_cv_lib_$1],
-[mdw_save_LIBS="$LIBS"
-mdw_cv_lib_$1="no"
-AC_TRY_LINK([$5], [$1($6)], [mdw_cv_lib_$1="none required"])
-test "$mdw_cv_lib_$1" = "no" && for i in $2; do
-LIBS="-l$i $mdw_save_LIBS"
-AC_TRY_LINK([$5], [$1($6)],
-[mdw_cv_lib_$1="-l$i"
-break])
-done
-LIBS="$mdw_save_LIBS"])
-if test "$mdw_cv_lib_$1" != "no"; then
- test "$mdw_cv_lib_$1" = "none required" || LIBS="$mdw_cv_lib_$1 $LIBS"
- $3
-else :
- $4
-fi])
-
-dnl --- *@-mdw__PYTHON_VERSION-@* ---
-dnl
-dnl Will fail hopelessly on Python < 1.5.2. Nobody uses that any more,
-dnl right?
-
-AC_DEFUN([mdw__PYTHON_VERSION],
-[$1 -c 'from sys import *; v = argv[1]; vv = v.split("."); x = 0
-for i in range(len(vv)): x = x | (int(vv[i]) << (24 - i * 8))
-exit(x > hexversion)' $2])
-
-dnl --- *@-mdw_PROG_PYTHON-@* ---
-dnl
-dnl Author: Mark Wooding
-dnl
-dnl Synopsis: mdw_PROG_PYTHON(VERSION, [IF-FOUND], [IF-NOT-FOUND])
-dnl
-dnl Arguments: VERSION = version number of Python required
-dnl IF-FOUND = what to do if it's found
-dnl IF-NOT-FOUND = what to do if it isn't
-dnl
-dnl Use: Attempts to find a working version of Python with a late
-dnl enough version number. It supplies an option `--with-python'
-dnl to allow the user to provide a Python interpreter. If one
-dnl isn't provided explicitly, it searches for `python' and
-dnl `pythonVERSION' in the current PATH, asking them whether they
-dnl have a late enough version number. The path of the working
-dnl Python is put into the `PYTHON' environment variable;
-dnl `AC_SUBST' is used to substitute its value into Python
-dnl scripts. If there is no Python to be found, the value of
-dnl `PYTHON' is set to be `none'.
-
-AC_DEFUN([mdw_PROG_PYTHON],
-[AC_ARG_WITH([python],
-[ --with-python=PYTHON specify path to Python version $1 or newer],
-[PYTHON="$withval"],
-if test -z "$PYTHON"; then
-[AC_CACHE_CHECK([for Python version $1 or later], mdw_cv_prog_python,
-[mdw_cv_prog_python="none"
-for p in `echo "$PATH:/usr/local/bin" | tr ":" " "`; do
- case $p in /*) ;; *) p=`pwd`/$p ;; esac
- if mdw__PYTHON_VERSION(["$p/python"], $1); then
- mdw_cv_prog_python="$p/python"
- break
- fi
- if mdw__PYTHON_VERSION(["$p/python$1"], $1); then
- mdw_cv_prog_python="$p/python$1"
- break
- fi
-done])
-PYTHON="$mdw_cv_prog_python"])
-fi
-
-AC_SUBST(PYTHON)dnl
-if test "$PYTHON" = "none"; then :
- $3
-else :
- $2
-fi])
-
-dnl --- *@-mdw_CHECK_PYTHON-@* ---
-dnl
-dnl Author: Mark Wooding
-dnl
-dnl Synopsis: mdw_CHECK_PYTHON(VERSION)
-dnl
-dnl Arguments: VERSION = version number of Python required
-dnl
-dnl Use: Verifies that the Python interpreter in the `PYTHON' shell
-dnl variable actually works and is of the right version. If it's
-dnl not, an error is raised and configuration is aborted.
-
-AC_DEFUN([mdw_CHECK_PYTHON],
-[mdw_REQUIRE([mdw_PROG_PYTHON], [mdw_PROG_PYTHON([$1])])
-AC_MSG_CHECKING([whether Python ($PYTHON) works])
-if test "$PYTHON" != "none" && mdw__PYTHON_VERSION("$PYTHON", $1); then
- AC_MSG_RESULT([yes])
-else
- AC_MSG_RESULT([no])
- AC_MSG_ERROR([Python version $1 or newer not found.
-If you have a recent enough Python, and I just failed to find it, try using
-the --with-python=PYTHON option to give me an explicit pathname.])
-fi])
-
-dnl --- *@-mdw__PERL_VERSION-@* ---
-dnl
-dnl AC_DEFUN relies on `[', `]' being quotes, so I have to drop down a level.
-
-AC_DEFUN([mdw__PERL_VERSION], [mdw__PERL_VERSION_hack([$1], [$2])])
-changequote(<<, >>)
-define(<<mdw__PERL_VERSION_hack>>, <<$1 -e 'exit ($] < $2);' >&5 2>&5>>)
-changequote([, ])
-
-dnl --- *@-mdw_PROG_PERL-@* ---
-dnl
-dnl Author: Mark Wooding
-dnl
-dnl Synopsis: mdw_PROG_PERL(VERSION, [IF-FOUND], [IF-NOT-FOUND])
-dnl
-dnl Arguments: VERSION = version number of Perl required
-dnl IF-FOUND = what to do if it's found
-dnl IF-NOT-FOUND = what to do if it isn't
-dnl
-dnl Use: Attempts to find a working version of Perl with a late
-dnl enough version number. It supplies an option `--with-perl'
-dnl to allow the user to provide a Perl interpreter. If one
-dnl isn't provided explicitly, it searches for `perl' and `perl5'
-dnl in the current PATH, asking them whether they have a late
-dnl enough version number. The path of the working Perl is
-dnl put into the `PERL' environment variable; `AC_SUBST' is used
-dnl to substitute its value into Perl scripts. If there is no
-dnl Perl to be found, the value of `PERL' is set to be `none'.
-
-AC_DEFUN([mdw_PROG_PERL],
-[AC_ARG_WITH([perl],
-[ --with-perl=PERL specify path to Perl version $1 or newer],
-[PERL="$withval"],
-if test -z "$PERL"; then
-[AC_CACHE_CHECK([for Perl version $1 or later], mdw_cv_prog_perl,
-[mdw_cv_prog_perl="none"
-for p in `echo "$PATH:/usr/local/bin" | tr ":" " "`; do
- case $p in /*) ;; *) p=`pwd`/$p ;; esac
- if mdw__PERL_VERSION(["$p/perl"], $1); then
- mdw_cv_prog_perl="$p/perl"
- break
- fi
- if mdw__PERL_VERSION(["$p/perl5"], $1); then
- mdw_cv_prog_perl="$p/perl5"
- break
- fi
-done])
-PERL="$mdw_cv_prog_perl"])
-fi
-
-AC_SUBST(PERL)dnl
-if test "$PERL" = "none"; then :
- $3
-else :
- $2
-fi])
-
-dnl --- *@-mdw_CHECK_PERL-@* ---
-dnl
-dnl Author: Mark Wooding
-dnl
-dnl Synopsis: mdw_CHECK_PERL(VERSION)
-dnl
-dnl Arguments: VERSION = version number of Perl required
-dnl
-dnl Use: Verifies that the Perl interpreter in the `PERL' shell
-dnl variable actually works and is of the right version. If it's
-dnl not, an error is raised and configuration is aborted.
-
-AC_DEFUN([mdw_CHECK_PERL],
-[mdw_REQUIRE([mdw_PROG_PERL], [mdw_PROG_PERL([$1])])
-AC_MSG_CHECKING([whether Perl ($PERL) works])
-if test "$PERL" != "none" && mdw__PERL_VERSION("$PERL", $1); then
- AC_MSG_RESULT([yes])
-else
- AC_MSG_RESULT([no])
- AC_MSG_ERROR([Perl version $1 or newer not found.
-If you have a recent enough Perl, and I just failed to find it, try using
-the --with-perl=PERL option to give me an explicit pathname.])
-fi])
-
-dnl --- *@-mdw_PERLLIB_CHECK-@* ---
-dnl
-dnl Author: Mark Wooding
-dnl
-dnl Synopsis: mdw_PERLLIB_CHECK(LIBRARY)
-dnl
-dnl Arguments: LIBRARY = name of a Perl library to check for
-dnl
-dnl Use: Ensures that a Perl script can `use LIBRARY;'. If it can,
-dnl all's well and good; if it can't, `LIBRARY.pm' is added to
-dnl the variable `NEEDED_PERLLIBS' and a line which adds
-dnl `pkgdatadir' to Perl's `@INC' array is placed in the
-dnl variable `INC_PERLLIBS'; `AC_SUBST' is called for both of
-dnl these variables. It's expected that `NEEDED_PERLLIBS' will
-dnl be used in the `Makefile.in' to decide which versions from
-dnl the distribution need installing.
-dnl
-dnl This macro isn't terribly useful in the general case. It
-dnl Also implicitly assumes that `$PERL' is Perl 5 or later.
-
-AC_DEFUN([mdw__PERLLIB_INIT],
-[AC_SUBST(INC_PERLLIBS)dnl
-AC_SUBST(NEEDED_PERLLIBS)dnl
-])
-
-AC_DEFUN([mdw_PERLLIB_CHECK],
-[AC_REQUIRE([mdw__PERLLIB_INIT])
-mdw_REQUIRE([mdw_CHECK_PERL], [mdw_PROG_PERL([5])])
-AC_CACHE_CHECK([for Perl library $1], mdw_cv_perllib_$1,
-[if $PERL -e 'use $1;' >&5 2>&5; then
- mdw_cv_perllib_$1="yes"
-else
- mdw_cv_perllib_$1="no"
-fi])
-
-if test "$mdw_cv_perllib_$1" = "no"; then
- NEEDED_PERLLIBS="$NEEDED_PERLLIBS $1.pm"
-
- # --- Deal with autoconf lossage ---
- #
- # It doesn't want to define `prefix' until rather later on, so I have
- # to bodge it here.
-
- if test -z "$INC_PERLLIBS"; then
- mdw_old_prefix="$prefix"
- test "$prefix" = "NONE" && prefix="$ac_default_prefix";
- INC_PERLLIBS="BEGIN { push @INC, \"`eval echo $datadir/$PACKAGE`\"; }"
- prefix="$mdw_old_prefix";
- fi
-fi])
-
-dnl --- *@-mdw_GCC_FLAGS-@* ---
-dnl
-dnl Author: Mark Wooding
-dnl
-dnl Synopsis: mdw_GCC_FLAGS([FLAGS], [CFLAGS], [C++FLAGS])
-dnl
-dnl Arguments: FLAGS = GCC compiler flags to add (default is
-dnl `-pedantic -Wall')
-dnl CFLAGS = GCC C compiler flags to add (default is empty)
-dnl C++FLAGS = GCC C++ compiler flags to add (default is
-dnl `-fhandle-exceptions').
-dnl
-dnl Use: If the C compiler is GCC, add the compiler flags.
-
-AC_DEFUN([mdw_GCC_FLAGS],
-[if test "$GCC" = "yes"; then
- CFLAGS="$CFLAGS ifelse([$1], [], [-pedantic -Wall], [$1])"
- CFLAGS="$CFLAGS ifelse([$2], [], [], [$2])"
-fi
-if test "$GXX" = "yes"; then
- CXXFLAGS="$CXXFLAGS ifelse([$1], [], [-pedantic -Wall], [$1])"
- CXXFLAGS="$CXXFLAGS ifelse([$3], [], [-fhandle-exceptions], [$3])"