aclocal: When checking for `environ', don't find `__environ'.
[cfd] / aclocal.glob
index 6e48f26..bce4c97 100644 (file)
@@ -28,24 +28,6 @@ dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 dnl *@--NOTICE--@* Common File Distribution
 dnl $Id$
 
-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 --- *@-mdw_CURSES-@* ---
 dnl
 dnl Author:    Mark Wooding
@@ -64,14 +46,16 @@ dnl         Finally, a check is made for the function `wresize' using
 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])
@@ -101,7 +85,7 @@ AC_CACHE_CHECK(for ssize_t, mdw_cv_ssize_t,
 #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-@* ---
@@ -118,7 +102,7 @@ dnl         is defined as a preprocessor symbol.
 
 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>
@@ -128,7 +112,8 @@ AC_DEFUN([mdw_DECL_ENVIRON],
 #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-@* ---
@@ -173,13 +158,100 @@ 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],
+[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.
 
 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(<:, :>)
+define(<:mdw__PERL_VERSION_hack:>, 
+<:test -x $1 && $1 -e 'exit ($] < $2);' >&5 2>&5:>)
 changequote([, ])
 
 dnl --- *@-mdw_PROG_PERL-@* ---
@@ -210,7 +282,7 @@ 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
+  case "$p" in /*) ;; *) p=`pwd`/$p ;; esac
   if mdw__PERL_VERSION(["$p/perl"], $1); then
     mdw_cv_prog_perl="$p/perl"
     break
@@ -243,7 +315,7 @@ 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], [$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])
@@ -281,7 +353,7 @@ AC_SUBST(NEEDED_PERLLIBS)dnl
 
 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"
@@ -422,7 +494,7 @@ dnl
 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-@* ---
@@ -438,7 +510,7 @@ dnl
 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-@* ---
@@ -454,7 +526,7 @@ dnl
 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-@* ---
@@ -472,7 +544,8 @@ AC_DEFUN([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-@* ---
@@ -507,7 +580,7 @@ AC_DEFUN([mdw_OPT_TRACE],
 [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-@* ---
@@ -534,11 +607,13 @@ AC_DEFUN([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
@@ -551,14 +626,14 @@ 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
@@ -593,8 +668,11 @@ case "$t" in 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