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