aclocal.m4 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745
  1. AC_DEFUN([LOC_CHECK_USE],[
  2. AC_MSG_CHECKING(whether to use $2)
  3. AC_MSG_RESULT("$with_$1")
  4. case "$with_$1" in
  5. "no") $3= ;;
  6. "yes") $3="1" ;;
  7. *) AC_MSG_ERROR([*** You must answer yes or no.]) ;;
  8. esac
  9. ])
  10. AC_DEFUN([LOC_CHECK_INC_PATH],[
  11. AC_MSG_CHECKING(for location of $2 includes)
  12. case "$with_$1_includes" in
  13. y | ye | yes | n | no)
  14. AC_MSG_ERROR([*** You must supply a directory to --with-$1-includes.])
  15. ;;
  16. esac
  17. AC_MSG_RESULT($with_$1_includes)
  18. if test -n "$with_$1_includes" ; then
  19. for dir in $with_$1_includes; do
  20. if test -d "$dir"; then
  21. $3="$$3 -I$dir"
  22. else
  23. AC_MSG_ERROR([*** $2 includes directory $dir does not exist.])
  24. fi
  25. done
  26. fi
  27. ])
  28. AC_DEFUN([LOC_CHECK_LIB_PATH],[
  29. AC_MSG_CHECKING(for location of $2 library)
  30. case "$with_$1_libs" in
  31. y | ye | yes | n | no)
  32. AC_MSG_ERROR([*** You must supply a directory to --with-$1-libs.])
  33. ;;
  34. esac
  35. AC_MSG_RESULT($with_$1_libs)
  36. if test -n "$with_$1_libs"; then
  37. for dir in $with_$1_libs; do
  38. if test -d "$dir"; then
  39. $3="$$3 -L$dir"
  40. else
  41. AC_MSG_ERROR([*** $2 library directory $dir does not exist.])
  42. fi
  43. done
  44. fi
  45. ])
  46. AC_DEFUN([LOC_CHECK_FRAMEWORK_PATH],[
  47. AC_MSG_CHECKING(for location of $2 framework)
  48. case "$with_$1_framework" in
  49. y | ye | yes | n | no)
  50. AC_MSG_ERROR([*** You must supply a directory to --with-$1-framework.])
  51. ;;
  52. esac
  53. AC_MSG_RESULT($with_$1_framework)
  54. if test -n "$with_$1_framework"; then
  55. if test -d $with_$1_framework; then
  56. $3="$$3 -F$with_$1_framework"
  57. else
  58. AC_MSG_ERROR([*** $2 framework directory $dir does not exist.])
  59. fi
  60. fi
  61. ])
  62. AC_DEFUN([LOC_CHECK_SHARE_PATH],[
  63. AC_MSG_CHECKING(for location of $2 data files)
  64. case "$with_$1_share" in
  65. y | ye | yes | n | no)
  66. AC_MSG_ERROR([*** You must supply a directory to --with-$1-share.])
  67. ;;
  68. esac
  69. AC_MSG_RESULT($with_$1_share)
  70. if test -n "$with_$1_share" ; then
  71. if test -d "$with_$1_share"; then
  72. $3="$with_$1_share"
  73. else
  74. AC_MSG_ERROR([*** $2 data directory $dir does not exist.])
  75. fi
  76. fi
  77. ])
  78. AC_DEFUN([LOC_CHECK_LDFLAGS],[
  79. AC_MSG_CHECKING(for $2 linking flags)
  80. case "$with_$1_ldflags" in
  81. y | ye | yes | n | no)
  82. AC_MSG_ERROR([*** You must supply a directory to --with-$1-ldflags.])
  83. ;;
  84. esac
  85. AC_MSG_RESULT($with_$1_ldflags)
  86. $3="$$3 $with_$1_ldflags"
  87. ])
  88. AC_DEFUN([LOC_CHECK_INCLUDES],[
  89. ac_save_cppflags="$CPPFLAGS"
  90. CPPFLAGS="$3 $CPPFLAGS"
  91. AC_CHECK_HEADERS($1, [], ifelse($4,[],[
  92. AC_MSG_ERROR([*** Unable to locate $2 includes.])
  93. ], $4))
  94. CPPFLAGS=$ac_save_cppflags
  95. ])
  96. dnl $1 = library
  97. dnl $2 = header
  98. dnl $3 = function call
  99. dnl $4 = descriptive name
  100. dnl $5 = LDFLAGS initialiser
  101. dnl $6 = result variable
  102. dnl $7 = mandatory dependencies (not added to $5)
  103. dnl $8 = mandatory dependencies (added to $5)
  104. dnl $9 = ACTION-IF-NOT-FOUND
  105. define(LOC_CHECK_LINK,[
  106. ac_save_ldflags="$LDFLAGS"
  107. ac_save_libs="$LIBS"
  108. AC_MSG_CHECKING(for $4 library)
  109. LDFLAGS="$5 $LDFLAGS"
  110. LIBS="-l$1 $7 $8"
  111. AC_TRY_LINK([$2],[$3],[
  112. AC_MSG_RESULT(found)
  113. $6="$$6 -l$1 $8"
  114. ],[
  115. ifelse($9,[],[
  116. AC_MSG_ERROR([*** Unable to locate $4 library.])
  117. ],$9)
  118. ])
  119. LIBS=${ac_save_libs}
  120. LDFLAGS=${ac_save_ldflags}
  121. ])
  122. dnl autoconf undefines "shift", so use "builtin([shift], ...)"
  123. define(LOC_SHIFT1,[builtin([shift],$*)])
  124. define(LOC_SHIFT2,[LOC_SHIFT1(LOC_SHIFT1($*))])
  125. define(LOC_SHIFT4,[LOC_SHIFT2(LOC_SHIFT2($*))])
  126. define(LOC_SHIFT8,[LOC_SHIFT4(LOC_SHIFT4($*))])
  127. define(LOC_SHIFT9,[LOC_SHIFT1(LOC_SHIFT8($*))])
  128. dnl $1 = library
  129. dnl $2 = function
  130. dnl $3 = descriptive name
  131. dnl $4 = LDFLAGS initialiser
  132. dnl $5 = result variable
  133. dnl $6 = mandatory dependencies (not added to $5)
  134. dnl $7 = mandatory dependencies (added to $5)
  135. dnl $8 = ACTION-IF-NOT-FOUND
  136. dnl $9+ = optional dependencies
  137. define(LOC_CHECK_LIBS_0,[
  138. AC_CHECK_LIB($1, $2, $5="$$5 -l$1 $7",[
  139. [$8]
  140. ],$6 $7)
  141. ])
  142. define(LOC_CHECK_LIBS_1,[
  143. ifelse($9,[],
  144. LOC_CHECK_LIBS_0($1,$2,,,$5,$6,$7,$8),
  145. [
  146. LOC_CHECK_LIBS_1($1,$2,,,$5,$6,$7,
  147. LOC_CHECK_LIBS_1($1,$2,,,$5,$6,$7 $9,$8,LOC_SHIFT9($*)),
  148. LOC_SHIFT9($*))
  149. ]
  150. )
  151. ])
  152. define(LOC_CHECK_LIBS,[
  153. ac_save_ldflags="$LDFLAGS"
  154. LDFLAGS="$4 $LDFLAGS"
  155. LOC_CHECK_LIBS_1($1,$2,,,$5,$6,$7,
  156. LDFLAGS=${ac_save_ldflags}
  157. ifelse($8,[],[
  158. AC_MSG_ERROR([*** Unable to locate $3 library.])
  159. ],$8),LOC_SHIFT8($*))
  160. LDFLAGS=${ac_save_ldflags}
  161. ])
  162. dnl $1 = function
  163. dnl $2 = descriptive name
  164. dnl $3 = result variable
  165. dnl $4 = LIBS initialiser (added to $3)
  166. dnl $5 = LDFLAGS initialiser (not added to $3)
  167. dnl $6 = LIBS initialiser (not added to $3)
  168. dnl $7 = ACTION-IF-FOUND
  169. dnl $8 = ACTION-IF-NOT-FOUND
  170. define(LOC_CHECK_FUNC,[
  171. ac_save_libs="$LIBS"
  172. ac_save_ldflags="$LDFLAGS"
  173. LIBS="$4 $6 $LIBS"
  174. LDFLAGS="$5 $LDFLAGS"
  175. AC_CHECK_FUNC($1,[
  176. ifelse($7,[],[
  177. $3="$$3 $4"
  178. ],$7)
  179. ],[
  180. ifelse($8,[],[
  181. ifelse($2,[],
  182. [AC_MSG_ERROR([*** Unable to locate $1.])],
  183. [AC_MSG_ERROR([*** Unable to locate $2.])]
  184. )
  185. ],$8)
  186. ])
  187. LIBS=${ac_save_libs}
  188. LDFLAGS=${ac_save_ldflags}
  189. ])
  190. AC_DEFUN([LOC_CHECK_VERSION_STRING],[
  191. AC_MSG_CHECKING($3 version)
  192. ac_save_cppflags="$CPPFLAGS"
  193. CPPFLAGS="$5 $CPPFLAGS"
  194. AC_TRY_RUN([
  195. #include <stdio.h>
  196. #include <$1>
  197. int main(void) {
  198. FILE *fp = fopen("conftestdata","w");
  199. fputs($2, fp);
  200. return 0;
  201. }
  202. ],
  203. [ $4=`cat conftestdata`
  204. AC_MSG_RESULT($$4)],
  205. [ AC_MSG_ERROR([*** Could not determine $3 version.]) ],
  206. [ $4=$6
  207. AC_MSG_RESULT([unknown (cross-compiling)]) ])
  208. CPPFLAGS=$ac_save_cppflags
  209. ])
  210. AC_DEFUN([LOC_CHECK_SHARE],[
  211. AC_CHECK_FILE($3/$1, [], ifelse($4,[],[
  212. AC_MSG_ERROR([*** Unable to locate $2 data files.])
  213. ], $4))
  214. ])
  215. AC_DEFUN([LOC_CHECK_VERSION_INT],[
  216. AC_MSG_CHECKING($3 version)
  217. ac_save_cppflags="$CPPFLAGS"
  218. CPPFLAGS="$5 $CPPFLAGS"
  219. AC_TRY_RUN([
  220. #include <stdio.h>
  221. #include <$1>
  222. int main(void) {
  223. FILE *fp = fopen("conftestdata","w");
  224. fprintf(fp, "%d", $2);
  225. return 0;
  226. }
  227. ],
  228. [ $4=`cat conftestdata`
  229. AC_MSG_RESULT($$4)],
  230. [ AC_MSG_ERROR([*** Could not determine $3 version.]) ],
  231. [ $4=$6
  232. AC_MSG_RESULT([unknown (cross-compiling)]) ])
  233. CPPFLAGS=$ac_save_cppflags
  234. ])
  235. dnl autoconf undefines "eval", so use "builtin([eval], ...)"
  236. AC_DEFUN([LOC_PAD],[$1[]ifelse(builtin([eval],len($1) > 23),1,[
  237. ],substr([ ],len($1)))])
  238. AC_DEFUN([LOC_ARG_WITH],[
  239. AC_ARG_WITH($1,
  240. LOC_PAD([ --with-$1])[support $2 functionality (default: ]ifelse([$3],,yes,[$3])[)],,
  241. [with_]patsubst([$1], -, _)[=]ifelse([$3],,yes,[$3]))
  242. ])
  243. AC_DEFUN([LOC_ARG_WITH_INC],[
  244. AC_ARG_WITH($1-includes,
  245. LOC_PAD([ --with-$1-includes=DIRS])[$2 include files are in DIRS])
  246. ])
  247. AC_DEFUN([LOC_ARG_WITH_LIB],[
  248. AC_ARG_WITH($1-libs,
  249. LOC_PAD([ --with-$1-libs=DIRS])[$2 library files are in DIRS])
  250. ])
  251. AC_DEFUN([LOC_ARG_WITH_LDFLAGS],[
  252. AC_ARG_WITH($1-ldflags,
  253. LOC_PAD([ --with-$1-ldflags=FLAGS])[$2 needs FLAGS when linking])
  254. ])
  255. AC_DEFUN([LOC_ARG_WITH_SHARE],[
  256. AC_ARG_WITH($1-share,
  257. LOC_PAD([ --with-$1-share=DIR])[$2 data files are in DIR])
  258. ])
  259. AC_DEFUN([LOC_ARG_WITH_FRAMEWORK],[
  260. AC_ARG_WITH($1-framework,
  261. LOC_PAD([ --with-$1-framework=DIR])[$2 framework is in DIR])
  262. ])
  263. AC_DEFUN([LOC_OPTIONAL],[
  264. AC_MSG_CHECKING(whether to build $1)
  265. if test -n "$USE_$2" ; then
  266. AC_MSG_RESULT(yes)
  267. BUILD_$3="$4"
  268. else
  269. AC_MSG_RESULT(no)
  270. BUILD_$3=
  271. fi
  272. AC_SUBST(BUILD_$3)
  273. ])
  274. dnl checks for complete floating-point support (infinity, NaN)
  275. define(LOC_FP_TEST,[
  276. #include <float.h>
  277. int main(void) {
  278. double one = 1.0;
  279. double zero = 0.0;
  280. if (one/zero > DBL_MAX) /* infinity */
  281. if (zero/zero != zero/zero) /* NaN */
  282. return 0;
  283. return 1;
  284. }
  285. ])
  286. AC_DEFUN([LOC_CHECK_FP_INF_NAN],[
  287. AC_MSG_CHECKING([for full floating-point support]$1)
  288. AC_TRY_RUN(LOC_FP_TEST,
  289. [ AC_MSG_RESULT(yes)
  290. $2],
  291. [ AC_MSG_RESULT(no)
  292. $3],
  293. [ AC_MSG_RESULT([unknown (cross-compiling)])
  294. $4]
  295. )
  296. ])
  297. dnl check whether the compiler supports the -mieee switch
  298. AC_DEFUN([LOC_CHECK_CC_MIEEE],[
  299. AC_MSG_CHECKING(whether "cc -mieee" works)
  300. ac_save_cflags=${CFLAGS}
  301. CFLAGS="$CFLAGS -mieee"
  302. AC_TRY_COMPILE(,,
  303. [ AC_MSG_RESULT(yes)
  304. IEEEFLAG="-mieee"],
  305. [ AC_MSG_RESULT(no)])
  306. CFLAGS=${ac_save_cflags}
  307. ])
  308. AC_DEFUN([LOC_MSG],[
  309. echo "$1"
  310. ])
  311. AC_DEFUN([LOC_PAD_26],[substr([ ],len($1))])
  312. AC_DEFUN([LOC_YES_NO],[if test -n "${$1}" ; then echo yes ; else echo no ; fi])
  313. AC_DEFUN([LOC_MSG_USE],[
  314. [echo " $1:]LOC_PAD_26($1)`LOC_YES_NO($2)`"])
  315. AC_DEFUN(LOC_EXEEXT,
  316. [AC_REQUIRE([AC_CYGWIN])
  317. AC_REQUIRE([AC_MINGW32])
  318. AC_MSG_CHECKING([for executable suffix])
  319. AC_CACHE_VAL(ac_cv_exeext,
  320. [if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
  321. ac_cv_exeext=.exe
  322. else
  323. ac_cv_exeext=no
  324. fi])
  325. EXEEXT=""
  326. test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
  327. AC_MSG_RESULT(${ac_cv_exeext})
  328. dnl Setting ac_exeext will implicitly change the ac_link command.
  329. ac_exeext=$EXEEXT
  330. AC_SUBST(EXEEXT)])
  331. #------------------------------------------------------------------------
  332. # SC_ENABLE_SHARED --
  333. #
  334. # Allows the building of shared libraries
  335. #
  336. # Arguments:
  337. # none
  338. #
  339. # Results:
  340. #
  341. # Adds the following arguments to configure:
  342. # --enable-shared=yes|no
  343. #
  344. # Defines the following vars:
  345. # STATIC_BUILD Used for building import/export libraries
  346. # on Windows.
  347. #
  348. # Sets the following vars:
  349. # SHARED_BUILD Value of 1 or 0
  350. #------------------------------------------------------------------------
  351. AC_DEFUN([SC_ENABLE_SHARED], [
  352. AC_MSG_CHECKING([how to build libraries])
  353. AC_ARG_ENABLE(shared,
  354. [ --enable-shared build and link with shared libraries [--enable-shared]],
  355. [shared_ok=$enableval], [shared_ok=yes])
  356. if test "${enable_shared+set}" = set; then
  357. enableval="$enable_shared"
  358. shared_ok=$enableval
  359. else
  360. shared_ok=yes
  361. fi
  362. if test "$shared_ok" = "yes" ; then
  363. AC_MSG_RESULT([shared])
  364. SHARED_BUILD=1
  365. GRASS_LIBRARY_TYPE='shlib'
  366. else
  367. AC_MSG_RESULT([static])
  368. SHARED_BUILD=0
  369. AC_DEFINE(STATIC_BUILD)
  370. GRASS_LIBRARY_TYPE='stlib'
  371. fi
  372. AC_SUBST(GRASS_LIBRARY_TYPE)
  373. ])
  374. #--------------------------------------------------------------------
  375. # SC_CONFIG_CFLAGS
  376. #
  377. # Try to determine the proper flags to pass to the compiler
  378. # for building shared libraries and other such nonsense.
  379. #
  380. # Arguments:
  381. # none
  382. #
  383. # Results:
  384. #
  385. # Defines and substitutes the following vars:
  386. #
  387. # LDFLAGS - Flags to pass to the compiler when linking object
  388. # files into an executable application binary such
  389. # as tclsh.
  390. # LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib",
  391. # that tell the run-time dynamic linker where to look
  392. # for shared libraries such as libtcl.so. Depends on
  393. # the variable LIB_RUNTIME_DIR in the Makefile. Could
  394. # be the same as CC_SEARCH_FLAGS if ${CC} is used to link.
  395. # CC_SEARCH_FLAGS-Flags to pass to ${CC}, such as "-Wl,-rpath,/usr/local/tcl/lib",
  396. # that tell the run-time dynamic linker where to look
  397. # for shared libraries such as libtcl.so. Depends on
  398. # the variable LIB_RUNTIME_DIR in the Makefile.
  399. # STLIB_LD - Base command to use for combining object files
  400. # into a static library.
  401. # SHLIB_CFLAGS - Flags to pass to cc when compiling the components
  402. # of a shared library (may request position-independent
  403. # code, among other things).
  404. # SHLIB_LD - Base command to use for combining object files
  405. # into a shared library.
  406. # SHLIB_LD_FLAGS -Flags to pass when building a shared library. This
  407. # differes from the SHLIB_CFLAGS as it is not used
  408. # when building object files or executables.
  409. # SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
  410. # creating shared libraries. This symbol typically
  411. # goes at the end of the "ld" commands that build
  412. # shared libraries. The value of the symbol is
  413. # "${LIBS}" if all of the dependent libraries should
  414. # be specified when creating a shared library. If
  415. # dependent libraries should not be specified (as on
  416. # SunOS 4.x, where they cause the link to fail, or in
  417. # general if Tcl and Tk aren't themselves shared
  418. # libraries), then this symbol has an empty string
  419. # as its value.
  420. # SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable
  421. # extensions. An empty string means we don't know how
  422. # to use shared libraries on this platform.
  423. #
  424. #--------------------------------------------------------------------
  425. AC_DEFUN([SC_CONFIG_CFLAGS], [
  426. SHLIB_CFLAGS=""
  427. SHLIB_LD_FLAGS=""
  428. SHLIB_LD_LIBS=""
  429. SHLIB_SUFFIX=""
  430. SHLIB_LD=""
  431. STLIB_LD='${AR} cr'
  432. STLIB_SUFFIX='.a'
  433. LDFLAGS=""
  434. CC_SEARCH_FLAGS=""
  435. LD_SEARCH_FLAGS=""
  436. LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
  437. PLAT_OBJS=""
  438. case $host in
  439. *-linux-*)
  440. SHLIB_CFLAGS="-fPIC"
  441. SHLIB_LD_FLAGS=""
  442. SHLIB_LD_LIBS='${LIBS}'
  443. SHLIB_SUFFIX=".so"
  444. SHLIB_LD="${CC} -shared"
  445. LDFLAGS="-Wl,--export-dynamic"
  446. CC_SEARCH_FLAGS='-Wl,-rpath-link,${LIB_RUNTIME_DIR}'
  447. LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  448. LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
  449. ;;
  450. *-pc-cygwin)
  451. SHLIB_LD_LIBS='${LIBS}'
  452. SHLIB_SUFFIX=".dll"
  453. SHLIB_LD="${CC} -shared"
  454. LDFLAGS="-Wl,--export-dynamic"
  455. LD_LIBRARY_PATH_VAR="PATH"
  456. ;;
  457. *-pc-mingw32)
  458. SHLIB_LD_LIBS='${LIBS}'
  459. SHLIB_SUFFIX=".dll"
  460. SHLIB_LD="${CC} -shared"
  461. LDFLAGS="-Wl,--export-dynamic,--enable-runtime-pseudo-reloc"
  462. LD_LIBRARY_PATH_VAR="PATH"
  463. ;;
  464. *-apple-darwin*)
  465. SHLIB_CFLAGS="-fno-common"
  466. SHLIB_LD_LIBS='${LIBS}'
  467. SHLIB_SUFFIX=".dylib"
  468. SHLIB_LD="cc -dynamiclib -compatibility_version \${GRASS_VERSION_MAJOR}.\${GRASS_VERSION_MINOR} -current_version \${GRASS_VERSION_MAJOR}.\${GRASS_VERSION_MINOR} -install_name \${INST_DIR}/lib/lib\${LIB_NAME}\${SHLIB_SUFFIX}"
  469. LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
  470. ;;
  471. *-sun-solaris*)
  472. # Note: If _REENTRANT isn't defined, then Solaris
  473. # won't define thread-safe library routines.
  474. AC_DEFINE(_REENTRANT)
  475. AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
  476. # Note: need the LIBS below, otherwise Tk won't find Tcl's
  477. # symbols when dynamically loaded into tclsh.
  478. if test "$GCC" = "yes" ; then
  479. SHLIB_CFLAGS="-fPIC"
  480. SHLIB_LD="$CC -shared"
  481. CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
  482. else
  483. SHLIB_CFLAGS="-KPIC"
  484. SHLIB_LD="/usr/ccs/bin/ld -G -z text"
  485. CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
  486. fi
  487. SHLIB_SUFFIX=".so"
  488. SHLIB_LD_LIBS='${LIBS}'
  489. LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  490. LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
  491. ;;
  492. *)
  493. AC_MSG_ERROR([***Unknown platform: $host***])
  494. ;;
  495. esac
  496. AC_SUBST(PLAT_OBJS)
  497. AC_SUBST(LDFLAGS)
  498. AC_SUBST(CC_SEARCH_FLAGS)
  499. AC_SUBST(LD_SEARCH_FLAGS)
  500. AC_SUBST(LD_LIBRARY_PATH_VAR)
  501. AC_SUBST(SHLIB_LD)
  502. AC_SUBST(SHLIB_LD_FLAGS)
  503. AC_SUBST(SHLIB_LD_LIBS)
  504. AC_SUBST(SHLIB_CFLAGS)
  505. AC_SUBST(SHLIB_SUFFIX)
  506. AC_SUBST(STLIB_LD)
  507. AC_SUBST(STLIB_SUFFIX)
  508. ])
  509. dnl XXXX Begin Stolen from cdrtools-2.01
  510. dnl XXXX by Joerg Schilling <schilling fokus fraunhofer de> et al. XXXXXXXXX
  511. dnl XXXXXXXXX Begin Stolen (but modified) from GNU tar XXXXXXXXXXXXXXXXXXXXX
  512. dnl Changes:
  513. dnl One line has been changed to: [ac_save_CC="${CC-cc}" to default to "'cc"
  514. dnl AC_SYS_LARGEFILE_MACRO_VALUE test moved from AC_FUNC_FSEEKO into AC_SYS_LARGEFILE
  515. dnl Do not call AC_FUNC_FSEEKO because it does not check whether fseeko() is
  516. dnl available on non Large File mode. There are additionoal tests for fseeko()/ftello()
  517. dnl inside the AC_HAVE_LARGEFILES test.
  518. dnl largefile_cc_opt definition added
  519. #serial 18
  520. dnl By default, many hosts won't let programs access large files;
  521. dnl one must use special compiler options to get large-file access to work.
  522. dnl For more details about this brain damage please see:
  523. dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
  524. dnl Written by Paul Eggert <eggert@twinsun.com>.
  525. dnl Internal subroutine of AC_SYS_LARGEFILE.
  526. dnl AC_SYS_LARGEFILE_TEST_INCLUDES
  527. AC_DEFUN([AC_SYS_LARGEFILE_TEST_INCLUDES],
  528. [[#include <sys/types.h>
  529. /* Check that off_t can represent 2**63 - 1 correctly.
  530. We can't simply "#define LARGE_OFF_T 9223372036854775807",
  531. since some C++ compilers masquerading as C compilers
  532. incorrectly reject 9223372036854775807. */
  533. # define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
  534. int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
  535. && LARGE_OFF_T % 2147483647 == 1)
  536. ? 1 : -1];
  537. ]])
  538. dnl Internal subroutine of AC_SYS_LARGEFILE.
  539. dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR, COMMENT, INCLUDES, FUNCTION-BODY)
  540. AC_DEFUN([AC_SYS_LARGEFILE_MACRO_VALUE],
  541. [AC_CACHE_CHECK([for $1 value needed for large files], $3,
  542. [$3=no
  543. AC_TRY_COMPILE([$5],
  544. [$6],
  545. ,
  546. [AC_TRY_COMPILE([#define $1 $2]
  547. [$5]
  548. ,
  549. [$6],
  550. [$3=$2])])])
  551. if test "[$]$3" != no; then
  552. AC_DEFINE_UNQUOTED([$1], [$]$3, [$4])
  553. fi])
  554. AC_DEFUN([AC_SYS_LARGEFILE],
  555. [AC_ARG_ENABLE(largefile,
  556. [ --enable-largefile enable support for large files (LFS)])
  557. if test "$enable_largefile" = yes; then
  558. AC_CACHE_CHECK([for special C compiler options needed for large files],
  559. ac_cv_sys_largefile_CC,
  560. [ac_cv_sys_largefile_CC=no
  561. largefile_cc_opt=""
  562. if test "$GCC" != yes; then
  563. # IRIX 6.2 and later do not support large files by default,
  564. # so use the C compiler's -n32 option if that helps.
  565. AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES, , ,
  566. [ac_save_CC="${CC-cc}"
  567. CC="$CC -n32"
  568. AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES, ,
  569. ac_cv_sys_largefile_CC=' -n32')
  570. CC="$ac_save_CC"])
  571. fi])
  572. if test "$ac_cv_sys_largefile_CC" != no; then
  573. CC="$CC$ac_cv_sys_largefile_CC"
  574. largefile_cc_opt="$ac_cv_sys_largefile_CC"
  575. fi
  576. AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64,
  577. ac_cv_sys_file_offset_bits,
  578. [Number of bits in a file offset, on hosts where this is settable.],
  579. AC_SYS_LARGEFILE_TEST_INCLUDES)
  580. AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1,
  581. ac_cv_sys_large_files,
  582. [Define for large files, on AIX-style hosts.],
  583. AC_SYS_LARGEFILE_TEST_INCLUDES)
  584. AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, 1,
  585. ac_cv_sys_largefile_source,
  586. [Define to make fseeko visible on some hosts (e.g. glibc 2.2).],
  587. [#include <stdio.h>], [return !fseeko;])
  588. fi
  589. ])
  590. AC_DEFUN([AC_FUNC_FSEEKO],
  591. [AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, 1,
  592. ac_cv_sys_largefile_source,
  593. [Define to make fseeko visible on some hosts (e.g. glibc 2.2).],
  594. [#include <stdio.h>], [return !fseeko;])
  595. # We used to try defining _XOPEN_SOURCE=500 too, to work around a bug
  596. # in glibc 2.1.3, but that breaks too many other things.
  597. # If you want fseeko and ftello with glibc, upgrade to a fixed glibc.
  598. AC_CACHE_CHECK([for fseeko], ac_cv_func_fseeko,
  599. [ac_cv_func_fseeko=no
  600. AC_TRY_LINK([#include <stdio.h>],
  601. [return fseeko && fseeko (stdin, 0, 0);],
  602. [ac_cv_func_fseeko=yes])])
  603. if test $ac_cv_func_fseeko != no; then
  604. AC_DEFINE(HAVE_FSEEKO, 1,
  605. [Define if fseeko (and presumably ftello) exists and is declared.])
  606. fi])
  607. dnl XXXXXXXXXXXXXXXXXX End Stolen (but modified) from GNU tar XXXXXXXXXXXXXX
  608. AC_DEFUN([AC_HAVE_LARGEFILES],
  609. [AC_CACHE_CHECK([if system supports Large Files at all], ac_cv_largefiles,
  610. [AC_TRY_COMPILE([#include <stdio.h>
  611. #include <sys/types.h>],
  612. [
  613. /*
  614. * Check that off_t can represent 2**63 - 1 correctly.
  615. * We can't simply "#define LARGE_OFF_T 9223372036854775807",
  616. * since some C++ compilers masquerading as C compilers
  617. * incorrectly reject 9223372036854775807.
  618. *
  619. * For MinGW, off64_t should be used and __MSVCRT_VERSION__ >= 0x0601
  620. * (msvcrt.dll version 6.10 or higher) is needed for _fstat64 and _stat64.
  621. */
  622. #ifdef __MINGW32__
  623. # define LARGE_OFF_T (((off64_t) 1 << 62) - 1 + ((off64_t) 1 << 62))
  624. #else
  625. # define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
  626. #endif
  627. int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
  628. && LARGE_OFF_T % 2147483647 == 1)
  629. ? 1 : -1];
  630. #ifdef __MINGW32__
  631. return !fseeko64;
  632. return !ftello64;
  633. #else
  634. return !fseeko;
  635. return !ftello;
  636. #endif],
  637. [ac_cv_largefiles=yes],
  638. [ac_cv_largefiles=no])])
  639. if test $ac_cv_largefiles = yes; then
  640. AC_DEFINE(HAVE_LARGEFILES)
  641. fi])
  642. dnl Checks for whether fseeko() is available in non large file mode
  643. dnl and whether there is a prototype for fseeko()
  644. dnl Defines HAVE_FSEEKO on success.
  645. AC_DEFUN([AC_SMALL_FSEEKO],
  646. [AC_CACHE_CHECK([for fseeko()], ac_cv_func_fseeko,
  647. [AC_TRY_LINK([#include <stdio.h>],
  648. [return !fseeko;],
  649. [ac_cv_func_fseeko=yes],
  650. [ac_cv_func_fseeko=no])])
  651. if test $ac_cv_func_fseeko = yes; then
  652. AC_DEFINE(HAVE_FSEEKO)
  653. fi])
  654. dnl Checks for whether ftello() is available in non large file mode
  655. dnl and whether there is a prototype for ftello()
  656. dnl Defines HAVE_FTELLO on success.
  657. AC_DEFUN([AC_SMALL_FTELLO],
  658. [AC_CACHE_CHECK([for ftello()], ac_cv_func_ftello,
  659. [AC_TRY_LINK([#include <stdio.h>],
  660. [return !ftello;],
  661. [ac_cv_func_ftello=yes],
  662. [ac_cv_func_ftello=no])])
  663. if test $ac_cv_func_ftello = yes; then
  664. AC_DEFINE(HAVE_FTELLO)
  665. fi])
  666. dnl XXXXXXXXXXX End Stolen from cdrtools-2.01 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX