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