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