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.

880 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
  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-2005 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, Paul Eggert.
  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, use the test from gnulib.
  571. AC_TRY_COMPILE([
  572. /* The Stardent Vistra knows sizeof(long double), but does not support it. */
  573. long double foo = 0.0;
  574. /* On Ultrix 4.3 cc, long double is 4 and double is 8. */
  575. int array [2*(sizeof(long double) >= sizeof(double)) - 1];
  576. ], , cl_cv_c_longdouble=yes, cl_cv_c_longdouble=no)])
  577. ])
  578. if test $cl_cv_c_longdouble = yes; then
  579. AC_DEFINE(HAVE_LONGDOUBLE)
  580. fi
  581. ])
  582. dnl -*- Autoconf -*-
  583. dnl Copyright (C) 1993-2005 Free Software Foundation, Inc.
  584. dnl This file is free software, distributed under the terms of the GNU
  585. dnl General Public License. As a special exception to the GNU General
  586. dnl Public License, this file may be distributed as part of a program
  587. dnl that contains a configuration script generated by Autoconf, under
  588. dnl the same distribution terms as the rest of that program.
  589. dnl From Bruno Haible, Marcus Daniels, Sam Steingold, Paul Eggert.
  590. AC_PREREQ(2.57)
  591. AC_DEFUN([CL_LONGLONG],
  592. [AC_CACHE_CHECK(for long long type, cl_cv_c_longlong, [
  593. AC_TRY_RUN([int main()
  594. {
  595. /* long longs don't work right with gcc-2.7.2 on m68k */
  596. /* long longs don't work right with gcc-2.7.2 on rs6000: avcall/tests.c gets
  597. miscompiled. */
  598. #if defined(__m68k__) || (defined(_IBMR2) || defined(__powerpc))
  599. #if defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ <= 7)
  600. exit(1);
  601. #endif
  602. #endif
  603. { long x = 944938507; long y = 737962842; long z = 162359677;
  604. exit(!(((long long) x)*((long long) y)>>32 == z));
  605. }
  606. }],
  607. cl_cv_c_longlong=yes, cl_cv_c_longlong=no, [
  608. dnl When cross-compiling, use the test from gnulib.
  609. AC_TRY_LINK([long long ll = 1LL; int i = 63;],
  610. [long long llmax = (long long) -1;
  611. return ll << i | ll >> i | llmax / ll | llmax % ll;],
  612. cl_cv_c_longlong=yes,
  613. cl_cv_c_longlong=no)])
  614. ])
  615. if test $cl_cv_c_longlong = yes; then
  616. AC_DEFINE(HAVE_LONGLONG,,[compiler supports the `long long' type])
  617. fi
  618. ])
  619. dnl -*- Autoconf -*-
  620. dnl Copyright (C) 1993-2003 Free Software Foundation, Inc.
  621. dnl This file is free software, distributed under the terms of the GNU
  622. dnl General Public License. As a special exception to the GNU General
  623. dnl Public License, this file may be distributed as part of a program
  624. dnl that contains a configuration script generated by Autoconf, under
  625. dnl the same distribution terms as the rest of that program.
  626. dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
  627. AC_PREREQ(2.57)
  628. AC_DEFUN([CL_PERROR],
  629. [AC_MSG_CHECKING(for perror declaration)
  630. AC_CACHE_VAL(cl_cv_proto_perror, [
  631. AC_TRY_COMPILE([
  632. /* Some systems declare perror() in <errno.h>, some in <stdio.h>, some don't
  633. declare it at all. */
  634. #include <stdio.h>
  635. #include <errno.h>
  636. ]AC_LANG_EXTERN[double perror ();], [],
  637. cl_cv_proto_perror=no, cl_cv_proto_perror=yes)
  638. ])
  639. AC_MSG_RESULT([$cl_cv_proto_perror])
  640. if test $cl_cv_proto_perror = yes; then
  641. AC_DEFINE(HAVE_PERROR_DECL,,[<errno.h> or <stdio.h> contains a declaration for perror()])
  642. fi
  643. ])
  644. dnl Copyright (C) 1993-2002 Free Software Foundation, Inc.
  645. dnl This file is free software, distributed under the terms of the GNU
  646. dnl General Public License. As a special exception to the GNU General
  647. dnl Public License, this file may be distributed as part of a program
  648. dnl that contains a configuration script generated by Autoconf, under
  649. dnl the same distribution terms as the rest of that program.
  650. dnl From Bruno Haible, Marcus Daniels.
  651. AC_PREREQ(2.13)
  652. dnl CL_PROTO(IDENTIFIER, ACTION-IF-NOT-FOUND, FINAL-PROTOTYPE)
  653. AC_DEFUN([CL_PROTO],
  654. [AC_MSG_CHECKING([for $1 declaration])
  655. AC_CACHE_VAL(cl_cv_proto_[$1], [$2
  656. cl_cv_proto_$1="$3"])
  657. cl_cv_proto_$1=`echo "[$]cl_cv_proto_$1" | tr -s ' ' | sed -e 's/( /(/'`
  658. AC_MSG_RESULT([$]{ac_t:-
  659. }[$]cl_cv_proto_$1)
  660. ])
  661. dnl CL_PROTO_RET(INCLUDES, ANSI-DECL, TRAD-DECL, CACHE-ID, TYPE-IF-OK, TYPE-IF-FAILS)
  662. AC_DEFUN([CL_PROTO_RET],
  663. [AC_TRY_COMPILE([$1]
  664. AC_LANG_EXTERN
  665. [#if defined(__STDC__) || defined(__cplusplus)
  666. $2
  667. #else
  668. $3
  669. #endif
  670. ], [], $4="$5", $4="$6")
  671. ])
  672. dnl CL_PROTO_TRY(INCLUDES, ANSI-DECL, TRAD-DECL, ACTION-IF-OK, ACTION-IF-FAILS)
  673. AC_DEFUN([CL_PROTO_TRY],
  674. [AC_TRY_COMPILE([$1]
  675. AC_LANG_EXTERN
  676. [#if defined(__STDC__) || defined(__cplusplus)
  677. $2
  678. #else
  679. $3
  680. #endif
  681. ], [], [$4], [$5])
  682. ])
  683. dnl CL_PROTO_CONST(INCLUDES, ANSI-DECL, TRAD-DECL, CACHE-ID)
  684. AC_DEFUN([CL_PROTO_CONST],
  685. [CL_PROTO_TRY([$1], [$2], [$3], $4="", $4="const")]
  686. )
  687. dnl -*- Autoconf -*-
  688. dnl Copyright (C) 1993-2003 Free Software Foundation, Inc.
  689. dnl This file is free software, distributed under the terms of the GNU
  690. dnl General Public License. As a special exception to the GNU General
  691. dnl Public License, this file may be distributed as part of a program
  692. dnl that contains a configuration script generated by Autoconf, under
  693. dnl the same distribution terms as the rest of that program.
  694. dnl From Bruno Haible, Marcus Daniels, Sam Steingold, Peter Burwood, Sam Steingold.
  695. AC_PREREQ(2.57)
  696. AC_DEFUN([CL_RUSAGE],
  697. [AC_CHECK_HEADERS(sys/resource.h sys/times.h)dnl
  698. if test $ac_cv_header_sys_resource_h = yes; then
  699. dnl HAVE_SYS_RESOURCE_H defined
  700. CL_LINK_CHECK([getrusage], cl_cv_func_getrusage,
  701. [#include <sys/types.h> /* NetBSD 1.0 needs this */
  702. #include <sys/time.h>
  703. #include <sys/resource.h>],
  704. [struct rusage x; int y = RUSAGE_SELF; getrusage(y,&x); x.ru_utime.tv_sec;])dnl
  705. if test $cl_cv_func_getrusage = yes; then
  706. CL_PROTO([getrusage], [
  707. CL_PROTO_TRY([
  708. #include <stdlib.h>
  709. #ifdef HAVE_UNISTD_H
  710. #include <unistd.h>
  711. #endif
  712. #include <sys/types.h> /* NetBSD 1.0 needs this */
  713. #include <sys/time.h>
  714. #include <sys/resource.h>
  715. ],
  716. [int getrusage (int who, struct rusage * rusage);],
  717. [int getrusage();],
  718. [cl_cv_proto_getrusage_arg1="int"],
  719. [cl_cv_proto_getrusage_arg1="enum __rusage_who"])
  720. ], [extern int getrusage ($cl_cv_proto_getrusage_arg1, struct rusage *);])dnl
  721. AC_CACHE_CHECK(whether getrusage works, cl_cv_func_getrusage_works, [
  722. AC_TRY_RUN([
  723. #include <stdio.h>
  724. #include <sys/types.h> /* NetBSD 1.0 needs this */
  725. #include <sys/time.h>
  726. #include <time.h> /* for time(2) */
  727. #include <sys/resource.h>
  728. int main ()
  729. {
  730. struct rusage used, prev;
  731. time_t end = time(NULL)+2;
  732. int count = 0;
  733. if ((count = getrusage(RUSAGE_SELF, &prev))) {
  734. /* getrusage is defined but does not do anything. */
  735. /*fprintf(stderr,"getrusage failed: return=%d\n",count);*/
  736. return 1;
  737. }
  738. while (time(NULL) < end) {
  739. count++;
  740. getrusage(RUSAGE_SELF, &used);
  741. if ((used.ru_utime.tv_usec != prev.ru_utime.tv_usec)
  742. || (used.ru_utime.tv_sec != prev.ru_utime.tv_sec)
  743. || (used.ru_stime.tv_usec != prev.ru_stime.tv_usec)
  744. || (used.ru_stime.tv_sec != prev.ru_stime.tv_sec)) {
  745. /*fprintf(stderr,"success after %d runs\n",count);*/
  746. return 0;
  747. }
  748. }
  749. /* getrusage is defined but does not work. */
  750. /*fprintf(stderr,"failure after %d runs\n",count);*/
  751. return 1;
  752. }],
  753. cl_cv_func_getrusage_works=yes,
  754. cl_cv_func_getrusage_works=no,
  755. dnl When cross-compiling, don't assume anything.
  756. cl_cv_func_getrusage_works="guessing no")])
  757. fi
  758. if test "$cl_cv_func_getrusage_works" = yes; then
  759. AC_DEFINE(HAVE_GETRUSAGE,,[have <sys/time.h>, the getrusage() function, the struct rusage type, and <sys/resource.h> defines RUSAGE_SELF])
  760. AC_DEFINE_UNQUOTED(RUSAGE_WHO_T,$cl_cv_proto_getrusage_arg1,[type of `who' in getrusage() declaration])
  761. fi
  762. fi
  763. ])
  764. dnl -*- Autoconf -*-
  765. dnl Copyright (C) 1993-2003 Free Software Foundation, Inc.
  766. dnl This file is free software, distributed under the terms of the GNU
  767. dnl General Public License. As a special exception to the GNU General
  768. dnl Public License, this file may be distributed as part of a program
  769. dnl that contains a configuration script generated by Autoconf, under
  770. dnl the same distribution terms as the rest of that program.
  771. dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
  772. AC_PREREQ(2.57)
  773. AC_DEFUN([CL_TIMES_CLOCK],
  774. [AC_REQUIRE([CL_GETTIMEOFDAY])dnl
  775. if test $ac_cv_func_gettimeofday = no -a $ac_cv_func_ftime = no; then
  776. AC_CHECK_FUNC(times, , no_times=1)dnl
  777. if test -z "$no_times"; then
  778. AC_CACHE_CHECK(for times return value, cl_cv_func_times_return, [
  779. AC_TRY_RUN([
  780. #include <sys/types.h>
  781. #include <time.h> /* needed for CLK_TCK */
  782. #ifndef CLK_TCK
  783. #include <sys/time.h> /* needed for CLK_TCK on SYSV PTX */
  784. #endif
  785. #include <sys/times.h>
  786. int main ()
  787. { struct tms buffer;
  788. clock_t result1;
  789. clock_t result2;
  790. int ticks;
  791. result1 = times(&buffer);
  792. if ((result1 == (clock_t)0) || (result1 == (clock_t)(-1))) exit(1);
  793. sleep(1);
  794. result2 = times(&buffer);
  795. if ((result2 == (clock_t)0) || (result2 == (clock_t)(-1))) exit(1);
  796. ticks = result2 - result1;
  797. exit(!((ticks >= CLK_TCK/2) && (ticks <= 3*CLK_TCK/2)));
  798. }], cl_cv_func_times_return=yes, cl_cv_func_times_return=no,
  799. dnl When cross-compiling, don't assume anything.
  800. cl_cv_func_times_return="guessing no")
  801. ])
  802. case "$cl_cv_func_times_return" in
  803. *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]) ;;
  804. *no) ;;
  805. esac
  806. fi
  807. fi
  808. ])
  809. m4_include([m4/cc.m4])
  810. m4_include([m4/gmp.m4])
  811. m4_include([m4/libtool.m4])