1 dnl -*-fundamental-*- *@--GLOB-HEADER--@*
3 dnl $Id: aclocal.glob,v 1.16 2003/04/23 12:47:22 mdw Exp $
5 dnl Common library of autoconf macros
7 dnl (c) 1997 Mark Wooding, except for macros and documentation where noted.
10 dnl----- Licensing notice ---------------------------------------------------
12 dnl This file is part of the Common Files Distribution (`common')
14 dnl `Common' is free software; you can redistribute it and/or modify
15 dnl it under the terms of the GNU General Public License as published by
16 dnl the Free Software Foundation; either version 2 of the License, or
17 dnl (at your option) any later version.
19 dnl `Common' is distributed in the hope that it will be useful,
20 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
21 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 dnl GNU General Public License for more details.
24 dnl You should have received a copy of the GNU General Public License
25 dnl along with `common'; if not, write to the Free Software Foundation,
26 dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 dnl----- Revision history ---------------------------------------------------
30 dnl $Log: aclocal.glob,v $
31 dnl Revision 1.16 2003/04/23 12:47:22 mdw
34 dnl Revision 1.15 2002/02/19 22:50:24 mdw
35 dnl Fix spelling. Add new macro which works out where to put TeX files.
37 dnl Revision 1.14 2002/02/03 19:15:15 mdw
38 dnl Add SDL-finding equipment. Quote some macro names which need it. Add
39 dnl long-overdue macros for expanding configured paths (and do it
42 dnl Revision 1.13 2001/02/23 09:07:24 mdw
43 dnl Restore temporary variable on exit.
45 dnl Revision 1.12 2001/02/04 01:18:52 mdw
46 dnl Overhaul the mLib debugging options.
48 dnl Revision 1.11 2001/01/20 12:03:08 mdw
49 dnl Remove redundant stuff.
51 dnl Revision 1.10 2000/10/14 16:32:15 mdw
52 dnl Fixes from upstream.
54 dnl Revision 1.9 2000/08/15 21:37:49 mdw
55 dnl New initialization macro for libraries, and a new base client macro for
56 dnl finding libraries with an appropriate version.
58 dnl Revision 1.8 1999/11/26 01:23:17 mdw
59 dnl And support for MXD (not yet released).
61 dnl Revision 1.7 1999/11/11 20:03:58 mdw
62 dnl Add support for mgLib too.
64 dnl Revision 1.6 1999/11/11 17:49:33 mdw
65 dnl New macros for configuring clients of mLib and Catacomb.
67 dnl Revision 1.5 1999/07/27 18:27:37 mdw
68 dnl Fix typo in header line for mdw_DECL_ENVIRON.
70 dnl Revision 1.4 1999/07/26 23:44:32 mdw
71 dnl Reorder and tidy documentation.
73 dnl Revision 1.3 1999/07/17 10:27:44 mdw
74 dnl More useful macros added.
76 dnl Revision 1.2 1999/05/13 22:57:23 mdw
77 dnl Change `-ise' to `-ize' throughout.
79 dnl Revision 1.1.1.1 1999/05/05 19:23:47 mdw
80 dnl New import. The old CVS repository was lost in a disk disaster.
83 dnl----- Common files distribution --------------------------- *@--NOTICE--@*
85 dnl $Id: aclocal.glob,v 1.16 2003/04/23 12:47:22 mdw Exp $
87 dnl --- *@-AM_PROG_CC_STDC-@* ---
89 dnl Author: Franc,ois Pinard
91 dnl Synopsis: AM_PROG_CC_STDC
95 dnl Use: If the C compiler in not in ANSI C mode by default, try to
96 dnl add an option to output variable `CC' to make it so. This
97 dnl macro tries various options that select ANSI C on some system
98 dnl or another. It considers the compiler to be in ANSI C mode
99 dnl if it defines `__STDC__' to 1 and handles function prototypes
102 dnl If you use this macro, you should check after calling it
103 dnl whether the C compiler has been set to accept ANSI C; if not,
104 dnl the shell variable `ac_cv_prog_cc_stdc' is set to `no'. If
105 dnl you wrote your source code in ANSI C, you can make an
106 dnl un-ANSIfied copy of it by using the program `ansi2knr', which
107 dnl comes with Ghostscript.
109 dnl (documentation by Franc,ois Pinard)
111 AC_DEFUN(AM_PROG_CC_STDC,
112 [AC_REQUIRE([AC_PROG_CC])
113 AC_BEFORE([$0], [AC_C_INLINE])
114 AC_BEFORE([$0], [AC_C_CONST])
115 AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
116 AC_CACHE_VAL(am_cv_prog_cc_stdc,
117 [am_cv_prog_cc_stdc=no
119 # Don't try gcc -ansi; that turns off useful extensions and
120 # breaks some systems' header files.
122 # Ultrix and OSF/1 -std1
123 # HP-UX -Aa -D_HPUX_SOURCE
124 # SVR4 -Xc -D__EXTENSIONS__
125 for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
127 CC="$ac_save_CC $ac_arg"
129 [#if !defined(__STDC__) || __STDC__ != 1
132 /* DYNIX/ptx V4.1.3 can't compile sys/stat.h with -Xc -D__EXTENSIONS__. */
134 # include <sys/types.h>
135 # include <sys/stat.h>
138 int test (int i, double x);
139 struct s1 {int (*f) (int a);};
140 struct s2 {int (*f) (double a);};],
141 [am_cv_prog_cc_stdc="$ac_arg"; break])
145 if test -z "$am_cv_prog_cc_stdc"; then
146 AC_MSG_RESULT([none needed])
148 AC_MSG_RESULT($am_cv_prog_cc_stdc)
150 case "x$am_cv_prog_cc_stdc" in
152 *) CC="$CC $am_cv_prog_cc_stdc" ;;
156 dnl----- AutoMake macros ------------------------------------- *@--IGNORE--@*
158 dnl --- *@-AM_CONDITIONAL-@* ---
162 dnl Synopsis: AM_CONDITIONAL(NAME, TEST)
164 dnl Arguments: NAME = name of the conditional
165 dnl TEST = a shell list to execute
167 dnl Use: Allows conditional sections in Makefiles.
169 AC_DEFUN(AM_CONDITIONAL,
180 dnl --- *@-AM_CYGWIN32-@* ---
182 dnl Author: Cygnus (I guess)
184 dnl Synopsis: AM_CYGWIN32
188 dnl Use: Check to see if we're running under Cygwin32, without using
189 dnl AC_CANONICAL_*. If so, set output variable EXEEXT to
190 dnl ".exe". Otherwise set it to "".
193 dnl You might think we can do this by checking for a cygwin32-specific
194 dnl cpp define. We can't, because cross-compilers that target
195 dnl cygwin32 don't use the .exe suffix. I don't know why.
196 AC_DEFUN(AM_CYGWIN32,
197 [AC_CACHE_CHECK(for Cygwin32 environment, am_cv_cygwin32,
198 [cat > conftest.$ac_ext << 'EOF'
203 if AC_TRY_EVAL(ac_link) && test -s conftest.exe; then
210 test "$am_cv_cygwin32" = yes && EXEEXT=.exe
213 dnl --- *@-AM_WITH_DMALLOC-@* ---
215 dnl Author: Franc,ois Pinard
217 dnl Synopsis: AM_WITH_DMALLOC
221 dnl Use: Links with `-dmalloc' if told to by the user.
223 ## ----------------------------------- ##
224 ## Check if --with-dmalloc was given. ##
225 ## From Franc,ois Pinard ##
226 ## ----------------------------------- ##
230 AC_DEFUN(AM_WITH_DMALLOC,
231 [AC_MSG_CHECKING(if malloc debugging is wanted)
233 [ --with-dmalloc use dmalloc, as in
234 ftp://ftp.letters.com/src/dmalloc/dmalloc.tar.gz],
235 [if test "$withval" = yes; then
237 AC_DEFINE(WITH_DMALLOC)
238 LIBS="$LIBS -ldmalloc"
239 LDFLAGS="$LDFLAGS -g"
242 fi], [AC_MSG_RESULT(no)])
245 dnl --- *@-AM_FUNC_ERROR_AT_LINE-@* ---
247 dnl Author: Jim Meyering
249 dnl Synopsis: AM_FUNC_ERROR_AT_LINE
253 dnl Use: Use this if you use the GNU error.[ch].
255 dnl FIXME: Migrate into libit
257 AC_DEFUN(AM_FUNC_ERROR_AT_LINE,
258 [AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line,
259 [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");],
260 am_cv_lib_error_at_line=yes,
261 am_cv_lib_error_at_line=no)])
262 if test $am_cv_lib_error_at_line = no; then
263 LIBOBJS="$LIBOBJS error.o"
268 dnl --- *@-AM_INIT_GUILE_MODULE-@* ---
272 dnl Synopsis: AM_INIT_GUILE_MODULE(MODNAME)
274 dnl Arguments: MODNAME = value to initialize `module' variable with
276 dnl Use: This macro will automatically get the guile version from the
277 dnl top-level srcdir, and will initialize automake. It also
278 dnl defines the `module' variable.
280 AC_DEFUN([AM_INIT_GUILE_MODULE],[
281 . $srcdir/../GUILE-VERSION
282 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
283 AC_CONFIG_AUX_DIR(..)
287 dnl --- *@-AM_CONFIG_HEADER-@* ---
291 dnl Synopsis: AM_CONFIG_HEADER(HEADER ...)
293 dnl Arguments: HEADER = a header spec, as for AC_CONFIG_HEADER
295 dnl Use: Like AC_CONFIG_HEADER, but automatically create stamp file.
297 AC_DEFUN(AM_CONFIG_HEADER,
299 AC_CONFIG_HEADER([$1])
300 dnl When config.status generates a header, we must update the stamp-h file.
301 dnl This file resides in the same directory as the config header
302 dnl that is generated. We must strip everything past the first ":",
303 dnl and everything past the last "/".
304 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
305 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
306 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/
307 \)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
309 for am_file in <<$1>>; do
310 case " <<$>>CONFIG_HEADERS " in
311 *" <<$>>am_file "*<<)>>
312 echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
315 am_indx=`expr "<<$>>am_indx" + 1`
319 dnl --- *@-AM_INIT_AUTOMAKE-@*
323 dnl Synopsis: AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
325 dnl Arguments: PACKAGE = package name
326 dnl VERSION = version number
327 dnl NO-DEFINE = if set, don't define package and version number
329 dnl Use: Do all the work for Automake. This macro actually does too
330 dnl much -- some checks are only needed if your package does
331 dnl certain things. But this isn't really a big deal.
335 AC_DEFUN(AM_INIT_AUTOMAKE,
336 [AC_REQUIRE([AC_PROG_INSTALL])
341 dnl test to see if srcdir already configured
342 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
343 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
346 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
347 AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
348 AC_REQUIRE([AM_SANITY_CHECK])
349 AC_REQUIRE([AC_ARG_PROGRAM])
350 dnl FIXME This is truly gross.
351 missing_dir=`cd $ac_aux_dir && pwd`
352 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
353 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
354 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
355 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
356 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
357 AC_REQUIRE([AC_PROG_MAKE_SET])])
359 dnl --- *@-AM_PROG_LEX-@* ---
361 dnl Author: Alexandre Oliva
363 dnl Synopsis: AM_PROG_LEX
367 dnl Use: Replacement for AC_PROG_LEX and AC_DECL_YYTEXT
370 dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT
371 AC_DEFUN(AM_PROG_LEX,
372 [missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1)
373 AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex")
377 dnl --- *@-AM_PROG_LIBTOOL-@* ---
381 dnl Synopsis: AM_PROG_LIBTOOL
385 dnl Use: Configures `libtool' for the target architecture.
388 ## Configure libtool for the target system.
390 # serial 1 AM_PROG_LIBTOOL
391 AC_DEFUN(AM_PROG_LIBTOOL,
392 [AC_REQUIRE([AC_CANONICAL_HOST])
393 AC_REQUIRE([AC_PROG_CC])
394 AC_REQUIRE([AC_PROG_RANLIB])
396 # Always use our own libtool.
397 LIBTOOL='$(top_builddir)/libtool'
400 dnl Allow the --disable-shared flag to stop us from building shared libs.
401 AC_ARG_ENABLE(shared,
402 [ --enable-shared build shared libraries [default=yes]],
403 test "$enableval" = no && libtool_shared=" --disable-shared",
406 libtool_flags="$libtool_shared"
407 test "$silent" = yes && libtool_flags="$libtool_flags --silent"
408 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
410 # Actually configure libtool. ac_aux_dir is where install-sh is found.
411 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" LD="$LD" RANLIB="$RANLIB" \
412 $ac_aux_dir/ltconfig $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
413 || AC_MSG_ERROR([libtool configure failed])
416 dnl --- *@-AM_PATH_LISPDIR-@* ---
418 dnl Author: Ulrich Drepper
420 dnl Synopsis: AM_PATH_LISPDIR
424 dnl Use: Sets the variable `lispdir' to point to a place to install
425 dnl Emacs lisp files.
427 ## ------------------------
428 ## Emacs LISP file handling
429 ## From Ulrich Drepper
430 ## ------------------------
434 AC_DEFUN(AM_PATH_LISPDIR,
435 [# If set to t, that means we are running in a shell under Emacs.
436 # If you have an Emacs named "t", then use the full path.
437 test "$EMACS" = t && EMACS=
438 AC_PATH_PROG(EMACS, emacs xemacs, no)
439 if test $EMACS != "no"; then
440 AC_MSG_CHECKING([where .elc files should go])
441 dnl Set default value
442 lispdir="\$(datadir)/emacs/site-lisp"
443 if test "x$prefix" = "xNONE"; then
444 if test -d $ac_default_prefix/share/emacs/site-lisp; then
445 lispdir="\$(prefix)/share/emacs/site-lisp"
447 if test -d $ac_default_prefix/lib/emacs/site-lisp; then
448 lispdir="\$(prefix)/lib/emacs/site-lisp"
452 if test -d $prefix/share/emacs/site-lisp; then
453 lispdir="\$(prefix)/share/emacs/site-lisp"
455 if test -d $prefix/lib/emacs/site-lisp; then
456 lispdir="\$(prefix)/lib/emacs/site-lisp"
460 AC_MSG_RESULT($lispdir)
464 dnl --- *@-AM_MAINTAINTER_MODE-@* ---
466 dnl Author: Jim Meyering
468 dnl Synopsis: jm_MAINTAINER_MODE
472 dnl Use: Provides an option `--enable-maintainer-mode' which turns
473 dnl on rules which might normally be commented out. The
474 dnl substitution variable `MAINT' is set to be a comment when
475 dnl this option is disabled, which it is by default.
479 AC_DEFUN(AM_MAINTAINER_MODE,
480 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
481 dnl maintainer-mode is disabled by default
482 AC_ARG_ENABLE(maintainer-mode,
483 [ --enable-maintainer-mode enable make rules and dependencies not useful
484 (and sometimes confusing) to the casual installer],
485 USE_MAINTAINER_MODE=$enableval,
486 USE_MAINTAINER_MODE=no)
487 AC_MSG_RESULT($USE_MAINTAINER_MODE)
488 if test $USE_MAINTAINER_MODE = yes; then
497 dnl --- *@-AM_MISSING_PROG-@* ---
501 dnl Synopsis: AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
503 dnl Arguments: NAME = variable to set to the file's location
504 dnl PROGRAM = name of program to find
505 dnl DIRECTORY = directory to look in
507 dnl Use: Fakes existence of a useful GNU maintainer tool.
509 AC_DEFUN(AM_MISSING_PROG,
510 [AC_MSG_CHECKING(for working $2)
511 # Run test in a subshell; some versions of sh will print an error if
512 # an executable is not found, even if stderr is redirected.
513 # Redirect stdin to placate older versions of autoconf. Sigh.
514 if ($2 --version) < /dev/null > /dev/null 2>&1; then
519 AC_MSG_RESULT(missing)
523 dnl --- *@-AM_FUNC_MKTIME-@* ---
525 dnl Author: Jim Meyering
527 dnl Synopsis: AM_FUNC_MKTIME
531 dnl Use: Checks for a working mktime function.
533 AC_DEFUN(AM_FUNC_MKTIME,
534 [AC_REQUIRE([AC_HEADER_TIME])dnl
535 AC_CHECK_HEADERS(sys/time.h)
536 AC_CACHE_CHECK([for working mktime], am_cv_func_working_mktime,
538 changequote(<<, >>)dnl
539 <</* Test program from Paul Eggert (eggert@twinsun.com)
540 and Tony Leneis (tony@plaza.ds.adp.com). */
541 #if TIME_WITH_SYS_TIME
542 # include <sys/time.h>
546 # include <sys/time.h>
552 static time_t time_t_max;
554 /* Values we'll use to set the TZ environment variable. */
555 static const char *const tz_strings[] = {
556 NULL, "GMT0", "JST-9", "EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00"
558 #define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0]))
564 if (mktime (localtime (&now)) != now)
566 now = time_t_max - now;
567 if (mktime (localtime (&now)) != now)
577 for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2)
580 delta = time_t_max / 997; /* a suitable prime number */
581 for (i = 0; i < N_STRINGS; i++)
584 putenv (tz_strings[i]);
586 for (t = 0; t <= time_t_max - delta; t += delta)
588 mktime_test ((time_t) 60 * 60);
589 mktime_test ((time_t) 60 * 60 * 24);
595 am_cv_func_working_mktime=yes, am_cv_func_working_mktime=no,
596 dnl When crosscompiling, assume mktime is missing or broken.
597 am_cv_func_working_mktime=no)
599 if test $am_cv_func_working_mktime = no; then
600 LIBOBJS="$LIBOBJS mktime.o"
604 dnl --- *@-AM_FUNC_OBSTACK-@* ---
606 dnl Author: Jim Meyering
608 dnl Synopsis: AM_FUNC_OBSTACK
612 dnl Use: Checks for GNU obstacks.
614 AC_DEFUN(AM_FUNC_OBSTACK,
615 [AC_CACHE_CHECK([for obstacks], am_cv_func_obstack,
616 [AC_TRY_LINK([#include "obstack.h"],
617 [struct obstack *mem;obstack_free(mem,(char *) 0)],
618 am_cv_func_obstack=yes,
619 am_cv_func_obstack=no)])
620 if test $am_cv_func_obstack = yes; then
621 AC_DEFINE(HAVE_OBSTACK)
623 LIBOBJS="$LIBOBJS obstack.o"
627 dnl --- *@-AC_C_PROTOTYPES-@* ---
629 dnl Author: Franc,ois Pinard
631 dnl Synopsis: AC_C_PROTOTYPES
635 dnl Use: If the C compiler understands ANSI C, define `PROTOTYPES',
636 dnl and clear the `U' and `ANSI2KNR' variables. Otherwise,
637 dnl set `U' to be `_' and `ANSI2KNR' to be `./ansi2knr'.
641 AC_DEFUN(fp_C_PROTOTYPES,
642 [AC_REQUIRE([AM_PROG_CC_STDC])
643 AC_MSG_CHECKING([for function prototypes])
644 if test "$ac_cv_prog_cc_stdc" != no; then
646 AC_DEFINE(PROTOTYPES)
650 U=_ ANSI2KNR=./ansi2knr
653 AC_SUBST(ANSI2KNR)dnl
656 dnl --- *@-AM_PATH_GTK-@* ---
658 dnl Author: Owen Taylor
660 dnl Synopsis: AM_PATH_GTK(MIN-VERSION, [ACTION-IF-FOUND], [ACTION-IF-NOT])
662 dnl Arguments: MIN-VERSION = minimum version of GTK required
663 dnl ACTION-IF-FOUND = executed if GTK found OK
664 dnl ACTION-IF-NOT-FOUND = what to do if GTK not available
666 dnl Use: Sets up compilation environment suitably for GTK programming.
668 # Configure paths for GTK+
669 # Owen Taylor 97-11-3
671 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
672 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
674 AC_DEFUN(AM_PATH_GTK,
676 dnl Get the cflags and libraries from the gtk-config script
678 AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
679 gtk_config_prefix="$withval", gtk_config_prefix="")
680 AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
681 gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
682 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
683 , enable_gtktest=yes)
685 if test x$gtk_config_exec_prefix != x ; then
686 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
687 if test x${GTK_CONFIG+set} != xset ; then
688 GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
691 if test x$gtk_config_prefix != x ; then
692 gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
693 if test x${GTK_CONFIG+set} != xset ; then
694 GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
698 AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
699 min_gtk_version=ifelse([$1], ,0.99.7,$1)
700 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
702 if test "$GTK_CONFIG" = "no" ; then
705 GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
706 GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
707 gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
708 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
709 gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
710 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
711 gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
712 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
713 if test "x$enable_gtktest" = "xyes" ; then
714 ac_save_CFLAGS="$CFLAGS"
716 CFLAGS="$CFLAGS $GTK_CFLAGS"
717 LIBS="$LIBS $GTK_LIBS"
719 dnl Now check if the installed GTK is sufficiently new. (Also sanity
720 dnl checks the results of gtk-config to some extent
730 int major, minor, micro;
733 system ("touch conf.gtktest");
735 /* HP/UX 9 (%@#!) writes to sscanf strings */
736 tmp_version = g_strdup("$min_gtk_version");
737 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
738 printf("%s, bad version string\n", "$min_gtk_version");
742 if ((gtk_major_version != $gtk_config_major_version) ||
743 (gtk_minor_version != $gtk_config_minor_version) ||
744 (gtk_micro_version != $gtk_config_micro_version))
746 printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
747 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
748 gtk_major_version, gtk_minor_version, gtk_micro_version);
749 printf ("*** was found! If gtk-config was correct, then it is best\n");
750 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
751 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
752 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
753 printf("*** required on your system.\n");
754 printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
755 printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
756 printf("*** before re-running configure\n");
760 if ((gtk_major_version > major) ||
761 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
762 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
768 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
769 gtk_major_version, gtk_minor_version, gtk_micro_version);
770 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
771 major, minor, micro);
772 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
774 printf("*** If you have already installed a sufficiently new version, this error\n");
775 printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
776 printf("*** being found. The easiest way to fix this is to remove the old version\n");
777 printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
778 printf("*** correct copy of gtk-config. (In this case, you will have to\n");
779 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
780 printf("*** so that the correct libraries are found at run-time))\n");
785 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
786 CFLAGS="$ac_save_CFLAGS"
790 if test "x$no_gtk" = x ; then
792 ifelse([$2], , :, [$2])
795 if test "$GTK_CONFIG" = "no" ; then
796 echo "*** The gtk-config script installed by GTK could not be found"
797 echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
798 echo "*** your path, or set the GTK_CONFIG environment variable to the"
799 echo "*** full path to gtk-config."
801 if test -f conf.gtktest ; then
804 echo "*** Could not run GTK test program, checking why..."
805 CFLAGS="$CFLAGS $GTK_CFLAGS"
806 LIBS="$LIBS $GTK_LIBS"
810 ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
811 [ echo "*** The test program compiled, but did not run. This usually means"
812 echo "*** that the run-time linker is not finding GTK or finding the wrong"
813 echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
814 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
815 echo "*** to the installed location Also, make sure you have run ldconfig if that"
816 echo "*** is required on your system"
818 echo "*** If you have an old version installed, it is best to remove it, although"
819 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
821 echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
822 echo "*** came with the system with the command"
824 echo "*** rpm --erase --nodeps gtk gtk-devel" ],
825 [ echo "*** The test program failed to compile or link. See the file config.log for the"
826 echo "*** exact error that occured. This usually means GTK was incorrectly installed"
827 echo "*** or that you have moved GTK since it was installed. In the latter case, you"
828 echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
829 CFLAGS="$ac_save_CFLAGS"
835 ifelse([$3], , :, [$3])
842 dnl --- *@-AM_PATH_SDL-@* ---
844 dnl Author: Sam Langinga
846 dnl Synopsis: AM_PATH_SDL([VERSION, [IF-FOUND, [IF-NOT-FOUND]]])
848 dnl Arguments: VERSION = minimum required version
849 dnl IF-FOUND = what to do if found
850 dnl IF-NOT-FOUND = what to do if not found
852 dnl Use: Test for SDL, and define SDL_CFLAGS and SDL_LIBS
854 # Configure paths for SDL
855 # Sam Lantinga 9/21/99
856 # stolen from Manish Singh
857 # stolen back from Frank Belew
858 # stolen from Manish Singh
859 # Shamelessly stolen from Owen Taylor
861 dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
862 dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
864 AC_DEFUN(AM_PATH_SDL,
866 dnl Get the cflags and libraries from the sdl-config script
868 AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
869 sdl_prefix="$withval", sdl_prefix="")
870 AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
871 sdl_exec_prefix="$withval", sdl_exec_prefix="")
872 AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program],
873 , enable_sdltest=yes)
875 if test x$sdl_exec_prefix != x ; then
876 sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix"
877 if test x${SDL_CONFIG+set} != xset ; then
878 SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
881 if test x$sdl_prefix != x ; then
882 sdl_args="$sdl_args --prefix=$sdl_prefix"
883 if test x${SDL_CONFIG+set} != xset ; then
884 SDL_CONFIG=$sdl_prefix/bin/sdl-config
888 AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
889 min_sdl_version=ifelse([$1], ,0.11.0,$1)
890 AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
892 if test "$SDL_CONFIG" = "no" ; then
895 SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags`
896 SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs`
898 sdl_major_version=`$SDL_CONFIG $sdl_args --version | \
899 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
900 sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \
901 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
902 sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
903 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
904 if test "x$enable_sdltest" = "xyes" ; then
905 ac_save_CFLAGS="$CFLAGS"
907 CFLAGS="$CFLAGS $SDL_CFLAGS"
908 LIBS="$LIBS $SDL_LIBS"
910 dnl Now check if the installed SDL is sufficiently new. (Also sanity
911 dnl checks the results of sdl-config to some extent
921 my_strdup (char *str)
927 new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
928 strcpy (new_str, str);
936 int main (int argc, char *argv[])
938 int major, minor, micro;
941 /* This hangs on some systems (?)
942 system ("touch conf.sdltest");
944 { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
946 /* HP/UX 9 (%@#!) writes to sscanf strings */
947 tmp_version = my_strdup("$min_sdl_version");
948 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
949 printf("%s, bad version string\n", "$min_sdl_version");
953 if (($sdl_major_version > major) ||
954 (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
955 (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
961 printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
962 printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
963 printf("*** best to upgrade to the required version.\n");
964 printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
965 printf("*** to point to the correct copy of sdl-config, and remove the file\n");
966 printf("*** config.cache before re-running configure\n");
971 ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
972 CFLAGS="$ac_save_CFLAGS"
976 if test "x$no_sdl" = x ; then
978 ifelse([$2], , :, [$2])
981 if test "$SDL_CONFIG" = "no" ; then
982 echo "*** The sdl-config script installed by SDL could not be found"
983 echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
984 echo "*** your path, or set the SDL_CONFIG environment variable to the"
985 echo "*** full path to sdl-config."
987 if test -f conf.sdltest ; then
990 echo "*** Could not run SDL test program, checking why..."
991 CFLAGS="$CFLAGS $SDL_CFLAGS"
992 LIBS="$LIBS $SDL_LIBS"
997 [ echo "*** The test program compiled, but did not run. This usually means"
998 echo "*** that the run-time linker is not finding SDL or finding the wrong"
999 echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
1000 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1001 echo "*** to the installed location Also, make sure you have run ldconfig if that"
1002 echo "*** is required on your system"
1004 echo "*** If you have an old version installed, it is best to remove it, although"
1005 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
1006 [ echo "*** The test program failed to compile or link. See the file config.log for the"
1007 echo "*** exact error that occured. This usually means SDL was incorrectly installed"
1008 echo "*** or that you have moved SDL since it was installed. In the latter case, you"
1009 echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
1010 CFLAGS="$ac_save_CFLAGS"
1011 LIBS="$ac_save_LIBS"
1016 ifelse([$3], , :, [$3])
1018 AC_SUBST(SDL_CFLAGS)
1023 dnl --- *@-AC_TYPE_PTRDIFF_T-@* ---
1025 dnl Author: Ulrich Drepper
1027 dnl Synopsis: AC_TYPE_PTRDIFF_T
1031 dnl Use: Sets HAVE_PTRDIFF_T if the type exists.
1033 AC_DEFUN(AM_TYPE_PTRDIFF_T,
1034 [AC_CACHE_CHECK([for ptrdiff_t], am_cv_type_ptrdiff_t,
1035 [AC_TRY_COMPILE([#include <stddef.h>], [ptrdiff_t p],
1036 am_cv_type_ptrdiff_t=yes, am_cv_type_ptrdiff_t=no)])
1037 if test $am_cv_type_ptrdiff_t = yes; then
1038 AC_DEFINE(HAVE_PTRDIFF_T)
1042 dnl --- *@-AM_WITH_REGEX-@* ---
1044 dnl Author: Unknown (possibly Franc,ois Pinard)
1046 dnl Synopsis: AM_WITH_REGEX
1051 dnl The idea is to distribute rx.[hc] and regex.[hc] together,
1052 dnl for a while. The WITH_REGEX symbol (which should also be
1053 dnl documented in acconfig.h) is used to decide which of regex.h
1054 dnl or rx.h should be included in the application. If
1055 dnl `./configure --with-regex' is given (the default), the
1056 dnl package will use gawk's regex. If `./configure
1057 dnl --without-regex', a check is made to see if rx is already
1058 dnl installed, as with newer Linux'es. If not found, the package
1059 dnl will use the rx from the distribution. If found, the package
1060 dnl will use the system's rx which, on Linux at least, will
1061 dnl result in a smaller executable file.
1063 AC_DEFUN(AM_WITH_REGEX,
1064 [AC_MSG_CHECKING(which of GNU rx or gawk's regex is wanted)
1066 [ --without-regex use GNU rx in lieu of gawk's regex for matching],
1067 [test "$withval" = yes && am_with_regex=1],
1069 if test -n "$am_with_regex"; then
1070 AC_MSG_RESULT(regex)
1071 AC_DEFINE(WITH_REGEX)
1072 AC_CACHE_CHECK([for GNU regex in libc], am_cv_gnu_regex,
1073 AC_TRY_LINK([], [extern int re_max_failures; re_max_failures = 1],
1074 am_cv_gnu_regex=yes, am_cv_gnu_regex=no))
1075 if test $am_cv_gnu_regex = no; then
1076 LIBOBJS="$LIBOBJS regex.o"
1080 AC_CHECK_FUNC(re_rx_search, , [LIBOBJS="$LIBOBJS rx.o"])
1082 AC_SUBST(LIBOBJS)dnl
1085 dnl --- *@-AM_SANITY_CHECK-@*
1089 dnl Synopsis: AM_SANITY_CHECK
1093 dnl Use: Check for build environment sanity.
1095 AC_DEFUN(AM_SANITY_CHECK,
1096 [AC_MSG_CHECKING([whether build environment is sane])
1099 echo timestamp > conftestfile
1100 # Do `set' in a subshell so we don't clobber the current shell's
1101 # arguments. Must try -L first in case configure is actually a
1102 # symlink; some systems play weird games with the mod time of symlinks
1103 # (eg FreeBSD returns the mod time of the symlink's containing
1106 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
1107 if test "$@" = "X"; then
1109 set X `ls -t $srcdir/configure conftestfile`
1111 test "[$]2" = conftestfile
1117 AC_MSG_ERROR([newly created file is older than distributed files!
1118 Check your system clock])
1121 AC_MSG_RESULT(yes)])
1123 dnl --- *@-AM_FUNC_STRDOD-@* ---
1125 dnl Author: Jim Meyering
1127 dnl Synopsis: AM_FUNC_STRTOD
1131 dnl Use: Checks for a working strtod function.
1133 ## Copyright (C) 1996 Free Software Foundation, Inc.
1135 ## This program is free software; you can redistribute it and/or modify
1136 ## it under the terms of the GNU General Public License as published by
1137 ## the Free Software Foundation; either version 2, or (at your option)
1138 ## any later version.
1140 ## This program is distributed in the hope that it will be useful,
1141 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
1142 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1143 ## GNU General Public License for more details.
1145 ## You should have received a copy of the GNU General Public License
1146 ## along with this program; if not, write to the Free Software
1147 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1150 ## From Jim Meyering.
1154 ## @defmac AC_FUNC_STRTOD
1155 ## @maindex FUNC_STRTOD
1157 ## If the @code{strtod} function is not available, or does not work
1158 ## correctly (like the one on SunOS 5.4), add @samp{strtod.o} to output
1159 ## variable @code{LIBOBJS}.
1162 AC_DEFUN(AM_FUNC_STRTOD,
1163 [AC_CACHE_CHECK(for working strtod, am_cv_func_strtod,
1170 /* Some versions of Linux strtod mis-parse strings with leading '+'. */
1171 char *string = " +69";
1174 value = strtod (string, &term);
1175 if (value != 69 || term != (string + 4))
1180 /* Under Solaris 2.4, strtod returns the wrong value for the
1181 terminating character under some conditions. */
1182 char *string = "NaN";
1184 strtod (string, &term);
1185 if (term != string && *(term - 1) == 0)
1190 ], am_cv_func_strtod=yes, am_cv_func_strtod=no, am_cv_func_strtod=no)])
1191 test $am_cv_func_strtod = no && LIBOBJS="$LIBOBJS strtod.o"
1192 AC_SUBST(LIBOBJS)dnl
1193 am_cv_func_strtod_needs_libm=no
1194 if test $am_cv_func_strtod = no; then
1196 if test $ac_cv_func_pow = no; then
1197 AC_CHECK_LIB(m, pow, [am_cv_func_strtod_needs_libm=yes],
1198 [AC_MSG_WARN(can't find library containing definition of pow)])
1203 dnl --- *@-AM_SYS_POSIX_TERMIOS-@* ---
1205 dnl Author: Jim Meyering
1207 dnl Synopsis: AM_SYS_POSIX_TERMIOS
1211 dnl Use: Checks for a POSIX termios.h.
1213 AC_DEFUN(AM_SYS_POSIX_TERMIOS,
1214 [AC_CACHE_CHECK([POSIX termios], am_cv_sys_posix_termios,
1215 [AC_TRY_LINK([#include <sys/types.h>
1217 #include <termios.h>],
1218 [/* SunOS 4.0.3 has termios.h but not the library calls. */
1220 am_cv_sys_posix_termios=yes,
1221 am_cv_sys_posix_termios=no)])
1224 dnl----- Macros by Mark Wooding ------------------------------ *@--IGNORE--@*
1226 dnl --- *@-mdw_REQUIRE-@* ---
1228 dnl Author: Mark Wooding
1230 dnl Synopsis: mdw_REQUIRE(MACRO, ARGS...)
1232 dnl Arguments: MACRO = name of a macro which should have been called
1233 dnl ARGS = arguments to pass
1235 dnl Use: Like `AC_REQUIRE', only it handles arguments.
1237 AC_DEFUN([mdw_REQUIRE],
1238 [ifdef([AC_PROVIDE_$1], ,
1239 [AC_DIVERT_PUSH(builtin(eval, AC_DIVERSION_CURRENT - 1))dnl
1244 dnl --- *@-mdw_CURSES-@* ---
1246 dnl Author: Mark Wooding
1248 dnl Synopsis: mdw_CURSES
1252 dnl Use: Searches for a `curses' library (one of `ncurses' or
1253 dnl `curses') using mdw_CHECK_MANYLIBS. If one is found, the
1254 dnl preprocessor macro HAVE_CURSES is defined, and a search is
1255 dnl made for a `curses' header file (one of <ncurses.h>,
1256 dnl <ncurses/ncurses.h> or <curses.h>) using AC_CHECK_HEADERS
1257 dnl and the appropriate preprocessor symbol is defined.
1258 dnl Finally, a check is made for the function `wresize' using
1261 AC_DEFUN([mdw_CURSES],
1262 [mdw_CHECK_MANYLIBS(newwin, ncurses curses, AC_DEFINE(HAVE_CURSES))
1263 if test $mdw_cv_lib_newwin != no; then
1264 AC_CHECK_HEADERS([ncurses.h ncurses/ncurses.h curses.h], [break])
1265 if test "$ac_cv_header_ncurses_h" = "no" &&
1266 test "$ac_cv_header_ncurses_ncurses_h" = "no" &&
1267 test "$ac_cv_header_curses_h" = "no"; then
1268 AC_MSG_WARN([couldn't find a \`curses' header. Assuming \`curses.h'.])
1269 AC_DEFINE(HAVE_CURSES_H)
1271 AC_CHECK_FUNCS(wresize)
1274 dnl --- *@-mdw_TYPE_SSIZE_T-@* ---
1276 dnl Author: Mark Wooding
1278 dnl Synopsis: mdw_TYPE_SSIZE_T
1282 dnl Use: Checks whether the Posix type `ssize_t' is defined. If not,
1283 dnl it defaults to `int'.
1285 AC_DEFUN([mdw_TYPE_SSIZE_T],
1286 [AC_REQUIRE([AC_HEADER_STDC])
1287 AC_CACHE_CHECK(for ssize_t, mdw_cv_ssize_t,
1288 [AC_EGREP_CPP(ssize_t,
1289 [#include <sys/types.h>
1297 [mdw_cv_ssize_t=yes], [mdw_cv_ssize_t=no])])
1298 if test $mdw_cv_ssize_t = no; then
1299 AC_DEFINE(ssize_t, int)
1302 dnl --- *@-mdw_DECL_ENVIRON-@* ---
1304 dnl Author: Mark Wooding
1306 dnl Synopsis: mdw_DECL_ENVIRON
1310 dnl Use: Searches for a declaration of the global `environ' variable.
1311 dnl If one is found in one of the `usual' places, DECL_ENVIRON
1312 dnl is defined as a preprocessor symbol.
1314 AC_DEFUN([mdw_DECL_ENVIRON],
1315 [AC_CACHE_CHECK([for declaration of \`environ'], mdw_cv_environ,
1316 [AC_EGREP_CPP(environ,
1317 [#include <sys/types.h>
1324 #endif], [mdw_cv_environ=yes], [mdw_cv_environ=no])])
1325 if test $mdw_cv_environ = yes; then
1326 AC_DEFINE(DECL_ENVIRON)
1329 dnl --- *@-mdw_CHECK_MANYLIBS-@* ---
1331 dnl Author: Mark Wooding
1333 dnl Synopsis: mdw_CHECK_MANYLIBS(FUNC, LIBS, [IF-FOUND], [IF-NOT-FOUND],
1334 dnl [INCLUDES], [ARGS])
1336 dnl Arguments: FUNC = a function to try to find
1337 dnl LIBS = a whitespace-separated list of libraries to search
1338 dnl IF-FOUND = what to do when the function is found
1339 dnl IF-NOT-FOUND = what to do when the function isn't found
1340 dnl INCLUDES = other include files to add
1341 dnl ARGS = arguments to pass the function
1343 dnl Use: Searches for a library which defines FUNC. It first tries
1344 dnl without any libraries; then it tries each library specified
1345 dnl in LIBS in turn. If it finds a match, it adds the
1346 dnl appropriate library to `LIBS'.
1348 dnl This is particularly handy under DIREIX: if you link with
1349 dnl `-lnsl' then you get non-NIS-aware versions of getpwnam and
1350 dnl so on, which is clearly a Bad Thing.
1352 AC_DEFUN([mdw_CHECK_MANYLIBS],
1353 [AC_CACHE_CHECK([for library containing $1], [mdw_cv_lib_$1],
1354 [mdw_save_LIBS="$LIBS"
1356 AC_TRY_LINK([$5], [$1($6)], [mdw_cv_lib_$1="none required"])
1357 test "$mdw_cv_lib_$1" = "no" && for i in $2; do
1358 LIBS="-l$i $mdw_save_LIBS"
1359 AC_TRY_LINK([$5], [$1($6)],
1360 [mdw_cv_lib_$1="-l$i"
1363 LIBS="$mdw_save_LIBS"])
1364 if test "$mdw_cv_lib_$1" != "no"; then
1365 test "$mdw_cv_lib_$1" = "none required" || LIBS="$mdw_cv_lib_$1 $LIBS"
1371 dnl --- *@-mdw__PERL_VERSION-@* ---
1373 dnl AC_DEFUN relies on `[', `]' being quotes, so I have to drop down a level.
1376 define([mdw__PERL_VERSION], <<$1 -e 'exit ($] < $2);' >&5 2>&5>>)
1379 dnl --- *@-mdw_PROG_PERL-@* ---
1381 dnl Author: Mark Wooding
1383 dnl Synopsis: mdw_PROG_PERL(VERSION, [IF-FOUND], [IF-NOT-FOUND])
1385 dnl Arguments: VERSION = version number of Perl required
1386 dnl IF-FOUND = what to do if it's found
1387 dnl IF-NOT-FOUND = what to do if it isn't
1389 dnl Use: Attempts to find a working version of Perl with a late
1390 dnl enough version number. It supplies an option `--with-perl'
1391 dnl to allow the user to provide a Perl interpreter. If one
1392 dnl isn't provided explicitly, it searches for `perl' and `perl5'
1393 dnl in the current PATH, asking them whether they have a late
1394 dnl enough version number. The path of the working Perl is
1395 dnl put into the `PERL' environment variable; `AC_SUBST' is used
1396 dnl to substitute its value into Perl scripts. If there is no
1397 dnl Perl to be found, the value of `PERL' is set to be `none'.
1399 AC_DEFUN([mdw_PROG_PERL],
1400 [AC_ARG_WITH([perl],
1401 [ --with-perl=PERL specify path to Perl version $1 or newer],
1403 if test -z "$PERL"; then
1404 [AC_CACHE_CHECK([for Perl version $1 or later], mdw_cv_prog_perl,
1405 [mdw_cv_prog_perl="none"
1406 for p in `echo "$PATH:/usr/local/bin" | tr ":" " "`; do
1407 case $p in /*) ;; *) p=`pwd`/$p ;; esac
1408 if mdw__PERL_VERSION(["$p/perl"], $1); then
1409 mdw_cv_prog_perl="$p/perl"
1412 if mdw__PERL_VERSION(["$p/perl5"], $1); then
1413 mdw_cv_prog_perl="$p/perl5"
1417 PERL="$mdw_cv_prog_perl"])
1421 if test "$PERL" = "none"; then :
1427 dnl --- *@-mdw_CHECK_PERL-@* ---
1429 dnl Author: Mark Wooding
1431 dnl Synopsis: mdw_CHECK_PERL(VERSION)
1433 dnl Arguments: VERSION = version number of Perl required
1435 dnl Use: Verifies that the Perl interpreter in the `PERL' shell
1436 dnl variable actually works and is of the right version. If it's
1437 dnl not, an error is raised and configuration is aborted.
1439 AC_DEFUN([mdw_CHECK_PERL],
1440 [mdw_REQUIRE([mdw_PROG_PERL], [$1])
1441 AC_MSG_CHECKING([whether Perl ($PERL) works])
1442 if test "$PERL" != "none" && mdw__PERL_VERSION("$PERL", $1); then
1443 AC_MSG_RESULT([yes])
1446 AC_MSG_ERROR([Perl version $1 or newer not found.
1447 If you have a recent enough Perl, and I just failed to find it, try using
1448 the --with-perl=PERL option to give me an explicit pathname.])
1451 dnl --- *@-mdw_PERLLIB_CHECK-@* ---
1453 dnl Author: Mark Wooding
1455 dnl Synopsis: mdw_PERLLIB_CHECK(LIBRARY)
1457 dnl Arguments: LIBRARY = name of a Perl library to check for
1459 dnl Use: Ensures that a Perl script can `use LIBRARY;'. If it can,
1460 dnl all's well and good; if it can't, `LIBRARY.pm' is added to
1461 dnl the variable `NEEDED_PERLLIBS' and a line which adds
1462 dnl `pkgdatadir' to Perl's `@INC' array is placed in the
1463 dnl variable `INC_PERLLIBS'; `AC_SUBST' is called for both of
1464 dnl these variables. It's expected that `NEEDED_PERLLIBS' will
1465 dnl be used in the `Makefile.in' to decide which versions from
1466 dnl the distribution need installing.
1468 dnl This macro isn't terribly useful in the general case. It
1469 dnl Also implicitly assumes that `$PERL' is Perl 5 or later.
1471 AC_DEFUN([mdw__PERLLIB_INIT],
1472 [AC_SUBST(INC_PERLLIBS)dnl
1473 AC_SUBST(NEEDED_PERLLIBS)dnl
1476 AC_DEFUN([mdw_PERLLIB_CHECK],
1477 [AC_REQUIRE([mdw__PERLLIB_INIT])
1478 mdw_REQUIRE([mdw_CHECK_PERL], 5)
1479 AC_CACHE_CHECK([for Perl library $1], mdw_cv_perllib_$1,
1480 [if $PERL -e 'use $1;' >&5 2>&5; then
1481 mdw_cv_perllib_$1="yes"
1483 mdw_cv_perllib_$1="no"
1486 if test "$mdw_cv_perllib_$1" = "no"; then
1487 NEEDED_PERLLIBS="$NEEDED_PERLLIBS $1.pm"
1489 # --- Deal with autoconf lossage ---
1491 # It doesn't want to define `prefix' until rather later on, so I have
1494 if test -z "$INC_PERLLIBS"; then
1495 mdw_old_prefix="$prefix"
1496 test "$prefix" = "NONE" && prefix="$ac_default_prefix";
1497 INC_PERLLIBS="BEGIN { push @INC, \"`eval echo $datadir/$PACKAGE`\"; }"
1498 prefix="$mdw_old_prefix";
1502 dnl --- *@-mdw_GCC_FLAGS-@* ---
1504 dnl Author: Mark Wooding
1506 dnl Synopsis: mdw_GCC_FLAGS([FLAGS], [CFLAGS], [C++FLAGS])
1508 dnl Arguments: FLAGS = GCC compiler flags to add (default is
1509 dnl `-pedantic -Wall')
1510 dnl CFLAGS = GCC C compiler flags to add (default is empty)
1511 dnl C++FLAGS = GCC C++ compiler flags to add (default is
1512 dnl `-fhandle-exceptions').
1514 dnl Use: If the C compiler is GCC, add the compiler flags.
1516 AC_DEFUN([mdw_GCC_FLAGS],
1517 [if test "$GCC" = "yes"; then
1518 CFLAGS="$CFLAGS ifelse([$1], [], [-pedantic -Wall], [$1])"
1519 CFLAGS="$CFLAGS ifelse([$2], [], [], [$2])"
1521 if test "$GXX" = "yes"; then
1522 CXXFLAGS="$CXXFLAGS ifelse([$1], [], [-pedantic -Wall], [$1])"
1523 CXXFLAGS="$CXXFLAGS ifelse([$3], [], [-fhandle-exceptions], [$3])"
1526 dnl *@-mdw_INIT_LIB-@*
1528 dnl Author: Mark Wooding
1530 dnl Synopsis: mdw_INIT_LIB(LIB, NAME, VERSION, [PACKAGE])
1532 dnl Arguments: LIB = the name of the library (and the package)
1533 dnl NAME = a presentable version of the library's name
1534 dnl VERSION = version of the library
1535 dnl PACKAGE = package name to pass on to AM_INIT_AUTOMAKE
1537 dnl Use: Sets up various useful variables. This macro calls
1538 dnl AM_INIT_AUTOMAKE, which might be considered useful. It also
1539 dnl provides variables for the use of `lib-config.in'.
1541 AC_DEFUN([mdw_INIT_LIB],
1542 [AM_INIT_AUTOMAKE(ifelse([$4], [], [$1], [$4]), [$3])
1543 LIBRARY="$1" AC_SUBST(LIBRARY)
1544 LIBNAME="$2" AC_SUBST(LIBNAME)])
1546 dnl *@-mdw_LIB_CONFIG-@*
1548 dnl Author: Mark Wooding
1550 dnl Synopsis: mdw_LIB_CONFIG(LIB, NAME, VERSION, IF-FOUND, IF-NOT-FOUND)
1552 dnl Arguments: LIB = the name of the library (and its configuration program)
1553 dnl NAME = a presentable version of the library's name
1554 dnl VERSION = version of library required
1555 dnl IF-FOUND = what to do if found
1556 dnl IF-NOT-FOUND = what to do if not found
1558 dnl Use: Configures a library client program, using a configuration
1559 dnl script provided by the library maintainer.
1561 dnl The default version is 1.0.0pre0; the default action is to
1562 dnl add everything to the CFLAGS and LIBS variables, and complain
1563 dnl if the library couldn't be found.
1565 dnl The variable LIB_VERSION contains the version number of
1566 dnl the library; LIB_CFLAGS is the C compiler flags required
1567 dnl and LIB_LIBS is the linker flags.
1569 AC_DEFUN([mdw_LIB_CONFIG],
1570 [pushdef([upname], translit([$1], [a-z], [A-Z]))dnl
1571 AC_MSG_CHECKING([for $2 library])
1572 if $1-config --check $3 >/dev/null 2>&1; then
1573 upname[]_VERSION=`$1-config --version`
1574 upname[]_CFLAGS=`$1-config --cflags`
1575 upname[]_LIBS=`$1-config --libs`
1576 AC_SUBST(upname[]_VERSION)
1577 AC_SUBST(upname[]_CFLAGS)
1578 AC_SUBST(upname[]_LIBS)
1580 [CFLAGS="$CFLAGS $upname[]_CFLAGS"
1581 LIBS="$upname[]_LIBS $LIBS"],
1583 AC_MSG_RESULT([$upname[]_VERSION])
1586 AC_MSG_ERROR([$2 library not found or too old.]),
1588 AC_MSG_RESULT([not found])
1594 dnl Author: Mark Wooding
1596 dnl Synopsis: mdw_MLIB(VERSION, IF-FOUND, IF-NOT-FOUND
1598 dnl Arguments: VERSION = version of library required
1599 dnl IF-FOUND = what to do if found
1600 dnl IF-NOT-FOUND = what to do if not found
1602 dnl Use: Configures an mLib client program.
1604 AC_DEFUN([mdw_MLIB], [mdw_LIB_CONFIG(mLib, mLib, $@)])
1608 dnl Author: Mark Wooding
1610 dnl Synopsis: mdw_MGLIB(VERSION, IF-FOUND, IF-NOT-FOUND
1612 dnl Arguments: VERSION = version of library required
1613 dnl IF-FOUND = what to do if found
1614 dnl IF-NOT-FOUND = what to do if not found
1616 dnl Use: Configures an mgLib client program.
1618 AC_DEFUN([mdw_MGLIB],
1619 [mdw_REQUIRE([mdw_MLIB], [1.6.0])
1620 mdw_LIB_CONFIG(mgLib, mgLib, $@)])
1622 dnl *@-mdw_CATACOMB-@*
1624 dnl Author: Mark Wooding
1626 dnl Synopsis: mdw_CATACOMB([VERSION], [IF-FOUND], [IF-NOT-FOUND])
1628 dnl Arguments: VERSION = version of Catacomb required
1629 dnl IF-FOUND = what to do if found
1630 dnl IF-NOT-FOUND = what to do if not found
1632 dnl Use: Configures the program as a Catacomb client.
1634 AC_DEFUN([mdw_CATACOMB],
1635 [mdw_REQUIRE([mdw_MLIB], [1.6.0])
1636 mdw_LIB_CONFIG(catacomb, Catacomb, $@)])
1640 dnl Author: Mark Wooding
1642 dnl Synopsis: mdw_PK([VERSION], [IF-FOUND], [IF-NOT-FOUND])
1644 dnl Arguments: VERSION = version of PK required
1645 dnl IF-FOUND = what to do if found
1646 dnl IF-NOT-FOUND = what to do if not found
1648 dnl Use: Configures the program as a PK client.
1651 [mdw_REQUIRE([mdw_MLIB], [1.6.0])
1652 mdw_LIB_CONFIG(pk, PK, $@)])
1654 dnl --- *@-mdw_OPT_NDEBUG-@* ---
1656 dnl Author: Mark Wooding
1658 dnl Synopsis: mdw_OPT_NDEBUG
1662 dnl Use: Turns on the `NDEBUG' flag, to disable useful things like
1665 AC_DEFUN([mdw_OPT_NDEBUG],
1666 [AC_ARG_ENABLE(debugging,
1667 [ --disable-debugging spews vast swathes of useless information],
1668 [if test "$enableval" = "no"; then
1669 AC_DEFINE(NDEBUG, 1)
1672 dnl --- *@-mdw_OPT_EFENCE-@* ---
1674 dnl Author: Mark Wooding
1676 dnl Synopsis: mdw_OPT_EFENCE
1680 dnl Use: Links with the Electric Fence library.
1682 AC_DEFUN([mdw_OPT_EFENCE],
1683 [AC_ARG_WITH(electric-fence,
1684 [ --with-electric-fence link programs with Electric Fence],
1685 [if test "$withval" = "yes"; then
1686 AC_CHECK_LIB(efence, malloc)
1689 dnl --- *@-mdw_OPT_TRACE-@* ---
1691 dnl Author: Mark Wooding
1693 dnl Synopsis: mdw_OPT_TRACE
1697 dnl Use: Turns on the `NTRACE' flag, to disable useful things like
1700 AC_DEFUN([mdw_OPT_TRACE],
1701 [AC_ARG_ENABLE(tracing,
1702 [ --disable-tracing disable output of trace information],
1703 [if test "$enableval" = "no"; then
1704 AC_DEFINE(NTRACE, 1)
1707 dnl --- *@-mdw_OPT_mLib_TRACK-@* ---
1709 dnl Author: Mark Wooding
1711 dnl Synopsis: mdw_OPT_mLib_TRACK(PROGRAM)
1713 dnl Arguments: PROGRAM = name of this program or package.
1715 dnl Use: Controls the unsupported mLib memory tracker. The
1716 dnl following are defined:
1718 dnl --enable-track turns on malloc tracking
1719 dnl --enable-blame-PROGRAM tracks malloc contexts in PROGRAM
1721 dnl There must be a separate `blame' option for each program,
1722 dnl so that the various blame options in a hierarchy get
1723 dnl propagated properly. This is an obsolete feature from the
1724 dnl days when mLib was provided as a subdirectory of other
1727 AC_DEFUN([mdw_OPT_mLib_TRACK],
1728 [AC_REQUIRE([mdw_OPT_TRACE])
1729 AC_ARG_ENABLE(track,
1730 [ --enable-track enable tracking of malloc and free],
1731 [AC_DEFINE(TRACK_ENABLE, 1)])
1732 AC_ARG_ENABLE(blame-$1,
1734 track malloc contexts while in $1],
1735 [AC_DEFINE(TRACK_BLAME, 1)])])
1737 dnl --- *@-mdw_OPT_mLib_DEBUG-@* ---
1739 dnl Author: Mark Wooding
1741 dnl Synopsis: mdw_OPT_mLib_DEBUG(PROGRAM)
1743 dnl Arguments: PROGRAM = name of this program or package.
1745 dnl Use: Provides all of the above debugging options.
1747 AC_DEFUN([mdw_OPT_mLib_DEBUG],
1748 [mdw_REQUIRE([mdw_OPT_NDEBUG])
1749 mdw_REQUIRE([mdw_OPT_mLib_TRACK], [$1])])
1751 dnl --- *@-mdw_DEFINE_PATHS-@*
1753 dnl Author: Mark Wooding
1755 dnl Synopsis: mdw_DEFINE_FILES(CODE)
1757 dnl Arguments: CODE = shell script code to execute
1759 dnl Use: Fixes up various variables so that pathname defines can be
1760 dnl defined. Within CODE, you may use the following macros:
1762 dnl mdw_PROG(NAME) Transformed program name
1764 dnl mdw_PATH(PATH) Expanded path (may contain variables)
1766 dnl mdw_DEFINE_PROG(SYMBOL, PROG)
1767 dnl Define a symbol as a transformed
1770 dnl mdw_DEFINE_PATH(SYMBOL, NAME)
1771 dnl Define a symbol as an expanded path
1773 AC_DEFUN([mdw_DEFINE_PATHS],
1774 [mdw_prefix=$prefix mdw_exec_prefix=$exec_prefix
1775 mdw_transform=`echo "$program_transform_name"|sed 's,\\\\\\\\,\\\\,g; s,\\$\\$,$,g'`
1776 test "$prefix" = "NONE" && prefix=$ac_default_prefix
1777 test "$exec_prefix" = "NONE" && exec_prefix=$prefix
1779 prefix=$mdw_prefix exec_prefix=$mdw_exec_prefix])
1781 AC_DEFUN([mdw_PROG], [`echo "$1"|sed "$mdw_transform"`])
1782 AC_DEFUN([mdw_PATH], [dnl
1786 *\\$[]*) t=\`eval echo "$t"\`;; dnl
1790 AC_DEFUN([mdw_DEFINE_PROG], [AC_DEFINE_UNQUOTED([$1], ["mdw_PROG([$2])"])])
1791 AC_DEFUN([mdw_DEFINE_PATH], [AC_DEFINE_UNQUOTED([$1], ["mdw_PATH([$2])"])])
1793 dnl --- *@-mdw_DIR_TEXMF-@* ---
1795 dnl Author: Mark Wooding
1797 dnl Synopsis: mdw_DIR_TEXMF
1801 dnl Use: Sets the substitution `texmfdir' as a sensible TeX install
1804 AC_DEFUN([mdw_DIR_TEXMF], [
1805 AC_ARG_WITH([texmfdir],
1806 [ --with-texmfdir=DIR set the TeX install directory to DIR],
1807 [texmfdir=$withval],
1808 [AC_MSG_CHECKING([where to put installed TeX files])
1810 texmfdir='${datadir}/texmf'
1812 '${datadir}/texmf' '${prefix}/lib/texmf' \
1813 '${prefix}/texmf' '${libdir}/lib/texmf'; do
1814 if test -d "mdw_PATH([$d])"; then
1819 AC_MSG_RESULT([$texmfdir])])])
1820 AC_SUBST(texmfdir)])
1822 dnl --- *@-mdw_MANEXT-@* ---
1824 dnl Author: Mark Wooding
1826 dnl Synopsis: mdw_MANEXT
1830 dnl Use: Sets the substitution `manext' for man page extensions.
1832 AC_DEFUN([mdw_MANEXT], [
1833 AC_ARG_WITH([man-ext],
1834 [ --with-man-ext=EXT give manpages the EXT extension (e.g., foo.3EXT)],
1835 [manext=$withval], [manext=mLib])
1838 dnl----- That's all, folks --------------------------------- *@--GLOB-END--@*