Version bump.
[cfd] / aclocal.glob
CommitLineData
b91e2391 1dnl -*-fundamental-*- *@--GLOB-HEADER--@*
2dnl
191b8aaf 3dnl $Id: aclocal.glob,v 1.13 2001/02/23 09:07:24 mdw Exp $
b91e2391 4dnl
5dnl Common library of autoconf macros
6dnl
7dnl (c) 1997 Mark Wooding, except for macros and documentation where noted.
8dnl
9
10dnl----- Licensing notice ---------------------------------------------------
11dnl
12dnl This file is part of the Common Files Distribution (`common')
13dnl
14dnl `Common' is free software; you can redistribute it and/or modify
15dnl it under the terms of the GNU General Public License as published by
16dnl the Free Software Foundation; either version 2 of the License, or
17dnl (at your option) any later version.
18dnl
19dnl `Common' is distributed in the hope that it will be useful,
20dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
21dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22dnl GNU General Public License for more details.
23dnl
24dnl You should have received a copy of the GNU General Public License
25dnl along with `common'; if not, write to the Free Software Foundation,
26dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27
28dnl----- Revision history ---------------------------------------------------
29dnl
30dnl $Log: aclocal.glob,v $
191b8aaf 31dnl Revision 1.13 2001/02/23 09:07:24 mdw
32dnl Restore temporary variable on exit.
33dnl
7a1aef7d 34dnl Revision 1.12 2001/02/04 01:18:52 mdw
35dnl Overhaul the mLib debugging options.
36dnl
485c6c23 37dnl Revision 1.11 2001/01/20 12:03:08 mdw
38dnl Remove redundant stuff.
39dnl
37dec778 40dnl Revision 1.10 2000/10/14 16:32:15 mdw
41dnl Fixes from upstream.
42dnl
08f6362d 43dnl Revision 1.9 2000/08/15 21:37:49 mdw
44dnl New initialization macro for libraries, and a new base client macro for
45dnl finding libraries with an appropriate version.
46dnl
5ba1b8b8 47dnl Revision 1.8 1999/11/26 01:23:17 mdw
48dnl And support for MXD (not yet released).
49dnl
5a27eb4e 50dnl Revision 1.7 1999/11/11 20:03:58 mdw
51dnl Add support for mgLib too.
52dnl
17fc60ae 53dnl Revision 1.6 1999/11/11 17:49:33 mdw
54dnl New macros for configuring clients of mLib and Catacomb.
55dnl
6c1c6588 56dnl Revision 1.5 1999/07/27 18:27:37 mdw
57dnl Fix typo in header line for mdw_DECL_ENVIRON.
58dnl
a80cb8cc 59dnl Revision 1.4 1999/07/26 23:44:32 mdw
60dnl Reorder and tidy documentation.
61dnl
aaa99339 62dnl Revision 1.3 1999/07/17 10:27:44 mdw
63dnl More useful macros added.
64dnl
5b59e227 65dnl Revision 1.2 1999/05/13 22:57:23 mdw
66dnl Change `-ise' to `-ize' throughout.
67dnl
68dnl Revision 1.1.1.1 1999/05/05 19:23:47 mdw
69dnl New import. The old CVS repository was lost in a disk disaster.
b91e2391 70dnl
71
72dnl----- Common files distribution --------------------------- *@--NOTICE--@*
73dnl
191b8aaf 74dnl $Id: aclocal.glob,v 1.13 2001/02/23 09:07:24 mdw Exp $
b91e2391 75
485c6c23 76dnl --- *@-AM_PROG_CC_STDC-@* ---
b91e2391 77dnl
78dnl Author: Franc,ois Pinard
79dnl
485c6c23 80dnl Synopsis: AM_PROG_CC_STDC
b91e2391 81dnl
82dnl Arguments: ---
83dnl
84dnl Use: If the C compiler in not in ANSI C mode by default, try to
85dnl add an option to output variable `CC' to make it so. This
86dnl macro tries various options that select ANSI C on some system
87dnl or another. It considers the compiler to be in ANSI C mode
88dnl if it defines `__STDC__' to 1 and handles function prototypes
89dnl correctly.
90dnl
91dnl If you use this macro, you should check after calling it
92dnl whether the C compiler has been set to accept ANSI C; if not,
93dnl the shell variable `ac_cv_prog_cc_stdc' is set to `no'. If
94dnl you wrote your source code in ANSI C, you can make an
95dnl un-ANSIfied copy of it by using the program `ansi2knr', which
96dnl comes with Ghostscript.
97dnl
98dnl (documentation by Franc,ois Pinard)
99
100AC_DEFUN(AM_PROG_CC_STDC,
101[AC_REQUIRE([AC_PROG_CC])
102AC_BEFORE([$0], [AC_C_INLINE])
103AC_BEFORE([$0], [AC_C_CONST])
104AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
105AC_CACHE_VAL(am_cv_prog_cc_stdc,
106[am_cv_prog_cc_stdc=no
107ac_save_CC="$CC"
108# Don't try gcc -ansi; that turns off useful extensions and
109# breaks some systems' header files.
110# AIX -qlanglvl=ansi
111# Ultrix and OSF/1 -std1
112# HP-UX -Aa -D_HPUX_SOURCE
113# SVR4 -Xc -D__EXTENSIONS__
114for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
115do
116 CC="$ac_save_CC $ac_arg"
117 AC_TRY_COMPILE(
118[#if !defined(__STDC__) || __STDC__ != 1
119choke me
120#endif
121/* DYNIX/ptx V4.1.3 can't compile sys/stat.h with -Xc -D__EXTENSIONS__. */
122#ifdef _SEQUENT_
123# include <sys/types.h>
124# include <sys/stat.h>
125#endif
126], [
127int test (int i, double x);
128struct s1 {int (*f) (int a);};
129struct s2 {int (*f) (double a);};],
130[am_cv_prog_cc_stdc="$ac_arg"; break])
131done
132CC="$ac_save_CC"
133])
134if test -z "$am_cv_prog_cc_stdc"; then
135 AC_MSG_RESULT([none needed])
136else
137 AC_MSG_RESULT($am_cv_prog_cc_stdc)
138fi
139case "x$am_cv_prog_cc_stdc" in
140 x|xno) ;;
141 *) CC="$CC $am_cv_prog_cc_stdc" ;;
142esac
143])
144
145dnl----- AutoMake macros ------------------------------------- *@--IGNORE--@*
146
147dnl --- *@-AM_CONDITIONAL-@* ---
148dnl
149dnl Author: Unknown
150dnl
151dnl Synopsis: AM_CONDITIONAL(NAME, TEST)
152dnl
153dnl Arguments: NAME = name of the conditional
154dnl TEST = a shell list to execute
155dnl
156dnl Use: Allows conditional sections in Makefiles.
157
158AC_DEFUN(AM_CONDITIONAL,
159[AC_SUBST($1_TRUE)
160AC_SUBST($1_FALSE)
161if $2; then
162 $1_TRUE=
163 $1_FALSE='#'
164else
165 $1_TRUE='#'
166 $1_FALSE=
167fi])
168
169dnl --- *@-AM_CYGWIN32-@* ---
170dnl
171dnl Author: Cygnus (I guess)
172dnl
173dnl Synopsis: AM_CYGWIN32
174dnl
175dnl Arguments: ---
176dnl
177dnl Use: Check to see if we're running under Cygwin32, without using
178dnl AC_CANONICAL_*. If so, set output variable EXEEXT to
179dnl ".exe". Otherwise set it to "".
180
181dnl AM_CYGWIN32()
182dnl You might think we can do this by checking for a cygwin32-specific
183dnl cpp define. We can't, because cross-compilers that target
184dnl cygwin32 don't use the .exe suffix. I don't know why.
185AC_DEFUN(AM_CYGWIN32,
186[AC_CACHE_CHECK(for Cygwin32 environment, am_cv_cygwin32,
187[cat > conftest.$ac_ext << 'EOF'
188int main () {
189/* Nothing. */
190return 0; }
191EOF
192if AC_TRY_EVAL(ac_link) && test -s conftest.exe; then
193 am_cv_cygwin32=yes
194else
195 am_cv_cygwin32=no
196fi
197rm -f conftest*])
198EXEEXT=
199test "$am_cv_cygwin32" = yes && EXEEXT=.exe
200AC_SUBST(EXEEXT)])
201
202dnl --- *@-AM_WITH_DMALLOC-@* ---
203dnl
204dnl Author: Franc,ois Pinard
205dnl
206dnl Synopsis: AM_WITH_DMALLOC
207dnl
208dnl Arguments: ---
209dnl
210dnl Use: Links with `-dmalloc' if told to by the user.
211
212## ----------------------------------- ##
213## Check if --with-dmalloc was given. ##
214## From Franc,ois Pinard ##
215## ----------------------------------- ##
216
217# serial 1
218
219AC_DEFUN(AM_WITH_DMALLOC,
220[AC_MSG_CHECKING(if malloc debugging is wanted)
221AC_ARG_WITH(dmalloc,
222[ --with-dmalloc use dmalloc, as in
223 ftp://ftp.letters.com/src/dmalloc/dmalloc.tar.gz],
224[if test "$withval" = yes; then
225 AC_MSG_RESULT(yes)
226 AC_DEFINE(WITH_DMALLOC)
227 LIBS="$LIBS -ldmalloc"
228 LDFLAGS="$LDFLAGS -g"
229else
230 AC_MSG_RESULT(no)
231fi], [AC_MSG_RESULT(no)])
232])
233
234dnl --- *@-AM_FUNC_ERROR_AT_LINE-@* ---
235dnl
236dnl Author: Jim Meyering
237dnl
238dnl Synopsis: AM_FUNC_ERROR_AT_LINE
239dnl
240dnl Arguments: ---
241dnl
242dnl Use: Use this if you use the GNU error.[ch].
243
244dnl FIXME: Migrate into libit
245
246AC_DEFUN(AM_FUNC_ERROR_AT_LINE,
247[AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line,
248 [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");],
249 am_cv_lib_error_at_line=yes,
250 am_cv_lib_error_at_line=no)])
251 if test $am_cv_lib_error_at_line = no; then
252 LIBOBJS="$LIBOBJS error.o"
253 fi
254 AC_SUBST(LIBOBJS)dnl
255])
256
257dnl --- *@-AM_INIT_GUILE_MODULE-@* ---
258dnl
259dnl Author: Unknown
260dnl
261dnl Synopsis: AM_INIT_GUILE_MODULE(MODNAME)
262dnl
5b59e227 263dnl Arguments: MODNAME = value to initialize `module' variable with
b91e2391 264dnl
265dnl Use: This macro will automatically get the guile version from the
266dnl top-level srcdir, and will initialize automake. It also
267dnl defines the `module' variable.
268
269AC_DEFUN([AM_INIT_GUILE_MODULE],[
270. $srcdir/../GUILE-VERSION
271AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
272AC_CONFIG_AUX_DIR(..)
273module=[$1]
274AC_SUBST(module)])
275
276dnl --- *@-AM_CONFIG_HEADER-@* ---
277dnl
278dnl Author: Unknown
279dnl
280dnl Synopsis: AM_CONFIG_HEADER(HEADER ...)
281dnl
282dnl Arguments: HEADER = a header spec, as for AC_CONFIG_HEADER
283dnl
284dnl Use: Like AC_CONFIG_HEADER, but automatically create stamp file.
285
286AC_DEFUN(AM_CONFIG_HEADER,
287[AC_PREREQ([2.12])
288AC_CONFIG_HEADER([$1])
289dnl When config.status generates a header, we must update the stamp-h file.
290dnl This file resides in the same directory as the config header
291dnl that is generated. We must strip everything past the first ":",
292dnl and everything past the last "/".
293AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
294ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
295<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/
296\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
297<<am_indx=1
298for am_file in <<$1>>; do
299 case " <<$>>CONFIG_HEADERS " in
300 *" <<$>>am_file "*<<)>>
301 echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
302 ;;
303 esac
304 am_indx=`expr "<<$>>am_indx" + 1`
305done<<>>dnl>>)
306changequote([,]))])
307
308dnl --- *@-AM_INIT_AUTOMAKE-@*
309dnl
310dnl Author: Unknown
311dnl
312dnl Synopsis: AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
313dnl
314dnl Arguments: PACKAGE = package name
315dnl VERSION = version number
316dnl NO-DEFINE = if set, don't define package and version number
317dnl
318dnl Use: Do all the work for Automake. This macro actually does too
319dnl much -- some checks are only needed if your package does
320dnl certain things. But this isn't really a big deal.
321
322# serial 1
323
324AC_DEFUN(AM_INIT_AUTOMAKE,
37dec778 325[AC_REQUIRE([AC_PROG_INSTALL])
b91e2391 326PACKAGE=[$1]
327AC_SUBST(PACKAGE)
328VERSION=[$2]
329AC_SUBST(VERSION)
330dnl test to see if srcdir already configured
331if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
332 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
333fi
334ifelse([$3],,
335AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
336AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
37dec778 337AC_REQUIRE([AM_SANITY_CHECK])
338AC_REQUIRE([AC_ARG_PROGRAM])
b91e2391 339dnl FIXME This is truly gross.
340missing_dir=`cd $ac_aux_dir && pwd`
341AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
342AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
343AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
344AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
345AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
37dec778 346AC_REQUIRE([AC_PROG_MAKE_SET])])
b91e2391 347
b91e2391 348dnl --- *@-AM_PROG_LEX-@* ---
349dnl
350dnl Author: Alexandre Oliva
351dnl
352dnl Synopsis: AM_PROG_LEX
353dnl
354dnl Arguments: ---
355dnl
356dnl Use: Replacement for AC_PROG_LEX and AC_DECL_YYTEXT
357
358dnl AM_PROG_LEX
359dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT
360AC_DEFUN(AM_PROG_LEX,
361[missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1)
362AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex")
363AC_PROG_LEX
364AC_DECL_YYTEXT])
365
366dnl --- *@-AM_PROG_LIBTOOL-@* ---
367dnl
368dnl Author: Unknown
369dnl
370dnl Synopsis: AM_PROG_LIBTOOL
371dnl
372dnl Arguments: ---
373dnl
374dnl Use: Configures `libtool' for the target architecture.
375
376##
377## Configure libtool for the target system.
378##
379# serial 1 AM_PROG_LIBTOOL
380AC_DEFUN(AM_PROG_LIBTOOL,
381[AC_REQUIRE([AC_CANONICAL_HOST])
382AC_REQUIRE([AC_PROG_CC])
383AC_REQUIRE([AC_PROG_RANLIB])
384
385# Always use our own libtool.
386LIBTOOL='$(top_builddir)/libtool'
387AC_SUBST(LIBTOOL)
388
389dnl Allow the --disable-shared flag to stop us from building shared libs.
390AC_ARG_ENABLE(shared,
391[ --enable-shared build shared libraries [default=yes]],
392test "$enableval" = no && libtool_shared=" --disable-shared",
393libtool_shared=)
394
395libtool_flags="$libtool_shared"
396test "$silent" = yes && libtool_flags="$libtool_flags --silent"
397test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
398
399# Actually configure libtool. ac_aux_dir is where install-sh is found.
400CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" LD="$LD" RANLIB="$RANLIB" \
401$ac_aux_dir/ltconfig $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
402|| AC_MSG_ERROR([libtool configure failed])
403])
404
405dnl --- *@-AM_PATH_LISPDIR-@* ---
406dnl
407dnl Author: Ulrich Drepper
408dnl
409dnl Synopsis: AM_PATH_LISPDIR
410dnl
411dnl Arguments: ---
412dnl
413dnl Use: Sets the variable `lispdir' to point to a place to install
414dnl Emacs lisp files.
415
416## ------------------------
417## Emacs LISP file handling
418## From Ulrich Drepper
419## ------------------------
420
421# serial 1
422
423AC_DEFUN(AM_PATH_LISPDIR,
424 [# If set to t, that means we are running in a shell under Emacs.
425 # If you have an Emacs named "t", then use the full path.
426 test "$EMACS" = t && EMACS=
427 AC_PATH_PROG(EMACS, emacs xemacs, no)
428 if test $EMACS != "no"; then
429 AC_MSG_CHECKING([where .elc files should go])
430 dnl Set default value
431 lispdir="\$(datadir)/emacs/site-lisp"
432 if test "x$prefix" = "xNONE"; then
433 if test -d $ac_default_prefix/share/emacs/site-lisp; then
434 lispdir="\$(prefix)/share/emacs/site-lisp"
435 else
436 if test -d $ac_default_prefix/lib/emacs/site-lisp; then
437 lispdir="\$(prefix)/lib/emacs/site-lisp"
438 fi
439 fi
440 else
441 if test -d $prefix/share/emacs/site-lisp; then
442 lispdir="\$(prefix)/share/emacs/site-lisp"
443 else
444 if test -d $prefix/lib/emacs/site-lisp; then
445 lispdir="\$(prefix)/lib/emacs/site-lisp"
446 fi
447 fi
448 fi
449 AC_MSG_RESULT($lispdir)
450 fi
451 AC_SUBST(lispdir)])
452
453dnl --- *@-AM_MAINTAINTER_MODE-@* ---
454dnl
455dnl Author: Jim Meyering
456dnl
457dnl Synopsis: jm_MAINTAINER_MODE
458dnl
459dnl Arguments: ---
460dnl
461dnl Use: Provides an option `--enable-maintainer-mode' which turns
462dnl on rules which might normally be commented out. The
463dnl substitution variable `MAINT' is set to be a comment when
464dnl this option is disabled, which it is by default.
465
466# serial 1
467
468AC_DEFUN(AM_MAINTAINER_MODE,
469[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
470 dnl maintainer-mode is disabled by default
471 AC_ARG_ENABLE(maintainer-mode,
472[ --enable-maintainer-mode enable make rules and dependencies not useful
473 (and sometimes confusing) to the casual installer],
474 USE_MAINTAINER_MODE=$enableval,
475 USE_MAINTAINER_MODE=no)
476 AC_MSG_RESULT($USE_MAINTAINER_MODE)
477 if test $USE_MAINTAINER_MODE = yes; then
478 MAINT=
479 else
480 MAINT='#M#'
481 fi
482 AC_SUBST(MAINT)dnl
483]
484)
485
486dnl --- *@-AM_MISSING_PROG-@* ---
487dnl
488dnl Author: Unknown
489dnl
490dnl Synopsis: AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
491dnl
492dnl Arguments: NAME = variable to set to the file's location
493dnl PROGRAM = name of program to find
494dnl DIRECTORY = directory to look in
495dnl
496dnl Use: Fakes existence of a useful GNU maintainer tool.
497
498AC_DEFUN(AM_MISSING_PROG,
499[AC_MSG_CHECKING(for working $2)
500# Run test in a subshell; some versions of sh will print an error if
501# an executable is not found, even if stderr is redirected.
502# Redirect stdin to placate older versions of autoconf. Sigh.
503if ($2 --version) < /dev/null > /dev/null 2>&1; then
504 $1=$2
505 AC_MSG_RESULT(found)
506else
507 $1="$3/missing $2"
508 AC_MSG_RESULT(missing)
509fi
510AC_SUBST($1)])
511
512dnl --- *@-AM_FUNC_MKTIME-@* ---
513dnl
514dnl Author: Jim Meyering
515dnl
516dnl Synopsis: AM_FUNC_MKTIME
517dnl
518dnl Arguments: ---
519dnl
520dnl Use: Checks for a working mktime function.
521
522AC_DEFUN(AM_FUNC_MKTIME,
523[AC_REQUIRE([AC_HEADER_TIME])dnl
524 AC_CHECK_HEADERS(sys/time.h)
525 AC_CACHE_CHECK([for working mktime], am_cv_func_working_mktime,
526 [AC_TRY_RUN(
527changequote(<<, >>)dnl
528<</* Test program from Paul Eggert (eggert@twinsun.com)
529 and Tony Leneis (tony@plaza.ds.adp.com). */
530#if TIME_WITH_SYS_TIME
531# include <sys/time.h>
532# include <time.h>
533#else
534# if HAVE_SYS_TIME_H
535# include <sys/time.h>
536# else
537# include <time.h>
538# endif
539#endif
540
541static time_t time_t_max;
542
543/* Values we'll use to set the TZ environment variable. */
544static const char *const tz_strings[] = {
545 NULL, "GMT0", "JST-9", "EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00"
546};
547#define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0]))
548
549static void
550mktime_test (now)
551 time_t now;
552{
553 if (mktime (localtime (&now)) != now)
554 exit (1);
555 now = time_t_max - now;
556 if (mktime (localtime (&now)) != now)
557 exit (1);
558}
559
560int
561main ()
562{
563 time_t t, delta;
564 int i;
565
566 for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2)
567 continue;
568 time_t_max--;
569 delta = time_t_max / 997; /* a suitable prime number */
570 for (i = 0; i < N_STRINGS; i++)
571 {
572 if (tz_strings[i])
573 putenv (tz_strings[i]);
574
575 for (t = 0; t <= time_t_max - delta; t += delta)
576 mktime_test (t);
577 mktime_test ((time_t) 60 * 60);
578 mktime_test ((time_t) 60 * 60 * 24);
579 }
580 exit (0);
581}
582 >>,
583changequote([, ])dnl
584 am_cv_func_working_mktime=yes, am_cv_func_working_mktime=no,
585 dnl When crosscompiling, assume mktime is missing or broken.
586 am_cv_func_working_mktime=no)
587 ])
588 if test $am_cv_func_working_mktime = no; then
589 LIBOBJS="$LIBOBJS mktime.o"
590 fi
591])
592
593dnl --- *@-AM_FUNC_OBSTACK-@* ---
594dnl
595dnl Author: Jim Meyering
596dnl
597dnl Synopsis: AM_FUNC_OBSTACK
598dnl
599dnl Arguments: ---
600dnl
601dnl Use: Checks for GNU obstacks.
602
603AC_DEFUN(AM_FUNC_OBSTACK,
604[AC_CACHE_CHECK([for obstacks], am_cv_func_obstack,
605 [AC_TRY_LINK([#include "obstack.h"],
606 [struct obstack *mem;obstack_free(mem,(char *) 0)],
607 am_cv_func_obstack=yes,
608 am_cv_func_obstack=no)])
609 if test $am_cv_func_obstack = yes; then
610 AC_DEFINE(HAVE_OBSTACK)
611 else
612 LIBOBJS="$LIBOBJS obstack.o"
613 fi
614])
615
616dnl --- *@-AC_C_PROTOTYPES-@* ---
617dnl
618dnl Author: Franc,ois Pinard
619dnl
620dnl Synopsis: AC_C_PROTOTYPES
621dnl
622dnl Arguments: ---
623dnl
624dnl Use: If the C compiler understands ANSI C, define `PROTOTYPES',
625dnl and clear the `U' and `ANSI2KNR' variables. Otherwise,
626dnl set `U' to be `_' and `ANSI2KNR' to be `./ansi2knr'.
627
628# serial 1
629
630AC_DEFUN(fp_C_PROTOTYPES,
485c6c23 631[AC_REQUIRE([AM_PROG_CC_STDC])
b91e2391 632AC_MSG_CHECKING([for function prototypes])
633if test "$ac_cv_prog_cc_stdc" != no; then
634 AC_MSG_RESULT(yes)
635 AC_DEFINE(PROTOTYPES)
636 U= ANSI2KNR=
637else
638 AC_MSG_RESULT(no)
639 U=_ ANSI2KNR=./ansi2knr
640fi
641AC_SUBST(U)dnl
642AC_SUBST(ANSI2KNR)dnl
643])
644
645dnl --- *@-AM_PATH_GTK-@* ---
646dnl
647dnl Author: Owen Taylor
648dnl
649dnl Synopsis: AM_PATH_GTK(MIN-VERSION, [ACTION-IF-FOUND], [ACTION-IF-NOT])
650dnl
651dnl Arguments: MIN-VERSION = minimum version of GTK required
652dnl ACTION-IF-FOUND = executed if GTK found OK
653dnl ACTION-IF-NOT-FOUND = what to do if GTK not available
654dnl
655dnl Use: Sets up compilation environment suitably for GTK programming.
656
657# Configure paths for GTK+
658# Owen Taylor 97-11-3
659
660dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
661dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
662dnl
663AC_DEFUN(AM_PATH_GTK,
664[dnl
665dnl Get the cflags and libraries from the gtk-config script
666dnl
667AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
668 gtk_config_prefix="$withval", gtk_config_prefix="")
669AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
670 gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
671AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
672 , enable_gtktest=yes)
673
674 if test x$gtk_config_exec_prefix != x ; then
675 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
676 if test x${GTK_CONFIG+set} != xset ; then
677 GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
678 fi
679 fi
680 if test x$gtk_config_prefix != x ; then
681 gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
682 if test x${GTK_CONFIG+set} != xset ; then
683 GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
684 fi
685 fi
686
687 AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
688 min_gtk_version=ifelse([$1], ,0.99.7,$1)
689 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
690 no_gtk=""
691 if test "$GTK_CONFIG" = "no" ; then
692 no_gtk=yes
693 else
694 GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
695 GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
696 gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
697 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
698 gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
699 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
700 gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
701 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
702 if test "x$enable_gtktest" = "xyes" ; then
703 ac_save_CFLAGS="$CFLAGS"
704 ac_save_LIBS="$LIBS"
705 CFLAGS="$CFLAGS $GTK_CFLAGS"
706 LIBS="$LIBS $GTK_LIBS"
707dnl
708dnl Now check if the installed GTK is sufficiently new. (Also sanity
709dnl checks the results of gtk-config to some extent
710dnl
711 rm -f conf.gtktest
712 AC_TRY_RUN([
713#include <gtk/gtk.h>
714#include <stdio.h>
715
716int
717main ()
718{
719 int major, minor, micro;
720 char *tmp_version;
721
722 system ("touch conf.gtktest");
723
724 /* HP/UX 9 (%@#!) writes to sscanf strings */
725 tmp_version = g_strdup("$min_gtk_version");
726 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
727 printf("%s, bad version string\n", "$min_gtk_version");
728 exit(1);
729 }
730
731 if ((gtk_major_version != $gtk_config_major_version) ||
732 (gtk_minor_version != $gtk_config_minor_version) ||
733 (gtk_micro_version != $gtk_config_micro_version))
734 {
735 printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
736 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
737 gtk_major_version, gtk_minor_version, gtk_micro_version);
738 printf ("*** was found! If gtk-config was correct, then it is best\n");
739 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
740 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
741 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
742 printf("*** required on your system.\n");
743 printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
744 printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
745 printf("*** before re-running configure\n");
746 }
747 else
748 {
749 if ((gtk_major_version > major) ||
750 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
751 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
752 {
753 return 0;
754 }
755 else
756 {
757 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
758 gtk_major_version, gtk_minor_version, gtk_micro_version);
759 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
760 major, minor, micro);
761 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
762 printf("***\n");
763 printf("*** If you have already installed a sufficiently new version, this error\n");
764 printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
765 printf("*** being found. The easiest way to fix this is to remove the old version\n");
766 printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
767 printf("*** correct copy of gtk-config. (In this case, you will have to\n");
768 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
769 printf("*** so that the correct libraries are found at run-time))\n");
770 }
771 }
772 return 1;
773}
774],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
775 CFLAGS="$ac_save_CFLAGS"
776 LIBS="$ac_save_LIBS"
777 fi
778 fi
779 if test "x$no_gtk" = x ; then
780 AC_MSG_RESULT(yes)
781 ifelse([$2], , :, [$2])
782 else
783 AC_MSG_RESULT(no)
784 if test "$GTK_CONFIG" = "no" ; then
785 echo "*** The gtk-config script installed by GTK could not be found"
786 echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
787 echo "*** your path, or set the GTK_CONFIG environment variable to the"
788 echo "*** full path to gtk-config."
789 else
790 if test -f conf.gtktest ; then
791 :
792 else
793 echo "*** Could not run GTK test program, checking why..."
794 CFLAGS="$CFLAGS $GTK_CFLAGS"
795 LIBS="$LIBS $GTK_LIBS"
796 AC_TRY_LINK([
797#include <gtk/gtk.h>
798#include <stdio.h>
799], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
800 [ echo "*** The test program compiled, but did not run. This usually means"
801 echo "*** that the run-time linker is not finding GTK or finding the wrong"
802 echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
803 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
804 echo "*** to the installed location Also, make sure you have run ldconfig if that"
805 echo "*** is required on your system"
806 echo "***"
807 echo "*** If you have an old version installed, it is best to remove it, although"
808 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
809 echo "***"
810 echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
811 echo "*** came with the system with the command"
812 echo "***"
813 echo "*** rpm --erase --nodeps gtk gtk-devel" ],
814 [ echo "*** The test program failed to compile or link. See the file config.log for the"
815 echo "*** exact error that occured. This usually means GTK was incorrectly installed"
816 echo "*** or that you have moved GTK since it was installed. In the latter case, you"
817 echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
818 CFLAGS="$ac_save_CFLAGS"
819 LIBS="$ac_save_LIBS"
820 fi
821 fi
822 GTK_CFLAGS=""
823 GTK_LIBS=""
824 ifelse([$3], , :, [$3])
825 fi
826 AC_SUBST(GTK_CFLAGS)
827 AC_SUBST(GTK_LIBS)
828 rm -f conf.gtktest
829])
830
831dnl --- *@-AC_TYPE_PTRDIFF_T-@* ---
832dnl
833dnl Author: Ulrich Drepper
834dnl
835dnl Synopsis: AC_TYPE_PTRDIFF_T
836dnl
837dnl Arguments: ---
838dnl
839dnl Use: Sets HAVE_PTRDIFF_T if the type exists.
840
841AC_DEFUN(AM_TYPE_PTRDIFF_T,
842 [AC_CACHE_CHECK([for ptrdiff_t], am_cv_type_ptrdiff_t,
843 [AC_TRY_COMPILE([#include <stddef.h>], [ptrdiff_t p],
844 am_cv_type_ptrdiff_t=yes, am_cv_type_ptrdiff_t=no)])
845 if test $am_cv_type_ptrdiff_t = yes; then
846 AC_DEFINE(HAVE_PTRDIFF_T)
847 fi
848])
849
850dnl --- *@-AM_WITH_REGEX-@* ---
851dnl
852dnl Author: Unknown (possibly Franc,ois Pinard)
853dnl
854dnl Synopsis: AM_WITH_REGEX
855dnl
856dnl Arguments: ---
857dnl
858dnl Use:
859dnl The idea is to distribute rx.[hc] and regex.[hc] together,
860dnl for a while. The WITH_REGEX symbol (which should also be
861dnl documented in acconfig.h) is used to decide which of regex.h
862dnl or rx.h should be included in the application. If
863dnl `./configure --with-regex' is given (the default), the
864dnl package will use gawk's regex. If `./configure
865dnl --without-regex', a check is made to see if rx is already
866dnl installed, as with newer Linux'es. If not found, the package
867dnl will use the rx from the distribution. If found, the package
868dnl will use the system's rx which, on Linux at least, will
869dnl result in a smaller executable file.
870
871AC_DEFUN(AM_WITH_REGEX,
872[AC_MSG_CHECKING(which of GNU rx or gawk's regex is wanted)
873AC_ARG_WITH(regex,
874[ --without-regex use GNU rx in lieu of gawk's regex for matching],
875[test "$withval" = yes && am_with_regex=1],
876[am_with_regex=1])
877if test -n "$am_with_regex"; then
878 AC_MSG_RESULT(regex)
879 AC_DEFINE(WITH_REGEX)
880 AC_CACHE_CHECK([for GNU regex in libc], am_cv_gnu_regex,
881 AC_TRY_LINK([], [extern int re_max_failures; re_max_failures = 1],
882 am_cv_gnu_regex=yes, am_cv_gnu_regex=no))
883 if test $am_cv_gnu_regex = no; then
884 LIBOBJS="$LIBOBJS regex.o"
885 fi
886else
887 AC_MSG_RESULT(rx)
888 AC_CHECK_FUNC(re_rx_search, , [LIBOBJS="$LIBOBJS rx.o"])
889fi
890AC_SUBST(LIBOBJS)dnl
891])
892
893dnl --- *@-AM_SANITY_CHECK-@*
894dnl
895dnl Author: Unknown
896dnl
897dnl Synopsis: AM_SANITY_CHECK
898dnl
899dnl Arguments: ---
900dnl
901dnl Use: Check for build environment sanity.
902
903AC_DEFUN(AM_SANITY_CHECK,
904[AC_MSG_CHECKING([whether build environment is sane])
905# Just in case
906sleep 1
907echo timestamp > conftestfile
908# Do `set' in a subshell so we don't clobber the current shell's
909# arguments. Must try -L first in case configure is actually a
910# symlink; some systems play weird games with the mod time of symlinks
911# (eg FreeBSD returns the mod time of the symlink's containing
912# directory).
913if (
914 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
915 if test "$@" = "X"; then
916 # -L didn't work.
917 set X `ls -t $srcdir/configure conftestfile`
918 fi
919 test "[$]2" = conftestfile
920 )
921then
922 # Ok.
923 :
924else
925 AC_MSG_ERROR([newly created file is older than distributed files!
926Check your system clock])
927fi
928rm -f conftest*
929AC_MSG_RESULT(yes)])
930
931dnl --- *@-AM_FUNC_STRDOD-@* ---
932dnl
933dnl Author: Jim Meyering
934dnl
935dnl Synopsis: AM_FUNC_STRTOD
936dnl
937dnl Arguments: ---
938dnl
939dnl Use: Checks for a working strtod function.
940
941## Copyright (C) 1996 Free Software Foundation, Inc.
942
943## This program is free software; you can redistribute it and/or modify
944## it under the terms of the GNU General Public License as published by
945## the Free Software Foundation; either version 2, or (at your option)
946## any later version.
947
948## This program is distributed in the hope that it will be useful,
949## but WITHOUT ANY WARRANTY; without even the implied warranty of
950## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
951## GNU General Public License for more details.
952
953## You should have received a copy of the GNU General Public License
954## along with this program; if not, write to the Free Software
955## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
956## 02111-1307, USA.
957
958## From Jim Meyering.
959
960## serial 1
961
962## @defmac AC_FUNC_STRTOD
963## @maindex FUNC_STRTOD
964## @ovindex LIBOBJS
965## If the @code{strtod} function is not available, or does not work
966## correctly (like the one on SunOS 5.4), add @samp{strtod.o} to output
967## variable @code{LIBOBJS}.
968## @end defmac
969
970AC_DEFUN(AM_FUNC_STRTOD,
971[AC_CACHE_CHECK(for working strtod, am_cv_func_strtod,
972[AC_TRY_RUN([
973double strtod ();
974int
975main()
976{
977 {
978 /* Some versions of Linux strtod mis-parse strings with leading '+'. */
979 char *string = " +69";
980 char *term;
981 double value;
982 value = strtod (string, &term);
983 if (value != 69 || term != (string + 4))
984 exit (1);
985 }
986
987 {
988 /* Under Solaris 2.4, strtod returns the wrong value for the
989 terminating character under some conditions. */
b91e2391 990 char *string = "NaN";
991 char *term;
992 strtod (string, &term);
993 if (term != string && *(term - 1) == 0)
994 exit (1);
995 }
996 exit (0);
997}
998], am_cv_func_strtod=yes, am_cv_func_strtod=no, am_cv_func_strtod=no)])
999test $am_cv_func_strtod = no && LIBOBJS="$LIBOBJS strtod.o"
1000AC_SUBST(LIBOBJS)dnl
1001am_cv_func_strtod_needs_libm=no
1002if test $am_cv_func_strtod = no; then
1003 AC_CHECK_FUNCS(pow)
1004 if test $ac_cv_func_pow = no; then
1005 AC_CHECK_LIB(m, pow, [am_cv_func_strtod_needs_libm=yes],
1006 [AC_MSG_WARN(can't find library containing definition of pow)])
1007 fi
1008fi
1009])
1010
1011dnl --- *@-AM_SYS_POSIX_TERMIOS-@* ---
1012dnl
1013dnl Author: Jim Meyering
1014dnl
1015dnl Synopsis: AM_SYS_POSIX_TERMIOS
1016dnl
1017dnl Arguments: ---
1018dnl
1019dnl Use: Checks for a POSIX termios.h.
1020
1021AC_DEFUN(AM_SYS_POSIX_TERMIOS,
1022[AC_CACHE_CHECK([POSIX termios], am_cv_sys_posix_termios,
1023 [AC_TRY_LINK([#include <sys/types.h>
1024#include <unistd.h>
1025#include <termios.h>],
1026 [/* SunOS 4.0.3 has termios.h but not the library calls. */
1027 tcgetattr(0, 0);],
1028 am_cv_sys_posix_termios=yes,
1029 am_cv_sys_posix_termios=no)])
1030])
1031
1032dnl----- Macros by Mark Wooding ------------------------------ *@--IGNORE--@*
1033
a80cb8cc 1034dnl --- *@-mdw_REQUIRE-@* ---
aaa99339 1035dnl
1036dnl Author: Mark Wooding
1037dnl
a80cb8cc 1038dnl Synopsis: mdw_REQUIRE(MACRO, ARGS...)
aaa99339 1039dnl
a80cb8cc 1040dnl Arguments: MACRO = name of a macro which should have been called
1041dnl ARGS = arguments to pass
aaa99339 1042dnl
a80cb8cc 1043dnl Use: Like `AC_REQUIRE', only it handles arguments.
aaa99339 1044
a80cb8cc 1045AC_DEFUN(mdw_REQUIRE,
17fc60ae 1046[ifdef([AC_PROVIDE_$1], ,
a80cb8cc 1047[AC_DIVERT_PUSH(builtin(eval, AC_DIVERSION_CURRENT - 1))dnl
1048indir($@)
1049AC_DIVERT_POP()dnl
1050])])
aaa99339 1051
1052dnl --- *@-mdw_CURSES-@* ---
1053dnl
1054dnl Author: Mark Wooding
1055dnl
1056dnl Synopsis: mdw_CURSES
1057dnl
1058dnl Arguments: ---
1059dnl
a80cb8cc 1060dnl Use: Searches for a `curses' library (one of `ncurses' or
1061dnl `curses') using mdw_CHECK_MANYLIBS. If one is found, the
1062dnl preprocessor macro HAVE_CURSES is defined, and a search is
1063dnl made for a `curses' header file (one of <ncurses.h>,
1064dnl <ncurses/ncurses.h> or <curses.h>) using AC_CHECK_HEADERS
1065dnl and the appropriate preprocessor symbol is defined.
1066dnl Finally, a check is made for the function `wresize' using
1067dnl AC_CHECK_FUNCS.
aaa99339 1068
1069AC_DEFUN(mdw_CURSES,
1070[mdw_CHECK_MANYLIBS(newwin, ncurses curses, AC_DEFINE(HAVE_CURSES))
1071if test $mdw_cv_lib_newwin != no; then
1072AC_CHECK_HEADERS([ncurses.h ncurses/ncurses.h curses.h], [break])
1073if test "$ac_cv_header_ncurses_h" = "no" &&
1074 test "$ac_cv_header_ncurses_ncurses_h" = "no" &&
1075 test "$ac_cv_header_curses_h" = "no"; then
1076 AC_MSG_WARN([couldn't find a \`curses' header. Assuming \`curses.h'.])
1077 AC_DEFINE(HAVE_CURSES_H)
1078fi
1079AC_CHECK_FUNCS(wresize)
1080fi])
1081
1082dnl --- *@-mdw_TYPE_SSIZE_T-@* ---
1083dnl
1084dnl Author: Mark Wooding
1085dnl
1086dnl Synopsis: mdw_TYPE_SSIZE_T
1087dnl
1088dnl Arguments: ---
1089dnl
a80cb8cc 1090dnl Use: Checks whether the Posix type `ssize_t' is defined. If not,
1091dnl it defaults to `int'.
aaa99339 1092
1093AC_DEFUN(mdw_TYPE_SSIZE_T,
a80cb8cc 1094[AC_REQUIRE([AC_HEADER_STDC])
1095AC_CACHE_CHECK(for ssize_t, mdw_cv_ssize_t,
aaa99339 1096[AC_EGREP_CPP(ssize_t,
1097[#include <sys/types.h>
1098#if HAVE_UNISTD_H
1099#include <unistd.h>
1100#endif
1101#if STDC_HEADERS
1102#include <stdlib.h>
1103#include <stddef.h>
1104#endif],
a80cb8cc 1105[mdw_cv_ssize_t=yes], [mdw_cv_ssize_t=no])])
1106if test $mdw_cv_ssize_t = no; then
aaa99339 1107 AC_DEFINE(ssize_t, int)
1108fi])
1109
6c1c6588 1110dnl --- *@-mdw_DECL_ENVIRON-@* ---
b91e2391 1111dnl
1112dnl Author: Mark Wooding
1113dnl
a80cb8cc 1114dnl Synopsis: mdw_DECL_ENVIRON
b91e2391 1115dnl
a80cb8cc 1116dnl Arguments: ---
b91e2391 1117dnl
a80cb8cc 1118dnl Use: Searches for a declaration of the global `environ' variable.
1119dnl If one is found in one of the `usual' places, DECL_ENVIRON
1120dnl is defined as a preprocessor symbol.
b91e2391 1121
a80cb8cc 1122AC_DEFUN(mdw_DECL_ENVIRON,
1123[AC_CACHE_CHECK([for declaration of \`environ'], mdw_cv_environ,
1124[AC_EGREP_CPP(environ,
1125[#include <sys/types.h>
1126#if HAVE_UNISTD_H
1127#include <unistd.h>
1128#endif
1129#if STDC_HEADERS
1130#include <stdlib.h>
1131#include <stddef.h>
1132#endif], [mdw_cv_environ=yes], [mdw_cv_environ=no])])
1133if test $mdw_cv_environ = yes; then
1134 AC_DEFINE(DECL_ENVIRON)
1135fi])
b91e2391 1136
1137dnl --- *@-mdw_CHECK_MANYLIBS-@* ---
1138dnl
1139dnl Author: Mark Wooding
1140dnl
37dec778 1141dnl Synopsis: mdw_CHECK_MANYLIBS(FUNC, LIBS, [IF-FOUND], [IF-NOT-FOUND],
1142dnl [INCLUDES], [ARGS])
b91e2391 1143dnl
1144dnl Arguments: FUNC = a function to try to find
1145dnl LIBS = a whitespace-separated list of libraries to search
1146dnl IF-FOUND = what to do when the function is found
1147dnl IF-NOT-FOUND = what to do when the function isn't found
37dec778 1148dnl INCLUDES = other include files to add
1149dnl ARGS = arguments to pass the function
b91e2391 1150dnl
1151dnl Use: Searches for a library which defines FUNC. It first tries
1152dnl without any libraries; then it tries each library specified
1153dnl in LIBS in turn. If it finds a match, it adds the
1154dnl appropriate library to `LIBS'.
1155dnl
1156dnl This is particularly handy under DIREIX: if you link with
1157dnl `-lnsl' then you get non-NIS-aware versions of getpwnam and
1158dnl so on, which is clearly a Bad Thing.
1159
1160AC_DEFUN(mdw_CHECK_MANYLIBS,
1161[AC_CACHE_CHECK([for library containing $1], [mdw_cv_lib_$1],
1162[mdw_save_LIBS="$LIBS"
1163mdw_cv_lib_$1="no"
37dec778 1164AC_TRY_LINK([$5], [$1($6)], [mdw_cv_lib_$1="none required"])
b91e2391 1165test "$mdw_cv_lib_$1" = "no" && for i in $2; do
1166LIBS="-l$i $mdw_save_LIBS"
37dec778 1167AC_TRY_LINK([$5], [$1($6)],
b91e2391 1168[mdw_cv_lib_$1="-l$i"
1169break])
1170done
1171LIBS="$mdw_save_LIBS"])
1172if test "$mdw_cv_lib_$1" != "no"; then
1173 test "$mdw_cv_lib_$1" = "none required" || LIBS="$mdw_cv_lib_$1 $LIBS"
1174 $3
1175else :
1176 $4
1177fi])
1178
1179dnl --- *@-mdw__PERL_VERSION-@* ---
1180dnl
1181dnl AC_DEFUN relies on `[', `]' being quotes, so I have to drop down a level.
1182
1183changequote(<<, >>)
1184define(mdw__PERL_VERSION, <<$1 -e 'exit ($] < $2);' >&5 2>&5>>)
1185changequote([, ])
1186
1187dnl --- *@-mdw_PROG_PERL-@* ---
1188dnl
1189dnl Author: Mark Wooding
1190dnl
1191dnl Synopsis: mdw_PROG_PERL(VERSION, [IF-FOUND], [IF-NOT-FOUND])
1192dnl
1193dnl Arguments: VERSION = version number of Perl required
1194dnl IF-FOUND = what to do if it's found
1195dnl IF-NOT-FOUND = what to do if it isn't
1196dnl
1197dnl Use: Attempts to find a working version of Perl with a late
1198dnl enough version number. It supplies an option `--with-perl'
1199dnl to allow the user to provide a Perl interpreter. If one
1200dnl isn't provided explicitly, it searches for `perl' and `perl5'
1201dnl in the current PATH, asking them whether they have a late
1202dnl enough version number. The path of the working Perl is
1203dnl put into the `PERL' environment variable; `AC_SUBST' is used
1204dnl to substitute its value into Perl scripts. If there is no
1205dnl Perl to be found, the value of `PERL' is set to be `none'.
1206
1207AC_DEFUN(mdw_PROG_PERL,
1208[AC_ARG_WITH([perl],
1209[ --with-perl=PERL specify path to Perl version $1 or newer],
1210[PERL="$withval"],
1211if test -z "$PERL"; then
1212[AC_CACHE_CHECK([for Perl version $1 or later], mdw_cv_prog_perl,
1213[mdw_cv_prog_perl="none"
1214for p in `echo "$PATH:/usr/local/bin" | tr ":" " "`; do
1215 case $p in /*) ;; *) p=`pwd`/$p ;; esac
1216 if mdw__PERL_VERSION(["$p/perl"], $1); then
1217 mdw_cv_prog_perl="$p/perl"
1218 break
1219 fi
1220 if mdw__PERL_VERSION(["$p/perl5"], $1); then
1221 mdw_cv_prog_perl="$p/perl5"
1222 break
1223 fi
1224done])
1225PERL="$mdw_cv_prog_perl"])
1226fi
1227
1228AC_SUBST(PERL)dnl
1229if test "$PERL" = "none"; then :
1230 $3
1231else :
1232 $2
1233fi])
1234
1235dnl --- *@-mdw_CHECK_PERL-@* ---
1236dnl
1237dnl Author: Mark Wooding
1238dnl
1239dnl Synopsis: mdw_CHECK_PERL(VERSION)
1240dnl
1241dnl Arguments: VERSION = version number of Perl required
1242dnl
1243dnl Use: Verifies that the Perl interpreter in the `PERL' shell
1244dnl variable actually works and is of the right version. If it's
1245dnl not, an error is raised and configuration is aborted.
1246
1247AC_DEFUN(mdw_CHECK_PERL,
1248[mdw_REQUIRE([mdw_PROG_PERL], [$1])
1249AC_MSG_CHECKING([whether Perl ($PERL) works])
1250if test "$PERL" != "none" && mdw__PERL_VERSION("$PERL", $1); then
1251 AC_MSG_RESULT([yes])
1252else
1253 AC_MSG_RESULT([no])
1254 AC_MSG_ERROR([Perl version $1 or newer not found.
1255If you have a recent enough Perl, and I just failed to find it, try using
1256the --with-perl=PERL option to give me an explicit pathname.])
1257fi])
1258
1259dnl --- *@-mdw_PERLLIB_CHECK-@* ---
1260dnl
1261dnl Author: Mark Wooding
1262dnl
1263dnl Synopsis: mdw_PERLLIB_CHECK(LIBRARY)
1264dnl
1265dnl Arguments: LIBRARY = name of a Perl library to check for
1266dnl
1267dnl Use: Ensures that a Perl script can `use LIBRARY;'. If it can,
1268dnl all's well and good; if it can't, `LIBRARY.pm' is added to
1269dnl the variable `NEEDED_PERLLIBS' and a line which adds
1270dnl `pkgdatadir' to Perl's `@INC' array is placed in the
1271dnl variable `INC_PERLLIBS'; `AC_SUBST' is called for both of
1272dnl these variables. It's expected that `NEEDED_PERLLIBS' will
1273dnl be used in the `Makefile.in' to decide which versions from
1274dnl the distribution need installing.
1275dnl
1276dnl This macro isn't terribly useful in the general case. It
1277dnl Also implicitly assumes that `$PERL' is Perl 5 or later.
1278
1279AC_DEFUN(mdw__PERLLIB_INIT,
1280[AC_SUBST(INC_PERLLIBS)dnl
1281AC_SUBST(NEEDED_PERLLIBS)dnl
1282])
1283
1284AC_DEFUN(mdw_PERLLIB_CHECK,
1285[AC_REQUIRE([mdw__PERLLIB_INIT])
1286mdw_REQUIRE([mdw_CHECK_PERL], 5)
1287AC_CACHE_CHECK([for Perl library $1], mdw_cv_perllib_$1,
1288[if $PERL -e 'use $1;' >&5 2>&5; then
1289 mdw_cv_perllib_$1="yes"
1290else
1291 mdw_cv_perllib_$1="no"
1292fi])
1293
1294if test "$mdw_cv_perllib_$1" = "no"; then
1295 NEEDED_PERLLIBS="$NEEDED_PERLLIBS $1.pm"
1296
1297 # --- Deal with autoconf lossage ---
1298 #
1299 # It doesn't want to define `prefix' until rather later on, so I have
1300 # to bodge it here.
1301
1302 if test -z "$INC_PERLLIBS"; then
1303 mdw_old_prefix="$prefix"
1304 test "$prefix" = "NONE" && prefix="$ac_default_prefix";
1305 INC_PERLLIBS="BEGIN { push @INC, \"`eval echo $datadir/$PACKAGE`\"; }"
1306 prefix="$mdw_old_prefix";
1307 fi
1308fi])
1309
1310dnl --- *@-mdw_GCC_FLAGS-@* ---
1311dnl
1312dnl Author: Mark Wooding
1313dnl
1314dnl Synopsis: mdw_GCC_FLAGS([FLAGS], [CFLAGS], [C++FLAGS])
1315dnl
1316dnl Arguments: FLAGS = GCC compiler flags to add (default is
1317dnl `-pedantic -Wall')
1318dnl CFLAGS = GCC C compiler flags to add (default is empty)
1319dnl C++FLAGS = GCC C++ compiler flags to add (default is
1320dnl `-fhandle-exceptions').
1321dnl
1322dnl Use: If the C compiler is GCC, add the compiler flags.
1323
1324AC_DEFUN(mdw_GCC_FLAGS,
1325[if test "$GCC" = "yes"; then
1326 CFLAGS="$CFLAGS ifelse([$1], [], [-pedantic -Wall], [$1])"
1327 CFLAGS="$CFLAGS ifelse([$2], [], [], [$2])"
1328fi
1329if test "$GXX" = "yes"; then
1330 CXXFLAGS="$CXXFLAGS ifelse([$1], [], [-pedantic -Wall], [$1])"
1331 CXXFLAGS="$CXXFLAGS ifelse([$3], [], [-fhandle-exceptions], [$3])"
1332fi])
1333
08f6362d 1334dnl *@-mdw_INIT_LIB-@*
17fc60ae 1335dnl
1336dnl Author: Mark Wooding
1337dnl
08f6362d 1338dnl Synopsis: mdw_INIT_LIB(LIB, NAME, VERSION, [PACKAGE])
17fc60ae 1339dnl
08f6362d 1340dnl Arguments: LIB = the name of the library (and the package)
1341dnl NAME = a presentable version of the library's name
1342dnl VERSION = version of the library
1343dnl PACKAGE = package name to pass on to AM_INIT_AUTOMAKE
1344dnl
1345dnl Use: Sets up various useful variables. This macro calls
1346dnl AM_INIT_AUTOMAKE, which might be considered useful. It also
1347dnl provides variables for the use of `lib-config.in'.
1348
1349AC_DEFUN([mdw_INIT_LIB],
1350[AM_INIT_AUTOMAKE(ifelse([$4], [], [$1], [$4]), [$3])
1351LIBRARY="$1" AC_SUBST(LIBRARY)
1352LIBNAME="$2" AC_SUBST(LIBNAME)])
1353
1354dnl *@-mdw_LIB_CONFIG-@*
1355dnl
1356dnl Author: Mark Wooding
1357dnl
1358dnl Synopsis: mdw_LIB_CONFIG(LIB, NAME, VERSION, IF-FOUND, IF-NOT-FOUND)
1359dnl
1360dnl Arguments: LIB = the name of the library (and its configuration program)
1361dnl NAME = a presentable version of the library's name
1362dnl VERSION = version of library required
17fc60ae 1363dnl IF-FOUND = what to do if found
1364dnl IF-NOT-FOUND = what to do if not found
1365dnl
08f6362d 1366dnl Use: Configures a library client program, using a configuration
1367dnl script provided by the library maintainer.
1368dnl
1369dnl The default version is 1.0.0pre0; the default action is to
1370dnl add everything to the CFLAGS and LIBS variables, and complain
17fc60ae 1371dnl if the library couldn't be found.
1372dnl
08f6362d 1373dnl The variable LIB_VERSION contains the version number of
1374dnl the library; LIB_CFLAGS is the C compiler flags required
1375dnl and LIB_LIBS is the linker flags.
1376
1377AC_DEFUN([mdw_LIB_CONFIG],
1378[pushdef([upname], translit([$1], [a-z], [A-Z]))dnl
1379AC_MSG_CHECKING([for $2 library])
1380if $1-config --check $3 >/dev/null 2>&1; then
1381 upname[]_VERSION=`$1-config --version`
1382 upname[]_CFLAGS=`$1-config --cflags`
1383 upname[]_LIBS=`$1-config --libs`
1384 AC_SUBST(upname[]_VERSION)
1385 AC_SUBST(upname[]_CFLAGS)
1386 AC_SUBST(upname[]_LIBS)
1387 ifelse([$4], [],
1388 [CFLAGS="$CFLAGS $upname[]_CFLAGS"
1389 LIBS="$upname[]_LIBS $LIBS"],
1390 $4)
1391 AC_MSG_RESULT([$upname[]_VERSION])
17fc60ae 1392else
08f6362d 1393 ifelse([$5], [],
1394 AC_MSG_ERROR([$2 library not found or too old.]),
1395 $5)
17fc60ae 1396 AC_MSG_RESULT([not found])
191b8aaf 1397fi
1398popdef([upname])])
17fc60ae 1399
08f6362d 1400dnl *@-mdw_MLIB-@*
5a27eb4e 1401dnl
1402dnl Author: Mark Wooding
1403dnl
08f6362d 1404dnl Synopsis: mdw_MLIB(VERSION, IF-FOUND, IF-NOT-FOUND
5a27eb4e 1405dnl
1406dnl Arguments: VERSION = version of library required
1407dnl IF-FOUND = what to do if found
1408dnl IF-NOT-FOUND = what to do if not found
1409dnl
08f6362d 1410dnl Use: Configures an mLib client program.
5a27eb4e 1411
08f6362d 1412AC_DEFUN([mdw_MLIB], [mdw_LIB_CONFIG(mLib, mLib, $@)])
5a27eb4e 1413
08f6362d 1414dnl *@-mdw_MGLIB-@*
5ba1b8b8 1415dnl
1416dnl Author: Mark Wooding
1417dnl
08f6362d 1418dnl Synopsis: mdw_MGLIB(VERSION, IF-FOUND, IF-NOT-FOUND
5ba1b8b8 1419dnl
1420dnl Arguments: VERSION = version of library required
1421dnl IF-FOUND = what to do if found
1422dnl IF-NOT-FOUND = what to do if not found
1423dnl
08f6362d 1424dnl Use: Configures an mgLib client program.
1425
1426AC_DEFUN([mdw_MGLIB],
1427[mdw_REQUIRE([mdw_MLIB], [1.6.0])
1428mdw_LIB_CONFIG(mgLib, mgLib, $@)])
5ba1b8b8 1429
17fc60ae 1430dnl *@-mdw_CATACOMB-@*
1431dnl
1432dnl Author: Mark Wooding
1433dnl
1434dnl Synopsis: mdw_CATACOMB([VERSION], [IF-FOUND], [IF-NOT-FOUND])
1435dnl
1436dnl Arguments: VERSION = version of Catacomb required
1437dnl IF-FOUND = what to do if found
1438dnl IF-NOT-FOUND = what to do if not found
1439dnl
08f6362d 1440dnl Use: Configures the program as a Catacomb client.
17fc60ae 1441
1442AC_DEFUN([mdw_CATACOMB],
5a27eb4e 1443[mdw_REQUIRE([mdw_MLIB], [1.6.0])
08f6362d 1444mdw_LIB_CONFIG(catacomb, Catacomb, $@)])
1445
1446dnl *@-mdw_PK-@*
1447dnl
1448dnl Author: Mark Wooding
1449dnl
1450dnl Synopsis: mdw_PK([VERSION], [IF-FOUND], [IF-NOT-FOUND])
1451dnl
1452dnl Arguments: VERSION = version of PK required
1453dnl IF-FOUND = what to do if found
1454dnl IF-NOT-FOUND = what to do if not found
1455dnl
1456dnl Use: Configures the program as a PK client.
1457
1458AC_DEFUN([mdw_PK],
1459[mdw_REQUIRE([mdw_MLIB], [1.6.0])
1460mdw_LIB_CONFIG(pk, PK, $@)])
17fc60ae 1461
b91e2391 1462dnl --- *@-mdw_OPT_NDEBUG-@* ---
1463dnl
1464dnl Author: Mark Wooding
1465dnl
1466dnl Synopsis: mdw_OPT_NDEBUG
1467dnl
1468dnl Arguments: ---
1469dnl
7a1aef7d 1470dnl Use: Turns on the `NDEBUG' flag, to disable useful things like
1471dnl assertions.
b91e2391 1472
1473AC_DEFUN(mdw_OPT_NDEBUG,
1474[AC_ARG_ENABLE(debugging,
7a1aef7d 1475[ --disable-debugging spews vast swathes of useless information],
b91e2391 1476[if test "$enableval" = "no"; then
1477 AC_DEFINE(NDEBUG, 1)
7a1aef7d 1478fi])])
b91e2391 1479
1480dnl --- *@-mdw_OPT_EFENCE-@* ---
1481dnl
1482dnl Author: Mark Wooding
1483dnl
1484dnl Synopsis: mdw_OPT_EFENCE
1485dnl
1486dnl Arguments: ---
1487dnl
1488dnl Use: Links with the Electric Fence library.
1489
1490AC_DEFUN(mdw_OPT_EFENCE,
1491[AC_ARG_WITH(electric-fence,
1492[ --with-electric-fence link programs with Electric Fence],
1493[if test "$withval" = "yes"; then
1494 AC_CHECK_LIB(efence, malloc)
1495fi])])
1496
7a1aef7d 1497dnl --- *@-mdw_OPT_TRACE-@* ---
b91e2391 1498dnl
1499dnl Author: Mark Wooding
1500dnl
7a1aef7d 1501dnl Synopsis: mdw_OPT_TRACE
b91e2391 1502dnl
1503dnl Arguments: ---
1504dnl
7a1aef7d 1505dnl Use: Turns on the `NTRACE' flag, to disable useful things like
1506dnl trace outputs.
1507
1508AC_DEFUN(mdw_OPT_TRACE,
1509[AC_ARG_ENABLE(tracing,
1510[ --disable-tracing disable output of trace information],
1511[if test "$enableval" = "no"; then
1512 AC_DEFINE(NTRACE, 1)
1513fi])])
1514
1515dnl --- *@-mdw_OPT_mLib_TRACK-@* ---
1516dnl
1517dnl Author: Mark Wooding
1518dnl
1519dnl Synopsis: mdw_OPT_mLib_TRACK(PROGRAM)
1520dnl
1521dnl Arguments: PROGRAM = name of this program or package.
1522dnl
1523dnl Use: Controls the unsupported mLib memory tracker. The
b91e2391 1524dnl following are defined:
1525dnl
b91e2391 1526dnl --enable-track turns on malloc tracking
1527dnl --enable-blame-PROGRAM tracks malloc contexts in PROGRAM
1528dnl
7a1aef7d 1529dnl There must be a separate `blame' option for each program,
1530dnl so that the various blame options in a hierarchy get
1531dnl propagated properly. This is an obsolete feature from the
1532dnl days when mLib was provided as a subdirectory of other
1533dnl packages.
b91e2391 1534
7a1aef7d 1535AC_DEFUN(mdw_OPT_mLib_TRACK,
1536[AC_REQUIRE([mdw_OPT_TRACE])
b91e2391 1537AC_ARG_ENABLE(track,
1538[ --enable-track enable tracking of malloc and free],
1539[AC_DEFINE(TRACK_ENABLE, 1)])
b91e2391 1540AC_ARG_ENABLE(blame-$1,
1541[ --enable-blame-$1
1542 track malloc contexts while in $1],
1543[AC_DEFINE(TRACK_BLAME, 1)])])
1544
7a1aef7d 1545dnl --- *@-mdw_OPT_mLib_DEBUG-@* ---
1546dnl
1547dnl Author: Mark Wooding
1548dnl
1549dnl Synopsis: mdw_OPT_mLib_DEBUG(PROGRAM)
1550dnl
1551dnl Arguments: PROGRAM = name of this program or package.
1552dnl
1553dnl Use: Provides all of the above debugging options.
1554
1555AC_DEFUN(mdw_OPT_mLib_DEBUG,
1556[mdw_REQUIRE([mdw_OPT_NDEBUG])
1557mdw_REQUIRE([mdw_OPT_mLib_TRACK], [$1])])
1558
b91e2391 1559dnl----- That's all, folks --------------------------------- *@--GLOB-END--@*