]> www.ginac.de Git - cln.git/blob - autoconf/aclocal.m4
* autoconf/ltmain.sh: Upgrade to libtool-1.5.14.
[cln.git] / autoconf / aclocal.m4
1 # generated automatically by aclocal 1.9.5 -*- Autoconf -*-
2
3 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 # 2005  Free Software Foundation, Inc.
5 # This file is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12 # PARTICULAR PURPOSE.
13
14 dnl -*- Autoconf -*-
15 dnl Copyright (C) 1993-2003 Free Software Foundation, Inc.
16 dnl This file is free software, distributed under the terms of the GNU
17 dnl General Public License.  As a special exception to the GNU General
18 dnl Public License, this file may be distributed as part of a program
19 dnl that contains a configuration script generated by Autoconf, under
20 dnl the same distribution terms as the rest of that program.
21
22 dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
23
24 AC_PREREQ(2.57)
25
26 AC_DEFUN([CL_ALLOCA],
27 [# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
28 # for constant arguments.  Useless!
29 CL_LINK_CHECK(working alloca.h, cl_cv_header_alloca_h,
30 [#include <alloca.h>], [char *p = (char *) alloca(2 * sizeof(int));],
31 AC_DEFINE(HAVE_ALLOCA_H,,[have <alloca.h> and it should be used (not Ultrix)]))
32 decl="#ifdef __GNUC__
33 #define alloca __builtin_alloca
34 #else
35 #ifdef _MSC_VER
36 #include <malloc.h>
37 #define alloca _alloca
38 #else
39 #ifdef HAVE_ALLOCA_H
40 #include <alloca.h>
41 #else
42 #ifdef _AIX
43  #pragma alloca
44 #else
45 #ifndef alloca
46 char *alloca ();
47 #endif
48 #endif
49 #endif
50 #endif
51 #endif
52 "
53 CL_LINK_CHECK([alloca], cl_cv_func_alloca,
54 $decl, [char *p = (char *) alloca(1);],
55  , [alloca_missing=1])dnl
56 if test -n "$alloca_missing"; then
57   # The SVR3 libPW and SVR4 libucb both contain incompatible functions
58   # that cause trouble.  Some versions do not even contain alloca or
59   # contain a buggy version.  If you still want to use their alloca,
60   # use ar to extract alloca.o from them instead of compiling alloca.c.
61   ALLOCA=alloca.${ac_objext}
62   AC_DEFINE(NO_ALLOCA,,[need to link with an external alloca.o when using alloca()])
63 fi
64 AC_SUBST(ALLOCA)dnl
65 ])
66
67 dnl -*- Autoconf -*-
68 dnl Copyright (C) 1993-2003 Free Software Foundation, Inc.
69 dnl This file is free software, distributed under the terms of the GNU
70 dnl General Public License.  As a special exception to the GNU General
71 dnl Public License, this file may be distributed as part of a program
72 dnl that contains a configuration script generated by Autoconf, under
73 dnl the same distribution terms as the rest of that program.
74
75 dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
76
77 AC_PREREQ(2.57)
78
79 AC_DEFUN([CL_AS_UNDERSCORE],
80 [AC_BEFORE([$0], [CL_GLOBAL_CONSTRUCTORS])
81 m4_pattern_allow([^AS_UNDERSCORE$])
82 AC_CACHE_CHECK(for underscore in external names, cl_cv_prog_as_underscore, [
83 cat > conftest.c <<EOF
84 #ifdef __cplusplus
85 extern "C"
86 #endif
87 int foo() { return 0; }
88 EOF
89 # look for the assembly language name in the .s file
90 AC_TRY_COMMAND(${CC-cc} -S conftest.c) >/dev/null 2>&1
91 if grep _foo conftest.s >/dev/null ; then
92   cl_cv_prog_as_underscore=yes
93 else
94   cl_cv_prog_as_underscore=no
95 fi
96 rm -f conftest*
97 ])
98 if test $cl_cv_prog_as_underscore = yes; then
99   AS_UNDERSCORE=true
100   AC_DEFINE(ASM_UNDERSCORE,,[symbols are prefixed by an underscore in assembly language])
101 else
102   AS_UNDERSCORE=false
103 fi
104 AC_SUBST(AS_UNDERSCORE)dnl
105 ])
106
107 dnl Copyright (C) 1993-2002 Free Software Foundation, Inc.
108 dnl This file is free software, distributed under the terms of the GNU
109 dnl General Public License.  As a special exception to the GNU General
110 dnl Public License, this file may be distributed as part of a program
111 dnl that contains a configuration script generated by Autoconf, under
112 dnl the same distribution terms as the rest of that program.
113
114 dnl From Bruno Haible, Marcus Daniels.
115
116 AC_PREREQ(2.13)
117
118 AC_DEFUN([CL_GLOBAL_CONSTRUCTORS],
119 [AC_REQUIRE([CL_AS_UNDERSCORE])dnl
120 if test -n "$GCC"; then
121 AC_CACHE_CHECK(for the global constructors function prefix,
122 cl_cv_cplusplus_ctorprefix, [
123 cat > conftest.cc << EOF
124 struct foo { foo (); };
125 foo foobar;
126 EOF
127 # look for the assembly language name in the .s file
128 AC_TRY_COMMAND(${CXX-g++} $CXXFLAGS -S conftest.cc) >/dev/null 2>&1
129 if grep '_GLOBAL_\$I\$foobar' conftest.s >/dev/null ; then
130   cl_cv_cplusplus_ctorprefix='_GLOBAL_$I$'
131 else
132   if grep '_GLOBAL_\.I\.foobar' conftest.s >/dev/null ; then
133     cl_cv_cplusplus_ctorprefix='_GLOBAL_.I.'
134   else
135     if grep '_GLOBAL__I_foobar' conftest.s >/dev/null ; then
136       cl_cv_cplusplus_ctorprefix='_GLOBAL__I_'
137     else
138       cl_cv_cplusplus_ctorprefix=unknown
139     fi
140   fi
141 fi
142 rm -f conftest*
143 ])
144 if test "$cl_cv_cplusplus_ctorprefix" '!=' unknown; then
145   ac_value='"'"$cl_cv_cplusplus_ctorprefix"'"'
146   AC_DEFINE_UNQUOTED(CL_GLOBAL_CONSTRUCTOR_PREFIX,$ac_value)
147 AC_CACHE_CHECK(for the global destructors function prefix,
148 cl_cv_cplusplus_dtorprefix, [
149 cat > conftest.cc << EOF
150 struct foo { foo (); ~ foo (); };
151 foo foobar;
152 EOF
153 # look for the assembly language name in the .s file
154 AC_TRY_COMMAND(${CXX-g++} $CXXFLAGS -S conftest.cc) >/dev/null 2>&1
155 if grep '_GLOBAL_\$D\$foobar' conftest.s >/dev/null ; then
156   cl_cv_cplusplus_dtorprefix='_GLOBAL_$D$'
157 else
158   if grep '_GLOBAL_\.D\.foobar' conftest.s >/dev/null ; then
159     cl_cv_cplusplus_dtorprefix='_GLOBAL_.D.'
160   else
161     if grep '_GLOBAL__D_foobar' conftest.s >/dev/null ; then
162       cl_cv_cplusplus_dtorprefix='_GLOBAL__D_'
163     else
164       cl_cv_cplusplus_dtorprefix=none
165     fi
166   fi
167 fi
168 rm -f conftest*
169 ])
170   if test "$cl_cv_cplusplus_dtorprefix" '!=' none; then
171     ac_value='"'"$cl_cv_cplusplus_ctorprefix"'"'
172     AC_DEFINE_UNQUOTED(CL_GLOBAL_DESTRUCTOR_PREFIX,$ac_value)
173   fi
174 dnl Check whether the global constructors/destructors functions are file-scope
175 dnl only by default. This is the case in egcs-1.1.2 or newer.
176 AC_CACHE_CHECK(whether the global constructors function need to be exported,
177 cl_cv_cplusplus_ctorexport, [
178 cat > conftest1.cc << EOF
179 struct foo { foo (); };
180 foo foobar;
181 EOF
182 cat > conftest2.cc << EOF
183 #include "confdefs.h"
184 #ifdef ASM_UNDERSCORE
185 #define ASM_UNDERSCORE_PREFIX "_"
186 #else
187 #define ASM_UNDERSCORE_PREFIX ""
188 #endif
189 struct foo { foo (); };
190 foo::foo () {}
191 extern "C" void ctor (void) __asm__ (ASM_UNDERSCORE_PREFIX CL_GLOBAL_CONSTRUCTOR_PREFIX "foobar");
192 int main() { ctor(); return 0; }
193 EOF
194 if AC_TRY_COMMAND(${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest1.cc conftest2.cc $LIBS 1>&5) >/dev/null 2>&1 && test -s conftest${ac_exeext}; then
195   cl_cv_cplusplus_ctorexport=no
196 else
197   cl_cv_cplusplus_ctorexport=yes
198 fi
199 rm -f conftest*
200 ])
201 if test "$cl_cv_cplusplus_ctorexport" = yes; then
202   AC_DEFINE(CL_NEED_GLOBALIZE_CTORDTOR)
203 fi
204 fi
205 fi
206 ])
207
208 dnl -*- Autoconf -*-
209 dnl Copyright (C) 1993-2003 Free Software Foundation, Inc.
210 dnl This file is free software, distributed under the terms of the GNU
211 dnl General Public License.  As a special exception to the GNU General
212 dnl Public License, this file may be distributed as part of a program
213 dnl that contains a configuration script generated by Autoconf, under
214 dnl the same distribution terms as the rest of that program.
215
216 dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
217
218 AC_PREREQ(2.57)
219
220 AC_DEFUN([CL_FPU_CONTROL],
221 [dnl Check for Linux with <fpu_control.h> and fpu_control_t or __setfpucw().
222 dnl glibc versions since October 1998 define fpu_control_t. Earlier versions
223 dnl define and declare __setfpucw(). Very early Linux libc versions have none,
224 dnl and __fpu_control is of type `unsigned short'.
225 CL_COMPILE_CHECK([fpu_control_t], cl_cv_type_fpu_control_t,
226 [#include <fpu_control.h>], [fpu_control_t x;],
227 AC_DEFINE(HAVE_FPU_CONTROL_T,,[have <fpu_control.h> and it defines the fpu_control_t type]))
228 CL_COMPILE_CHECK([__setfpucw], cl_cv_func_setfpucw,
229 [#include <fpu_control.h>], [__setfpucw(_FPU_IEEE);],
230 AC_DEFINE(HAVE_SETFPUCW,,[have <fpu_control.h> and it declares the __setfpucw() function]))
231 ])
232
233 dnl Copyright (C) 1993-2002 Free Software Foundation, Inc.
234 dnl This file is free software, distributed under the terms of the GNU
235 dnl General Public License.  As a special exception to the GNU General
236 dnl Public License, this file may be distributed as part of a program
237 dnl that contains a configuration script generated by Autoconf, under
238 dnl the same distribution terms as the rest of that program.
239
240 dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
241
242 AC_PREREQ(2.13)
243
244 dnl without AC_MSG_...:   with AC_MSG_... and caching:
245 dnl   AC_TRY_CPP          CL_CPP_CHECK
246 dnl   AC_TRY_COMPILE      CL_COMPILE_CHECK
247 dnl   AC_TRY_LINK         CL_LINK_CHECK
248 dnl   AC_TRY_RUN          CL_RUN_CHECK - would require cross-compiling support
249 dnl Usage:
250 dnl AC_TRY_CPP(INCLUDES,
251 dnl            ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
252 dnl CL_CPP_CHECK(ECHO-TEXT, CACHE-ID,
253 dnl              INCLUDES,
254 dnl              ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
255 dnl AC_TRY_xxx(INCLUDES, FUNCTION-BODY,
256 dnl            ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
257 dnl CL_xxx_CHECK(ECHO-TEXT, CACHE-ID,
258 dnl              INCLUDES, FUNCTION-BODY,
259 dnl              ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
260
261 AC_DEFUN([CL_CPP_CHECK],
262 [AC_MSG_CHECKING(for $1)
263 AC_CACHE_VAL($2,[
264 AC_TRY_CPP([$3], $2=yes, $2=no)
265 ])
266 AC_MSG_RESULT([$]$2)
267 if test [$]$2 = yes; then
268   ifelse([$4], , :, [$4])
269 ifelse([$5], , , [else
270   $5
271 ])dnl
272 fi
273 ])
274
275 AC_DEFUN([CL_COMPILE_CHECK],
276 [AC_MSG_CHECKING(for $1)
277 AC_CACHE_VAL($2,[
278 AC_TRY_COMPILE([$3],[$4], $2=yes, $2=no)
279 ])
280 AC_MSG_RESULT([$]$2)
281 if test [$]$2 = yes; then
282   ifelse([$5], , :, [$5])
283 ifelse([$6], , , [else
284   $6
285 ])dnl
286 fi
287 ])
288
289 AC_DEFUN([CL_LINK_CHECK],
290 [AC_MSG_CHECKING(for $1)
291 AC_CACHE_VAL($2,[
292 AC_TRY_LINK([$3],[$4], $2=yes, $2=no)
293 ])
294 AC_MSG_RESULT([$]$2)
295 if test [$]$2 = yes; then
296   ifelse([$5], , :, [$5])
297 ifelse([$6], , , [else
298   $6
299 ])dnl
300 fi
301 ])
302
303 dnl CL_SILENT(ACTION)
304 dnl performs ACTION, with AC_MSG_CHECKING and AC_MSG_RESULT being defined away.
305 AC_DEFUN([CL_SILENT],
306 [pushdef([AC_MSG_CHECKING],[:])dnl
307 pushdef([AC_CHECKING],[:])dnl
308 pushdef([AC_MSG_RESULT],[:])dnl
309 $1[]dnl
310 popdef([AC_MSG_RESULT])dnl
311 popdef([AC_CHECKING])dnl
312 popdef([AC_MSG_CHECKING])dnl
313 ])
314
315 dnl Expands to the "extern ..." prefix used for system declarations.
316 dnl AC_LANG_EXTERN()
317 AC_DEFUN([AC_LANG_EXTERN],
318 [extern
319 #ifdef __cplusplus
320 "C"
321 #endif
322 ])
323
324 AC_DEFUN([CL_CC_WORKS],
325 [AC_CACHE_CHECK(whether CC works at all, cl_cv_prog_cc_works, [
326 AC_LANG_SAVE()
327 AC_LANG_C()
328 AC_TRY_RUN([int main() { exit(0); }],
329 cl_cv_prog_cc_works=yes, cl_cv_prog_cc_works=no,
330 AC_TRY_LINK([], [], cl_cv_prog_cc_works=yes, cl_cv_prog_cc_works=no))
331 AC_LANG_RESTORE()
332 ])
333 case "$cl_cv_prog_cc_works" in
334   *no) echo "Installation or configuration problem: C compiler cannot create executables."; exit 1;;
335   *yes) ;;
336 esac
337 ])
338
339 AC_DEFUN([CL_CONFIG_SUBDIRS],
340 [dnl No AC_CONFIG_AUX_DIR_DEFAULT, so we don't need install.sh.
341 AC_PROVIDE([AC_CONFIG_AUX_DIR_DEFAULT])
342 AC_CONFIG_SUBDIRS([$1])dnl
343 ])
344
345 AC_DEFUN([CL_CANONICAL_HOST],
346 [AC_REQUIRE([AC_PROG_CC]) dnl Actually: AC_REQUIRE([CL_CC_WORKS])
347 dnl Set ac_aux_dir before the cache check, because AM_PROG_LIBTOOL needs it.
348 ac_aux_dir=${srcdir}/$1
349 dnl A substitute for AC_CONFIG_AUX_DIR_DEFAULT, so we don't need install.sh.
350 ac_config_guess="$SHELL $ac_aux_dir/config.guess"
351 ac_config_sub="$SHELL $ac_aux_dir/config.sub"
352 dnl We have defined $ac_aux_dir.
353 AC_PROVIDE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
354 dnl In autoconf-2.52, a single AC_CANONICAL_HOST has the effect of inserting
355 dnl the code of AC_CANONICAL_BUILD *before* CL_CANONICAL_HOST, i.e. before
356 dnl ac_aux_dir has been set. To work around this, we list AC_CANONICAL_BUILD
357 dnl explicitly.
358 AC_CANONICAL_BUILD
359 AC_CANONICAL_HOST
360 ])
361
362 AC_DEFUN([CL_CANONICAL_HOST_CPU],
363 [AC_REQUIRE([CL_CANONICAL_HOST])AC_REQUIRE([AC_PROG_CC])
364 case "$host_cpu" in
365 changequote(,)dnl
366   i[4567]86 )
367     host_cpu=i386
368     ;;
369   alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] )
370     host_cpu=alpha
371     ;;
372   hppa1.0 | hppa1.1 | hppa2.0* | hppa64 )
373     host_cpu=hppa
374     ;;
375   powerpc )
376     host_cpu=rs6000
377     ;;
378   c1 | c2 | c32 | c34 | c38 | c4 )
379     host_cpu=convex
380     ;;
381   arm* )
382     host_cpu=arm
383     ;;
384 changequote([,])dnl
385   mips )
386     AC_CACHE_CHECK([for 64-bit MIPS], cl_cv_host_mips64, [
387 AC_EGREP_CPP(yes,
388 [#if defined(_MIPS_SZLONG)
389 #if (_MIPS_SZLONG == 64)
390 /* We should also check for (_MIPS_SZPTR == 64), but gcc keeps this at 32. */
391   yes
392 #endif
393 #endif
394 ], cl_cv_host_mips64=yes, cl_cv_host_mips64=no)
395 ])
396 if test $cl_cv_host_mips64 = yes; then
397   host_cpu=mips64
398 fi
399     ;;
400 dnl UltraSPARCs running Linux have `uname -m` = "sparc64", but the C compiler
401 dnl still generates 32-bit code.
402   sparc | sparc64 )
403     AC_CACHE_CHECK([for 64-bit SPARC], cl_cv_host_sparc64, [
404 AC_EGREP_CPP(yes,
405 [#if defined(__sparcv9) || defined(__arch64__)
406   yes
407 #endif
408 ], cl_cv_host_sparc64=yes, cl_cv_host_sparc64=no)
409 ])
410 if test $cl_cv_host_sparc64 = yes; then
411   host_cpu=sparc64
412 else
413   host_cpu=sparc
414 fi
415     ;;
416 esac
417 dnl was AC_DEFINE_UNQUOTED(__${host_cpu}__) but KAI C++ 3.2d doesn't like this
418 cat >> confdefs.h <<EOF
419 #ifndef __${host_cpu}__
420 #define __${host_cpu}__ 1
421 #endif
422 EOF
423 ])
424
425 AC_DEFUN([CL_CANONICAL_HOST_CPU_FOR_FFCALL],
426 [AC_REQUIRE([CL_CANONICAL_HOST])AC_REQUIRE([AC_PROG_CC])
427 case "$host_cpu" in
428 changequote(,)dnl
429   i[4567]86 )
430     host_cpu=i386
431     ;;
432   alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] )
433     host_cpu=alpha
434     ;;
435   hppa1.0 | hppa1.1 | hppa2.0* | hppa64 )
436     host_cpu=hppa
437     ;;
438   powerpc )
439     host_cpu=rs6000
440     ;;
441   c1 | c2 | c32 | c34 | c38 | c4 )
442     host_cpu=convex
443     ;;
444   arm* )
445     host_cpu=arm
446     ;;
447 changequote([,])dnl
448   mips )
449     AC_CACHE_CHECK([for 64-bit MIPS], cl_cv_host_mips64, [
450 AC_EGREP_CPP(yes,
451 [#if defined(_MIPS_SZLONG)
452 #if (_MIPS_SZLONG == 64)
453 /* We should also check for (_MIPS_SZPTR == 64), but gcc keeps this at 32. */
454   yes
455 #endif
456 #endif
457 ], cl_cv_host_mips64=yes, cl_cv_host_mips64=no)
458 ])
459 if test $cl_cv_host_mips64 = yes; then
460   host_cpu=mips64
461 else
462   AC_CACHE_CHECK([for MIPS with n32 ABI], cl_cv_host_mipsn32, [
463 dnl Strictly speaking, the MIPS ABI (-32 or -n32) is independent from the CPU
464 dnl identification (-mips[12] or -mips[34]). But -n32 is commonly used together
465 dnl with -mips3, and it's easier to test the CPU identification.
466 AC_EGREP_CPP(yes,
467 [#if __mips >= 3
468   yes
469 #endif
470 ], cl_cv_host_mipsn32=yes, cl_cv_host_mipsn32=no)
471 ])
472 if test $cl_cv_host_mipsn32 = yes; then
473   host_cpu=mipsn32
474 fi
475 fi
476     ;;
477 dnl UltraSPARCs running Linux have `uname -m` = "sparc64", but the C compiler
478 dnl still generates 32-bit code.
479   sparc | sparc64 )
480     AC_CACHE_CHECK([for 64-bit SPARC], cl_cv_host_sparc64, [
481 AC_EGREP_CPP(yes,
482 [#if defined(__sparcv9) || defined(__arch64__)
483   yes
484 #endif
485 ], cl_cv_host_sparc64=yes, cl_cv_host_sparc64=no)
486 ])
487 if test $cl_cv_host_sparc64 = yes; then
488   host_cpu=sparc64
489 else
490   host_cpu=sparc
491 fi
492     ;;
493 esac
494 dnl was AC_DEFINE_UNQUOTED(__${host_cpu}__) but KAI C++ 3.2d doesn't like this
495 cat >> confdefs.h <<EOF
496 #ifndef __${host_cpu}__
497 #define __${host_cpu}__ 1
498 #endif
499 EOF
500 ])
501
502 dnl -*- Autoconf -*-
503 dnl Copyright (C) 1993-2003 Free Software Foundation, Inc.
504 dnl This file is free software, distributed under the terms of the GNU
505 dnl General Public License.  As a special exception to the GNU General
506 dnl Public License, this file may be distributed as part of a program
507 dnl that contains a configuration script generated by Autoconf, under
508 dnl the same distribution terms as the rest of that program.
509
510 dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
511
512 AC_PREREQ(2.57)
513
514 AC_DEFUN([CL_GETTIMEOFDAY],
515 [AC_BEFORE([$0], [CL_TIMES_CLOCK])
516 AC_CHECK_FUNCS(gettimeofday)dnl
517 if test $ac_cv_func_gettimeofday = yes; then
518 dnl HAVE_GETTIMEOFDAY is defined
519 CL_PROTO([gettimeofday], [
520 CL_PROTO_TRY([
521 #include <sys/types.h>
522 #include <sys/time.h>
523 ], [int gettimeofday (struct timeval * tp, struct timezone * tzp);],
524 [int gettimeofday();],
525 cl_cv_proto_gettimeofday_dots=no
526 cl_cv_proto_gettimeofday_arg2="struct timezone *",
527 CL_PROTO_TRY([
528 #include <sys/types.h>
529 #include <sys/time.h>
530 ], [int gettimeofday (struct timeval * tp, void * tzp);],
531 [int gettimeofday();],
532 cl_cv_proto_gettimeofday_dots=no
533 cl_cv_proto_gettimeofday_arg2="void *",
534 cl_cv_proto_gettimeofday_dots=yes
535 cl_cv_proto_gettimeofday_arg2="..."))
536 ], [extern int gettimeofday (struct timeval *, $cl_cv_proto_gettimeofday_arg2);])
537 if test $cl_cv_proto_gettimeofday_dots = yes; then
538 AC_DEFINE(GETTIMEOFDAY_DOTS,,[declaration of gettimeofday() needs dots])
539 else
540 AC_DEFINE_UNQUOTED(GETTIMEOFDAY_TZP_T,$cl_cv_proto_gettimeofday_arg2,[type of `tzp' in gettimeofday() declaration])
541 fi
542 fi
543 ])
544
545 dnl -*- Autoconf -*-
546 dnl Copyright (C) 1993-2003 Free Software Foundation, Inc.
547 dnl This file is free software, distributed under the terms of the GNU
548 dnl General Public License.  As a special exception to the GNU General
549 dnl Public License, this file may be distributed as part of a program
550 dnl that contains a configuration script generated by Autoconf, under
551 dnl the same distribution terms as the rest of that program.
552
553 dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
554
555 AC_PREREQ(2.13)
556
557 AC_DEFUN([CL_MACHINE],
558 [AC_REQUIRE([AC_PROG_CC])dnl
559 AC_REQUIRE([AC_C_CHAR_UNSIGNED])dnl
560 cl_machine_file_c=$2
561 cl_machine_file_h=$3
562 if test $cross_compiling = no; then
563 if test -z "$[$4]"; then
564 AC_CHECKING(for [$1])
565 cat > conftest.$ac_ext <<EOF
566 #include "confdefs.h"
567 EOF
568 cat "$cl_machine_file_c" >> conftest.$ac_ext
569 ORIGCC="$CC"
570 if test $ac_cv_prog_gcc = yes; then
571 # gcc -O (gcc version <= 2.3.2) crashes when compiling long long shifts for
572 # target 80386. Strip "-O".
573 CC=`echo "$CC " | sed -e 's/-O //g'`
574 fi
575 AC_TRY_EVAL(ac_link)
576 CC="$ORIGCC"
577 if test -s conftest; then
578   echo "creating $cl_machine_file_h"
579   ./conftest > conftest.h
580   if cmp -s "$cl_machine_file_h" conftest.h 2>/dev/null; then
581     # The file exists and we would not be changing it
582     rm -f conftest.h
583   else
584     rm -f "$cl_machine_file_h"
585     mv conftest.h "$cl_machine_file_h"
586   fi
587   [$4]=1
588 else
589   echo "creation of $cl_machine_file_h failed"
590 fi
591 rm -f conftest*
592 fi
593 else
594 echo "cross-compiling - cannot create $cl_machine_file_h"
595 fi
596 ])
597
598 dnl Copyright (C) 1993-2002 Free Software Foundation, Inc.
599 dnl This file is free software, distributed under the terms of the GNU
600 dnl General Public License.  As a special exception to the GNU General
601 dnl Public License, this file may be distributed as part of a program
602 dnl that contains a configuration script generated by Autoconf, under
603 dnl the same distribution terms as the rest of that program.
604
605 dnl From Bruno Haible, Marcus Daniels.
606
607 AC_PREREQ(2.13)
608
609 AC_DEFUN([CL_LONGDOUBLE],
610 [AC_CACHE_CHECK(for long double type, cl_cv_c_longdouble, [
611 AC_TRY_RUN([int main()
612 { long double x = 2.7182818284590452354L; x = x*x; exit (x==0.0L); }],
613 cl_cv_c_longdouble=yes, cl_cv_c_longdouble=no,
614 dnl When cross-compiling, don't assume anything.
615 cl_cv_c_longdouble="guessing no")
616 ])
617 case "$cl_cv_c_longdouble" in
618   *yes) AC_DEFINE(HAVE_LONGDOUBLE) ;;
619   *no) ;;
620 esac
621 ])
622
623 dnl -*- Autoconf -*-
624 dnl Copyright (C) 1993-2003 Free Software Foundation, Inc.
625 dnl This file is free software, distributed under the terms of the GNU
626 dnl General Public License.  As a special exception to the GNU General
627 dnl Public License, this file may be distributed as part of a program
628 dnl that contains a configuration script generated by Autoconf, under
629 dnl the same distribution terms as the rest of that program.
630
631 dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
632
633 AC_PREREQ(2.57)
634
635 AC_DEFUN([CL_LONGLONG],
636 [AC_CACHE_CHECK(for long long type, cl_cv_c_longlong, [
637 AC_TRY_RUN([int main()
638 {
639 /* long longs don't work right with gcc-2.7.2 on m68k */
640 /* long longs don't work right with gcc-2.7.2 on rs6000: avcall/tests.c gets
641    miscompiled. */
642 #if defined(__m68k__) || (defined(_IBMR2) || defined(__powerpc))
643 #if defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ <= 7)
644   exit(1);
645 #endif
646 #endif
647   { long x = 944938507; long y = 737962842; long z = 162359677;
648     exit(!(((long long) x)*((long long) y)>>32 == z));
649   }
650 }],
651 cl_cv_c_longlong=yes, cl_cv_c_longlong=no,
652 dnl When cross-compiling, don't assume anything.
653 cl_cv_c_longlong="guessing no")
654 ])
655 case "$cl_cv_c_longlong" in
656   *yes) AC_DEFINE(HAVE_LONGLONG,,[compiler supports the `long long' type]) ;;
657   *no) ;;
658 esac
659 ])
660
661 dnl -*- Autoconf -*-
662 dnl Copyright (C) 1993-2003 Free Software Foundation, Inc.
663 dnl This file is free software, distributed under the terms of the GNU
664 dnl General Public License.  As a special exception to the GNU General
665 dnl Public License, this file may be distributed as part of a program
666 dnl that contains a configuration script generated by Autoconf, under
667 dnl the same distribution terms as the rest of that program.
668
669 dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
670
671 AC_PREREQ(2.57)
672
673 AC_DEFUN([CL_PERROR],
674 [AC_MSG_CHECKING(for perror declaration)
675 AC_CACHE_VAL(cl_cv_proto_perror, [
676 AC_TRY_COMPILE([
677 /* Some systems declare perror() in <errno.h>, some in <stdio.h>, some don't
678    declare it at all. */
679 #include <stdio.h>
680 #include <errno.h>
681 ]AC_LANG_EXTERN[double perror ();], [],
682 cl_cv_proto_perror=no, cl_cv_proto_perror=yes)
683 ])
684 AC_MSG_RESULT([$cl_cv_proto_perror])
685 if test $cl_cv_proto_perror = yes; then
686 AC_DEFINE(HAVE_PERROR_DECL,,[<errno.h> or <stdio.h> contains a declaration for perror()])
687 fi
688 ])
689
690 dnl Copyright (C) 1993-2002 Free Software Foundation, Inc.
691 dnl This file is free software, distributed under the terms of the GNU
692 dnl General Public License.  As a special exception to the GNU General
693 dnl Public License, this file may be distributed as part of a program
694 dnl that contains a configuration script generated by Autoconf, under
695 dnl the same distribution terms as the rest of that program.
696
697 dnl From Bruno Haible, Marcus Daniels.
698
699 AC_PREREQ(2.13)
700
701 dnl CL_PROTO(IDENTIFIER, ACTION-IF-NOT-FOUND, FINAL-PROTOTYPE)
702 AC_DEFUN([CL_PROTO],
703 [AC_MSG_CHECKING([for $1 declaration])
704 AC_CACHE_VAL(cl_cv_proto_[$1], [$2
705 cl_cv_proto_$1="$3"])
706 cl_cv_proto_$1=`echo "[$]cl_cv_proto_$1" | tr -s ' ' | sed -e 's/( /(/'`
707 AC_MSG_RESULT([$]{ac_t:-
708          }[$]cl_cv_proto_$1)
709 ])
710
711 dnl CL_PROTO_RET(INCLUDES, ANSI-DECL, TRAD-DECL, CACHE-ID, TYPE-IF-OK, TYPE-IF-FAILS)
712 AC_DEFUN([CL_PROTO_RET],
713 [AC_TRY_COMPILE([$1]
714 AC_LANG_EXTERN
715 [#if defined(__STDC__) || defined(__cplusplus)
716 $2
717 #else
718 $3
719 #endif
720 ], [], $4="$5", $4="$6")
721 ])
722
723 dnl CL_PROTO_TRY(INCLUDES, ANSI-DECL, TRAD-DECL, ACTION-IF-OK, ACTION-IF-FAILS)
724 AC_DEFUN([CL_PROTO_TRY],
725 [AC_TRY_COMPILE([$1]
726 AC_LANG_EXTERN
727 [#if defined(__STDC__) || defined(__cplusplus)
728 $2
729 #else
730 $3
731 #endif
732 ], [], [$4], [$5])
733 ])
734
735 dnl CL_PROTO_CONST(INCLUDES, ANSI-DECL, TRAD-DECL, CACHE-ID)
736 AC_DEFUN([CL_PROTO_CONST],
737 [CL_PROTO_TRY([$1], [$2], [$3], $4="", $4="const")]
738 )
739
740 dnl -*- Autoconf -*-
741 dnl Copyright (C) 1993-2003 Free Software Foundation, Inc.
742 dnl This file is free software, distributed under the terms of the GNU
743 dnl General Public License.  As a special exception to the GNU General
744 dnl Public License, this file may be distributed as part of a program
745 dnl that contains a configuration script generated by Autoconf, under
746 dnl the same distribution terms as the rest of that program.
747
748 dnl From Bruno Haible, Marcus Daniels, Sam Steingold, Peter Burwood, Sam Steingold.
749
750 AC_PREREQ(2.57)
751
752 AC_DEFUN([CL_RUSAGE],
753 [AC_CHECK_HEADERS(sys/resource.h sys/times.h)dnl
754 if test $ac_cv_header_sys_resource_h = yes; then
755   dnl HAVE_SYS_RESOURCE_H defined
756   CL_LINK_CHECK([getrusage], cl_cv_func_getrusage,
757 [#include <sys/types.h> /* NetBSD 1.0 needs this */
758 #include <sys/time.h>
759 #include <sys/resource.h>],
760     [struct rusage x; int y = RUSAGE_SELF; getrusage(y,&x); x.ru_utime.tv_sec;])dnl
761   if test $cl_cv_func_getrusage = yes; then
762     CL_PROTO([getrusage], [
763     CL_PROTO_TRY([
764 #include <stdlib.h>
765 #ifdef HAVE_UNISTD_H
766 #include <unistd.h>
767 #endif
768 #include <sys/types.h> /* NetBSD 1.0 needs this */
769 #include <sys/time.h>
770 #include <sys/resource.h>
771 ],
772 [int getrusage (int who, struct rusage * rusage);],
773 [int getrusage();],
774 [cl_cv_proto_getrusage_arg1="int"],
775 [cl_cv_proto_getrusage_arg1="enum __rusage_who"])
776 ], [extern int getrusage ($cl_cv_proto_getrusage_arg1, struct rusage *);])dnl
777     AC_CACHE_CHECK(whether getrusage works, cl_cv_func_getrusage_works, [
778     AC_TRY_RUN([
779 #include <stdio.h>
780 #include <sys/types.h> /* NetBSD 1.0 needs this */
781 #include <sys/time.h>
782 #include <time.h> /* for time(2) */
783 #include <sys/resource.h>
784 int main ()
785 {
786   struct rusage used, prev;
787   time_t end = time(NULL)+2;
788   int count = 0;
789
790   if ((count = getrusage(RUSAGE_SELF, &prev))) {
791     /* getrusage is defined but does not do anything. */
792     /*fprintf(stderr,"getrusage failed: return=%d\n",count);*/
793     return 1;
794   }
795   while (time(NULL) < end) {
796     count++;
797     getrusage(RUSAGE_SELF, &used);
798     if ((used.ru_utime.tv_usec != prev.ru_utime.tv_usec)
799         || (used.ru_utime.tv_sec != prev.ru_utime.tv_sec)
800         || (used.ru_stime.tv_usec != prev.ru_stime.tv_usec)
801         || (used.ru_stime.tv_sec != prev.ru_stime.tv_sec)) {
802       /*fprintf(stderr,"success after %d runs\n",count);*/
803       return 0;
804     }
805   }
806   /* getrusage is defined but does not work. */
807   /*fprintf(stderr,"failure after %d runs\n",count);*/
808   return 1;
809 }],
810 cl_cv_func_getrusage_works=yes,
811 cl_cv_func_getrusage_works=no,
812 dnl When cross-compiling, don't assume anything.
813 cl_cv_func_getrusage_works="guessing no")])
814   fi
815   if test $cl_cv_func_getrusage_works = yes; then
816     AC_DEFINE(HAVE_GETRUSAGE,,[have <sys/time.h>, the getrusage() function, the struct rusage type, and <sys/resource.h> defines RUSAGE_SELF])
817     AC_DEFINE_UNQUOTED(RUSAGE_WHO_T,$cl_cv_proto_getrusage_arg1,[type of `who' in getrusage() declaration])
818   fi
819 fi
820 ])
821
822 dnl -*- Autoconf -*-
823 dnl Copyright (C) 1993-2003 Free Software Foundation, Inc.
824 dnl This file is free software, distributed under the terms of the GNU
825 dnl General Public License.  As a special exception to the GNU General
826 dnl Public License, this file may be distributed as part of a program
827 dnl that contains a configuration script generated by Autoconf, under
828 dnl the same distribution terms as the rest of that program.
829
830 dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
831
832 AC_PREREQ(2.57)
833
834 AC_DEFUN([CL_TIMES_CLOCK],
835 [AC_REQUIRE([CL_GETTIMEOFDAY])dnl
836 if test $ac_cv_func_gettimeofday = no -a $ac_cv_func_ftime = no; then
837 AC_CHECK_FUNC(times, , no_times=1)dnl
838 if test -z "$no_times"; then
839 AC_CACHE_CHECK(for times return value, cl_cv_func_times_return, [
840 AC_TRY_RUN([
841 #include <sys/types.h>
842 #include <time.h> /* needed for CLK_TCK */
843 #ifndef CLK_TCK
844 #include <sys/time.h> /* needed for CLK_TCK on SYSV PTX */
845 #endif
846 #include <sys/times.h>
847 int main ()
848 { struct tms buffer;
849   clock_t result1;
850   clock_t result2;
851   int ticks;
852   result1 = times(&buffer);
853   if ((result1 == (clock_t)0) || (result1 == (clock_t)(-1))) exit(1);
854   sleep(1);
855   result2 = times(&buffer);
856   if ((result2 == (clock_t)0) || (result2 == (clock_t)(-1))) exit(1);
857   ticks = result2 - result1;
858   exit(!((ticks >= CLK_TCK/2) && (ticks <= 3*CLK_TCK/2)));
859 }], cl_cv_func_times_return=yes, cl_cv_func_times_return=no,
860 dnl When cross-compiling, don't assume anything.
861 cl_cv_func_times_return="guessing no")
862 ])
863 case "$cl_cv_func_times_return" in
864   *yes) AC_DEFINE(HAVE_TIMES_CLOCK,,[have the times() function and it returns the real time, but do not have the gettimeofday() or ftime() function]) ;;
865   *no)  ;;
866 esac
867 fi
868 fi
869 ])
870
871 m4_include([m4/gmp.m4])
872 m4_include([m4/libtool.m4])