You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

884 lines
27 KiB

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