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 / acinclude.m4 < prev    next >
M4 Source File  |  1998-12-04  |  59KB  |  2,270 lines

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