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