1 dnl -*-fundamental-*- *@--GLOB-HEADER--@*
3 dnl $Id: aclocal.glob,v 1.14 2002/02/03 19:15:15 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.14 2002/02/03 19:15:15 mdw
32 dnl Add SDL-finding equipment. Quote some macro names which need it. Add
33 dnl long-overdue macros for expanding configured paths (and do it
36 dnl Revision 1.13 2001/02/23 09:07:24 mdw
37 dnl Restore temporary variable on exit.
39 dnl Revision 1.12 2001/02/04 01:18:52 mdw
40 dnl Overhaul the mLib debugging options.
42 dnl Revision 1.11 2001/01/20 12:03:08 mdw
43 dnl Remove redundant stuff.
45 dnl Revision 1.10 2000/10/14 16:32:15 mdw
46 dnl Fixes from upstream.
48 dnl Revision 1.9 2000/08/15 21:37:49 mdw
49 dnl New initialization macro for libraries, and a new base client macro for
50 dnl finding libraries with an appropriate version.
52 dnl Revision 1.8 1999/11/26 01:23:17 mdw
53 dnl And support for MXD (not yet released).
55 dnl Revision 1.7 1999/11/11 20:03:58 mdw
56 dnl Add support for mgLib too.
58 dnl Revision 1.6 1999/11/11 17:49:33 mdw
59 dnl New macros for configuring clients of mLib and Catacomb.
61 dnl Revision 1.5 1999/07/27 18:27:37 mdw
62 dnl Fix typo in header line for mdw_DECL_ENVIRON.
64 dnl Revision 1.4 1999/07/26 23:44:32 mdw
65 dnl Reorder and tidy documentation.
67 dnl Revision 1.3 1999/07/17 10:27:44 mdw
68 dnl More useful macros added.
70 dnl Revision 1.2 1999/05/13 22:57:23 mdw
71 dnl Change `-ise' to `-ize' throughout.
73 dnl Revision 1.1.1.1 1999/05/05 19:23:47 mdw
74 dnl New import. The old CVS repository was lost in a disk disaster.
77 dnl----- Common files distribution --------------------------- *@--NOTICE--@*
79 dnl $Id: aclocal.glob,v 1.14 2002/02/03 19:15:15 mdw Exp $
81 dnl --- *@-AM_PROG_CC_STDC-@* ---
83 dnl Author: Franc,ois Pinard
85 dnl Synopsis: AM_PROG_CC_STDC
89 dnl Use: If the C compiler in not in ANSI C mode by default, try to
90 dnl add an option to output variable `CC' to make it so. This
91 dnl macro tries various options that select ANSI C on some system
92 dnl or another. It considers the compiler to be in ANSI C mode
93 dnl if it defines `__STDC__' to 1 and handles function prototypes
96 dnl If you use this macro, you should check after calling it
97 dnl whether the C compiler has been set to accept ANSI C; if not,
98 dnl the shell variable `ac_cv_prog_cc_stdc' is set to `no'. If
99 dnl you wrote your source code in ANSI C, you can make an
100 dnl un-ANSIfied copy of it by using the program `ansi2knr', which
101 dnl comes with Ghostscript.
103 dnl (documentation by Franc,ois Pinard)
105 AC_DEFUN(AM_PROG_CC_STDC,
106 [AC_REQUIRE([AC_PROG_CC])
107 AC_BEFORE([$0], [AC_C_INLINE])
108 AC_BEFORE([$0], [AC_C_CONST])
109 AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
110 AC_CACHE_VAL(am_cv_prog_cc_stdc,
111 [am_cv_prog_cc_stdc=no
113 # Don't try gcc -ansi; that turns off useful extensions and
114 # breaks some systems' header files.
116 # Ultrix and OSF/1 -std1
117 # HP-UX -Aa -D_HPUX_SOURCE
118 # SVR4 -Xc -D__EXTENSIONS__
119 for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
121 CC="$ac_save_CC $ac_arg"
123 [#if !defined(__STDC__) || __STDC__ != 1
126 /* DYNIX/ptx V4.1.3 can't compile sys/stat.h with -Xc -D__EXTENSIONS__. */
128 # include <sys/types.h>
129 # include <sys/stat.h>
132 int test (int i, double x);
133 struct s1 {int (*f) (int a);};
134 struct s2 {int (*f) (double a);};],
135 [am_cv_prog_cc_stdc="$ac_arg"; break])
139 if test -z "$am_cv_prog_cc_stdc"; then
140 AC_MSG_RESULT([none needed])
142 AC_MSG_RESULT($am_cv_prog_cc_stdc)
144 case "x$am_cv_prog_cc_stdc" in
146 *) CC="$CC $am_cv_prog_cc_stdc" ;;
150 dnl----- AutoMake macros ------------------------------------- *@--IGNORE--@*
152 dnl --- *@-AM_CONDITIONAL-@* ---
156 dnl Synopsis: AM_CONDITIONAL(NAME, TEST)
158 dnl Arguments: NAME = name of the conditional
159 dnl TEST = a shell list to execute
161 dnl Use: Allows conditional sections in Makefiles.
163 AC_DEFUN(AM_CONDITIONAL,
174 dnl --- *@-AM_CYGWIN32-@* ---
176 dnl Author: Cygnus (I guess)
178 dnl Synopsis: AM_CYGWIN32
182 dnl Use: Check to see if we're running under Cygwin32, without using
183 dnl AC_CANONICAL_*. If so, set output variable EXEEXT to
184 dnl ".exe". Otherwise set it to "".
187 dnl You might think we can do this by checking for a cygwin32-specific
188 dnl cpp define. We can't, because cross-compilers that target
189 dnl cygwin32 don't use the .exe suffix. I don't know why.
190 AC_DEFUN(AM_CYGWIN32,
191 [AC_CACHE_CHECK(for Cygwin32 environment, am_cv_cygwin32,
192 [cat > conftest.$ac_ext << 'EOF'
197 if AC_TRY_EVAL(ac_link) && test -s conftest.exe; then
204 test "$am_cv_cygwin32" = yes && EXEEXT=.exe
207 dnl --- *@-AM_WITH_DMALLOC-@* ---
209 dnl Author: Franc,ois Pinard
211 dnl Synopsis: AM_WITH_DMALLOC
215 dnl Use: Links with `-dmalloc' if told to by the user.
217 ## ----------------------------------- ##
218 ## Check if --with-dmalloc was given. ##
219 ## From Franc,ois Pinard ##
220 ## ----------------------------------- ##
224 AC_DEFUN(AM_WITH_DMALLOC,
225 [AC_MSG_CHECKING(if malloc debugging is wanted)
227 [ --with-dmalloc use dmalloc, as in
228 ftp://ftp.letters.com/src/dmalloc/dmalloc.tar.gz],
229 [if test "$withval" = yes; then
231 AC_DEFINE(WITH_DMALLOC)
232 LIBS="$LIBS -ldmalloc"
233 LDFLAGS="$LDFLAGS -g"
236 fi], [AC_MSG_RESULT(no)])
239 dnl --- *@-AM_FUNC_ERROR_AT_LINE-@* ---
241 dnl Author: Jim Meyering
243 dnl Synopsis: AM_FUNC_ERROR_AT_LINE
247 dnl Use: Use this if you use the GNU error.[ch].
249 dnl FIXME: Migrate into libit
251 AC_DEFUN(AM_FUNC_ERROR_AT_LINE,
252 [AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line,
253 [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");],
254 am_cv_lib_error_at_line=yes,
255 am_cv_lib_error_at_line=no)])
256 if test $am_cv_lib_error_at_line = no; then
257 LIBOBJS="$LIBOBJS error.o"
262 dnl --- *@-AM_INIT_GUILE_MODULE-@* ---
266 dnl Synopsis: AM_INIT_GUILE_MODULE(MODNAME)
268 dnl Arguments: MODNAME = value to initialize `module' variable with
270 dnl Use: This macro will automatically get the guile version from the
271 dnl top-level srcdir, and will initialize automake. It also
272 dnl defines the `module' variable.
274 AC_DEFUN([AM_INIT_GUILE_MODULE],[
275 . $srcdir/../GUILE-VERSION
276 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
277 AC_CONFIG_AUX_DIR(..)
281 dnl --- *@-AM_CONFIG_HEADER-@* ---
285 dnl Synopsis: AM_CONFIG_HEADER(HEADER ...)
287 dnl Arguments: HEADER = a header spec, as for AC_CONFIG_HEADER
289 dnl Use: Like AC_CONFIG_HEADER, but automatically create stamp file.
291 AC_DEFUN(AM_CONFIG_HEADER,
293 AC_CONFIG_HEADER([$1])
294 dnl When config.status generates a header, we must update the stamp-h file.
295 dnl This file resides in the same directory as the config header
296 dnl that is generated. We must strip everything past the first ":",
297 dnl and everything past the last "/".
298 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
299 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
300 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/
301 \)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
303 for am_file in <<$1>>; do
304 case " <<$>>CONFIG_HEADERS " in
305 *" <<$>>am_file "*<<)>>
306 echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
309 am_indx=`expr "<<$>>am_indx" + 1`
313 dnl --- *@-AM_INIT_AUTOMAKE-@*
317 dnl Synopsis: AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
319 dnl Arguments: PACKAGE = package name
320 dnl VERSION = version number
321 dnl NO-DEFINE = if set, don't define package and version number
323 dnl Use: Do all the work for Automake. This macro actually does too
324 dnl much -- some checks are only needed if your package does
325 dnl certain things. But this isn't really a big deal.
329 AC_DEFUN(AM_INIT_AUTOMAKE,
330 [AC_REQUIRE([AC_PROG_INSTALL])
335 dnl test to see if srcdir already configured
336 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
337 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
340 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
341 AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
342 AC_REQUIRE([AM_SANITY_CHECK])
343 AC_REQUIRE([AC_ARG_PROGRAM])
344 dnl FIXME This is truly gross.
345 missing_dir=`cd $ac_aux_dir && pwd`
346 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
347 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
348 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
349 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
350 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
351 AC_REQUIRE([AC_PROG_MAKE_SET])])
353 dnl --- *@-AM_PROG_LEX-@* ---
355 dnl Author: Alexandre Oliva
357 dnl Synopsis: AM_PROG_LEX
361 dnl Use: Replacement for AC_PROG_LEX and AC_DECL_YYTEXT
364 dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT
365 AC_DEFUN(AM_PROG_LEX,
366 [missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1)
367 AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex")
371 dnl --- *@-AM_PROG_LIBTOOL-@* ---
375 dnl Synopsis: AM_PROG_LIBTOOL
379 dnl Use: Configures `libtool' for the target architecture.
382 ## Configure libtool for the target system.
384 # serial 1 AM_PROG_LIBTOOL
385 AC_DEFUN(AM_PROG_LIBTOOL,
386 [AC_REQUIRE([AC_CANONICAL_HOST])
387 AC_REQUIRE([AC_PROG_CC])
388 AC_REQUIRE([AC_PROG_RANLIB])
390 # Always use our own libtool.
391 LIBTOOL='$(top_builddir)/libtool'
394 dnl Allow the --disable-shared flag to stop us from building shared libs.
395 AC_ARG_ENABLE(shared,
396 [ --enable-shared build shared libraries [default=yes]],
397 test "$enableval" = no && libtool_shared=" --disable-shared",
400 libtool_flags="$libtool_shared"
401 test "$silent" = yes && libtool_flags="$libtool_flags --silent"
402 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
404 # Actually configure libtool. ac_aux_dir is where install-sh is found.
405 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" LD="$LD" RANLIB="$RANLIB" \
406 $ac_aux_dir/ltconfig $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
407 || AC_MSG_ERROR([libtool configure failed])
410 dnl --- *@-AM_PATH_LISPDIR-@* ---
412 dnl Author: Ulrich Drepper
414 dnl Synopsis: AM_PATH_LISPDIR
418 dnl Use: Sets the variable `lispdir' to point to a place to install
419 dnl Emacs lisp files.
421 ## ------------------------
422 ## Emacs LISP file handling
423 ## From Ulrich Drepper
424 ## ------------------------
428 AC_DEFUN(AM_PATH_LISPDIR,
429 [# If set to t, that means we are running in a shell under Emacs.
430 # If you have an Emacs named "t", then use the full path.
431 test "$EMACS" = t && EMACS=
432 AC_PATH_PROG(EMACS, emacs xemacs, no)
433 if test $EMACS != "no"; then
434 AC_MSG_CHECKING([where .elc files should go])
435 dnl Set default value
436 lispdir="\$(datadir)/emacs/site-lisp"
437 if test "x$prefix" = "xNONE"; then
438 if test -d $ac_default_prefix/share/emacs/site-lisp; then
439 lispdir="\$(prefix)/share/emacs/site-lisp"
441 if test -d $ac_default_prefix/lib/emacs/site-lisp; then
442 lispdir="\$(prefix)/lib/emacs/site-lisp"
446 if test -d $prefix/share/emacs/site-lisp; then
447 lispdir="\$(prefix)/share/emacs/site-lisp"
449 if test -d $prefix/lib/emacs/site-lisp; then
450 lispdir="\$(prefix)/lib/emacs/site-lisp"
454 AC_MSG_RESULT($lispdir)
458 dnl --- *@-AM_MAINTAINTER_MODE-@* ---
460 dnl Author: Jim Meyering
462 dnl Synopsis: jm_MAINTAINER_MODE
466 dnl Use: Provides an option `--enable-maintainer-mode' which turns
467 dnl on rules which might normally be commented out. The
468 dnl substitution variable `MAINT' is set to be a comment when
469 dnl this option is disabled, which it is by default.
473 AC_DEFUN(AM_MAINTAINER_MODE,
474 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
475 dnl maintainer-mode is disabled by default
476 AC_ARG_ENABLE(maintainer-mode,
477 [ --enable-maintainer-mode enable make rules and dependencies not useful
478 (and sometimes confusing) to the casual installer],
479 USE_MAINTAINER_MODE=$enableval,
480 USE_MAINTAINER_MODE=no)
481 AC_MSG_RESULT($USE_MAINTAINER_MODE)
482 if test $USE_MAINTAINER_MODE = yes; then
491 dnl --- *@-AM_MISSING_PROG-@* ---
495 dnl Synopsis: AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
497 dnl Arguments: NAME = variable to set to the file's location
498 dnl PROGRAM = name of program to find
499 dnl DIRECTORY = directory to look in
501 dnl Use: Fakes existence of a useful GNU maintainer tool.
503 AC_DEFUN(AM_MISSING_PROG,
504 [AC_MSG_CHECKING(for working $2)
505 # Run test in a subshell; some versions of sh will print an error if
506 # an executable is not found, even if stderr is redirected.
507 # Redirect stdin to placate older versions of autoconf. Sigh.
508 if ($2 --version) < /dev/null > /dev/null 2>&1; then
513 AC_MSG_RESULT(missing)
517 dnl --- *@-AM_FUNC_MKTIME-@* ---
519 dnl Author: Jim Meyering
521 dnl Synopsis: AM_FUNC_MKTIME
525 dnl Use: Checks for a working mktime function.
527 AC_DEFUN(AM_FUNC_MKTIME,
528 [AC_REQUIRE([AC_HEADER_TIME])dnl
529 AC_CHECK_HEADERS(sys/time.h)
530 AC_CACHE_CHECK([for working mktime], am_cv_func_working_mktime,
532 changequote(<<, >>)dnl
533 <</* Test program from Paul Eggert (eggert@twinsun.com)
534 and Tony Leneis (tony@plaza.ds.adp.com). */
535 #if TIME_WITH_SYS_TIME
536 # include <sys/time.h>
540 # include <sys/time.h>
546 static time_t time_t_max;
548 /* Values we'll use to set the TZ environment variable. */
549 static const char *const tz_strings[] = {
550 NULL, "GMT0", "JST-9", "EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00"
552 #define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0]))
558 if (mktime (localtime (&now)) != now)
560 now = time_t_max - now;
561 if (mktime (localtime (&now)) != now)
571 for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2)
574 delta = time_t_max / 997; /* a suitable prime number */
575 for (i = 0; i < N_STRINGS; i++)
578 putenv (tz_strings[i]);
580 for (t = 0; t <= time_t_max - delta; t += delta)
582 mktime_test ((time_t) 60 * 60);
583 mktime_test ((time_t) 60 * 60 * 24);
589 am_cv_func_working_mktime=yes, am_cv_func_working_mktime=no,
590 dnl When crosscompiling, assume mktime is missing or broken.
591 am_cv_func_working_mktime=no)
593 if test $am_cv_func_working_mktime = no; then
594 LIBOBJS="$LIBOBJS mktime.o"
598 dnl --- *@-AM_FUNC_OBSTACK-@* ---
600 dnl Author: Jim Meyering
602 dnl Synopsis: AM_FUNC_OBSTACK
606 dnl Use: Checks for GNU obstacks.
608 AC_DEFUN(AM_FUNC_OBSTACK,
609 [AC_CACHE_CHECK([for obstacks], am_cv_func_obstack,
610 [AC_TRY_LINK([#include "obstack.h"],
611 [struct obstack *mem;obstack_free(mem,(char *) 0)],
612 am_cv_func_obstack=yes,
613 am_cv_func_obstack=no)])
614 if test $am_cv_func_obstack = yes; then
615 AC_DEFINE(HAVE_OBSTACK)
617 LIBOBJS="$LIBOBJS obstack.o"
621 dnl --- *@-AC_C_PROTOTYPES-@* ---
623 dnl Author: Franc,ois Pinard
625 dnl Synopsis: AC_C_PROTOTYPES
629 dnl Use: If the C compiler understands ANSI C, define `PROTOTYPES',
630 dnl and clear the `U' and `ANSI2KNR' variables. Otherwise,
631 dnl set `U' to be `_' and `ANSI2KNR' to be `./ansi2knr'.
635 AC_DEFUN(fp_C_PROTOTYPES,
636 [AC_REQUIRE([AM_PROG_CC_STDC])
637 AC_MSG_CHECKING([for function prototypes])
638 if test "$ac_cv_prog_cc_stdc" != no; then
640 AC_DEFINE(PROTOTYPES)
644 U=_ ANSI2KNR=./ansi2knr
647 AC_SUBST(ANSI2KNR)dnl
650 dnl --- *@-AM_PATH_GTK-@* ---
652 dnl Author: Owen Taylor
654 dnl Synopsis: AM_PATH_GTK(MIN-VERSION, [ACTION-IF-FOUND], [ACTION-IF-NOT])
656 dnl Arguments: MIN-VERSION = minimum version of GTK required
657 dnl ACTION-IF-FOUND = executed if GTK found OK
658 dnl ACTION-IF-NOT-FOUND = what to do if GTK not available
660 dnl Use: Sets up compilation environment suitably for GTK programming.
662 # Configure paths for GTK+
663 # Owen Taylor 97-11-3
665 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
666 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
668 AC_DEFUN(AM_PATH_GTK,
670 dnl Get the cflags and libraries from the gtk-config script
672 AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
673 gtk_config_prefix="$withval", gtk_config_prefix="")
674 AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
675 gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
676 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
677 , enable_gtktest=yes)
679 if test x$gtk_config_exec_prefix != x ; then
680 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
681 if test x${GTK_CONFIG+set} != xset ; then
682 GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
685 if test x$gtk_config_prefix != x ; then
686 gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
687 if test x${GTK_CONFIG+set} != xset ; then
688 GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
692 AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
693 min_gtk_version=ifelse([$1], ,0.99.7,$1)
694 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
696 if test "$GTK_CONFIG" = "no" ; then
699 GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
700 GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
701 gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
702 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
703 gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
704 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
705 gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
706 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
707 if test "x$enable_gtktest" = "xyes" ; then
708 ac_save_CFLAGS="$CFLAGS"
710 CFLAGS="$CFLAGS $GTK_CFLAGS"
711 LIBS="$LIBS $GTK_LIBS"
713 dnl Now check if the installed GTK is sufficiently new. (Also sanity
714 dnl checks the results of gtk-config to some extent
724 int major, minor, micro;
727 system ("touch conf.gtktest");
729 /* HP/UX 9 (%@#!) writes to sscanf strings */
730 tmp_version = g_strdup("$min_gtk_version");
731 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
732 printf("%s, bad version string\n", "$min_gtk_version");
736 if ((gtk_major_version != $gtk_config_major_version) ||
737 (gtk_minor_version != $gtk_config_minor_version) ||
738 (gtk_micro_version != $gtk_config_micro_version))
740 printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
741 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
742 gtk_major_version, gtk_minor_version, gtk_micro_version);
743 printf ("*** was found! If gtk-config was correct, then it is best\n");
744 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
745 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
746 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
747 printf("*** required on your system.\n");
748 printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
749 printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
750 printf("*** before re-running configure\n");
754 if ((gtk_major_version > major) ||
755 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
756 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
762 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
763 gtk_major_version, gtk_minor_version, gtk_micro_version);
764 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
765 major, minor, micro);
766 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
768 printf("*** If you have already installed a sufficiently new version, this error\n");
769 printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
770 printf("*** being found. The easiest way to fix this is to remove the old version\n");
771 printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
772 printf("*** correct copy of gtk-config. (In this case, you will have to\n");
773 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
774 printf("*** so that the correct libraries are found at run-time))\n");
779 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
780 CFLAGS="$ac_save_CFLAGS"
784 if test "x$no_gtk" = x ; then
786 ifelse([$2], , :, [$2])
789 if test "$GTK_CONFIG" = "no" ; then
790 echo "*** The gtk-config script installed by GTK could not be found"
791 echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
792 echo "*** your path, or set the GTK_CONFIG environment variable to the"
793 echo "*** full path to gtk-config."
795 if test -f conf.gtktest ; then
798 echo "*** Could not run GTK test program, checking why..."
799 CFLAGS="$CFLAGS $GTK_CFLAGS"
800 LIBS="$LIBS $GTK_LIBS"
804 ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
805 [ echo "*** The test program compiled, but did not run. This usually means"
806 echo "*** that the run-time linker is not finding GTK or finding the wrong"
807 echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
808 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
809 echo "*** to the installed location Also, make sure you have run ldconfig if that"
810 echo "*** is required on your system"
812 echo "*** If you have an old version installed, it is best to remove it, although"
813 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
815 echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
816 echo "*** came with the system with the command"
818 echo "*** rpm --erase --nodeps gtk gtk-devel" ],
819 [ echo "*** The test program failed to compile or link. See the file config.log for the"
820 echo "*** exact error that occured. This usually means GTK was incorrectly installed"
821 echo "*** or that you have moved GTK since it was installed. In the latter case, you"
822 echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
823 CFLAGS="$ac_save_CFLAGS"
829 ifelse([$3], , :, [$3])
836 dnl --- *@-AM_PATH_SDL-@* ---
838 dnl Author: Sam Langinga
840 dnl Synopsis: AM_PATH_SDL([VERSION, [IF-FOUND, [IF-NOT-FOUND]]])
842 dnl Arguments: VERSION = minimum required version
843 dnl IF-FOUND = what to do if found
844 dnl IF-NOT-FOUND = what to do if not found
846 dnl Use: Test for SDL, and define SDL_CFLAGS and SDL_LIBS
848 # Configure paths for SDL
849 # Sam Lantinga 9/21/99
850 # stolen from Manish Singh
851 # stolen back from Frank Belew
852 # stolen from Manish Singh
853 # Shamelessly stolen from Owen Taylor
855 dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
856 dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
858 AC_DEFUN(AM_PATH_SDL,
860 dnl Get the cflags and libraries from the sdl-config script
862 AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
863 sdl_prefix="$withval", sdl_prefix="")
864 AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
865 sdl_exec_prefix="$withval", sdl_exec_prefix="")
866 AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program],
867 , enable_sdltest=yes)
869 if test x$sdl_exec_prefix != x ; then
870 sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix"
871 if test x${SDL_CONFIG+set} != xset ; then
872 SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
875 if test x$sdl_prefix != x ; then
876 sdl_args="$sdl_args --prefix=$sdl_prefix"
877 if test x${SDL_CONFIG+set} != xset ; then
878 SDL_CONFIG=$sdl_prefix/bin/sdl-config
882 AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
883 min_sdl_version=ifelse([$1], ,0.11.0,$1)
884 AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
886 if test "$SDL_CONFIG" = "no" ; then
889 SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags`
890 SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs`
892 sdl_major_version=`$SDL_CONFIG $sdl_args --version | \
893 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
894 sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \
895 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
896 sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
897 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
898 if test "x$enable_sdltest" = "xyes" ; then
899 ac_save_CFLAGS="$CFLAGS"
901 CFLAGS="$CFLAGS $SDL_CFLAGS"
902 LIBS="$LIBS $SDL_LIBS"
904 dnl Now check if the installed SDL is sufficiently new. (Also sanity
905 dnl checks the results of sdl-config to some extent
915 my_strdup (char *str)
921 new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
922 strcpy (new_str, str);
930 int main (int argc, char *argv[])
932 int major, minor, micro;
935 /* This hangs on some systems (?)
936 system ("touch conf.sdltest");
938 { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
940 /* HP/UX 9 (%@#!) writes to sscanf strings */
941 tmp_version = my_strdup("$min_sdl_version");
942 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
943 printf("%s, bad version string\n", "$min_sdl_version");
947 if (($sdl_major_version > major) ||
948 (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
949 (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
955 printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
956 printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
957 printf("*** best to upgrade to the required version.\n");
958 printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
959 printf("*** to point to the correct copy of sdl-config, and remove the file\n");
960 printf("*** config.cache before re-running configure\n");
965 ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
966 CFLAGS="$ac_save_CFLAGS"
970 if test "x$no_sdl" = x ; then
972 ifelse([$2], , :, [$2])
975 if test "$SDL_CONFIG" = "no" ; then
976 echo "*** The sdl-config script installed by SDL could not be found"
977 echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
978 echo "*** your path, or set the SDL_CONFIG environment variable to the"
979 echo "*** full path to sdl-config."
981 if test -f conf.sdltest ; then
984 echo "*** Could not run SDL test program, checking why..."
985 CFLAGS="$CFLAGS $SDL_CFLAGS"
986 LIBS="$LIBS $SDL_LIBS"
991 [ echo "*** The test program compiled, but did not run. This usually means"
992 echo "*** that the run-time linker is not finding SDL or finding the wrong"
993 echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
994 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
995 echo "*** to the installed location Also, make sure you have run ldconfig if that"
996 echo "*** is required on your system"
998 echo "*** If you have an old version installed, it is best to remove it, although"
999 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
1000 [ echo "*** The test program failed to compile or link. See the file config.log for the"
1001 echo "*** exact error that occured. This usually means SDL was incorrectly installed"
1002 echo "*** or that you have moved SDL since it was installed. In the latter case, you"
1003 echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
1004 CFLAGS="$ac_save_CFLAGS"
1005 LIBS="$ac_save_LIBS"
1010 ifelse([$3], , :, [$3])
1012 AC_SUBST(SDL_CFLAGS)
1017 dnl --- *@-AC_TYPE_PTRDIFF_T-@* ---
1019 dnl Author: Ulrich Drepper
1021 dnl Synopsis: AC_TYPE_PTRDIFF_T
1025 dnl Use: Sets HAVE_PTRDIFF_T if the type exists.
1027 AC_DEFUN(AM_TYPE_PTRDIFF_T,
1028 [AC_CACHE_CHECK([for ptrdiff_t], am_cv_type_ptrdiff_t,
1029 [AC_TRY_COMPILE([#include <stddef.h>], [ptrdiff_t p],
1030 am_cv_type_ptrdiff_t=yes, am_cv_type_ptrdiff_t=no)])
1031 if test $am_cv_type_ptrdiff_t = yes; then
1032 AC_DEFINE(HAVE_PTRDIFF_T)
1036 dnl --- *@-AM_WITH_REGEX-@* ---
1038 dnl Author: Unknown (possibly Franc,ois Pinard)
1040 dnl Synopsis: AM_WITH_REGEX
1045 dnl The idea is to distribute rx.[hc] and regex.[hc] together,
1046 dnl for a while. The WITH_REGEX symbol (which should also be
1047 dnl documented in acconfig.h) is used to decide which of regex.h
1048 dnl or rx.h should be included in the application. If
1049 dnl `./configure --with-regex' is given (the default), the
1050 dnl package will use gawk's regex. If `./configure
1051 dnl --without-regex', a check is made to see if rx is already
1052 dnl installed, as with newer Linux'es. If not found, the package
1053 dnl will use the rx from the distribution. If found, the package
1054 dnl will use the system's rx which, on Linux at least, will
1055 dnl result in a smaller executable file.
1057 AC_DEFUN(AM_WITH_REGEX,
1058 [AC_MSG_CHECKING(which of GNU rx or gawk's regex is wanted)
1060 [ --without-regex use GNU rx in lieu of gawk's regex for matching],
1061 [test "$withval" = yes && am_with_regex=1],
1063 if test -n "$am_with_regex"; then
1064 AC_MSG_RESULT(regex)
1065 AC_DEFINE(WITH_REGEX)
1066 AC_CACHE_CHECK([for GNU regex in libc], am_cv_gnu_regex,
1067 AC_TRY_LINK([], [extern int re_max_failures; re_max_failures = 1],
1068 am_cv_gnu_regex=yes, am_cv_gnu_regex=no))
1069 if test $am_cv_gnu_regex = no; then
1070 LIBOBJS="$LIBOBJS regex.o"
1074 AC_CHECK_FUNC(re_rx_search, , [LIBOBJS="$LIBOBJS rx.o"])
1076 AC_SUBST(LIBOBJS)dnl
1079 dnl --- *@-AM_SANITY_CHECK-@*
1083 dnl Synopsis: AM_SANITY_CHECK
1087 dnl Use: Check for build environment sanity.
1089 AC_DEFUN(AM_SANITY_CHECK,
1090 [AC_MSG_CHECKING([whether build environment is sane])
1093 echo timestamp > conftestfile
1094 # Do `set' in a subshell so we don't clobber the current shell's
1095 # arguments. Must try -L first in case configure is actually a
1096 # symlink; some systems play weird games with the mod time of symlinks
1097 # (eg FreeBSD returns the mod time of the symlink's containing
1100 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
1101 if test "$@" = "X"; then
1103 set X `ls -t $srcdir/configure conftestfile`
1105 test "[$]2" = conftestfile
1111 AC_MSG_ERROR([newly created file is older than distributed files!
1112 Check your system clock])
1115 AC_MSG_RESULT(yes)])
1117 dnl --- *@-AM_FUNC_STRDOD-@* ---
1119 dnl Author: Jim Meyering
1121 dnl Synopsis: AM_FUNC_STRTOD
1125 dnl Use: Checks for a working strtod function.
1127 ## Copyright (C) 1996 Free Software Foundation, Inc.
1129 ## This program is free software; you can redistribute it and/or modify
1130 ## it under the terms of the GNU General Public License as published by
1131 ## the Free Software Foundation; either version 2, or (at your option)
1132 ## any later version.
1134 ## This program is distributed in the hope that it will be useful,
1135 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
1136 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1137 ## GNU General Public License for more details.
1139 ## You should have received a copy of the GNU General Public License
1140 ## along with this program; if not, write to the Free Software
1141 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1144 ## From Jim Meyering.
1148 ## @defmac AC_FUNC_STRTOD
1149 ## @maindex FUNC_STRTOD
1151 ## If the @code{strtod} function is not available, or does not work
1152 ## correctly (like the one on SunOS 5.4), add @samp{strtod.o} to output
1153 ## variable @code{LIBOBJS}.
1156 AC_DEFUN(AM_FUNC_STRTOD,
1157 [AC_CACHE_CHECK(for working strtod, am_cv_func_strtod,
1164 /* Some versions of Linux strtod mis-parse strings with leading '+'. */
1165 char *string = " +69";
1168 value = strtod (string, &term);
1169 if (value != 69 || term != (string + 4))
1174 /* Under Solaris 2.4, strtod returns the wrong value for the
1175 terminating character under some conditions. */
1176 char *string = "NaN";
1178 strtod (string, &term);
1179 if (term != string && *(term - 1) == 0)
1184 ], am_cv_func_strtod=yes, am_cv_func_strtod=no, am_cv_func_strtod=no)])
1185 test $am_cv_func_strtod = no && LIBOBJS="$LIBOBJS strtod.o"
1186 AC_SUBST(LIBOBJS)dnl
1187 am_cv_func_strtod_needs_libm=no
1188 if test $am_cv_func_strtod = no; then
1190 if test $ac_cv_func_pow = no; then
1191 AC_CHECK_LIB(m, pow, [am_cv_func_strtod_needs_libm=yes],
1192 [AC_MSG_WARN(can't find library containing definition of pow)])
1197 dnl --- *@-AM_SYS_POSIX_TERMIOS-@* ---
1199 dnl Author: Jim Meyering
1201 dnl Synopsis: AM_SYS_POSIX_TERMIOS
1205 dnl Use: Checks for a POSIX termios.h.
1207 AC_DEFUN(AM_SYS_POSIX_TERMIOS,
1208 [AC_CACHE_CHECK([POSIX termios], am_cv_sys_posix_termios,
1209 [AC_TRY_LINK([#include <sys/types.h>
1211 #include <termios.h>],
1212 [/* SunOS 4.0.3 has termios.h but not the library calls. */
1214 am_cv_sys_posix_termios=yes,
1215 am_cv_sys_posix_termios=no)])
1218 dnl----- Macros by Mark Wooding ------------------------------ *@--IGNORE--@*
1220 dnl --- *@-mdw_REQUIRE-@* ---
1222 dnl Author: Mark Wooding
1224 dnl Synopsis: mdw_REQUIRE(MACRO, ARGS...)
1226 dnl Arguments: MACRO = name of a macro which should have been called
1227 dnl ARGS = arguments to pass
1229 dnl Use: Like `AC_REQUIRE', only it handles arguments.
1231 AC_DEFUN([mdw_REQUIRE],
1232 [ifdef([AC_PROVIDE_$1], ,
1233 [AC_DIVERT_PUSH(builtin(eval, AC_DIVERSION_CURRENT - 1))dnl
1238 dnl --- *@-mdw_CURSES-@* ---
1240 dnl Author: Mark Wooding
1242 dnl Synopsis: mdw_CURSES
1246 dnl Use: Searches for a `curses' library (one of `ncurses' or
1247 dnl `curses') using mdw_CHECK_MANYLIBS. If one is found, the
1248 dnl preprocessor macro HAVE_CURSES is defined, and a search is
1249 dnl made for a `curses' header file (one of <ncurses.h>,
1250 dnl <ncurses/ncurses.h> or <curses.h>) using AC_CHECK_HEADERS
1251 dnl and the appropriate preprocessor symbol is defined.
1252 dnl Finally, a check is made for the function `wresize' using
1255 AC_DEFUN([mdw_CURSES],
1256 [mdw_CHECK_MANYLIBS(newwin, ncurses curses, AC_DEFINE(HAVE_CURSES))
1257 if test $mdw_cv_lib_newwin != no; then
1258 AC_CHECK_HEADERS([ncurses.h ncurses/ncurses.h curses.h], [break])
1259 if test "$ac_cv_header_ncurses_h" = "no" &&
1260 test "$ac_cv_header_ncurses_ncurses_h" = "no" &&
1261 test "$ac_cv_header_curses_h" = "no"; then
1262 AC_MSG_WARN([couldn't find a \`curses' header. Assuming \`curses.h'.])
1263 AC_DEFINE(HAVE_CURSES_H)
1265 AC_CHECK_FUNCS(wresize)
1268 dnl --- *@-mdw_TYPE_SSIZE_T-@* ---
1270 dnl Author: Mark Wooding
1272 dnl Synopsis: mdw_TYPE_SSIZE_T
1276 dnl Use: Checks whether the Posix type `ssize_t' is defined. If not,
1277 dnl it defaults to `int'.
1279 AC_DEFUN([mdw_TYPE_SSIZE_T],
1280 [AC_REQUIRE([AC_HEADER_STDC])
1281 AC_CACHE_CHECK(for ssize_t, mdw_cv_ssize_t,
1282 [AC_EGREP_CPP(ssize_t,
1283 [#include <sys/types.h>
1291 [mdw_cv_ssize_t=yes], [mdw_cv_ssize_t=no])])
1292 if test $mdw_cv_ssize_t = no; then
1293 AC_DEFINE(ssize_t, int)
1296 dnl --- *@-mdw_DECL_ENVIRON-@* ---
1298 dnl Author: Mark Wooding
1300 dnl Synopsis: mdw_DECL_ENVIRON
1304 dnl Use: Searches for a declaration of the global `environ' variable.
1305 dnl If one is found in one of the `usual' places, DECL_ENVIRON
1306 dnl is defined as a preprocessor symbol.
1308 AC_DEFUN([mdw_DECL_ENVIRON],
1309 [AC_CACHE_CHECK([for declaration of \`environ'], mdw_cv_environ,
1310 [AC_EGREP_CPP(environ,
1311 [#include <sys/types.h>
1318 #endif], [mdw_cv_environ=yes], [mdw_cv_environ=no])])
1319 if test $mdw_cv_environ = yes; then
1320 AC_DEFINE(DECL_ENVIRON)
1323 dnl --- *@-mdw_CHECK_MANYLIBS-@* ---
1325 dnl Author: Mark Wooding
1327 dnl Synopsis: mdw_CHECK_MANYLIBS(FUNC, LIBS, [IF-FOUND], [IF-NOT-FOUND],
1328 dnl [INCLUDES], [ARGS])
1330 dnl Arguments: FUNC = a function to try to find
1331 dnl LIBS = a whitespace-separated list of libraries to search
1332 dnl IF-FOUND = what to do when the function is found
1333 dnl IF-NOT-FOUND = what to do when the function isn't found
1334 dnl INCLUDES = other include files to add
1335 dnl ARGS = arguments to pass the function
1337 dnl Use: Searches for a library which defines FUNC. It first tries
1338 dnl without any libraries; then it tries each library specified
1339 dnl in LIBS in turn. If it finds a match, it adds the
1340 dnl appropriate library to `LIBS'.
1342 dnl This is particularly handy under DIREIX: if you link with
1343 dnl `-lnsl' then you get non-NIS-aware versions of getpwnam and
1344 dnl so on, which is clearly a Bad Thing.
1346 AC_DEFUN([mdw_CHECK_MANYLIBS],
1347 [AC_CACHE_CHECK([for library containing $1], [mdw_cv_lib_$1],
1348 [mdw_save_LIBS="$LIBS"
1350 AC_TRY_LINK([$5], [$1($6)], [mdw_cv_lib_$1="none required"])
1351 test "$mdw_cv_lib_$1" = "no" && for i in $2; do
1352 LIBS="-l$i $mdw_save_LIBS"
1353 AC_TRY_LINK([$5], [$1($6)],
1354 [mdw_cv_lib_$1="-l$i"
1357 LIBS="$mdw_save_LIBS"])
1358 if test "$mdw_cv_lib_$1" != "no"; then
1359 test "$mdw_cv_lib_$1" = "none required" || LIBS="$mdw_cv_lib_$1 $LIBS"
1365 dnl --- *@-mdw__PERL_VERSION-@* ---
1367 dnl AC_DEFUN relies on `[', `]' being quotes, so I have to drop down a level.
1370 define([mdw__PERL_VERSION], <<$1 -e 'exit ($] < $2);' >&5 2>&5>>)
1373 dnl --- *@-mdw_PROG_PERL-@* ---
1375 dnl Author: Mark Wooding
1377 dnl Synopsis: mdw_PROG_PERL(VERSION, [IF-FOUND], [IF-NOT-FOUND])
1379 dnl Arguments: VERSION = version number of Perl required
1380 dnl IF-FOUND = what to do if it's found
1381 dnl IF-NOT-FOUND = what to do if it isn't
1383 dnl Use: Attempts to find a working version of Perl with a late
1384 dnl enough version number. It supplies an option `--with-perl'
1385 dnl to allow the user to provide a Perl interpreter. If one
1386 dnl isn't provided explicitly, it searches for `perl' and `perl5'
1387 dnl in the current PATH, asking them whether they have a late
1388 dnl enough version number. The path of the working Perl is
1389 dnl put into the `PERL' environment variable; `AC_SUBST' is used
1390 dnl to substitute its value into Perl scripts. If there is no
1391 dnl Perl to be found, the value of `PERL' is set to be `none'.
1393 AC_DEFUN([mdw_PROG_PERL],
1394 [AC_ARG_WITH([perl],
1395 [ --with-perl=PERL specify path to Perl version $1 or newer],
1397 if test -z "$PERL"; then
1398 [AC_CACHE_CHECK([for Perl version $1 or later], mdw_cv_prog_perl,
1399 [mdw_cv_prog_perl="none"
1400 for p in `echo "$PATH:/usr/local/bin" | tr ":" " "`; do
1401 case $p in /*) ;; *) p=`pwd`/$p ;; esac
1402 if mdw__PERL_VERSION(["$p/perl"], $1); then
1403 mdw_cv_prog_perl="$p/perl"
1406 if mdw__PERL_VERSION(["$p/perl5"], $1); then
1407 mdw_cv_prog_perl="$p/perl5"
1411 PERL="$mdw_cv_prog_perl"])
1415 if test "$PERL" = "none"; then :
1421 dnl --- *@-mdw_CHECK_PERL-@* ---
1423 dnl Author: Mark Wooding
1425 dnl Synopsis: mdw_CHECK_PERL(VERSION)
1427 dnl Arguments: VERSION = version number of Perl required
1429 dnl Use: Verifies that the Perl interpreter in the `PERL' shell
1430 dnl variable actually works and is of the right version. If it's
1431 dnl not, an error is raised and configuration is aborted.
1433 AC_DEFUN([mdw_CHECK_PERL],
1434 [mdw_REQUIRE([mdw_PROG_PERL], [$1])
1435 AC_MSG_CHECKING([whether Perl ($PERL) works])
1436 if test "$PERL" != "none" && mdw__PERL_VERSION("$PERL", $1); then
1437 AC_MSG_RESULT([yes])
1440 AC_MSG_ERROR([Perl version $1 or newer not found.
1441 If you have a recent enough Perl, and I just failed to find it, try using
1442 the --with-perl=PERL option to give me an explicit pathname.])
1445 dnl --- *@-mdw_PERLLIB_CHECK-@* ---
1447 dnl Author: Mark Wooding
1449 dnl Synopsis: mdw_PERLLIB_CHECK(LIBRARY)
1451 dnl Arguments: LIBRARY = name of a Perl library to check for
1453 dnl Use: Ensures that a Perl script can `use LIBRARY;'. If it can,
1454 dnl all's well and good; if it can't, `LIBRARY.pm' is added to
1455 dnl the variable `NEEDED_PERLLIBS' and a line which adds
1456 dnl `pkgdatadir' to Perl's `@INC' array is placed in the
1457 dnl variable `INC_PERLLIBS'; `AC_SUBST' is called for both of
1458 dnl these variables. It's expected that `NEEDED_PERLLIBS' will
1459 dnl be used in the `Makefile.in' to decide which versions from
1460 dnl the distribution need installing.
1462 dnl This macro isn't terribly useful in the general case. It
1463 dnl Also implicitly assumes that `$PERL' is Perl 5 or later.
1465 AC_DEFUN([mdw__PERLLIB_INIT],
1466 [AC_SUBST(INC_PERLLIBS)dnl
1467 AC_SUBST(NEEDED_PERLLIBS)dnl
1470 AC_DEFUN([mdw_PERLLIB_CHECK],
1471 [AC_REQUIRE([mdw__PERLLIB_INIT])
1472 mdw_REQUIRE([mdw_CHECK_PERL], 5)
1473 AC_CACHE_CHECK([for Perl library $1], mdw_cv_perllib_$1,
1474 [if $PERL -e 'use $1;' >&5 2>&5; then
1475 mdw_cv_perllib_$1="yes"
1477 mdw_cv_perllib_$1="no"
1480 if test "$mdw_cv_perllib_$1" = "no"; then
1481 NEEDED_PERLLIBS="$NEEDED_PERLLIBS $1.pm"
1483 # --- Deal with autoconf lossage ---
1485 # It doesn't want to define `prefix' until rather later on, so I have
1488 if test -z "$INC_PERLLIBS"; then
1489 mdw_old_prefix="$prefix"
1490 test "$prefix" = "NONE" && prefix="$ac_default_prefix";
1491 INC_PERLLIBS="BEGIN { push @INC, \"`eval echo $datadir/$PACKAGE`\"; }"
1492 prefix="$mdw_old_prefix";
1496 dnl --- *@-mdw_GCC_FLAGS-@* ---
1498 dnl Author: Mark Wooding
1500 dnl Synopsis: mdw_GCC_FLAGS([FLAGS], [CFLAGS], [C++FLAGS])
1502 dnl Arguments: FLAGS = GCC compiler flags to add (default is
1503 dnl `-pedantic -Wall')
1504 dnl CFLAGS = GCC C compiler flags to add (default is empty)
1505 dnl C++FLAGS = GCC C++ compiler flags to add (default is
1506 dnl `-fhandle-exceptions').
1508 dnl Use: If the C compiler is GCC, add the compiler flags.
1510 AC_DEFUN([mdw_GCC_FLAGS],
1511 [if test "$GCC" = "yes"; then
1512 CFLAGS="$CFLAGS ifelse([$1], [], [-pedantic -Wall], [$1])"
1513 CFLAGS="$CFLAGS ifelse([$2], [], [], [$2])"
1515 if test "$GXX" = "yes"; then
1516 CXXFLAGS="$CXXFLAGS ifelse([$1], [], [-pedantic -Wall], [$1])"
1517 CXXFLAGS="$CXXFLAGS ifelse([$3], [], [-fhandle-exceptions], [$3])"
1520 dnl *@-mdw_INIT_LIB-@*
1522 dnl Author: Mark Wooding
1524 dnl Synopsis: mdw_INIT_LIB(LIB, NAME, VERSION, [PACKAGE])
1526 dnl Arguments: LIB = the name of the library (and the package)
1527 dnl NAME = a presentable version of the library's name
1528 dnl VERSION = version of the library
1529 dnl PACKAGE = package name to pass on to AM_INIT_AUTOMAKE
1531 dnl Use: Sets up various useful variables. This macro calls
1532 dnl AM_INIT_AUTOMAKE, which might be considered useful. It also
1533 dnl provides variables for the use of `lib-config.in'.
1535 AC_DEFUN([mdw_INIT_LIB],
1536 [AM_INIT_AUTOMAKE(ifelse([$4], [], [$1], [$4]), [$3])
1537 LIBRARY="$1" AC_SUBST(LIBRARY)
1538 LIBNAME="$2" AC_SUBST(LIBNAME)])
1540 dnl *@-mdw_LIB_CONFIG-@*
1542 dnl Author: Mark Wooding
1544 dnl Synopsis: mdw_LIB_CONFIG(LIB, NAME, VERSION, IF-FOUND, IF-NOT-FOUND)
1546 dnl Arguments: LIB = the name of the library (and its configuration program)
1547 dnl NAME = a presentable version of the library's name
1548 dnl VERSION = version of library required
1549 dnl IF-FOUND = what to do if found
1550 dnl IF-NOT-FOUND = what to do if not found
1552 dnl Use: Configures a library client program, using a configuration
1553 dnl script provided by the library maintainer.
1555 dnl The default version is 1.0.0pre0; the default action is to
1556 dnl add everything to the CFLAGS and LIBS variables, and complain
1557 dnl if the library couldn't be found.
1559 dnl The variable LIB_VERSION contains the version number of
1560 dnl the library; LIB_CFLAGS is the C compiler flags required
1561 dnl and LIB_LIBS is the linker flags.
1563 AC_DEFUN([mdw_LIB_CONFIG],
1564 [pushdef([upname], translit([$1], [a-z], [A-Z]))dnl
1565 AC_MSG_CHECKING([for $2 library])
1566 if $1-config --check $3 >/dev/null 2>&1; then
1567 upname[]_VERSION=`$1-config --version`
1568 upname[]_CFLAGS=`$1-config --cflags`
1569 upname[]_LIBS=`$1-config --libs`
1570 AC_SUBST(upname[]_VERSION)
1571 AC_SUBST(upname[]_CFLAGS)
1572 AC_SUBST(upname[]_LIBS)
1574 [CFLAGS="$CFLAGS $upname[]_CFLAGS"
1575 LIBS="$upname[]_LIBS $LIBS"],
1577 AC_MSG_RESULT([$upname[]_VERSION])
1580 AC_MSG_ERROR([$2 library not found or too old.]),
1582 AC_MSG_RESULT([not found])
1588 dnl Author: Mark Wooding
1590 dnl Synopsis: mdw_MLIB(VERSION, IF-FOUND, IF-NOT-FOUND
1592 dnl Arguments: VERSION = version of library required
1593 dnl IF-FOUND = what to do if found
1594 dnl IF-NOT-FOUND = what to do if not found
1596 dnl Use: Configures an mLib client program.
1598 AC_DEFUN([mdw_MLIB], [mdw_LIB_CONFIG(mLib, mLib, $@)])
1602 dnl Author: Mark Wooding
1604 dnl Synopsis: mdw_MGLIB(VERSION, IF-FOUND, IF-NOT-FOUND
1606 dnl Arguments: VERSION = version of library required
1607 dnl IF-FOUND = what to do if found
1608 dnl IF-NOT-FOUND = what to do if not found
1610 dnl Use: Configures an mgLib client program.
1612 AC_DEFUN([mdw_MGLIB],
1613 [mdw_REQUIRE([mdw_MLIB], [1.6.0])
1614 mdw_LIB_CONFIG(mgLib, mgLib, $@)])
1616 dnl *@-mdw_CATACOMB-@*
1618 dnl Author: Mark Wooding
1620 dnl Synopsis: mdw_CATACOMB([VERSION], [IF-FOUND], [IF-NOT-FOUND])
1622 dnl Arguments: VERSION = version of Catacomb required
1623 dnl IF-FOUND = what to do if found
1624 dnl IF-NOT-FOUND = what to do if not found
1626 dnl Use: Configures the program as a Catacomb client.
1628 AC_DEFUN([mdw_CATACOMB],
1629 [mdw_REQUIRE([mdw_MLIB], [1.6.0])
1630 mdw_LIB_CONFIG(catacomb, Catacomb, $@)])
1634 dnl Author: Mark Wooding
1636 dnl Synopsis: mdw_PK([VERSION], [IF-FOUND], [IF-NOT-FOUND])
1638 dnl Arguments: VERSION = version of PK required
1639 dnl IF-FOUND = what to do if found
1640 dnl IF-NOT-FOUND = what to do if not found
1642 dnl Use: Configures the program as a PK client.
1645 [mdw_REQUIRE([mdw_MLIB], [1.6.0])
1646 mdw_LIB_CONFIG(pk, PK, $@)])
1648 dnl --- *@-mdw_OPT_NDEBUG-@* ---
1650 dnl Author: Mark Wooding
1652 dnl Synopsis: mdw_OPT_NDEBUG
1656 dnl Use: Turns on the `NDEBUG' flag, to disable useful things like
1659 AC_DEFUN([mdw_OPT_NDEBUG],
1660 [AC_ARG_ENABLE(debugging,
1661 [ --disable-debugging spews vast swathes of useless information],
1662 [if test "$enableval" = "no"; then
1663 AC_DEFINE(NDEBUG, 1)
1666 dnl --- *@-mdw_OPT_EFENCE-@* ---
1668 dnl Author: Mark Wooding
1670 dnl Synopsis: mdw_OPT_EFENCE
1674 dnl Use: Links with the Electric Fence library.
1676 AC_DEFUN([mdw_OPT_EFENCE],
1677 [AC_ARG_WITH(electric-fence,
1678 [ --with-electric-fence link programs with Electric Fence],
1679 [if test "$withval" = "yes"; then
1680 AC_CHECK_LIB(efence, malloc)
1683 dnl --- *@-mdw_OPT_TRACE-@* ---
1685 dnl Author: Mark Wooding
1687 dnl Synopsis: mdw_OPT_TRACE
1691 dnl Use: Turns on the `NTRACE' flag, to disable useful things like
1694 AC_DEFUN([mdw_OPT_TRACE],
1695 [AC_ARG_ENABLE(tracing,
1696 [ --disable-tracing disable output of trace information],
1697 [if test "$enableval" = "no"; then
1698 AC_DEFINE(NTRACE, 1)
1701 dnl --- *@-mdw_OPT_mLib_TRACK-@* ---
1703 dnl Author: Mark Wooding
1705 dnl Synopsis: mdw_OPT_mLib_TRACK(PROGRAM)
1707 dnl Arguments: PROGRAM = name of this program or package.
1709 dnl Use: Controls the unsupported mLib memory tracker. The
1710 dnl following are defined:
1712 dnl --enable-track turns on malloc tracking
1713 dnl --enable-blame-PROGRAM tracks malloc contexts in PROGRAM
1715 dnl There must be a separate `blame' option for each program,
1716 dnl so that the various blame options in a hierarchy get
1717 dnl propagated properly. This is an obsolete feature from the
1718 dnl days when mLib was provided as a subdirectory of other
1721 AC_DEFUN([mdw_OPT_mLib_TRACK],
1722 [AC_REQUIRE([mdw_OPT_TRACE])
1723 AC_ARG_ENABLE(track,
1724 [ --enable-track enable tracking of malloc and free],
1725 [AC_DEFINE(TRACK_ENABLE, 1)])
1726 AC_ARG_ENABLE(blame-$1,
1728 track malloc contexts while in $1],
1729 [AC_DEFINE(TRACK_BLAME, 1)])])
1731 dnl --- *@-mdw_OPT_mLib_DEBUG-@* ---
1733 dnl Author: Mark Wooding
1735 dnl Synopsis: mdw_OPT_mLib_DEBUG(PROGRAM)
1737 dnl Arguments: PROGRAM = name of this program or package.
1739 dnl Use: Provides all of the above debugging options.
1741 AC_DEFUN([mdw_OPT_mLib_DEBUG],
1742 [mdw_REQUIRE([mdw_OPT_NDEBUG])
1743 mdw_REQUIRE([mdw_OPT_mLib_TRACK], [$1])])
1745 dnl --- *@-mdw_DEFINE_PATHS-@*
1747 dnl Author: Mark Wooding
1749 dnl Synopsys: mdw_DEFINE_FILES(CODE)
1751 dnl Arguments: CODE = shell script code to execute
1753 dnl Use: Fixes up various variables so that pathname defines can be
1754 dnl defined. Within CODE, you may use the following macros:
1756 dnl mdw_PROG(NAME) Transformed program name
1758 dnl mdw_PATH(PATH) Expanded path (may contain variables)
1760 dnl mdw_DEFINE_PROG(SYMBOL, PROG)
1761 dnl Define a symbol as a transformed
1764 dnl mdw_DEFINE_PATH(SYMBOL, NAME)
1765 dnl Define a symbol as an expanded path
1767 AC_DEFUN([mdw_DEFINE_PATHS],
1768 [mdw_prefix=$prefix mdw_exec_prefix=$exec_prefix
1769 mdw_transform=`echo "$program_transform_name"|sed 's,\\\\\\\\,\\\\,g; s,\\$\\$,$,g'`
1770 test "$prefix" = "NONE" && prefix=$ac_default_prefix
1771 test "$exec_prefix" = "NONE" && exec_prefix=$prefix
1773 prefix=$mdw_prefix exec_prefix=$mdw_exec_prefix])
1775 AC_DEFUN([mdw_PROG], [`echo "$1"|sed "$mdw_transform"`])
1776 AC_DEFUN([mdw_PATH], [dnl
1780 *\\$[]*) t=\`eval echo "$t"\`;; dnl
1784 AC_DEFUN([mdw_DEFINE_PROG], [AC_DEFINE_UNQUOTED([$1], ["mdw_PROG([$2])"])])
1785 AC_DEFUN([mdw_DEFINE_PATH], [AC_DEFINE_UNQUOTED([$1], ["mdw_PATH([$2])"])])
1787 dnl----- That's all, folks --------------------------------- *@--GLOB-END--@*