]> www.ginac.de Git - cln.git/blob - autoconf/aclocal.m4
Define HAVE_LONGLONG and HAVE_LONGDOUBLE when cross-compiling.
[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-2005 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, Paul Eggert.
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, use the test from gnulib.
615 AC_TRY_COMPILE([
616   /* The Stardent Vistra knows sizeof(long double), but does not support it.  */
617   long double foo = 0.0;
618   /* On Ultrix 4.3 cc, long double is 4 and double is 8.  */
619   int array [2*(sizeof(long double) >= sizeof(double)) - 1];
620   ], , cl_cv_c_longdouble=yes, cl_cv_c_longdouble=no)])
621 ])
622 if test $cl_cv_c_longdouble = yes; then
623   AC_DEFINE(HAVE_LONGDOUBLE)
624 fi
625 ])
626
627 dnl -*- Autoconf -*-
628 dnl Copyright (C) 1993-2005 Free Software Foundation, Inc.
629 dnl This file is free software, distributed under the terms of the GNU
630 dnl General Public License.  As a special exception to the GNU General
631 dnl Public License, this file may be distributed as part of a program
632 dnl that contains a configuration script generated by Autoconf, under
633 dnl the same distribution terms as the rest of that program.
634
635 dnl From Bruno Haible, Marcus Daniels, Sam Steingold, Paul Eggert.
636
637 AC_PREREQ(2.57)
638
639 AC_DEFUN([CL_LONGLONG],
640 [AC_CACHE_CHECK(for long long type, cl_cv_c_longlong, [
641 AC_TRY_RUN([int main()
642 {
643 /* long longs don't work right with gcc-2.7.2 on m68k */
644 /* long longs don't work right with gcc-2.7.2 on rs6000: avcall/tests.c gets
645    miscompiled. */
646 #if defined(__m68k__) || (defined(_IBMR2) || defined(__powerpc))
647 #if defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ <= 7)
648   exit(1);
649 #endif
650 #endif
651   { long x = 944938507; long y = 737962842; long z = 162359677;
652     exit(!(((long long) x)*((long long) y)>>32 == z));
653   }
654 }],
655 cl_cv_c_longlong=yes, cl_cv_c_longlong=no, [
656 dnl When cross-compiling, use the test from gnulib.
657 AC_TRY_LINK([long long ll = 1LL; int i = 63;],
658   [long long llmax = (long long) -1;
659    return ll << i | ll >> i | llmax / ll | llmax % ll;],
660   cl_cv_c_longlong=yes,
661   cl_cv_c_longlong=no)])
662 ])
663 if test $cl_cv_c_longlong = yes; then
664   AC_DEFINE(HAVE_LONGLONG,,[compiler supports the `long long' type])
665 fi
666 ])
667
668 dnl -*- Autoconf -*-
669 dnl Copyright (C) 1993-2003 Free Software Foundation, Inc.
670 dnl This file is free software, distributed under the terms of the GNU
671 dnl General Public License.  As a special exception to the GNU General
672 dnl Public License, this file may be distributed as part of a program
673 dnl that contains a configuration script generated by Autoconf, under
674 dnl the same distribution terms as the rest of that program.
675
676 dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
677
678 AC_PREREQ(2.57)
679
680 AC_DEFUN([CL_PERROR],
681 [AC_MSG_CHECKING(for perror declaration)
682 AC_CACHE_VAL(cl_cv_proto_perror, [
683 AC_TRY_COMPILE([
684 /* Some systems declare perror() in <errno.h>, some in <stdio.h>, some don't
685    declare it at all. */
686 #include <stdio.h>
687 #include <errno.h>
688 ]AC_LANG_EXTERN[double perror ();], [],
689 cl_cv_proto_perror=no, cl_cv_proto_perror=yes)
690 ])
691 AC_MSG_RESULT([$cl_cv_proto_perror])
692 if test $cl_cv_proto_perror = yes; then
693 AC_DEFINE(HAVE_PERROR_DECL,,[<errno.h> or <stdio.h> contains a declaration for perror()])
694 fi
695 ])
696
697 dnl Copyright (C) 1993-2002 Free Software Foundation, Inc.
698 dnl This file is free software, distributed under the terms of the GNU
699 dnl General Public License.  As a special exception to the GNU General
700 dnl Public License, this file may be distributed as part of a program
701 dnl that contains a configuration script generated by Autoconf, under
702 dnl the same distribution terms as the rest of that program.
703
704 dnl From Bruno Haible, Marcus Daniels.
705
706 AC_PREREQ(2.13)
707
708 dnl CL_PROTO(IDENTIFIER, ACTION-IF-NOT-FOUND, FINAL-PROTOTYPE)
709 AC_DEFUN([CL_PROTO],
710 [AC_MSG_CHECKING([for $1 declaration])
711 AC_CACHE_VAL(cl_cv_proto_[$1], [$2
712 cl_cv_proto_$1="$3"])
713 cl_cv_proto_$1=`echo "[$]cl_cv_proto_$1" | tr -s ' ' | sed -e 's/( /(/'`
714 AC_MSG_RESULT([$]{ac_t:-
715          }[$]cl_cv_proto_$1)
716 ])
717
718 dnl CL_PROTO_RET(INCLUDES, ANSI-DECL, TRAD-DECL, CACHE-ID, TYPE-IF-OK, TYPE-IF-FAILS)
719 AC_DEFUN([CL_PROTO_RET],
720 [AC_TRY_COMPILE([$1]
721 AC_LANG_EXTERN
722 [#if defined(__STDC__) || defined(__cplusplus)
723 $2
724 #else
725 $3
726 #endif
727 ], [], $4="$5", $4="$6")
728 ])
729
730 dnl CL_PROTO_TRY(INCLUDES, ANSI-DECL, TRAD-DECL, ACTION-IF-OK, ACTION-IF-FAILS)
731 AC_DEFUN([CL_PROTO_TRY],
732 [AC_TRY_COMPILE([$1]
733 AC_LANG_EXTERN
734 [#if defined(__STDC__) || defined(__cplusplus)
735 $2
736 #else
737 $3
738 #endif
739 ], [], [$4], [$5])
740 ])
741
742 dnl CL_PROTO_CONST(INCLUDES, ANSI-DECL, TRAD-DECL, CACHE-ID)
743 AC_DEFUN([CL_PROTO_CONST],
744 [CL_PROTO_TRY([$1], [$2], [$3], $4="", $4="const")]
745 )
746
747 dnl -*- Autoconf -*-
748 dnl Copyright (C) 1993-2003 Free Software Foundation, Inc.
749 dnl This file is free software, distributed under the terms of the GNU
750 dnl General Public License.  As a special exception to the GNU General
751 dnl Public License, this file may be distributed as part of a program
752 dnl that contains a configuration script generated by Autoconf, under
753 dnl the same distribution terms as the rest of that program.
754
755 dnl From Bruno Haible, Marcus Daniels, Sam Steingold, Peter Burwood, Sam Steingold.
756
757 AC_PREREQ(2.57)
758
759 AC_DEFUN([CL_RUSAGE],
760 [AC_CHECK_HEADERS(sys/resource.h sys/times.h)dnl
761 if test $ac_cv_header_sys_resource_h = yes; then
762   dnl HAVE_SYS_RESOURCE_H defined
763   CL_LINK_CHECK([getrusage], cl_cv_func_getrusage,
764 [#include <sys/types.h> /* NetBSD 1.0 needs this */
765 #include <sys/time.h>
766 #include <sys/resource.h>],
767     [struct rusage x; int y = RUSAGE_SELF; getrusage(y,&x); x.ru_utime.tv_sec;])dnl
768   if test $cl_cv_func_getrusage = yes; then
769     CL_PROTO([getrusage], [
770     CL_PROTO_TRY([
771 #include <stdlib.h>
772 #ifdef HAVE_UNISTD_H
773 #include <unistd.h>
774 #endif
775 #include <sys/types.h> /* NetBSD 1.0 needs this */
776 #include <sys/time.h>
777 #include <sys/resource.h>
778 ],
779 [int getrusage (int who, struct rusage * rusage);],
780 [int getrusage();],
781 [cl_cv_proto_getrusage_arg1="int"],
782 [cl_cv_proto_getrusage_arg1="enum __rusage_who"])
783 ], [extern int getrusage ($cl_cv_proto_getrusage_arg1, struct rusage *);])dnl
784     AC_CACHE_CHECK(whether getrusage works, cl_cv_func_getrusage_works, [
785     AC_TRY_RUN([
786 #include <stdio.h>
787 #include <sys/types.h> /* NetBSD 1.0 needs this */
788 #include <sys/time.h>
789 #include <time.h> /* for time(2) */
790 #include <sys/resource.h>
791 int main ()
792 {
793   struct rusage used, prev;
794   time_t end = time(NULL)+2;
795   int count = 0;
796
797   if ((count = getrusage(RUSAGE_SELF, &prev))) {
798     /* getrusage is defined but does not do anything. */
799     /*fprintf(stderr,"getrusage failed: return=%d\n",count);*/
800     return 1;
801   }
802   while (time(NULL) < end) {
803     count++;
804     getrusage(RUSAGE_SELF, &used);
805     if ((used.ru_utime.tv_usec != prev.ru_utime.tv_usec)
806         || (used.ru_utime.tv_sec != prev.ru_utime.tv_sec)
807         || (used.ru_stime.tv_usec != prev.ru_stime.tv_usec)
808         || (used.ru_stime.tv_sec != prev.ru_stime.tv_sec)) {
809       /*fprintf(stderr,"success after %d runs\n",count);*/
810       return 0;
811     }
812   }
813   /* getrusage is defined but does not work. */
814   /*fprintf(stderr,"failure after %d runs\n",count);*/
815   return 1;
816 }],
817 cl_cv_func_getrusage_works=yes,
818 cl_cv_func_getrusage_works=no,
819 dnl When cross-compiling, don't assume anything.
820 cl_cv_func_getrusage_works="guessing no")])
821   fi
822   if test "$cl_cv_func_getrusage_works" = yes; then
823     AC_DEFINE(HAVE_GETRUSAGE,,[have <sys/time.h>, the getrusage() function, the struct rusage type, and <sys/resource.h> defines RUSAGE_SELF])
824     AC_DEFINE_UNQUOTED(RUSAGE_WHO_T,$cl_cv_proto_getrusage_arg1,[type of `who' in getrusage() declaration])
825   fi
826 fi
827 ])
828
829 dnl -*- Autoconf -*-
830 dnl Copyright (C) 1993-2003 Free Software Foundation, Inc.
831 dnl This file is free software, distributed under the terms of the GNU
832 dnl General Public License.  As a special exception to the GNU General
833 dnl Public License, this file may be distributed as part of a program
834 dnl that contains a configuration script generated by Autoconf, under
835 dnl the same distribution terms as the rest of that program.
836
837 dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
838
839 AC_PREREQ(2.57)
840
841 AC_DEFUN([CL_TIMES_CLOCK],
842 [AC_REQUIRE([CL_GETTIMEOFDAY])dnl
843 if test $ac_cv_func_gettimeofday = no -a $ac_cv_func_ftime = no; then
844 AC_CHECK_FUNC(times, , no_times=1)dnl
845 if test -z "$no_times"; then
846 AC_CACHE_CHECK(for times return value, cl_cv_func_times_return, [
847 AC_TRY_RUN([
848 #include <sys/types.h>
849 #include <time.h> /* needed for CLK_TCK */
850 #ifndef CLK_TCK
851 #include <sys/time.h> /* needed for CLK_TCK on SYSV PTX */
852 #endif
853 #include <sys/times.h>
854 int main ()
855 { struct tms buffer;
856   clock_t result1;
857   clock_t result2;
858   int ticks;
859   result1 = times(&buffer);
860   if ((result1 == (clock_t)0) || (result1 == (clock_t)(-1))) exit(1);
861   sleep(1);
862   result2 = times(&buffer);
863   if ((result2 == (clock_t)0) || (result2 == (clock_t)(-1))) exit(1);
864   ticks = result2 - result1;
865   exit(!((ticks >= CLK_TCK/2) && (ticks <= 3*CLK_TCK/2)));
866 }], cl_cv_func_times_return=yes, cl_cv_func_times_return=no,
867 dnl When cross-compiling, don't assume anything.
868 cl_cv_func_times_return="guessing no")
869 ])
870 case "$cl_cv_func_times_return" in
871   *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]) ;;
872   *no)  ;;
873 esac
874 fi
875 fi
876 ])
877
878 m4_include([m4/cc.m4])
879 m4_include([m4/gmp.m4])
880 m4_include([m4/libtool.m4])