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