1 dnl -*-fundamental-*- *@--GLOB-HEADER--@*
3 dnl $Id: aclocal.glob,v 1.15 2002/02/19 22:50:24 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.15 2002/02/19 22:50:24 mdw
32 dnl Fix spelling. Add new macro which works out where to put TeX files.
34 dnl Revision 1.14 2002/02/03 19:15:15 mdw
35 dnl Add SDL-finding equipment. Quote some macro names which need it. Add
36 dnl long-overdue macros for expanding configured paths (and do it
39 dnl Revision 1.13 2001/02/23 09:07:24 mdw
40 dnl Restore temporary variable on exit.
42 dnl Revision 1.12 2001/02/04 01:18:52 mdw
43 dnl Overhaul the mLib debugging options.
45 dnl Revision 1.11 2001/01/20 12:03:08 mdw
46 dnl Remove redundant stuff.
48 dnl Revision 1.10 2000/10/14 16:32:15 mdw
49 dnl Fixes from upstream.
51 dnl Revision 1.9 2000/08/15 21:37:49 mdw
52 dnl New initialization macro for libraries, and a new base client macro for
53 dnl finding libraries with an appropriate version.
55 dnl Revision 1.8 1999/11/26 01:23:17 mdw
56 dnl And support for MXD (not yet released).
58 dnl Revision 1.7 1999/11/11 20:03:58 mdw
59 dnl Add support for mgLib too.
61 dnl Revision 1.6 1999/11/11 17:49:33 mdw
62 dnl New macros for configuring clients of mLib and Catacomb.
64 dnl Revision 1.5 1999/07/27 18:27:37 mdw
65 dnl Fix typo in header line for mdw_DECL_ENVIRON.
67 dnl Revision 1.4 1999/07/26 23:44:32 mdw
68 dnl Reorder and tidy documentation.
70 dnl Revision 1.3 1999/07/17 10:27:44 mdw
71 dnl More useful macros added.
73 dnl Revision 1.2 1999/05/13 22:57:23 mdw
74 dnl Change `-ise' to `-ize' throughout.
76 dnl Revision 1.1.1.1 1999/05/05 19:23:47 mdw
77 dnl New import. The old CVS repository was lost in a disk disaster.
80 dnl----- Common files distribution --------------------------- *@--NOTICE--@*
82 dnl $Id: aclocal.glob,v 1.15 2002/02/19 22:50:24 mdw Exp $
84 dnl --- *@-AM_PROG_CC_STDC-@* ---
86 dnl Author: Franc,ois Pinard
88 dnl Synopsis: AM_PROG_CC_STDC
92 dnl Use: If the C compiler in not in ANSI C mode by default, try to
93 dnl add an option to output variable `CC' to make it so. This
94 dnl macro tries various options that select ANSI C on some system
95 dnl or another. It considers the compiler to be in ANSI C mode
96 dnl if it defines `__STDC__' to 1 and handles function prototypes
99 dnl If you use this macro, you should check after calling it
100 dnl whether the C compiler has been set to accept ANSI C; if not,
101 dnl the shell variable `ac_cv_prog_cc_stdc' is set to `no'. If
102 dnl you wrote your source code in ANSI C, you can make an
103 dnl un-ANSIfied copy of it by using the program `ansi2knr', which
104 dnl comes with Ghostscript.
106 dnl (documentation by Franc,ois Pinard)
108 AC_DEFUN(AM_PROG_CC_STDC,
109 [AC_REQUIRE([AC_PROG_CC])
110 AC_BEFORE([$0], [AC_C_INLINE])
111 AC_BEFORE([$0], [AC_C_CONST])
112 AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
113 AC_CACHE_VAL(am_cv_prog_cc_stdc,
114 [am_cv_prog_cc_stdc=no
116 # Don't try gcc -ansi; that turns off useful extensions and
117 # breaks some systems' header files.
119 # Ultrix and OSF/1 -std1
120 # HP-UX -Aa -D_HPUX_SOURCE
121 # SVR4 -Xc -D__EXTENSIONS__
122 for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
124 CC="$ac_save_CC $ac_arg"
126 [#if !defined(__STDC__) || __STDC__ != 1
129 /* DYNIX/ptx V4.1.3 can't compile sys/stat.h with -Xc -D__EXTENSIONS__. */
131 # include <sys/types.h>
132 # include <sys/stat.h>
135 int test (int i, double x);
136 struct s1 {int (*f) (int a);};
137 struct s2 {int (*f) (double a);};],
138 [am_cv_prog_cc_stdc="$ac_arg"; break])
142 if test -z "$am_cv_prog_cc_stdc"; then
143 AC_MSG_RESULT([none needed])
145 AC_MSG_RESULT($am_cv_prog_cc_stdc)
147 case "x$am_cv_prog_cc_stdc" in
149 *) CC="$CC $am_cv_prog_cc_stdc" ;;
153 dnl----- AutoMake macros ------------------------------------- *@--IGNORE--@*
155 dnl --- *@-AM_CONDITIONAL-@* ---
159 dnl Synopsis: AM_CONDITIONAL(NAME, TEST)
161 dnl Arguments: NAME = name of the conditional
162 dnl TEST = a shell list to execute
164 dnl Use: Allows conditional sections in Makefiles.
166 AC_DEFUN(AM_CONDITIONAL,
177 dnl --- *@-AM_CYGWIN32-@* ---
179 dnl Author: Cygnus (I guess)
181 dnl Synopsis: AM_CYGWIN32
185 dnl Use: Check to see if we're running under Cygwin32, without using
186 dnl AC_CANONICAL_*. If so, set output variable EXEEXT to
187 dnl ".exe". Otherwise set it to "".
190 dnl You might think we can do this by checking for a cygwin32-specific
191 dnl cpp define. We can't, because cross-compilers that target
192 dnl cygwin32 don't use the .exe suffix. I don't know why.
193 AC_DEFUN(AM_CYGWIN32,
194 [AC_CACHE_CHECK(for Cygwin32 environment, am_cv_cygwin32,
195 [cat > conftest.$ac_ext << 'EOF'
200 if AC_TRY_EVAL(ac_link) && test -s conftest.exe; then
207 test "$am_cv_cygwin32" = yes && EXEEXT=.exe
210 dnl --- *@-AM_WITH_DMALLOC-@* ---
212 dnl Author: Franc,ois Pinard
214 dnl Synopsis: AM_WITH_DMALLOC
218 dnl Use: Links with `-dmalloc' if told to by the user.
220 ## ----------------------------------- ##
221 ## Check if --with-dmalloc was given. ##
222 ## From Franc,ois Pinard ##
223 ## ----------------------------------- ##
227 AC_DEFUN(AM_WITH_DMALLOC,
228 [AC_MSG_CHECKING(if malloc debugging is wanted)
230 [ --with-dmalloc use dmalloc, as in
231 ftp://ftp.letters.com/src/dmalloc/dmalloc.tar.gz],
232 [if test "$withval" = yes; then
234 AC_DEFINE(WITH_DMALLOC)
235 LIBS="$LIBS -ldmalloc"
236 LDFLAGS="$LDFLAGS -g"
239 fi], [AC_MSG_RESULT(no)])
242 dnl --- *@-AM_FUNC_ERROR_AT_LINE-@* ---
244 dnl Author: Jim Meyering
246 dnl Synopsis: AM_FUNC_ERROR_AT_LINE
250 dnl Use: Use this if you use the GNU error.[ch].
252 dnl FIXME: Migrate into libit
254 AC_DEFUN(AM_FUNC_ERROR_AT_LINE,
255 [AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line,
256 [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");],
257 am_cv_lib_error_at_line=yes,
258 am_cv_lib_error_at_line=no)])
259 if test $am_cv_lib_error_at_line = no; then
260 LIBOBJS="$LIBOBJS error.o"
265 dnl --- *@-AM_INIT_GUILE_MODULE-@* ---
269 dnl Synopsis: AM_INIT_GUILE_MODULE(MODNAME)
271 dnl Arguments: MODNAME = value to initialize `module' variable with
273 dnl Use: This macro will automatically get the guile version from the
274 dnl top-level srcdir, and will initialize automake. It also
275 dnl defines the `module' variable.
277 AC_DEFUN([AM_INIT_GUILE_MODULE],[
278 . $srcdir/../GUILE-VERSION
279 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
280 AC_CONFIG_AUX_DIR(..)
284 dnl --- *@-AM_CONFIG_HEADER-@* ---
288 dnl Synopsis: AM_CONFIG_HEADER(HEADER ...)
290 dnl Arguments: HEADER = a header spec, as for AC_CONFIG_HEADER
292 dnl Use: Like AC_CONFIG_HEADER, but automatically create stamp file.
294 AC_DEFUN(AM_CONFIG_HEADER,
296 AC_CONFIG_HEADER([$1])
297 dnl When config.status generates a header, we must update the stamp-h file.
298 dnl This file resides in the same directory as the config header
299 dnl that is generated. We must strip everything past the first ":",
300 dnl and everything past the last "/".
301 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
302 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
303 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/
304 \)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
306 for am_file in <<$1>>; do
307 case " <<$>>CONFIG_HEADERS " in
308 *" <<$>>am_file "*<<)>>
309 echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
312 am_indx=`expr "<<$>>am_indx" + 1`
316 dnl --- *@-AM_INIT_AUTOMAKE-@*
320 dnl Synopsis: AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
322 dnl Arguments: PACKAGE = package name
323 dnl VERSION = version number
324 dnl NO-DEFINE = if set, don't define package and version number
326 dnl Use: Do all the work for Automake. This macro actually does too
327 dnl much -- some checks are only needed if your package does
328 dnl certain things. But this isn't really a big deal.
332 AC_DEFUN(AM_INIT_AUTOMAKE,
333 [AC_REQUIRE([AC_PROG_INSTALL])
338 dnl test to see if srcdir already configured
339 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
340 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
343 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
344 AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
345 AC_REQUIRE([AM_SANITY_CHECK])
346 AC_REQUIRE([AC_ARG_PROGRAM])
347 dnl FIXME This is truly gross.
348 missing_dir=`cd $ac_aux_dir && pwd`
349 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
350 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
351 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
352 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
353 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
354 AC_REQUIRE([AC_PROG_MAKE_SET])])
356 dnl --- *@-AM_PROG_LEX-@* ---
358 dnl Author: Alexandre Oliva
360 dnl Synopsis: AM_PROG_LEX
364 dnl Use: Replacement for AC_PROG_LEX and AC_DECL_YYTEXT
367 dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT
368 AC_DEFUN(AM_PROG_LEX,
369 [missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1)
370 AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex")
374 dnl --- *@-AM_PROG_LIBTOOL-@* ---
378 dnl Synopsis: AM_PROG_LIBTOOL
382 dnl Use: Configures `libtool' for the target architecture.
385 ## Configure libtool for the target system.
387 # serial 1 AM_PROG_LIBTOOL
388 AC_DEFUN(AM_PROG_LIBTOOL,
389 [AC_REQUIRE([AC_CANONICAL_HOST])
390 AC_REQUIRE([AC_PROG_CC])
391 AC_REQUIRE([AC_PROG_RANLIB])
393 # Always use our own libtool.
394 LIBTOOL='$(top_builddir)/libtool'
397 dnl Allow the --disable-shared flag to stop us from building shared libs.
398 AC_ARG_ENABLE(shared,
399 [ --enable-shared build shared libraries [default=yes]],
400 test "$enableval" = no && libtool_shared=" --disable-shared",
403 libtool_flags="$libtool_shared"
404 test "$silent" = yes && libtool_flags="$libtool_flags --silent"
405 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
407 # Actually configure libtool. ac_aux_dir is where install-sh is found.
408 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" LD="$LD" RANLIB="$RANLIB" \
409 $ac_aux_dir/ltconfig $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
410 || AC_MSG_ERROR([libtool configure failed])
413 dnl --- *@-AM_PATH_LISPDIR-@* ---
415 dnl Author: Ulrich Drepper
417 dnl Synopsis: AM_PATH_LISPDIR
421 dnl Use: Sets the variable `lispdir' to point to a place to install
422 dnl Emacs lisp files.
424 ## ------------------------
425 ## Emacs LISP file handling
426 ## From Ulrich Drepper
427 ## ------------------------
431 AC_DEFUN(AM_PATH_LISPDIR,
432 [# If set to t, that means we are running in a shell under Emacs.
433 # If you have an Emacs named "t", then use the full path.
434 test "$EMACS" = t && EMACS=
435 AC_PATH_PROG(EMACS, emacs xemacs, no)
436 if test $EMACS != "no"; then
437 AC_MSG_CHECKING([where .elc files should go])
438 dnl Set default value
439 lispdir="\$(datadir)/emacs/site-lisp"
440 if test "x$prefix" = "xNONE"; then
441 if test -d $ac_default_prefix/share/emacs/site-lisp; then
442 lispdir="\$(prefix)/share/emacs/site-lisp"
444 if test -d $ac_default_prefix/lib/emacs/site-lisp; then
445 lispdir="\$(prefix)/lib/emacs/site-lisp"
449 if test -d $prefix/share/emacs/site-lisp; then
450 lispdir="\$(prefix)/share/emacs/site-lisp"
452 if test -d $prefix/lib/emacs/site-lisp; then
453 lispdir="\$(prefix)/lib/emacs/site-lisp"
457 AC_MSG_RESULT($lispdir)
461 dnl --- *@-AM_MAINTAINTER_MODE-@* ---
463 dnl Author: Jim Meyering
465 dnl Synopsis: jm_MAINTAINER_MODE
469 dnl Use: Provides an option `--enable-maintainer-mode' which turns
470 dnl on rules which might normally be commented out. The
471 dnl substitution variable `MAINT' is set to be a comment when
472 dnl this option is disabled, which it is by default.
476 AC_DEFUN(AM_MAINTAINER_MODE,
477 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
478 dnl maintainer-mode is disabled by default
479 AC_ARG_ENABLE(maintainer-mode,
480 [ --enable-maintainer-mode enable make rules and dependencies not useful
481 (and sometimes confusing) to the casual installer],
482 USE_MAINTAINER_MODE=$enableval,
483 USE_MAINTAINER_MODE=no)
484 AC_MSG_RESULT($USE_MAINTAINER_MODE)
485 if test $USE_MAINTAINER_MODE = yes; then
494 dnl --- *@-AM_MISSING_PROG-@* ---
498 dnl Synopsis: AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
500 dnl Arguments: NAME = variable to set to the file's location
501 dnl PROGRAM = name of program to find
502 dnl DIRECTORY = directory to look in
504 dnl Use: Fakes existence of a useful GNU maintainer tool.
506 AC_DEFUN(AM_MISSING_PROG,
507 [AC_MSG_CHECKING(for working $2)
508 # Run test in a subshell; some versions of sh will print an error if
509 # an executable is not found, even if stderr is redirected.
510 # Redirect stdin to placate older versions of autoconf. Sigh.
511 if ($2 --version) < /dev/null > /dev/null 2>&1; then
516 AC_MSG_RESULT(missing)
520 dnl --- *@-AM_FUNC_MKTIME-@* ---
522 dnl Author: Jim Meyering
524 dnl Synopsis: AM_FUNC_MKTIME
528 dnl Use: Checks for a working mktime function.
530 AC_DEFUN(AM_FUNC_MKTIME,
531 [AC_REQUIRE([AC_HEADER_TIME])dnl
532 AC_CHECK_HEADERS(sys/time.h)
533 AC_CACHE_CHECK([for working mktime], am_cv_func_working_mktime,
535 changequote(<<, >>)dnl
536 <</* Test program from Paul Eggert (eggert@twinsun.com)
537 and Tony Leneis (tony@plaza.ds.adp.com). */
538 #if TIME_WITH_SYS_TIME
539 # include <sys/time.h>
543 # include <sys/time.h>
549 static time_t time_t_max;
551 /* Values we'll use to set the TZ environment variable. */
552 static const char *const tz_strings[] = {
553 NULL, "GMT0", "JST-9", "EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00"
555 #define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0]))
561 if (mktime (localtime (&now)) != now)
563 now = time_t_max - now;
564 if (mktime (localtime (&now)) != now)
574 for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2)
577 delta = time_t_max / 997; /* a suitable prime number */
578 for (i = 0; i < N_STRINGS; i++)
581 putenv (tz_strings[i]);
583 for (t = 0; t <= time_t_max - delta; t += delta)
585 mktime_test ((time_t) 60 * 60);
586 mktime_test ((time_t) 60 * 60 * 24);
592 am_cv_func_working_mktime=yes, am_cv_func_working_mktime=no,
593 dnl When crosscompiling, assume mktime is missing or broken.
594 am_cv_func_working_mktime=no)
596 if test $am_cv_func_working_mktime = no; then
597 LIBOBJS="$LIBOBJS mktime.o"
601 dnl --- *@-AM_FUNC_OBSTACK-@* ---
603 dnl Author: Jim Meyering
605 dnl Synopsis: AM_FUNC_OBSTACK
609 dnl Use: Checks for GNU obstacks.
611 AC_DEFUN(AM_FUNC_OBSTACK,
612 [AC_CACHE_CHECK([for obstacks], am_cv_func_obstack,
613 [AC_TRY_LINK([#include "obstack.h"],
614 [struct obstack *mem;obstack_free(mem,(char *) 0)],
615 am_cv_func_obstack=yes,
616 am_cv_func_obstack=no)])
617 if test $am_cv_func_obstack = yes; then
618 AC_DEFINE(HAVE_OBSTACK)
620 LIBOBJS="$LIBOBJS obstack.o"
624 dnl --- *@-AC_C_PROTOTYPES-@* ---
626 dnl Author: Franc,ois Pinard
628 dnl Synopsis: AC_C_PROTOTYPES
632 dnl Use: If the C compiler understands ANSI C, define `PROTOTYPES',
633 dnl and clear the `U' and `ANSI2KNR' variables. Otherwise,
634 dnl set `U' to be `_' and `ANSI2KNR' to be `./ansi2knr'.
638 AC_DEFUN(fp_C_PROTOTYPES,
639 [AC_REQUIRE([AM_PROG_CC_STDC])
640 AC_MSG_CHECKING([for function prototypes])
641 if test "$ac_cv_prog_cc_stdc" != no; then
643 AC_DEFINE(PROTOTYPES)
647 U=_ ANSI2KNR=./ansi2knr
650 AC_SUBST(ANSI2KNR)dnl
653 dnl --- *@-AM_PATH_GTK-@* ---
655 dnl Author: Owen Taylor
657 dnl Synopsis: AM_PATH_GTK(MIN-VERSION, [ACTION-IF-FOUND], [ACTION-IF-NOT])
659 dnl Arguments: MIN-VERSION = minimum version of GTK required
660 dnl ACTION-IF-FOUND = executed if GTK found OK
661 dnl ACTION-IF-NOT-FOUND = what to do if GTK not available
663 dnl Use: Sets up compilation environment suitably for GTK programming.
665 # Configure paths for GTK+
666 # Owen Taylor 97-11-3
668 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
669 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
671 AC_DEFUN(AM_PATH_GTK,
673 dnl Get the cflags and libraries from the gtk-config script
675 AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
676 gtk_config_prefix="$withval", gtk_config_prefix="")
677 AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
678 gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
679 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
680 , enable_gtktest=yes)
682 if test x$gtk_config_exec_prefix != x ; then
683 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
684 if test x${GTK_CONFIG+set} != xset ; then
685 GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
688 if test x$gtk_config_prefix != x ; then
689 gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
690 if test x${GTK_CONFIG+set} != xset ; then
691 GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
695 AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
696 min_gtk_version=ifelse([$1], ,0.99.7,$1)
697 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
699 if test "$GTK_CONFIG" = "no" ; then
702 GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
703 GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
704 gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
705 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
706 gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
707 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
708 gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
709 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
710 if test "x$enable_gtktest" = "xyes" ; then
711 ac_save_CFLAGS="$CFLAGS"
713 CFLAGS="$CFLAGS $GTK_CFLAGS"
714 LIBS="$LIBS $GTK_LIBS"
716 dnl Now check if the installed GTK is sufficiently new. (Also sanity
717 dnl checks the results of gtk-config to some extent
727 int major, minor, micro;
730 system ("touch conf.gtktest");
732 /* HP/UX 9 (%@#!) writes to sscanf strings */
733 tmp_version = g_strdup("$min_gtk_version");
734 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
735 printf("%s, bad version string\n", "$min_gtk_version");
739 if ((gtk_major_version != $gtk_config_major_version) ||
740 (gtk_minor_version != $gtk_config_minor_version) ||
741 (gtk_micro_version != $gtk_config_micro_version))
743 printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
744 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
745 gtk_major_version, gtk_minor_version, gtk_micro_version);
746 printf ("*** was found! If gtk-config was correct, then it is best\n");
747 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
748 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
749 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
750 printf("*** required on your system.\n");
751 printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
752 printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
753 printf("*** before re-running configure\n");
757 if ((gtk_major_version > major) ||
758 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
759 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
765 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
766 gtk_major_version, gtk_minor_version, gtk_micro_version);
767 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
768 major, minor, micro);
769 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
771 printf("*** If you have already installed a sufficiently new version, this error\n");
772 printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
773 printf("*** being found. The easiest way to fix this is to remove the old version\n");
774 printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
775 printf("*** correct copy of gtk-config. (In this case, you will have to\n");
776 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
777 printf("*** so that the correct libraries are found at run-time))\n");
782 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
783 CFLAGS="$ac_save_CFLAGS"
787 if test "x$no_gtk" = x ; then
789 ifelse([$2], , :, [$2])
792 if test "$GTK_CONFIG" = "no" ; then
793 echo "*** The gtk-config script installed by GTK could not be found"
794 echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
795 echo "*** your path, or set the GTK_CONFIG environment variable to the"
796 echo "*** full path to gtk-config."
798 if test -f conf.gtktest ; then
801 echo "*** Could not run GTK test program, checking why..."
802 CFLAGS="$CFLAGS $GTK_CFLAGS"
803 LIBS="$LIBS $GTK_LIBS"
807 ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
808 [ echo "*** The test program compiled, but did not run. This usually means"
809 echo "*** that the run-time linker is not finding GTK or finding the wrong"
810 echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
811 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
812 echo "*** to the installed location Also, make sure you have run ldconfig if that"
813 echo "*** is required on your system"
815 echo "*** If you have an old version installed, it is best to remove it, although"
816 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
818 echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
819 echo "*** came with the system with the command"
821 echo "*** rpm --erase --nodeps gtk gtk-devel" ],
822 [ echo "*** The test program failed to compile or link. See the file config.log for the"
823 echo "*** exact error that occured. This usually means GTK was incorrectly installed"
824 echo "*** or that you have moved GTK since it was installed. In the latter case, you"
825 echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
826 CFLAGS="$ac_save_CFLAGS"
832 ifelse([$3], , :, [$3])
839 dnl --- *@-AM_PATH_SDL-@* ---
841 dnl Author: Sam Langinga
843 dnl Synopsis: AM_PATH_SDL([VERSION, [IF-FOUND, [IF-NOT-FOUND]]])
845 dnl Arguments: VERSION = minimum required version
846 dnl IF-FOUND = what to do if found
847 dnl IF-NOT-FOUND = what to do if not found
849 dnl Use: Test for SDL, and define SDL_CFLAGS and SDL_LIBS
851 # Configure paths for SDL
852 # Sam Lantinga 9/21/99
853 # stolen from Manish Singh
854 # stolen back from Frank Belew
855 # stolen from Manish Singh
856 # Shamelessly stolen from Owen Taylor
858 dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
859 dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
861 AC_DEFUN(AM_PATH_SDL,
863 dnl Get the cflags and libraries from the sdl-config script
865 AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
866 sdl_prefix="$withval", sdl_prefix="")
867 AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
868 sdl_exec_prefix="$withval", sdl_exec_prefix="")
869 AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program],
870 , enable_sdltest=yes)
872 if test x$sdl_exec_prefix != x ; then
873 sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix"
874 if test x${SDL_CONFIG+set} != xset ; then
875 SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
878 if test x$sdl_prefix != x ; then
879 sdl_args="$sdl_args --prefix=$sdl_prefix"
880 if test x${SDL_CONFIG+set} != xset ; then
881 SDL_CONFIG=$sdl_prefix/bin/sdl-config
885 AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
886 min_sdl_version=ifelse([$1], ,0.11.0,$1)
887 AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
889 if test "$SDL_CONFIG" = "no" ; then
892 SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags`
893 SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs`
895 sdl_major_version=`$SDL_CONFIG $sdl_args --version | \
896 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
897 sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \
898 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
899 sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
900 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
901 if test "x$enable_sdltest" = "xyes" ; then
902 ac_save_CFLAGS="$CFLAGS"
904 CFLAGS="$CFLAGS $SDL_CFLAGS"
905 LIBS="$LIBS $SDL_LIBS"
907 dnl Now check if the installed SDL is sufficiently new. (Also sanity
908 dnl checks the results of sdl-config to some extent
918 my_strdup (char *str)
924 new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
925 strcpy (new_str, str);
933 int main (int argc, char *argv[])
935 int major, minor, micro;
938 /* This hangs on some systems (?)
939 system ("touch conf.sdltest");
941 { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
943 /* HP/UX 9 (%@#!) writes to sscanf strings */
944 tmp_version = my_strdup("$min_sdl_version");
945 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
946 printf("%s, bad version string\n", "$min_sdl_version");
950 if (($sdl_major_version > major) ||
951 (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
952 (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
958 printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
959 printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
960 printf("*** best to upgrade to the required version.\n");
961 printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
962 printf("*** to point to the correct copy of sdl-config, and remove the file\n");
963 printf("*** config.cache before re-running configure\n");
968 ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
969 CFLAGS="$ac_save_CFLAGS"
973 if test "x$no_sdl" = x ; then
975 ifelse([$2], , :, [$2])
978 if test "$SDL_CONFIG" = "no" ; then
979 echo "*** The sdl-config script installed by SDL could not be found"
980 echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
981 echo "*** your path, or set the SDL_CONFIG environment variable to the"
982 echo "*** full path to sdl-config."
984 if test -f conf.sdltest ; then
987 echo "*** Could not run SDL test program, checking why..."
988 CFLAGS="$CFLAGS $SDL_CFLAGS"
989 LIBS="$LIBS $SDL_LIBS"
994 [ echo "*** The test program compiled, but did not run. This usually means"
995 echo "*** that the run-time linker is not finding SDL or finding the wrong"
996 echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
997 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
998 echo "*** to the installed location Also, make sure you have run ldconfig if that"
999 echo "*** is required on your system"
1001 echo "*** If you have an old version installed, it is best to remove it, although"
1002 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
1003 [ echo "*** The test program failed to compile or link. See the file config.log for the"
1004 echo "*** exact error that occured. This usually means SDL was incorrectly installed"
1005 echo "*** or that you have moved SDL since it was installed. In the latter case, you"
1006 echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
1007 CFLAGS="$ac_save_CFLAGS"
1008 LIBS="$ac_save_LIBS"
1013 ifelse([$3], , :, [$3])
1015 AC_SUBST(SDL_CFLAGS)
1020 dnl --- *@-AC_TYPE_PTRDIFF_T-@* ---
1022 dnl Author: Ulrich Drepper
1024 dnl Synopsis: AC_TYPE_PTRDIFF_T
1028 dnl Use: Sets HAVE_PTRDIFF_T if the type exists.
1030 AC_DEFUN(AM_TYPE_PTRDIFF_T,
1031 [AC_CACHE_CHECK([for ptrdiff_t], am_cv_type_ptrdiff_t,
1032 [AC_TRY_COMPILE([#include <stddef.h>], [ptrdiff_t p],
1033 am_cv_type_ptrdiff_t=yes, am_cv_type_ptrdiff_t=no)])
1034 if test $am_cv_type_ptrdiff_t = yes; then
1035 AC_DEFINE(HAVE_PTRDIFF_T)
1039 dnl --- *@-AM_WITH_REGEX-@* ---
1041 dnl Author: Unknown (possibly Franc,ois Pinard)
1043 dnl Synopsis: AM_WITH_REGEX
1048 dnl The idea is to distribute rx.[hc] and regex.[hc] together,
1049 dnl for a while. The WITH_REGEX symbol (which should also be
1050 dnl documented in acconfig.h) is used to decide which of regex.h
1051 dnl or rx.h should be included in the application. If
1052 dnl `./configure --with-regex' is given (the default), the
1053 dnl package will use gawk's regex. If `./configure
1054 dnl --without-regex', a check is made to see if rx is already
1055 dnl installed, as with newer Linux'es. If not found, the package
1056 dnl will use the rx from the distribution. If found, the package
1057 dnl will use the system's rx which, on Linux at least, will
1058 dnl result in a smaller executable file.
1060 AC_DEFUN(AM_WITH_REGEX,
1061 [AC_MSG_CHECKING(which of GNU rx or gawk's regex is wanted)
1063 [ --without-regex use GNU rx in lieu of gawk's regex for matching],
1064 [test "$withval" = yes && am_with_regex=1],
1066 if test -n "$am_with_regex"; then
1067 AC_MSG_RESULT(regex)
1068 AC_DEFINE(WITH_REGEX)
1069 AC_CACHE_CHECK([for GNU regex in libc], am_cv_gnu_regex,
1070 AC_TRY_LINK([], [extern int re_max_failures; re_max_failures = 1],
1071 am_cv_gnu_regex=yes, am_cv_gnu_regex=no))
1072 if test $am_cv_gnu_regex = no; then
1073 LIBOBJS="$LIBOBJS regex.o"
1077 AC_CHECK_FUNC(re_rx_search, , [LIBOBJS="$LIBOBJS rx.o"])
1079 AC_SUBST(LIBOBJS)dnl
1082 dnl --- *@-AM_SANITY_CHECK-@*
1086 dnl Synopsis: AM_SANITY_CHECK
1090 dnl Use: Check for build environment sanity.
1092 AC_DEFUN(AM_SANITY_CHECK,
1093 [AC_MSG_CHECKING([whether build environment is sane])
1096 echo timestamp > conftestfile
1097 # Do `set' in a subshell so we don't clobber the current shell's
1098 # arguments. Must try -L first in case configure is actually a
1099 # symlink; some systems play weird games with the mod time of symlinks
1100 # (eg FreeBSD returns the mod time of the symlink's containing
1103 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
1104 if test "$@" = "X"; then
1106 set X `ls -t $srcdir/configure conftestfile`
1108 test "[$]2" = conftestfile
1114 AC_MSG_ERROR([newly created file is older than distributed files!
1115 Check your system clock])
1118 AC_MSG_RESULT(yes)])
1120 dnl --- *@-AM_FUNC_STRDOD-@* ---
1122 dnl Author: Jim Meyering
1124 dnl Synopsis: AM_FUNC_STRTOD
1128 dnl Use: Checks for a working strtod function.
1130 ## Copyright (C) 1996 Free Software Foundation, Inc.
1132 ## This program is free software; you can redistribute it and/or modify
1133 ## it under the terms of the GNU General Public License as published by
1134 ## the Free Software Foundation; either version 2, or (at your option)
1135 ## any later version.
1137 ## This program is distributed in the hope that it will be useful,
1138 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
1139 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1140 ## GNU General Public License for more details.
1142 ## You should have received a copy of the GNU General Public License
1143 ## along with this program; if not, write to the Free Software
1144 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1147 ## From Jim Meyering.
1151 ## @defmac AC_FUNC_STRTOD
1152 ## @maindex FUNC_STRTOD
1154 ## If the @code{strtod} function is not available, or does not work
1155 ## correctly (like the one on SunOS 5.4), add @samp{strtod.o} to output
1156 ## variable @code{LIBOBJS}.
1159 AC_DEFUN(AM_FUNC_STRTOD,
1160 [AC_CACHE_CHECK(for working strtod, am_cv_func_strtod,
1167 /* Some versions of Linux strtod mis-parse strings with leading '+'. */
1168 char *string = " +69";
1171 value = strtod (string, &term);
1172 if (value != 69 || term != (string + 4))
1177 /* Under Solaris 2.4, strtod returns the wrong value for the
1178 terminating character under some conditions. */
1179 char *string = "NaN";
1181 strtod (string, &term);
1182 if (term != string && *(term - 1) == 0)
1187 ], am_cv_func_strtod=yes, am_cv_func_strtod=no, am_cv_func_strtod=no)])
1188 test $am_cv_func_strtod = no && LIBOBJS="$LIBOBJS strtod.o"
1189 AC_SUBST(LIBOBJS)dnl
1190 am_cv_func_strtod_needs_libm=no
1191 if test $am_cv_func_strtod = no; then
1193 if test $ac_cv_func_pow = no; then
1194 AC_CHECK_LIB(m, pow, [am_cv_func_strtod_needs_libm=yes],
1195 [AC_MSG_WARN(can't find library containing definition of pow)])
1200 dnl --- *@-AM_SYS_POSIX_TERMIOS-@* ---
1202 dnl Author: Jim Meyering
1204 dnl Synopsis: AM_SYS_POSIX_TERMIOS
1208 dnl Use: Checks for a POSIX termios.h.
1210 AC_DEFUN(AM_SYS_POSIX_TERMIOS,
1211 [AC_CACHE_CHECK([POSIX termios], am_cv_sys_posix_termios,
1212 [AC_TRY_LINK([#include <sys/types.h>
1214 #include <termios.h>],
1215 [/* SunOS 4.0.3 has termios.h but not the library calls. */
1217 am_cv_sys_posix_termios=yes,
1218 am_cv_sys_posix_termios=no)])
1221 dnl----- Macros by Mark Wooding ------------------------------ *@--IGNORE--@*
1223 dnl --- *@-mdw_REQUIRE-@* ---
1225 dnl Author: Mark Wooding
1227 dnl Synopsis: mdw_REQUIRE(MACRO, ARGS...)
1229 dnl Arguments: MACRO = name of a macro which should have been called
1230 dnl ARGS = arguments to pass
1232 dnl Use: Like `AC_REQUIRE', only it handles arguments.
1234 AC_DEFUN([mdw_REQUIRE],
1235 [ifdef([AC_PROVIDE_$1], ,
1236 [AC_DIVERT_PUSH(builtin(eval, AC_DIVERSION_CURRENT - 1))dnl
1241 dnl --- *@-mdw_CURSES-@* ---
1243 dnl Author: Mark Wooding
1245 dnl Synopsis: mdw_CURSES
1249 dnl Use: Searches for a `curses' library (one of `ncurses' or
1250 dnl `curses') using mdw_CHECK_MANYLIBS. If one is found, the
1251 dnl preprocessor macro HAVE_CURSES is defined, and a search is
1252 dnl made for a `curses' header file (one of <ncurses.h>,
1253 dnl <ncurses/ncurses.h> or <curses.h>) using AC_CHECK_HEADERS
1254 dnl and the appropriate preprocessor symbol is defined.
1255 dnl Finally, a check is made for the function `wresize' using
1258 AC_DEFUN([mdw_CURSES],
1259 [mdw_CHECK_MANYLIBS(newwin, ncurses curses, AC_DEFINE(HAVE_CURSES))
1260 if test $mdw_cv_lib_newwin != no; then
1261 AC_CHECK_HEADERS([ncurses.h ncurses/ncurses.h curses.h], [break])
1262 if test "$ac_cv_header_ncurses_h" = "no" &&
1263 test "$ac_cv_header_ncurses_ncurses_h" = "no" &&
1264 test "$ac_cv_header_curses_h" = "no"; then
1265 AC_MSG_WARN([couldn't find a \`curses' header. Assuming \`curses.h'.])
1266 AC_DEFINE(HAVE_CURSES_H)
1268 AC_CHECK_FUNCS(wresize)
1271 dnl --- *@-mdw_TYPE_SSIZE_T-@* ---
1273 dnl Author: Mark Wooding
1275 dnl Synopsis: mdw_TYPE_SSIZE_T
1279 dnl Use: Checks whether the Posix type `ssize_t' is defined. If not,
1280 dnl it defaults to `int'.
1282 AC_DEFUN([mdw_TYPE_SSIZE_T],
1283 [AC_REQUIRE([AC_HEADER_STDC])
1284 AC_CACHE_CHECK(for ssize_t, mdw_cv_ssize_t,
1285 [AC_EGREP_CPP(ssize_t,
1286 [#include <sys/types.h>
1294 [mdw_cv_ssize_t=yes], [mdw_cv_ssize_t=no])])
1295 if test $mdw_cv_ssize_t = no; then
1296 AC_DEFINE(ssize_t, int)
1299 dnl --- *@-mdw_DECL_ENVIRON-@* ---
1301 dnl Author: Mark Wooding
1303 dnl Synopsis: mdw_DECL_ENVIRON
1307 dnl Use: Searches for a declaration of the global `environ' variable.
1308 dnl If one is found in one of the `usual' places, DECL_ENVIRON
1309 dnl is defined as a preprocessor symbol.
1311 AC_DEFUN([mdw_DECL_ENVIRON],
1312 [AC_CACHE_CHECK([for declaration of \`environ'], mdw_cv_environ,
1313 [AC_EGREP_CPP(environ,
1314 [#include <sys/types.h>
1321 #endif], [mdw_cv_environ=yes], [mdw_cv_environ=no])])
1322 if test $mdw_cv_environ = yes; then
1323 AC_DEFINE(DECL_ENVIRON)
1326 dnl --- *@-mdw_CHECK_MANYLIBS-@* ---
1328 dnl Author: Mark Wooding
1330 dnl Synopsis: mdw_CHECK_MANYLIBS(FUNC, LIBS, [IF-FOUND], [IF-NOT-FOUND],
1331 dnl [INCLUDES], [ARGS])
1333 dnl Arguments: FUNC = a function to try to find
1334 dnl LIBS = a whitespace-separated list of libraries to search
1335 dnl IF-FOUND = what to do when the function is found
1336 dnl IF-NOT-FOUND = what to do when the function isn't found
1337 dnl INCLUDES = other include files to add
1338 dnl ARGS = arguments to pass the function
1340 dnl Use: Searches for a library which defines FUNC. It first tries
1341 dnl without any libraries; then it tries each library specified
1342 dnl in LIBS in turn. If it finds a match, it adds the
1343 dnl appropriate library to `LIBS'.
1345 dnl This is particularly handy under DIREIX: if you link with
1346 dnl `-lnsl' then you get non-NIS-aware versions of getpwnam and
1347 dnl so on, which is clearly a Bad Thing.
1349 AC_DEFUN([mdw_CHECK_MANYLIBS],
1350 [AC_CACHE_CHECK([for library containing $1], [mdw_cv_lib_$1],
1351 [mdw_save_LIBS="$LIBS"
1353 AC_TRY_LINK([$5], [$1($6)], [mdw_cv_lib_$1="none required"])
1354 test "$mdw_cv_lib_$1" = "no" && for i in $2; do
1355 LIBS="-l$i $mdw_save_LIBS"
1356 AC_TRY_LINK([$5], [$1($6)],
1357 [mdw_cv_lib_$1="-l$i"
1360 LIBS="$mdw_save_LIBS"])
1361 if test "$mdw_cv_lib_$1" != "no"; then
1362 test "$mdw_cv_lib_$1" = "none required" || LIBS="$mdw_cv_lib_$1 $LIBS"
1368 dnl --- *@-mdw__PERL_VERSION-@* ---
1370 dnl AC_DEFUN relies on `[', `]' being quotes, so I have to drop down a level.
1373 define([mdw__PERL_VERSION], <<$1 -e 'exit ($] < $2);' >&5 2>&5>>)
1376 dnl --- *@-mdw_PROG_PERL-@* ---
1378 dnl Author: Mark Wooding
1380 dnl Synopsis: mdw_PROG_PERL(VERSION, [IF-FOUND], [IF-NOT-FOUND])
1382 dnl Arguments: VERSION = version number of Perl required
1383 dnl IF-FOUND = what to do if it's found
1384 dnl IF-NOT-FOUND = what to do if it isn't
1386 dnl Use: Attempts to find a working version of Perl with a late
1387 dnl enough version number. It supplies an option `--with-perl'
1388 dnl to allow the user to provide a Perl interpreter. If one
1389 dnl isn't provided explicitly, it searches for `perl' and `perl5'
1390 dnl in the current PATH, asking them whether they have a late
1391 dnl enough version number. The path of the working Perl is
1392 dnl put into the `PERL' environment variable; `AC_SUBST' is used
1393 dnl to substitute its value into Perl scripts. If there is no
1394 dnl Perl to be found, the value of `PERL' is set to be `none'.
1396 AC_DEFUN([mdw_PROG_PERL],
1397 [AC_ARG_WITH([perl],
1398 [ --with-perl=PERL specify path to Perl version $1 or newer],
1400 if test -z "$PERL"; then
1401 [AC_CACHE_CHECK([for Perl version $1 or later], mdw_cv_prog_perl,
1402 [mdw_cv_prog_perl="none"
1403 for p in `echo "$PATH:/usr/local/bin" | tr ":" " "`; do
1404 case $p in /*) ;; *) p=`pwd`/$p ;; esac
1405 if mdw__PERL_VERSION(["$p/perl"], $1); then
1406 mdw_cv_prog_perl="$p/perl"
1409 if mdw__PERL_VERSION(["$p/perl5"], $1); then
1410 mdw_cv_prog_perl="$p/perl5"
1414 PERL="$mdw_cv_prog_perl"])
1418 if test "$PERL" = "none"; then :
1424 dnl --- *@-mdw_CHECK_PERL-@* ---
1426 dnl Author: Mark Wooding
1428 dnl Synopsis: mdw_CHECK_PERL(VERSION)
1430 dnl Arguments: VERSION = version number of Perl required
1432 dnl Use: Verifies that the Perl interpreter in the `PERL' shell
1433 dnl variable actually works and is of the right version. If it's
1434 dnl not, an error is raised and configuration is aborted.
1436 AC_DEFUN([mdw_CHECK_PERL],
1437 [mdw_REQUIRE([mdw_PROG_PERL], [$1])
1438 AC_MSG_CHECKING([whether Perl ($PERL) works])
1439 if test "$PERL" != "none" && mdw__PERL_VERSION("$PERL", $1); then
1440 AC_MSG_RESULT([yes])
1443 AC_MSG_ERROR([Perl version $1 or newer not found.
1444 If you have a recent enough Perl, and I just failed to find it, try using
1445 the --with-perl=PERL option to give me an explicit pathname.])
1448 dnl --- *@-mdw_PERLLIB_CHECK-@* ---
1450 dnl Author: Mark Wooding
1452 dnl Synopsis: mdw_PERLLIB_CHECK(LIBRARY)
1454 dnl Arguments: LIBRARY = name of a Perl library to check for
1456 dnl Use: Ensures that a Perl script can `use LIBRARY;'. If it can,
1457 dnl all's well and good; if it can't, `LIBRARY.pm' is added to
1458 dnl the variable `NEEDED_PERLLIBS' and a line which adds
1459 dnl `pkgdatadir' to Perl's `@INC' array is placed in the
1460 dnl variable `INC_PERLLIBS'; `AC_SUBST' is called for both of
1461 dnl these variables. It's expected that `NEEDED_PERLLIBS' will
1462 dnl be used in the `Makefile.in' to decide which versions from
1463 dnl the distribution need installing.
1465 dnl This macro isn't terribly useful in the general case. It
1466 dnl Also implicitly assumes that `$PERL' is Perl 5 or later.
1468 AC_DEFUN([mdw__PERLLIB_INIT],
1469 [AC_SUBST(INC_PERLLIBS)dnl
1470 AC_SUBST(NEEDED_PERLLIBS)dnl
1473 AC_DEFUN([mdw_PERLLIB_CHECK],
1474 [AC_REQUIRE([mdw__PERLLIB_INIT])
1475 mdw_REQUIRE([mdw_CHECK_PERL], 5)
1476 AC_CACHE_CHECK([for Perl library $1], mdw_cv_perllib_$1,
1477 [if $PERL -e 'use $1;' >&5 2>&5; then
1478 mdw_cv_perllib_$1="yes"
1480 mdw_cv_perllib_$1="no"
1483 if test "$mdw_cv_perllib_$1" = "no"; then
1484 NEEDED_PERLLIBS="$NEEDED_PERLLIBS $1.pm"
1486 # --- Deal with autoconf lossage ---
1488 # It doesn't want to define `prefix' until rather later on, so I have
1491 if test -z "$INC_PERLLIBS"; then
1492 mdw_old_prefix="$prefix"
1493 test "$prefix" = "NONE" && prefix="$ac_default_prefix";
1494 INC_PERLLIBS="BEGIN { push @INC, \"`eval echo $datadir/$PACKAGE`\"; }"
1495 prefix="$mdw_old_prefix";
1499 dnl --- *@-mdw_GCC_FLAGS-@* ---
1501 dnl Author: Mark Wooding
1503 dnl Synopsis: mdw_GCC_FLAGS([FLAGS], [CFLAGS], [C++FLAGS])
1505 dnl Arguments: FLAGS = GCC compiler flags to add (default is
1506 dnl `-pedantic -Wall')
1507 dnl CFLAGS = GCC C compiler flags to add (default is empty)
1508 dnl C++FLAGS = GCC C++ compiler flags to add (default is
1509 dnl `-fhandle-exceptions').
1511 dnl Use: If the C compiler is GCC, add the compiler flags.
1513 AC_DEFUN([mdw_GCC_FLAGS],
1514 [if test "$GCC" = "yes"; then
1515 CFLAGS="$CFLAGS ifelse([$1], [], [-pedantic -Wall], [$1])"
1516 CFLAGS="$CFLAGS ifelse([$2], [], [], [$2])"
1518 if test "$GXX" = "yes"; then
1519 CXXFLAGS="$CXXFLAGS ifelse([$1], [], [-pedantic -Wall], [$1])"
1520 CXXFLAGS="$CXXFLAGS ifelse([$3], [], [-fhandle-exceptions], [$3])"
1523 dnl *@-mdw_INIT_LIB-@*
1525 dnl Author: Mark Wooding
1527 dnl Synopsis: mdw_INIT_LIB(LIB, NAME, VERSION, [PACKAGE])
1529 dnl Arguments: LIB = the name of the library (and the package)
1530 dnl NAME = a presentable version of the library's name
1531 dnl VERSION = version of the library
1532 dnl PACKAGE = package name to pass on to AM_INIT_AUTOMAKE
1534 dnl Use: Sets up various useful variables. This macro calls
1535 dnl AM_INIT_AUTOMAKE, which might be considered useful. It also
1536 dnl provides variables for the use of `lib-config.in'.
1538 AC_DEFUN([mdw_INIT_LIB],
1539 [AM_INIT_AUTOMAKE(ifelse([$4], [], [$1], [$4]), [$3])
1540 LIBRARY="$1" AC_SUBST(LIBRARY)
1541 LIBNAME="$2" AC_SUBST(LIBNAME)])
1543 dnl *@-mdw_LIB_CONFIG-@*
1545 dnl Author: Mark Wooding
1547 dnl Synopsis: mdw_LIB_CONFIG(LIB, NAME, VERSION, IF-FOUND, IF-NOT-FOUND)
1549 dnl Arguments: LIB = the name of the library (and its configuration program)
1550 dnl NAME = a presentable version of the library's name
1551 dnl VERSION = version of library required
1552 dnl IF-FOUND = what to do if found
1553 dnl IF-NOT-FOUND = what to do if not found
1555 dnl Use: Configures a library client program, using a configuration
1556 dnl script provided by the library maintainer.
1558 dnl The default version is 1.0.0pre0; the default action is to
1559 dnl add everything to the CFLAGS and LIBS variables, and complain
1560 dnl if the library couldn't be found.
1562 dnl The variable LIB_VERSION contains the version number of
1563 dnl the library; LIB_CFLAGS is the C compiler flags required
1564 dnl and LIB_LIBS is the linker flags.
1566 AC_DEFUN([mdw_LIB_CONFIG],
1567 [pushdef([upname], translit([$1], [a-z], [A-Z]))dnl
1568 AC_MSG_CHECKING([for $2 library])
1569 if $1-config --check $3 >/dev/null 2>&1; then
1570 upname[]_VERSION=`$1-config --version`
1571 upname[]_CFLAGS=`$1-config --cflags`
1572 upname[]_LIBS=`$1-config --libs`
1573 AC_SUBST(upname[]_VERSION)
1574 AC_SUBST(upname[]_CFLAGS)
1575 AC_SUBST(upname[]_LIBS)
1577 [CFLAGS="$CFLAGS $upname[]_CFLAGS"
1578 LIBS="$upname[]_LIBS $LIBS"],
1580 AC_MSG_RESULT([$upname[]_VERSION])
1583 AC_MSG_ERROR([$2 library not found or too old.]),
1585 AC_MSG_RESULT([not found])
1591 dnl Author: Mark Wooding
1593 dnl Synopsis: mdw_MLIB(VERSION, IF-FOUND, IF-NOT-FOUND
1595 dnl Arguments: VERSION = version of library required
1596 dnl IF-FOUND = what to do if found
1597 dnl IF-NOT-FOUND = what to do if not found
1599 dnl Use: Configures an mLib client program.
1601 AC_DEFUN([mdw_MLIB], [mdw_LIB_CONFIG(mLib, mLib, $@)])
1605 dnl Author: Mark Wooding
1607 dnl Synopsis: mdw_MGLIB(VERSION, IF-FOUND, IF-NOT-FOUND
1609 dnl Arguments: VERSION = version of library required
1610 dnl IF-FOUND = what to do if found
1611 dnl IF-NOT-FOUND = what to do if not found
1613 dnl Use: Configures an mgLib client program.
1615 AC_DEFUN([mdw_MGLIB],
1616 [mdw_REQUIRE([mdw_MLIB], [1.6.0])
1617 mdw_LIB_CONFIG(mgLib, mgLib, $@)])
1619 dnl *@-mdw_CATACOMB-@*
1621 dnl Author: Mark Wooding
1623 dnl Synopsis: mdw_CATACOMB([VERSION], [IF-FOUND], [IF-NOT-FOUND])
1625 dnl Arguments: VERSION = version of Catacomb required
1626 dnl IF-FOUND = what to do if found
1627 dnl IF-NOT-FOUND = what to do if not found
1629 dnl Use: Configures the program as a Catacomb client.
1631 AC_DEFUN([mdw_CATACOMB],
1632 [mdw_REQUIRE([mdw_MLIB], [1.6.0])
1633 mdw_LIB_CONFIG(catacomb, Catacomb, $@)])
1637 dnl Author: Mark Wooding
1639 dnl Synopsis: mdw_PK([VERSION], [IF-FOUND], [IF-NOT-FOUND])
1641 dnl Arguments: VERSION = version of PK required
1642 dnl IF-FOUND = what to do if found
1643 dnl IF-NOT-FOUND = what to do if not found
1645 dnl Use: Configures the program as a PK client.
1648 [mdw_REQUIRE([mdw_MLIB], [1.6.0])
1649 mdw_LIB_CONFIG(pk, PK, $@)])
1651 dnl --- *@-mdw_OPT_NDEBUG-@* ---
1653 dnl Author: Mark Wooding
1655 dnl Synopsis: mdw_OPT_NDEBUG
1659 dnl Use: Turns on the `NDEBUG' flag, to disable useful things like
1662 AC_DEFUN([mdw_OPT_NDEBUG],
1663 [AC_ARG_ENABLE(debugging,
1664 [ --disable-debugging spews vast swathes of useless information],
1665 [if test "$enableval" = "no"; then
1666 AC_DEFINE(NDEBUG, 1)
1669 dnl --- *@-mdw_OPT_EFENCE-@* ---
1671 dnl Author: Mark Wooding
1673 dnl Synopsis: mdw_OPT_EFENCE
1677 dnl Use: Links with the Electric Fence library.
1679 AC_DEFUN([mdw_OPT_EFENCE],
1680 [AC_ARG_WITH(electric-fence,
1681 [ --with-electric-fence link programs with Electric Fence],
1682 [if test "$withval" = "yes"; then
1683 AC_CHECK_LIB(efence, malloc)
1686 dnl --- *@-mdw_OPT_TRACE-@* ---
1688 dnl Author: Mark Wooding
1690 dnl Synopsis: mdw_OPT_TRACE
1694 dnl Use: Turns on the `NTRACE' flag, to disable useful things like
1697 AC_DEFUN([mdw_OPT_TRACE],
1698 [AC_ARG_ENABLE(tracing,
1699 [ --disable-tracing disable output of trace information],
1700 [if test "$enableval" = "no"; then
1701 AC_DEFINE(NTRACE, 1)
1704 dnl --- *@-mdw_OPT_mLib_TRACK-@* ---
1706 dnl Author: Mark Wooding
1708 dnl Synopsis: mdw_OPT_mLib_TRACK(PROGRAM)
1710 dnl Arguments: PROGRAM = name of this program or package.
1712 dnl Use: Controls the unsupported mLib memory tracker. The
1713 dnl following are defined:
1715 dnl --enable-track turns on malloc tracking
1716 dnl --enable-blame-PROGRAM tracks malloc contexts in PROGRAM
1718 dnl There must be a separate `blame' option for each program,
1719 dnl so that the various blame options in a hierarchy get
1720 dnl propagated properly. This is an obsolete feature from the
1721 dnl days when mLib was provided as a subdirectory of other
1724 AC_DEFUN([mdw_OPT_mLib_TRACK],
1725 [AC_REQUIRE([mdw_OPT_TRACE])
1726 AC_ARG_ENABLE(track,
1727 [ --enable-track enable tracking of malloc and free],
1728 [AC_DEFINE(TRACK_ENABLE, 1)])
1729 AC_ARG_ENABLE(blame-$1,
1731 track malloc contexts while in $1],
1732 [AC_DEFINE(TRACK_BLAME, 1)])])
1734 dnl --- *@-mdw_OPT_mLib_DEBUG-@* ---
1736 dnl Author: Mark Wooding
1738 dnl Synopsis: mdw_OPT_mLib_DEBUG(PROGRAM)
1740 dnl Arguments: PROGRAM = name of this program or package.
1742 dnl Use: Provides all of the above debugging options.
1744 AC_DEFUN([mdw_OPT_mLib_DEBUG],
1745 [mdw_REQUIRE([mdw_OPT_NDEBUG])
1746 mdw_REQUIRE([mdw_OPT_mLib_TRACK], [$1])])
1748 dnl --- *@-mdw_DEFINE_PATHS-@*
1750 dnl Author: Mark Wooding
1752 dnl Synopsis: mdw_DEFINE_FILES(CODE)
1754 dnl Arguments: CODE = shell script code to execute
1756 dnl Use: Fixes up various variables so that pathname defines can be
1757 dnl defined. Within CODE, you may use the following macros:
1759 dnl mdw_PROG(NAME) Transformed program name
1761 dnl mdw_PATH(PATH) Expanded path (may contain variables)
1763 dnl mdw_DEFINE_PROG(SYMBOL, PROG)
1764 dnl Define a symbol as a transformed
1767 dnl mdw_DEFINE_PATH(SYMBOL, NAME)
1768 dnl Define a symbol as an expanded path
1770 AC_DEFUN([mdw_DEFINE_PATHS],
1771 [mdw_prefix=$prefix mdw_exec_prefix=$exec_prefix
1772 mdw_transform=`echo "$program_transform_name"|sed 's,\\\\\\\\,\\\\,g; s,\\$\\$,$,g'`
1773 test "$prefix" = "NONE" && prefix=$ac_default_prefix
1774 test "$exec_prefix" = "NONE" && exec_prefix=$prefix
1776 prefix=$mdw_prefix exec_prefix=$mdw_exec_prefix])
1778 AC_DEFUN([mdw_PROG], [`echo "$1"|sed "$mdw_transform"`])
1779 AC_DEFUN([mdw_PATH], [dnl
1783 *\\$[]*) t=\`eval echo "$t"\`;; dnl
1787 AC_DEFUN([mdw_DEFINE_PROG], [AC_DEFINE_UNQUOTED([$1], ["mdw_PROG([$2])"])])
1788 AC_DEFUN([mdw_DEFINE_PATH], [AC_DEFINE_UNQUOTED([$1], ["mdw_PATH([$2])"])])
1790 dnl --- *@-mdw_DIR_TEXMF-@* ---
1792 dnl Author: Mark Wooding
1794 dnl Synopsis: mdw_DIR_TEXMF
1798 dnl Use: Sets the substitution `texmfdir' as a sensible TeX install
1801 AC_DEFUN([mdw_DIR_TEXMF], [
1802 AC_ARG_WITH([texmfdir],
1803 [ --with-texmfdir=DIR set the TeX install directory to DIR],
1804 [texmfdir=$witharg],
1805 [AC_MSG_CHECKING([where to put installed TeX files])
1807 texmfdir='${datadir}/texmf'
1809 '${datadir}/texmf' '${prefix}/lib/texmf' \
1810 '${prefix}/texmf' '${libdir}/lib/texmf'; do
1811 if test -d "mdw_PATH([$d])"; then
1816 AC_MSG_RESULT([$texmfdir])])])
1817 AC_SUBST(texmfdir)])
1819 dnl----- That's all, folks --------------------------------- *@--GLOB-END--@*