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