configure.in 16 KB

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