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