configure.in 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755
  1. # -*- Autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. AC_INIT(rAthena)
  4. AC_REVISION($Revision$)
  5. AC_PREREQ([2.59])
  6. AC_CONFIG_SRCDIR([src/common/cbasetypes.h])
  7. AC_CONFIG_FILES([Makefile src/common/Makefile])
  8. AC_CONFIG_FILES([3rdparty/mt19937ar/Makefile])
  9. AC_CONFIG_FILES([src/char/Makefile src/login/Makefile])
  10. AC_CONFIG_FILES([src/map/Makefile src/plugins/Makefile src/tool/Makefile])
  11. #
  12. # Memory managers
  13. #
  14. AC_ARG_ENABLE(
  15. [manager],
  16. AC_HELP_STRING(
  17. [--enable-manager=ARG],
  18. [memory managers: no, builtin, memwatch, dmalloc, gcollect, bcheck (defaults to builtin)]
  19. ),
  20. [
  21. enable_manager="$enableval"
  22. case $enableval in
  23. "no");;
  24. "builtin");;
  25. "memwatch");;
  26. "dmalloc");;
  27. "gcollect");;
  28. "bcheck");;
  29. *) AC_MSG_ERROR([[unknown memory manager '$enableval'... stopping]]);;
  30. esac
  31. ],
  32. [enable_manager="builtin"]
  33. )
  34. #
  35. # packetver
  36. #
  37. AC_ARG_ENABLE(
  38. [packetver],
  39. AC_HELP_STRING(
  40. [--enable-packetver=ARG],
  41. [Sets the PACKETVER define of the map-server. (see src/map/clif.h)]
  42. ),
  43. [enable_packetver="$enableval"],
  44. [enable_packetver=""]
  45. )
  46. #
  47. # debug
  48. #
  49. AC_ARG_ENABLE(
  50. [debug],
  51. AC_HELP_STRING(
  52. [--enable-debug@<:@=ARG@:>@],
  53. [
  54. Compiles extra debug code. (disabled by default)
  55. (available options: yes, no, gdb)
  56. ]
  57. ),
  58. [
  59. enable_debug="$enableval"
  60. case $enableval in
  61. "no");;
  62. "yes");;
  63. "gdb");;
  64. *) AC_MSG_ERROR([[invalid argument --enable-debug=$enableval... stopping]]);;
  65. esac
  66. ],
  67. [enable_debug="no"]
  68. )
  69. #
  70. # Buildbot
  71. #
  72. AC_ARG_ENABLE(
  73. [buildbot],
  74. AC_HELP_STRING(
  75. [--enable-buildbot@<:@=ARG@:>@],
  76. [(available options: yes, no)]
  77. ),
  78. [
  79. enable_buildbot="$enableval"
  80. case $enableval in
  81. "no");;
  82. "yes");;
  83. *) AC_MSG_ERROR([[invalid argument --enable-buildbot=$enableval... stopping]]);;
  84. esac
  85. ],
  86. [enable_buildbot="no"]
  87. )
  88. #
  89. # RDTSC as Tick Source
  90. #
  91. AC_ARG_ENABLE(
  92. [rdtsc],
  93. AC_HELP_STRING(
  94. [--enable-rdtsc],
  95. [
  96. Uses rdtsc as timing source (disabled by default)
  97. Enable it when you've timing issues.
  98. (For example: in conjunction with XEN or Other Virtualization mechanisms)
  99. Note:
  100. Please ensure that you've disabled dynamic CPU-Frequencys, such as power saving options.
  101. (On the most modern Dedicated Servers cpufreq is preconfigured, see your distribution's manual
  102. how to disable it)
  103. ]
  104. ),
  105. [
  106. enable_rdtsc=1
  107. ],
  108. [enable_rdtsc=0]
  109. )
  110. #
  111. # Profiler
  112. #
  113. AC_ARG_ENABLE(
  114. [profiler],
  115. AC_HELP_STRING(
  116. [--enable-profiler=ARG],
  117. [Profilers: no, gprof (disabled by default)]
  118. ),
  119. [
  120. enable_profiler="$enableval"
  121. case $enableval in
  122. "no");;
  123. "gprof");;
  124. *) AC_MSG_ERROR([[invalid argument --enable-profiler=$enableval... stopping]]);;
  125. esac
  126. ],
  127. [enable_profiler="no"]
  128. )
  129. #
  130. # 64bit
  131. #
  132. AC_ARG_ENABLE(
  133. [64bit],
  134. AC_HELP_STRING(
  135. [--enable-64bit],
  136. [
  137. Don't force 32 bit. (disabled by default)
  138. 64bit support is still being tested, not recommended for production servers.
  139. ]
  140. ),
  141. [
  142. enable_64bit="$enableval"
  143. case $enableval in
  144. "no");;
  145. "yes");;
  146. *) AC_MSG_ERROR([[invalid argument --enable-64bit=$enableval... stopping]]);;
  147. esac
  148. ],
  149. [enable_64bit="no"]
  150. )
  151. #
  152. # Optionally specify the path to mysql_config
  153. #
  154. AC_ARG_WITH(
  155. [mysql],
  156. AC_HELP_STRING(
  157. [--with-mysql@<:@=ARG@:>@],
  158. [optionally specify the path to the mysql_config executable]
  159. ),
  160. [
  161. if test "$withval" != "no" ; then
  162. if test ! -x "$withval" ; then
  163. AC_MSG_ERROR([$withval is not an executable file])
  164. fi
  165. MYSQL_CONFIG_HOME="$withval"
  166. fi
  167. ]
  168. )
  169. #
  170. # Manual MYSQL_CFLAGS (optional)
  171. #
  172. AC_ARG_WITH(
  173. [MYSQL_CFLAGS],
  174. AC_HELP_STRING(
  175. [--with-MYSQL_CFLAGS=ARG],
  176. [specify MYSQL_CFLAGS manually (instead of using "mysql_config --include")]
  177. ),
  178. [
  179. manual_MYSQL_CFLAGS="yes"
  180. MYSQL_CFLAGS="$withval"
  181. ],
  182. [manual_MYSQL_CFLAGS="no"]
  183. )
  184. #
  185. # Manual MYSQL_LIBS (optional)
  186. #
  187. AC_ARG_WITH(
  188. [MYSQL_LIBS],
  189. AC_HELP_STRING(
  190. [--with-MYSQL_LIBS=ARG],
  191. [specify MYSQL_LIBS manually (instead of using "mysql_config --libs")]
  192. ),
  193. [
  194. manual_MYSQL_LIBS="yes"
  195. MYSQL_LIBS="$withval"
  196. ],
  197. [manual_MYSQL_LIBS="no"]
  198. )
  199. #
  200. # Enable/disable PCRE and optionally specify the path (optional library)
  201. #
  202. AC_ARG_WITH(
  203. [pcre],
  204. AC_HELP_STRING(
  205. [--with-pcre@<:@=ARG@:>@],
  206. [use PCRE library, optionally specify the full path of pcre installation directory (by default pcre is used if found)]
  207. ),
  208. [
  209. if test "$withval" = "no" ; then
  210. want_pcre="no"
  211. else
  212. want_pcre="yes"
  213. require_pcre="yes"
  214. if test "$withval" != "yes" ; then
  215. if test ! -d "$withval" ; then
  216. AC_MSG_ERROR([$withval is not a directoy])
  217. fi
  218. PCRE_HOME="$withval"
  219. fi
  220. fi
  221. ],
  222. [want_pcre="yes" require_pcre="no"]
  223. )
  224. #
  225. # Specify the path of the zlib library (required library)
  226. #
  227. AC_ARG_WITH(
  228. [zlib],
  229. AC_HELP_STRING(
  230. [--with-zlib=DIR],
  231. [root directory path of zlib installation (defaults to /usr/local or /usr if not found in /usr/local).
  232. Assumes that the header files are in DIR/include and the library files are in DIR/lib]
  233. ),
  234. [
  235. test -n "$withval" && ZLIB_HOME="$withval"
  236. ],
  237. [
  238. ZLIB_HOME=/usr/local
  239. test ! -f "${ZLIB_HOME}/include/zlib.h" && ZLIB_HOME=/usr
  240. ]
  241. )
  242. ###############################################################################
  243. # Check for programs and types.
  244. #
  245. AC_PROG_MAKE_SET
  246. AC_PROG_CC
  247. AC_PROG_CPP
  248. AC_LANG([C])
  249. CFLAGS="$CFLAGS -pipe -ffast-math -Wall -Wno-sign-compare"
  250. CPPFLAGS="$CPPFLAGS -I../common"
  251. AC_C_BIGENDIAN(
  252. [AC_MSG_ERROR([[bigendian is not supported... stopping]])],
  253. ,
  254. [AC_MSG_WARN([[unable to determine endianess, only little endian is supported]])]
  255. )
  256. if test "$enable_64bit" = "no" ; then
  257. AC_MSG_CHECKING([whether pointers can be stored in ints (old code)])
  258. pointers_fit_in_ints="no"
  259. AC_COMPILE_IFELSE(
  260. [AC_LANG_PROGRAM([[static int test_array[((long int)sizeof(int)) == ((long int)sizeof(void*)) ? 1 : -1];]])],
  261. [pointers_fit_in_ints="yes"],
  262. []
  263. )
  264. if test "$pointers_fit_in_ints" = "no" ; then
  265. CFLAGS="$CFLAGS -m32"
  266. LDFLAGS="$LDFLAGS -m32"
  267. AC_COMPILE_IFELSE(
  268. [AC_LANG_PROGRAM([[static int test_array[((long int)sizeof(int)) == ((long int)sizeof(void *)) ? 1 : -1];]])],
  269. [pointers_fit_in_ints="yes (with -m32)"],
  270. []
  271. )
  272. fi
  273. AC_MSG_RESULT($pointers_fit_in_ints)
  274. if test "$pointers_fit_in_ints" = "no" ; then
  275. AC_MSG_ERROR([pointers cannot be stored in ints, required for old code... stopping])
  276. fi
  277. fi
  278. AC_MSG_CHECKING([whether $CC supports -Wno-unused-parameter])
  279. OLD_CFLAGS="$CFLAGS"
  280. CFLAGS="$CFLAGS -Wno-unused-parameter"
  281. AC_COMPILE_IFELSE(
  282. [int foo;],
  283. [AC_MSG_RESULT([yes])],
  284. [
  285. AC_MSG_RESULT([no])
  286. CFLAGS="$OLD_CFLAGS"
  287. ]
  288. )
  289. AC_MSG_CHECKING([whether $CC supports -Wno-pointer-sign])
  290. OLD_CFLAGS="$CFLAGS"
  291. CFLAGS="$CFLAGS -Wno-pointer-sign"
  292. AC_COMPILE_IFELSE(
  293. [int foo;],
  294. [
  295. AC_MSG_RESULT([yes])
  296. AC_MSG_CHECKING([whether $CC can actually use -Wno-pointer-sign])
  297. # This option causes warnings in C++ mode
  298. # Note: -Werror must be before -Wno-pointer-sign, otherwise it does not do anything
  299. CFLAGS="$OLD_CFLAGS -Werror -Wno-pointer-sign"
  300. AC_COMPILE_IFELSE(
  301. [int foo;],
  302. [
  303. AC_MSG_RESULT([yes])
  304. CFLAGS="$OLD_CFLAGS -Wno-pointer-sign"
  305. ],
  306. [
  307. AC_MSG_RESULT([no])
  308. CFLAGS="$OLD_CFLAGS"
  309. ]
  310. )
  311. ],
  312. [
  313. AC_MSG_RESULT([no])
  314. CFLAGS="$OLD_CFLAGS"
  315. ]
  316. )
  317. AC_MSG_CHECKING([whether $CC supports -Wno-switch])
  318. OLD_CFLAGS="$CFLAGS"
  319. CFLAGS="$CFLAGS -Wno-switch"
  320. AC_COMPILE_IFELSE(
  321. [int foo;],
  322. [AC_MSG_RESULT([yes])],
  323. [
  324. AC_MSG_RESULT([no])
  325. CFLAGS="$OLD_CFLAGS"
  326. ]
  327. )
  328. AC_MSG_CHECKING([whether $CC supports -fPIC])
  329. OLD_CFLAGS="$CFLAGS"
  330. CFLAGS="$CFLAGS -fPIC"
  331. AC_COMPILE_IFELSE(
  332. [int foo;],
  333. [
  334. AC_MSG_RESULT([yes])
  335. compiler_supports_pic="yes"
  336. ],
  337. [
  338. AC_MSG_RESULT([no])
  339. compiler_supports_pic="no"
  340. ]
  341. )
  342. CFLAGS="$OLD_CFLAGS"
  343. #
  344. # -shared needs position independent code; some platforms emit it
  345. # always, others need -fPIC
  346. #
  347. AC_MSG_CHECKING([whether $CC needs -fPIC for shared objects])
  348. OLD_CFLAGS="$CFLAGS"
  349. CFLAGS="$CFLAGS -shared"
  350. WITH_PLUGINS="yes"
  351. AC_LINK_IFELSE(
  352. [
  353. int foo(void)
  354. {
  355. return 0;
  356. }
  357. ],
  358. [
  359. AC_MSG_RESULT([no])
  360. CFLAGS="$OLD_CFLAGS"
  361. ],
  362. [
  363. if test "$compiler_supports_pic" = "yes" ; then
  364. # Verify if -shared really fails due to lack of -fPIC or something else
  365. CFLAGS="$CFLAGS -fPIC"
  366. AC_LINK_IFELSE(
  367. [
  368. int foo(void)
  369. {
  370. return 0;
  371. }
  372. ],
  373. [
  374. AC_MSG_RESULT([yes])
  375. CFLAGS="$OLD_CFLAGS -fPIC"
  376. ],
  377. [
  378. AC_MSG_RESULT([no, but fails for another reason])
  379. AC_MSG_ERROR([compiler is unable to compile shared objects for an unhandled reason, please report this with attached config.log... stopping])
  380. ]
  381. )
  382. else
  383. # Disable compilation of plugins (optional), so 'make all' does not fail
  384. AC_MSG_RESULT([yes, but unsupported])
  385. AC_MSG_NOTICE([compiler is unable to generate position independent code, disabled plugins (optional)])
  386. WITH_PLUGINS="no"
  387. fi
  388. ]
  389. )
  390. AC_SUBST([WITH_PLUGINS])
  391. #
  392. # -O2 implies -fstrict-aliasing, but the code is not safe for that
  393. #
  394. AC_MSG_CHECKING([whether $CC supports -fno-strict-aliasing])
  395. OLD_CFLAGS="$CFLAGS"
  396. CFLAGS="$CFLAGS -fno-strict-aliasing"
  397. AC_COMPILE_IFELSE(
  398. [int foo;],
  399. [AC_MSG_RESULT([yes])],
  400. [
  401. AC_MSG_RESULT([no])
  402. CFLAGS="$OLD_CFLAGS"
  403. ]
  404. )
  405. ###############################################################################
  406. # Check for libraries and header files.
  407. #
  408. #
  409. # setrlimit - used to set the socket limit
  410. #
  411. AC_CHECK_FUNC([setrlimit],[CFLAGS="$CFLAGS -DHAVE_SETRLIMIT"])
  412. #
  413. # strnlen - string length with upper scan bound
  414. #
  415. AC_CHECK_FUNC([strnlen],[CFLAGS="$CFLAGS -DHAVE_STRNLEN"])
  416. #
  417. # Memory manager
  418. #
  419. case $enable_manager in
  420. "no")
  421. CFLAGS="$CFLAGS -DNO_MEMMGR"
  422. ;;
  423. "builtin")
  424. # enabled by default
  425. ;;
  426. "memwatch")
  427. CFLAGS="$CFLAGS -DMEMWATCH"
  428. AC_CHECK_HEADER([memwatch.h], , [AC_MSG_ERROR([memwatch header not found... stopping])])
  429. ;;
  430. "dmalloc")
  431. CFLAGS="$CFLAGS -DDMALLOC -DDMALLOC_FUNC_CHECK"
  432. LIBS="$LIBS -ldmalloc"
  433. AC_CHECK_HEADER([dmalloc.h], , [AC_MSG_ERROR([dmalloc header not found... stopping])])
  434. ;;
  435. "gcollect")
  436. CFLAGS="$CFLAGS -DGCOLLECT"
  437. LIBS="$LIBS -lgc"
  438. AC_CHECK_HEADER([gc.h], , [AC_MSG_ERROR([gcollect header not found... stopping])])
  439. ;;
  440. "bcheck")
  441. CFLAGS="$CFLAGS -DBCHECK"
  442. ;;
  443. esac
  444. #
  445. # Packetver
  446. #
  447. if test -n "$enable_packetver" ; then
  448. CFLAGS="$CFLAGS -DPACKETVER=$enable_packetver"
  449. fi
  450. #
  451. # Debug
  452. #
  453. case $enable_debug in
  454. "no")
  455. # default value
  456. CFLAGS="$CFLAGS -Wno-unused -Wno-parentheses"
  457. ;;
  458. "yes")
  459. CFLAGS="$CFLAGS -g -DDEBUG"
  460. ;;
  461. "gdb")
  462. CFLAGS="$CFLAGS -ggdb -DDEBUG"
  463. ;;
  464. esac
  465. #
  466. # Buildbot
  467. #
  468. case $enable_buildbot in
  469. "no")
  470. # default value
  471. ;;
  472. "yes")
  473. CFLAGS="$CFLAGS -DBUILDBOT"
  474. ;;
  475. esac
  476. #
  477. # RDTSC
  478. #
  479. case $enable_rdtsc in
  480. 0)
  481. #default value
  482. ;;
  483. 1)
  484. CFLAGS="$CFLAGS -DENABLE_RDTSC"
  485. ;;
  486. esac
  487. #
  488. # Profiler
  489. #
  490. case $enable_profiler in
  491. "no")
  492. # default value
  493. ;;
  494. "gprof")
  495. CFLAGS="$CFLAGS -pg"
  496. LDFLAGS="$LDFLAGS -pg"
  497. ;;
  498. esac
  499. #
  500. # zlib library (required)
  501. #
  502. if test -n "${ZLIB_HOME}" ; then
  503. LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib"
  504. CPPFLAGS="$CPPFLAGS -I${ZLIB_HOME}/include"
  505. fi
  506. AC_CHECK_LIB([z], [inflateEnd], [],[AC_MSG_ERROR([zlib library not found or incompatible, please specify the correct path with --with-zlib=DIR... stopping])])
  507. AC_CHECK_HEADER([zlib.h], [], [AC_MSG_ERROR([zlib header not found, please specify the correct path with --with-zlib=DIR... stopping])])
  508. #
  509. # math library (required)
  510. #
  511. AC_SEARCH_LIBS([sqrt], [m], [], [AC_MSG_ERROR([math library not found... stopping])])
  512. #
  513. # clock_gettime (optional, rt on Debian)
  514. #
  515. AC_SEARCH_LIBS([clock_gettime], [rt])
  516. #
  517. # CLOCK_MONOTONIC clock for clock_gettime
  518. # Normally defines _POSIX_TIMERS > 0 and _POSIX_MONOTONIC_CLOCK (for posix
  519. # compliant systems) and __FreeBSD_cc_version >= 500005 (for FreeBSD
  520. # >= 5.1.0, which does not have the posix defines (ref. r11983)) would be
  521. # checked but some systems define them even when they do not support it
  522. # (ref. bugreport:1003).
  523. #
  524. if test "$ac_cv_search_clock_gettime" != "no" ; then
  525. AC_MSG_CHECKING([whether CLOCK_MONOTONIC is supported and works])
  526. AC_RUN_IFELSE(
  527. [
  528. #include <sys/time.h>
  529. #include <time.h>
  530. #include <unistd.h>
  531. int main(int argc, char** argv)
  532. {
  533. struct timespec tval;
  534. return clock_gettime(CLOCK_MONOTONIC, &tval);
  535. }
  536. ],
  537. [
  538. AC_MSG_RESULT([yes])
  539. CFLAGS="$CFLAGS -DHAVE_MONOTONIC_CLOCK"
  540. ],
  541. [
  542. # either it failed to compile (CLOCK_MONOTONIC undefined)
  543. # or clock_gettime has returned a non-zero value
  544. AC_MSG_RESULT([no])
  545. ],
  546. [
  547. AC_MSG_RESULT([guessing no])
  548. ]
  549. )
  550. fi
  551. #
  552. # MySQL library
  553. #
  554. if test -z "$MYSQL_CONFIG_HOME"; then
  555. AC_PATH_PROG([MYSQL_CONFIG_HOME], [mysql_config], [no])
  556. fi
  557. if test "$MYSQL_CONFIG_HOME" != "no" ; then
  558. MYSQL_VERSION="`$MYSQL_CONFIG_HOME --version`"
  559. if test "$manual_MYSQL_CFLAGS" = "no" ; then
  560. MYSQL_CFLAGS="`$MYSQL_CONFIG_HOME --include`"
  561. fi
  562. if test "$manual_MYSQL_LIBS" = "no" ; then
  563. MYSQL_LIBS="`$MYSQL_CONFIG_HOME --libs`"
  564. fi
  565. else
  566. MYSQL_VERSION="unknown"
  567. fi
  568. MYSQL_OLD_LDFLAGS="$LDFLAGS" ; LDFLAGS="$LDFLAGS $MYSQL_LIBS"
  569. MYSQL_OLD_CPPFLAGS="$CPPFLAGS" ; CPPFLAGS="$CPPFLAGS $MYSQL_CFLAGS"
  570. AC_CHECK_LIB([mysqlclient], [mysql_init], [HAVE_MYSQL="yes"], [])
  571. AC_CHECK_HEADER([mysql.h], [], [HAVE_MYSQL=""])
  572. CPPFLAGS="$MYSQL_OLD_CPPFLAGS"
  573. LDFLAGS="$MYSQL_OLD_LDFLAGS"
  574. AC_MSG_CHECKING([MySQL library (required)])
  575. if test "$HAVE_MYSQL" = "yes" ; then
  576. AC_MSG_RESULT([yes ($MYSQL_VERSION)])
  577. else
  578. AC_MSG_RESULT([no])
  579. AC_MSG_ERROR([MySQL not found or incompatible])
  580. fi
  581. AC_SUBST([HAVE_MYSQL])
  582. AC_SUBST([MYSQL_VERSION])
  583. AC_SUBST([MYSQL_CFLAGS])
  584. AC_SUBST([MYSQL_LIBS])
  585. #
  586. # PCRE library (optional)
  587. #
  588. ##TODO PCRE version
  589. PCRE_LIBS=""
  590. PCRE_CFLAGS=""
  591. if test "$want_pcre" = "no" ; then
  592. AC_MSG_NOTICE([ignoring PCRE (optional)])
  593. else
  594. if test -z "$PCRE_HOME" ; then
  595. AC_CHECK_LIB([pcre], [pcre_study], [HAVE_PCRE="yes"], [])
  596. if test "$HAVE_PCRE" = "yes" ; then
  597. PCRE_LIBS="-lpcre"
  598. fi
  599. else
  600. PCRE_OLD_LDFLAGS="$LDFLAGS" ; LDFLAGS="$LDFLAGS -L$PCRE_HOME/lib"
  601. PCRE_OLD_CPPFLAGS="$CPPFLAGS" ; CPPFLAGS="$CPPFLAGS -I$PCRE_HOME/include"
  602. AC_CHECK_LIB(pcre, pcre_compile, [HAVE_PCRE="yes"], [])
  603. CPPFLAGS="$PCRE_OLD_CPPFLAGS"
  604. LDFLAGS="$PCRE_OLD_LDFLAGS"
  605. if test "$HAVE_PCRE" = "yes" ; then
  606. PCRE_LIBS="-L$PCRE_HOME/lib -lpcre"
  607. test -d "$PCRE_HOME/include" && PCRE_CFLAGS="-I$PCRE_HOME/include"
  608. fi
  609. fi
  610. AC_MSG_CHECKING([PCRE library (optional)])
  611. if test "$HAVE_PCRE" = "yes" ; then
  612. AC_MSG_RESULT([yes])
  613. else
  614. AC_MSG_RESULT([no])
  615. if test "$require_pcre" = "yes" ; then
  616. AC_MSG_ERROR([PCRE not found or incompatible (requested)])
  617. else
  618. AC_MSG_NOTICE([disabling PCRE (optional)])
  619. fi
  620. fi
  621. fi
  622. AC_SUBST([HAVE_PCRE])
  623. AC_SUBST([PCRE_LIBS])
  624. AC_SUBST([PCRE_CFLAGS])
  625. #
  626. # Host specific stuff
  627. #
  628. AC_MSG_CHECKING([host OS])
  629. host_os="`uname`"
  630. AC_MSG_RESULT([$host_os])
  631. fd_setsize=""
  632. DLLEXT=".so"
  633. case $host_os in
  634. Solaris* )
  635. LIBS="$LIBS -lsocket -lnsl -ldl"
  636. ;;
  637. Linux* )
  638. LIBS="$LIBS -ldl"
  639. ;;
  640. FreeBSD*)
  641. CPPFLAGS="$CPPFLAGS -D__FREEBSD__"
  642. ;;
  643. NetBSD*)
  644. CPPFLAGS="$CPPFLAGS -D__NETBSD__"
  645. ;;
  646. CYGWIN*)
  647. CPPFLAGS="$CPPFLAGS -DFD_SETSIZE=4096 -DCYGWIN"
  648. fd_setsize="done"
  649. DLLEXT=".dll"
  650. ;;
  651. esac
  652. AC_SUBST([DLLEXT])
  653. AC_MSG_CHECKING([for MinGW])
  654. if test -n "`$CC --version | grep -i mingw`" ; then
  655. AC_MSG_RESULT([yes])
  656. CPPFLAGS="$CPPFLAGS -DMINGW"
  657. if test -z "$fd_setsize" ; then
  658. CPPFLAGS="$CPPFLAGS -DFD_SETSIZE=4096"
  659. fi
  660. LIBS="$LIBS -lws2_32"
  661. else
  662. AC_MSG_RESULT([no])
  663. fi
  664. ###############################################################################
  665. AC_OUTPUT