dnl -*-fundamental-*- *@--GLOB-HEADER--@*
dnl
-dnl $Id: aclocal.glob,v 1.17 2003/09/24 22:45:57 mdw Exp $
+dnl $Id$
dnl
dnl Common library of autoconf macros
dnl
dnl along with `common'; if not, write to the Free Software Foundation,
dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-dnl----- Revision history ---------------------------------------------------
-dnl
-dnl $Log: aclocal.glob,v $
-dnl Revision 1.17 2003/09/24 22:45:57 mdw
-dnl Support Automake's `aclocal' scheme. Deposit Autoconf fragments in
-dnl `aclocal's' repository. Apply heinous bodging to `txtlib' and
-dnl `mkaclocal'.
-dnl
-dnl Revision 1.16 2003/04/23 12:47:22 mdw
-dnl Add mdw_MANEXT.
-dnl
-dnl Revision 1.15 2002/02/19 22:50:24 mdw
-dnl Fix spelling. Add new macro which works out where to put TeX files.
-dnl
-dnl Revision 1.14 2002/02/03 19:15:15 mdw
-dnl Add SDL-finding equipment. Quote some macro names which need it. Add
-dnl long-overdue macros for expanding configured paths (and do it
-dnl properly).
-dnl
-dnl Revision 1.13 2001/02/23 09:07:24 mdw
-dnl Restore temporary variable on exit.
-dnl
-dnl Revision 1.12 2001/02/04 01:18:52 mdw
-dnl Overhaul the mLib debugging options.
-dnl
-dnl Revision 1.11 2001/01/20 12:03:08 mdw
-dnl Remove redundant stuff.
-dnl
-dnl Revision 1.10 2000/10/14 16:32:15 mdw
-dnl Fixes from upstream.
-dnl
-dnl Revision 1.9 2000/08/15 21:37:49 mdw
-dnl New initialization macro for libraries, and a new base client macro for
-dnl finding libraries with an appropriate version.
-dnl
-dnl Revision 1.8 1999/11/26 01:23:17 mdw
-dnl And support for MXD (not yet released).
-dnl
-dnl Revision 1.7 1999/11/11 20:03:58 mdw
-dnl Add support for mgLib too.
-dnl
-dnl Revision 1.6 1999/11/11 17:49:33 mdw
-dnl New macros for configuring clients of mLib and Catacomb.
-dnl
-dnl Revision 1.5 1999/07/27 18:27:37 mdw
-dnl Fix typo in header line for mdw_DECL_ENVIRON.
-dnl
-dnl Revision 1.4 1999/07/26 23:44:32 mdw
-dnl Reorder and tidy documentation.
-dnl
-dnl Revision 1.3 1999/07/17 10:27:44 mdw
-dnl More useful macros added.
-dnl
-dnl Revision 1.2 1999/05/13 22:57:23 mdw
-dnl Change `-ise' to `-ize' throughout.
-dnl
-dnl Revision 1.1.1.1 1999/05/05 19:23:47 mdw
-dnl New import. The old CVS repository was lost in a disk disaster.
-dnl
-
dnl *@--NOTICE--@* Common File Distribution
-dnl $Id: aclocal.glob,v 1.17 2003/09/24 22:45:57 mdw Exp $
-
-dnl --- *@-mdw_REQUIRE-@* ---
-dnl
-dnl Author: Mark Wooding
-dnl
-dnl Synopsis: mdw_REQUIRE(MACRO, ARGS...)
-dnl
-dnl Arguments: MACRO = name of a macro which should have been called
-dnl ARGS = arguments to pass
-dnl
-dnl Use: Like `AC_REQUIRE', only it handles arguments.
-
-AC_DEFUN([mdw_REQUIRE],
-[ifdef([AC_PROVIDE_$1], ,
-[AC_DIVERT_PUSH(builtin(eval, AC_DIVERSION_CURRENT - 1))dnl
-indir($@)
-AC_DIVERT_POP()dnl
-])])
+dnl $Id$
dnl --- *@-mdw_CURSES-@* ---
dnl
dnl AC_CHECK_FUNCS.
AC_DEFUN([mdw_CURSES],
-[mdw_CHECK_MANYLIBS(newwin, ncurses curses, AC_DEFINE(HAVE_CURSES))
+[mdw_CHECK_MANYLIBS([newwin], [ncurses curses],
+ [AC_DEFINE([HAVE_CURSES], [1],
+ [Define if you have a curses library.])])
if test $mdw_cv_lib_newwin != no; then
AC_CHECK_HEADERS([ncurses.h ncurses/ncurses.h curses.h], [break])
if test "$ac_cv_header_ncurses_h" = "no" &&
test "$ac_cv_header_ncurses_ncurses_h" = "no" &&
test "$ac_cv_header_curses_h" = "no"; then
AC_MSG_WARN([couldn't find a \`curses' header. Assuming \`curses.h'.])
- AC_DEFINE(HAVE_CURSES_H)
+ AC_DEFINE([HAVE_CURSES_H], [1], [Define if you have a `curses.h' header.])
fi
AC_CHECK_FUNCS(wresize)
fi])
#endif],
[mdw_cv_ssize_t=yes], [mdw_cv_ssize_t=no])])
if test $mdw_cv_ssize_t = no; then
- AC_DEFINE(ssize_t, int)
+ AC_DEFINE([ssize_t], [int], [Define to `int' if your system doesn't have ssize_t.])
fi])
dnl --- *@-mdw_DECL_ENVIRON-@* ---
AC_DEFUN([mdw_DECL_ENVIRON],
[AC_CACHE_CHECK([for declaration of \`environ'], mdw_cv_environ,
-[AC_EGREP_CPP(environ,
+[AC_EGREP_CPP([\<environ\>],
[#include <sys/types.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#include <stddef.h>
#endif], [mdw_cv_environ=yes], [mdw_cv_environ=no])])
if test $mdw_cv_environ = yes; then
- AC_DEFINE(DECL_ENVIRON)
+ AC_DEFINE([DECL_ENVIRON], [1],
+ [Define if you have the `environ' vector of environment variables.])
fi])
dnl --- *@-mdw_CHECK_MANYLIBS-@* ---
$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],
+[changequote(<:, :>)dnl
+test -x $1 && dnl
+"$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)' $2dnl
+changequote([, ])])
+
+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],
+[AC_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.
-changequote(<<, >>)
-define([mdw__PERL_VERSION], <<$1 -e 'exit ($] < $2);' >&5 2>&5>>)
+AC_DEFUN([mdw__PERL_VERSION], [mdw__PERL_VERSION_hack([$1], [$2])])
+changequote(<:, :>)
+define(<:mdw__PERL_VERSION_hack:>,
+<:test -x $1 && $1 -e 'exit ($] < $2);' >&5 2>&5:>)
changequote([, ])
dnl --- *@-mdw_PROG_PERL-@* ---
[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
+ case "$p" in /*) ;; *) p=`pwd`/$p ;; esac
if mdw__PERL_VERSION(["$p/perl"], $1); then
mdw_cv_prog_perl="$p/perl"
break
dnl not, an error is raised and configuration is aborted.
AC_DEFUN([mdw_CHECK_PERL],
-[mdw_REQUIRE([mdw_PROG_PERL], [$1])
+[AC_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])
AC_DEFUN([mdw_PERLLIB_CHECK],
[AC_REQUIRE([mdw__PERLLIB_INIT])
-mdw_REQUIRE([mdw_CHECK_PERL], 5)
+AC_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"
dnl Use: Configures an mgLib client program.
AC_DEFUN([mdw_MGLIB],
-[mdw_REQUIRE([mdw_MLIB], [1.6.0])
+[AC_REQUIRE([mdw_MLIB], [mdw_MLIB([2.0.3])])
mdw_LIB_CONFIG(mgLib, mgLib, $@)])
dnl --- *@-mdw_CATACOMB-@* ---
dnl Use: Configures the program as a Catacomb client.
AC_DEFUN([mdw_CATACOMB],
-[mdw_REQUIRE([mdw_MLIB], [1.6.0])
+[AC_REQUIRE([mdw_MLIB], [mdw_MLIB([2.0.3])])
mdw_LIB_CONFIG(catacomb, Catacomb, $@)])
dnl --- *@-mdw_PK-@* ---
dnl Use: Configures the program as a PK client.
AC_DEFUN([mdw_PK],
-[mdw_REQUIRE([mdw_MLIB], [1.6.0])
+[AC_REQUIRE([mdw_MLIB], [mdw_MLIB([2.0.3])])
mdw_LIB_CONFIG(pk, PK, $@)])
dnl --- *@-mdw_OPT_NDEBUG-@* ---
[AC_ARG_ENABLE(debugging,
[ --disable-debugging spews vast swathes of useless information],
[if test "$enableval" = "no"; then
- AC_DEFINE(NDEBUG, 1)
+ AC_DEFINE([NDEBUG], [1],
+ [Define to turn off assertions and other debugging. Not recommended.])
fi])])
dnl --- *@-mdw_OPT_EFENCE-@* ---
[AC_ARG_ENABLE(tracing,
[ --disable-tracing disable output of trace information],
[if test "$enableval" = "no"; then
- AC_DEFINE(NTRACE, 1)
+ AC_DEFINE([NTRACE], [1], [Define to turn off tracing.])
fi])])
dnl --- *@-mdw_OPT_mLib_TRACK-@* ---
[AC_REQUIRE([mdw_OPT_TRACE])
AC_ARG_ENABLE(track,
[ --enable-track enable tracking of malloc and free],
-[AC_DEFINE(TRACK_ENABLE, 1)])
+[AC_DEFINE([TRACK_ENABLE], [1],
+ [Define to turn on memory tracking. Doesn't work properly.])])
AC_ARG_ENABLE(blame-$1,
[ --enable-blame-$1
track malloc contexts while in $1],
-[AC_DEFINE(TRACK_BLAME, 1)])])
+[AC_DEFINE([TRACK_BLAME], [1],
+ [Define to track mallocs in this code.])])])
dnl --- *@-mdw_OPT_mLib_DEBUG-@* ---
dnl
dnl Use: Provides all of the above debugging options.
AC_DEFUN([mdw_OPT_mLib_DEBUG],
-[mdw_REQUIRE([mdw_OPT_NDEBUG])
-mdw_REQUIRE([mdw_OPT_mLib_TRACK], [$1])])
+[AC_REQUIRE([mdw_OPT_NDEBUG])
+AC_REQUIRE([mdw_OPT_mLib_TRACK], [mdw_OPT_mLib_TRACK([$1])])])
dnl --- *@-mdw_DEFINE_PATHS-@*
dnl
dnl Author: Mark Wooding
dnl
-dnl Synopsis: mdw_DEFINE_FILES(CODE)
+dnl Synopsis: mdw_DEFINE_PATHS(CODE)
dnl
dnl Arguments: CODE = shell script code to execute
dnl
*) break;; dnl
esac; done; dnl
echo "$t"`])
-AC_DEFUN([mdw_DEFINE_PROG], [AC_DEFINE_UNQUOTED([$1], ["mdw_PROG([$2])"])])
-AC_DEFUN([mdw_DEFINE_PATH], [AC_DEFINE_UNQUOTED([$1], ["mdw_PATH([$2])"])])
+AC_DEFUN([mdw_DEFINE_PROG],
+ [AC_DEFINE_UNQUOTED([$1], ["mdw_PROG([$2])"],
+ [Program name for $2.])])
+AC_DEFUN([mdw_DEFINE_PATH], [AC_DEFINE_UNQUOTED([$1], ["mdw_PATH([$2])"],
+ [Pathname for $2.])])
dnl --- *@-mdw_DIR_TEXMF-@* ---
dnl