Fix stupid bug which only read one word from environment variables.
[cfd] / aclocal.glob
CommitLineData
b91e2391 1dnl -*-fundamental-*- *@--GLOB-HEADER--@*
2dnl
5b59e227 3dnl $Id: aclocal.glob,v 1.2 1999/05/13 22:57:23 mdw Exp $
b91e2391 4dnl
5dnl Common library of autoconf macros
6dnl
7dnl (c) 1997 Mark Wooding, except for macros and documentation where noted.
8dnl
9
10dnl----- Licensing notice ---------------------------------------------------
11dnl
12dnl This file is part of the Common Files Distribution (`common')
13dnl
14dnl `Common' is free software; you can redistribute it and/or modify
15dnl it under the terms of the GNU General Public License as published by
16dnl the Free Software Foundation; either version 2 of the License, or
17dnl (at your option) any later version.
18dnl
19dnl `Common' is distributed in the hope that it will be useful,
20dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
21dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22dnl GNU General Public License for more details.
23dnl
24dnl You should have received a copy of the GNU General Public License
25dnl along with `common'; if not, write to the Free Software Foundation,
26dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27
28dnl----- Revision history ---------------------------------------------------
29dnl
30dnl $Log: aclocal.glob,v $
5b59e227 31dnl Revision 1.2 1999/05/13 22:57:23 mdw
32dnl Change `-ise' to `-ize' throughout.
33dnl
34dnl Revision 1.1.1.1 1999/05/05 19:23:47 mdw
35dnl New import. The old CVS repository was lost in a disk disaster.
b91e2391 36dnl
37
38dnl----- Common files distribution --------------------------- *@--NOTICE--@*
39dnl
5b59e227 40dnl $Id: aclocal.glob,v 1.2 1999/05/13 22:57:23 mdw Exp $
b91e2391 41
42dnl --- *@-AC_PROG_CC_STDC-@* ---
43dnl
44dnl Author: Franc,ois Pinard
45dnl
46dnl Synopsis: AC_PROG_CC_STDC
47dnl
48dnl Arguments: ---
49dnl
50dnl Use: If the C compiler in not in ANSI C mode by default, try to
51dnl add an option to output variable `CC' to make it so. This
52dnl macro tries various options that select ANSI C on some system
53dnl or another. It considers the compiler to be in ANSI C mode
54dnl if it defines `__STDC__' to 1 and handles function prototypes
55dnl correctly.
56dnl
57dnl If you use this macro, you should check after calling it
58dnl whether the C compiler has been set to accept ANSI C; if not,
59dnl the shell variable `ac_cv_prog_cc_stdc' is set to `no'. If
60dnl you wrote your source code in ANSI C, you can make an
61dnl un-ANSIfied copy of it by using the program `ansi2knr', which
62dnl comes with Ghostscript.
63dnl
64dnl (documentation by Franc,ois Pinard)
65
66AC_DEFUN(AM_PROG_CC_STDC,
67[AC_REQUIRE([AC_PROG_CC])
68AC_BEFORE([$0], [AC_C_INLINE])
69AC_BEFORE([$0], [AC_C_CONST])
70AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
71AC_CACHE_VAL(am_cv_prog_cc_stdc,
72[am_cv_prog_cc_stdc=no
73ac_save_CC="$CC"
74# Don't try gcc -ansi; that turns off useful extensions and
75# breaks some systems' header files.
76# AIX -qlanglvl=ansi
77# Ultrix and OSF/1 -std1
78# HP-UX -Aa -D_HPUX_SOURCE
79# SVR4 -Xc -D__EXTENSIONS__
80for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
81do
82 CC="$ac_save_CC $ac_arg"
83 AC_TRY_COMPILE(
84[#if !defined(__STDC__) || __STDC__ != 1
85choke me
86#endif
87/* DYNIX/ptx V4.1.3 can't compile sys/stat.h with -Xc -D__EXTENSIONS__. */
88#ifdef _SEQUENT_
89# include <sys/types.h>
90# include <sys/stat.h>
91#endif
92], [
93int test (int i, double x);
94struct s1 {int (*f) (int a);};
95struct s2 {int (*f) (double a);};],
96[am_cv_prog_cc_stdc="$ac_arg"; break])
97done
98CC="$ac_save_CC"
99])
100if test -z "$am_cv_prog_cc_stdc"; then
101 AC_MSG_RESULT([none needed])
102else
103 AC_MSG_RESULT($am_cv_prog_cc_stdc)
104fi
105case "x$am_cv_prog_cc_stdc" in
106 x|xno) ;;
107 *) CC="$CC $am_cv_prog_cc_stdc" ;;
108esac
109])
110
111dnl----- AutoMake macros ------------------------------------- *@--IGNORE--@*
112
113dnl --- *@-AM_CONDITIONAL-@* ---
114dnl
115dnl Author: Unknown
116dnl
117dnl Synopsis: AM_CONDITIONAL(NAME, TEST)
118dnl
119dnl Arguments: NAME = name of the conditional
120dnl TEST = a shell list to execute
121dnl
122dnl Use: Allows conditional sections in Makefiles.
123
124AC_DEFUN(AM_CONDITIONAL,
125[AC_SUBST($1_TRUE)
126AC_SUBST($1_FALSE)
127if $2; then
128 $1_TRUE=
129 $1_FALSE='#'
130else
131 $1_TRUE='#'
132 $1_FALSE=
133fi])
134
135dnl --- *@-AM_CYGWIN32-@* ---
136dnl
137dnl Author: Cygnus (I guess)
138dnl
139dnl Synopsis: AM_CYGWIN32
140dnl
141dnl Arguments: ---
142dnl
143dnl Use: Check to see if we're running under Cygwin32, without using
144dnl AC_CANONICAL_*. If so, set output variable EXEEXT to
145dnl ".exe". Otherwise set it to "".
146
147dnl AM_CYGWIN32()
148dnl You might think we can do this by checking for a cygwin32-specific
149dnl cpp define. We can't, because cross-compilers that target
150dnl cygwin32 don't use the .exe suffix. I don't know why.
151AC_DEFUN(AM_CYGWIN32,
152[AC_CACHE_CHECK(for Cygwin32 environment, am_cv_cygwin32,
153[cat > conftest.$ac_ext << 'EOF'
154int main () {
155/* Nothing. */
156return 0; }
157EOF
158if AC_TRY_EVAL(ac_link) && test -s conftest.exe; then
159 am_cv_cygwin32=yes
160else
161 am_cv_cygwin32=no
162fi
163rm -f conftest*])
164EXEEXT=
165test "$am_cv_cygwin32" = yes && EXEEXT=.exe
166AC_SUBST(EXEEXT)])
167
168dnl --- *@-AM_WITH_DMALLOC-@* ---
169dnl
170dnl Author: Franc,ois Pinard
171dnl
172dnl Synopsis: AM_WITH_DMALLOC
173dnl
174dnl Arguments: ---
175dnl
176dnl Use: Links with `-dmalloc' if told to by the user.
177
178## ----------------------------------- ##
179## Check if --with-dmalloc was given. ##
180## From Franc,ois Pinard ##
181## ----------------------------------- ##
182
183# serial 1
184
185AC_DEFUN(AM_WITH_DMALLOC,
186[AC_MSG_CHECKING(if malloc debugging is wanted)
187AC_ARG_WITH(dmalloc,
188[ --with-dmalloc use dmalloc, as in
189 ftp://ftp.letters.com/src/dmalloc/dmalloc.tar.gz],
190[if test "$withval" = yes; then
191 AC_MSG_RESULT(yes)
192 AC_DEFINE(WITH_DMALLOC)
193 LIBS="$LIBS -ldmalloc"
194 LDFLAGS="$LDFLAGS -g"
195else
196 AC_MSG_RESULT(no)
197fi], [AC_MSG_RESULT(no)])
198])
199
200dnl --- *@-AM_FUNC_ERROR_AT_LINE-@* ---
201dnl
202dnl Author: Jim Meyering
203dnl
204dnl Synopsis: AM_FUNC_ERROR_AT_LINE
205dnl
206dnl Arguments: ---
207dnl
208dnl Use: Use this if you use the GNU error.[ch].
209
210dnl FIXME: Migrate into libit
211
212AC_DEFUN(AM_FUNC_ERROR_AT_LINE,
213[AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line,
214 [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");],
215 am_cv_lib_error_at_line=yes,
216 am_cv_lib_error_at_line=no)])
217 if test $am_cv_lib_error_at_line = no; then
218 LIBOBJS="$LIBOBJS error.o"
219 fi
220 AC_SUBST(LIBOBJS)dnl
221])
222
223dnl --- *@-AM_INIT_GUILE_MODULE-@* ---
224dnl
225dnl Author: Unknown
226dnl
227dnl Synopsis: AM_INIT_GUILE_MODULE(MODNAME)
228dnl
5b59e227 229dnl Arguments: MODNAME = value to initialize `module' variable with
b91e2391 230dnl
231dnl Use: This macro will automatically get the guile version from the
232dnl top-level srcdir, and will initialize automake. It also
233dnl defines the `module' variable.
234
235AC_DEFUN([AM_INIT_GUILE_MODULE],[
236. $srcdir/../GUILE-VERSION
237AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
238AC_CONFIG_AUX_DIR(..)
239module=[$1]
240AC_SUBST(module)])
241
242dnl --- *@-AM_CONFIG_HEADER-@* ---
243dnl
244dnl Author: Unknown
245dnl
246dnl Synopsis: AM_CONFIG_HEADER(HEADER ...)
247dnl
248dnl Arguments: HEADER = a header spec, as for AC_CONFIG_HEADER
249dnl
250dnl Use: Like AC_CONFIG_HEADER, but automatically create stamp file.
251
252AC_DEFUN(AM_CONFIG_HEADER,
253[AC_PREREQ([2.12])
254AC_CONFIG_HEADER([$1])
255dnl When config.status generates a header, we must update the stamp-h file.
256dnl This file resides in the same directory as the config header
257dnl that is generated. We must strip everything past the first ":",
258dnl and everything past the last "/".
259AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
260ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
261<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/
262\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
263<<am_indx=1
264for am_file in <<$1>>; do
265 case " <<$>>CONFIG_HEADERS " in
266 *" <<$>>am_file "*<<)>>
267 echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
268 ;;
269 esac
270 am_indx=`expr "<<$>>am_indx" + 1`
271done<<>>dnl>>)
272changequote([,]))])
273
274dnl --- *@-AM_INIT_AUTOMAKE-@*
275dnl
276dnl Author: Unknown
277dnl
278dnl Synopsis: AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
279dnl
280dnl Arguments: PACKAGE = package name
281dnl VERSION = version number
282dnl NO-DEFINE = if set, don't define package and version number
283dnl
284dnl Use: Do all the work for Automake. This macro actually does too
285dnl much -- some checks are only needed if your package does
286dnl certain things. But this isn't really a big deal.
287
288# serial 1
289
290AC_DEFUN(AM_INIT_AUTOMAKE,
291[AC_REQUIRE([AM_PROG_INSTALL])
292PACKAGE=[$1]
293AC_SUBST(PACKAGE)
294VERSION=[$2]
295AC_SUBST(VERSION)
296dnl test to see if srcdir already configured
297if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
298 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
299fi
300ifelse([$3],,
301AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
302AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
303AM_SANITY_CHECK
304AC_ARG_PROGRAM
305dnl FIXME This is truly gross.
306missing_dir=`cd $ac_aux_dir && pwd`
307AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
308AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
309AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
310AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
311AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
312AC_PROG_MAKE_SET])
313
314dnl --- *@-AM_PROG_INSTALL-@* ---
315dnl
316dnl Author: Franc,ois Pinard
317dnl
318dnl Synopsis: AM_PROG_INSTALL
319dnl
320dnl Arguments: ---
321dnl
322dnl Use: Calls `AC_PROG_INSTALL' to find an installer. Then it sets
323dnl `INSTALL_SCRIPT' to a suitable value if necessary.
324
325# serial 1
326
327AC_DEFUN(AM_PROG_INSTALL,
328[AC_PROG_INSTALL
329test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL} -m 755'
330AC_SUBST(INSTALL_SCRIPT)dnl
331])
332
333dnl --- *@-AM_PROG_LEX-@* ---
334dnl
335dnl Author: Alexandre Oliva
336dnl
337dnl Synopsis: AM_PROG_LEX
338dnl
339dnl Arguments: ---
340dnl
341dnl Use: Replacement for AC_PROG_LEX and AC_DECL_YYTEXT
342
343dnl AM_PROG_LEX
344dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT
345AC_DEFUN(AM_PROG_LEX,
346[missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1)
347AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex")
348AC_PROG_LEX
349AC_DECL_YYTEXT])
350
351dnl --- *@-AM_PROG_LIBTOOL-@* ---
352dnl
353dnl Author: Unknown
354dnl
355dnl Synopsis: AM_PROG_LIBTOOL
356dnl
357dnl Arguments: ---
358dnl
359dnl Use: Configures `libtool' for the target architecture.
360
361##
362## Configure libtool for the target system.
363##
364# serial 1 AM_PROG_LIBTOOL
365AC_DEFUN(AM_PROG_LIBTOOL,
366[AC_REQUIRE([AC_CANONICAL_HOST])
367AC_REQUIRE([AC_PROG_CC])
368AC_REQUIRE([AC_PROG_RANLIB])
369
370# Always use our own libtool.
371LIBTOOL='$(top_builddir)/libtool'
372AC_SUBST(LIBTOOL)
373
374dnl Allow the --disable-shared flag to stop us from building shared libs.
375AC_ARG_ENABLE(shared,
376[ --enable-shared build shared libraries [default=yes]],
377test "$enableval" = no && libtool_shared=" --disable-shared",
378libtool_shared=)
379
380libtool_flags="$libtool_shared"
381test "$silent" = yes && libtool_flags="$libtool_flags --silent"
382test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
383
384# Actually configure libtool. ac_aux_dir is where install-sh is found.
385CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" LD="$LD" RANLIB="$RANLIB" \
386$ac_aux_dir/ltconfig $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
387|| AC_MSG_ERROR([libtool configure failed])
388])
389
390dnl --- *@-AM_PATH_LISPDIR-@* ---
391dnl
392dnl Author: Ulrich Drepper
393dnl
394dnl Synopsis: AM_PATH_LISPDIR
395dnl
396dnl Arguments: ---
397dnl
398dnl Use: Sets the variable `lispdir' to point to a place to install
399dnl Emacs lisp files.
400
401## ------------------------
402## Emacs LISP file handling
403## From Ulrich Drepper
404## ------------------------
405
406# serial 1
407
408AC_DEFUN(AM_PATH_LISPDIR,
409 [# If set to t, that means we are running in a shell under Emacs.
410 # If you have an Emacs named "t", then use the full path.
411 test "$EMACS" = t && EMACS=
412 AC_PATH_PROG(EMACS, emacs xemacs, no)
413 if test $EMACS != "no"; then
414 AC_MSG_CHECKING([where .elc files should go])
415 dnl Set default value
416 lispdir="\$(datadir)/emacs/site-lisp"
417 if test "x$prefix" = "xNONE"; then
418 if test -d $ac_default_prefix/share/emacs/site-lisp; then
419 lispdir="\$(prefix)/share/emacs/site-lisp"
420 else
421 if test -d $ac_default_prefix/lib/emacs/site-lisp; then
422 lispdir="\$(prefix)/lib/emacs/site-lisp"
423 fi
424 fi
425 else
426 if test -d $prefix/share/emacs/site-lisp; then
427 lispdir="\$(prefix)/share/emacs/site-lisp"
428 else
429 if test -d $prefix/lib/emacs/site-lisp; then
430 lispdir="\$(prefix)/lib/emacs/site-lisp"
431 fi
432 fi
433 fi
434 AC_MSG_RESULT($lispdir)
435 fi
436 AC_SUBST(lispdir)])
437
438dnl --- *@-AM_MAINTAINTER_MODE-@* ---
439dnl
440dnl Author: Jim Meyering
441dnl
442dnl Synopsis: jm_MAINTAINER_MODE
443dnl
444dnl Arguments: ---
445dnl
446dnl Use: Provides an option `--enable-maintainer-mode' which turns
447dnl on rules which might normally be commented out. The
448dnl substitution variable `MAINT' is set to be a comment when
449dnl this option is disabled, which it is by default.
450
451# serial 1
452
453AC_DEFUN(AM_MAINTAINER_MODE,
454[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
455 dnl maintainer-mode is disabled by default
456 AC_ARG_ENABLE(maintainer-mode,
457[ --enable-maintainer-mode enable make rules and dependencies not useful
458 (and sometimes confusing) to the casual installer],
459 USE_MAINTAINER_MODE=$enableval,
460 USE_MAINTAINER_MODE=no)
461 AC_MSG_RESULT($USE_MAINTAINER_MODE)
462 if test $USE_MAINTAINER_MODE = yes; then
463 MAINT=
464 else
465 MAINT='#M#'
466 fi
467 AC_SUBST(MAINT)dnl
468]
469)
470
471dnl --- *@-AM_MISSING_PROG-@* ---
472dnl
473dnl Author: Unknown
474dnl
475dnl Synopsis: AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
476dnl
477dnl Arguments: NAME = variable to set to the file's location
478dnl PROGRAM = name of program to find
479dnl DIRECTORY = directory to look in
480dnl
481dnl Use: Fakes existence of a useful GNU maintainer tool.
482
483AC_DEFUN(AM_MISSING_PROG,
484[AC_MSG_CHECKING(for working $2)
485# Run test in a subshell; some versions of sh will print an error if
486# an executable is not found, even if stderr is redirected.
487# Redirect stdin to placate older versions of autoconf. Sigh.
488if ($2 --version) < /dev/null > /dev/null 2>&1; then
489 $1=$2
490 AC_MSG_RESULT(found)
491else
492 $1="$3/missing $2"
493 AC_MSG_RESULT(missing)
494fi
495AC_SUBST($1)])
496
497dnl --- *@-AM_FUNC_MKTIME-@* ---
498dnl
499dnl Author: Jim Meyering
500dnl
501dnl Synopsis: AM_FUNC_MKTIME
502dnl
503dnl Arguments: ---
504dnl
505dnl Use: Checks for a working mktime function.
506
507AC_DEFUN(AM_FUNC_MKTIME,
508[AC_REQUIRE([AC_HEADER_TIME])dnl
509 AC_CHECK_HEADERS(sys/time.h)
510 AC_CACHE_CHECK([for working mktime], am_cv_func_working_mktime,
511 [AC_TRY_RUN(
512changequote(<<, >>)dnl
513<</* Test program from Paul Eggert (eggert@twinsun.com)
514 and Tony Leneis (tony@plaza.ds.adp.com). */
515#if TIME_WITH_SYS_TIME
516# include <sys/time.h>
517# include <time.h>
518#else
519# if HAVE_SYS_TIME_H
520# include <sys/time.h>
521# else
522# include <time.h>
523# endif
524#endif
525
526static time_t time_t_max;
527
528/* Values we'll use to set the TZ environment variable. */
529static const char *const tz_strings[] = {
530 NULL, "GMT0", "JST-9", "EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00"
531};
532#define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0]))
533
534static void
535mktime_test (now)
536 time_t now;
537{
538 if (mktime (localtime (&now)) != now)
539 exit (1);
540 now = time_t_max - now;
541 if (mktime (localtime (&now)) != now)
542 exit (1);
543}
544
545int
546main ()
547{
548 time_t t, delta;
549 int i;
550
551 for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2)
552 continue;
553 time_t_max--;
554 delta = time_t_max / 997; /* a suitable prime number */
555 for (i = 0; i < N_STRINGS; i++)
556 {
557 if (tz_strings[i])
558 putenv (tz_strings[i]);
559
560 for (t = 0; t <= time_t_max - delta; t += delta)
561 mktime_test (t);
562 mktime_test ((time_t) 60 * 60);
563 mktime_test ((time_t) 60 * 60 * 24);
564 }
565 exit (0);
566}
567 >>,
568changequote([, ])dnl
569 am_cv_func_working_mktime=yes, am_cv_func_working_mktime=no,
570 dnl When crosscompiling, assume mktime is missing or broken.
571 am_cv_func_working_mktime=no)
572 ])
573 if test $am_cv_func_working_mktime = no; then
574 LIBOBJS="$LIBOBJS mktime.o"
575 fi
576])
577
578dnl --- *@-AM_FUNC_OBSTACK-@* ---
579dnl
580dnl Author: Jim Meyering
581dnl
582dnl Synopsis: AM_FUNC_OBSTACK
583dnl
584dnl Arguments: ---
585dnl
586dnl Use: Checks for GNU obstacks.
587
588AC_DEFUN(AM_FUNC_OBSTACK,
589[AC_CACHE_CHECK([for obstacks], am_cv_func_obstack,
590 [AC_TRY_LINK([#include "obstack.h"],
591 [struct obstack *mem;obstack_free(mem,(char *) 0)],
592 am_cv_func_obstack=yes,
593 am_cv_func_obstack=no)])
594 if test $am_cv_func_obstack = yes; then
595 AC_DEFINE(HAVE_OBSTACK)
596 else
597 LIBOBJS="$LIBOBJS obstack.o"
598 fi
599])
600
601dnl --- *@-AC_C_PROTOTYPES-@* ---
602dnl
603dnl Author: Franc,ois Pinard
604dnl
605dnl Synopsis: AC_C_PROTOTYPES
606dnl
607dnl Arguments: ---
608dnl
609dnl Use: If the C compiler understands ANSI C, define `PROTOTYPES',
610dnl and clear the `U' and `ANSI2KNR' variables. Otherwise,
611dnl set `U' to be `_' and `ANSI2KNR' to be `./ansi2knr'.
612
613# serial 1
614
615AC_DEFUN(fp_C_PROTOTYPES,
616[AC_REQUIRE([fp_PROG_CC_STDC])
617AC_MSG_CHECKING([for function prototypes])
618if test "$ac_cv_prog_cc_stdc" != no; then
619 AC_MSG_RESULT(yes)
620 AC_DEFINE(PROTOTYPES)
621 U= ANSI2KNR=
622else
623 AC_MSG_RESULT(no)
624 U=_ ANSI2KNR=./ansi2knr
625fi
626AC_SUBST(U)dnl
627AC_SUBST(ANSI2KNR)dnl
628])
629
630dnl --- *@-AM_PATH_GTK-@* ---
631dnl
632dnl Author: Owen Taylor
633dnl
634dnl Synopsis: AM_PATH_GTK(MIN-VERSION, [ACTION-IF-FOUND], [ACTION-IF-NOT])
635dnl
636dnl Arguments: MIN-VERSION = minimum version of GTK required
637dnl ACTION-IF-FOUND = executed if GTK found OK
638dnl ACTION-IF-NOT-FOUND = what to do if GTK not available
639dnl
640dnl Use: Sets up compilation environment suitably for GTK programming.
641
642# Configure paths for GTK+
643# Owen Taylor 97-11-3
644
645dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
646dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
647dnl
648AC_DEFUN(AM_PATH_GTK,
649[dnl
650dnl Get the cflags and libraries from the gtk-config script
651dnl
652AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
653 gtk_config_prefix="$withval", gtk_config_prefix="")
654AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
655 gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
656AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
657 , enable_gtktest=yes)
658
659 if test x$gtk_config_exec_prefix != x ; then
660 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
661 if test x${GTK_CONFIG+set} != xset ; then
662 GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
663 fi
664 fi
665 if test x$gtk_config_prefix != x ; then
666 gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
667 if test x${GTK_CONFIG+set} != xset ; then
668 GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
669 fi
670 fi
671
672 AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
673 min_gtk_version=ifelse([$1], ,0.99.7,$1)
674 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
675 no_gtk=""
676 if test "$GTK_CONFIG" = "no" ; then
677 no_gtk=yes
678 else
679 GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
680 GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
681 gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
682 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
683 gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
684 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
685 gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
686 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
687 if test "x$enable_gtktest" = "xyes" ; then
688 ac_save_CFLAGS="$CFLAGS"
689 ac_save_LIBS="$LIBS"
690 CFLAGS="$CFLAGS $GTK_CFLAGS"
691 LIBS="$LIBS $GTK_LIBS"
692dnl
693dnl Now check if the installed GTK is sufficiently new. (Also sanity
694dnl checks the results of gtk-config to some extent
695dnl
696 rm -f conf.gtktest
697 AC_TRY_RUN([
698#include <gtk/gtk.h>
699#include <stdio.h>
700
701int
702main ()
703{
704 int major, minor, micro;
705 char *tmp_version;
706
707 system ("touch conf.gtktest");
708
709 /* HP/UX 9 (%@#!) writes to sscanf strings */
710 tmp_version = g_strdup("$min_gtk_version");
711 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
712 printf("%s, bad version string\n", "$min_gtk_version");
713 exit(1);
714 }
715
716 if ((gtk_major_version != $gtk_config_major_version) ||
717 (gtk_minor_version != $gtk_config_minor_version) ||
718 (gtk_micro_version != $gtk_config_micro_version))
719 {
720 printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
721 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
722 gtk_major_version, gtk_minor_version, gtk_micro_version);
723 printf ("*** was found! If gtk-config was correct, then it is best\n");
724 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
725 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
726 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
727 printf("*** required on your system.\n");
728 printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
729 printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
730 printf("*** before re-running configure\n");
731 }
732 else
733 {
734 if ((gtk_major_version > major) ||
735 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
736 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
737 {
738 return 0;
739 }
740 else
741 {
742 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
743 gtk_major_version, gtk_minor_version, gtk_micro_version);
744 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
745 major, minor, micro);
746 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
747 printf("***\n");
748 printf("*** If you have already installed a sufficiently new version, this error\n");
749 printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
750 printf("*** being found. The easiest way to fix this is to remove the old version\n");
751 printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
752 printf("*** correct copy of gtk-config. (In this case, you will have to\n");
753 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
754 printf("*** so that the correct libraries are found at run-time))\n");
755 }
756 }
757 return 1;
758}
759],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
760 CFLAGS="$ac_save_CFLAGS"
761 LIBS="$ac_save_LIBS"
762 fi
763 fi
764 if test "x$no_gtk" = x ; then
765 AC_MSG_RESULT(yes)
766 ifelse([$2], , :, [$2])
767 else
768 AC_MSG_RESULT(no)
769 if test "$GTK_CONFIG" = "no" ; then
770 echo "*** The gtk-config script installed by GTK could not be found"
771 echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
772 echo "*** your path, or set the GTK_CONFIG environment variable to the"
773 echo "*** full path to gtk-config."
774 else
775 if test -f conf.gtktest ; then
776 :
777 else
778 echo "*** Could not run GTK test program, checking why..."
779 CFLAGS="$CFLAGS $GTK_CFLAGS"
780 LIBS="$LIBS $GTK_LIBS"
781 AC_TRY_LINK([
782#include <gtk/gtk.h>
783#include <stdio.h>
784], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
785 [ echo "*** The test program compiled, but did not run. This usually means"
786 echo "*** that the run-time linker is not finding GTK or finding the wrong"
787 echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
788 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
789 echo "*** to the installed location Also, make sure you have run ldconfig if that"
790 echo "*** is required on your system"
791 echo "***"
792 echo "*** If you have an old version installed, it is best to remove it, although"
793 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
794 echo "***"
795 echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
796 echo "*** came with the system with the command"
797 echo "***"
798 echo "*** rpm --erase --nodeps gtk gtk-devel" ],
799 [ echo "*** The test program failed to compile or link. See the file config.log for the"
800 echo "*** exact error that occured. This usually means GTK was incorrectly installed"
801 echo "*** or that you have moved GTK since it was installed. In the latter case, you"
802 echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
803 CFLAGS="$ac_save_CFLAGS"
804 LIBS="$ac_save_LIBS"
805 fi
806 fi
807 GTK_CFLAGS=""
808 GTK_LIBS=""
809 ifelse([$3], , :, [$3])
810 fi
811 AC_SUBST(GTK_CFLAGS)
812 AC_SUBST(GTK_LIBS)
813 rm -f conf.gtktest
814])
815
816dnl --- *@-AC_TYPE_PTRDIFF_T-@* ---
817dnl
818dnl Author: Ulrich Drepper
819dnl
820dnl Synopsis: AC_TYPE_PTRDIFF_T
821dnl
822dnl Arguments: ---
823dnl
824dnl Use: Sets HAVE_PTRDIFF_T if the type exists.
825
826AC_DEFUN(AM_TYPE_PTRDIFF_T,
827 [AC_CACHE_CHECK([for ptrdiff_t], am_cv_type_ptrdiff_t,
828 [AC_TRY_COMPILE([#include <stddef.h>], [ptrdiff_t p],
829 am_cv_type_ptrdiff_t=yes, am_cv_type_ptrdiff_t=no)])
830 if test $am_cv_type_ptrdiff_t = yes; then
831 AC_DEFINE(HAVE_PTRDIFF_T)
832 fi
833])
834
835dnl --- *@-AM_WITH_REGEX-@* ---
836dnl
837dnl Author: Unknown (possibly Franc,ois Pinard)
838dnl
839dnl Synopsis: AM_WITH_REGEX
840dnl
841dnl Arguments: ---
842dnl
843dnl Use:
844dnl The idea is to distribute rx.[hc] and regex.[hc] together,
845dnl for a while. The WITH_REGEX symbol (which should also be
846dnl documented in acconfig.h) is used to decide which of regex.h
847dnl or rx.h should be included in the application. If
848dnl `./configure --with-regex' is given (the default), the
849dnl package will use gawk's regex. If `./configure
850dnl --without-regex', a check is made to see if rx is already
851dnl installed, as with newer Linux'es. If not found, the package
852dnl will use the rx from the distribution. If found, the package
853dnl will use the system's rx which, on Linux at least, will
854dnl result in a smaller executable file.
855
856AC_DEFUN(AM_WITH_REGEX,
857[AC_MSG_CHECKING(which of GNU rx or gawk's regex is wanted)
858AC_ARG_WITH(regex,
859[ --without-regex use GNU rx in lieu of gawk's regex for matching],
860[test "$withval" = yes && am_with_regex=1],
861[am_with_regex=1])
862if test -n "$am_with_regex"; then
863 AC_MSG_RESULT(regex)
864 AC_DEFINE(WITH_REGEX)
865 AC_CACHE_CHECK([for GNU regex in libc], am_cv_gnu_regex,
866 AC_TRY_LINK([], [extern int re_max_failures; re_max_failures = 1],
867 am_cv_gnu_regex=yes, am_cv_gnu_regex=no))
868 if test $am_cv_gnu_regex = no; then
869 LIBOBJS="$LIBOBJS regex.o"
870 fi
871else
872 AC_MSG_RESULT(rx)
873 AC_CHECK_FUNC(re_rx_search, , [LIBOBJS="$LIBOBJS rx.o"])
874fi
875AC_SUBST(LIBOBJS)dnl
876])
877
878dnl --- *@-AM_SANITY_CHECK-@*
879dnl
880dnl Author: Unknown
881dnl
882dnl Synopsis: AM_SANITY_CHECK
883dnl
884dnl Arguments: ---
885dnl
886dnl Use: Check for build environment sanity.
887
888AC_DEFUN(AM_SANITY_CHECK,
889[AC_MSG_CHECKING([whether build environment is sane])
890# Just in case
891sleep 1
892echo timestamp > conftestfile
893# Do `set' in a subshell so we don't clobber the current shell's
894# arguments. Must try -L first in case configure is actually a
895# symlink; some systems play weird games with the mod time of symlinks
896# (eg FreeBSD returns the mod time of the symlink's containing
897# directory).
898if (
899 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
900 if test "$@" = "X"; then
901 # -L didn't work.
902 set X `ls -t $srcdir/configure conftestfile`
903 fi
904 test "[$]2" = conftestfile
905 )
906then
907 # Ok.
908 :
909else
910 AC_MSG_ERROR([newly created file is older than distributed files!
911Check your system clock])
912fi
913rm -f conftest*
914AC_MSG_RESULT(yes)])
915
916dnl --- *@-AM_FUNC_STRDOD-@* ---
917dnl
918dnl Author: Jim Meyering
919dnl
920dnl Synopsis: AM_FUNC_STRTOD
921dnl
922dnl Arguments: ---
923dnl
924dnl Use: Checks for a working strtod function.
925
926## Copyright (C) 1996 Free Software Foundation, Inc.
927
928## This program is free software; you can redistribute it and/or modify
929## it under the terms of the GNU General Public License as published by
930## the Free Software Foundation; either version 2, or (at your option)
931## any later version.
932
933## This program is distributed in the hope that it will be useful,
934## but WITHOUT ANY WARRANTY; without even the implied warranty of
935## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
936## GNU General Public License for more details.
937
938## You should have received a copy of the GNU General Public License
939## along with this program; if not, write to the Free Software
940## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
941## 02111-1307, USA.
942
943## From Jim Meyering.
944
945## serial 1
946
947## @defmac AC_FUNC_STRTOD
948## @maindex FUNC_STRTOD
949## @ovindex LIBOBJS
950## If the @code{strtod} function is not available, or does not work
951## correctly (like the one on SunOS 5.4), add @samp{strtod.o} to output
952## variable @code{LIBOBJS}.
953## @end defmac
954
955AC_DEFUN(AM_FUNC_STRTOD,
956[AC_CACHE_CHECK(for working strtod, am_cv_func_strtod,
957[AC_TRY_RUN([
958double strtod ();
959int
960main()
961{
962 {
963 /* Some versions of Linux strtod mis-parse strings with leading '+'. */
964 char *string = " +69";
965 char *term;
966 double value;
967 value = strtod (string, &term);
968 if (value != 69 || term != (string + 4))
969 exit (1);
970 }
971
972 {
973 /* Under Solaris 2.4, strtod returns the wrong value for the
974 terminating character under some conditions. */
975
976## @defmac AC_FUNC_STRTOD
977## @maindex FUNC_STRTOD
978## @ovindex LIBOBJS
979## If the @code{strtod} function is not available, or does not work
980## correctly (like the one on SunOS 5.4), add @samp{strtod.o} to output
981## variable @code{LIBOBJS}.
982## @end defmac
983
984AC_DEFUN(AM_FUNC_STRTOD,
985[AC_CACHE_CHECK(for working strtod, am_cv_func_strtod,
986[AC_TRY_RUN([
987double strtod ();
988int
989main()
990{
991 {
992 /* Some versions of Linux strtod mis-parse strings with leading '+'. */
993 char *string = " +69";
994 char *term;
995 double value;
996 value = strtod (string, &term);
997 if (value != 69 || term != (string + 4))
998 exit (1);
999 }
1000
1001 {
1002 /* Under Solaris 2.4, strtod returns the wrong value for the
1003 terminating character under some conditions. */
1004 char *string = "NaN";
1005 char *term;
1006 strtod (string, &term);
1007 if (term != string && *(term - 1) == 0)
1008 exit (1);
1009 }
1010 exit (0);
1011}
1012], am_cv_func_strtod=yes, am_cv_func_strtod=no, am_cv_func_strtod=no)])
1013test $am_cv_func_strtod = no && LIBOBJS="$LIBOBJS strtod.o"
1014AC_SUBST(LIBOBJS)dnl
1015am_cv_func_strtod_needs_libm=no
1016if test $am_cv_func_strtod = no; then
1017 AC_CHECK_FUNCS(pow)
1018 if test $ac_cv_func_pow = no; then
1019 AC_CHECK_LIB(m, pow, [am_cv_func_strtod_needs_libm=yes],
1020 [AC_MSG_WARN(can't find library containing definition of pow)])
1021 fi
1022fi
1023])
1024
1025dnl --- *@-AM_SYS_POSIX_TERMIOS-@* ---
1026dnl
1027dnl Author: Jim Meyering
1028dnl
1029dnl Synopsis: AM_SYS_POSIX_TERMIOS
1030dnl
1031dnl Arguments: ---
1032dnl
1033dnl Use: Checks for a POSIX termios.h.
1034
1035AC_DEFUN(AM_SYS_POSIX_TERMIOS,
1036[AC_CACHE_CHECK([POSIX termios], am_cv_sys_posix_termios,
1037 [AC_TRY_LINK([#include <sys/types.h>
1038#include <unistd.h>
1039#include <termios.h>],
1040 [/* SunOS 4.0.3 has termios.h but not the library calls. */
1041 tcgetattr(0, 0);],
1042 am_cv_sys_posix_termios=yes,
1043 am_cv_sys_posix_termios=no)])
1044])
1045
1046dnl----- Macros by Mark Wooding ------------------------------ *@--IGNORE--@*
1047
1048dnl --- *@-mdw_REQUIRE-@* ---
1049dnl
1050dnl Author: Mark Wooding
1051dnl
1052dnl Synopsis: mdw_REQUIRE(MACRO, ARGS...)
1053dnl
1054dnl Arguments: MACRO = name of a macro which should have been called
1055dnl ARGS = arguments to pass
1056dnl
1057dnl Use: Like `AC_REQUIRE', only it handles arguments.
1058
1059AC_DEFUN(mdw_REQUIRE,
1060[ifdef([AC_PROVIDED_$1], ,
1061[AC_DIVERT_PUSH(builtin(eval, AC_DIVERSION_CURRENT - 1))dnl
1062indir($@)
1063AC_DIVERT_POP()dnl
1064])])
1065
1066dnl --- *@-mdw_CHECK_MANYLIBS-@* ---
1067dnl
1068dnl Author: Mark Wooding
1069dnl
1070dnl Synopsis: mdw_CHECK_MANYLIBS(FUNC, LIBS, [IF-FOUND], [IF-NOT-FOUND])
1071dnl
1072dnl Arguments: FUNC = a function to try to find
1073dnl LIBS = a whitespace-separated list of libraries to search
1074dnl IF-FOUND = what to do when the function is found
1075dnl IF-NOT-FOUND = what to do when the function isn't found
1076dnl
1077dnl Use: Searches for a library which defines FUNC. It first tries
1078dnl without any libraries; then it tries each library specified
1079dnl in LIBS in turn. If it finds a match, it adds the
1080dnl appropriate library to `LIBS'.
1081dnl
1082dnl This is particularly handy under DIREIX: if you link with
1083dnl `-lnsl' then you get non-NIS-aware versions of getpwnam and
1084dnl so on, which is clearly a Bad Thing.
1085
1086AC_DEFUN(mdw_CHECK_MANYLIBS,
1087[AC_CACHE_CHECK([for library containing $1], [mdw_cv_lib_$1],
1088[mdw_save_LIBS="$LIBS"
1089mdw_cv_lib_$1="no"
1090AC_TRY_LINK(,[$1()], [mdw_cv_lib_$1="none required"])
1091test "$mdw_cv_lib_$1" = "no" && for i in $2; do
1092LIBS="-l$i $mdw_save_LIBS"
1093AC_TRY_LINK(,[$1()],
1094[mdw_cv_lib_$1="-l$i"
1095break])
1096done
1097LIBS="$mdw_save_LIBS"])
1098if test "$mdw_cv_lib_$1" != "no"; then
1099 test "$mdw_cv_lib_$1" = "none required" || LIBS="$mdw_cv_lib_$1 $LIBS"
1100 $3
1101else :
1102 $4
1103fi])
1104
1105dnl --- *@-mdw__PERL_VERSION-@* ---
1106dnl
1107dnl AC_DEFUN relies on `[', `]' being quotes, so I have to drop down a level.
1108
1109changequote(<<, >>)
1110define(mdw__PERL_VERSION, <<$1 -e 'exit ($] < $2);' >&5 2>&5>>)
1111changequote([, ])
1112
1113dnl --- *@-mdw_PROG_PERL-@* ---
1114dnl
1115dnl Author: Mark Wooding
1116dnl
1117dnl Synopsis: mdw_PROG_PERL(VERSION, [IF-FOUND], [IF-NOT-FOUND])
1118dnl
1119dnl Arguments: VERSION = version number of Perl required
1120dnl IF-FOUND = what to do if it's found
1121dnl IF-NOT-FOUND = what to do if it isn't
1122dnl
1123dnl Use: Attempts to find a working version of Perl with a late
1124dnl enough version number. It supplies an option `--with-perl'
1125dnl to allow the user to provide a Perl interpreter. If one
1126dnl isn't provided explicitly, it searches for `perl' and `perl5'
1127dnl in the current PATH, asking them whether they have a late
1128dnl enough version number. The path of the working Perl is
1129dnl put into the `PERL' environment variable; `AC_SUBST' is used
1130dnl to substitute its value into Perl scripts. If there is no
1131dnl Perl to be found, the value of `PERL' is set to be `none'.
1132
1133AC_DEFUN(mdw_PROG_PERL,
1134[AC_ARG_WITH([perl],
1135[ --with-perl=PERL specify path to Perl version $1 or newer],
1136[PERL="$withval"],
1137if test -z "$PERL"; then
1138[AC_CACHE_CHECK([for Perl version $1 or later], mdw_cv_prog_perl,
1139[mdw_cv_prog_perl="none"
1140for p in `echo "$PATH:/usr/local/bin" | tr ":" " "`; do
1141 case $p in /*) ;; *) p=`pwd`/$p ;; esac
1142 if mdw__PERL_VERSION(["$p/perl"], $1); then
1143 mdw_cv_prog_perl="$p/perl"
1144 break
1145 fi
1146 if mdw__PERL_VERSION(["$p/perl5"], $1); then
1147 mdw_cv_prog_perl="$p/perl5"
1148 break
1149 fi
1150done])
1151PERL="$mdw_cv_prog_perl"])
1152fi
1153
1154AC_SUBST(PERL)dnl
1155if test "$PERL" = "none"; then :
1156 $3
1157else :
1158 $2
1159fi])
1160
1161dnl --- *@-mdw_CHECK_PERL-@* ---
1162dnl
1163dnl Author: Mark Wooding
1164dnl
1165dnl Synopsis: mdw_CHECK_PERL(VERSION)
1166dnl
1167dnl Arguments: VERSION = version number of Perl required
1168dnl
1169dnl Use: Verifies that the Perl interpreter in the `PERL' shell
1170dnl variable actually works and is of the right version. If it's
1171dnl not, an error is raised and configuration is aborted.
1172
1173AC_DEFUN(mdw_CHECK_PERL,
1174[mdw_REQUIRE([mdw_PROG_PERL], [$1])
1175AC_MSG_CHECKING([whether Perl ($PERL) works])
1176if test "$PERL" != "none" && mdw__PERL_VERSION("$PERL", $1); then
1177 AC_MSG_RESULT([yes])
1178else
1179 AC_MSG_RESULT([no])
1180 AC_MSG_ERROR([Perl version $1 or newer not found.
1181If you have a recent enough Perl, and I just failed to find it, try using
1182the --with-perl=PERL option to give me an explicit pathname.])
1183fi])
1184
1185dnl --- *@-mdw_PERLLIB_CHECK-@* ---
1186dnl
1187dnl Author: Mark Wooding
1188dnl
1189dnl Synopsis: mdw_PERLLIB_CHECK(LIBRARY)
1190dnl
1191dnl Arguments: LIBRARY = name of a Perl library to check for
1192dnl
1193dnl Use: Ensures that a Perl script can `use LIBRARY;'. If it can,
1194dnl all's well and good; if it can't, `LIBRARY.pm' is added to
1195dnl the variable `NEEDED_PERLLIBS' and a line which adds
1196dnl `pkgdatadir' to Perl's `@INC' array is placed in the
1197dnl variable `INC_PERLLIBS'; `AC_SUBST' is called for both of
1198dnl these variables. It's expected that `NEEDED_PERLLIBS' will
1199dnl be used in the `Makefile.in' to decide which versions from
1200dnl the distribution need installing.
1201dnl
1202dnl This macro isn't terribly useful in the general case. It
1203dnl Also implicitly assumes that `$PERL' is Perl 5 or later.
1204
1205AC_DEFUN(mdw__PERLLIB_INIT,
1206[AC_SUBST(INC_PERLLIBS)dnl
1207AC_SUBST(NEEDED_PERLLIBS)dnl
1208])
1209
1210AC_DEFUN(mdw_PERLLIB_CHECK,
1211[AC_REQUIRE([mdw__PERLLIB_INIT])
1212mdw_REQUIRE([mdw_CHECK_PERL], 5)
1213AC_CACHE_CHECK([for Perl library $1], mdw_cv_perllib_$1,
1214[if $PERL -e 'use $1;' >&5 2>&5; then
1215 mdw_cv_perllib_$1="yes"
1216else
1217 mdw_cv_perllib_$1="no"
1218fi])
1219
1220if test "$mdw_cv_perllib_$1" = "no"; then
1221 NEEDED_PERLLIBS="$NEEDED_PERLLIBS $1.pm"
1222
1223 # --- Deal with autoconf lossage ---
1224 #
1225 # It doesn't want to define `prefix' until rather later on, so I have
1226 # to bodge it here.
1227
1228 if test -z "$INC_PERLLIBS"; then
1229 mdw_old_prefix="$prefix"
1230 test "$prefix" = "NONE" && prefix="$ac_default_prefix";
1231 INC_PERLLIBS="BEGIN { push @INC, \"`eval echo $datadir/$PACKAGE`\"; }"
1232 prefix="$mdw_old_prefix";
1233 fi
1234fi])
1235
1236dnl --- *@-mdw_GCC_FLAGS-@* ---
1237dnl
1238dnl Author: Mark Wooding
1239dnl
1240dnl Synopsis: mdw_GCC_FLAGS([FLAGS], [CFLAGS], [C++FLAGS])
1241dnl
1242dnl Arguments: FLAGS = GCC compiler flags to add (default is
1243dnl `-pedantic -Wall')
1244dnl CFLAGS = GCC C compiler flags to add (default is empty)
1245dnl C++FLAGS = GCC C++ compiler flags to add (default is
1246dnl `-fhandle-exceptions').
1247dnl
1248dnl Use: If the C compiler is GCC, add the compiler flags.
1249
1250AC_DEFUN(mdw_GCC_FLAGS,
1251[if test "$GCC" = "yes"; then
1252 CFLAGS="$CFLAGS ifelse([$1], [], [-pedantic -Wall], [$1])"
1253 CFLAGS="$CFLAGS ifelse([$2], [], [], [$2])"
1254fi
1255if test "$GXX" = "yes"; then
1256 CXXFLAGS="$CXXFLAGS ifelse([$1], [], [-pedantic -Wall], [$1])"
1257 CXXFLAGS="$CXXFLAGS ifelse([$3], [], [-fhandle-exceptions], [$3])"
1258fi])
1259
1260dnl --- *@-mdw_OPT_NDEBUG-@* ---
1261dnl
1262dnl Author: Mark Wooding
1263dnl
1264dnl Synopsis: mdw_OPT_NDEBUG
1265dnl
1266dnl Arguments: ---
1267dnl
1268dnl Use: Turns off the `NDEBUG' flag if the user wants to do
1269dnl debugging.
1270
1271AC_DEFUN(mdw_OPT_NDEBUG,
1272[AC_ARG_ENABLE(debugging,
1273[ --enable-debugging spews vast swathes of useless information],
1274[if test "$enableval" = "no"; then
1275 AC_DEFINE(NDEBUG, 1)
1276fi],
1277[AC_DEFINE(NDEBUG, 1)])])
1278
1279dnl --- *@-mdw_OPT_EFENCE-@* ---
1280dnl
1281dnl Author: Mark Wooding
1282dnl
1283dnl Synopsis: mdw_OPT_EFENCE
1284dnl
1285dnl Arguments: ---
1286dnl
1287dnl Use: Links with the Electric Fence library.
1288
1289AC_DEFUN(mdw_OPT_EFENCE,
1290[AC_ARG_WITH(electric-fence,
1291[ --with-electric-fence link programs with Electric Fence],
1292[if test "$withval" = "yes"; then
1293 AC_CHECK_LIB(efence, malloc)
1294fi])])
1295
1296dnl --- *@-mdw_OPT_mLib_DEBUG-@* ---
1297dnl
1298dnl Author: Mark Wooding
1299dnl
1300dnl Synopsis: mdw_OPT_mLib_DEBUG(PROGRAM)
1301dnl
1302dnl Arguments: ---
1303dnl
1304dnl Use: Provides options for mLib debugging. In particular, the
1305dnl following are defined:
1306dnl
1307dnl --enable-tracing turns off the NTRACE variable
1308dnl --enable-track turns on malloc tracking
1309dnl --enable-blame-PROGRAM tracks malloc contexts in PROGRAM
1310dnl
1311dnl There must be a separate `blame' option, so that the various
1312dnl blame options work properly.
1313
1314AC_DEFUN(mdw_OPT_mLib_DEBUG,
1315[mdw_OPT_NDEBUG
1316mdw_OPT_EFENCE
1317
1318AC_ARG_ENABLE(tracing,
1319[ --enable-tracing enable output of tracing information],
1320[if test "$enableval" = "no"; then
1321 AC_DEFINE(NTRACE, 1)
1322fi],
1323[AC_DEFINE(NTRACE, 1)])
1324
1325AC_ARG_ENABLE(track,
1326[ --enable-track enable tracking of malloc and free],
1327[AC_DEFINE(TRACK_ENABLE, 1)])
1328
1329AC_ARG_ENABLE(blame-$1,
1330[ --enable-blame-$1
1331 track malloc contexts while in $1],
1332[AC_DEFINE(TRACK_BLAME, 1)])])
1333
1334dnl----- That's all, folks --------------------------------- *@--GLOB-END--@*