# generated automatically by aclocal 1.9 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 # Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. dnl -*- Autoconf -*- dnl Copyright (C) 1993-2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl From Bruno Haible, Marcus Daniels, Sam Steingold. AC_PREREQ(2.57) AC_DEFUN([CL_ALLOCA], [# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! CL_LINK_CHECK(working alloca.h, cl_cv_header_alloca_h, [#include ], [char *p = (char *) alloca(2 * sizeof(int));], AC_DEFINE(HAVE_ALLOCA_H,,[have and it should be used (not Ultrix)])) decl="#ifdef __GNUC__ #define alloca __builtin_alloca #else #ifdef _MSC_VER #include #define alloca _alloca #else #ifdef HAVE_ALLOCA_H #include #else #ifdef _AIX #pragma alloca #else #ifndef alloca char *alloca (); #endif #endif #endif #endif #endif " CL_LINK_CHECK([alloca], cl_cv_func_alloca, $decl, [char *p = (char *) alloca(1);], , [alloca_missing=1])dnl if test -n "$alloca_missing"; then # The SVR3 libPW and SVR4 libucb both contain incompatible functions # that cause trouble. Some versions do not even contain alloca or # contain a buggy version. If you still want to use their alloca, # use ar to extract alloca.o from them instead of compiling alloca.c. ALLOCA=alloca.${ac_objext} AC_DEFINE(NO_ALLOCA,,[need to link with an external alloca.o when using alloca()]) fi AC_SUBST(ALLOCA)dnl ]) dnl -*- Autoconf -*- dnl Copyright (C) 1993-2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl From Bruno Haible, Marcus Daniels, Sam Steingold. AC_PREREQ(2.57) AC_DEFUN([CL_AS_UNDERSCORE], [AC_BEFORE([$0], [CL_GLOBAL_CONSTRUCTORS]) m4_pattern_allow([^AS_UNDERSCORE$]) AC_CACHE_CHECK(for underscore in external names, cl_cv_prog_as_underscore, [ cat > conftest.c </dev/null 2>&1 if grep _foo conftest.s >/dev/null ; then cl_cv_prog_as_underscore=yes else cl_cv_prog_as_underscore=no fi rm -f conftest* ]) if test $cl_cv_prog_as_underscore = yes; then AS_UNDERSCORE=true AC_DEFINE(ASM_UNDERSCORE,,[symbols are prefixed by an underscore in assembly language]) else AS_UNDERSCORE=false fi AC_SUBST(AS_UNDERSCORE)dnl ]) dnl Copyright (C) 1993-2002 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl From Bruno Haible, Marcus Daniels. AC_PREREQ(2.13) AC_DEFUN([CL_GLOBAL_CONSTRUCTORS], [AC_REQUIRE([CL_AS_UNDERSCORE])dnl if test -n "$GCC"; then AC_CACHE_CHECK(for the global constructors function prefix, cl_cv_cplusplus_ctorprefix, [ cat > conftest.cc << EOF struct foo { foo (); }; foo foobar; EOF # look for the assembly language name in the .s file AC_TRY_COMMAND(${CXX-g++} $CXXFLAGS -S conftest.cc) >/dev/null 2>&1 if grep '_GLOBAL_\$I\$foobar' conftest.s >/dev/null ; then cl_cv_cplusplus_ctorprefix='_GLOBAL_$I$' else if grep '_GLOBAL_\.I\.foobar' conftest.s >/dev/null ; then cl_cv_cplusplus_ctorprefix='_GLOBAL_.I.' else if grep '_GLOBAL__I_foobar' conftest.s >/dev/null ; then cl_cv_cplusplus_ctorprefix='_GLOBAL__I_' else cl_cv_cplusplus_ctorprefix=unknown fi fi fi rm -f conftest* ]) if test "$cl_cv_cplusplus_ctorprefix" '!=' unknown; then ac_value='"'"$cl_cv_cplusplus_ctorprefix"'"' AC_DEFINE_UNQUOTED(CL_GLOBAL_CONSTRUCTOR_PREFIX,$ac_value) AC_CACHE_CHECK(for the global destructors function prefix, cl_cv_cplusplus_dtorprefix, [ cat > conftest.cc << EOF struct foo { foo (); ~ foo (); }; foo foobar; EOF # look for the assembly language name in the .s file AC_TRY_COMMAND(${CXX-g++} $CXXFLAGS -S conftest.cc) >/dev/null 2>&1 if grep '_GLOBAL_\$D\$foobar' conftest.s >/dev/null ; then cl_cv_cplusplus_dtorprefix='_GLOBAL_$D$' else if grep '_GLOBAL_\.D\.foobar' conftest.s >/dev/null ; then cl_cv_cplusplus_dtorprefix='_GLOBAL_.D.' else if grep '_GLOBAL__D_foobar' conftest.s >/dev/null ; then cl_cv_cplusplus_dtorprefix='_GLOBAL__D_' else cl_cv_cplusplus_dtorprefix=none fi fi fi rm -f conftest* ]) if test "$cl_cv_cplusplus_dtorprefix" '!=' none; then ac_value='"'"$cl_cv_cplusplus_ctorprefix"'"' AC_DEFINE_UNQUOTED(CL_GLOBAL_DESTRUCTOR_PREFIX,$ac_value) fi dnl Check whether the global constructors/destructors functions are file-scope dnl only by default. This is the case in egcs-1.1.2 or newer. AC_CACHE_CHECK(whether the global constructors function need to be exported, cl_cv_cplusplus_ctorexport, [ cat > conftest1.cc << EOF struct foo { foo (); }; foo foobar; EOF cat > conftest2.cc << EOF #include "confdefs.h" #ifdef ASM_UNDERSCORE #define ASM_UNDERSCORE_PREFIX "_" #else #define ASM_UNDERSCORE_PREFIX "" #endif struct foo { foo (); }; foo::foo () {} extern "C" void ctor (void) __asm__ (ASM_UNDERSCORE_PREFIX CL_GLOBAL_CONSTRUCTOR_PREFIX "foobar"); int main() { ctor(); return 0; } EOF 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 cl_cv_cplusplus_ctorexport=no else cl_cv_cplusplus_ctorexport=yes fi rm -f conftest* ]) if test "$cl_cv_cplusplus_ctorexport" = yes; then AC_DEFINE(CL_NEED_GLOBALIZE_CTORDTOR) fi fi fi ]) dnl -*- Autoconf -*- dnl Copyright (C) 1993-2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl From Bruno Haible, Marcus Daniels, Sam Steingold. AC_PREREQ(2.57) AC_DEFUN([CL_FPU_CONTROL], [dnl Check for Linux with and fpu_control_t or __setfpucw(). dnl glibc versions since October 1998 define fpu_control_t. Earlier versions dnl define and declare __setfpucw(). Very early Linux libc versions have none, dnl and __fpu_control is of type `unsigned short'. CL_COMPILE_CHECK([fpu_control_t], cl_cv_type_fpu_control_t, [#include ], [fpu_control_t x;], AC_DEFINE(HAVE_FPU_CONTROL_T,,[have and it defines the fpu_control_t type])) CL_COMPILE_CHECK([__setfpucw], cl_cv_func_setfpucw, [#include ], [__setfpucw(_FPU_IEEE);], AC_DEFINE(HAVE_SETFPUCW,,[have and it declares the __setfpucw() function])) ]) dnl Copyright (C) 1993-2002 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl From Bruno Haible, Marcus Daniels, Sam Steingold. AC_PREREQ(2.13) dnl without AC_MSG_...: with AC_MSG_... and caching: dnl AC_TRY_CPP CL_CPP_CHECK dnl AC_TRY_COMPILE CL_COMPILE_CHECK dnl AC_TRY_LINK CL_LINK_CHECK dnl AC_TRY_RUN CL_RUN_CHECK - would require cross-compiling support dnl Usage: dnl AC_TRY_CPP(INCLUDES, dnl ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]) dnl CL_CPP_CHECK(ECHO-TEXT, CACHE-ID, dnl INCLUDES, dnl ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]) dnl AC_TRY_xxx(INCLUDES, FUNCTION-BODY, dnl ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]) dnl CL_xxx_CHECK(ECHO-TEXT, CACHE-ID, dnl INCLUDES, FUNCTION-BODY, dnl ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]) AC_DEFUN([CL_CPP_CHECK], [AC_MSG_CHECKING(for $1) AC_CACHE_VAL($2,[ AC_TRY_CPP([$3], $2=yes, $2=no) ]) AC_MSG_RESULT([$]$2) if test [$]$2 = yes; then ifelse([$4], , :, [$4]) ifelse([$5], , , [else $5 ])dnl fi ]) AC_DEFUN([CL_COMPILE_CHECK], [AC_MSG_CHECKING(for $1) AC_CACHE_VAL($2,[ AC_TRY_COMPILE([$3],[$4], $2=yes, $2=no) ]) AC_MSG_RESULT([$]$2) if test [$]$2 = yes; then ifelse([$5], , :, [$5]) ifelse([$6], , , [else $6 ])dnl fi ]) AC_DEFUN([CL_LINK_CHECK], [AC_MSG_CHECKING(for $1) AC_CACHE_VAL($2,[ AC_TRY_LINK([$3],[$4], $2=yes, $2=no) ]) AC_MSG_RESULT([$]$2) if test [$]$2 = yes; then ifelse([$5], , :, [$5]) ifelse([$6], , , [else $6 ])dnl fi ]) dnl CL_SILENT(ACTION) dnl performs ACTION, with AC_MSG_CHECKING and AC_MSG_RESULT being defined away. AC_DEFUN([CL_SILENT], [pushdef([AC_MSG_CHECKING],[:])dnl pushdef([AC_CHECKING],[:])dnl pushdef([AC_MSG_RESULT],[:])dnl $1[]dnl popdef([AC_MSG_RESULT])dnl popdef([AC_CHECKING])dnl popdef([AC_MSG_CHECKING])dnl ]) dnl Expands to the "extern ..." prefix used for system declarations. dnl AC_LANG_EXTERN() AC_DEFUN([AC_LANG_EXTERN], [extern #ifdef __cplusplus "C" #endif ]) AC_DEFUN([CL_CC_WORKS], [AC_CACHE_CHECK(whether CC works at all, cl_cv_prog_cc_works, [ AC_LANG_SAVE() AC_LANG_C() AC_TRY_RUN([int main() { exit(0); }], cl_cv_prog_cc_works=yes, cl_cv_prog_cc_works=no, AC_TRY_LINK([], [], cl_cv_prog_cc_works=yes, cl_cv_prog_cc_works=no)) AC_LANG_RESTORE() ]) case "$cl_cv_prog_cc_works" in *no) echo "Installation or configuration problem: C compiler cannot create executables."; exit 1;; *yes) ;; esac ]) AC_DEFUN([CL_CONFIG_SUBDIRS], [dnl No AC_CONFIG_AUX_DIR_DEFAULT, so we don't need install.sh. AC_PROVIDE([AC_CONFIG_AUX_DIR_DEFAULT]) AC_CONFIG_SUBDIRS([$1])dnl ]) AC_DEFUN([CL_CANONICAL_HOST], [AC_REQUIRE([AC_PROG_CC]) dnl Actually: AC_REQUIRE([CL_CC_WORKS]) dnl Set ac_aux_dir before the cache check, because AM_PROG_LIBTOOL needs it. ac_aux_dir=${srcdir}/$1 dnl A substitute for AC_CONFIG_AUX_DIR_DEFAULT, so we don't need install.sh. ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" dnl We have defined $ac_aux_dir. AC_PROVIDE([AC_CONFIG_AUX_DIR_DEFAULT])dnl dnl In autoconf-2.52, a single AC_CANONICAL_HOST has the effect of inserting dnl the code of AC_CANONICAL_BUILD *before* CL_CANONICAL_HOST, i.e. before dnl ac_aux_dir has been set. To work around this, we list AC_CANONICAL_BUILD dnl explicitly. AC_CANONICAL_BUILD AC_CANONICAL_HOST ]) AC_DEFUN([CL_CANONICAL_HOST_CPU], [AC_REQUIRE([CL_CANONICAL_HOST])AC_REQUIRE([AC_PROG_CC]) case "$host_cpu" in changequote(,)dnl i[4567]86 ) host_cpu=i386 ;; alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] ) host_cpu=alpha ;; hppa1.0 | hppa1.1 | hppa2.0* | hppa64 ) host_cpu=hppa ;; powerpc ) host_cpu=rs6000 ;; c1 | c2 | c32 | c34 | c38 | c4 ) host_cpu=convex ;; arm* ) host_cpu=arm ;; changequote([,])dnl mips ) AC_CACHE_CHECK([for 64-bit MIPS], cl_cv_host_mips64, [ AC_EGREP_CPP(yes, [#if defined(_MIPS_SZLONG) #if (_MIPS_SZLONG == 64) /* We should also check for (_MIPS_SZPTR == 64), but gcc keeps this at 32. */ yes #endif #endif ], cl_cv_host_mips64=yes, cl_cv_host_mips64=no) ]) if test $cl_cv_host_mips64 = yes; then host_cpu=mips64 fi ;; dnl UltraSPARCs running Linux have `uname -m` = "sparc64", but the C compiler dnl still generates 32-bit code. sparc | sparc64 ) AC_CACHE_CHECK([for 64-bit SPARC], cl_cv_host_sparc64, [ AC_EGREP_CPP(yes, [#if defined(__sparcv9) || defined(__arch64__) yes #endif ], cl_cv_host_sparc64=yes, cl_cv_host_sparc64=no) ]) if test $cl_cv_host_sparc64 = yes; then host_cpu=sparc64 else host_cpu=sparc fi ;; esac dnl was AC_DEFINE_UNQUOTED(__${host_cpu}__) but KAI C++ 3.2d doesn't like this cat >> confdefs.h <= 3 yes #endif ], cl_cv_host_mipsn32=yes, cl_cv_host_mipsn32=no) ]) if test $cl_cv_host_mipsn32 = yes; then host_cpu=mipsn32 fi fi ;; dnl UltraSPARCs running Linux have `uname -m` = "sparc64", but the C compiler dnl still generates 32-bit code. sparc | sparc64 ) AC_CACHE_CHECK([for 64-bit SPARC], cl_cv_host_sparc64, [ AC_EGREP_CPP(yes, [#if defined(__sparcv9) || defined(__arch64__) yes #endif ], cl_cv_host_sparc64=yes, cl_cv_host_sparc64=no) ]) if test $cl_cv_host_sparc64 = yes; then host_cpu=sparc64 else host_cpu=sparc fi ;; esac dnl was AC_DEFINE_UNQUOTED(__${host_cpu}__) but KAI C++ 3.2d doesn't like this cat >> confdefs.h < #include ], [int gettimeofday (struct timeval * tp, struct timezone * tzp);], [int gettimeofday();], cl_cv_proto_gettimeofday_dots=no cl_cv_proto_gettimeofday_arg2="struct timezone *", CL_PROTO_TRY([ #include #include ], [int gettimeofday (struct timeval * tp, void * tzp);], [int gettimeofday();], cl_cv_proto_gettimeofday_dots=no cl_cv_proto_gettimeofday_arg2="void *", cl_cv_proto_gettimeofday_dots=yes cl_cv_proto_gettimeofday_arg2="...")) ], [extern int gettimeofday (struct timeval *, $cl_cv_proto_gettimeofday_arg2);]) if test $cl_cv_proto_gettimeofday_dots = yes; then AC_DEFINE(GETTIMEOFDAY_DOTS,,[declaration of gettimeofday() needs dots]) else AC_DEFINE_UNQUOTED(GETTIMEOFDAY_TZP_T,$cl_cv_proto_gettimeofday_arg2,[type of `tzp' in gettimeofday() declaration]) fi fi ]) dnl -*- Autoconf -*- dnl Copyright (C) 1993-2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl From Bruno Haible, Marcus Daniels, Sam Steingold. AC_PREREQ(2.13) AC_DEFUN([CL_MACHINE], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_C_CHAR_UNSIGNED])dnl cl_machine_file_c=$2 cl_machine_file_h=$3 if test $cross_compiling = no; then if test -z "$[$4]"; then AC_CHECKING(for [$1]) cat > conftest.$ac_ext <> conftest.$ac_ext ORIGCC="$CC" if test $ac_cv_prog_gcc = yes; then # gcc -O (gcc version <= 2.3.2) crashes when compiling long long shifts for # target 80386. Strip "-O". CC=`echo "$CC " | sed -e 's/-O //g'` fi AC_TRY_EVAL(ac_link) CC="$ORIGCC" if test -s conftest; then echo "creating $cl_machine_file_h" ./conftest > conftest.h if cmp -s "$cl_machine_file_h" conftest.h 2>/dev/null; then # The file exists and we would not be changing it rm -f conftest.h else rm -f "$cl_machine_file_h" mv conftest.h "$cl_machine_file_h" fi [$4]=1 else echo "creation of $cl_machine_file_h failed" fi rm -f conftest* fi else echo "cross-compiling - cannot create $cl_machine_file_h" fi ]) dnl Copyright (C) 1993-2002 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl From Bruno Haible, Marcus Daniels. AC_PREREQ(2.13) AC_DEFUN([CL_LONGDOUBLE], [AC_CACHE_CHECK(for long double type, cl_cv_c_longdouble, [ AC_TRY_RUN([int main() { long double x = 2.7182818284590452354L; x = x*x; exit (x==0.0L); }], cl_cv_c_longdouble=yes, cl_cv_c_longdouble=no, dnl When cross-compiling, don't assume anything. cl_cv_c_longdouble="guessing no") ]) case "$cl_cv_c_longdouble" in *yes) AC_DEFINE(HAVE_LONGDOUBLE) ;; *no) ;; esac ]) dnl -*- Autoconf -*- dnl Copyright (C) 1993-2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl From Bruno Haible, Marcus Daniels, Sam Steingold. AC_PREREQ(2.57) AC_DEFUN([CL_LONGLONG], [AC_CACHE_CHECK(for long long type, cl_cv_c_longlong, [ AC_TRY_RUN([int main() { /* long longs don't work right with gcc-2.7.2 on m68k */ /* long longs don't work right with gcc-2.7.2 on rs6000: avcall/tests.c gets miscompiled. */ #if defined(__m68k__) || (defined(_IBMR2) || defined(__powerpc)) #if defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ <= 7) exit(1); #endif #endif { long x = 944938507; long y = 737962842; long z = 162359677; exit(!(((long long) x)*((long long) y)>>32 == z)); } }], cl_cv_c_longlong=yes, cl_cv_c_longlong=no, dnl When cross-compiling, don't assume anything. cl_cv_c_longlong="guessing no") ]) case "$cl_cv_c_longlong" in *yes) AC_DEFINE(HAVE_LONGLONG,,[compiler supports the `long long' type]) ;; *no) ;; esac ]) dnl -*- Autoconf -*- dnl Copyright (C) 1993-2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl From Bruno Haible, Marcus Daniels, Sam Steingold. AC_PREREQ(2.57) AC_DEFUN([CL_PERROR], [AC_MSG_CHECKING(for perror declaration) AC_CACHE_VAL(cl_cv_proto_perror, [ AC_TRY_COMPILE([ /* Some systems declare perror() in , some in , some don't declare it at all. */ #include #include ]AC_LANG_EXTERN[double perror ();], [], cl_cv_proto_perror=no, cl_cv_proto_perror=yes) ]) AC_MSG_RESULT([$cl_cv_proto_perror]) if test $cl_cv_proto_perror = yes; then AC_DEFINE(HAVE_PERROR_DECL,,[ or contains a declaration for perror()]) fi ]) dnl Copyright (C) 1993-2002 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl From Bruno Haible, Marcus Daniels. AC_PREREQ(2.13) dnl CL_PROTO(IDENTIFIER, ACTION-IF-NOT-FOUND, FINAL-PROTOTYPE) AC_DEFUN([CL_PROTO], [AC_MSG_CHECKING([for $1 declaration]) AC_CACHE_VAL(cl_cv_proto_[$1], [$2 cl_cv_proto_$1="$3"]) cl_cv_proto_$1=`echo "[$]cl_cv_proto_$1" | tr -s ' ' | sed -e 's/( /(/'` AC_MSG_RESULT([$]{ac_t:- }[$]cl_cv_proto_$1) ]) dnl CL_PROTO_RET(INCLUDES, ANSI-DECL, TRAD-DECL, CACHE-ID, TYPE-IF-OK, TYPE-IF-FAILS) AC_DEFUN([CL_PROTO_RET], [AC_TRY_COMPILE([$1] AC_LANG_EXTERN [#if defined(__STDC__) || defined(__cplusplus) $2 #else $3 #endif ], [], $4="$5", $4="$6") ]) dnl CL_PROTO_TRY(INCLUDES, ANSI-DECL, TRAD-DECL, ACTION-IF-OK, ACTION-IF-FAILS) AC_DEFUN([CL_PROTO_TRY], [AC_TRY_COMPILE([$1] AC_LANG_EXTERN [#if defined(__STDC__) || defined(__cplusplus) $2 #else $3 #endif ], [], [$4], [$5]) ]) dnl CL_PROTO_CONST(INCLUDES, ANSI-DECL, TRAD-DECL, CACHE-ID) AC_DEFUN([CL_PROTO_CONST], [CL_PROTO_TRY([$1], [$2], [$3], $4="", $4="const")] ) dnl -*- Autoconf -*- dnl Copyright (C) 1993-2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl From Bruno Haible, Marcus Daniels, Sam Steingold, Peter Burwood, Sam Steingold. AC_PREREQ(2.57) AC_DEFUN([CL_RUSAGE], [AC_CHECK_HEADERS(sys/resource.h sys/times.h)dnl if test $ac_cv_header_sys_resource_h = yes; then dnl HAVE_SYS_RESOURCE_H defined CL_LINK_CHECK([getrusage], cl_cv_func_getrusage, [#include /* NetBSD 1.0 needs this */ #include #include ], [struct rusage x; int y = RUSAGE_SELF; getrusage(y,&x); x.ru_utime.tv_sec;])dnl if test $cl_cv_func_getrusage = yes; then CL_PROTO([getrusage], [ CL_PROTO_TRY([ #include #ifdef HAVE_UNISTD_H #include #endif #include /* NetBSD 1.0 needs this */ #include #include ], [int getrusage (int who, struct rusage * rusage);], [int getrusage();], [cl_cv_proto_getrusage_arg1="int"], [cl_cv_proto_getrusage_arg1="enum __rusage_who"]) ], [extern int getrusage ($cl_cv_proto_getrusage_arg1, struct rusage *);])dnl AC_CACHE_CHECK(whether getrusage works, cl_cv_func_getrusage_works, [ AC_TRY_RUN([ #include #include /* NetBSD 1.0 needs this */ #include #include /* for time(2) */ #include int main () { struct rusage used, prev; time_t end = time(NULL)+2; int count = 0; if ((count = getrusage(RUSAGE_SELF, &prev))) { /* getrusage is defined but does not do anything. */ /*fprintf(stderr,"getrusage failed: return=%d\n",count);*/ return 1; } while (time(NULL) < end) { count++; getrusage(RUSAGE_SELF, &used); if ((used.ru_utime.tv_usec != prev.ru_utime.tv_usec) || (used.ru_utime.tv_sec != prev.ru_utime.tv_sec) || (used.ru_stime.tv_usec != prev.ru_stime.tv_usec) || (used.ru_stime.tv_sec != prev.ru_stime.tv_sec)) { /*fprintf(stderr,"success after %d runs\n",count);*/ return 0; } } /* getrusage is defined but does not work. */ /*fprintf(stderr,"failure after %d runs\n",count);*/ return 1; }], cl_cv_func_getrusage_works=yes, cl_cv_func_getrusage_works=no, dnl When cross-compiling, don't assume anything. cl_cv_func_getrusage_works="guessing no")]) fi if test $cl_cv_func_getrusage_works = yes; then AC_DEFINE(HAVE_GETRUSAGE,,[have , the getrusage() function, the struct rusage type, and defines RUSAGE_SELF]) AC_DEFINE_UNQUOTED(RUSAGE_WHO_T,$cl_cv_proto_getrusage_arg1,[type of `who' in getrusage() declaration]) fi fi ]) dnl -*- Autoconf -*- dnl Copyright (C) 1993-2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl From Bruno Haible, Marcus Daniels, Sam Steingold. AC_PREREQ(2.57) AC_DEFUN([CL_TIMES_CLOCK], [AC_REQUIRE([CL_GETTIMEOFDAY])dnl if test $ac_cv_func_gettimeofday = no -a $ac_cv_func_ftime = no; then AC_CHECK_FUNC(times, , no_times=1)dnl if test -z "$no_times"; then AC_CACHE_CHECK(for times return value, cl_cv_func_times_return, [ AC_TRY_RUN([ #include #include /* needed for CLK_TCK */ #ifndef CLK_TCK #include /* needed for CLK_TCK on SYSV PTX */ #endif #include int main () { struct tms buffer; clock_t result1; clock_t result2; int ticks; result1 = times(&buffer); if ((result1 == (clock_t)0) || (result1 == (clock_t)(-1))) exit(1); sleep(1); result2 = times(&buffer); if ((result2 == (clock_t)0) || (result2 == (clock_t)(-1))) exit(1); ticks = result2 - result1; exit(!((ticks >= CLK_TCK/2) && (ticks <= 3*CLK_TCK/2))); }], cl_cv_func_times_return=yes, cl_cv_func_times_return=no, dnl When cross-compiling, don't assume anything. cl_cv_func_times_return="guessing no") ]) case "$cl_cv_func_times_return" in *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]) ;; *no) ;; esac fi fi ]) m4_include([m4/gmp.m4]) m4_include([m4/libtool.m4])