b91e2391 |
1 | dnl -*-fundamental-*- *@--GLOB-HEADER--@* |
2 | dnl |
5b59e227 |
3 | dnl $Id: aclocal.glob,v 1.2 1999/05/13 22:57:23 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 $ |
5b59e227 |
31 | dnl Revision 1.2 1999/05/13 22:57:23 mdw |
32 | dnl Change `-ise' to `-ize' throughout. |
33 | dnl |
34 | dnl Revision 1.1.1.1 1999/05/05 19:23:47 mdw |
35 | dnl New import. The old CVS repository was lost in a disk disaster. |
b91e2391 |
36 | dnl |
37 | |
38 | dnl----- Common files distribution --------------------------- *@--NOTICE--@* |
39 | dnl |
5b59e227 |
40 | dnl $Id: aclocal.glob,v 1.2 1999/05/13 22:57:23 mdw Exp $ |
b91e2391 |
41 | |
42 | dnl --- *@-AC_PROG_CC_STDC-@* --- |
43 | dnl |
44 | dnl Author: Franc,ois Pinard |
45 | dnl |
46 | dnl Synopsis: AC_PROG_CC_STDC |
47 | dnl |
48 | dnl Arguments: --- |
49 | dnl |
50 | dnl Use: If the C compiler in not in ANSI C mode by default, try to |
51 | dnl add an option to output variable `CC' to make it so. This |
52 | dnl macro tries various options that select ANSI C on some system |
53 | dnl or another. It considers the compiler to be in ANSI C mode |
54 | dnl if it defines `__STDC__' to 1 and handles function prototypes |
55 | dnl correctly. |
56 | dnl |
57 | dnl If you use this macro, you should check after calling it |
58 | dnl whether the C compiler has been set to accept ANSI C; if not, |
59 | dnl the shell variable `ac_cv_prog_cc_stdc' is set to `no'. If |
60 | dnl you wrote your source code in ANSI C, you can make an |
61 | dnl un-ANSIfied copy of it by using the program `ansi2knr', which |
62 | dnl comes with Ghostscript. |
63 | dnl |
64 | dnl (documentation by Franc,ois Pinard) |
65 | |
66 | AC_DEFUN(AM_PROG_CC_STDC, |
67 | [AC_REQUIRE([AC_PROG_CC]) |
68 | AC_BEFORE([$0], [AC_C_INLINE]) |
69 | AC_BEFORE([$0], [AC_C_CONST]) |
70 | AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C) |
71 | AC_CACHE_VAL(am_cv_prog_cc_stdc, |
72 | [am_cv_prog_cc_stdc=no |
73 | ac_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__ |
80 | for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" |
81 | do |
82 | CC="$ac_save_CC $ac_arg" |
83 | AC_TRY_COMPILE( |
84 | [#if !defined(__STDC__) || __STDC__ != 1 |
85 | choke 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 | ], [ |
93 | int test (int i, double x); |
94 | struct s1 {int (*f) (int a);}; |
95 | struct s2 {int (*f) (double a);};], |
96 | [am_cv_prog_cc_stdc="$ac_arg"; break]) |
97 | done |
98 | CC="$ac_save_CC" |
99 | ]) |
100 | if test -z "$am_cv_prog_cc_stdc"; then |
101 | AC_MSG_RESULT([none needed]) |
102 | else |
103 | AC_MSG_RESULT($am_cv_prog_cc_stdc) |
104 | fi |
105 | case "x$am_cv_prog_cc_stdc" in |
106 | x|xno) ;; |
107 | *) CC="$CC $am_cv_prog_cc_stdc" ;; |
108 | esac |
109 | ]) |
110 | |
111 | dnl----- AutoMake macros ------------------------------------- *@--IGNORE--@* |
112 | |
113 | dnl --- *@-AM_CONDITIONAL-@* --- |
114 | dnl |
115 | dnl Author: Unknown |
116 | dnl |
117 | dnl Synopsis: AM_CONDITIONAL(NAME, TEST) |
118 | dnl |
119 | dnl Arguments: NAME = name of the conditional |
120 | dnl TEST = a shell list to execute |
121 | dnl |
122 | dnl Use: Allows conditional sections in Makefiles. |
123 | |
124 | AC_DEFUN(AM_CONDITIONAL, |
125 | [AC_SUBST($1_TRUE) |
126 | AC_SUBST($1_FALSE) |
127 | if $2; then |
128 | $1_TRUE= |
129 | $1_FALSE='#' |
130 | else |
131 | $1_TRUE='#' |
132 | $1_FALSE= |
133 | fi]) |
134 | |
135 | dnl --- *@-AM_CYGWIN32-@* --- |
136 | dnl |
137 | dnl Author: Cygnus (I guess) |
138 | dnl |
139 | dnl Synopsis: AM_CYGWIN32 |
140 | dnl |
141 | dnl Arguments: --- |
142 | dnl |
143 | dnl Use: Check to see if we're running under Cygwin32, without using |
144 | dnl AC_CANONICAL_*. If so, set output variable EXEEXT to |
145 | dnl ".exe". Otherwise set it to "". |
146 | |
147 | dnl AM_CYGWIN32() |
148 | dnl You might think we can do this by checking for a cygwin32-specific |
149 | dnl cpp define. We can't, because cross-compilers that target |
150 | dnl cygwin32 don't use the .exe suffix. I don't know why. |
151 | AC_DEFUN(AM_CYGWIN32, |
152 | [AC_CACHE_CHECK(for Cygwin32 environment, am_cv_cygwin32, |
153 | [cat > conftest.$ac_ext << 'EOF' |
154 | int main () { |
155 | /* Nothing. */ |
156 | return 0; } |
157 | EOF |
158 | if AC_TRY_EVAL(ac_link) && test -s conftest.exe; then |
159 | am_cv_cygwin32=yes |
160 | else |
161 | am_cv_cygwin32=no |
162 | fi |
163 | rm -f conftest*]) |
164 | EXEEXT= |
165 | test "$am_cv_cygwin32" = yes && EXEEXT=.exe |
166 | AC_SUBST(EXEEXT)]) |
167 | |
168 | dnl --- *@-AM_WITH_DMALLOC-@* --- |
169 | dnl |
170 | dnl Author: Franc,ois Pinard |
171 | dnl |
172 | dnl Synopsis: AM_WITH_DMALLOC |
173 | dnl |
174 | dnl Arguments: --- |
175 | dnl |
176 | dnl 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 | |
185 | AC_DEFUN(AM_WITH_DMALLOC, |
186 | [AC_MSG_CHECKING(if malloc debugging is wanted) |
187 | AC_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" |
195 | else |
196 | AC_MSG_RESULT(no) |
197 | fi], [AC_MSG_RESULT(no)]) |
198 | ]) |
199 | |
200 | dnl --- *@-AM_FUNC_ERROR_AT_LINE-@* --- |
201 | dnl |
202 | dnl Author: Jim Meyering |
203 | dnl |
204 | dnl Synopsis: AM_FUNC_ERROR_AT_LINE |
205 | dnl |
206 | dnl Arguments: --- |
207 | dnl |
208 | dnl Use: Use this if you use the GNU error.[ch]. |
209 | |
210 | dnl FIXME: Migrate into libit |
211 | |
212 | AC_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 | |
223 | dnl --- *@-AM_INIT_GUILE_MODULE-@* --- |
224 | dnl |
225 | dnl Author: Unknown |
226 | dnl |
227 | dnl Synopsis: AM_INIT_GUILE_MODULE(MODNAME) |
228 | dnl |
5b59e227 |
229 | dnl Arguments: MODNAME = value to initialize `module' variable with |
b91e2391 |
230 | dnl |
231 | dnl Use: This macro will automatically get the guile version from the |
232 | dnl top-level srcdir, and will initialize automake. It also |
233 | dnl defines the `module' variable. |
234 | |
235 | AC_DEFUN([AM_INIT_GUILE_MODULE],[ |
236 | . $srcdir/../GUILE-VERSION |
237 | AM_INIT_AUTOMAKE($PACKAGE, $VERSION) |
238 | AC_CONFIG_AUX_DIR(..) |
239 | module=[$1] |
240 | AC_SUBST(module)]) |
241 | |
242 | dnl --- *@-AM_CONFIG_HEADER-@* --- |
243 | dnl |
244 | dnl Author: Unknown |
245 | dnl |
246 | dnl Synopsis: AM_CONFIG_HEADER(HEADER ...) |
247 | dnl |
248 | dnl Arguments: HEADER = a header spec, as for AC_CONFIG_HEADER |
249 | dnl |
250 | dnl Use: Like AC_CONFIG_HEADER, but automatically create stamp file. |
251 | |
252 | AC_DEFUN(AM_CONFIG_HEADER, |
253 | [AC_PREREQ([2.12]) |
254 | AC_CONFIG_HEADER([$1]) |
255 | dnl When config.status generates a header, we must update the stamp-h file. |
256 | dnl This file resides in the same directory as the config header |
257 | dnl that is generated. We must strip everything past the first ":", |
258 | dnl and everything past the last "/". |
259 | AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl |
260 | ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, |
261 | <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/ |
262 | \)?.*>>, <<\1>>)stamp-h<<>>dnl>>, |
263 | <<am_indx=1 |
264 | for 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` |
271 | done<<>>dnl>>) |
272 | changequote([,]))]) |
273 | |
274 | dnl --- *@-AM_INIT_AUTOMAKE-@* |
275 | dnl |
276 | dnl Author: Unknown |
277 | dnl |
278 | dnl Synopsis: AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) |
279 | dnl |
280 | dnl Arguments: PACKAGE = package name |
281 | dnl VERSION = version number |
282 | dnl NO-DEFINE = if set, don't define package and version number |
283 | dnl |
284 | dnl Use: Do all the work for Automake. This macro actually does too |
285 | dnl much -- some checks are only needed if your package does |
286 | dnl certain things. But this isn't really a big deal. |
287 | |
288 | # serial 1 |
289 | |
290 | AC_DEFUN(AM_INIT_AUTOMAKE, |
291 | [AC_REQUIRE([AM_PROG_INSTALL]) |
292 | PACKAGE=[$1] |
293 | AC_SUBST(PACKAGE) |
294 | VERSION=[$2] |
295 | AC_SUBST(VERSION) |
296 | dnl test to see if srcdir already configured |
297 | if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then |
298 | AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) |
299 | fi |
300 | ifelse([$3],, |
301 | AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") |
302 | AC_DEFINE_UNQUOTED(VERSION, "$VERSION")) |
303 | AM_SANITY_CHECK |
304 | AC_ARG_PROGRAM |
305 | dnl FIXME This is truly gross. |
306 | missing_dir=`cd $ac_aux_dir && pwd` |
307 | AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) |
308 | AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) |
309 | AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) |
310 | AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) |
311 | AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) |
312 | AC_PROG_MAKE_SET]) |
313 | |
314 | dnl --- *@-AM_PROG_INSTALL-@* --- |
315 | dnl |
316 | dnl Author: Franc,ois Pinard |
317 | dnl |
318 | dnl Synopsis: AM_PROG_INSTALL |
319 | dnl |
320 | dnl Arguments: --- |
321 | dnl |
322 | dnl Use: Calls `AC_PROG_INSTALL' to find an installer. Then it sets |
323 | dnl `INSTALL_SCRIPT' to a suitable value if necessary. |
324 | |
325 | # serial 1 |
326 | |
327 | AC_DEFUN(AM_PROG_INSTALL, |
328 | [AC_PROG_INSTALL |
329 | test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL} -m 755' |
330 | AC_SUBST(INSTALL_SCRIPT)dnl |
331 | ]) |
332 | |
333 | dnl --- *@-AM_PROG_LEX-@* --- |
334 | dnl |
335 | dnl Author: Alexandre Oliva |
336 | dnl |
337 | dnl Synopsis: AM_PROG_LEX |
338 | dnl |
339 | dnl Arguments: --- |
340 | dnl |
341 | dnl Use: Replacement for AC_PROG_LEX and AC_DECL_YYTEXT |
342 | |
343 | dnl AM_PROG_LEX |
344 | dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT |
345 | AC_DEFUN(AM_PROG_LEX, |
346 | [missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1) |
347 | AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex") |
348 | AC_PROG_LEX |
349 | AC_DECL_YYTEXT]) |
350 | |
351 | dnl --- *@-AM_PROG_LIBTOOL-@* --- |
352 | dnl |
353 | dnl Author: Unknown |
354 | dnl |
355 | dnl Synopsis: AM_PROG_LIBTOOL |
356 | dnl |
357 | dnl Arguments: --- |
358 | dnl |
359 | dnl Use: Configures `libtool' for the target architecture. |
360 | |
361 | ## |
362 | ## Configure libtool for the target system. |
363 | ## |
364 | # serial 1 AM_PROG_LIBTOOL |
365 | AC_DEFUN(AM_PROG_LIBTOOL, |
366 | [AC_REQUIRE([AC_CANONICAL_HOST]) |
367 | AC_REQUIRE([AC_PROG_CC]) |
368 | AC_REQUIRE([AC_PROG_RANLIB]) |
369 | |
370 | # Always use our own libtool. |
371 | LIBTOOL='$(top_builddir)/libtool' |
372 | AC_SUBST(LIBTOOL) |
373 | |
374 | dnl Allow the --disable-shared flag to stop us from building shared libs. |
375 | AC_ARG_ENABLE(shared, |
376 | [ --enable-shared build shared libraries [default=yes]], |
377 | test "$enableval" = no && libtool_shared=" --disable-shared", |
378 | libtool_shared=) |
379 | |
380 | libtool_flags="$libtool_shared" |
381 | test "$silent" = yes && libtool_flags="$libtool_flags --silent" |
382 | test "$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. |
385 | CC="$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 | |
390 | dnl --- *@-AM_PATH_LISPDIR-@* --- |
391 | dnl |
392 | dnl Author: Ulrich Drepper |
393 | dnl |
394 | dnl Synopsis: AM_PATH_LISPDIR |
395 | dnl |
396 | dnl Arguments: --- |
397 | dnl |
398 | dnl Use: Sets the variable `lispdir' to point to a place to install |
399 | dnl Emacs lisp files. |
400 | |
401 | ## ------------------------ |
402 | ## Emacs LISP file handling |
403 | ## From Ulrich Drepper |
404 | ## ------------------------ |
405 | |
406 | # serial 1 |
407 | |
408 | AC_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 | |
438 | dnl --- *@-AM_MAINTAINTER_MODE-@* --- |
439 | dnl |
440 | dnl Author: Jim Meyering |
441 | dnl |
442 | dnl Synopsis: jm_MAINTAINER_MODE |
443 | dnl |
444 | dnl Arguments: --- |
445 | dnl |
446 | dnl Use: Provides an option `--enable-maintainer-mode' which turns |
447 | dnl on rules which might normally be commented out. The |
448 | dnl substitution variable `MAINT' is set to be a comment when |
449 | dnl this option is disabled, which it is by default. |
450 | |
451 | # serial 1 |
452 | |
453 | AC_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 | |
471 | dnl --- *@-AM_MISSING_PROG-@* --- |
472 | dnl |
473 | dnl Author: Unknown |
474 | dnl |
475 | dnl Synopsis: AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) |
476 | dnl |
477 | dnl Arguments: NAME = variable to set to the file's location |
478 | dnl PROGRAM = name of program to find |
479 | dnl DIRECTORY = directory to look in |
480 | dnl |
481 | dnl Use: Fakes existence of a useful GNU maintainer tool. |
482 | |
483 | AC_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. |
488 | if ($2 --version) < /dev/null > /dev/null 2>&1; then |
489 | $1=$2 |
490 | AC_MSG_RESULT(found) |
491 | else |
492 | $1="$3/missing $2" |
493 | AC_MSG_RESULT(missing) |
494 | fi |
495 | AC_SUBST($1)]) |
496 | |
497 | dnl --- *@-AM_FUNC_MKTIME-@* --- |
498 | dnl |
499 | dnl Author: Jim Meyering |
500 | dnl |
501 | dnl Synopsis: AM_FUNC_MKTIME |
502 | dnl |
503 | dnl Arguments: --- |
504 | dnl |
505 | dnl Use: Checks for a working mktime function. |
506 | |
507 | AC_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( |
512 | changequote(<<, >>)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 | |
526 | static time_t time_t_max; |
527 | |
528 | /* Values we'll use to set the TZ environment variable. */ |
529 | static 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 | |
534 | static void |
535 | mktime_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 | |
545 | int |
546 | main () |
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 | >>, |
568 | changequote([, ])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 | |
578 | dnl --- *@-AM_FUNC_OBSTACK-@* --- |
579 | dnl |
580 | dnl Author: Jim Meyering |
581 | dnl |
582 | dnl Synopsis: AM_FUNC_OBSTACK |
583 | dnl |
584 | dnl Arguments: --- |
585 | dnl |
586 | dnl Use: Checks for GNU obstacks. |
587 | |
588 | AC_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 | |
601 | dnl --- *@-AC_C_PROTOTYPES-@* --- |
602 | dnl |
603 | dnl Author: Franc,ois Pinard |
604 | dnl |
605 | dnl Synopsis: AC_C_PROTOTYPES |
606 | dnl |
607 | dnl Arguments: --- |
608 | dnl |
609 | dnl Use: If the C compiler understands ANSI C, define `PROTOTYPES', |
610 | dnl and clear the `U' and `ANSI2KNR' variables. Otherwise, |
611 | dnl set `U' to be `_' and `ANSI2KNR' to be `./ansi2knr'. |
612 | |
613 | # serial 1 |
614 | |
615 | AC_DEFUN(fp_C_PROTOTYPES, |
616 | [AC_REQUIRE([fp_PROG_CC_STDC]) |
617 | AC_MSG_CHECKING([for function prototypes]) |
618 | if test "$ac_cv_prog_cc_stdc" != no; then |
619 | AC_MSG_RESULT(yes) |
620 | AC_DEFINE(PROTOTYPES) |
621 | U= ANSI2KNR= |
622 | else |
623 | AC_MSG_RESULT(no) |
624 | U=_ ANSI2KNR=./ansi2knr |
625 | fi |
626 | AC_SUBST(U)dnl |
627 | AC_SUBST(ANSI2KNR)dnl |
628 | ]) |
629 | |
630 | dnl --- *@-AM_PATH_GTK-@* --- |
631 | dnl |
632 | dnl Author: Owen Taylor |
633 | dnl |
634 | dnl Synopsis: AM_PATH_GTK(MIN-VERSION, [ACTION-IF-FOUND], [ACTION-IF-NOT]) |
635 | dnl |
636 | dnl Arguments: MIN-VERSION = minimum version of GTK required |
637 | dnl ACTION-IF-FOUND = executed if GTK found OK |
638 | dnl ACTION-IF-NOT-FOUND = what to do if GTK not available |
639 | dnl |
640 | dnl Use: Sets up compilation environment suitably for GTK programming. |
641 | |
642 | # Configure paths for GTK+ |
643 | # Owen Taylor 97-11-3 |
644 | |
645 | dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) |
646 | dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS |
647 | dnl |
648 | AC_DEFUN(AM_PATH_GTK, |
649 | [dnl |
650 | dnl Get the cflags and libraries from the gtk-config script |
651 | dnl |
652 | AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)], |
653 | gtk_config_prefix="$withval", gtk_config_prefix="") |
654 | AC_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="") |
656 | AC_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" |
692 | dnl |
693 | dnl Now check if the installed GTK is sufficiently new. (Also sanity |
694 | dnl checks the results of gtk-config to some extent |
695 | dnl |
696 | rm -f conf.gtktest |
697 | AC_TRY_RUN([ |
698 | #include <gtk/gtk.h> |
699 | #include <stdio.h> |
700 | |
701 | int |
702 | main () |
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, µ) != 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 | |
816 | dnl --- *@-AC_TYPE_PTRDIFF_T-@* --- |
817 | dnl |
818 | dnl Author: Ulrich Drepper |
819 | dnl |
820 | dnl Synopsis: AC_TYPE_PTRDIFF_T |
821 | dnl |
822 | dnl Arguments: --- |
823 | dnl |
824 | dnl Use: Sets HAVE_PTRDIFF_T if the type exists. |
825 | |
826 | AC_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 | |
835 | dnl --- *@-AM_WITH_REGEX-@* --- |
836 | dnl |
837 | dnl Author: Unknown (possibly Franc,ois Pinard) |
838 | dnl |
839 | dnl Synopsis: AM_WITH_REGEX |
840 | dnl |
841 | dnl Arguments: --- |
842 | dnl |
843 | dnl Use: |
844 | dnl The idea is to distribute rx.[hc] and regex.[hc] together, |
845 | dnl for a while. The WITH_REGEX symbol (which should also be |
846 | dnl documented in acconfig.h) is used to decide which of regex.h |
847 | dnl or rx.h should be included in the application. If |
848 | dnl `./configure --with-regex' is given (the default), the |
849 | dnl package will use gawk's regex. If `./configure |
850 | dnl --without-regex', a check is made to see if rx is already |
851 | dnl installed, as with newer Linux'es. If not found, the package |
852 | dnl will use the rx from the distribution. If found, the package |
853 | dnl will use the system's rx which, on Linux at least, will |
854 | dnl result in a smaller executable file. |
855 | |
856 | AC_DEFUN(AM_WITH_REGEX, |
857 | [AC_MSG_CHECKING(which of GNU rx or gawk's regex is wanted) |
858 | AC_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]) |
862 | if 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 |
871 | else |
872 | AC_MSG_RESULT(rx) |
873 | AC_CHECK_FUNC(re_rx_search, , [LIBOBJS="$LIBOBJS rx.o"]) |
874 | fi |
875 | AC_SUBST(LIBOBJS)dnl |
876 | ]) |
877 | |
878 | dnl --- *@-AM_SANITY_CHECK-@* |
879 | dnl |
880 | dnl Author: Unknown |
881 | dnl |
882 | dnl Synopsis: AM_SANITY_CHECK |
883 | dnl |
884 | dnl Arguments: --- |
885 | dnl |
886 | dnl Use: Check for build environment sanity. |
887 | |
888 | AC_DEFUN(AM_SANITY_CHECK, |
889 | [AC_MSG_CHECKING([whether build environment is sane]) |
890 | # Just in case |
891 | sleep 1 |
892 | echo 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). |
898 | if ( |
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 | ) |
906 | then |
907 | # Ok. |
908 | : |
909 | else |
910 | AC_MSG_ERROR([newly created file is older than distributed files! |
911 | Check your system clock]) |
912 | fi |
913 | rm -f conftest* |
914 | AC_MSG_RESULT(yes)]) |
915 | |
916 | dnl --- *@-AM_FUNC_STRDOD-@* --- |
917 | dnl |
918 | dnl Author: Jim Meyering |
919 | dnl |
920 | dnl Synopsis: AM_FUNC_STRTOD |
921 | dnl |
922 | dnl Arguments: --- |
923 | dnl |
924 | dnl 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 | |
955 | AC_DEFUN(AM_FUNC_STRTOD, |
956 | [AC_CACHE_CHECK(for working strtod, am_cv_func_strtod, |
957 | [AC_TRY_RUN([ |
958 | double strtod (); |
959 | int |
960 | main() |
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 | |
984 | AC_DEFUN(AM_FUNC_STRTOD, |
985 | [AC_CACHE_CHECK(for working strtod, am_cv_func_strtod, |
986 | [AC_TRY_RUN([ |
987 | double strtod (); |
988 | int |
989 | main() |
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)]) |
1013 | test $am_cv_func_strtod = no && LIBOBJS="$LIBOBJS strtod.o" |
1014 | AC_SUBST(LIBOBJS)dnl |
1015 | am_cv_func_strtod_needs_libm=no |
1016 | if 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 |
1022 | fi |
1023 | ]) |
1024 | |
1025 | dnl --- *@-AM_SYS_POSIX_TERMIOS-@* --- |
1026 | dnl |
1027 | dnl Author: Jim Meyering |
1028 | dnl |
1029 | dnl Synopsis: AM_SYS_POSIX_TERMIOS |
1030 | dnl |
1031 | dnl Arguments: --- |
1032 | dnl |
1033 | dnl Use: Checks for a POSIX termios.h. |
1034 | |
1035 | AC_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 | |
1046 | dnl----- Macros by Mark Wooding ------------------------------ *@--IGNORE--@* |
1047 | |
1048 | dnl --- *@-mdw_REQUIRE-@* --- |
1049 | dnl |
1050 | dnl Author: Mark Wooding |
1051 | dnl |
1052 | dnl Synopsis: mdw_REQUIRE(MACRO, ARGS...) |
1053 | dnl |
1054 | dnl Arguments: MACRO = name of a macro which should have been called |
1055 | dnl ARGS = arguments to pass |
1056 | dnl |
1057 | dnl Use: Like `AC_REQUIRE', only it handles arguments. |
1058 | |
1059 | AC_DEFUN(mdw_REQUIRE, |
1060 | [ifdef([AC_PROVIDED_$1], , |
1061 | [AC_DIVERT_PUSH(builtin(eval, AC_DIVERSION_CURRENT - 1))dnl |
1062 | indir($@) |
1063 | AC_DIVERT_POP()dnl |
1064 | ])]) |
1065 | |
1066 | dnl --- *@-mdw_CHECK_MANYLIBS-@* --- |
1067 | dnl |
1068 | dnl Author: Mark Wooding |
1069 | dnl |
1070 | dnl Synopsis: mdw_CHECK_MANYLIBS(FUNC, LIBS, [IF-FOUND], [IF-NOT-FOUND]) |
1071 | dnl |
1072 | dnl Arguments: FUNC = a function to try to find |
1073 | dnl LIBS = a whitespace-separated list of libraries to search |
1074 | dnl IF-FOUND = what to do when the function is found |
1075 | dnl IF-NOT-FOUND = what to do when the function isn't found |
1076 | dnl |
1077 | dnl Use: Searches for a library which defines FUNC. It first tries |
1078 | dnl without any libraries; then it tries each library specified |
1079 | dnl in LIBS in turn. If it finds a match, it adds the |
1080 | dnl appropriate library to `LIBS'. |
1081 | dnl |
1082 | dnl This is particularly handy under DIREIX: if you link with |
1083 | dnl `-lnsl' then you get non-NIS-aware versions of getpwnam and |
1084 | dnl so on, which is clearly a Bad Thing. |
1085 | |
1086 | AC_DEFUN(mdw_CHECK_MANYLIBS, |
1087 | [AC_CACHE_CHECK([for library containing $1], [mdw_cv_lib_$1], |
1088 | [mdw_save_LIBS="$LIBS" |
1089 | mdw_cv_lib_$1="no" |
1090 | AC_TRY_LINK(,[$1()], [mdw_cv_lib_$1="none required"]) |
1091 | test "$mdw_cv_lib_$1" = "no" && for i in $2; do |
1092 | LIBS="-l$i $mdw_save_LIBS" |
1093 | AC_TRY_LINK(,[$1()], |
1094 | [mdw_cv_lib_$1="-l$i" |
1095 | break]) |
1096 | done |
1097 | LIBS="$mdw_save_LIBS"]) |
1098 | if test "$mdw_cv_lib_$1" != "no"; then |
1099 | test "$mdw_cv_lib_$1" = "none required" || LIBS="$mdw_cv_lib_$1 $LIBS" |
1100 | $3 |
1101 | else : |
1102 | $4 |
1103 | fi]) |
1104 | |
1105 | dnl --- *@-mdw__PERL_VERSION-@* --- |
1106 | dnl |
1107 | dnl AC_DEFUN relies on `[', `]' being quotes, so I have to drop down a level. |
1108 | |
1109 | changequote(<<, >>) |
1110 | define(mdw__PERL_VERSION, <<$1 -e 'exit ($] < $2);' >&5 2>&5>>) |
1111 | changequote([, ]) |
1112 | |
1113 | dnl --- *@-mdw_PROG_PERL-@* --- |
1114 | dnl |
1115 | dnl Author: Mark Wooding |
1116 | dnl |
1117 | dnl Synopsis: mdw_PROG_PERL(VERSION, [IF-FOUND], [IF-NOT-FOUND]) |
1118 | dnl |
1119 | dnl Arguments: VERSION = version number of Perl required |
1120 | dnl IF-FOUND = what to do if it's found |
1121 | dnl IF-NOT-FOUND = what to do if it isn't |
1122 | dnl |
1123 | dnl Use: Attempts to find a working version of Perl with a late |
1124 | dnl enough version number. It supplies an option `--with-perl' |
1125 | dnl to allow the user to provide a Perl interpreter. If one |
1126 | dnl isn't provided explicitly, it searches for `perl' and `perl5' |
1127 | dnl in the current PATH, asking them whether they have a late |
1128 | dnl enough version number. The path of the working Perl is |
1129 | dnl put into the `PERL' environment variable; `AC_SUBST' is used |
1130 | dnl to substitute its value into Perl scripts. If there is no |
1131 | dnl Perl to be found, the value of `PERL' is set to be `none'. |
1132 | |
1133 | AC_DEFUN(mdw_PROG_PERL, |
1134 | [AC_ARG_WITH([perl], |
1135 | [ --with-perl=PERL specify path to Perl version $1 or newer], |
1136 | [PERL="$withval"], |
1137 | if test -z "$PERL"; then |
1138 | [AC_CACHE_CHECK([for Perl version $1 or later], mdw_cv_prog_perl, |
1139 | [mdw_cv_prog_perl="none" |
1140 | for 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 |
1150 | done]) |
1151 | PERL="$mdw_cv_prog_perl"]) |
1152 | fi |
1153 | |
1154 | AC_SUBST(PERL)dnl |
1155 | if test "$PERL" = "none"; then : |
1156 | $3 |
1157 | else : |
1158 | $2 |
1159 | fi]) |
1160 | |
1161 | dnl --- *@-mdw_CHECK_PERL-@* --- |
1162 | dnl |
1163 | dnl Author: Mark Wooding |
1164 | dnl |
1165 | dnl Synopsis: mdw_CHECK_PERL(VERSION) |
1166 | dnl |
1167 | dnl Arguments: VERSION = version number of Perl required |
1168 | dnl |
1169 | dnl Use: Verifies that the Perl interpreter in the `PERL' shell |
1170 | dnl variable actually works and is of the right version. If it's |
1171 | dnl not, an error is raised and configuration is aborted. |
1172 | |
1173 | AC_DEFUN(mdw_CHECK_PERL, |
1174 | [mdw_REQUIRE([mdw_PROG_PERL], [$1]) |
1175 | AC_MSG_CHECKING([whether Perl ($PERL) works]) |
1176 | if test "$PERL" != "none" && mdw__PERL_VERSION("$PERL", $1); then |
1177 | AC_MSG_RESULT([yes]) |
1178 | else |
1179 | AC_MSG_RESULT([no]) |
1180 | AC_MSG_ERROR([Perl version $1 or newer not found. |
1181 | If you have a recent enough Perl, and I just failed to find it, try using |
1182 | the --with-perl=PERL option to give me an explicit pathname.]) |
1183 | fi]) |
1184 | |
1185 | dnl --- *@-mdw_PERLLIB_CHECK-@* --- |
1186 | dnl |
1187 | dnl Author: Mark Wooding |
1188 | dnl |
1189 | dnl Synopsis: mdw_PERLLIB_CHECK(LIBRARY) |
1190 | dnl |
1191 | dnl Arguments: LIBRARY = name of a Perl library to check for |
1192 | dnl |
1193 | dnl Use: Ensures that a Perl script can `use LIBRARY;'. If it can, |
1194 | dnl all's well and good; if it can't, `LIBRARY.pm' is added to |
1195 | dnl the variable `NEEDED_PERLLIBS' and a line which adds |
1196 | dnl `pkgdatadir' to Perl's `@INC' array is placed in the |
1197 | dnl variable `INC_PERLLIBS'; `AC_SUBST' is called for both of |
1198 | dnl these variables. It's expected that `NEEDED_PERLLIBS' will |
1199 | dnl be used in the `Makefile.in' to decide which versions from |
1200 | dnl the distribution need installing. |
1201 | dnl |
1202 | dnl This macro isn't terribly useful in the general case. It |
1203 | dnl Also implicitly assumes that `$PERL' is Perl 5 or later. |
1204 | |
1205 | AC_DEFUN(mdw__PERLLIB_INIT, |
1206 | [AC_SUBST(INC_PERLLIBS)dnl |
1207 | AC_SUBST(NEEDED_PERLLIBS)dnl |
1208 | ]) |
1209 | |
1210 | AC_DEFUN(mdw_PERLLIB_CHECK, |
1211 | [AC_REQUIRE([mdw__PERLLIB_INIT]) |
1212 | mdw_REQUIRE([mdw_CHECK_PERL], 5) |
1213 | AC_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" |
1216 | else |
1217 | mdw_cv_perllib_$1="no" |
1218 | fi]) |
1219 | |
1220 | if 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 |
1234 | fi]) |
1235 | |
1236 | dnl --- *@-mdw_GCC_FLAGS-@* --- |
1237 | dnl |
1238 | dnl Author: Mark Wooding |
1239 | dnl |
1240 | dnl Synopsis: mdw_GCC_FLAGS([FLAGS], [CFLAGS], [C++FLAGS]) |
1241 | dnl |
1242 | dnl Arguments: FLAGS = GCC compiler flags to add (default is |
1243 | dnl `-pedantic -Wall') |
1244 | dnl CFLAGS = GCC C compiler flags to add (default is empty) |
1245 | dnl C++FLAGS = GCC C++ compiler flags to add (default is |
1246 | dnl `-fhandle-exceptions'). |
1247 | dnl |
1248 | dnl Use: If the C compiler is GCC, add the compiler flags. |
1249 | |
1250 | AC_DEFUN(mdw_GCC_FLAGS, |
1251 | [if test "$GCC" = "yes"; then |
1252 | CFLAGS="$CFLAGS ifelse([$1], [], [-pedantic -Wall], [$1])" |
1253 | CFLAGS="$CFLAGS ifelse([$2], [], [], [$2])" |
1254 | fi |
1255 | if test "$GXX" = "yes"; then |
1256 | CXXFLAGS="$CXXFLAGS ifelse([$1], [], [-pedantic -Wall], [$1])" |
1257 | CXXFLAGS="$CXXFLAGS ifelse([$3], [], [-fhandle-exceptions], [$3])" |
1258 | fi]) |
1259 | |
1260 | dnl --- *@-mdw_OPT_NDEBUG-@* --- |
1261 | dnl |
1262 | dnl Author: Mark Wooding |
1263 | dnl |
1264 | dnl Synopsis: mdw_OPT_NDEBUG |
1265 | dnl |
1266 | dnl Arguments: --- |
1267 | dnl |
1268 | dnl Use: Turns off the `NDEBUG' flag if the user wants to do |
1269 | dnl debugging. |
1270 | |
1271 | AC_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) |
1276 | fi], |
1277 | [AC_DEFINE(NDEBUG, 1)])]) |
1278 | |
1279 | dnl --- *@-mdw_OPT_EFENCE-@* --- |
1280 | dnl |
1281 | dnl Author: Mark Wooding |
1282 | dnl |
1283 | dnl Synopsis: mdw_OPT_EFENCE |
1284 | dnl |
1285 | dnl Arguments: --- |
1286 | dnl |
1287 | dnl Use: Links with the Electric Fence library. |
1288 | |
1289 | AC_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) |
1294 | fi])]) |
1295 | |
1296 | dnl --- *@-mdw_OPT_mLib_DEBUG-@* --- |
1297 | dnl |
1298 | dnl Author: Mark Wooding |
1299 | dnl |
1300 | dnl Synopsis: mdw_OPT_mLib_DEBUG(PROGRAM) |
1301 | dnl |
1302 | dnl Arguments: --- |
1303 | dnl |
1304 | dnl Use: Provides options for mLib debugging. In particular, the |
1305 | dnl following are defined: |
1306 | dnl |
1307 | dnl --enable-tracing turns off the NTRACE variable |
1308 | dnl --enable-track turns on malloc tracking |
1309 | dnl --enable-blame-PROGRAM tracks malloc contexts in PROGRAM |
1310 | dnl |
1311 | dnl There must be a separate `blame' option, so that the various |
1312 | dnl blame options work properly. |
1313 | |
1314 | AC_DEFUN(mdw_OPT_mLib_DEBUG, |
1315 | [mdw_OPT_NDEBUG |
1316 | mdw_OPT_EFENCE |
1317 | |
1318 | AC_ARG_ENABLE(tracing, |
1319 | [ --enable-tracing enable output of tracing information], |
1320 | [if test "$enableval" = "no"; then |
1321 | AC_DEFINE(NTRACE, 1) |
1322 | fi], |
1323 | [AC_DEFINE(NTRACE, 1)]) |
1324 | |
1325 | AC_ARG_ENABLE(track, |
1326 | [ --enable-track enable tracking of malloc and free], |
1327 | [AC_DEFINE(TRACK_ENABLE, 1)]) |
1328 | |
1329 | AC_ARG_ENABLE(blame-$1, |
1330 | [ --enable-blame-$1 |
1331 | track malloc contexts while in $1], |
1332 | [AC_DEFINE(TRACK_BLAME, 1)])]) |
1333 | |
1334 | dnl----- That's all, folks --------------------------------- *@--GLOB-END--@* |