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.

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