home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1999 mARCH / PCWK3A99.iso / Linux / DDD331 / DDD-3_1_.000 / DDD-3_1_ / ddd-3.1.1 / ddd / aclocal.m4 < prev    next >
M4 Source File  |  1998-12-06  |  65KB  |  2,457 lines

  1. dnl aclocal.m4 generated automatically by aclocal 1.3
  2.  
  3. dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
  4. dnl This Makefile.in is free software; the Free Software Foundation
  5. dnl gives unlimited permission to copy and/or distribute it,
  6. dnl with or without modifications, as long as this notice is preserved.
  7.  
  8. dnl This program is distributed in the hope that it will be useful,
  9. dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
  10. dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  11. dnl PARTICULAR PURPOSE.
  12.  
  13. dnl $Id: acinclude.m4,v 1.12.4.1 1998/12/04 09:22:57 zeller Exp $ -*- autoconf -*-
  14. dnl ICE and DDD autoconf macros
  15. dnl 
  16. dnl Copyright (C) 1995-1998 Technische Universitaet Braunschweig, Germany.
  17. dnl Written by Andreas Zeller <zeller@ips.cs.tu-bs.de>.
  18. dnl 
  19. dnl This file is part of the ICE Library.
  20. dnl 
  21. dnl The ICE Library is free software; you can redistribute it and/or
  22. dnl modify it under the terms of the GNU Library General Public
  23. dnl License as published by the Free Software Foundation; either
  24. dnl version 2 of the License, or (at your option) any later version.
  25. dnl 
  26. dnl The ICE Library is distributed in the hope that it will be useful,
  27. dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
  28. dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  29. dnl See the GNU Library General Public License for more details.
  30. dnl 
  31. dnl You should have received a copy of the GNU Library General Public
  32. dnl License along with the ICE Library -- see the file COPYING.LIB.
  33. dnl If not, write to the Free Software Foundation, Inc.,
  34. dnl 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  35. dnl 
  36. dnl ICE is the incremental configuration environment.
  37. dnl For details, see the ICE World-Wide-Web page, 
  38. dnl `http://www.cs.tu-bs.de/softech/ice/',
  39. dnl or send a mail to the ICE developers at `ice@ips.cs.tu-bs.de'.
  40. dnl
  41. dnl DDD is the data display debugger.
  42. dnl For details, see the DDD World-Wide-Web page, 
  43. dnl `http://www.cs.tu-bs.de/softech/ddd/',
  44. dnl or send a mail to the DDD developers <ddd@ips.cs.tu-bs.de>.
  45. dnl
  46. dnl
  47. dnl ICE_PROG_CC and ICE_PROG_CXX
  48. dnl ----------------------------
  49. dnl 
  50. dnl Extended compiler checks.  Check not only for a compiler,
  51. dnl but also determine whether it compiles a simple "hello, world" 
  52. dnl program.
  53. dnl
  54. AC_DEFUN(ICE_PROG_CC,
  55. [
  56. AC_REQUIRE([AC_ISC_POSIX])
  57. AC_REQUIRE([AC_PROG_CC])
  58. AC_MSG_CHECKING(whether the C compiler (${CC}) compiles and links a simple C program)
  59. AC_CACHE_VAL(ice_cv_prog_cc,
  60. [
  61. AC_LANG_SAVE
  62. AC_LANG_C
  63. AC_TRY_LINK([#include <stdio.h>], [printf("hello, world!");],
  64. ice_cv_prog_cc=yes,
  65. ice_cv_prog_cc=no)
  66. AC_LANG_RESTORE
  67. ])
  68. AC_MSG_RESULT($ice_cv_prog_cc)
  69. if test "$ice_cv_prog_cc" = no; then
  70. AC_MSG_ERROR(You must set the environment variable CC to a working
  71.                   C compiler.  Also check the CFLAGS settings.
  72.                   See the file 'config.log' for further diagnostics.)
  73. fi
  74. ])dnl
  75. dnl
  76. AC_DEFUN(ICE_PROG_CXX,
  77. [
  78. AC_REQUIRE([AC_PROG_CXX])
  79. dnl
  80. if test "$CXX" = gcc; then
  81. dnl
  82. dnl Using gcc as C++ compiler requires linkage with -lstdc++ or -lg++
  83. dnl
  84. AC_LANG_SAVE
  85. AC_LANG_CPLUSPLUS
  86. ice_save_LIBS="$LIBS"
  87. AC_CHECK_LIB(m, sin, LIBS="-lm $LIBS")
  88. AC_CHECK_LIB(stdc++, cout, LIBS="-lstdc++ $LIBS")
  89. case "$LIBS" in
  90. *-lstdc++*)
  91. dnl -lstdc++ found - proceed
  92. ;;
  93. *)
  94. dnl -lstdc++ not found - try -lg++ instead
  95. AC_CHECK_LIB(g++, cout, LIBS="-lg++ $LIBS")
  96. ;;
  97. esac
  98. AC_LANG_RESTORE
  99. fi
  100. dnl
  101. AC_MSG_CHECKING(whether the C++ compiler (${CXX}) compiles a simple program)
  102. AC_CACHE_VAL(ice_cv_prog_cxx,
  103. [
  104. AC_LANG_SAVE
  105. AC_LANG_CPLUSPLUS
  106. AC_TRY_LINK([#include <iostream.h>], [cout << "hello, world!";],
  107. ice_cv_prog_cxx=yes,
  108. ice_cv_prog_cxx=no)
  109. AC_LANG_RESTORE
  110. ])
  111. AC_MSG_RESULT($ice_cv_prog_cxx)
  112. if test "$ice_cv_prog_cxx" = no; then
  113. AC_MSG_ERROR(You must set the environment variable CXX to a working 
  114.                   C++ compiler.  Also check the CXXFLAGS settings.
  115.                   See the file 'config.log' for further diagnostics.)
  116. fi
  117. ice_need_cxxlibs=no
  118. case "$LIBS" in
  119.   *-lstdc++*)
  120.           case "$CXXLIBS" in
  121.         *-lstdc++*)
  122.                 ;;
  123.         *)
  124.            ice_need_cxxlibs=yes
  125.            ;;
  126.           esac
  127.           ;;
  128.   *-lg++*)
  129.        case "$CXXLIBS" in
  130.          *-lg++*)
  131.               ;;
  132.          *)
  133.         ice_need_cxxlibs=yes
  134.         ;;
  135.          esac
  136.          ;;
  137. esac
  138. if test "$ice_need_cxxlibs" = yes
  139. then
  140. dnl These libraries are required for all C++ programs.
  141. CXXLIBS="$CXXLIBS $LIBS"
  142. fi
  143. AC_SUBST(CXXLIBS)dnl
  144. LIBS="$ice_save_LIBS"
  145. ])dnl
  146. dnl
  147. dnl
  148. dnl ICE_EXTERNAL_TEMPLATES
  149. dnl ----------------------
  150. dnl
  151. dnl If the C++ compiler accepts the `-fexternal-templates' flag,
  152. dnl set output variable `EXTERNAL_TEMPLATES' to `-fexternal-templates',
  153. dnl empty otherwise.
  154. dnl
  155. AC_DEFUN(ICE_EXTERNAL_TEMPLATES,
  156. [
  157. AC_REQUIRE([AC_PROG_CXX])
  158. AC_MSG_CHECKING(whether the C++ compiler (${CXX}) accepts -fexternal-templates)
  159. AC_CACHE_VAL(ice_cv_external_templates,
  160. [
  161. AC_LANG_SAVE
  162. AC_LANG_CPLUSPLUS
  163. ice_save_cxxflags="$CXXFLAGS"
  164. CXXFLAGS=-fexternal-templates
  165. AC_TRY_COMPILE(,[int a;],
  166. ice_cv_external_templates=yes, ice_cv_external_templates=no)
  167. CXXFLAGS="$ice_save_cxxflags"
  168. AC_LANG_RESTORE
  169. ])
  170. AC_MSG_RESULT($ice_cv_external_templates)
  171. if test "$ice_cv_external_templates" = yes; then
  172. EXTERNAL_TEMPLATES=-fexternal-templates
  173. fi
  174. AC_SUBST(EXTERNAL_TEMPLATES)
  175. ])dnl
  176. dnl
  177. dnl
  178. dnl
  179. dnl ICE_NO_IMPLICIT_TEMPLATES
  180. dnl -------------------------
  181. dnl
  182. dnl If the C++ compiler accepts the `-fno-implicit-templates' flag,
  183. dnl set output variable `NO_IMPLICIT_TEMPLATES' to `-fno-implicit-templates',
  184. dnl empty otherwise.
  185. dnl
  186. AC_DEFUN(ICE_NO_IMPLICIT_TEMPLATES,
  187. [
  188. AC_REQUIRE([AC_PROG_CXX])
  189. AC_MSG_CHECKING(whether the C++ compiler (${CXX}) accepts -fno-implicit-templates)
  190. AC_CACHE_VAL(ice_cv_no_implicit_templates,
  191. [
  192. AC_LANG_SAVE
  193. AC_LANG_CPLUSPLUS
  194. ice_save_cxxflags="$CXXFLAGS"
  195. CXXFLAGS=-fno-implicit-templates
  196. AC_TRY_COMPILE(,[int a;],
  197. ice_cv_no_implicit_templates=yes, ice_cv_no_implicit_templates=no)
  198. CXXFLAGS="$ice_save_cxxflags"
  199. AC_LANG_RESTORE
  200. ])
  201. AC_MSG_RESULT($ice_cv_no_implicit_templates)
  202. if test "$ice_cv_no_implicit_templates" = yes; then
  203. NO_IMPLICIT_TEMPLATES=-fno-implicit-templates
  204. fi
  205. AC_SUBST(NO_IMPLICIT_TEMPLATES)
  206. ])dnl
  207. dnl
  208. dnl
  209. dnl ICE_ELIDE_CONSTRUCTORS
  210. dnl ----------------------
  211. dnl
  212. dnl If the C++ compiler accepts the `-felide-constructors' flag,
  213. dnl set output variable `ELIDE_CONSTRUCTORS' to `-felide-constructors',
  214. dnl empty otherwise.
  215. dnl
  216. AC_DEFUN(ICE_ELIDE_CONSTRUCTORS,
  217. [
  218. AC_REQUIRE([AC_PROG_CXX])
  219. AC_MSG_CHECKING(whether the C++ compiler (${CXX}) accepts -felide-constructors)
  220. AC_CACHE_VAL(ice_cv_elide_constructors,
  221. [
  222. AC_LANG_SAVE
  223. AC_LANG_CPLUSPLUS
  224. ice_save_cxxflags="$CXXFLAGS"
  225. CXXFLAGS=-felide-constructors
  226. AC_TRY_COMPILE(,[int a;],
  227. ice_cv_elide_constructors=yes, ice_cv_elide_constructors=no)
  228. CXXFLAGS="$ice_save_cxxflags"
  229. AC_LANG_RESTORE
  230. ])
  231. AC_MSG_RESULT($ice_cv_elide_constructors)
  232. if test "$ice_cv_elide_constructors" = yes; then
  233. ELIDE_CONSTRUCTORS=-felide-constructors
  234. fi
  235. AC_SUBST(ELIDE_CONSTRUCTORS)
  236. ])dnl
  237. dnl
  238. dnl ICE_CONSERVE_SPACE
  239. dnl ------------------
  240. dnl
  241. dnl If the C++ compiler accepts the `-fconserve-space' flag,
  242. dnl set output variable `CONSERVE_SPACE' to `-fconserve-space',
  243. dnl empty otherwise.
  244. dnl
  245. AC_DEFUN(ICE_CONSERVE_SPACE,
  246. [
  247. AC_REQUIRE([AC_PROG_CXX])
  248. AC_MSG_CHECKING(whether the C++ compiler (${CXX}) accepts -fconserve-space)
  249. AC_CACHE_VAL(ice_cv_conserve_space,
  250. [
  251. AC_LANG_SAVE
  252. AC_LANG_CPLUSPLUS
  253. ice_save_cxxflags="$CXXFLAGS"
  254. CXXFLAGS=-fconserve-space
  255. AC_TRY_COMPILE(,[int a;],
  256. ice_cv_conserve_space=yes, ice_cv_conserve_space=no)
  257. CXXFLAGS="$ice_save_cxxflags"
  258. AC_LANG_RESTORE
  259. ])
  260. AC_MSG_RESULT($ice_cv_conserve_space)
  261. if test "$ice_cv_conserve_space" = yes; then
  262. CONSERVE_SPACE=-fconserve-space
  263. fi
  264. AC_SUBST(CONSERVE_SPACE)
  265. ])dnl
  266. dnl
  267. dnl
  268. dnl
  269. dnl ICE_WARN_EFFECTIVE_CXX
  270. dnl ----------------------
  271. dnl
  272. dnl If the C++ compiler accepts the `-Weffc++' flag,
  273. dnl set output variable `WARN_EFFECTIVE_CXX' to `-Weffc++' and
  274. dnl `WARN_NO_EFFECTIVE_CXX' to `-Wno-effc++'.  Otherwise,
  275. dnl leave both empty.
  276. dnl
  277. AC_DEFUN(ICE_WARN_EFFECTIVE_CXX,
  278. [
  279. AC_REQUIRE([AC_PROG_CXX])
  280. AC_MSG_CHECKING(whether the C++ compiler (${CXX}) accepts -Weffc++)
  281. AC_CACHE_VAL(ice_cv_warn_effective_cxx,
  282. [
  283. AC_LANG_SAVE
  284. AC_LANG_CPLUSPLUS
  285. ice_save_cxxflags="$CXXFLAGS"
  286. CXXFLAGS=-Weffc++
  287. AC_TRY_COMPILE(,[int a;],
  288. ice_cv_warn_effective_cxx=yes, ice_cv_warn_effective_cxx=no)
  289. CXXFLAGS="$ice_save_cxxflags"
  290. AC_LANG_RESTORE
  291. ])
  292. AC_MSG_RESULT($ice_cv_warn_effective_cxx)
  293. if test "$ice_cv_warn_effective_cxx" = yes; then
  294. WARN_EFFECTIVE_CXX=-Weffc++
  295. WARN_NO_EFFECTIVE_CXX=-Wno-effc++
  296. fi
  297. AC_SUBST(WARN_EFFECTIVE_CXX)
  298. AC_SUBST(WARN_NO_EFFECTIVE_CXX)
  299. ])dnl
  300. dnl
  301. dnl ICE_BIG_TOC
  302. dnl -----------
  303. dnl
  304. dnl If the C++ compiler supports `-Wl,-bbigtoc' (as required for large
  305. dnl programs on RS/6000 and PowerPC) set BIG_TOC to `-Wl,-bbigtoc'.
  306. dnl An alternative to this is using `-mminimal-toc' when compiling.
  307. dnl
  308. AC_DEFUN(ICE_BIG_TOC,
  309. [
  310. AC_REQUIRE([AC_PROG_CXX])
  311. AC_MSG_CHECKING(whether the C++ compiler (${CXX}) accepts [-Wl,-bbigtoc])
  312. AC_CACHE_VAL(ice_cv_big_toc,
  313. [
  314. AC_LANG_SAVE
  315. AC_LANG_CPLUSPLUS
  316. ice_save_ldflags="$LDFLAGS"
  317. LDFLAGS="-Wl,-bbigtoc"
  318. AC_TRY_LINK(,[int a;],
  319. ice_cv_big_toc=yes, ice_cv_big_toc=no)
  320. LDFLAGS="$ice_save_ldflags"
  321. AC_LANG_RESTORE
  322. ])
  323. AC_MSG_RESULT($ice_cv_big_toc)
  324. if test "$ice_cv_big_toc" = yes; then
  325. BIG_TOC="-Wl,-bbigtoc"
  326. fi
  327. AC_SUBST(BIG_TOC)
  328. ])dnl
  329. dnl
  330. dnl
  331. dnl ICE_MINIMAL_TOC
  332. dnl ---------------
  333. dnl
  334. dnl If the C++ compiler `-mminimal-toc' (as required for large
  335. dnl programs on RS/6000 and PowerPC) set MINIMAL_TOC to `-mminimal-toc'.
  336. dnl An alternative to this is using `-Wl,-bbigtoc' when linking.
  337. dnl
  338. AC_DEFUN(ICE_MINIMAL_TOC,
  339. [
  340. AC_REQUIRE([AC_PROG_CXX])
  341. AC_MSG_CHECKING(whether the C++ compiler (${CXX}) accepts [-mminimal-toc])
  342. AC_CACHE_VAL(ice_cv_minimal_toc,
  343. [
  344. AC_LANG_SAVE
  345. AC_LANG_CPLUSPLUS
  346. ice_save_cxxflags="$CXXFLAGS"
  347. CXXFLAGS="-mminimal-toc"
  348. AC_TRY_LINK(,[int a;],
  349. ice_cv_minimal_toc=yes, ice_cv_minimal_toc=no)
  350. CXXFLAGS="$ice_save_cxxflags"
  351. AC_LANG_RESTORE
  352. ])
  353. AC_MSG_RESULT($ice_cv_minimal_toc)
  354. if test "$ice_cv_minimal_toc" = yes; then
  355. MINIMAL_TOC="-mminimal-toc"
  356. fi
  357. AC_SUBST(MINIMAL_TOC)
  358. ])dnl
  359. dnl
  360. dnl
  361. dnl ICE_WARN_UNINITIALIZED
  362. dnl ----------------------
  363. dnl
  364. dnl If the C++ compiler accepts the `-Wuninitialized' flag,
  365. dnl set output variable `WARN_UNINITIALIZED' to `-Wuninitialized'
  366. dnl and `WARN_NO_UNINITIALIZED' to `-Wno-uninitialized'.  Otherwise,
  367. dnl leave both empty.
  368. dnl
  369. AC_DEFUN(ICE_WARN_UNINITIALIZED,
  370. [
  371. AC_REQUIRE([AC_PROG_CXX])
  372. AC_MSG_CHECKING(whether the C++ compiler (${CXX}) accepts -Wuninitialized)
  373. AC_CACHE_VAL(ice_cv_warn_uninitialized,
  374. [
  375. AC_LANG_SAVE
  376. AC_LANG_CPLUSPLUS
  377. ice_save_cxxflags="$CXXFLAGS"
  378. CXXFLAGS=-Wuninitialized
  379. AC_TRY_COMPILE(,[int a;],
  380. ice_cv_warn_uninitialized=yes, ice_cv_warn_uninitialized=no)
  381. CXXFLAGS="$ice_save_cxxflags"
  382. AC_LANG_RESTORE
  383. ])
  384. AC_MSG_RESULT($ice_cv_warn_uninitialized)
  385. if test "$ice_cv_warn_uninitialized" = yes; then
  386. WARN_UNINITIALIZED=-Wuninitialized
  387. WARN_NO_UNINITIALIZED=-Wno-uninitialized
  388. fi
  389. AC_SUBST(WARN_UNINITIALIZED)
  390. AC_SUBST(WARN_NO_UNINITIALIZED)
  391. ])dnl
  392. dnl
  393. dnl
  394. dnl
  395. dnl ICE_XS_DEBUG_INFO
  396. dnl -----------------
  397. dnl
  398. dnl If the C++ compiler accepts the `-xs' flag (as Sun CC)
  399. dnl set output variable `XS_DEBUG_INFO' to `-xs'.  Otherwise, 
  400. dnl leave it empty.
  401. dnl
  402. AC_DEFUN(ICE_XS_DEBUG_INFO,
  403. [
  404. AC_REQUIRE([AC_PROG_CXX])
  405. AC_MSG_CHECKING(whether the C++ compiler (${CXX}) accepts -xs)
  406. AC_CACHE_VAL(ice_cv_xs_debug_info,
  407. [
  408. AC_LANG_SAVE
  409. AC_LANG_CPLUSPLUS
  410. ice_save_cxxflags="$CXXFLAGS"
  411. CXXFLAGS=-xs
  412. AC_TRY_COMPILE(,[int a;],
  413. ice_cv_xs_debug_info=yes, ice_cv_xs_debug_info=no)
  414. CXXFLAGS="$ice_save_cxxflags"
  415. AC_LANG_RESTORE
  416. ])
  417. AC_MSG_RESULT($ice_cv_xs_debug_info)
  418. if test "$ice_cv_xs_debug_info" = yes; then
  419. XS_DEBUG_INFO=-xs
  420. fi
  421. AC_SUBST(XS_DEBUG_INFO)
  422. ])dnl
  423. dnl
  424. dnl
  425. dnl
  426. dnl
  427. dnl
  428. dnl ICE_CXX_PROBLEMATIC_VERSION
  429. dnl ---------------------------
  430. dnl
  431. dnl If this is GNU C++ earlier than 2.5, issue a warning.
  432. dnl
  433. AC_DEFUN(ICE_CXX_PROBLEMATIC_VERSION,
  434. [
  435. AC_REQUIRE([AC_PROG_CXX])
  436. AC_MSG_CHECKING(if this is a problematic ${CXX} version)
  437. AC_CACHE_VAL(ice_cv_cxx_problematic_version,
  438. [
  439. AC_LANG_SAVE
  440. AC_LANG_CPLUSPLUS
  441. AC_TRY_CPP([
  442. #ifdef __GNUC__
  443. #if __GNUC__ < 2
  444. #error ICE works best with GCC version 2.5 or higher
  445. #endif /* __GNUC__ < 2 */
  446. #ifdef __GNUC_MINOR__
  447. #if __GNUC__ == 2 && __GNUC_MINOR__ < 5
  448. #error ICE works best with GCC version 2.5 or higher
  449. #endif /* __GNUC_MINOR__ < 5 */
  450. #endif /* defined(__GNUC_MINOR__) */
  451. #endif /* defined(__GNUC__) */
  452. ],
  453. ice_cv_cxx_problematic_version=no, ice_cv_cxx_problematic_version=yes)
  454. AC_LANG_RESTORE
  455. ])
  456. AC_MSG_RESULT($ice_cv_cxx_problematic_version)
  457. if test "$ice_cv_cxx_problematic_version" = yes; then
  458. AC_MSG_WARN(*** This package works best with ${CXX} version 2.5 or higher ***)
  459. fi
  460. ])dnl
  461. dnl
  462. dnl
  463. dnl
  464. dnl ICE_CXX_BOOL
  465. dnl ------------
  466. dnl
  467. dnl If the C++ compiler accepts the `bool' keyword, define `HAVE_BOOL'.
  468. dnl
  469. AC_DEFUN(ICE_CXX_BOOL,
  470. [
  471. AC_REQUIRE([AC_PROG_CXX])
  472. AC_MSG_CHECKING(whether the C++ compiler (${CXX}) supports bool types)
  473. AC_CACHE_VAL(ice_cv_have_bool,
  474. [
  475. AC_LANG_SAVE
  476. AC_LANG_CPLUSPLUS
  477. AC_TRY_COMPILE(,[bool b = true;],
  478. ice_cv_have_bool=yes,
  479. ice_cv_have_bool=no)
  480. AC_LANG_RESTORE
  481. ])
  482. AC_MSG_RESULT($ice_cv_have_bool)
  483. if test "$ice_cv_have_bool" = yes; then
  484. AC_DEFINE(HAVE_BOOL)
  485. fi
  486. ])dnl
  487. dnl
  488. dnl
  489. dnl
  490. dnl ICE_CXX_EXPLICIT
  491. dnl ----------------
  492. dnl
  493. dnl If the C++ compiler accepts the `explicit' keyword, define `HAVE_EXPLICIT'.
  494. dnl
  495. AC_DEFUN(ICE_CXX_EXPLICIT,
  496. [
  497. AC_REQUIRE([AC_PROG_CXX])
  498. AC_MSG_CHECKING(whether the C++ compiler (${CXX}) supports explicit constructors)
  499. AC_CACHE_VAL(ice_cv_have_explicit,
  500. [
  501. AC_LANG_SAVE
  502. AC_LANG_CPLUSPLUS
  503. AC_TRY_COMPILE(,[class A { public: explicit A(int) {} };],
  504. ice_cv_have_explicit=yes,
  505. ice_cv_have_explicit=no)
  506. AC_LANG_RESTORE
  507. ])
  508. AC_MSG_RESULT($ice_cv_have_explicit)
  509. if test "$ice_cv_have_explicit" = yes; then
  510. AC_DEFINE(HAVE_EXPLICIT)
  511. fi
  512. ])dnl
  513. dnl
  514. dnl
  515. dnl
  516. dnl ICE_CXX_MUTABLE
  517. dnl ----------------
  518. dnl
  519. dnl If the C++ compiler accepts the `mutable' keyword, define `HAVE_MUTABLE'.
  520. dnl
  521. AC_DEFUN(ICE_CXX_MUTABLE,
  522. [
  523. AC_REQUIRE([AC_PROG_CXX])
  524. AC_MSG_CHECKING(whether the C++ compiler (${CXX}) supports mutable members)
  525. AC_CACHE_VAL(ice_cv_have_mutable,
  526. [
  527. AC_LANG_SAVE
  528. AC_LANG_CPLUSPLUS
  529. AC_TRY_COMPILE(,[struct A { mutable int x; };],
  530. ice_cv_have_mutable=yes,
  531. ice_cv_have_mutable=no)
  532. AC_LANG_RESTORE
  533. ])
  534. AC_MSG_RESULT($ice_cv_have_mutable)
  535. if test "$ice_cv_have_mutable" = yes; then
  536. AC_DEFINE(HAVE_MUTABLE)
  537. fi
  538. ])dnl
  539. dnl
  540. dnl
  541. dnl
  542. dnl ICE_CXX_NAMESPACE
  543. dnl -----------------
  544. dnl
  545. dnl If the C++ compiler supports namespaces, define `HAVE_NAMESPACE'.
  546. dnl
  547. AC_DEFUN(ICE_CXX_NAMESPACE,
  548. [
  549. AC_REQUIRE([AC_PROG_CXX])
  550. AC_MSG_CHECKING(whether the C++ compiler (${CXX}) supports namespaces)
  551. AC_CACHE_VAL(ice_cv_have_namespace,
  552. [
  553. AC_LANG_SAVE
  554. AC_LANG_CPLUSPLUS
  555. AC_TRY_COMPILE([
  556. namespace one { 
  557.     extern int f(); 
  558. };
  559.  
  560. int one::f() {};
  561.  
  562. using namespace one;
  563. ],[f()],
  564. ice_cv_have_namespace=yes,
  565. ice_cv_have_namespace=no)
  566. AC_LANG_RESTORE
  567. ])
  568. AC_MSG_RESULT($ice_cv_have_namespace)
  569. if test "$ice_cv_have_namespace" = yes; then
  570. AC_DEFINE(HAVE_NAMESPACE)
  571. fi
  572. ])dnl
  573. dnl
  574. dnl
  575. dnl
  576. dnl ICE_CXX_NAMED_RETURN_VALUES
  577. dnl ---------------------------
  578. dnl
  579. dnl If the C++ compiler supports named return values, 
  580. dnl define `HAVE_NAMED_RETURN_VALUES'.
  581. dnl
  582. AC_DEFUN(ICE_CXX_NAMED_RETURN_VALUES,
  583. [
  584. AC_REQUIRE([AC_PROG_CXX])
  585. AC_MSG_CHECKING(whether the C++ compiler (${CXX}) supports named return values)
  586. AC_CACHE_VAL(ice_cv_have_named_return_values,
  587. [
  588. AC_LANG_SAVE
  589. AC_LANG_CPLUSPLUS
  590. AC_TRY_COMPILE([
  591. struct X {
  592.     int f();
  593. };
  594.  
  595. int X::f() return i;
  596. {
  597.     i = 42;
  598. }
  599. ], [/* empty */],
  600. ice_cv_have_named_return_values=yes,
  601. ice_cv_have_named_return_values=no)
  602. AC_LANG_RESTORE
  603. ])
  604. AC_MSG_RESULT($ice_cv_have_named_return_values)
  605. if test "$ice_cv_have_named_return_values" = yes; then
  606. AC_DEFINE(HAVE_NAMED_RETURN_VALUES)
  607. fi
  608. ])dnl
  609. dnl
  610. dnl
  611. dnl ICE_CXX_EXPLICIT_TEMPLATE_INSTANTIATION
  612. dnl ---------------------------------------
  613. dnl
  614. dnl If the C++ compiler supports explicit template instantiation, 
  615. dnl define `HAVE_EXPLICIT_TEMPLATE_INSTANTIATION'.
  616. dnl
  617. AC_DEFUN(ICE_CXX_EXPLICIT_TEMPLATE_INSTANTIATION,
  618. [
  619. AC_REQUIRE([AC_PROG_CXX])
  620. AC_MSG_CHECKING(whether the C++ compiler (${CXX}) supports explicit template instantiation)
  621. AC_CACHE_VAL(ice_cv_have_explicit_template_instantiation,
  622. [
  623. AC_LANG_SAVE
  624. AC_LANG_CPLUSPLUS
  625. AC_TRY_COMPILE([
  626. template <class T> class Pointer { public: T *value; };
  627. template class Pointer<char>;
  628. ], [/* empty */],
  629. ice_cv_have_explicit_template_instantiation=yes,
  630. ice_cv_have_explicit_template_instantiation=no)
  631. AC_LANG_RESTORE
  632. ])
  633. AC_MSG_RESULT($ice_cv_have_explicit_template_instantiation)
  634. if test "$ice_cv_have_explicit_template_instantiation" = yes; then
  635. AC_DEFINE(HAVE_EXPLICIT_TEMPLATE_INSTANTIATION)
  636. fi
  637. ])dnl
  638. dnl
  639. dnl
  640. dnl ICE_CXX_PRETTY_FUNCTION
  641. dnl -----------------------
  642. dnl
  643. dnl If the C++ compiler supports the __PRETTY_FUNCTION__ macro,
  644. dnl define `HAVE_PRETTY_FUNCTION'.
  645. dnl
  646. AC_DEFUN(ICE_CXX_PRETTY_FUNCTION,
  647. [
  648. AC_REQUIRE([AC_PROG_CXX])
  649. AC_MSG_CHECKING(whether the C++ compiler (${CXX}) supports __PRETTY_FUNCTION__)
  650. AC_CACHE_VAL(ice_cv_have_pretty_function,
  651. [
  652. AC_LANG_SAVE
  653. AC_LANG_CPLUSPLUS
  654. # Testing compilation alone does not suffice --
  655. # some GCC versions have trouble in linking.
  656. AC_TRY_LINK([#include <stdio.h>],
  657. [puts(__PRETTY_FUNCTION__);],
  658. ice_cv_have_pretty_function=yes,
  659. ice_cv_have_pretty_function=no)
  660. AC_LANG_RESTORE
  661. ])
  662. AC_MSG_RESULT($ice_cv_have_pretty_function)
  663. if test "$ice_cv_have_pretty_function" = yes; then
  664. AC_DEFINE(HAVE_PRETTY_FUNCTION)
  665. fi
  666. ])dnl
  667. dnl
  668. dnl
  669. dnl ICE_CXX_ARRAY_OPERATOR_NEW
  670. dnl --------------------------
  671. dnl
  672. dnl If the C++ compiler supports overloading operator new[],
  673. dnl define `HAVE_ARRAY_OPERATOR_NEW'.
  674. dnl
  675. AC_DEFUN(ICE_CXX_ARRAY_OPERATOR_NEW,
  676. [
  677. AC_REQUIRE([AC_PROG_CXX])
  678. changequote(,)dnl
  679. AC_MSG_CHECKING(whether the C++ compiler (${CXX}) supports overloaded new[])
  680. changequote([,])dnl
  681. AC_CACHE_VAL(ice_cv_have_array_operator_new,
  682. [
  683. AC_LANG_SAVE
  684. AC_LANG_CPLUSPLUS
  685. AC_TRY_COMPILE([#include <sys/types.h>
  686. void *operator new[](size_t nbytes);],
  687. /* empty */,
  688. ice_cv_have_array_operator_new=yes,
  689. ice_cv_have_array_operator_new=no)
  690. AC_LANG_RESTORE
  691. ])
  692. AC_MSG_RESULT($ice_cv_have_array_operator_new)
  693. if test "$ice_cv_have_array_operator_new" = yes; then
  694. AC_DEFINE(HAVE_ARRAY_OPERATOR_NEW)
  695. fi
  696. ])dnl
  697. dnl
  698. dnl
  699. dnl
  700. dnl ICE_CXX_PLACEMENT_NEW
  701. dnl ---------------------
  702. dnl
  703. dnl If the C++ compiler supports placement new,
  704. dnl define `HAVE_PLACEMENT_NEW'.
  705. dnl
  706. AC_DEFUN(ICE_CXX_PLACEMENT_NEW,
  707. [
  708. AC_REQUIRE([AC_PROG_CXX])
  709. changequote(,)dnl
  710. AC_MSG_CHECKING(whether the C++ compiler (${CXX}) supports placement new)
  711. changequote([,])dnl
  712. AC_CACHE_VAL(ice_cv_have_placement_new,
  713. [
  714. AC_LANG_SAVE
  715. AC_LANG_CPLUSPLUS
  716. AC_TRY_COMPILE([#include <new.h>],
  717. [int *pi = new (operator new (sizeof(int))) int;],
  718. ice_cv_have_placement_new=yes,
  719. ice_cv_have_placement_new=no)
  720. AC_LANG_RESTORE
  721. ])
  722. AC_MSG_RESULT($ice_cv_have_placement_new)
  723. if test "$ice_cv_have_placement_new" = yes; then
  724. AC_DEFINE(HAVE_PLACEMENT_NEW)
  725. fi
  726. ])dnl
  727. dnl
  728. dnl
  729. dnl ICE_CXX_LIFETIME_OF_TEMPORARIES
  730. dnl -------------------------------
  731. dnl
  732. dnl If the C++ compiler realizes ANSI C++ working paper conformant
  733. dnl lifetime of temporaries, define `HAVE_ANSI_LIFETIME_OF_TEMPORARIES'.
  734. dnl
  735. AC_DEFUN(ICE_CXX_LIFETIME_OF_TEMPORARIES,
  736. [
  737. AC_REQUIRE([AC_PROG_CXX])
  738. AC_MSG_CHECKING(whether the C++ compiler (${CXX}) supports ANSI lifetime of temporaries)
  739. AC_CACHE_VAL(ice_cv_have_ansi_lifetime_of_temporaries,
  740. [
  741. AC_LANG_SAVE
  742. AC_LANG_CPLUSPLUS
  743. AC_TRY_RUN(
  744. [
  745. // This program returns 0 if compiled with ANSI C++ compliant 
  746. // lifetime of temporaries; 1, otherwise.
  747. static int destructor_called = 0;
  748. struct X {
  749.     int dummy;
  750.     X(int)         {}
  751.     X(const X&)    {}
  752.     ~X()           { destructor_called = 1; }
  753. };
  754. int f(const X&)    { return destructor_called; }
  755. X g(const X& x)    { return x; }
  756. X h()              { return 1; }
  757. int main()         { return f(g(h())); }
  758. ], 
  759. ice_cv_have_ansi_lifetime_of_temporaries=yes, 
  760. ice_cv_have_ansi_lifetime_of_temporaries=no,
  761. [
  762. if test "$GXX" = yes; then
  763. # Cross-compiling with GNU C++: Guess on the version number
  764. AC_TRY_CPP([
  765. /* Check for GCC versions lower than 2.6 */
  766. #ifdef __GNUC__
  767. #if __GNUC__ < 2
  768. #error
  769. #endif
  770. #if !defined(__GNUC_MINOR__)
  771. #error
  772. #endif
  773. #if __GNUC_MINOR__ < 6
  774. #error
  775. #endif
  776. #endif
  777. ],
  778. ice_cv_have_ansi_lifetime_of_temporaries=yes,
  779. ice_cv_have_ansi_lifetime_of_temporaries=no)
  780. else
  781. # Cross-compiling and not GNU C++: Play it safe.
  782. ice_cv_have_ansi_lifetime_of_temporaries=no
  783. fi
  784. ])
  785. AC_LANG_RESTORE
  786. ])
  787. AC_MSG_RESULT($ice_cv_have_ansi_lifetime_of_temporaries)
  788. if test "$ice_cv_have_ansi_lifetime_of_temporaries" = yes; then
  789. AC_DEFINE(HAVE_ANSI_LIFETIME_OF_TEMPORARIES)
  790. fi
  791. ])dnl
  792. dnl
  793. dnl ICE_OSTRSTREAM_PCOUNT_BROKEN
  794. dnl ----------------------------
  795. dnl
  796. dnl If the C++ ostrstream::pcount() is increased by one after calling
  797. dnl ostrstream::str() (as in the SGI C++ I/O library), 
  798. dnl define `OSTRSTREAM_PCOUNT_BROKEN'.
  799. dnl
  800. AC_DEFUN(ICE_OSTRSTREAM_PCOUNT_BROKEN,
  801. [
  802. AC_REQUIRE([AC_PROG_CXX])
  803. AC_MSG_CHECKING(whether ostrstream::pcount() is broken)
  804. AC_CACHE_VAL(ice_cv_ostrstream_pcount_broken,
  805. [
  806. AC_LANG_SAVE
  807. AC_LANG_CPLUSPLUS
  808. AC_TRY_RUN(
  809. [
  810. // Returns 0 if ostrstream::pcount() is broken; 1, otherwise.
  811. #include <iostream.h>
  812. #include <strstream.h>
  813.  
  814. int main() 
  815. {
  816.     ostrstream os;
  817.     os << 'a';           // os.pcount() == 1.
  818.     char *s = os.str();  // In the SGI C++ I/O library, os.pcount() is now 2!
  819.     return (os.pcount() == 2) ? 0 : 1;
  820. }
  821. ], 
  822. ice_cv_ostrstream_pcount_broken=yes,
  823. ice_cv_ostrstream_pcount_broken=no,
  824. ice_cv_ostrstream_pcount_broken=no
  825. )
  826. AC_LANG_RESTORE
  827. ])
  828. AC_MSG_RESULT($ice_cv_ostrstream_pcount_broken)
  829. if test "$ice_cv_ostrstream_pcount_broken" = yes; then
  830. AC_DEFINE(OSTRSTREAM_PCOUNT_BROKEN)
  831. fi
  832. ])dnl
  833. dnl
  834. dnl
  835. dnl ICE_CXX_LONG_LONG
  836. dnl -----------------
  837. dnl
  838. dnl If the C++ compiler supports `long long' types,  define `HAVE_LONG_LONG'.
  839. dnl
  840. AC_DEFUN(ICE_CXX_LONG_LONG,
  841. [
  842. AC_REQUIRE([AC_PROG_CXX])
  843. AC_MSG_CHECKING(whether the C++ compiler (${CXX}) supports long long types)
  844. AC_CACHE_VAL(ice_cv_have_long_long,
  845. [
  846. AC_LANG_SAVE
  847. AC_LANG_CPLUSPLUS
  848. AC_TRY_COMPILE(,[long long a;], 
  849. ice_cv_have_long_long=yes, 
  850. ice_cv_have_long_long=no)
  851. AC_LANG_RESTORE
  852. ])
  853. AC_MSG_RESULT($ice_cv_have_long_long)
  854. if test "$ice_cv_have_long_long" = yes; then
  855. AC_DEFINE(HAVE_LONG_LONG)
  856. fi
  857. ])dnl
  858. dnl
  859. dnl
  860. dnl ICE_CXX_EXCEPTIONS
  861. dnl ------------------
  862. dnl
  863. dnl If the C++ compiler handles exceptions, define `HAVE_EXCEPTIONS'.
  864. dnl
  865. AC_DEFUN(ICE_CXX_EXCEPTIONS,
  866. [
  867. AC_REQUIRE([AC_PROG_CXX])
  868. AC_MSG_CHECKING(whether the C++ compiler (${CXX}) supports exception handling)
  869. AC_CACHE_VAL(ice_cv_have_exceptions,
  870. [
  871. AC_LANG_SAVE
  872. AC_LANG_CPLUSPLUS
  873. AC_TRY_COMPILE(,[try { throw 1; } catch(...) { }],
  874. ice_cv_have_exceptions=yes,
  875. ice_cv_have_exceptions=no)
  876. AC_LANG_RESTORE
  877. ])
  878. AC_MSG_RESULT($ice_cv_have_exceptions)
  879. if test "$ice_cv_have_exceptions" = yes; then
  880. AC_DEFINE(HAVE_EXCEPTIONS)
  881. fi
  882. ])dnl
  883. dnl
  884. dnl
  885. dnl ICE_CXX_STD_EXCEPTIONS
  886. dnl ----------------------------
  887. dnl
  888. dnl If the C++ compiler handles ISO C++ std exceptions, 
  889. dnl define `HAVE_STD_EXCEPTIONS'.
  890. dnl
  891. AC_DEFUN(ICE_CXX_STD_EXCEPTIONS,
  892. [
  893. AC_REQUIRE([ICE_CXX_EXCEPTIONS])
  894. AC_MSG_CHECKING(whether the C++ compiler (${CXX}) supports standard exceptions)
  895. AC_CACHE_VAL(ice_cv_have_std_exceptions,
  896. [
  897. AC_LANG_SAVE
  898. AC_LANG_CPLUSPLUS
  899. dnl On SGI, EGCS <exception> included by <stdexcept> conflicts with <math.h>.
  900. dnl Check for this.
  901. AC_TRY_COMPILE([
  902. #include <stdexcept>
  903. #include <math.h>
  904. ],
  905. [try { throw runtime_error("too many fingers on keyboard"); }
  906.  catch(const exception& e) { const char *s = e.what(); }],
  907. ice_cv_have_std_exceptions=yes,
  908. ice_cv_have_std_exceptions=no)
  909. AC_LANG_RESTORE
  910. ])
  911. AC_MSG_RESULT($ice_cv_have_std_exceptions)
  912. if test "$ice_cv_have_std_exceptions" = yes; then
  913. AC_DEFINE(HAVE_STD_EXCEPTIONS)
  914. fi
  915. ])dnl
  916. dnl
  917. dnl
  918. dnl ICE_CXX_TYPEINFO
  919. dnl ----------------
  920. dnl
  921. dnl If the C++ compiler supports run-time type info, define `HAVE_TYPEINFO'.
  922. dnl
  923. AC_DEFUN(ICE_CXX_TYPEINFO,
  924. [
  925. AC_REQUIRE([AC_PROG_CXX])
  926. AC_MSG_CHECKING(whether the C++ compiler (${CXX}) supports run-time type info)
  927. AC_CACHE_VAL(ice_cv_have_typeinfo,
  928. [
  929. AC_LANG_SAVE
  930. AC_LANG_CPLUSPLUS
  931. dnl On SGI, EGCS <exception> included by <typeinfo> conflicts with <math.h>.
  932. dnl Check for this.
  933. AC_TRY_COMPILE([
  934. #include <typeinfo>
  935. #include <math.h>
  936. ],
  937. [int x; const char *s = typeid(x).name();],
  938. ice_cv_have_typeinfo=yes,
  939. ice_cv_have_typeinfo=no)
  940. AC_LANG_RESTORE
  941. ])
  942. AC_MSG_RESULT($ice_cv_have_typeinfo)
  943. if test "$ice_cv_have_typeinfo" = yes; then
  944. AC_DEFINE(HAVE_TYPEINFO)
  945. fi
  946. ])dnl
  947. dnl
  948. dnl
  949. dnl ICE_PROG_CPP_TRADITIONAL
  950. dnl ------------------------
  951. dnl
  952. dnl Set output variable `CPP_TRADITIONAL' to a command that runs a 
  953. dnl "traditional" C preprocessor (that is, pre-ANSI-C).
  954. dnl Try each one of `$CPP', `$CC -E', `/lib/cpp' either without flags
  955. dnl or with `-traditional-cpp' or with `-traditional'.
  956. dnl
  957. AC_DEFUN(ICE_PROG_CPP_TRADITIONAL,
  958. [
  959. AC_REQUIRE([AC_PROG_CPP])
  960. AC_MSG_CHECKING(for a traditional C preprocessor)
  961. AC_CACHE_VAL(ice_cv_traditional_cpp,
  962. [
  963. cat > conftest.c << EOF
  964. #if 1
  965. "this is an unterminated string
  966. #endif
  967. EOF
  968. ice_cv_traditional_cpp=
  969. ice_save_cpp="$CPP"
  970. ice_save_cppflags="$CPPFLAGS"
  971. for ice_cpp in "$CPP" "$CC -E" "/lib/cpp"; do
  972. for ice_cppflags in '' ' -traditional-cpp' ' -traditional'; do
  973. CPP="$ice_cpp"
  974. CPPFLAGS="$ice_cppflags"
  975. AC_TRY_CPP([
  976. #if 1
  977. "this is an unterminated string
  978. #endif
  979. ], ice_cv_traditional_cpp="${CPP}${CPPFLAGS}")
  980. if test "$ice_cv_traditional_cpp" != ""; then
  981. break 2
  982. fi
  983. done
  984. done
  985. CPP="$ice_save_cpp"
  986. CPPFLAGS="$ice_save_cppflags"
  987. ])
  988. AC_MSG_RESULT($ice_cv_traditional_cpp)
  989. CPP_TRADITIONAL="$ice_cv_traditional_cpp"
  990. AC_SUBST(CPP_TRADITIONAL)
  991. ])dnl
  992. dnl
  993. dnl
  994. dnl ICE_CHECK_PATH_MAX
  995. dnl ------------------
  996. dnl
  997. dnl Define `HAVE_PATH_MAX' if PATH_MAX is defined in <limits.h>
  998. dnl
  999. AC_DEFUN(ICE_CHECK_PATH_MAX,
  1000. [
  1001. AC_MSG_CHECKING(for PATH_MAX definition in limits.h)
  1002. AC_CACHE_VAL(ice_cv_have_path_max,
  1003. [
  1004. AC_TRY_COMPILE([#include <limits.h>], [int n = PATH_MAX;],
  1005. ice_cv_have_path_max=yes,
  1006. ice_cv_have_path_max=no)
  1007. ])
  1008. AC_MSG_RESULT($ice_cv_have_path_max)
  1009. if test "$ice_cv_have_path_max" = yes; then
  1010. AC_DEFINE(HAVE_PATH_MAX)
  1011. fi
  1012. ])dnl
  1013. dnl
  1014. dnl
  1015. dnl ICE_CHECK_POSIX_PATH_MAX
  1016. dnl ------------------------
  1017. dnl
  1018. dnl Define `HAVE_POSIX_PATH_MAX' if _POSIX_PATH_MAX is defined in <limits.h>
  1019. dnl
  1020. AC_DEFUN(ICE_CHECK_POSIX_PATH_MAX,
  1021. [
  1022. AC_MSG_CHECKING(for _POSIX_PATH_MAX definition in limits.h)
  1023. AC_CACHE_VAL(ice_cv_have_posix_path_max,
  1024. [
  1025. AC_TRY_COMPILE([#include <limits.h>], [int n = _POSIX_PATH_MAX],
  1026. ice_cv_have_posix_path_max=yes,
  1027. ice_cv_have_posix_path_max=no)
  1028. ])
  1029. AC_MSG_RESULT($ice_cv_have_posix_path_max)
  1030. if test "$ice_cv_have_posix_path_max" = yes; then
  1031. AC_DEFINE(HAVE_POSIX_PATH_MAX)
  1032. fi
  1033. ])dnl
  1034. dnl
  1035. dnl
  1036. dnl ICE_CHECK_MAXPATHLEN
  1037. dnl --------------------
  1038. dnl
  1039. dnl Define `HAVE_MAXPATHLEN' if MAXPATHLEN is defined in <limits.h>
  1040. dnl
  1041. AC_DEFUN(ICE_CHECK_MAXPATHLEN,
  1042. [
  1043. AC_MSG_CHECKING(for MAXPATHLEN definition in sys/param.h)
  1044. AC_CACHE_VAL(ice_cv_have_maxpathlen,
  1045. [
  1046. AC_TRY_COMPILE([#include <sys/param.h>], [int n = MAXPATHLEN;],
  1047. ice_cv_have_maxpathlen=yes,
  1048. ice_cv_have_maxpathlen=no)
  1049. ])
  1050. AC_MSG_RESULT($ice_cv_have_maxpathlen)
  1051. if test "$ice_cv_have_maxpathlen" = yes; then
  1052. AC_DEFINE(HAVE_MAXPATHLEN)
  1053. fi
  1054. ])dnl
  1055. dnl
  1056. dnl
  1057. dnl ICE_CHECK_DECL (FUNCTION, HEADER-FILE...)
  1058. dnl -----------------------------------------
  1059. dnl
  1060. dnl If FUNCTION is available, define `HAVE_FUNCTION'.  If it is declared
  1061. dnl in one of the headers named in the whitespace-separated list 
  1062. dnl HEADER_FILE, define `HAVE_FUNCTION_DECL` (in all capitals).
  1063. dnl
  1064. AC_DEFUN(ICE_CHECK_DECL,
  1065. [
  1066. changequote(,)dnl
  1067. ice_tr=`echo $1 | tr '[a-z]' '[A-Z]'`
  1068. changequote([,])dnl
  1069. ice_have_tr=HAVE_$ice_tr
  1070. ice_have_decl_tr=${ice_have_tr}_DECL
  1071. ice_have_$1=no
  1072. AC_CHECK_FUNCS($1, ice_have_$1=yes)
  1073. if test "${ice_have_$1}" = yes; then
  1074. AC_MSG_CHECKING(for $1 declaration in $2)
  1075. AC_CACHE_VAL(ice_cv_have_$1_decl,
  1076. [
  1077. ice_cv_have_$1_decl=no
  1078. changequote(,)dnl
  1079. ice_re_params='[a-zA-Z_][a-zA-Z0-9_]*'
  1080. ice_re_word='(^|[^a-zA-Z_0-9_])'
  1081. changequote([,])dnl
  1082. for header in $2; do
  1083. # Check for ordinary declaration
  1084. AC_EGREP_HEADER([${ice_re_word}$1 *\(], $header, 
  1085.     ice_cv_have_$1_decl=yes)
  1086. if test "$ice_cv_have_$1_decl" = yes; then
  1087.     break
  1088. fi
  1089. # Check for "fixed" declaration like "getpid _PARAMS((int))"
  1090. AC_EGREP_HEADER([${ice_re_word}$1 *$ice_re_params\(\(], $header, 
  1091.     ice_cv_have_$1_decl=yes)
  1092. if test "$ice_cv_have_$1_decl" = yes; then
  1093.     break
  1094. fi
  1095. done
  1096. ])
  1097. AC_MSG_RESULT($ice_cv_have_$1_decl)
  1098. if test "$ice_cv_have_$1_decl" = yes; then
  1099. AC_DEFINE_UNQUOTED(${ice_have_decl_tr})
  1100. fi
  1101. fi
  1102. ])dnl
  1103. dnl
  1104. dnl
  1105. dnl ICE_CHECK_LESSTIF
  1106. dnl -----------------
  1107. dnl
  1108. dnl Define `HAVE_LESSTIF' if the Motif library is actually a LessTif library
  1109. dnl
  1110. AC_DEFUN(ICE_CHECK_LESSTIF,
  1111. [
  1112. AC_MSG_CHECKING(whether the Motif library is actually a LessTif library)
  1113. AC_CACHE_VAL(ice_cv_have_lesstif,
  1114. AC_EGREP_CPP(yes,
  1115. [#include <Xm/Xm.h>
  1116. #ifdef LesstifVersion
  1117. yes
  1118. #endif
  1119. ], ice_cv_have_lesstif=yes, ice_cv_have_lesstif=no))
  1120. AC_MSG_RESULT($ice_cv_have_lesstif)
  1121. if test "$ice_cv_have_lesstif" = yes; then
  1122. AC_DEFINE(HAVE_LESSTIF)
  1123. fi
  1124. ])dnl
  1125. dnl
  1126. dnl
  1127. dnl
  1128. dnl ICE_CHECK_PTRACE_DUMPCORE
  1129. dnl -------------------------
  1130. dnl
  1131. dnl Set `HAVE_PTRACE_DUMPCORE' if PTRACE_DUMPCORE is defined in <sys/ptrace.h>.
  1132. dnl
  1133. AC_DEFUN(ICE_CHECK_PTRACE_DUMPCORE,
  1134. [
  1135. AC_MSG_CHECKING(for PTRACE_DUMPCORE definition in <sys/ptrace.h>)
  1136. AC_CACHE_VAL(ice_cv_have_ptrace_dumpcore,
  1137. [
  1138. AC_TRY_COMPILE([#include <sys/ptrace.h>], [int request = PTRACE_DUMPCORE;],
  1139. ice_cv_have_ptrace_dumpcore=yes,
  1140. ice_cv_have_ptrace_dumpcore=no)
  1141. ])
  1142. AC_MSG_RESULT($ice_cv_have_ptrace_dumpcore)
  1143. if test "$ice_cv_have_ptrace_dumpcore" = yes; then
  1144. AC_DEFINE(HAVE_PTRACE_DUMPCORE)
  1145. fi
  1146. ])dnl
  1147. dnl
  1148. dnl
  1149. dnl
  1150. dnl ICE_CHECK_CORE_MAGIC
  1151. dnl --------------------
  1152. dnl
  1153. dnl Set `HAVE_CORE_MAGIC' if CORE_MAGIC is defined in <sys/core.h>.
  1154. dnl
  1155. AC_DEFUN(ICE_CHECK_CORE_MAGIC,
  1156. [
  1157. AC_MSG_CHECKING(for CORE_MAGIC definition in <sys/core.h>)
  1158. AC_CACHE_VAL(ice_cv_have_core_magic,
  1159. AC_EGREP_CPP(yes,
  1160. [#include <sys/core.h>
  1161. #ifdef CORE_MAGIC
  1162. yes
  1163. #endif
  1164. ], ice_cv_have_core_magic=yes, ice_cv_have_core_magic=no))
  1165. AC_MSG_RESULT($ice_cv_have_core_magic)
  1166. if test "$ice_cv_have_core_magic" = yes; then
  1167. AC_DEFINE(HAVE_CORE_MAGIC)
  1168. fi
  1169. ])dnl
  1170. dnl
  1171. dnl
  1172. dnl
  1173. dnl ICE_CXX_INCLUDE_DIR
  1174. dnl -------------------
  1175. dnl
  1176. dnl Set output variable CXX_INCLUDE_DIR to the name of a directory
  1177. dnl where the C++ compiler looks for C++ include files.
  1178. dnl
  1179. AC_DEFUN(ICE_CXX_INCLUDE_DIR,
  1180. [
  1181. AC_MSG_CHECKING(for directory to install c++ include files)
  1182. AC_CACHE_VAL(ice_cv_cxx_include_dir,
  1183. [
  1184. cat > conftest.cc << EOF
  1185. #include <iostream.h>
  1186. EOF
  1187. changequote(,)dnl
  1188. $CXXCPP $DEFS conftest.cc > conftest.ii 2>&5
  1189. if test $? != 0; then
  1190. AC_MSG_ERROR(${CXXCPP} could not find iostream.h)
  1191. else
  1192. ice_file=`grep '^# 1' conftest.ii | grep iostream.h | \
  1193.     head -1 | sed 's/^.*"\(.*\)".*$/\1/'`
  1194. ice_cv_cxx_include_dir=`echo $ice_file | sed 's%/[^/][^/]*$%%'`
  1195. fi
  1196. if test "$ice_cv_cxx_include_dir" = ""; then
  1197. ice_cv_cxx_include_dir="$prefix/include"
  1198. for pfx in "$prefix" "$exec_prefix"; do
  1199. for dir in "$pfx/lib/g++-include" "$pfx/include/CC" \
  1200.     "$pfx/include" /usr/include; do
  1201. if test -d "$dir"; then
  1202. ice_cv_cxx_include_dir="$dir"
  1203. break
  1204. fi
  1205. done
  1206. done
  1207. fi
  1208. changequote([,])dnl
  1209. rm -f conftest.cc conftest.ii
  1210. ])
  1211. CXX_INCLUDE_DIR=$ice_cv_cxx_include_dir
  1212. AC_MSG_RESULT(${CXX_INCLUDE_DIR})
  1213. AC_SUBST(CXX_INCLUDE_DIR)
  1214. ])dnl
  1215. dnl
  1216. dnl
  1217. dnl ICE_CXX_LIB_DIR
  1218. dnl ---------------
  1219. dnl
  1220. dnl Set output variable CXX_LIB_DIR to the name of a directory
  1221. dnl where the C++ compiler looks for C++ libraries.
  1222. dnl
  1223. AC_DEFUN(ICE_CXX_LIB_DIR,
  1224. [
  1225. AC_MSG_CHECKING(for directory to install c++ libraries)
  1226. AC_CACHE_VAL(ice_cv_cxx_lib_dir,
  1227. [
  1228. changequote(,)dnl
  1229. ice_cv_cxx_lib_dir=`$CXX $DEFS -print-libgcc-file-name 2>&5 | \
  1230.     sed 's%/[^/][^/]*$%%'`
  1231. changequote([,])dnl
  1232. if test "$ice_cv_cxx_lib_dir" = ""; then
  1233. for p in $exec_prefix /usr/local /usr; do
  1234. if test -d "$p/lib"; then
  1235. ice_cv_cxx_lib_dir="$p/lib"
  1236. break
  1237. fi
  1238. done
  1239. fi
  1240. ])
  1241. CXX_LIB_DIR=$ice_cv_cxx_lib_dir
  1242. AC_MSG_RESULT(${CXX_LIB_DIR})
  1243. AC_SUBST(CXX_LIB_DIR)
  1244. ])dnl
  1245. dnl
  1246. dnl
  1247. dnl ICE_CXX_OPTIONS
  1248. dnl ---------------
  1249. dnl
  1250. dnl Setup C++ compile options.  Specific to DDD and ICE.
  1251. dnl
  1252. AC_DEFUN(ICE_CXX_OPTIONS,
  1253. [
  1254. if test "$GXX" = yes; then
  1255.   # Check warnings
  1256.   ICE_WARN_EFFECTIVE_CXX
  1257.   ICE_WARN_UNINITIALIZED
  1258.   
  1259.   # Check TOC options
  1260.   ICE_MINIMAL_TOC
  1261.   if test "$ice_cv_minimal_toc" = yes; then
  1262.     # Only check for `-Wl,-bbig-toc' if `-mminimal-toc' is supported.
  1263.     ICE_BIG_TOC
  1264.     if test "$ice_cv_big_toc" = yes; then
  1265.       # Prefer `-Wl,-bbig-toc' on `-mminimal-toc'.
  1266.       MINIMAL_TOC=
  1267.     fi
  1268.   fi
  1269.  
  1270.   # Setup options
  1271.   # In GCC 2.8.0, `-Wuninitialized' generates lots of warnings about
  1272.   # variables possibly being clobbered by a longjmp()/vfork() call.
  1273.   # These warnings seldom make sense and hide more serious warnings.
  1274.   # Hence, we turn them off via `-Wno-uninitialized'.
  1275.   CXXOPT="-DNDEBUG"
  1276.   CXXDEBUG=
  1277.   CXXWARNINGS="-W -Wall ${WARN_NO_UNINITIALIZED}"
  1278.   CXXSTATIC_BINDING="-Bstatic"
  1279.   CXXDYNAMIC_BINDING="-Bdynamic"
  1280.   CXXSTUFF="${MINIMAL_TOC}"
  1281.  
  1282.   for flag in $CXXFLAGS; do
  1283.     case $flag in
  1284.       -O)  CXXOPT="$CXXOPT -O2";;
  1285.       -O2) CXXOPT="$CXXOPT -O2";;
  1286.       -O*) CXXOPT="$CXXOPT $flag";;
  1287.       -g*) CXXDEBUG="$flag";;
  1288.       -W*) CXXWARNINGS="$CXXWARNINGS $flag";;
  1289.       *)   CXXSTUFF="$CXXSTUFF $flag";;
  1290.     esac
  1291.   done
  1292. else
  1293.   case "$CXX" in
  1294.     *CC)
  1295.       case "$host_os" in
  1296.     *solaris*)
  1297.       # We're using CC on Solaris.  Debugging with GDB requires -xs.
  1298.       ICE_XS_DEBUG_INFO
  1299.       ;;
  1300.     *)
  1301.       ;;
  1302.       esac
  1303.       ;;
  1304.     *)
  1305.       ;;
  1306.   esac
  1307.  
  1308.   CXXOPT="-DNDEBUG"
  1309.   CXXDEBUG="${XS_DEBUG_INFO}"
  1310.   CXXWARNINGS=
  1311.   CXXSTATIC_BINDING="-static"
  1312.   CXXDYNAMIC_BINDING=
  1313.   CXXSTUFF=
  1314.  
  1315.   for flag in $CXXFLAGS; do
  1316.     case $flag in
  1317.       -O*) CXXOPT="$CXXOPT $flag";;
  1318.       -g*) CXXDEBUG="$CXXDEBUG $flag";;
  1319.       -W*) CXXWARNINGS="$CXXWARNINGS $flag";;
  1320.       *)   CXXSTUFF="$CXXSTUFF $flag";;
  1321.     esac
  1322.   done
  1323. fi
  1324. AC_MSG_CHECKING(for C++ compiler (${CXX}) warning options)
  1325. AC_MSG_RESULT(${CXXWARNINGS})
  1326. AC_MSG_CHECKING(for C++ compiler (${CXX}) optimizing options)
  1327. AC_MSG_RESULT(${CXXOPT})
  1328. AC_MSG_CHECKING(for C++ compiler (${CXX}) debugging options)
  1329. AC_MSG_RESULT(${CXXDEBUG})
  1330. AC_MSG_CHECKING(for C++ compiler (${CXX}) extra libraries)
  1331. AC_MSG_RESULT(${CXXLIBS})
  1332. AC_MSG_CHECKING(for C++ compiler (${CXX}) static binding options)
  1333. AC_MSG_RESULT(${CXXSTATIC_BINDING})
  1334. AC_MSG_CHECKING(for C++ compiler (${CXX}) dynamic binding options)
  1335. AC_MSG_RESULT(${CXXDYNAMIC_BINDING})
  1336. AC_SUBST(CXXWARNINGS)dnl
  1337. AC_SUBST(CXXDEBUG)dnl
  1338. AC_SUBST(CXXOPT)dnl
  1339. AC_SUBST(CXXLIBS)dnl
  1340. AC_SUBST(CXXSTATIC_BINDING)dnl
  1341. AC_SUBST(CXXDYNAMIC_BINDING)dnl
  1342. dnl
  1343. if test "$GXX" = yes; then
  1344. ICE_EXTERNAL_TEMPLATES
  1345. dnl ICE_NO_IMPLICIT_TEMPLATES
  1346. ICE_ELIDE_CONSTRUCTORS
  1347. ICE_CONSERVE_SPACE
  1348. fi
  1349. CXXSTUFF="$CXXSTUFF $EXTERNAL_TEMPLATES $ELIDE_CONSTRUCTORS $CONSERVE_SPACE"
  1350. AC_SUBST(CXXSTUFF)dnl
  1351. ])dnl
  1352. dnl
  1353. dnl
  1354. dnl
  1355. dnl ICE_PROG_EMACS
  1356. dnl --------------
  1357. dnl
  1358. dnl Look for emacs; put its name in output variable `EMACS'.
  1359. dnl
  1360. dnl
  1361. AC_DEFUN(ICE_PROG_EMACS, 
  1362. [
  1363. AC_CHECK_PROGS(EMACS, emacs temacs xemacs lemacs)
  1364. ])dnl
  1365. dnl
  1366. dnl
  1367. dnl ICE_PATH_INFO
  1368. dnl --------------
  1369. dnl
  1370. dnl Look for info path; put it in output variable `infodir'.
  1371. dnl
  1372. AC_DEFUN(ICE_PATH_INFO,
  1373. [
  1374. AC_MSG_CHECKING(for info directory)
  1375. AC_CACHE_VAL(ice_cv_infodir,
  1376. [
  1377. AC_REQUIRE([AC_PREFIX_PROGRAM])
  1378. AC_REQUIRE([ICE_PROG_EMACS])
  1379. ice_cv_infodir=$prefix/info
  1380. if test "$EMACS" != ""; then
  1381. cat > conftest.el << EOF
  1382.  
  1383. (defun print-list (l)
  1384.   (if (not (null l))
  1385.       (list
  1386.        (princ (car l) t)
  1387.        (princ "
  1388. " t)
  1389.        (print-list (cdr l)))))
  1390.  
  1391. (defun print-info-dirs ()
  1392.   (cond
  1393.    ((boundp 'Info-directory-list) 
  1394.     (print-list Info-directory-list))
  1395.    ((boundp 'Info-default-directory-list) 
  1396.     (print-list Info-default-directory-list))
  1397.    ((boundp 'Info-directory) 
  1398.     (print-list (list Info-directory)))
  1399. ))
  1400. EOF
  1401. ice_info_dirs=`$EMACS -batch -l conftest.el -f print-info-dirs 2>&5`
  1402. rm -f conftest.el
  1403. for ice_info_dir in $ice_info_dirs; do
  1404.     ice_info_dir=`echo $ice_info_dir | sed 's,/*$,,'`
  1405.     if test -f "$ice_info_dir/dir"; then
  1406.     ice_cv_infodir="$ice_info_dir"
  1407.         break
  1408.     fi
  1409. done
  1410. fi
  1411. ])
  1412. infodir=$ice_cv_infodir
  1413. AC_MSG_RESULT($infodir)
  1414. AC_SUBST(infodir)
  1415. ])dnl
  1416. dnl
  1417. dnl
  1418. dnl ICE_TYPE_SIGNAL
  1419. dnl ---------------
  1420. dnl
  1421. dnl ICE_TYPE_SIGNAL: like AC_TYPE_SIGNAL, but use C++ for checks.
  1422. dnl
  1423. AC_DEFUN(ICE_TYPE_SIGNAL,
  1424. [
  1425. AC_REQUIRE([AC_PROG_CXX])
  1426. AC_MSG_CHECKING([return type of signal handlers])
  1427. AC_LANG_SAVE
  1428. AC_LANG_CPLUSPLUS
  1429. AC_CACHE_VAL(ice_cv_type_signal,
  1430. [
  1431. AC_TRY_COMPILE(
  1432. [
  1433. #include <sys/types.h>
  1434. #include <signal.h>
  1435. void handler(int sg);],
  1436. [signal(1, handler);], ice_cv_type_signal=void, ice_cv_type_signal=int)])dnl
  1437. AC_LANG_RESTORE
  1438. AC_MSG_RESULT($ice_cv_type_signal)
  1439. AC_DEFINE_UNQUOTED(RETSIGTYPE, $ice_cv_type_signal)
  1440. ])dnl
  1441. dnl
  1442. dnl
  1443. dnl
  1444. dnl ICE_TYPE_SIGNALPROC
  1445. dnl -------------------
  1446. dnl
  1447. dnl ICE_TYPE_SIGNALPROC: check params of signal handler.  Use as:
  1448. dnl
  1449. dnl #include "config.h"
  1450. dnl
  1451. dnl typedef void (*SignalProc)(SIGHANDLERARGS);
  1452. dnl
  1453. dnl
  1454. AC_DEFUN(ICE_TYPE_SIG_HANDLER_ARGS,
  1455. [
  1456. AC_REQUIRE([AC_TYPE_SIGNAL])
  1457. AC_MSG_CHECKING([parameter type of signal handlers])
  1458. AC_CACHE_VAL(ice_cv_type_sig_handler_args,
  1459. [
  1460. AC_LANG_SAVE
  1461. AC_LANG_CPLUSPLUS
  1462. ice_cv_type_sig_handler_args=""
  1463. # Try "..."
  1464. if test "$ice_cv_type_sig_handler_args" = ""; then
  1465. AC_TRY_COMPILE(
  1466. [
  1467. #include <sys/types.h>
  1468. #include <signal.h>
  1469. RETSIGTYPE handler(...);],
  1470. [signal(1, handler);], 
  1471. ice_cv_type_sig_handler_args="...")
  1472. fi
  1473. # Try "int"
  1474. if test "$ice_cv_type_sig_handler_args" = ""; then
  1475. AC_TRY_COMPILE(
  1476. [
  1477. #include <sys/types.h>
  1478. #include <signal.h>
  1479. RETSIGTYPE handler(int);],
  1480. [signal(1, handler);], 
  1481. ice_cv_type_sig_handler_args="int")
  1482. fi
  1483. # Try "int, ..."
  1484. if test "$ice_cv_type_sig_handler_args" = ""; then
  1485. AC_TRY_COMPILE(
  1486. [
  1487. #include <sys/types.h>
  1488. #include <signal.h>
  1489. RETSIGTYPE handler(int ...);],
  1490. [signal(1, handler);], 
  1491. ice_cv_type_sig_handler_args="int ...")
  1492. fi
  1493. AC_LANG_RESTORE
  1494. ]
  1495. )dnl
  1496. AC_MSG_RESULT($ice_cv_type_sig_handler_args)
  1497. if test "$ice_cv_type_sig_handler_args" = ""; then
  1498. AC_MSG_WARN([Please #define SIGHANDLERARGS in config.h])
  1499. fi
  1500. AC_DEFINE_UNQUOTED(SIGHANDLERARGS, $ice_cv_type_sig_handler_args)
  1501. ])dnl
  1502. dnl
  1503. dnl
  1504. dnl
  1505. dnl ICE_CHECK_FROZEN_OSTRSTREAM
  1506. dnl ---------------------------
  1507. dnl
  1508. dnl If the C++ library has a ostrstream::frozen() function,
  1509. dnl define HAVE_FROZEN_OSTRSTREAM.
  1510. dnl
  1511. AC_DEFUN(ICE_CHECK_FROZEN_OSTRSTREAM,
  1512. [
  1513. AC_REQUIRE([AC_PROG_CXX])
  1514. AC_MSG_CHECKING([for ostrstream::frozen()])
  1515. AC_CACHE_VAL(ice_cv_frozen_ostrstream,
  1516. [
  1517. AC_LANG_SAVE
  1518. AC_LANG_CPLUSPLUS
  1519. AC_TRY_COMPILE([#include <strstream.h>],
  1520. [ostrstream os; int frozen = os.frozen();],
  1521. ice_cv_frozen_ostrstream=yes, ice_cv_frozen_ostrstream=no)
  1522. AC_LANG_RESTORE
  1523. ])
  1524. AC_MSG_RESULT($ice_cv_frozen_ostrstream)
  1525. if test "$ice_cv_frozen_ostrstream" = yes; then
  1526. AC_DEFINE(HAVE_FROZEN_OSTRSTREAM)
  1527. fi
  1528. ])dnl
  1529. dnl
  1530. dnl
  1531. dnl ICE_TYPE_REGEX_T
  1532. dnl ----------------
  1533. dnl
  1534. dnl ICE_TYPE_REGEX_T: find members of POSIX.2 `regex_t' type
  1535. dnl - HAVE_REGEX_T_RE_NSUB:   `regex_t' has a `re_nsub' member
  1536. dnl - HAVE_REGEX_T_N_SUBEXPS: `regex_t' has a `n_subexps' member
  1537. dnl
  1538. AC_DEFUN(ICE_TYPE_REGEX_T,
  1539. [
  1540. AC_REQUIRE([AC_PROG_CXX])
  1541. AC_CHECK_HEADERS(regex.h rx.h rxposix.h)
  1542. ICE_CHECK_DECL(regcomp, regex.h rx.h rxposix.h)
  1543. ICE_CHECK_DECL(regexec, regex.h rx.h rxposix.h)
  1544. ice_save_cppflags="$CPPFLAGS"
  1545. CPPFLAGS="-I$srcdir/.. $CPPFLAGS"
  1546. AC_LANG_SAVE
  1547. AC_LANG_CPLUSPLUS
  1548. AC_MSG_CHECKING([re_nsub member of POSIX.2 regex_t type])
  1549. AC_CACHE_VAL(ice_cv_have_regex_t_re_nsub,
  1550. [
  1551. AC_TRY_COMPILE(
  1552. [
  1553. extern "C" {
  1554. #include <sys/types.h>
  1555.  
  1556. // Avoid conflicts with C regex() function
  1557. #define regex c_regex
  1558.  
  1559. // Don't include old libg++ <regex.h> contents
  1560. #define __REGEXP_LIBRARY
  1561.  
  1562. #ifndef __STDC__
  1563. #define __STDC__ 1              // Reguired for KCC when using GNU includes
  1564. #endif
  1565.  
  1566. // Some old versions of libg++ contain a <regex.h> file.  Avoid this.
  1567. #if !defined(REG_EXTENDED) && HAVE_REGEX_H
  1568. #include <regex.h>        // POSIX.2 interface
  1569. #endif
  1570.  
  1571. // Try hard-wired path to get native <regex.h>.
  1572. #if !defined(REG_EXTENDED) && HAVE_REGEX_H
  1573. #include </usr/include/regex.h>    // POSIX.2 interface
  1574. #endif
  1575.  
  1576. // Some more GNU headers.
  1577. #if !defined(REG_EXTENDED) && HAVE_RX_H
  1578. #include <rx.h>                 // Header from GNU rx 0.07
  1579. #endif
  1580.  
  1581. #if !defined(REG_EXTENDED) && HAVE_RXPOSIX_H
  1582. #include <rxposix.h>        // Header from GNU rx 1.0 and later
  1583. #endif
  1584. }
  1585. ],
  1586. [regex_t rx; int a = rx.re_nsub;], 
  1587. ice_cv_have_regex_t_re_nsub=yes, ice_cv_have_regex_t_re_nsub=no)])dnl
  1588. AC_MSG_RESULT($ice_cv_have_regex_t_re_nsub)
  1589. if test "$ice_cv_have_regex_t_re_nsub" = yes; then
  1590. AC_DEFINE(HAVE_REGEX_T_RE_NSUB)
  1591. fi
  1592. dnl
  1593. dnl
  1594. AC_MSG_CHECKING([n_subexps member of GNU RX 1.0 regex_t type])
  1595. AC_CACHE_VAL(ice_cv_have_regex_t_n_subexps,
  1596. [
  1597. AC_TRY_COMPILE(
  1598. [
  1599. extern "C" {
  1600. #include <sys/types.h>
  1601.  
  1602. // Avoid conflicts with C regex() function
  1603. #define regex c_regex
  1604.  
  1605. // Don't include old libg++ <regex.h> contents
  1606. #define __REGEXP_LIBRARY
  1607.  
  1608. #ifndef __STDC__
  1609. #define __STDC__ 1              // Reguired for KCC when using GNU includes
  1610. #endif
  1611.  
  1612. // Some old versions of libg++ contain a <regex.h> file.  Avoid this.
  1613. #if !defined(REG_EXTENDED) && HAVE_REGEX_H
  1614. #include <regex.h>        // POSIX.2 interface
  1615. #endif
  1616.  
  1617. // Try hard-wired path to get native <regex.h>.
  1618. #if !defined(REG_EXTENDED) && HAVE_REGEX_H
  1619. #include </usr/include/regex.h>    // POSIX.2 interface
  1620. #endif
  1621.  
  1622. // Some more GNU headers.
  1623. #if !defined(REG_EXTENDED) && HAVE_RX_H
  1624. #include <rx.h>                 // Header from GNU rx 0.07
  1625. #endif
  1626.  
  1627. #if !defined(REG_EXTENDED) && HAVE_RXPOSIX_H
  1628. #include <rxposix.h>        // Header from GNU rx 1.0 and later
  1629. #endif
  1630. }
  1631. ],
  1632. [regex_t rx; int a = rx.n_subexps;],
  1633. ice_cv_have_regex_t_n_subexps=yes, ice_cv_have_regex_t_n_subexps=no)])dnl
  1634. AC_MSG_RESULT($ice_cv_have_regex_t_n_subexps)
  1635. if test "$ice_cv_have_regex_t_n_subexps" = yes; then
  1636. AC_DEFINE(HAVE_REGEX_T_N_SUBEXPS)
  1637. fi
  1638. dnl
  1639. dnl
  1640. AC_LANG_RESTORE
  1641. CPPFLAGS="$ice_save_cppflags"
  1642. ])dnl
  1643. dnl
  1644. dnl
  1645. dnl
  1646. dnl ICE_REGCOMP_BROKEN
  1647. dnl ------------------
  1648. dnl
  1649. dnl #define REGCOMP_BROKEN if regcomp() always returns -1.
  1650. dnl This happens on Solaris 2.4.
  1651. dnl
  1652. AC_DEFUN(ICE_REGCOMP_BROKEN,
  1653. [
  1654. AC_REQUIRE([ICE_TYPE_REGEX_T])
  1655. if  test "$ice_have_regcomp" = yes && test "$ice_have_regexec" = yes; then
  1656. AC_REQUIRE([AC_PROG_CXX])
  1657. AC_MSG_CHECKING([whether regcomp() is broken])
  1658. ice_save_cppflags="$CPPFLAGS"
  1659. CPPFLAGS="-I$srcdir/.. $CPPFLAGS"
  1660. AC_LANG_SAVE
  1661. AC_LANG_CPLUSPLUS
  1662. AC_CACHE_VAL(ice_cv_regcomp_broken,
  1663. [
  1664. AC_TRY_RUN(
  1665. [
  1666. extern "C" {
  1667. #include <sys/types.h>
  1668.  
  1669. // Avoid conflicts with C regex() function
  1670. #define regex c_regex
  1671.  
  1672. // Don't include old libg++ <regex.h> contents
  1673. #define __REGEXP_LIBRARY
  1674.  
  1675. #ifndef __STDC__
  1676. #define __STDC__ 1              // Reguired for KCC when using GNU includes
  1677. #endif
  1678.  
  1679. // Some old versions of libg++ contain a <regex.h> file.  Avoid this.
  1680. #if !defined(REG_EXTENDED) && HAVE_REGEX_H
  1681. #include <regex.h>        // POSIX.2 interface
  1682. #endif
  1683.  
  1684. // Try hard-wired path to get native <regex.h>.
  1685. #if !defined(REG_EXTENDED) && HAVE_REGEX_H
  1686. #include </usr/include/regex.h>    // POSIX.2 interface
  1687. #endif
  1688.  
  1689. // Some more GNU headers.
  1690. #if !defined(REG_EXTENDED) && HAVE_RX_H
  1691. #include <rx.h>                 // Header from GNU rx 0.07
  1692. #endif
  1693.  
  1694. #if !defined(REG_EXTENDED) && HAVE_RXPOSIX_H
  1695. #include <rxposix.h>        // Header from GNU rx 1.0 and later
  1696. #endif
  1697. }
  1698.  
  1699. int main()
  1700. {
  1701.     char rxdouble[] = 
  1702.     "-?(([0-9]+\\\\.[0-9]*)|([0-9]+)|(\\\\.[0-9]+))"
  1703.     "([eE][---+]?[0-9]+)?";
  1704.     regex_t compiled;
  1705.     int errcode = regcomp(&compiled, rxdouble, REG_EXTENDED);
  1706.     if (errcode)
  1707.     return 1;
  1708.     
  1709.     char somedouble[] = "3.141529e+0";
  1710.     return regexec(&compiled, somedouble, 0, 0, 0);
  1711. }
  1712. ], ice_cv_regcomp_broken=no, ice_cv_regcomp_broken=yes,
  1713. ice_cv_regcomp_broken=yes)])dnl
  1714. AC_MSG_RESULT($ice_cv_regcomp_broken)
  1715. if test "$ice_cv_regcomp_broken" = yes; then
  1716. AC_DEFINE(REGCOMP_BROKEN)
  1717. fi
  1718. dnl
  1719. dnl
  1720. AC_LANG_RESTORE
  1721. CPPFLAGS="$ice_save_cppflags"
  1722. ]
  1723. fi)dnl
  1724. dnl
  1725. dnl
  1726. dnl ICE_FIND_MOTIF
  1727. dnl --------------
  1728. dnl
  1729. dnl Find Motif libraries and headers
  1730. dnl Put Motif include directory in motif_includes,
  1731. dnl put Motif library directory in motif_libraries,
  1732. dnl and add appropriate flags to X_CFLAGS and X_LIBS.
  1733. dnl
  1734. dnl
  1735. AC_DEFUN(ICE_FIND_MOTIF,
  1736. [
  1737. AC_REQUIRE([AC_PATH_XTRA])
  1738. motif_includes=
  1739. motif_libraries=
  1740. AC_ARG_WITH(motif,
  1741. [  --without-motif                  do not use Motif widgets])
  1742. dnl Treat --without-motif like
  1743. dnl --without-motif-includes --without-motif-libraries.
  1744. if test "$with_motif" = "no"
  1745. then
  1746. motif_includes=no
  1747. motif_libraries=no
  1748. fi
  1749. AC_ARG_WITH(motif-includes,
  1750. [  --with-motif-includes=DIR        Motif include files are in DIR],
  1751. motif_includes="$withval")
  1752. AC_ARG_WITH(motif-libraries,
  1753. [  --with-motif-libraries=DIR       Motif libraries are in DIR],
  1754. motif_libraries="$withval")
  1755. AC_MSG_CHECKING(for Motif)
  1756. #
  1757. #
  1758. # Search the include files.
  1759. #
  1760. if test "$motif_includes" = ""; then
  1761. AC_CACHE_VAL(ice_cv_motif_includes,
  1762. [
  1763. ice_motif_save_LIBS="$LIBS"
  1764. ice_motif_save_CFLAGS="$CFLAGS"
  1765. ice_motif_save_CPPFLAGS="$CPPFLAGS"
  1766. ice_motif_save_LDFLAGS="$LDFLAGS"
  1767. #
  1768. LIBS="$X_PRE_LIBS -lXm -lXt -lX11 $X_EXTRA_LIBS $LIBS"
  1769. CFLAGS="$X_CFLAGS $CFLAGS"
  1770. CPPFLAGS="$X_CFLAGS $CPPFLAGS"
  1771. LDFLAGS="$X_LIBS $LDFLAGS"
  1772. #
  1773. AC_TRY_COMPILE([#include <Xm/Xm.h>],[int a;],
  1774. [
  1775. # Xm/Xm.h is in the standard search path.
  1776. ice_cv_motif_includes=
  1777. ],
  1778. [
  1779. # Xm/Xm.h is not in the standard search path.
  1780. # Locate it and put its directory in `motif_includes'
  1781. #
  1782. # /usr/include/Motif* are used on HP-UX (Motif).
  1783. # /usr/include/X11* are used on HP-UX (X and Athena).
  1784. # /usr/dt is used on Solaris (Motif).
  1785. # /usr/openwin is used on Solaris (X and Athena).
  1786. # Other directories are just guesses.
  1787. for dir in "$x_includes" "${prefix}/include" /usr/include /usr/local/include \
  1788.            /usr/include/Motif2.0 /usr/include/Motif1.2 /usr/include/Motif1.1 \
  1789.            /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 \
  1790.            /usr/dt/include /usr/openwin/include \
  1791.            /usr/dt/*/include /opt/*/include /usr/include/Motif* \
  1792.        "${prefix}"/*/include /usr/*/include /usr/local/*/include \
  1793.        "${prefix}"/include/* /usr/include/* /usr/local/include/*; do
  1794. if test -f "$dir/Xm/Xm.h"; then
  1795. ice_cv_motif_includes="$dir"
  1796. break
  1797. fi
  1798. done
  1799. if test "$ice_cv_motif_includes" = ""; then
  1800. ice_cv_motif_includes=no
  1801. fi
  1802. ])
  1803. #
  1804. LIBS="$ice_motif_save_LIBS"
  1805. CFLAGS="$ice_motif_save_CFLAGS"
  1806. CPPFLAGS="$ice_motif_save_CPPFLAGS"
  1807. LDFLAGS="$ice_motif_save_LDFLAGS"
  1808. ])
  1809. motif_includes="$ice_cv_motif_includes"
  1810. fi
  1811. #
  1812. #
  1813. # Now for the libraries.
  1814. #
  1815. if test "$motif_libraries" = ""; then
  1816. AC_CACHE_VAL(ice_cv_motif_libraries,
  1817. [
  1818. ice_motif_save_LIBS="$LIBS"
  1819. ice_motif_save_CFLAGS="$CFLAGS"
  1820. ice_motif_save_CPPFLAGS="$CPPFLAGS"
  1821. ice_motif_save_LDFLAGS="$LDFLAGS"
  1822. #
  1823. LIBS="$X_PRE_LIBS -lXm -lXt -lX11 $X_EXTRA_LIBS $LIBS"
  1824. CFLAGS="$X_CFLAGS $CFLAGS"
  1825. CPPFLAGS="$X_CFLAGS $CPPFLAGS"
  1826. LDFLAGS="$X_LIBS $LDFLAGS"
  1827. #
  1828. # We use XtToolkitInitialize() here since it takes no arguments
  1829. # and thus also works with a C++ compiler.
  1830. AC_TRY_LINK([
  1831. #include <X11/Intrinsic.h>
  1832. #include <Xm/Xm.h>
  1833. ],[XtToolkitInitialize();],
  1834. [
  1835. # libXm.a is in the standard search path.
  1836. ice_cv_motif_libraries=
  1837. ],
  1838. [
  1839. # libXm.a is not in the standard search path.
  1840. # Locate it and put its directory in `motif_libraries'
  1841. #
  1842. # /usr/lib/Motif* are used on HP-UX (Motif).
  1843. # /usr/lib/X11* are used on HP-UX (X and Athena).
  1844. # /usr/dt is used on Solaris (Motif).
  1845. # /usr/lesstif is used on Linux (Lesstif).
  1846. # /usr/openwin is used on Solaris (X and Athena).
  1847. # Other directories are just guesses.
  1848. for dir in "$x_libraries" "${prefix}/lib" /usr/lib /usr/local/lib \
  1849.        /usr/lib/Motif2.0 /usr/lib/Motif1.2 /usr/lib/Motif1.1 \
  1850.        /usr/lib/X11R6 /usr/lib/X11R5 /usr/lib/X11R4 /usr/lib/X11 \
  1851.            /usr/dt/lib /usr/openwin/lib \
  1852.        /usr/dt/*/lib /opt/*/lib /usr/lib/Motif* \
  1853.            /usr/lesstif*/lib /usr/lib/Lesstif* \
  1854.        "${prefix}"/*/lib /usr/*/lib /usr/local/*/lib \
  1855.        "${prefix}"/lib/* /usr/lib/* /usr/local/lib/*; do
  1856. if test -d "$dir" && test "`ls $dir/libXm.* 2> /dev/null`" != ""; then
  1857. ice_cv_motif_libraries="$dir"
  1858. break
  1859. fi
  1860. done
  1861. if test "$ice_cv_motif_libraries" = ""; then
  1862. ice_cv_motif_libraries=no
  1863. fi
  1864. ])
  1865. #
  1866. LIBS="$ice_motif_save_LIBS"
  1867. CFLAGS="$ice_motif_save_CFLAGS"
  1868. CPPFLAGS="$ice_motif_save_CPPFLAGS"
  1869. LDFLAGS="$ice_motif_save_LDFLAGS"
  1870. ])
  1871. #
  1872. motif_libraries="$ice_cv_motif_libraries"
  1873. fi
  1874. # Add Motif definitions to X flags
  1875. #
  1876. if test "$motif_includes" != "" && test "$motif_includes" != "$x_includes" && test "$motif_includes" != "no"
  1877. then
  1878. X_CFLAGS="-I$motif_includes $X_CFLAGS"
  1879. fi
  1880. if test "$motif_libraries" != "" && test "$motif_libraries" != "$x_libraries" && test "$motif_libraries" != "no"
  1881. then
  1882. case "$X_LIBS" in
  1883.   *-R\ *) X_LIBS="-L$motif_libraries -R $motif_libraries $X_LIBS";;
  1884.   *-R*)   X_LIBS="-L$motif_libraries -R$motif_libraries $X_LIBS";;
  1885.   *)      X_LIBS="-L$motif_libraries $X_LIBS";;
  1886. esac
  1887. fi
  1888. #
  1889. #
  1890. motif_libraries_result="$motif_libraries"
  1891. motif_includes_result="$motif_includes"
  1892. test "$motif_libraries_result" = "" && 
  1893.   motif_libraries_result="in default path"
  1894. test "$motif_includes_result" = "" && 
  1895.   motif_includes_result="in default path"
  1896. test "$motif_libraries_result" = "no" && 
  1897.   motif_libraries_result="(none)"
  1898. test "$motif_includes_result" = "no" && 
  1899.   motif_includes_result="(none)"
  1900. AC_MSG_RESULT(
  1901.   [libraries $motif_libraries_result, headers $motif_includes_result])
  1902. ])dnl
  1903. dnl
  1904. dnl
  1905. dnl ICE_FIND_ATHENA
  1906. dnl ---------------
  1907. dnl
  1908. dnl Find Athena libraries and headers.
  1909. dnl Put Athena include directory in athena_includes,
  1910. dnl put Athena library directory in athena_libraries,
  1911. dnl and add appropriate flags to X_CFLAGS and X_LIBS.
  1912. dnl
  1913. dnl
  1914. AC_DEFUN(ICE_FIND_ATHENA,
  1915. [
  1916. AC_REQUIRE([AC_PATH_XTRA])
  1917. athena_includes=
  1918. athena_libraries=
  1919. AC_ARG_WITH(athena,
  1920. [  --without-athena                 do not use Athena widgets])
  1921. dnl Treat --without-athena like
  1922. dnl --without-athena-includes --without-athena-libraries.
  1923. if test "$with_athena" = "no"
  1924. then
  1925. athena_includes=no
  1926. athena_libraries=no
  1927. fi
  1928. AC_ARG_WITH(athena-includes,
  1929. [  --with-athena-includes=DIR       Athena include files are in DIR],
  1930. athena_includes="$withval")
  1931. AC_ARG_WITH(athena-libraries,
  1932. [  --with-athena-libraries=DIR      Athena libraries are in DIR],
  1933. athena_libraries="$withval")
  1934. AC_MSG_CHECKING(for Athena)
  1935. #
  1936. #
  1937. # Search the include files.
  1938. #
  1939. if test "$athena_includes" = ""; then
  1940. AC_CACHE_VAL(ice_cv_athena_includes,
  1941. [
  1942. ice_athena_save_LIBS="$LIBS"
  1943. ice_athena_save_CFLAGS="$CFLAGS"
  1944. ice_athena_save_CPPFLAGS="$CPPFLAGS"
  1945. ice_athena_save_LDFLAGS="$LDFLAGS"
  1946. #
  1947. LIBS="$X_PRE_LIBS -lXaw -lXmu -lXext -lXt -lX11 $X_EXTRA_LIBS $LIBS"
  1948. CFLAGS="$X_CFLAGS $CFLAGS"
  1949. CPPFLAGS="$X_CFLAGS $CPPFLAGS"
  1950. LDFLAGS="$X_LIBS $LDFLAGS"
  1951. #
  1952. AC_TRY_COMPILE([
  1953. #include <X11/Intrinsic.h>
  1954. #include <X11/Xaw/Text.h>
  1955. ],[int a;],
  1956. [
  1957. # X11/Xaw/Text.h is in the standard search path.
  1958. ice_cv_athena_includes=
  1959. ],
  1960. [
  1961. # X11/Xaw/Text.h is not in the standard search path.
  1962. # Locate it and put its directory in `athena_includes'
  1963. #
  1964. # /usr/include/Motif* are used on HP-UX (Motif).
  1965. # /usr/include/X11* are used on HP-UX (X and Athena).
  1966. # /usr/dt is used on Solaris (Motif).
  1967. # /usr/openwin is used on Solaris (X and Athena).
  1968. # Other directories are just guesses.
  1969. for dir in "$x_includes" "${prefix}/include" /usr/include /usr/local/include \
  1970.            /usr/include/Motif2.0 /usr/include/Motif1.2 /usr/include/Motif1.1 \
  1971.            /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 \
  1972.            /usr/dt/include /usr/openwin/include \
  1973.            /usr/dt/*/include /opt/*/include /usr/include/Motif* \
  1974.        "${prefix}"/*/include /usr/*/include /usr/local/*/include \
  1975.        "${prefix}"/include/* /usr/include/* /usr/local/include/*; do
  1976. if test -f "$dir/X11/Xaw/Text.h"; then
  1977. ice_cv_athena_includes="$dir"
  1978. break
  1979. fi
  1980. done
  1981. ])
  1982. #
  1983. LIBS="$ice_athena_save_LIBS"
  1984. CFLAGS="$ice_athena_save_CFLAGS"
  1985. CPPFLAGS="$ice_athena_save_CPPFLAGS"
  1986. LDFLAGS="$ice_athena_save_LDFLAGS"
  1987. ])
  1988. athena_includes="$ice_cv_athena_includes"
  1989. fi
  1990. #
  1991. #
  1992. # Now for the libraries.
  1993. #
  1994. if test "$athena_libraries" = ""; then
  1995. AC_CACHE_VAL(ice_cv_athena_libraries,
  1996. [
  1997. ice_athena_save_LIBS="$LIBS"
  1998. ice_athena_save_CFLAGS="$CFLAGS"
  1999. ice_athena_save_CPPFLAGS="$CPPFLAGS"
  2000. ice_athena_save_LDFLAGS="$LDFLAGS"
  2001. #
  2002. LIBS="$X_PRE_LIBS -lXaw -lXmu -lXext -lXt -lX11 $X_EXTRA_LIBS $LIBS"
  2003. CFLAGS="$X_CFLAGS $CFLAGS"
  2004. CPPFLAGS="$X_CFLAGS $CPPFLAGS"
  2005. LDFLAGS="$X_LIBS $LDFLAGS"
  2006. #
  2007. # We use XtToolkitInitialize() here since it takes no arguments
  2008. # and thus also works with a C++ compiler.
  2009. AC_TRY_LINK([
  2010. #include <X11/Intrinsic.h>
  2011. #include <X11/Xaw/Text.h>
  2012. ],[XtToolkitInitialize();],
  2013. [
  2014. # libXaw.a is in the standard search path.
  2015. ice_cv_athena_libraries=
  2016. ],
  2017. [
  2018. # libXaw.a is not in the standard search path.
  2019. # Locate it and put its directory in `athena_libraries'
  2020. #
  2021. #
  2022. # /usr/lib/Motif* are used on HP-UX (Motif).
  2023. # /usr/lib/X11* are used on HP-UX (X and Athena).
  2024. # /usr/dt is used on Solaris (Motif).
  2025. # /usr/openwin is used on Solaris (X and Athena).
  2026. # Other directories are just guesses.
  2027. for dir in "$x_libraries" "${prefix}/lib" /usr/lib /usr/local/lib \
  2028.        /usr/lib/Motif2.0 /usr/lib/Motif1.2 /usr/lib/Motif1.1 \
  2029.        /usr/lib/X11R6 /usr/lib/X11R5 /usr/lib/X11R4 /usr/lib/X11 \
  2030.            /usr/dt/lib /usr/openwin/lib \
  2031.        /usr/dt/*/lib /opt/*/lib /usr/lib/Motif* \
  2032.        "${prefix}"/*/lib /usr/*/lib /usr/local/*/lib \
  2033.        "${prefix}"/lib/* /usr/lib/* /usr/local/lib/*; do
  2034. if test -d "$dir" && test "`ls $dir/libXaw.* 2> /dev/null`" != ""; then
  2035. ice_cv_athena_libraries="$dir"
  2036. break
  2037. fi
  2038. done
  2039. ])
  2040. #
  2041. LIBS="$ice_athena_save_LIBS"
  2042. CFLAGS="$ice_athena_save_CFLAGS"
  2043. CPPFLAGS="$ice_athena_save_CPPFLAGS"
  2044. LDFLAGS="$ice_athena_save_LDFLAGS"
  2045. ])
  2046. #
  2047. athena_libraries="$ice_cv_athena_libraries"
  2048. fi
  2049. # Add Athena definitions to X flags
  2050. #
  2051. if test "$athena_includes" != "" && test "$athena_includes" != "$x_includes" && test "$athena_includes" != "no"
  2052. then
  2053. X_CFLAGS="-I$athena_includes $X_CFLAGS"
  2054. fi
  2055. if test "$athena_libraries" != "" && test "$athena_libraries" != "$x_libraries" && test "$athena_libraries" != "no"
  2056. then
  2057. case "$X_LIBS" in
  2058.   *-R\ *) X_LIBS="-L$athena_libraries -R $athena_libraries $X_LIBS";;
  2059.   *-R*)   X_LIBS="-L$athena_libraries -R$athena_libraries $X_LIBS";;
  2060.   *)      X_LIBS="-L$athena_libraries $X_LIBS";;
  2061. esac
  2062. fi
  2063. #
  2064. #
  2065. athena_libraries_result="$athena_libraries"
  2066. athena_includes_result="$athena_includes"
  2067. test "$athena_libraries_result" = "" && 
  2068.   athena_libraries_result="in default path"
  2069. test "$athena_includes_result" = "" && 
  2070.   athena_includes_result="in default path"
  2071. test "$athena_libraries_result" = "no" && 
  2072.   athena_libraries_result="(none)"
  2073. test "$athena_includes_result" = "no" && 
  2074.   athena_includes_result="(none)"
  2075. AC_MSG_RESULT(
  2076.   [libraries $athena_libraries_result, headers $athena_includes_result])
  2077. ])dnl
  2078. dnl
  2079. dnl
  2080. dnl ICE_FIND_XPM
  2081. dnl ---------------
  2082. dnl
  2083. dnl Find Xpm libraries and headers.
  2084. dnl Put Xpm include directory in xpm_includes,
  2085. dnl put Xpm library directory in xpm_libraries,
  2086. dnl and add appropriate flags to X_CFLAGS and X_LIBS.
  2087. dnl
  2088. dnl
  2089. AC_DEFUN(ICE_FIND_XPM,
  2090. [
  2091. AC_REQUIRE([AC_PATH_XTRA])
  2092. xpm_includes=
  2093. xpm_libraries=
  2094. AC_ARG_WITH(xpm,
  2095. [  --without-xpm                    do not use the Xpm library])
  2096. dnl Treat --without-xpm like
  2097. dnl --without-xpm-includes --without-xpm-libraries.
  2098. if test "$with_xpm" = "no"
  2099. then
  2100. xpm_includes=no
  2101. xpm_libraries=no
  2102. fi
  2103. AC_ARG_WITH(xpm-includes,
  2104. [  --with-xpm-includes=DIR          Xpm include files are in DIR],
  2105. xpm_includes="$withval")
  2106. AC_ARG_WITH(xpm-libraries,
  2107. [  --with-xpm-libraries=DIR         Xpm libraries are in DIR],
  2108. xpm_libraries="$withval")
  2109. AC_MSG_CHECKING(for Xpm)
  2110. #
  2111. #
  2112. # Search the include files.  Note that XPM can come in <X11/xpm.h> (as
  2113. # in X11R6) or in <xpm.h> if installed locally.
  2114. #
  2115. if test "$xpm_includes" = ""; then
  2116. AC_CACHE_VAL(ice_cv_xpm_includes,
  2117. [
  2118. ice_xpm_save_LIBS="$LIBS"
  2119. ice_xpm_save_CFLAGS="$CFLAGS"
  2120. ice_xpm_save_CPPFLAGS="$CPPFLAGS"
  2121. ice_xpm_save_LDFLAGS="$LDFLAGS"
  2122. #
  2123. LIBS="$X_PRE_LIBS -lXpm -lXt -lX11 $X_EXTRA_LIBS $LIBS"
  2124. CFLAGS="$X_CFLAGS $CFLAGS"
  2125. CPPFLAGS="$X_CFLAGS $CPPFLAGS"
  2126. LDFLAGS="$X_LIBS $LDFLAGS"
  2127. #
  2128. AC_TRY_COMPILE([
  2129. #include <X11/xpm.h>
  2130. ],[int a;],
  2131. [
  2132. # X11/xpm.h is in the standard search path.
  2133. ice_cv_xpm_includes=
  2134. ],
  2135. [
  2136. # X11/xpm.h is not in the standard search path.
  2137. # Locate it and put its directory in `xpm_includes'
  2138. #
  2139. # /usr/include/Motif* are used on HP-UX (Motif).
  2140. # /usr/include/X11* are used on HP-UX (X and Xaw).
  2141. # /usr/dt is used on Solaris (Motif).
  2142. # /usr/openwin is used on Solaris (X and Xaw).
  2143. # Other directories are just guesses.
  2144. for dir in "$x_includes" "${prefix}/include" /usr/include /usr/local/include \
  2145.            /usr/include/Motif2.0 /usr/include/Motif1.2 /usr/include/Motif1.1 \
  2146.            /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 \
  2147.            /usr/dt/include /usr/openwin/include \
  2148.            /usr/dt/*/include /opt/*/include /usr/include/Motif* \
  2149.        "${prefix}"/*/include /usr/*/include /usr/local/*/include \
  2150.        "${prefix}"/include/* /usr/include/* /usr/local/include/*; do
  2151. if test -f "$dir/X11/xpm.h" || test -f "$dir/xpm.h"; then
  2152. ice_cv_xpm_includes="$dir"
  2153. break
  2154. fi
  2155. done
  2156. ])
  2157. #
  2158. LIBS="$ice_xpm_save_LIBS"
  2159. CFLAGS="$ice_xpm_save_CFLAGS"
  2160. CPPFLAGS="$ice_xpm_save_CPPFLAGS"
  2161. LDFLAGS="$ice_xpm_save_LDFLAGS"
  2162. ])
  2163. xpm_includes="$ice_cv_xpm_includes"
  2164. fi
  2165. #
  2166. #
  2167. # Now for the libraries.
  2168. #
  2169. if test "$xpm_libraries" = ""; then
  2170. AC_CACHE_VAL(ice_cv_xpm_libraries,
  2171. [
  2172. ice_xpm_save_LIBS="$LIBS"
  2173. ice_xpm_save_CFLAGS="$CFLAGS"
  2174. ice_xpm_save_CPPFLAGS="$CPPFLAGS"
  2175. ice_xpm_save_LDFLAGS="$LDFLAGS"
  2176. #
  2177. LIBS="$X_PRE_LIBS -lXpm -lXt -lX11 $X_EXTRA_LIBS $LIBS"
  2178. CFLAGS="$X_CFLAGS $CFLAGS"
  2179. CPPFLAGS="$X_CFLAGS $CPPFLAGS"
  2180. LDFLAGS="$X_LIBS $LDFLAGS"
  2181. #
  2182. #
  2183. # We use XtToolkitInitialize() here since it takes no arguments
  2184. # and thus also works with a C++ compiler.
  2185. AC_TRY_LINK([
  2186. #include <X11/Intrinsic.h>
  2187. #include <X11/xpm.h>
  2188. ],[XtToolkitInitialize();],
  2189. [
  2190. # libxpm.a is in the standard search path.
  2191. ice_cv_xpm_libraries=
  2192. ],
  2193. [
  2194. # libXpm.a is not in the standard search path.
  2195. # Locate it and put its directory in `xpm_libraries'
  2196. #
  2197. #
  2198. # /usr/lib/Motif* are used on HP-UX (Motif).
  2199. # /usr/lib/X11* are used on HP-UX (X and Xpm).
  2200. # /usr/dt is used on Solaris (Motif).
  2201. # /usr/openwin is used on Solaris (X and Xpm).
  2202. # Other directories are just guesses.
  2203. for dir in "$x_libraries" "${prefix}/lib" /usr/lib /usr/local/lib \
  2204.        /usr/lib/Motif2.0 /usr/lib/Motif1.2 /usr/lib/Motif1.1 \
  2205.        /usr/lib/X11R6 /usr/lib/X11R5 /usr/lib/X11R4 /usr/lib/X11 \
  2206.            /usr/dt/lib /usr/openwin/lib \
  2207.        /usr/dt/*/lib /opt/*/lib /usr/lib/Motif* \
  2208.        "${prefix}"/*/lib /usr/*/lib /usr/local/*/lib \
  2209.        "${prefix}"/lib/* /usr/lib/* /usr/local/lib/*; do
  2210. if test -d "$dir" && test "`ls $dir/libXpm.* 2> /dev/null`" != ""; then
  2211. ice_cv_xpm_libraries="$dir"
  2212. break
  2213. fi
  2214. done
  2215. ])
  2216. #
  2217. LIBS="$ice_xpm_save_LIBS"
  2218. CFLAGS="$ice_xpm_save_CFLAGS"
  2219. CPPFLAGS="$ice_xpm_save_CPPFLAGS"
  2220. LDFLAGS="$ice_xpm_save_LDFLAGS"
  2221. ])
  2222. #
  2223. xpm_libraries="$ice_cv_xpm_libraries"
  2224. fi
  2225. #
  2226. # Add Xpm definitions to X flags
  2227. #
  2228. if test "$xpm_includes" != "" && test "$xpm_includes" != "$x_includes" && test "$xpm_includes" != "no"
  2229. then
  2230. X_CFLAGS="-I$xpm_includes $X_CFLAGS"
  2231. fi
  2232. if test "$xpm_libraries" != "" && test "$xpm_libraries" != "$x_libraries" && test "$xpm_libraries" != "no"
  2233. then
  2234. case "$X_LIBS" in
  2235.   *-R\ *) X_LIBS="-L$xpm_libraries -R $xpm_libraries $X_LIBS";;
  2236.   *-R*)   X_LIBS="-L$xpm_libraries -R$xpm_libraries $X_LIBS";;
  2237.   *)      X_LIBS="-L$xpm_libraries $X_LIBS";;
  2238. esac
  2239. fi
  2240. #
  2241. #
  2242. xpm_libraries_result="$xpm_libraries"
  2243. xpm_includes_result="$xpm_includes"
  2244. test "$xpm_libraries_result" = "" && 
  2245.   xpm_libraries_result="in default path"
  2246. test "$xpm_includes_result" = "" && 
  2247.   xpm_includes_result="in default path"
  2248. test "$xpm_libraries_result" = "no" && 
  2249.   xpm_libraries_result="(none)"
  2250. test "$xpm_includes_result" = "no" && 
  2251.   xpm_includes_result="(none)"
  2252. AC_MSG_RESULT(
  2253.   [libraries $xpm_libraries_result, headers $xpm_includes_result])
  2254. ])dnl
  2255. dnl
  2256. dnl
  2257. dnl
  2258. dnl ICE_TRANSLATION_RESOURCE
  2259. dnl ------------------------
  2260. dnl 
  2261. dnl If Xt supports base translations, set @TRANSLATIONS@ to `baseTranslations',
  2262. dnl otherwise, to `translations'.
  2263. dnl
  2264. AC_DEFUN(ICE_TRANSLATION_RESOURCE,
  2265. [
  2266. AC_REQUIRE([AC_PROG_CXX])
  2267. AC_MSG_CHECKING(for the name of the translation resource)
  2268. AC_CACHE_VAL(ice_cv_translations,
  2269. [
  2270. AC_TRY_COMPILE([#include <X11/Intrinsic.h>],[
  2271. #if XtSpecificationRelease < 5
  2272. #error baseTranslation resource only in X11R5 and later
  2273. #endif
  2274. ],
  2275. ice_cv_translations=baseTranslations, 
  2276. ice_cv_translations=translations)
  2277. ])
  2278. AC_MSG_RESULT($ice_cv_translations)
  2279. TRANSLATIONS=$ice_cv_translations
  2280. AC_SUBST(TRANSLATIONS)
  2281. ])dnl
  2282.  
  2283. # Do all the work for Automake.  This macro actually does too much --
  2284. # some checks are only needed if your package does certain things.
  2285. # But this isn't really a big deal.
  2286.  
  2287. # serial 1
  2288.  
  2289. dnl Usage:
  2290. dnl AM_INIT_AUTOMAKE(package,version, [no-define])
  2291.  
  2292. AC_DEFUN(AM_INIT_AUTOMAKE,
  2293. [AC_REQUIRE([AM_PROG_INSTALL])
  2294. PACKAGE=[$1]
  2295. AC_SUBST(PACKAGE)
  2296. VERSION=[$2]
  2297. AC_SUBST(VERSION)
  2298. dnl test to see if srcdir already configured
  2299. if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
  2300.   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
  2301. fi
  2302. ifelse([$3],,
  2303. AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
  2304. AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
  2305. AC_REQUIRE([AM_SANITY_CHECK])
  2306. AC_REQUIRE([AC_ARG_PROGRAM])
  2307. dnl FIXME This is truly gross.
  2308. missing_dir=`cd $ac_aux_dir && pwd`
  2309. AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
  2310. AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
  2311. AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
  2312. AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
  2313. AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
  2314. AC_REQUIRE([AC_PROG_MAKE_SET])])
  2315.  
  2316.  
  2317. # serial 1
  2318.  
  2319. AC_DEFUN(AM_PROG_INSTALL,
  2320. [AC_REQUIRE([AC_PROG_INSTALL])
  2321. test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
  2322. AC_SUBST(INSTALL_SCRIPT)dnl
  2323. ])
  2324.  
  2325. #
  2326. # Check to make sure that the build environment is sane.
  2327. #
  2328.  
  2329. AC_DEFUN(AM_SANITY_CHECK,
  2330. [AC_MSG_CHECKING([whether build environment is sane])
  2331. # Just in case
  2332. sleep 1
  2333. echo timestamp > conftestfile
  2334. # Do `set' in a subshell so we don't clobber the current shell's
  2335. # arguments.  Must try -L first in case configure is actually a
  2336. # symlink; some systems play weird games with the mod time of symlinks
  2337. # (eg FreeBSD returns the mod time of the symlink's containing
  2338. # directory).
  2339. if (
  2340.    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
  2341.    if test "[$]*" = "X"; then
  2342.       # -L didn't work.
  2343.       set X `ls -t $srcdir/configure conftestfile`
  2344.    fi
  2345.    if test "[$]*" != "X $srcdir/configure conftestfile" \
  2346.       && test "[$]*" != "X conftestfile $srcdir/configure"; then
  2347.  
  2348.       # If neither matched, then we have a broken ls.  This can happen
  2349.       # if, for instance, CONFIG_SHELL is bash and it inherits a
  2350.       # broken ls alias from the environment.  This has actually
  2351.       # happened.  Such a system could not be considered "sane".
  2352.       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
  2353. alias in your environment])
  2354.    fi
  2355.  
  2356.    test "[$]2" = conftestfile
  2357.    )
  2358. then
  2359.    # Ok.
  2360.    :
  2361. else
  2362.    AC_MSG_ERROR([newly created file is older than distributed files!
  2363. Check your system clock])
  2364. fi
  2365. rm -f conftest*
  2366. AC_MSG_RESULT(yes)])
  2367.  
  2368. dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
  2369. dnl The program must properly implement --version.
  2370. AC_DEFUN(AM_MISSING_PROG,
  2371. [AC_MSG_CHECKING(for working $2)
  2372. # Run test in a subshell; some versions of sh will print an error if
  2373. # an executable is not found, even if stderr is redirected.
  2374. # Redirect stdin to placate older versions of autoconf.  Sigh.
  2375. if ($2 --version) < /dev/null > /dev/null 2>&1; then
  2376.    $1=$2
  2377.    AC_MSG_RESULT(found)
  2378. else
  2379.    $1="$3/missing $2"
  2380.    AC_MSG_RESULT(missing)
  2381. fi
  2382. AC_SUBST($1)])
  2383.  
  2384.  
  2385. dnl AM_PROG_LEX
  2386. dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT
  2387. AC_DEFUN(AM_PROG_LEX,
  2388. [missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1)
  2389. AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex")
  2390. AC_PROG_LEX
  2391. AC_DECL_YYTEXT])
  2392.  
  2393. # Check to see if we're running under Win32, without using
  2394. # AC_CANONICAL_*.  If so, set output variable EXEEXT to ".exe".
  2395. # Otherwise set it to "".
  2396.  
  2397. dnl AM_EXEEXT()
  2398. dnl This knows we add .exe if we're building in the Cygwin32
  2399. dnl environment. But if we're not, then it compiles a test program
  2400. dnl to see if there is a suffix for executables.
  2401. AC_DEFUN(AM_EXEEXT,
  2402. [AC_REQUIRE([AM_CYGWIN32])
  2403. AC_REQUIRE([AM_MINGW32])
  2404. AC_MSG_CHECKING([for executable suffix])
  2405. AC_CACHE_VAL(am_cv_exeext,
  2406. [if test "$CYGWIN32" = yes || test "$MINGW32" = yes; then
  2407. am_cv_exeext=.exe
  2408. else
  2409. cat > am_c_test.c << 'EOF'
  2410. int main() {
  2411. /* Nothing needed here */
  2412. }
  2413. EOF
  2414. ${CC-cc} -o am_c_test $CFLAGS $CPPFLAGS $LDFLAGS am_c_test.c $LIBS 1>&5
  2415. am_cv_exeext=
  2416. for file in am_c_test.*; do
  2417.    case $file in
  2418.     *.c) ;;
  2419.     *.o) ;;
  2420.     *) am_cv_exeext=`echo $file | sed -e s/am_c_test//` ;;
  2421.    esac
  2422. done
  2423. rm -f am_c_test*])
  2424. test x"${am_cv_exeext}" = x && am_cv_exeext=no
  2425. fi
  2426. EXEEXT=""
  2427. test x"${am_cv_exeext}" != xno && EXEEXT=${am_cv_exeext}
  2428. AC_MSG_RESULT(${am_cv_exeext})
  2429. AC_SUBST(EXEEXT)])
  2430.  
  2431. # Check to see if we're running under Cygwin32, without using
  2432. # AC_CANONICAL_*.  If so, set output variable CYGWIN32 to "yes".
  2433. # Otherwise set it to "no".
  2434.  
  2435. dnl AM_CYGWIN32()
  2436. AC_DEFUN(AM_CYGWIN32,
  2437. [AC_CACHE_CHECK(for Cygwin32 environment, am_cv_cygwin32,
  2438. [AC_TRY_COMPILE(,[return __CYGWIN32__;],
  2439. am_cv_cygwin32=yes, am_cv_cygwin32=no)
  2440. rm -f conftest*])
  2441. CYGWIN32=
  2442. test "$am_cv_cygwin32" = yes && CYGWIN32=yes])
  2443.  
  2444. # Check to see if we're running under Mingw, without using
  2445. # AC_CANONICAL_*.  If so, set output variable MINGW32 to "yes".
  2446. # Otherwise set it to "no".
  2447.  
  2448. dnl AM_MINGW32()
  2449. AC_DEFUN(AM_MINGW32,
  2450. [AC_CACHE_CHECK(for Mingw32 environment, am_cv_mingw32,
  2451. [AC_TRY_COMPILE(,[return __MINGW32__;],
  2452. am_cv_mingw32=yes, am_cv_mingw32=no)
  2453. rm -f conftest*])
  2454. MINGW32=
  2455. test "$am_cv_mingw32" = yes && MINGW32=yes])
  2456.  
  2457.