1 dnl -*-fundamental-*- *@--GLOB-HEADER--@*
3 dnl $Id: aclocal.glob,v 1.10 2000/10/14 16:32: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.10 2000/10/14 16:32:15 mdw
32 dnl Fixes from upstream.
34 dnl Revision 1.9 2000/08/15 21:37:49 mdw
35 dnl New initialization macro for libraries, and a new base client macro for
36 dnl finding libraries with an appropriate version.
38 dnl Revision 1.8 1999/11/26 01:23:17 mdw
39 dnl And support for MXD (not yet released).
41 dnl Revision 1.7 1999/11/11 20:03:58 mdw
42 dnl Add support for mgLib too.
44 dnl Revision 1.6 1999/11/11 17:49:33 mdw
45 dnl New macros for configuring clients of mLib and Catacomb.
47 dnl Revision 1.5 1999/07/27 18:27:37 mdw
48 dnl Fix typo in header line for mdw_DECL_ENVIRON.
50 dnl Revision 1.4 1999/07/26 23:44:32 mdw
51 dnl Reorder and tidy documentation.
53 dnl Revision 1.3 1999/07/17 10:27:44 mdw
54 dnl More useful macros added.
56 dnl Revision 1.2 1999/05/13 22:57:23 mdw
57 dnl Change `-ise' to `-ize' throughout.
59 dnl Revision 1.1.1.1 1999/05/05 19:23:47 mdw
60 dnl New import. The old CVS repository was lost in a disk disaster.
63 dnl----- Common files distribution --------------------------- *@--NOTICE--@*
65 dnl $Id: aclocal.glob,v 1.10 2000/10/14 16:32:15 mdw Exp $
67 dnl --- *@-AC_PROG_CC_STDC-@* ---
69 dnl Author: Franc,ois Pinard
71 dnl Synopsis: AC_PROG_CC_STDC
75 dnl Use: If the C compiler in not in ANSI C mode by default, try to
76 dnl add an option to output variable `CC' to make it so. This
77 dnl macro tries various options that select ANSI C on some system
78 dnl or another. It considers the compiler to be in ANSI C mode
79 dnl if it defines `__STDC__' to 1 and handles function prototypes
82 dnl If you use this macro, you should check after calling it
83 dnl whether the C compiler has been set to accept ANSI C; if not,
84 dnl the shell variable `ac_cv_prog_cc_stdc' is set to `no'. If
85 dnl you wrote your source code in ANSI C, you can make an
86 dnl un-ANSIfied copy of it by using the program `ansi2knr', which
87 dnl comes with Ghostscript.
89 dnl (documentation by Franc,ois Pinard)
91 AC_DEFUN(AM_PROG_CC_STDC,
92 [AC_REQUIRE([AC_PROG_CC])
93 AC_BEFORE([$0], [AC_C_INLINE])
94 AC_BEFORE([$0], [AC_C_CONST])
95 AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
96 AC_CACHE_VAL(am_cv_prog_cc_stdc,
97 [am_cv_prog_cc_stdc=no
99 # Don't try gcc -ansi; that turns off useful extensions and
100 # breaks some systems' header files.
102 # Ultrix and OSF/1 -std1
103 # HP-UX -Aa -D_HPUX_SOURCE
104 # SVR4 -Xc -D__EXTENSIONS__
105 for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
107 CC="$ac_save_CC $ac_arg"
109 [#if !defined(__STDC__) || __STDC__ != 1
112 /* DYNIX/ptx V4.1.3 can't compile sys/stat.h with -Xc -D__EXTENSIONS__. */
114 # include <sys/types.h>
115 # include <sys/stat.h>
118 int test (int i, double x);
119 struct s1 {int (*f) (int a);};
120 struct s2 {int (*f) (double a);};],
121 [am_cv_prog_cc_stdc="$ac_arg"; break])
125 if test -z "$am_cv_prog_cc_stdc"; then
126 AC_MSG_RESULT([none needed])
128 AC_MSG_RESULT($am_cv_prog_cc_stdc)
130 case "x$am_cv_prog_cc_stdc" in
132 *) CC="$CC $am_cv_prog_cc_stdc" ;;
136 dnl----- AutoMake macros ------------------------------------- *@--IGNORE--@*
138 dnl --- *@-AM_CONDITIONAL-@* ---
142 dnl Synopsis: AM_CONDITIONAL(NAME, TEST)
144 dnl Arguments: NAME = name of the conditional
145 dnl TEST = a shell list to execute
147 dnl Use: Allows conditional sections in Makefiles.
149 AC_DEFUN(AM_CONDITIONAL,
160 dnl --- *@-AM_CYGWIN32-@* ---
162 dnl Author: Cygnus (I guess)
164 dnl Synopsis: AM_CYGWIN32
168 dnl Use: Check to see if we're running under Cygwin32, without using
169 dnl AC_CANONICAL_*. If so, set output variable EXEEXT to
170 dnl ".exe". Otherwise set it to "".
173 dnl You might think we can do this by checking for a cygwin32-specific
174 dnl cpp define. We can't, because cross-compilers that target
175 dnl cygwin32 don't use the .exe suffix. I don't know why.
176 AC_DEFUN(AM_CYGWIN32,
177 [AC_CACHE_CHECK(for Cygwin32 environment, am_cv_cygwin32,
178 [cat > conftest.$ac_ext << 'EOF'
183 if AC_TRY_EVAL(ac_link) && test -s conftest.exe; then
190 test "$am_cv_cygwin32" = yes && EXEEXT=.exe
193 dnl --- *@-AM_WITH_DMALLOC-@* ---
195 dnl Author: Franc,ois Pinard
197 dnl Synopsis: AM_WITH_DMALLOC
201 dnl Use: Links with `-dmalloc' if told to by the user.
203 ## ----------------------------------- ##
204 ## Check if --with-dmalloc was given. ##
205 ## From Franc,ois Pinard ##
206 ## ----------------------------------- ##
210 AC_DEFUN(AM_WITH_DMALLOC,
211 [AC_MSG_CHECKING(if malloc debugging is wanted)
213 [ --with-dmalloc use dmalloc, as in
214 ftp://ftp.letters.com/src/dmalloc/dmalloc.tar.gz],
215 [if test "$withval" = yes; then
217 AC_DEFINE(WITH_DMALLOC)
218 LIBS="$LIBS -ldmalloc"
219 LDFLAGS="$LDFLAGS -g"
222 fi], [AC_MSG_RESULT(no)])
225 dnl --- *@-AM_FUNC_ERROR_AT_LINE-@* ---
227 dnl Author: Jim Meyering
229 dnl Synopsis: AM_FUNC_ERROR_AT_LINE
233 dnl Use: Use this if you use the GNU error.[ch].
235 dnl FIXME: Migrate into libit
237 AC_DEFUN(AM_FUNC_ERROR_AT_LINE,
238 [AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line,
239 [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");],
240 am_cv_lib_error_at_line=yes,
241 am_cv_lib_error_at_line=no)])
242 if test $am_cv_lib_error_at_line = no; then
243 LIBOBJS="$LIBOBJS error.o"
248 dnl --- *@-AM_INIT_GUILE_MODULE-@* ---
252 dnl Synopsis: AM_INIT_GUILE_MODULE(MODNAME)
254 dnl Arguments: MODNAME = value to initialize `module' variable with
256 dnl Use: This macro will automatically get the guile version from the
257 dnl top-level srcdir, and will initialize automake. It also
258 dnl defines the `module' variable.
260 AC_DEFUN([AM_INIT_GUILE_MODULE],[
261 . $srcdir/../GUILE-VERSION
262 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
263 AC_CONFIG_AUX_DIR(..)
267 dnl --- *@-AM_CONFIG_HEADER-@* ---
271 dnl Synopsis: AM_CONFIG_HEADER(HEADER ...)
273 dnl Arguments: HEADER = a header spec, as for AC_CONFIG_HEADER
275 dnl Use: Like AC_CONFIG_HEADER, but automatically create stamp file.
277 AC_DEFUN(AM_CONFIG_HEADER,
279 AC_CONFIG_HEADER([$1])
280 dnl When config.status generates a header, we must update the stamp-h file.
281 dnl This file resides in the same directory as the config header
282 dnl that is generated. We must strip everything past the first ":",
283 dnl and everything past the last "/".
284 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
285 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
286 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/
287 \)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
289 for am_file in <<$1>>; do
290 case " <<$>>CONFIG_HEADERS " in
291 *" <<$>>am_file "*<<)>>
292 echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
295 am_indx=`expr "<<$>>am_indx" + 1`
299 dnl --- *@-AM_INIT_AUTOMAKE-@*
303 dnl Synopsis: AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
305 dnl Arguments: PACKAGE = package name
306 dnl VERSION = version number
307 dnl NO-DEFINE = if set, don't define package and version number
309 dnl Use: Do all the work for Automake. This macro actually does too
310 dnl much -- some checks are only needed if your package does
311 dnl certain things. But this isn't really a big deal.
315 AC_DEFUN(AM_INIT_AUTOMAKE,
316 [AC_REQUIRE([AC_PROG_INSTALL])
321 dnl test to see if srcdir already configured
322 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
323 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
326 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
327 AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
328 AC_REQUIRE([AM_SANITY_CHECK])
329 AC_REQUIRE([AC_ARG_PROGRAM])
330 dnl FIXME This is truly gross.
331 missing_dir=`cd $ac_aux_dir && pwd`
332 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
333 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
334 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
335 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
336 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
337 AC_REQUIRE([AC_PROG_MAKE_SET])])
339 dnl --- *@-AM_PROG_INSTALL-@* ---
341 dnl Author: Franc,ois Pinard
343 dnl Synopsis: AM_PROG_INSTALL
347 dnl Use: Calls `AC_PROG_INSTALL' to find an installer. Then it sets
348 dnl `INSTALL_SCRIPT' to a suitable value if necessary.
352 AC_DEFUN(AM_PROG_INSTALL,
354 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL} -m 755'
355 AC_SUBST(INSTALL_SCRIPT)dnl
358 dnl --- *@-AM_PROG_LEX-@* ---
360 dnl Author: Alexandre Oliva
362 dnl Synopsis: AM_PROG_LEX
366 dnl Use: Replacement for AC_PROG_LEX and AC_DECL_YYTEXT
369 dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT
370 AC_DEFUN(AM_PROG_LEX,
371 [missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1)
372 AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex")
376 dnl --- *@-AM_PROG_LIBTOOL-@* ---
380 dnl Synopsis: AM_PROG_LIBTOOL
384 dnl Use: Configures `libtool' for the target architecture.
387 ## Configure libtool for the target system.
389 # serial 1 AM_PROG_LIBTOOL
390 AC_DEFUN(AM_PROG_LIBTOOL,
391 [AC_REQUIRE([AC_CANONICAL_HOST])
392 AC_REQUIRE([AC_PROG_CC])
393 AC_REQUIRE([AC_PROG_RANLIB])
395 # Always use our own libtool.
396 LIBTOOL='$(top_builddir)/libtool'
399 dnl Allow the --disable-shared flag to stop us from building shared libs.
400 AC_ARG_ENABLE(shared,
401 [ --enable-shared build shared libraries [default=yes]],
402 test "$enableval" = no && libtool_shared=" --disable-shared",
405 libtool_flags="$libtool_shared"
406 test "$silent" = yes && libtool_flags="$libtool_flags --silent"
407 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
409 # Actually configure libtool. ac_aux_dir is where install-sh is found.
410 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" LD="$LD" RANLIB="$RANLIB" \
411 $ac_aux_dir/ltconfig $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
412 || AC_MSG_ERROR([libtool configure failed])
415 dnl --- *@-AM_PATH_LISPDIR-@* ---
417 dnl Author: Ulrich Drepper
419 dnl Synopsis: AM_PATH_LISPDIR
423 dnl Use: Sets the variable `lispdir' to point to a place to install
424 dnl Emacs lisp files.
426 ## ------------------------
427 ## Emacs LISP file handling
428 ## From Ulrich Drepper
429 ## ------------------------
433 AC_DEFUN(AM_PATH_LISPDIR,
434 [# If set to t, that means we are running in a shell under Emacs.
435 # If you have an Emacs named "t", then use the full path.
436 test "$EMACS" = t && EMACS=
437 AC_PATH_PROG(EMACS, emacs xemacs, no)
438 if test $EMACS != "no"; then
439 AC_MSG_CHECKING([where .elc files should go])
440 dnl Set default value
441 lispdir="\$(datadir)/emacs/site-lisp"
442 if test "x$prefix" = "xNONE"; then
443 if test -d $ac_default_prefix/share/emacs/site-lisp; then
444 lispdir="\$(prefix)/share/emacs/site-lisp"
446 if test -d $ac_default_prefix/lib/emacs/site-lisp; then
447 lispdir="\$(prefix)/lib/emacs/site-lisp"
451 if test -d $prefix/share/emacs/site-lisp; then
452 lispdir="\$(prefix)/share/emacs/site-lisp"
454 if test -d $prefix/lib/emacs/site-lisp; then
455 lispdir="\$(prefix)/lib/emacs/site-lisp"
459 AC_MSG_RESULT($lispdir)
463 dnl --- *@-AM_MAINTAINTER_MODE-@* ---
465 dnl Author: Jim Meyering
467 dnl Synopsis: jm_MAINTAINER_MODE
471 dnl Use: Provides an option `--enable-maintainer-mode' which turns
472 dnl on rules which might normally be commented out. The
473 dnl substitution variable `MAINT' is set to be a comment when
474 dnl this option is disabled, which it is by default.
478 AC_DEFUN(AM_MAINTAINER_MODE,
479 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
480 dnl maintainer-mode is disabled by default
481 AC_ARG_ENABLE(maintainer-mode,
482 [ --enable-maintainer-mode enable make rules and dependencies not useful
483 (and sometimes confusing) to the casual installer],
484 USE_MAINTAINER_MODE=$enableval,
485 USE_MAINTAINER_MODE=no)
486 AC_MSG_RESULT($USE_MAINTAINER_MODE)
487 if test $USE_MAINTAINER_MODE = yes; then
496 dnl --- *@-AM_MISSING_PROG-@* ---
500 dnl Synopsis: AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
502 dnl Arguments: NAME = variable to set to the file's location
503 dnl PROGRAM = name of program to find
504 dnl DIRECTORY = directory to look in
506 dnl Use: Fakes existence of a useful GNU maintainer tool.
508 AC_DEFUN(AM_MISSING_PROG,
509 [AC_MSG_CHECKING(for working $2)
510 # Run test in a subshell; some versions of sh will print an error if
511 # an executable is not found, even if stderr is redirected.
512 # Redirect stdin to placate older versions of autoconf. Sigh.
513 if ($2 --version) < /dev/null > /dev/null 2>&1; then
518 AC_MSG_RESULT(missing)
522 dnl --- *@-AM_FUNC_MKTIME-@* ---
524 dnl Author: Jim Meyering
526 dnl Synopsis: AM_FUNC_MKTIME
530 dnl Use: Checks for a working mktime function.
532 AC_DEFUN(AM_FUNC_MKTIME,
533 [AC_REQUIRE([AC_HEADER_TIME])dnl
534 AC_CHECK_HEADERS(sys/time.h)
535 AC_CACHE_CHECK([for working mktime], am_cv_func_working_mktime,
537 changequote(<<, >>)dnl
538 <</* Test program from Paul Eggert (eggert@twinsun.com)
539 and Tony Leneis (tony@plaza.ds.adp.com). */
540 #if TIME_WITH_SYS_TIME
541 # include <sys/time.h>
545 # include <sys/time.h>
551 static time_t time_t_max;
553 /* Values we'll use to set the TZ environment variable. */
554 static const char *const tz_strings[] = {
555 NULL, "GMT0", "JST-9", "EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00"
557 #define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0]))
563 if (mktime (localtime (&now)) != now)
565 now = time_t_max - now;
566 if (mktime (localtime (&now)) != now)
576 for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2)
579 delta = time_t_max / 997; /* a suitable prime number */
580 for (i = 0; i < N_STRINGS; i++)
583 putenv (tz_strings[i]);
585 for (t = 0; t <= time_t_max - delta; t += delta)
587 mktime_test ((time_t) 60 * 60);
588 mktime_test ((time_t) 60 * 60 * 24);
594 am_cv_func_working_mktime=yes, am_cv_func_working_mktime=no,
595 dnl When crosscompiling, assume mktime is missing or broken.
596 am_cv_func_working_mktime=no)
598 if test $am_cv_func_working_mktime = no; then
599 LIBOBJS="$LIBOBJS mktime.o"
603 dnl --- *@-AM_FUNC_OBSTACK-@* ---
605 dnl Author: Jim Meyering
607 dnl Synopsis: AM_FUNC_OBSTACK
611 dnl Use: Checks for GNU obstacks.
613 AC_DEFUN(AM_FUNC_OBSTACK,
614 [AC_CACHE_CHECK([for obstacks], am_cv_func_obstack,
615 [AC_TRY_LINK([#include "obstack.h"],
616 [struct obstack *mem;obstack_free(mem,(char *) 0)],
617 am_cv_func_obstack=yes,
618 am_cv_func_obstack=no)])
619 if test $am_cv_func_obstack = yes; then
620 AC_DEFINE(HAVE_OBSTACK)
622 LIBOBJS="$LIBOBJS obstack.o"
626 dnl --- *@-AC_C_PROTOTYPES-@* ---
628 dnl Author: Franc,ois Pinard
630 dnl Synopsis: AC_C_PROTOTYPES
634 dnl Use: If the C compiler understands ANSI C, define `PROTOTYPES',
635 dnl and clear the `U' and `ANSI2KNR' variables. Otherwise,
636 dnl set `U' to be `_' and `ANSI2KNR' to be `./ansi2knr'.
640 AC_DEFUN(fp_C_PROTOTYPES,
641 [AC_REQUIRE([fp_PROG_CC_STDC])
642 AC_MSG_CHECKING([for function prototypes])
643 if test "$ac_cv_prog_cc_stdc" != no; then
645 AC_DEFINE(PROTOTYPES)
649 U=_ ANSI2KNR=./ansi2knr
652 AC_SUBST(ANSI2KNR)dnl
655 dnl --- *@-AM_PATH_GTK-@* ---
657 dnl Author: Owen Taylor
659 dnl Synopsis: AM_PATH_GTK(MIN-VERSION, [ACTION-IF-FOUND], [ACTION-IF-NOT])
661 dnl Arguments: MIN-VERSION = minimum version of GTK required
662 dnl ACTION-IF-FOUND = executed if GTK found OK
663 dnl ACTION-IF-NOT-FOUND = what to do if GTK not available
665 dnl Use: Sets up compilation environment suitably for GTK programming.
667 # Configure paths for GTK+
668 # Owen Taylor 97-11-3
670 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
671 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
673 AC_DEFUN(AM_PATH_GTK,
675 dnl Get the cflags and libraries from the gtk-config script
677 AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
678 gtk_config_prefix="$withval", gtk_config_prefix="")
679 AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
680 gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
681 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
682 , enable_gtktest=yes)
684 if test x$gtk_config_exec_prefix != x ; then
685 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
686 if test x${GTK_CONFIG+set} != xset ; then
687 GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
690 if test x$gtk_config_prefix != x ; then
691 gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
692 if test x${GTK_CONFIG+set} != xset ; then
693 GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
697 AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
698 min_gtk_version=ifelse([$1], ,0.99.7,$1)
699 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
701 if test "$GTK_CONFIG" = "no" ; then
704 GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
705 GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
706 gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
707 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
708 gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
709 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
710 gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
711 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
712 if test "x$enable_gtktest" = "xyes" ; then
713 ac_save_CFLAGS="$CFLAGS"
715 CFLAGS="$CFLAGS $GTK_CFLAGS"
716 LIBS="$LIBS $GTK_LIBS"
718 dnl Now check if the installed GTK is sufficiently new. (Also sanity
719 dnl checks the results of gtk-config to some extent
729 int major, minor, micro;
732 system ("touch conf.gtktest");
734 /* HP/UX 9 (%@#!) writes to sscanf strings */
735 tmp_version = g_strdup("$min_gtk_version");
736 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
737 printf("%s, bad version string\n", "$min_gtk_version");
741 if ((gtk_major_version != $gtk_config_major_version) ||
742 (gtk_minor_version != $gtk_config_minor_version) ||
743 (gtk_micro_version != $gtk_config_micro_version))
745 printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
746 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
747 gtk_major_version, gtk_minor_version, gtk_micro_version);
748 printf ("*** was found! If gtk-config was correct, then it is best\n");
749 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
750 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
751 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
752 printf("*** required on your system.\n");
753 printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
754 printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
755 printf("*** before re-running configure\n");
759 if ((gtk_major_version > major) ||
760 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
761 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
767 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
768 gtk_major_version, gtk_minor_version, gtk_micro_version);
769 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
770 major, minor, micro);
771 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
773 printf("*** If you have already installed a sufficiently new version, this error\n");
774 printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
775 printf("*** being found. The easiest way to fix this is to remove the old version\n");
776 printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
777 printf("*** correct copy of gtk-config. (In this case, you will have to\n");
778 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
779 printf("*** so that the correct libraries are found at run-time))\n");
784 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
785 CFLAGS="$ac_save_CFLAGS"
789 if test "x$no_gtk" = x ; then
791 ifelse([$2], , :, [$2])
794 if test "$GTK_CONFIG" = "no" ; then
795 echo "*** The gtk-config script installed by GTK could not be found"
796 echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
797 echo "*** your path, or set the GTK_CONFIG environment variable to the"
798 echo "*** full path to gtk-config."
800 if test -f conf.gtktest ; then
803 echo "*** Could not run GTK test program, checking why..."
804 CFLAGS="$CFLAGS $GTK_CFLAGS"
805 LIBS="$LIBS $GTK_LIBS"
809 ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
810 [ echo "*** The test program compiled, but did not run. This usually means"
811 echo "*** that the run-time linker is not finding GTK or finding the wrong"
812 echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
813 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
814 echo "*** to the installed location Also, make sure you have run ldconfig if that"
815 echo "*** is required on your system"
817 echo "*** If you have an old version installed, it is best to remove it, although"
818 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
820 echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
821 echo "*** came with the system with the command"
823 echo "*** rpm --erase --nodeps gtk gtk-devel" ],
824 [ echo "*** The test program failed to compile or link. See the file config.log for the"
825 echo "*** exact error that occured. This usually means GTK was incorrectly installed"
826 echo "*** or that you have moved GTK since it was installed. In the latter case, you"
827 echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
828 CFLAGS="$ac_save_CFLAGS"
834 ifelse([$3], , :, [$3])
841 dnl --- *@-AC_TYPE_PTRDIFF_T-@* ---
843 dnl Author: Ulrich Drepper
845 dnl Synopsis: AC_TYPE_PTRDIFF_T
849 dnl Use: Sets HAVE_PTRDIFF_T if the type exists.
851 AC_DEFUN(AM_TYPE_PTRDIFF_T,
852 [AC_CACHE_CHECK([for ptrdiff_t], am_cv_type_ptrdiff_t,
853 [AC_TRY_COMPILE([#include <stddef.h>], [ptrdiff_t p],
854 am_cv_type_ptrdiff_t=yes, am_cv_type_ptrdiff_t=no)])
855 if test $am_cv_type_ptrdiff_t = yes; then
856 AC_DEFINE(HAVE_PTRDIFF_T)
860 dnl --- *@-AM_WITH_REGEX-@* ---
862 dnl Author: Unknown (possibly Franc,ois Pinard)
864 dnl Synopsis: AM_WITH_REGEX
869 dnl The idea is to distribute rx.[hc] and regex.[hc] together,
870 dnl for a while. The WITH_REGEX symbol (which should also be
871 dnl documented in acconfig.h) is used to decide which of regex.h
872 dnl or rx.h should be included in the application. If
873 dnl `./configure --with-regex' is given (the default), the
874 dnl package will use gawk's regex. If `./configure
875 dnl --without-regex', a check is made to see if rx is already
876 dnl installed, as with newer Linux'es. If not found, the package
877 dnl will use the rx from the distribution. If found, the package
878 dnl will use the system's rx which, on Linux at least, will
879 dnl result in a smaller executable file.
881 AC_DEFUN(AM_WITH_REGEX,
882 [AC_MSG_CHECKING(which of GNU rx or gawk's regex is wanted)
884 [ --without-regex use GNU rx in lieu of gawk's regex for matching],
885 [test "$withval" = yes && am_with_regex=1],
887 if test -n "$am_with_regex"; then
889 AC_DEFINE(WITH_REGEX)
890 AC_CACHE_CHECK([for GNU regex in libc], am_cv_gnu_regex,
891 AC_TRY_LINK([], [extern int re_max_failures; re_max_failures = 1],
892 am_cv_gnu_regex=yes, am_cv_gnu_regex=no))
893 if test $am_cv_gnu_regex = no; then
894 LIBOBJS="$LIBOBJS regex.o"
898 AC_CHECK_FUNC(re_rx_search, , [LIBOBJS="$LIBOBJS rx.o"])
903 dnl --- *@-AM_SANITY_CHECK-@*
907 dnl Synopsis: AM_SANITY_CHECK
911 dnl Use: Check for build environment sanity.
913 AC_DEFUN(AM_SANITY_CHECK,
914 [AC_MSG_CHECKING([whether build environment is sane])
917 echo timestamp > conftestfile
918 # Do `set' in a subshell so we don't clobber the current shell's
919 # arguments. Must try -L first in case configure is actually a
920 # symlink; some systems play weird games with the mod time of symlinks
921 # (eg FreeBSD returns the mod time of the symlink's containing
924 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
925 if test "$@" = "X"; then
927 set X `ls -t $srcdir/configure conftestfile`
929 test "[$]2" = conftestfile
935 AC_MSG_ERROR([newly created file is older than distributed files!
936 Check your system clock])
941 dnl --- *@-AM_FUNC_STRDOD-@* ---
943 dnl Author: Jim Meyering
945 dnl Synopsis: AM_FUNC_STRTOD
949 dnl Use: Checks for a working strtod function.
951 ## Copyright (C) 1996 Free Software Foundation, Inc.
953 ## This program is free software; you can redistribute it and/or modify
954 ## it under the terms of the GNU General Public License as published by
955 ## the Free Software Foundation; either version 2, or (at your option)
956 ## any later version.
958 ## This program is distributed in the hope that it will be useful,
959 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
960 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
961 ## GNU General Public License for more details.
963 ## You should have received a copy of the GNU General Public License
964 ## along with this program; if not, write to the Free Software
965 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
968 ## From Jim Meyering.
972 ## @defmac AC_FUNC_STRTOD
973 ## @maindex FUNC_STRTOD
975 ## If the @code{strtod} function is not available, or does not work
976 ## correctly (like the one on SunOS 5.4), add @samp{strtod.o} to output
977 ## variable @code{LIBOBJS}.
980 AC_DEFUN(AM_FUNC_STRTOD,
981 [AC_CACHE_CHECK(for working strtod, am_cv_func_strtod,
988 /* Some versions of Linux strtod mis-parse strings with leading '+'. */
989 char *string = " +69";
992 value = strtod (string, &term);
993 if (value != 69 || term != (string + 4))
998 /* Under Solaris 2.4, strtod returns the wrong value for the
999 terminating character under some conditions. */
1001 ## @defmac AC_FUNC_STRTOD
1002 ## @maindex FUNC_STRTOD
1004 ## If the @code{strtod} function is not available, or does not work
1005 ## correctly (like the one on SunOS 5.4), add @samp{strtod.o} to output
1006 ## variable @code{LIBOBJS}.
1009 AC_DEFUN(AM_FUNC_STRTOD,
1010 [AC_CACHE_CHECK(for working strtod, am_cv_func_strtod,
1017 /* Some versions of Linux strtod mis-parse strings with leading '+'. */
1018 char *string = " +69";
1021 value = strtod (string, &term);
1022 if (value != 69 || term != (string + 4))
1027 /* Under Solaris 2.4, strtod returns the wrong value for the
1028 terminating character under some conditions. */
1029 char *string = "NaN";
1031 strtod (string, &term);
1032 if (term != string && *(term - 1) == 0)
1037 ], am_cv_func_strtod=yes, am_cv_func_strtod=no, am_cv_func_strtod=no)])
1038 test $am_cv_func_strtod = no && LIBOBJS="$LIBOBJS strtod.o"
1039 AC_SUBST(LIBOBJS)dnl
1040 am_cv_func_strtod_needs_libm=no
1041 if test $am_cv_func_strtod = no; then
1043 if test $ac_cv_func_pow = no; then
1044 AC_CHECK_LIB(m, pow, [am_cv_func_strtod_needs_libm=yes],
1045 [AC_MSG_WARN(can't find library containing definition of pow)])
1050 dnl --- *@-AM_SYS_POSIX_TERMIOS-@* ---
1052 dnl Author: Jim Meyering
1054 dnl Synopsis: AM_SYS_POSIX_TERMIOS
1058 dnl Use: Checks for a POSIX termios.h.
1060 AC_DEFUN(AM_SYS_POSIX_TERMIOS,
1061 [AC_CACHE_CHECK([POSIX termios], am_cv_sys_posix_termios,
1062 [AC_TRY_LINK([#include <sys/types.h>
1064 #include <termios.h>],
1065 [/* SunOS 4.0.3 has termios.h but not the library calls. */
1067 am_cv_sys_posix_termios=yes,
1068 am_cv_sys_posix_termios=no)])
1071 dnl----- Macros by Mark Wooding ------------------------------ *@--IGNORE--@*
1073 dnl --- *@-mdw_REQUIRE-@* ---
1075 dnl Author: Mark Wooding
1077 dnl Synopsis: mdw_REQUIRE(MACRO, ARGS...)
1079 dnl Arguments: MACRO = name of a macro which should have been called
1080 dnl ARGS = arguments to pass
1082 dnl Use: Like `AC_REQUIRE', only it handles arguments.
1084 AC_DEFUN(mdw_REQUIRE,
1085 [ifdef([AC_PROVIDE_$1], ,
1086 [AC_DIVERT_PUSH(builtin(eval, AC_DIVERSION_CURRENT - 1))dnl
1091 dnl --- *@-mdw_CURSES-@* ---
1093 dnl Author: Mark Wooding
1095 dnl Synopsis: mdw_CURSES
1099 dnl Use: Searches for a `curses' library (one of `ncurses' or
1100 dnl `curses') using mdw_CHECK_MANYLIBS. If one is found, the
1101 dnl preprocessor macro HAVE_CURSES is defined, and a search is
1102 dnl made for a `curses' header file (one of <ncurses.h>,
1103 dnl <ncurses/ncurses.h> or <curses.h>) using AC_CHECK_HEADERS
1104 dnl and the appropriate preprocessor symbol is defined.
1105 dnl Finally, a check is made for the function `wresize' using
1108 AC_DEFUN(mdw_CURSES,
1109 [mdw_CHECK_MANYLIBS(newwin, ncurses curses, AC_DEFINE(HAVE_CURSES))
1110 if test $mdw_cv_lib_newwin != no; then
1111 AC_CHECK_HEADERS([ncurses.h ncurses/ncurses.h curses.h], [break])
1112 if test "$ac_cv_header_ncurses_h" = "no" &&
1113 test "$ac_cv_header_ncurses_ncurses_h" = "no" &&
1114 test "$ac_cv_header_curses_h" = "no"; then
1115 AC_MSG_WARN([couldn't find a \`curses' header. Assuming \`curses.h'.])
1116 AC_DEFINE(HAVE_CURSES_H)
1118 AC_CHECK_FUNCS(wresize)
1121 dnl --- *@-mdw_TYPE_SSIZE_T-@* ---
1123 dnl Author: Mark Wooding
1125 dnl Synopsis: mdw_TYPE_SSIZE_T
1129 dnl Use: Checks whether the Posix type `ssize_t' is defined. If not,
1130 dnl it defaults to `int'.
1132 AC_DEFUN(mdw_TYPE_SSIZE_T,
1133 [AC_REQUIRE([AC_HEADER_STDC])
1134 AC_CACHE_CHECK(for ssize_t, mdw_cv_ssize_t,
1135 [AC_EGREP_CPP(ssize_t,
1136 [#include <sys/types.h>
1144 [mdw_cv_ssize_t=yes], [mdw_cv_ssize_t=no])])
1145 if test $mdw_cv_ssize_t = no; then
1146 AC_DEFINE(ssize_t, int)
1149 dnl --- *@-mdw_DECL_ENVIRON-@* ---
1151 dnl Author: Mark Wooding
1153 dnl Synopsis: mdw_DECL_ENVIRON
1157 dnl Use: Searches for a declaration of the global `environ' variable.
1158 dnl If one is found in one of the `usual' places, DECL_ENVIRON
1159 dnl is defined as a preprocessor symbol.
1161 AC_DEFUN(mdw_DECL_ENVIRON,
1162 [AC_CACHE_CHECK([for declaration of \`environ'], mdw_cv_environ,
1163 [AC_EGREP_CPP(environ,
1164 [#include <sys/types.h>
1171 #endif], [mdw_cv_environ=yes], [mdw_cv_environ=no])])
1172 if test $mdw_cv_environ = yes; then
1173 AC_DEFINE(DECL_ENVIRON)
1176 dnl --- *@-mdw_CHECK_MANYLIBS-@* ---
1178 dnl Author: Mark Wooding
1180 dnl Synopsis: mdw_CHECK_MANYLIBS(FUNC, LIBS, [IF-FOUND], [IF-NOT-FOUND],
1181 dnl [INCLUDES], [ARGS])
1183 dnl Arguments: FUNC = a function to try to find
1184 dnl LIBS = a whitespace-separated list of libraries to search
1185 dnl IF-FOUND = what to do when the function is found
1186 dnl IF-NOT-FOUND = what to do when the function isn't found
1187 dnl INCLUDES = other include files to add
1188 dnl ARGS = arguments to pass the function
1190 dnl Use: Searches for a library which defines FUNC. It first tries
1191 dnl without any libraries; then it tries each library specified
1192 dnl in LIBS in turn. If it finds a match, it adds the
1193 dnl appropriate library to `LIBS'.
1195 dnl This is particularly handy under DIREIX: if you link with
1196 dnl `-lnsl' then you get non-NIS-aware versions of getpwnam and
1197 dnl so on, which is clearly a Bad Thing.
1199 AC_DEFUN(mdw_CHECK_MANYLIBS,
1200 [AC_CACHE_CHECK([for library containing $1], [mdw_cv_lib_$1],
1201 [mdw_save_LIBS="$LIBS"
1203 AC_TRY_LINK([$5], [$1($6)], [mdw_cv_lib_$1="none required"])
1204 test "$mdw_cv_lib_$1" = "no" && for i in $2; do
1205 LIBS="-l$i $mdw_save_LIBS"
1206 AC_TRY_LINK([$5], [$1($6)],
1207 [mdw_cv_lib_$1="-l$i"
1210 LIBS="$mdw_save_LIBS"])
1211 if test "$mdw_cv_lib_$1" != "no"; then
1212 test "$mdw_cv_lib_$1" = "none required" || LIBS="$mdw_cv_lib_$1 $LIBS"
1218 dnl --- *@-mdw__PERL_VERSION-@* ---
1220 dnl AC_DEFUN relies on `[', `]' being quotes, so I have to drop down a level.
1223 define(mdw__PERL_VERSION, <<$1 -e 'exit ($] < $2);' >&5 2>&5>>)
1226 dnl --- *@-mdw_PROG_PERL-@* ---
1228 dnl Author: Mark Wooding
1230 dnl Synopsis: mdw_PROG_PERL(VERSION, [IF-FOUND], [IF-NOT-FOUND])
1232 dnl Arguments: VERSION = version number of Perl required
1233 dnl IF-FOUND = what to do if it's found
1234 dnl IF-NOT-FOUND = what to do if it isn't
1236 dnl Use: Attempts to find a working version of Perl with a late
1237 dnl enough version number. It supplies an option `--with-perl'
1238 dnl to allow the user to provide a Perl interpreter. If one
1239 dnl isn't provided explicitly, it searches for `perl' and `perl5'
1240 dnl in the current PATH, asking them whether they have a late
1241 dnl enough version number. The path of the working Perl is
1242 dnl put into the `PERL' environment variable; `AC_SUBST' is used
1243 dnl to substitute its value into Perl scripts. If there is no
1244 dnl Perl to be found, the value of `PERL' is set to be `none'.
1246 AC_DEFUN(mdw_PROG_PERL,
1247 [AC_ARG_WITH([perl],
1248 [ --with-perl=PERL specify path to Perl version $1 or newer],
1250 if test -z "$PERL"; then
1251 [AC_CACHE_CHECK([for Perl version $1 or later], mdw_cv_prog_perl,
1252 [mdw_cv_prog_perl="none"
1253 for p in `echo "$PATH:/usr/local/bin" | tr ":" " "`; do
1254 case $p in /*) ;; *) p=`pwd`/$p ;; esac
1255 if mdw__PERL_VERSION(["$p/perl"], $1); then
1256 mdw_cv_prog_perl="$p/perl"
1259 if mdw__PERL_VERSION(["$p/perl5"], $1); then
1260 mdw_cv_prog_perl="$p/perl5"
1264 PERL="$mdw_cv_prog_perl"])
1268 if test "$PERL" = "none"; then :
1274 dnl --- *@-mdw_CHECK_PERL-@* ---
1276 dnl Author: Mark Wooding
1278 dnl Synopsis: mdw_CHECK_PERL(VERSION)
1280 dnl Arguments: VERSION = version number of Perl required
1282 dnl Use: Verifies that the Perl interpreter in the `PERL' shell
1283 dnl variable actually works and is of the right version. If it's
1284 dnl not, an error is raised and configuration is aborted.
1286 AC_DEFUN(mdw_CHECK_PERL,
1287 [mdw_REQUIRE([mdw_PROG_PERL], [$1])
1288 AC_MSG_CHECKING([whether Perl ($PERL) works])
1289 if test "$PERL" != "none" && mdw__PERL_VERSION("$PERL", $1); then
1290 AC_MSG_RESULT([yes])
1293 AC_MSG_ERROR([Perl version $1 or newer not found.
1294 If you have a recent enough Perl, and I just failed to find it, try using
1295 the --with-perl=PERL option to give me an explicit pathname.])
1298 dnl --- *@-mdw_PERLLIB_CHECK-@* ---
1300 dnl Author: Mark Wooding
1302 dnl Synopsis: mdw_PERLLIB_CHECK(LIBRARY)
1304 dnl Arguments: LIBRARY = name of a Perl library to check for
1306 dnl Use: Ensures that a Perl script can `use LIBRARY;'. If it can,
1307 dnl all's well and good; if it can't, `LIBRARY.pm' is added to
1308 dnl the variable `NEEDED_PERLLIBS' and a line which adds
1309 dnl `pkgdatadir' to Perl's `@INC' array is placed in the
1310 dnl variable `INC_PERLLIBS'; `AC_SUBST' is called for both of
1311 dnl these variables. It's expected that `NEEDED_PERLLIBS' will
1312 dnl be used in the `Makefile.in' to decide which versions from
1313 dnl the distribution need installing.
1315 dnl This macro isn't terribly useful in the general case. It
1316 dnl Also implicitly assumes that `$PERL' is Perl 5 or later.
1318 AC_DEFUN(mdw__PERLLIB_INIT,
1319 [AC_SUBST(INC_PERLLIBS)dnl
1320 AC_SUBST(NEEDED_PERLLIBS)dnl
1323 AC_DEFUN(mdw_PERLLIB_CHECK,
1324 [AC_REQUIRE([mdw__PERLLIB_INIT])
1325 mdw_REQUIRE([mdw_CHECK_PERL], 5)
1326 AC_CACHE_CHECK([for Perl library $1], mdw_cv_perllib_$1,
1327 [if $PERL -e 'use $1;' >&5 2>&5; then
1328 mdw_cv_perllib_$1="yes"
1330 mdw_cv_perllib_$1="no"
1333 if test "$mdw_cv_perllib_$1" = "no"; then
1334 NEEDED_PERLLIBS="$NEEDED_PERLLIBS $1.pm"
1336 # --- Deal with autoconf lossage ---
1338 # It doesn't want to define `prefix' until rather later on, so I have
1341 if test -z "$INC_PERLLIBS"; then
1342 mdw_old_prefix="$prefix"
1343 test "$prefix" = "NONE" && prefix="$ac_default_prefix";
1344 INC_PERLLIBS="BEGIN { push @INC, \"`eval echo $datadir/$PACKAGE`\"; }"
1345 prefix="$mdw_old_prefix";
1349 dnl --- *@-mdw_GCC_FLAGS-@* ---
1351 dnl Author: Mark Wooding
1353 dnl Synopsis: mdw_GCC_FLAGS([FLAGS], [CFLAGS], [C++FLAGS])
1355 dnl Arguments: FLAGS = GCC compiler flags to add (default is
1356 dnl `-pedantic -Wall')
1357 dnl CFLAGS = GCC C compiler flags to add (default is empty)
1358 dnl C++FLAGS = GCC C++ compiler flags to add (default is
1359 dnl `-fhandle-exceptions').
1361 dnl Use: If the C compiler is GCC, add the compiler flags.
1363 AC_DEFUN(mdw_GCC_FLAGS,
1364 [if test "$GCC" = "yes"; then
1365 CFLAGS="$CFLAGS ifelse([$1], [], [-pedantic -Wall], [$1])"
1366 CFLAGS="$CFLAGS ifelse([$2], [], [], [$2])"
1368 if test "$GXX" = "yes"; then
1369 CXXFLAGS="$CXXFLAGS ifelse([$1], [], [-pedantic -Wall], [$1])"
1370 CXXFLAGS="$CXXFLAGS ifelse([$3], [], [-fhandle-exceptions], [$3])"
1373 dnl *@-mdw_INIT_LIB-@*
1375 dnl Author: Mark Wooding
1377 dnl Synopsis: mdw_INIT_LIB(LIB, NAME, VERSION, [PACKAGE])
1379 dnl Arguments: LIB = the name of the library (and the package)
1380 dnl NAME = a presentable version of the library's name
1381 dnl VERSION = version of the library
1382 dnl PACKAGE = package name to pass on to AM_INIT_AUTOMAKE
1384 dnl Use: Sets up various useful variables. This macro calls
1385 dnl AM_INIT_AUTOMAKE, which might be considered useful. It also
1386 dnl provides variables for the use of `lib-config.in'.
1388 AC_DEFUN([mdw_INIT_LIB],
1389 [AM_INIT_AUTOMAKE(ifelse([$4], [], [$1], [$4]), [$3])
1390 LIBRARY="$1" AC_SUBST(LIBRARY)
1391 LIBNAME="$2" AC_SUBST(LIBNAME)])
1393 dnl *@-mdw_LIB_CONFIG-@*
1395 dnl Author: Mark Wooding
1397 dnl Synopsis: mdw_LIB_CONFIG(LIB, NAME, VERSION, IF-FOUND, IF-NOT-FOUND)
1399 dnl Arguments: LIB = the name of the library (and its configuration program)
1400 dnl NAME = a presentable version of the library's name
1401 dnl VERSION = version of library required
1402 dnl IF-FOUND = what to do if found
1403 dnl IF-NOT-FOUND = what to do if not found
1405 dnl Use: Configures a library client program, using a configuration
1406 dnl script provided by the library maintainer.
1408 dnl The default version is 1.0.0pre0; the default action is to
1409 dnl add everything to the CFLAGS and LIBS variables, and complain
1410 dnl if the library couldn't be found.
1412 dnl The variable LIB_VERSION contains the version number of
1413 dnl the library; LIB_CFLAGS is the C compiler flags required
1414 dnl and LIB_LIBS is the linker flags.
1416 AC_DEFUN([mdw_LIB_CONFIG],
1417 [pushdef([upname], translit([$1], [a-z], [A-Z]))dnl
1418 AC_MSG_CHECKING([for $2 library])
1419 if $1-config --check $3 >/dev/null 2>&1; then
1420 upname[]_VERSION=`$1-config --version`
1421 upname[]_CFLAGS=`$1-config --cflags`
1422 upname[]_LIBS=`$1-config --libs`
1423 AC_SUBST(upname[]_VERSION)
1424 AC_SUBST(upname[]_CFLAGS)
1425 AC_SUBST(upname[]_LIBS)
1427 [CFLAGS="$CFLAGS $upname[]_CFLAGS"
1428 LIBS="$upname[]_LIBS $LIBS"],
1430 AC_MSG_RESULT([$upname[]_VERSION])
1433 AC_MSG_ERROR([$2 library not found or too old.]),
1435 AC_MSG_RESULT([not found])
1440 dnl Author: Mark Wooding
1442 dnl Synopsis: mdw_MLIB(VERSION, IF-FOUND, IF-NOT-FOUND
1444 dnl Arguments: VERSION = version of library required
1445 dnl IF-FOUND = what to do if found
1446 dnl IF-NOT-FOUND = what to do if not found
1448 dnl Use: Configures an mLib client program.
1450 AC_DEFUN([mdw_MLIB], [mdw_LIB_CONFIG(mLib, mLib, $@)])
1454 dnl Author: Mark Wooding
1456 dnl Synopsis: mdw_MGLIB(VERSION, IF-FOUND, IF-NOT-FOUND
1458 dnl Arguments: VERSION = version of library required
1459 dnl IF-FOUND = what to do if found
1460 dnl IF-NOT-FOUND = what to do if not found
1462 dnl Use: Configures an mgLib client program.
1464 AC_DEFUN([mdw_MGLIB],
1465 [mdw_REQUIRE([mdw_MLIB], [1.6.0])
1466 mdw_LIB_CONFIG(mgLib, mgLib, $@)])
1468 dnl *@-mdw_CATACOMB-@*
1470 dnl Author: Mark Wooding
1472 dnl Synopsis: mdw_CATACOMB([VERSION], [IF-FOUND], [IF-NOT-FOUND])
1474 dnl Arguments: VERSION = version of Catacomb required
1475 dnl IF-FOUND = what to do if found
1476 dnl IF-NOT-FOUND = what to do if not found
1478 dnl Use: Configures the program as a Catacomb client.
1480 AC_DEFUN([mdw_CATACOMB],
1481 [mdw_REQUIRE([mdw_MLIB], [1.6.0])
1482 mdw_LIB_CONFIG(catacomb, Catacomb, $@)])
1486 dnl Author: Mark Wooding
1488 dnl Synopsis: mdw_PK([VERSION], [IF-FOUND], [IF-NOT-FOUND])
1490 dnl Arguments: VERSION = version of PK required
1491 dnl IF-FOUND = what to do if found
1492 dnl IF-NOT-FOUND = what to do if not found
1494 dnl Use: Configures the program as a PK client.
1497 [mdw_REQUIRE([mdw_MLIB], [1.6.0])
1498 mdw_LIB_CONFIG(pk, PK, $@)])
1500 dnl --- *@-mdw_OPT_NDEBUG-@* ---
1502 dnl Author: Mark Wooding
1504 dnl Synopsis: mdw_OPT_NDEBUG
1508 dnl Use: Turns off the `NDEBUG' flag if the user wants to do
1511 AC_DEFUN(mdw_OPT_NDEBUG,
1512 [AC_ARG_ENABLE(debugging,
1513 [ --enable-debugging spews vast swathes of useless information],
1514 [if test "$enableval" = "no"; then
1515 AC_DEFINE(NDEBUG, 1)
1517 [AC_DEFINE(NDEBUG, 1)])])
1519 dnl --- *@-mdw_OPT_EFENCE-@* ---
1521 dnl Author: Mark Wooding
1523 dnl Synopsis: mdw_OPT_EFENCE
1527 dnl Use: Links with the Electric Fence library.
1529 AC_DEFUN(mdw_OPT_EFENCE,
1530 [AC_ARG_WITH(electric-fence,
1531 [ --with-electric-fence link programs with Electric Fence],
1532 [if test "$withval" = "yes"; then
1533 AC_CHECK_LIB(efence, malloc)
1536 dnl --- *@-mdw_OPT_mLib_DEBUG-@* ---
1538 dnl Author: Mark Wooding
1540 dnl Synopsis: mdw_OPT_mLib_DEBUG(PROGRAM)
1544 dnl Use: Provides options for mLib debugging. In particular, the
1545 dnl following are defined:
1547 dnl --enable-tracing turns off the NTRACE variable
1548 dnl --enable-track turns on malloc tracking
1549 dnl --enable-blame-PROGRAM tracks malloc contexts in PROGRAM
1551 dnl There must be a separate `blame' option, so that the various
1552 dnl blame options work properly.
1554 AC_DEFUN(mdw_OPT_mLib_DEBUG,
1558 AC_ARG_ENABLE(tracing,
1559 [ --enable-tracing enable output of tracing information],
1560 [if test "$enableval" = "no"; then
1561 AC_DEFINE(NTRACE, 1)
1563 [AC_DEFINE(NTRACE, 1)])
1565 AC_ARG_ENABLE(track,
1566 [ --enable-track enable tracking of malloc and free],
1567 [AC_DEFINE(TRACK_ENABLE, 1)])
1569 AC_ARG_ENABLE(blame-$1,
1571 track malloc contexts while in $1],
1572 [AC_DEFINE(TRACK_BLAME, 1)])])
1574 dnl----- That's all, folks --------------------------------- *@--GLOB-END--@*