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