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