X-Git-Url: https://git.distorted.org.uk/~mdw/cfd/blobdiff_plain/aaa993397614d23a868fcbb5b8b50704538644a3..3d69a2786bcc132232304d1d220735f086abfc53:/aclocal.glob diff --git a/aclocal.glob b/aclocal.glob index 760229c..bce4c97 100644 --- a/aclocal.glob +++ b/aclocal.glob @@ -1,6 +1,6 @@ dnl -*-fundamental-*- *@--GLOB-HEADER--@* dnl -dnl $Id: aclocal.glob,v 1.3 1999/07/17 10:27:44 mdw Exp $ +dnl $Id$ dnl dnl Common library of autoconf macros dnl @@ -25,1055 +25,8 @@ dnl You should have received a copy of the GNU General Public License 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.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----- Common files distribution --------------------------- *@--NOTICE--@* -dnl -dnl $Id: aclocal.glob,v 1.3 1999/07/17 10:27:44 mdw Exp $ - -dnl --- *@-AC_PROG_CC_STDC-@* --- -dnl -dnl Author: Franc,ois Pinard -dnl -dnl Synopsis: AC_PROG_CC_STDC -dnl -dnl Arguments: --- -dnl -dnl Use: If the C compiler in not in ANSI C mode by default, try to -dnl add an option to output variable `CC' to make it so. This -dnl macro tries various options that select ANSI C on some system -dnl or another. It considers the compiler to be in ANSI C mode -dnl if it defines `__STDC__' to 1 and handles function prototypes -dnl correctly. -dnl -dnl If you use this macro, you should check after calling it -dnl whether the C compiler has been set to accept ANSI C; if not, -dnl the shell variable `ac_cv_prog_cc_stdc' is set to `no'. If -dnl you wrote your source code in ANSI C, you can make an -dnl un-ANSIfied copy of it by using the program `ansi2knr', which -dnl comes with Ghostscript. -dnl -dnl (documentation by Franc,ois Pinard) - -AC_DEFUN(AM_PROG_CC_STDC, -[AC_REQUIRE([AC_PROG_CC]) -AC_BEFORE([$0], [AC_C_INLINE]) -AC_BEFORE([$0], [AC_C_CONST]) -AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C) -AC_CACHE_VAL(am_cv_prog_cc_stdc, -[am_cv_prog_cc_stdc=no -ac_save_CC="$CC" -# Don't try gcc -ansi; that turns off useful extensions and -# breaks some systems' header files. -# AIX -qlanglvl=ansi -# Ultrix and OSF/1 -std1 -# HP-UX -Aa -D_HPUX_SOURCE -# SVR4 -Xc -D__EXTENSIONS__ -for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - AC_TRY_COMPILE( -[#if !defined(__STDC__) || __STDC__ != 1 -choke me -#endif -/* DYNIX/ptx V4.1.3 can't compile sys/stat.h with -Xc -D__EXTENSIONS__. */ -#ifdef _SEQUENT_ -# include -# include -#endif -], [ -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);};], -[am_cv_prog_cc_stdc="$ac_arg"; break]) -done -CC="$ac_save_CC" -]) -if test -z "$am_cv_prog_cc_stdc"; then - AC_MSG_RESULT([none needed]) -else - AC_MSG_RESULT($am_cv_prog_cc_stdc) -fi -case "x$am_cv_prog_cc_stdc" in - x|xno) ;; - *) CC="$CC $am_cv_prog_cc_stdc" ;; -esac -]) - -dnl----- AutoMake macros ------------------------------------- *@--IGNORE--@* - -dnl --- *@-AM_CONDITIONAL-@* --- -dnl -dnl Author: Unknown -dnl -dnl Synopsis: AM_CONDITIONAL(NAME, TEST) -dnl -dnl Arguments: NAME = name of the conditional -dnl TEST = a shell list to execute -dnl -dnl Use: Allows conditional sections in Makefiles. - -AC_DEFUN(AM_CONDITIONAL, -[AC_SUBST($1_TRUE) -AC_SUBST($1_FALSE) -if $2; then - $1_TRUE= - $1_FALSE='#' -else - $1_TRUE='#' - $1_FALSE= -fi]) - -dnl --- *@-AM_CYGWIN32-@* --- -dnl -dnl Author: Cygnus (I guess) -dnl -dnl Synopsis: AM_CYGWIN32 -dnl -dnl Arguments: --- -dnl -dnl Use: Check to see if we're running under Cygwin32, without using -dnl AC_CANONICAL_*. If so, set output variable EXEEXT to -dnl ".exe". Otherwise set it to "". - -dnl AM_CYGWIN32() -dnl You might think we can do this by checking for a cygwin32-specific -dnl cpp define. We can't, because cross-compilers that target -dnl cygwin32 don't use the .exe suffix. I don't know why. -AC_DEFUN(AM_CYGWIN32, -[AC_CACHE_CHECK(for Cygwin32 environment, am_cv_cygwin32, -[cat > conftest.$ac_ext << 'EOF' -int main () { -/* Nothing. */ -return 0; } -EOF -if AC_TRY_EVAL(ac_link) && test -s conftest.exe; then - am_cv_cygwin32=yes -else - am_cv_cygwin32=no -fi -rm -f conftest*]) -EXEEXT= -test "$am_cv_cygwin32" = yes && EXEEXT=.exe -AC_SUBST(EXEEXT)]) - -dnl --- *@-AM_WITH_DMALLOC-@* --- -dnl -dnl Author: Franc,ois Pinard -dnl -dnl Synopsis: AM_WITH_DMALLOC -dnl -dnl Arguments: --- -dnl -dnl Use: Links with `-dmalloc' if told to by the user. - -## ----------------------------------- ## -## Check if --with-dmalloc was given. ## -## From Franc,ois Pinard ## -## ----------------------------------- ## - -# serial 1 - -AC_DEFUN(AM_WITH_DMALLOC, -[AC_MSG_CHECKING(if malloc debugging is wanted) -AC_ARG_WITH(dmalloc, -[ --with-dmalloc use dmalloc, as in - ftp://ftp.letters.com/src/dmalloc/dmalloc.tar.gz], -[if test "$withval" = yes; then - AC_MSG_RESULT(yes) - AC_DEFINE(WITH_DMALLOC) - LIBS="$LIBS -ldmalloc" - LDFLAGS="$LDFLAGS -g" -else - AC_MSG_RESULT(no) -fi], [AC_MSG_RESULT(no)]) -]) - -dnl --- *@-AM_FUNC_ERROR_AT_LINE-@* --- -dnl -dnl Author: Jim Meyering -dnl -dnl Synopsis: AM_FUNC_ERROR_AT_LINE -dnl -dnl Arguments: --- -dnl -dnl Use: Use this if you use the GNU error.[ch]. - -dnl FIXME: Migrate into libit - -AC_DEFUN(AM_FUNC_ERROR_AT_LINE, -[AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line, - [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");], - am_cv_lib_error_at_line=yes, - am_cv_lib_error_at_line=no)]) - if test $am_cv_lib_error_at_line = no; then - LIBOBJS="$LIBOBJS error.o" - fi - AC_SUBST(LIBOBJS)dnl -]) - -dnl --- *@-AM_INIT_GUILE_MODULE-@* --- -dnl -dnl Author: Unknown -dnl -dnl Synopsis: AM_INIT_GUILE_MODULE(MODNAME) -dnl -dnl Arguments: MODNAME = value to initialize `module' variable with -dnl -dnl Use: This macro will automatically get the guile version from the -dnl top-level srcdir, and will initialize automake. It also -dnl defines the `module' variable. - -AC_DEFUN([AM_INIT_GUILE_MODULE],[ -. $srcdir/../GUILE-VERSION -AM_INIT_AUTOMAKE($PACKAGE, $VERSION) -AC_CONFIG_AUX_DIR(..) -module=[$1] -AC_SUBST(module)]) - -dnl --- *@-AM_CONFIG_HEADER-@* --- -dnl -dnl Author: Unknown -dnl -dnl Synopsis: AM_CONFIG_HEADER(HEADER ...) -dnl -dnl Arguments: HEADER = a header spec, as for AC_CONFIG_HEADER -dnl -dnl Use: Like AC_CONFIG_HEADER, but automatically create stamp file. - -AC_DEFUN(AM_CONFIG_HEADER, -[AC_PREREQ([2.12]) -AC_CONFIG_HEADER([$1]) -dnl When config.status generates a header, we must update the stamp-h file. -dnl This file resides in the same directory as the config header -dnl that is generated. We must strip everything past the first ":", -dnl and everything past the last "/". -AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl -ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, -<>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/ -\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, -<>; do - case " <<$>>CONFIG_HEADERS " in - *" <<$>>am_file "*<<)>> - echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx - ;; - esac - am_indx=`expr "<<$>>am_indx" + 1` -done<<>>dnl>>) -changequote([,]))]) - -dnl --- *@-AM_INIT_AUTOMAKE-@* -dnl -dnl Author: Unknown -dnl -dnl Synopsis: AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) -dnl -dnl Arguments: PACKAGE = package name -dnl VERSION = version number -dnl NO-DEFINE = if set, don't define package and version number -dnl -dnl Use: Do all the work for Automake. This macro actually does too -dnl much -- some checks are only needed if your package does -dnl certain things. But this isn't really a big deal. - -# serial 1 - -AC_DEFUN(AM_INIT_AUTOMAKE, -[AC_REQUIRE([AM_PROG_INSTALL]) -PACKAGE=[$1] -AC_SUBST(PACKAGE) -VERSION=[$2] -AC_SUBST(VERSION) -dnl test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) -fi -ifelse([$3],, -AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") -AC_DEFINE_UNQUOTED(VERSION, "$VERSION")) -AM_SANITY_CHECK -AC_ARG_PROGRAM -dnl FIXME This is truly gross. -missing_dir=`cd $ac_aux_dir && pwd` -AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) -AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) -AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) -AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) -AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) -AC_PROG_MAKE_SET]) - -dnl --- *@-AM_PROG_INSTALL-@* --- -dnl -dnl Author: Franc,ois Pinard -dnl -dnl Synopsis: AM_PROG_INSTALL -dnl -dnl Arguments: --- -dnl -dnl Use: Calls `AC_PROG_INSTALL' to find an installer. Then it sets -dnl `INSTALL_SCRIPT' to a suitable value if necessary. - -# serial 1 - -AC_DEFUN(AM_PROG_INSTALL, -[AC_PROG_INSTALL -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL} -m 755' -AC_SUBST(INSTALL_SCRIPT)dnl -]) - -dnl --- *@-AM_PROG_LEX-@* --- -dnl -dnl Author: Alexandre Oliva -dnl -dnl Synopsis: AM_PROG_LEX -dnl -dnl Arguments: --- -dnl -dnl Use: Replacement for AC_PROG_LEX and AC_DECL_YYTEXT - -dnl AM_PROG_LEX -dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT -AC_DEFUN(AM_PROG_LEX, -[missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1) -AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex") -AC_PROG_LEX -AC_DECL_YYTEXT]) - -dnl --- *@-AM_PROG_LIBTOOL-@* --- -dnl -dnl Author: Unknown -dnl -dnl Synopsis: AM_PROG_LIBTOOL -dnl -dnl Arguments: --- -dnl -dnl Use: Configures `libtool' for the target architecture. - -## -## Configure libtool for the target system. -## -# serial 1 AM_PROG_LIBTOOL -AC_DEFUN(AM_PROG_LIBTOOL, -[AC_REQUIRE([AC_CANONICAL_HOST]) -AC_REQUIRE([AC_PROG_CC]) -AC_REQUIRE([AC_PROG_RANLIB]) - -# Always use our own libtool. -LIBTOOL='$(top_builddir)/libtool' -AC_SUBST(LIBTOOL) - -dnl Allow the --disable-shared flag to stop us from building shared libs. -AC_ARG_ENABLE(shared, -[ --enable-shared build shared libraries [default=yes]], -test "$enableval" = no && libtool_shared=" --disable-shared", -libtool_shared=) - -libtool_flags="$libtool_shared" -test "$silent" = yes && libtool_flags="$libtool_flags --silent" -test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" - -# Actually configure libtool. ac_aux_dir is where install-sh is found. -CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" LD="$LD" RANLIB="$RANLIB" \ -$ac_aux_dir/ltconfig $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \ -|| AC_MSG_ERROR([libtool configure failed]) -]) - -dnl --- *@-AM_PATH_LISPDIR-@* --- -dnl -dnl Author: Ulrich Drepper -dnl -dnl Synopsis: AM_PATH_LISPDIR -dnl -dnl Arguments: --- -dnl -dnl Use: Sets the variable `lispdir' to point to a place to install -dnl Emacs lisp files. - -## ------------------------ -## Emacs LISP file handling -## From Ulrich Drepper -## ------------------------ - -# serial 1 - -AC_DEFUN(AM_PATH_LISPDIR, - [# If set to t, that means we are running in a shell under Emacs. - # If you have an Emacs named "t", then use the full path. - test "$EMACS" = t && EMACS= - AC_PATH_PROG(EMACS, emacs xemacs, no) - if test $EMACS != "no"; then - AC_MSG_CHECKING([where .elc files should go]) - dnl Set default value - lispdir="\$(datadir)/emacs/site-lisp" - if test "x$prefix" = "xNONE"; then - if test -d $ac_default_prefix/share/emacs/site-lisp; then - lispdir="\$(prefix)/share/emacs/site-lisp" - else - if test -d $ac_default_prefix/lib/emacs/site-lisp; then - lispdir="\$(prefix)/lib/emacs/site-lisp" - fi - fi - else - if test -d $prefix/share/emacs/site-lisp; then - lispdir="\$(prefix)/share/emacs/site-lisp" - else - if test -d $prefix/lib/emacs/site-lisp; then - lispdir="\$(prefix)/lib/emacs/site-lisp" - fi - fi - fi - AC_MSG_RESULT($lispdir) - fi - AC_SUBST(lispdir)]) - -dnl --- *@-AM_MAINTAINTER_MODE-@* --- -dnl -dnl Author: Jim Meyering -dnl -dnl Synopsis: jm_MAINTAINER_MODE -dnl -dnl Arguments: --- -dnl -dnl Use: Provides an option `--enable-maintainer-mode' which turns -dnl on rules which might normally be commented out. The -dnl substitution variable `MAINT' is set to be a comment when -dnl this option is disabled, which it is by default. - -# serial 1 - -AC_DEFUN(AM_MAINTAINER_MODE, -[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) - dnl maintainer-mode is disabled by default - AC_ARG_ENABLE(maintainer-mode, -[ --enable-maintainer-mode enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer], - USE_MAINTAINER_MODE=$enableval, - USE_MAINTAINER_MODE=no) - AC_MSG_RESULT($USE_MAINTAINER_MODE) - if test $USE_MAINTAINER_MODE = yes; then - MAINT= - else - MAINT='#M#' - fi - AC_SUBST(MAINT)dnl -] -) - -dnl --- *@-AM_MISSING_PROG-@* --- -dnl -dnl Author: Unknown -dnl -dnl Synopsis: AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) -dnl -dnl Arguments: NAME = variable to set to the file's location -dnl PROGRAM = name of program to find -dnl DIRECTORY = directory to look in -dnl -dnl Use: Fakes existence of a useful GNU maintainer tool. - -AC_DEFUN(AM_MISSING_PROG, -[AC_MSG_CHECKING(for working $2) -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if ($2 --version) < /dev/null > /dev/null 2>&1; then - $1=$2 - AC_MSG_RESULT(found) -else - $1="$3/missing $2" - AC_MSG_RESULT(missing) -fi -AC_SUBST($1)]) - -dnl --- *@-AM_FUNC_MKTIME-@* --- -dnl -dnl Author: Jim Meyering -dnl -dnl Synopsis: AM_FUNC_MKTIME -dnl -dnl Arguments: --- -dnl -dnl Use: Checks for a working mktime function. - -AC_DEFUN(AM_FUNC_MKTIME, -[AC_REQUIRE([AC_HEADER_TIME])dnl - AC_CHECK_HEADERS(sys/time.h) - AC_CACHE_CHECK([for working mktime], am_cv_func_working_mktime, - [AC_TRY_RUN( -changequote(<<, >>)dnl -< -# include -#else -# if HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif - -static time_t time_t_max; - -/* Values we'll use to set the TZ environment variable. */ -static const char *const tz_strings[] = { - NULL, "GMT0", "JST-9", "EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00" -}; -#define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0])) - -static void -mktime_test (now) - time_t now; -{ - if (mktime (localtime (&now)) != now) - exit (1); - now = time_t_max - now; - if (mktime (localtime (&now)) != now) - exit (1); -} - -int -main () -{ - time_t t, delta; - int i; - - for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2) - continue; - time_t_max--; - delta = time_t_max / 997; /* a suitable prime number */ - for (i = 0; i < N_STRINGS; i++) - { - if (tz_strings[i]) - putenv (tz_strings[i]); - - for (t = 0; t <= time_t_max - delta; t += delta) - mktime_test (t); - mktime_test ((time_t) 60 * 60); - mktime_test ((time_t) 60 * 60 * 24); - } - exit (0); -} - >>, -changequote([, ])dnl - am_cv_func_working_mktime=yes, am_cv_func_working_mktime=no, - dnl When crosscompiling, assume mktime is missing or broken. - am_cv_func_working_mktime=no) - ]) - if test $am_cv_func_working_mktime = no; then - LIBOBJS="$LIBOBJS mktime.o" - fi -]) - -dnl --- *@-AM_FUNC_OBSTACK-@* --- -dnl -dnl Author: Jim Meyering -dnl -dnl Synopsis: AM_FUNC_OBSTACK -dnl -dnl Arguments: --- -dnl -dnl Use: Checks for GNU obstacks. - -AC_DEFUN(AM_FUNC_OBSTACK, -[AC_CACHE_CHECK([for obstacks], am_cv_func_obstack, - [AC_TRY_LINK([#include "obstack.h"], - [struct obstack *mem;obstack_free(mem,(char *) 0)], - am_cv_func_obstack=yes, - am_cv_func_obstack=no)]) - if test $am_cv_func_obstack = yes; then - AC_DEFINE(HAVE_OBSTACK) - else - LIBOBJS="$LIBOBJS obstack.o" - fi -]) - -dnl --- *@-AC_C_PROTOTYPES-@* --- -dnl -dnl Author: Franc,ois Pinard -dnl -dnl Synopsis: AC_C_PROTOTYPES -dnl -dnl Arguments: --- -dnl -dnl Use: If the C compiler understands ANSI C, define `PROTOTYPES', -dnl and clear the `U' and `ANSI2KNR' variables. Otherwise, -dnl set `U' to be `_' and `ANSI2KNR' to be `./ansi2knr'. - -# serial 1 - -AC_DEFUN(fp_C_PROTOTYPES, -[AC_REQUIRE([fp_PROG_CC_STDC]) -AC_MSG_CHECKING([for function prototypes]) -if test "$ac_cv_prog_cc_stdc" != no; then - AC_MSG_RESULT(yes) - AC_DEFINE(PROTOTYPES) - U= ANSI2KNR= -else - AC_MSG_RESULT(no) - U=_ ANSI2KNR=./ansi2knr -fi -AC_SUBST(U)dnl -AC_SUBST(ANSI2KNR)dnl -]) - -dnl --- *@-AM_PATH_GTK-@* --- -dnl -dnl Author: Owen Taylor -dnl -dnl Synopsis: AM_PATH_GTK(MIN-VERSION, [ACTION-IF-FOUND], [ACTION-IF-NOT]) -dnl -dnl Arguments: MIN-VERSION = minimum version of GTK required -dnl ACTION-IF-FOUND = executed if GTK found OK -dnl ACTION-IF-NOT-FOUND = what to do if GTK not available -dnl -dnl Use: Sets up compilation environment suitably for GTK programming. - -# Configure paths for GTK+ -# Owen Taylor 97-11-3 - -dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) -dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS -dnl -AC_DEFUN(AM_PATH_GTK, -[dnl -dnl Get the cflags and libraries from the gtk-config script -dnl -AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)], - gtk_config_prefix="$withval", gtk_config_prefix="") -AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)], - gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="") -AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program], - , enable_gtktest=yes) - - if test x$gtk_config_exec_prefix != x ; then - gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix" - if test x${GTK_CONFIG+set} != xset ; then - GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config - fi - fi - if test x$gtk_config_prefix != x ; then - gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix" - if test x${GTK_CONFIG+set} != xset ; then - GTK_CONFIG=$gtk_config_prefix/bin/gtk-config - fi - fi - - AC_PATH_PROG(GTK_CONFIG, gtk-config, no) - min_gtk_version=ifelse([$1], ,0.99.7,$1) - AC_MSG_CHECKING(for GTK - version >= $min_gtk_version) - no_gtk="" - if test "$GTK_CONFIG" = "no" ; then - no_gtk=yes - else - GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags` - GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs` - gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` - gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` - gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` - if test "x$enable_gtktest" = "xyes" ; then - ac_save_CFLAGS="$CFLAGS" - ac_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $GTK_CFLAGS" - LIBS="$LIBS $GTK_LIBS" -dnl -dnl Now check if the installed GTK is sufficiently new. (Also sanity -dnl checks the results of gtk-config to some extent -dnl - rm -f conf.gtktest - AC_TRY_RUN([ -#include -#include - -int -main () -{ - int major, minor, micro; - char *tmp_version; - - system ("touch conf.gtktest"); - - /* HP/UX 9 (%@#!) writes to sscanf strings */ - tmp_version = g_strdup("$min_gtk_version"); - if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { - printf("%s, bad version string\n", "$min_gtk_version"); - exit(1); - } - - if ((gtk_major_version != $gtk_config_major_version) || - (gtk_minor_version != $gtk_config_minor_version) || - (gtk_micro_version != $gtk_config_micro_version)) - { - printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", - $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, - gtk_major_version, gtk_minor_version, gtk_micro_version); - printf ("*** was found! If gtk-config was correct, then it is best\n"); - printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); - printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); - printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); - printf("*** required on your system.\n"); - printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n"); - printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n"); - printf("*** before re-running configure\n"); - } - else - { - if ((gtk_major_version > major) || - ((gtk_major_version == major) && (gtk_minor_version > minor)) || - ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) - { - return 0; - } - else - { - printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", - gtk_major_version, gtk_minor_version, gtk_micro_version); - printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", - major, minor, micro); - printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); - printf("***\n"); - printf("*** If you have already installed a sufficiently new version, this error\n"); - printf("*** probably means that the wrong copy of the gtk-config shell script is\n"); - printf("*** being found. The easiest way to fix this is to remove the old version\n"); - printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n"); - printf("*** correct copy of gtk-config. (In this case, you will have to\n"); - printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); - printf("*** so that the correct libraries are found at run-time))\n"); - } - } - return 1; -} -],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - if test "x$no_gtk" = x ; then - AC_MSG_RESULT(yes) - ifelse([$2], , :, [$2]) - else - AC_MSG_RESULT(no) - if test "$GTK_CONFIG" = "no" ; then - echo "*** The gtk-config script installed by GTK could not be found" - echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in" - echo "*** your path, or set the GTK_CONFIG environment variable to the" - echo "*** full path to gtk-config." - else - if test -f conf.gtktest ; then - : - else - echo "*** Could not run GTK test program, checking why..." - CFLAGS="$CFLAGS $GTK_CFLAGS" - LIBS="$LIBS $GTK_LIBS" - AC_TRY_LINK([ -#include -#include -], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ], - [ echo "*** The test program compiled, but did not run. This usually means" - echo "*** that the run-time linker is not finding GTK or finding the wrong" - echo "*** version of GTK. If it is not finding GTK, you'll need to set your" - echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" - echo "*** to the installed location Also, make sure you have run ldconfig if that" - echo "*** is required on your system" - echo "***" - echo "*** If you have an old version installed, it is best to remove it, although" - echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" - echo "***" - echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that" - echo "*** came with the system with the command" - echo "***" - echo "*** rpm --erase --nodeps gtk gtk-devel" ], - [ echo "*** The test program failed to compile or link. See the file config.log for the" - echo "*** exact error that occured. This usually means GTK was incorrectly installed" - echo "*** or that you have moved GTK since it was installed. In the latter case, you" - echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ]) - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - GTK_CFLAGS="" - GTK_LIBS="" - ifelse([$3], , :, [$3]) - fi - AC_SUBST(GTK_CFLAGS) - AC_SUBST(GTK_LIBS) - rm -f conf.gtktest -]) - -dnl --- *@-AC_TYPE_PTRDIFF_T-@* --- -dnl -dnl Author: Ulrich Drepper -dnl -dnl Synopsis: AC_TYPE_PTRDIFF_T -dnl -dnl Arguments: --- -dnl -dnl Use: Sets HAVE_PTRDIFF_T if the type exists. - -AC_DEFUN(AM_TYPE_PTRDIFF_T, - [AC_CACHE_CHECK([for ptrdiff_t], am_cv_type_ptrdiff_t, - [AC_TRY_COMPILE([#include ], [ptrdiff_t p], - am_cv_type_ptrdiff_t=yes, am_cv_type_ptrdiff_t=no)]) - if test $am_cv_type_ptrdiff_t = yes; then - AC_DEFINE(HAVE_PTRDIFF_T) - fi -]) - -dnl --- *@-AM_WITH_REGEX-@* --- -dnl -dnl Author: Unknown (possibly Franc,ois Pinard) -dnl -dnl Synopsis: AM_WITH_REGEX -dnl -dnl Arguments: --- -dnl -dnl Use: -dnl The idea is to distribute rx.[hc] and regex.[hc] together, -dnl for a while. The WITH_REGEX symbol (which should also be -dnl documented in acconfig.h) is used to decide which of regex.h -dnl or rx.h should be included in the application. If -dnl `./configure --with-regex' is given (the default), the -dnl package will use gawk's regex. If `./configure -dnl --without-regex', a check is made to see if rx is already -dnl installed, as with newer Linux'es. If not found, the package -dnl will use the rx from the distribution. If found, the package -dnl will use the system's rx which, on Linux at least, will -dnl result in a smaller executable file. - -AC_DEFUN(AM_WITH_REGEX, -[AC_MSG_CHECKING(which of GNU rx or gawk's regex is wanted) -AC_ARG_WITH(regex, -[ --without-regex use GNU rx in lieu of gawk's regex for matching], -[test "$withval" = yes && am_with_regex=1], -[am_with_regex=1]) -if test -n "$am_with_regex"; then - AC_MSG_RESULT(regex) - AC_DEFINE(WITH_REGEX) - AC_CACHE_CHECK([for GNU regex in libc], am_cv_gnu_regex, - AC_TRY_LINK([], [extern int re_max_failures; re_max_failures = 1], - am_cv_gnu_regex=yes, am_cv_gnu_regex=no)) - if test $am_cv_gnu_regex = no; then - LIBOBJS="$LIBOBJS regex.o" - fi -else - AC_MSG_RESULT(rx) - AC_CHECK_FUNC(re_rx_search, , [LIBOBJS="$LIBOBJS rx.o"]) -fi -AC_SUBST(LIBOBJS)dnl -]) - -dnl --- *@-AM_SANITY_CHECK-@* -dnl -dnl Author: Unknown -dnl -dnl Synopsis: AM_SANITY_CHECK -dnl -dnl Arguments: --- -dnl -dnl Use: Check for build environment sanity. - -AC_DEFUN(AM_SANITY_CHECK, -[AC_MSG_CHECKING([whether build environment is sane]) -# Just in case -sleep 1 -echo timestamp > conftestfile -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` - if test "$@" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftestfile` - fi - test "[$]2" = conftestfile - ) -then - # Ok. - : -else - AC_MSG_ERROR([newly created file is older than distributed files! -Check your system clock]) -fi -rm -f conftest* -AC_MSG_RESULT(yes)]) - -dnl --- *@-AM_FUNC_STRDOD-@* --- -dnl -dnl Author: Jim Meyering -dnl -dnl Synopsis: AM_FUNC_STRTOD -dnl -dnl Arguments: --- -dnl -dnl Use: Checks for a working strtod function. - -## Copyright (C) 1996 Free Software Foundation, Inc. - -## This program is free software; you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. - -## This program is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. - -## You should have received a copy of the GNU General Public License -## along with this program; if not, write to the Free Software -## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -## 02111-1307, USA. - -## From Jim Meyering. - -## serial 1 - -## @defmac AC_FUNC_STRTOD -## @maindex FUNC_STRTOD -## @ovindex LIBOBJS -## If the @code{strtod} function is not available, or does not work -## correctly (like the one on SunOS 5.4), add @samp{strtod.o} to output -## variable @code{LIBOBJS}. -## @end defmac - -AC_DEFUN(AM_FUNC_STRTOD, -[AC_CACHE_CHECK(for working strtod, am_cv_func_strtod, -[AC_TRY_RUN([ -double strtod (); -int -main() -{ - { - /* Some versions of Linux strtod mis-parse strings with leading '+'. */ - char *string = " +69"; - char *term; - double value; - value = strtod (string, &term); - if (value != 69 || term != (string + 4)) - exit (1); - } - - { - /* Under Solaris 2.4, strtod returns the wrong value for the - terminating character under some conditions. */ - -## @defmac AC_FUNC_STRTOD -## @maindex FUNC_STRTOD -## @ovindex LIBOBJS -## If the @code{strtod} function is not available, or does not work -## correctly (like the one on SunOS 5.4), add @samp{strtod.o} to output -## variable @code{LIBOBJS}. -## @end defmac - -AC_DEFUN(AM_FUNC_STRTOD, -[AC_CACHE_CHECK(for working strtod, am_cv_func_strtod, -[AC_TRY_RUN([ -double strtod (); -int -main() -{ - { - /* Some versions of Linux strtod mis-parse strings with leading '+'. */ - char *string = " +69"; - char *term; - double value; - value = strtod (string, &term); - if (value != 69 || term != (string + 4)) - exit (1); - } - - { - /* Under Solaris 2.4, strtod returns the wrong value for the - terminating character under some conditions. */ - char *string = "NaN"; - char *term; - strtod (string, &term); - if (term != string && *(term - 1) == 0) - exit (1); - } - exit (0); -} -], am_cv_func_strtod=yes, am_cv_func_strtod=no, am_cv_func_strtod=no)]) -test $am_cv_func_strtod = no && LIBOBJS="$LIBOBJS strtod.o" -AC_SUBST(LIBOBJS)dnl -am_cv_func_strtod_needs_libm=no -if test $am_cv_func_strtod = no; then - AC_CHECK_FUNCS(pow) - if test $ac_cv_func_pow = no; then - AC_CHECK_LIB(m, pow, [am_cv_func_strtod_needs_libm=yes], - [AC_MSG_WARN(can't find library containing definition of pow)]) - fi -fi -]) - -dnl --- *@-AM_SYS_POSIX_TERMIOS-@* --- -dnl -dnl Author: Jim Meyering -dnl -dnl Synopsis: AM_SYS_POSIX_TERMIOS -dnl -dnl Arguments: --- -dnl -dnl Use: Checks for a POSIX termios.h. - -AC_DEFUN(AM_SYS_POSIX_TERMIOS, -[AC_CACHE_CHECK([POSIX termios], am_cv_sys_posix_termios, - [AC_TRY_LINK([#include -#include -#include ], - [/* SunOS 4.0.3 has termios.h but not the library calls. */ - tcgetattr(0, 0);], - am_cv_sys_posix_termios=yes, - am_cv_sys_posix_termios=no)]) -]) - -dnl----- Macros by Mark Wooding ------------------------------ *@--IGNORE--@* - -dnl --- *@-mdw_DECL_ENVIRON-@* --- -dnl -dnl Author: Mark Wooding -dnl -dnl Synopsis: mdw_DECL_ENVIRON -dnl -dnl Arguments: --- -dnl -dnl Use: If the global variable `environ' is declared anywhere -dnl `obvious', then define the preprocessor symbol DECL_ENVIRON. - -AC_DEFUN(mdw_DECL_ENVIRON, -[AC_CHECK_HEADERS([unistd.h]) -AC_CACHE_CHECK([for declaration of \`environ'], sw_cv_environ, -[AC_EGREP_CPP(environ, -[#include -#if HAVE_UNISTD_H -#include -#endif -#if STDC_HEADERS -#include -#include -#endif], [sw_cv_environ=yes], [sw_cv_environ=no])]) -if test $sw_cv_environ = yes; then - AC_DEFINE(DECL_ENVIRON) -fi]) +dnl *@--NOTICE--@* Common File Distribution +dnl $Id$ dnl --- *@-mdw_CURSES-@* --- dnl @@ -1083,22 +36,26 @@ dnl Synopsis: mdw_CURSES dnl dnl Arguments: --- dnl -dnl Use: Attempts to find an implementation of `curses'. A `curses' -dnl library (`ncurses' by preference) will be added to `LIBS'. -dnl If a library could be found, the preprocessor symbol -dnl HAVE_CURSES is defined, along with one of HAVE_NCURSES_H, -dnl HAVE_NCURSES_NCURSES_H or HAVE_CURSES_H, suggesting which -dnl header to include (in the obvious way). - -AC_DEFUN(mdw_CURSES, -[mdw_CHECK_MANYLIBS(newwin, ncurses curses, AC_DEFINE(HAVE_CURSES)) +dnl Use: Searches for a `curses' library (one of `ncurses' or +dnl `curses') using mdw_CHECK_MANYLIBS. If one is found, the +dnl preprocessor macro HAVE_CURSES is defined, and a search is +dnl made for a `curses' header file (one of , +dnl or ) using AC_CHECK_HEADERS +dnl and the appropriate preprocessor symbol is defined. +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], [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]) @@ -1111,11 +68,12 @@ dnl Synopsis: mdw_TYPE_SSIZE_T dnl dnl Arguments: --- dnl -dnl Use: Finds an appropriate type for `ssize_t' if there isn't a -dnl sensible one to use already. +dnl Use: Checks whether the Posix type `ssize_t' is defined. If not, +dnl it defaults to `int'. -AC_DEFUN(mdw_TYPE_SSIZE_T, -[AC_CACHE_CHECK(for ssize_t, sw_cv_ssize_t, +AC_DEFUN([mdw_TYPE_SSIZE_T], +[AC_REQUIRE([AC_HEADER_STDC]) +AC_CACHE_CHECK(for ssize_t, mdw_cv_ssize_t, [AC_EGREP_CPP(ssize_t, [#include #if HAVE_UNISTD_H @@ -1125,39 +83,52 @@ AC_DEFUN(mdw_TYPE_SSIZE_T, #include #include #endif], -[sw_cv_ssize_t=yes], [sw_cv_ssize_t=no])]) -if test $sw_cv_ssize_t = no; then - AC_DEFINE(ssize_t, int) +[mdw_cv_ssize_t=yes], [mdw_cv_ssize_t=no])]) +if test $mdw_cv_ssize_t = no; then + AC_DEFINE([ssize_t], [int], [Define to `int' if your system doesn't have ssize_t.]) fi]) -dnl --- *@-mdw_REQUIRE-@* --- +dnl --- *@-mdw_DECL_ENVIRON-@* --- dnl dnl Author: Mark Wooding dnl -dnl Synopsis: mdw_REQUIRE(MACRO, ARGS...) +dnl Synopsis: mdw_DECL_ENVIRON dnl -dnl Arguments: MACRO = name of a macro which should have been called -dnl ARGS = arguments to pass +dnl Arguments: --- dnl -dnl Use: Like `AC_REQUIRE', only it handles arguments. +dnl Use: Searches for a declaration of the global `environ' variable. +dnl If one is found in one of the `usual' places, DECL_ENVIRON +dnl is defined as a preprocessor symbol. -AC_DEFUN(mdw_REQUIRE, -[ifdef([AC_PROVIDED_$1], , -[AC_DIVERT_PUSH(builtin(eval, AC_DIVERSION_CURRENT - 1))dnl -indir($@) -AC_DIVERT_POP()dnl -])]) +AC_DEFUN([mdw_DECL_ENVIRON], +[AC_CACHE_CHECK([for declaration of \`environ'], mdw_cv_environ, +[AC_EGREP_CPP([\], +[#include +#if HAVE_UNISTD_H +#include +#endif +#if STDC_HEADERS +#include +#include +#endif], [mdw_cv_environ=yes], [mdw_cv_environ=no])]) +if test $mdw_cv_environ = yes; then + AC_DEFINE([DECL_ENVIRON], [1], + [Define if you have the `environ' vector of environment variables.]) +fi]) dnl --- *@-mdw_CHECK_MANYLIBS-@* --- dnl dnl Author: Mark Wooding dnl -dnl Synopsis: mdw_CHECK_MANYLIBS(FUNC, LIBS, [IF-FOUND], [IF-NOT-FOUND]) +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 @@ -1168,14 +139,14 @@ 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_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(,[$1()], [mdw_cv_lib_$1="none required"]) +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(,[$1()], +AC_TRY_LINK([$5], [$1($6)], [mdw_cv_lib_$1="-l$i" break]) done @@ -1187,12 +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. -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-@* --- @@ -1215,7 +274,7 @@ 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_DEFUN([mdw_PROG_PERL], [AC_ARG_WITH([perl], [ --with-perl=PERL specify path to Perl version $1 or newer], [PERL="$withval"], @@ -1223,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 @@ -1255,8 +314,8 @@ 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], [$1]) +AC_DEFUN([mdw_CHECK_PERL], +[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]) @@ -1287,14 +346,14 @@ 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_DEFUN([mdw__PERLLIB_INIT], [AC_SUBST(INC_PERLLIBS)dnl AC_SUBST(NEEDED_PERLLIBS)dnl ]) -AC_DEFUN(mdw_PERLLIB_CHECK, +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" @@ -1332,7 +391,7 @@ dnl `-fhandle-exceptions'). dnl dnl Use: If the C compiler is GCC, add the compiler flags. -AC_DEFUN(mdw_GCC_FLAGS, +AC_DEFUN([mdw_GCC_FLAGS], [if test "$GCC" = "yes"; then CFLAGS="$CFLAGS ifelse([$1], [], [-pedantic -Wall], [$1])" CFLAGS="$CFLAGS ifelse([$2], [], [], [$2])" @@ -1342,6 +401,134 @@ if test "$GXX" = "yes"; then CXXFLAGS="$CXXFLAGS ifelse([$3], [], [-fhandle-exceptions], [$3])" fi]) +dnl --- *@-mdw_INIT_LIB-@* --- +dnl +dnl Author: Mark Wooding +dnl +dnl Synopsis: mdw_INIT_LIB(LIB, NAME, VERSION, [PACKAGE]) +dnl +dnl Arguments: LIB = the name of the library (and the package) +dnl NAME = a presentable version of the library's name +dnl VERSION = version of the library +dnl PACKAGE = package name to pass on to AM_INIT_AUTOMAKE +dnl +dnl Use: Sets up various useful variables. This macro calls +dnl AM_INIT_AUTOMAKE, which might be considered useful. It also +dnl provides variables for the use of `lib-config.in'. + +AC_DEFUN([mdw_INIT_LIB], +[AM_INIT_AUTOMAKE(ifelse([$4], [], [$1], [$4]), [$3]) +LIBRARY="$1" AC_SUBST(LIBRARY) +LIBNAME="$2" AC_SUBST(LIBNAME)]) + +dnl --- *@-mdw_LIB_CONFIG-@* --- +dnl +dnl Author: Mark Wooding +dnl +dnl Synopsis: mdw_LIB_CONFIG(LIB, NAME, VERSION, IF-FOUND, IF-NOT-FOUND) +dnl +dnl Arguments: LIB = the name of the library (and its configuration program) +dnl NAME = a presentable version of the library's name +dnl VERSION = version of library required +dnl IF-FOUND = what to do if found +dnl IF-NOT-FOUND = what to do if not found +dnl +dnl Use: Configures a library client program, using a configuration +dnl script provided by the library maintainer. +dnl +dnl The default version is 1.0.0pre0; the default action is to +dnl add everything to the CFLAGS and LIBS variables, and complain +dnl if the library couldn't be found. +dnl +dnl The variable LIB_VERSION contains the version number of +dnl the library; LIB_CFLAGS is the C compiler flags required +dnl and LIB_LIBS is the linker flags. + +AC_DEFUN([mdw_LIB_CONFIG], +[pushdef([upname], translit([$1], [a-z], [A-Z]))dnl +AC_MSG_CHECKING([for $2 library]) +if $1-config --check $3 >/dev/null 2>&1; then + upname[]_VERSION=`$1-config --version` + upname[]_CFLAGS=`$1-config --cflags` + upname[]_LIBS=`$1-config --libs` + AC_SUBST(upname[]_VERSION) + AC_SUBST(upname[]_CFLAGS) + AC_SUBST(upname[]_LIBS) + ifelse([$4], [], + [CFLAGS="$CFLAGS $upname[]_CFLAGS" + LIBS="$upname[]_LIBS $LIBS"], + $4) + AC_MSG_RESULT([$upname[]_VERSION]) +else + ifelse([$5], [], + AC_MSG_ERROR([$2 library not found or too old.]), + $5) + AC_MSG_RESULT([not found]) +fi +popdef([upname])]) + +dnl --- *@-mdw_MLIB-@* --- +dnl +dnl Author: Mark Wooding +dnl +dnl Synopsis: mdw_MLIB(VERSION, IF-FOUND, IF-NOT-FOUND +dnl +dnl Arguments: VERSION = version of library required +dnl IF-FOUND = what to do if found +dnl IF-NOT-FOUND = what to do if not found +dnl +dnl Use: Configures an mLib client program. + +AC_DEFUN([mdw_MLIB], [mdw_LIB_CONFIG(mLib, mLib, $@)]) + +dnl --- *@-mdw_MGLIB-@* --- +dnl +dnl Author: Mark Wooding +dnl +dnl Synopsis: mdw_MGLIB(VERSION, IF-FOUND, IF-NOT-FOUND +dnl +dnl Arguments: VERSION = version of library required +dnl IF-FOUND = what to do if found +dnl IF-NOT-FOUND = what to do if not found +dnl +dnl Use: Configures an mgLib client program. + +AC_DEFUN([mdw_MGLIB], +[AC_REQUIRE([mdw_MLIB], [mdw_MLIB([2.0.3])]) +mdw_LIB_CONFIG(mgLib, mgLib, $@)]) + +dnl --- *@-mdw_CATACOMB-@* --- +dnl +dnl Author: Mark Wooding +dnl +dnl Synopsis: mdw_CATACOMB([VERSION], [IF-FOUND], [IF-NOT-FOUND]) +dnl +dnl Arguments: VERSION = version of Catacomb required +dnl IF-FOUND = what to do if found +dnl IF-NOT-FOUND = what to do if not found +dnl +dnl Use: Configures the program as a Catacomb client. + +AC_DEFUN([mdw_CATACOMB], +[AC_REQUIRE([mdw_MLIB], [mdw_MLIB([2.0.3])]) +mdw_LIB_CONFIG(catacomb, Catacomb, $@)]) + +dnl --- *@-mdw_PK-@* --- +dnl +dnl Author: Mark Wooding +dnl +dnl Synopsis: mdw_PK([VERSION], [IF-FOUND], [IF-NOT-FOUND]) +dnl +dnl Arguments: VERSION = version of PK required +dnl IF-FOUND = what to do if found +dnl IF-NOT-FOUND = what to do if not found +dnl +dnl Use: Configures the program as a PK client. + +AC_DEFUN([mdw_PK], +[AC_REQUIRE([mdw_MLIB], [mdw_MLIB([2.0.3])]) +mdw_LIB_CONFIG(pk, PK, $@)]) + dnl --- *@-mdw_OPT_NDEBUG-@* --- dnl dnl Author: Mark Wooding @@ -1350,16 +537,16 @@ dnl Synopsis: mdw_OPT_NDEBUG dnl dnl Arguments: --- dnl -dnl Use: Turns off the `NDEBUG' flag if the user wants to do -dnl debugging. +dnl Use: Turns on the `NDEBUG' flag, to disable useful things like +dnl assertions. -AC_DEFUN(mdw_OPT_NDEBUG, +AC_DEFUN([mdw_OPT_NDEBUG], [AC_ARG_ENABLE(debugging, -[ --enable-debugging spews vast swathes of useless information], +[ --disable-debugging spews vast swathes of useless information], [if test "$enableval" = "no"; then - AC_DEFINE(NDEBUG, 1) -fi], -[AC_DEFINE(NDEBUG, 1)])]) + AC_DEFINE([NDEBUG], [1], + [Define to turn off assertions and other debugging. Not recommended.]) +fi])]) dnl --- *@-mdw_OPT_EFENCE-@* --- dnl @@ -1371,49 +558,165 @@ dnl Arguments: --- dnl dnl Use: Links with the Electric Fence library. -AC_DEFUN(mdw_OPT_EFENCE, +AC_DEFUN([mdw_OPT_EFENCE], [AC_ARG_WITH(electric-fence, [ --with-electric-fence link programs with Electric Fence], [if test "$withval" = "yes"; then AC_CHECK_LIB(efence, malloc) fi])]) -dnl --- *@-mdw_OPT_mLib_DEBUG-@* --- +dnl --- *@-mdw_OPT_TRACE-@* --- dnl dnl Author: Mark Wooding dnl -dnl Synopsis: mdw_OPT_mLib_DEBUG(PROGRAM) +dnl Synopsis: mdw_OPT_TRACE dnl dnl Arguments: --- dnl -dnl Use: Provides options for mLib debugging. In particular, the +dnl Use: Turns on the `NTRACE' flag, to disable useful things like +dnl trace outputs. + +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], [Define to turn off tracing.]) +fi])]) + +dnl --- *@-mdw_OPT_mLib_TRACK-@* --- +dnl +dnl Author: Mark Wooding +dnl +dnl Synopsis: mdw_OPT_mLib_TRACK(PROGRAM) +dnl +dnl Arguments: PROGRAM = name of this program or package. +dnl +dnl Use: Controls the unsupported mLib memory tracker. The dnl following are defined: dnl -dnl --enable-tracing turns off the NTRACE variable dnl --enable-track turns on malloc tracking dnl --enable-blame-PROGRAM tracks malloc contexts in PROGRAM dnl -dnl There must be a separate `blame' option, so that the various -dnl blame options work properly. - -AC_DEFUN(mdw_OPT_mLib_DEBUG, -[mdw_OPT_NDEBUG -mdw_OPT_EFENCE - -AC_ARG_ENABLE(tracing, -[ --enable-tracing enable output of tracing information], -[if test "$enableval" = "no"; then - AC_DEFINE(NTRACE, 1) -fi], -[AC_DEFINE(NTRACE, 1)]) +dnl There must be a separate `blame' option for each program, +dnl so that the various blame options in a hierarchy get +dnl propagated properly. This is an obsolete feature from the +dnl days when mLib was provided as a subdirectory of other +dnl packages. +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 +dnl Author: Mark Wooding +dnl +dnl Synopsis: mdw_OPT_mLib_DEBUG(PROGRAM) +dnl +dnl Arguments: PROGRAM = name of this program or package. +dnl +dnl Use: Provides all of the above debugging options. + +AC_DEFUN([mdw_OPT_mLib_DEBUG], +[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_PATHS(CODE) +dnl +dnl Arguments: CODE = shell script code to execute +dnl +dnl Use: Fixes up various variables so that pathname defines can be +dnl defined. Within CODE, you may use the following macros: +dnl +dnl mdw_PROG(NAME) Transformed program name +dnl +dnl mdw_PATH(PATH) Expanded path (may contain variables) +dnl +dnl mdw_DEFINE_PROG(SYMBOL, PROG) +dnl Define a symbol as a transformed +dnl program name. +dnl +dnl mdw_DEFINE_PATH(SYMBOL, NAME) +dnl Define a symbol as an expanded path + +AC_DEFUN([mdw_DEFINE_PATHS], +[mdw_prefix=$prefix mdw_exec_prefix=$exec_prefix +mdw_transform=`echo "$program_transform_name"|sed 's,\\\\\\\\,\\\\,g; s,\\$\\$,$,g'` +test "$prefix" = "NONE" && prefix=$ac_default_prefix +test "$exec_prefix" = "NONE" && exec_prefix=$prefix +$1 +prefix=$mdw_prefix exec_prefix=$mdw_exec_prefix]) + +AC_DEFUN([mdw_PROG], [`echo "$1"|sed "$mdw_transform"`]) +AC_DEFUN([mdw_PATH], [dnl +`t="$1"; dnl +while :; do dnl +case "$t" in dnl +*\\$[]*) t=\`eval echo "$t"\`;; dnl +*) break;; dnl +esac; done; dnl +echo "$t"`]) +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 +dnl Author: Mark Wooding +dnl +dnl Synopsis: mdw_DIR_TEXMF +dnl +dnl Arguments: --- +dnl +dnl Use: Sets the substitution `texmfdir' as a sensible TeX install +dnl tree. + +AC_DEFUN([mdw_DIR_TEXMF], [ +AC_ARG_WITH([texmfdir], +[ --with-texmfdir=DIR set the TeX install directory to DIR], +[texmfdir=$withval], +[AC_MSG_CHECKING([where to put installed TeX files]) +mdw_DEFINE_PATHS([ +texmfdir='${datadir}/texmf' +for d in \ + '${datadir}/texmf' '${prefix}/lib/texmf' \ + '${prefix}/texmf' '${libdir}/lib/texmf'; do + if test -d "mdw_PATH([$d])"; then + texmfdir=$d + break + fi +done +AC_MSG_RESULT([$texmfdir])])]) +AC_SUBST(texmfdir)]) + +dnl --- *@-mdw_MANEXT-@* --- +dnl +dnl Author: Mark Wooding +dnl +dnl Synopsis: mdw_MANEXT +dnl +dnl Arguments: --- +dnl +dnl Use: Sets the substitution `manext' for man page extensions. + +AC_DEFUN([mdw_MANEXT], [ +AC_ARG_WITH([man-ext], +[ --with-man-ext=EXT give manpages the EXT extension (e.g., foo.3EXT)], +[manext=$withval], [manext=mLib]) +AC_SUBST(manext)]) dnl----- That's all, folks --------------------------------- *@--GLOB-END--@*