1 # generated automatically by aclocal 1.9.5 -*- Autoconf -*-
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.
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
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.
22 dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
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)]))
33 #define alloca __builtin_alloca
37 #define alloca _alloca
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()])
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.
75 dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
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
87 int foo() { return 0; }
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
94 cl_cv_prog_as_underscore=no
98 if test $cl_cv_prog_as_underscore = yes; then
100 AC_DEFINE(ASM_UNDERSCORE,,[symbols are prefixed by an underscore in assembly language])
104 AC_SUBST(AS_UNDERSCORE)dnl
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.
114 dnl From Bruno Haible, Marcus Daniels.
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 (); };
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$'
132 if grep '_GLOBAL_\.I\.foobar' conftest.s >/dev/null ; then
133 cl_cv_cplusplus_ctorprefix='_GLOBAL_.I.'
135 if grep '_GLOBAL__I_foobar' conftest.s >/dev/null ; then
136 cl_cv_cplusplus_ctorprefix='_GLOBAL__I_'
138 cl_cv_cplusplus_ctorprefix=unknown
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 (); };
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$'
158 if grep '_GLOBAL_\.D\.foobar' conftest.s >/dev/null ; then
159 cl_cv_cplusplus_dtorprefix='_GLOBAL_.D.'
161 if grep '_GLOBAL__D_foobar' conftest.s >/dev/null ; then
162 cl_cv_cplusplus_dtorprefix='_GLOBAL__D_'
164 cl_cv_cplusplus_dtorprefix=none
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)
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 (); };
182 cat > conftest2.cc << EOF
183 #include "confdefs.h"
184 #ifdef ASM_UNDERSCORE
185 #define ASM_UNDERSCORE_PREFIX "_"
187 #define ASM_UNDERSCORE_PREFIX ""
189 struct foo { foo (); };
191 extern "C" void ctor (void) __asm__ (ASM_UNDERSCORE_PREFIX CL_GLOBAL_CONSTRUCTOR_PREFIX "foobar");
192 int main() { ctor(); return 0; }
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
197 cl_cv_cplusplus_ctorexport=yes
201 if test "$cl_cv_cplusplus_ctorexport" = yes; then
202 AC_DEFINE(CL_NEED_GLOBALIZE_CTORDTOR)
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.
216 dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
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]))
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.
240 dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
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
250 dnl AC_TRY_CPP(INCLUDES,
251 dnl ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
252 dnl CL_CPP_CHECK(ECHO-TEXT, CACHE-ID,
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])
261 AC_DEFUN([CL_CPP_CHECK],
262 [AC_MSG_CHECKING(for $1)
264 AC_TRY_CPP([$3], $2=yes, $2=no)
267 if test [$]$2 = yes; then
268 ifelse([$4], , :, [$4])
269 ifelse([$5], , , [else
275 AC_DEFUN([CL_COMPILE_CHECK],
276 [AC_MSG_CHECKING(for $1)
278 AC_TRY_COMPILE([$3],[$4], $2=yes, $2=no)
281 if test [$]$2 = yes; then
282 ifelse([$5], , :, [$5])
283 ifelse([$6], , , [else
289 AC_DEFUN([CL_LINK_CHECK],
290 [AC_MSG_CHECKING(for $1)
292 AC_TRY_LINK([$3],[$4], $2=yes, $2=no)
295 if test [$]$2 = yes; then
296 ifelse([$5], , :, [$5])
297 ifelse([$6], , , [else
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
310 popdef([AC_MSG_RESULT])dnl
311 popdef([AC_CHECKING])dnl
312 popdef([AC_MSG_CHECKING])dnl
315 dnl Expands to the "extern ..." prefix used for system declarations.
317 AC_DEFUN([AC_LANG_EXTERN],
324 AC_DEFUN([CL_CC_WORKS],
325 [AC_CACHE_CHECK(whether CC works at all, cl_cv_prog_cc_works, [
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))
333 case "$cl_cv_prog_cc_works" in
334 *no) echo "Installation or configuration problem: C compiler cannot create executables."; exit 1;;
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
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
362 AC_DEFUN([CL_CANONICAL_HOST_CPU],
363 [AC_REQUIRE([CL_CANONICAL_HOST])AC_REQUIRE([AC_PROG_CC])
369 alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] )
372 hppa1.0 | hppa1.1 | hppa2.0* | hppa64 )
378 c1 | c2 | c32 | c34 | c38 | c4 )
386 AC_CACHE_CHECK([for 64-bit MIPS], cl_cv_host_mips64, [
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. */
394 ], cl_cv_host_mips64=yes, cl_cv_host_mips64=no)
396 if test $cl_cv_host_mips64 = yes; then
400 dnl UltraSPARCs running Linux have `uname -m` = "sparc64", but the C compiler
401 dnl still generates 32-bit code.
403 AC_CACHE_CHECK([for 64-bit SPARC], cl_cv_host_sparc64, [
405 [#if defined(__sparcv9) || defined(__arch64__)
408 ], cl_cv_host_sparc64=yes, cl_cv_host_sparc64=no)
410 if test $cl_cv_host_sparc64 = yes; then
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
425 AC_DEFUN([CL_CANONICAL_HOST_CPU_FOR_FFCALL],
426 [AC_REQUIRE([CL_CANONICAL_HOST])AC_REQUIRE([AC_PROG_CC])
432 alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] )
435 hppa1.0 | hppa1.1 | hppa2.0* | hppa64 )
441 c1 | c2 | c32 | c34 | c38 | c4 )
449 AC_CACHE_CHECK([for 64-bit MIPS], cl_cv_host_mips64, [
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. */
457 ], cl_cv_host_mips64=yes, cl_cv_host_mips64=no)
459 if test $cl_cv_host_mips64 = yes; then
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.
470 ], cl_cv_host_mipsn32=yes, cl_cv_host_mipsn32=no)
472 if test $cl_cv_host_mipsn32 = yes; then
477 dnl UltraSPARCs running Linux have `uname -m` = "sparc64", but the C compiler
478 dnl still generates 32-bit code.
480 AC_CACHE_CHECK([for 64-bit SPARC], cl_cv_host_sparc64, [
482 [#if defined(__sparcv9) || defined(__arch64__)
485 ], cl_cv_host_sparc64=yes, cl_cv_host_sparc64=no)
487 if test $cl_cv_host_sparc64 = yes; then
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
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.
510 dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
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], [
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 *",
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])
540 AC_DEFINE_UNQUOTED(GETTIMEOFDAY_TZP_T,$cl_cv_proto_gettimeofday_arg2,[type of `tzp' in gettimeofday() declaration])
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.
553 dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
557 AC_DEFUN([CL_MACHINE],
558 [AC_REQUIRE([AC_PROG_CC])dnl
559 AC_REQUIRE([AC_C_CHAR_UNSIGNED])dnl
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"
568 cat "$cl_machine_file_c" >> conftest.$ac_ext
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'`
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
584 rm -f "$cl_machine_file_h"
585 mv conftest.h "$cl_machine_file_h"
589 echo "creation of $cl_machine_file_h failed"
594 echo "cross-compiling - cannot create $cl_machine_file_h"
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.
605 dnl From Bruno Haible, Marcus Daniels, Paul Eggert.
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.
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)])
622 if test $cl_cv_c_longdouble = yes; then
623 AC_DEFINE(HAVE_LONGDOUBLE)
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.
635 dnl From Bruno Haible, Marcus Daniels, Sam Steingold, Paul Eggert.
639 AC_DEFUN([CL_LONGLONG],
640 [AC_CACHE_CHECK(for long long type, cl_cv_c_longlong, [
641 AC_TRY_RUN([int main()
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
646 #if defined(__m68k__) || (defined(_IBMR2) || defined(__powerpc))
647 #if defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ <= 7)
651 { long x = 944938507; long y = 737962842; long z = 162359677;
652 exit(!(((long long) x)*((long long) y)>>32 == z));
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)])
663 if test $cl_cv_c_longlong = yes; then
664 AC_DEFINE(HAVE_LONGLONG,,[compiler supports the `long long' type])
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.
676 dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
680 AC_DEFUN([CL_PERROR],
681 [AC_MSG_CHECKING(for perror declaration)
682 AC_CACHE_VAL(cl_cv_proto_perror, [
684 /* Some systems declare perror() in <errno.h>, some in <stdio.h>, some don't
685 declare it at all. */
688 ]AC_LANG_EXTERN[double perror ();], [],
689 cl_cv_proto_perror=no, cl_cv_proto_perror=yes)
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()])
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.
704 dnl From Bruno Haible, Marcus Daniels.
708 dnl CL_PROTO(IDENTIFIER, ACTION-IF-NOT-FOUND, FINAL-PROTOTYPE)
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:-
718 dnl CL_PROTO_RET(INCLUDES, ANSI-DECL, TRAD-DECL, CACHE-ID, TYPE-IF-OK, TYPE-IF-FAILS)
719 AC_DEFUN([CL_PROTO_RET],
722 [#if defined(__STDC__) || defined(__cplusplus)
727 ], [], $4="$5", $4="$6")
730 dnl CL_PROTO_TRY(INCLUDES, ANSI-DECL, TRAD-DECL, ACTION-IF-OK, ACTION-IF-FAILS)
731 AC_DEFUN([CL_PROTO_TRY],
734 [#if defined(__STDC__) || defined(__cplusplus)
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")]
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.
755 dnl From Bruno Haible, Marcus Daniels, Sam Steingold, Peter Burwood, Sam Steingold.
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], [
775 #include <sys/types.h> /* NetBSD 1.0 needs this */
776 #include <sys/time.h>
777 #include <sys/resource.h>
779 [int getrusage (int who, struct rusage * rusage);],
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, [
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>
793 struct rusage used, prev;
794 time_t end = time(NULL)+2;
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);*/
802 while (time(NULL) < end) {
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);*/
813 /* getrusage is defined but does not work. */
814 /*fprintf(stderr,"failure after %d runs\n",count);*/
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")])
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])
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.
837 dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
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, [
848 #include <sys/types.h>
849 #include <time.h> /* needed for CLK_TCK */
851 #include <sys/time.h> /* needed for CLK_TCK on SYSV PTX */
853 #include <sys/times.h>
859 result1 = times(&buffer);
860 if ((result1 == (clock_t)0) || (result1 == (clock_t)(-1))) exit(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")
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]) ;;
878 m4_include([m4/cc.m4])
879 m4_include([m4/gmp.m4])
880 m4_include([m4/libtool.m4])