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
14 m4_include([intparam.m4])
15 m4_include([floatparam.m4])
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.
25 dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
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)]))
36 #define alloca __builtin_alloca
40 #define alloca _alloca
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()])
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.
78 dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
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
90 int foo() { return 0; }
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
97 cl_cv_prog_as_underscore=no
101 if test $cl_cv_prog_as_underscore = yes; then
103 AC_DEFINE(ASM_UNDERSCORE,,[symbols are prefixed by an underscore in assembly language])
107 AC_SUBST(AS_UNDERSCORE)dnl
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.
117 dnl From Bruno Haible, Marcus Daniels.
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 (); };
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$'
135 if grep '_GLOBAL_\.I\.foobar' conftest.s >/dev/null ; then
136 cl_cv_cplusplus_ctorprefix='_GLOBAL_.I.'
138 if grep '_GLOBAL__I_foobar' conftest.s >/dev/null ; then
139 cl_cv_cplusplus_ctorprefix='_GLOBAL__I_'
141 cl_cv_cplusplus_ctorprefix=unknown
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 (); };
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$'
161 if grep '_GLOBAL_\.D\.foobar' conftest.s >/dev/null ; then
162 cl_cv_cplusplus_dtorprefix='_GLOBAL_.D.'
164 if grep '_GLOBAL__D_foobar' conftest.s >/dev/null ; then
165 cl_cv_cplusplus_dtorprefix='_GLOBAL__D_'
167 cl_cv_cplusplus_dtorprefix=none
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)
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 (); };
185 cat > conftest2.cc << EOF
186 #include "confdefs.h"
187 #ifdef ASM_UNDERSCORE
188 #define ASM_UNDERSCORE_PREFIX "_"
190 #define ASM_UNDERSCORE_PREFIX ""
192 struct foo { foo (); };
194 extern "C" void ctor (void) __asm__ (ASM_UNDERSCORE_PREFIX CL_GLOBAL_CONSTRUCTOR_PREFIX "foobar");
195 int main() { ctor(); return 0; }
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
200 cl_cv_cplusplus_ctorexport=yes
204 if test "$cl_cv_cplusplus_ctorexport" = yes; then
205 AC_DEFINE(CL_NEED_GLOBALIZE_CTORDTOR)
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.
219 dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
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]))
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.
243 dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
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
253 dnl AC_TRY_CPP(INCLUDES,
254 dnl ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
255 dnl CL_CPP_CHECK(ECHO-TEXT, CACHE-ID,
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])
264 AC_DEFUN([CL_CPP_CHECK],
265 [AC_MSG_CHECKING(for $1)
267 AC_TRY_CPP([$3], $2=yes, $2=no)
270 if test [$]$2 = yes; then
271 ifelse([$4], , :, [$4])
272 ifelse([$5], , , [else
278 AC_DEFUN([CL_COMPILE_CHECK],
279 [AC_MSG_CHECKING(for $1)
281 AC_TRY_COMPILE([$3],[$4], $2=yes, $2=no)
284 if test [$]$2 = yes; then
285 ifelse([$5], , :, [$5])
286 ifelse([$6], , , [else
292 AC_DEFUN([CL_LINK_CHECK],
293 [AC_MSG_CHECKING(for $1)
295 AC_TRY_LINK([$3],[$4], $2=yes, $2=no)
298 if test [$]$2 = yes; then
299 ifelse([$5], , :, [$5])
300 ifelse([$6], , , [else
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
313 popdef([AC_MSG_RESULT])dnl
314 popdef([AC_CHECKING])dnl
315 popdef([AC_MSG_CHECKING])dnl
318 dnl Expands to the "extern ..." prefix used for system declarations.
320 AC_DEFUN([AC_LANG_EXTERN],
327 AC_DEFUN([CL_CC_WORKS],
328 [AC_CACHE_CHECK(whether CC works at all, cl_cv_prog_cc_works, [
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))
336 case "$cl_cv_prog_cc_works" in
337 *no) echo "Installation or configuration problem: C compiler cannot create executables."; exit 1;;
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
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
365 AC_DEFUN([CL_CANONICAL_HOST_CPU],
366 [AC_REQUIRE([CL_CANONICAL_HOST])AC_REQUIRE([AC_PROG_CC])
372 alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] )
375 hppa1.0 | hppa1.1 | hppa2.0* | hppa64 )
381 c1 | c2 | c32 | c34 | c38 | c4 )
389 AC_CACHE_CHECK([for 64-bit MIPS], cl_cv_host_mips64, [
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. */
397 ], cl_cv_host_mips64=yes, cl_cv_host_mips64=no)
399 if test $cl_cv_host_mips64 = yes; then
403 dnl UltraSPARCs running Linux have `uname -m` = "sparc64", but the C compiler
404 dnl still generates 32-bit code.
406 AC_CACHE_CHECK([for 64-bit SPARC], cl_cv_host_sparc64, [
408 [#if defined(__sparcv9) || defined(__arch64__)
411 ], cl_cv_host_sparc64=yes, cl_cv_host_sparc64=no)
413 if test $cl_cv_host_sparc64 = yes; then
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
428 AC_DEFUN([CL_CANONICAL_HOST_CPU_FOR_FFCALL],
429 [AC_REQUIRE([CL_CANONICAL_HOST])AC_REQUIRE([AC_PROG_CC])
435 alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] )
438 hppa1.0 | hppa1.1 | hppa2.0* | hppa64 )
444 c1 | c2 | c32 | c34 | c38 | c4 )
452 AC_CACHE_CHECK([for 64-bit MIPS], cl_cv_host_mips64, [
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. */
460 ], cl_cv_host_mips64=yes, cl_cv_host_mips64=no)
462 if test $cl_cv_host_mips64 = yes; then
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.
473 ], cl_cv_host_mipsn32=yes, cl_cv_host_mipsn32=no)
475 if test $cl_cv_host_mipsn32 = yes; then
480 dnl UltraSPARCs running Linux have `uname -m` = "sparc64", but the C compiler
481 dnl still generates 32-bit code.
483 AC_CACHE_CHECK([for 64-bit SPARC], cl_cv_host_sparc64, [
485 [#if defined(__sparcv9) || defined(__arch64__)
488 ], cl_cv_host_sparc64=yes, cl_cv_host_sparc64=no)
490 if test $cl_cv_host_sparc64 = yes; then
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
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.
513 dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
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], [
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 *",
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])
543 AC_DEFINE_UNQUOTED(GETTIMEOFDAY_TZP_T,$cl_cv_proto_gettimeofday_arg2,[type of `tzp' in gettimeofday() declaration])
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.
556 dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
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
565 if test -z "$[$5]"; then
566 AC_CHECKING(for [$1])
567 if test $cross_compiling = no; then
569 cat > conftest.$ac_ext <<EOF
570 #include "confdefs.h"
572 cat "$cl_machine_file_c" >> conftest.$ac_ext
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'`
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
588 rm -f "$cl_machine_file_h"
589 mv conftest.h "$cl_machine_file_h"
593 echo "creation of $cl_machine_file_h failed"
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.
609 dnl From Bruno Haible, Marcus Daniels, Paul Eggert.
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.
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)])
626 if test $cl_cv_c_longdouble = yes; then
627 AC_DEFINE(HAVE_LONGDOUBLE)
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.
639 dnl From Bruno Haible, Marcus Daniels, Sam Steingold, Paul Eggert.
643 AC_DEFUN([CL_LONGLONG],
644 [AC_CACHE_CHECK(for long long type, cl_cv_c_longlong, [
645 AC_TRY_RUN([int main()
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
650 #if defined(__m68k__) || (defined(_IBMR2) || defined(__powerpc))
651 #if defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ <= 7)
655 { long x = 944938507; long y = 737962842; long z = 162359677;
656 exit(!(((long long) x)*((long long) y)>>32 == z));
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)])
667 if test $cl_cv_c_longlong = yes; then
668 AC_DEFINE(HAVE_LONGLONG,,[compiler supports the `long long' type])
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.
680 dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
684 AC_DEFUN([CL_PERROR],
685 [AC_MSG_CHECKING(for perror declaration)
686 AC_CACHE_VAL(cl_cv_proto_perror, [
688 /* Some systems declare perror() in <errno.h>, some in <stdio.h>, some don't
689 declare it at all. */
692 ]AC_LANG_EXTERN[double perror ();], [],
693 cl_cv_proto_perror=no, cl_cv_proto_perror=yes)
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()])
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.
708 dnl From Bruno Haible, Marcus Daniels.
712 dnl CL_PROTO(IDENTIFIER, ACTION-IF-NOT-FOUND, FINAL-PROTOTYPE)
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:-
722 dnl CL_PROTO_RET(INCLUDES, ANSI-DECL, TRAD-DECL, CACHE-ID, TYPE-IF-OK, TYPE-IF-FAILS)
723 AC_DEFUN([CL_PROTO_RET],
726 [#if defined(__STDC__) || defined(__cplusplus)
731 ], [], $4="$5", $4="$6")
734 dnl CL_PROTO_TRY(INCLUDES, ANSI-DECL, TRAD-DECL, ACTION-IF-OK, ACTION-IF-FAILS)
735 AC_DEFUN([CL_PROTO_TRY],
738 [#if defined(__STDC__) || defined(__cplusplus)
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")]
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.
759 dnl From Bruno Haible, Marcus Daniels, Sam Steingold, Peter Burwood, Sam Steingold.
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], [
779 #include <sys/types.h> /* NetBSD 1.0 needs this */
780 #include <sys/time.h>
781 #include <sys/resource.h>
783 [int getrusage (int who, struct rusage * rusage);],
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, [
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>
797 struct rusage used, prev;
798 time_t end = time(NULL)+2;
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);*/
806 while (time(NULL) < end) {
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);*/
817 /* getrusage is defined but does not work. */
818 /*fprintf(stderr,"failure after %d runs\n",count);*/
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")])
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])
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.
841 dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
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, [
852 #include <sys/types.h>
853 #include <time.h> /* needed for CLK_TCK */
855 #include <sys/time.h> /* needed for CLK_TCK on SYSV PTX */
857 #include <sys/times.h>
863 result1 = times(&buffer);
864 if ((result1 == (clock_t)0) || (result1 == (clock_t)(-1))) exit(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")
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]) ;;
882 m4_include([m4/cc.m4])
883 m4_include([m4/gmp.m4])
884 m4_include([m4/libtool.m4])