configure.ac 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374
  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_LANG([C++])
  7. AC_LANG_COMPILER_REQUIRE
  8. AC_CONFIG_SRCDIR([src/common/cbasetypes.hpp])
  9. AC_CONFIG_FILES([Makefile src/common/Makefile])
  10. AC_CONFIG_FILES([3rdparty/libconfig/Makefile 3rdparty/yaml-cpp/Makefile 3rdparty/rapidyaml/Makefile 3rdparty/httplib/Makefile])
  11. AC_CONFIG_FILES([src/char/Makefile src/login/Makefile])
  12. AC_CONFIG_FILES([src/map/Makefile src/tool/Makefile])
  13. AC_CONFIG_FILES([src/web/Makefile])
  14. AC_GNU_SOURCE
  15. #
  16. # Memory managers
  17. #
  18. AC_ARG_ENABLE(
  19. [manager],
  20. AC_HELP_STRING(
  21. [--enable-manager=ARG],
  22. [memory managers: no, builtin, memwatch, dmalloc, gcollect, bcheck (defaults to builtin)]
  23. ),
  24. [
  25. enable_manager="$enableval"
  26. case $enableval in
  27. "no");;
  28. "builtin");;
  29. "memwatch");;
  30. "dmalloc");;
  31. "gcollect");;
  32. "bcheck");;
  33. *) AC_MSG_ERROR([[unknown memory manager '$enableval'... stopping]]);;
  34. esac
  35. ],
  36. [enable_manager="builtin"]
  37. )
  38. #
  39. # packetver
  40. #
  41. AC_ARG_ENABLE(
  42. [packetver],
  43. AC_HELP_STRING(
  44. [--enable-packetver=ARG],
  45. [Sets the PACKETVER define. (see src/common/mmo.hpp)]
  46. ),
  47. [enable_packetver="$enableval"],
  48. [enable_packetver=""]
  49. )
  50. #
  51. # Epoll
  52. #
  53. AC_ARG_ENABLE(
  54. [epoll],
  55. AC_HELP_STRING(
  56. [--enable-epoll],
  57. [use epoll(4) on Linux]
  58. ),
  59. [enable_epoll=$enableval],
  60. [enable_epoll=no]
  61. )
  62. if test x$enable_epoll = xno; then
  63. have_linux_epoll=no
  64. else
  65. AC_MSG_CHECKING([for Linux epoll(4)])
  66. AC_LINK_IFELSE([AC_LANG_PROGRAM(
  67. [
  68. #ifndef __linux__
  69. #error This is not Linux
  70. #endif
  71. #include <sys/epoll.h>
  72. ],
  73. [epoll_create1 (EPOLL_CLOEXEC);])],
  74. [have_linux_epoll=yes],
  75. [have_linux_epoll=no]
  76. )
  77. AC_MSG_RESULT([$have_linux_epoll])
  78. fi
  79. if test x$enable_epoll,$have_linux_epoll = xyes,no; then
  80. AC_MSG_ERROR([epoll support explicitly enabled but not available])
  81. fi
  82. #
  83. # debug
  84. #
  85. AC_ARG_ENABLE(
  86. [debug],
  87. AC_HELP_STRING(
  88. [--enable-debug@<:@=ARG@:>@],
  89. [
  90. Compiles extra debug code. (disabled by default)
  91. (available options: yes, no, gdb)
  92. ]
  93. ),
  94. [
  95. enable_debug="$enableval"
  96. case $enableval in
  97. "no");;
  98. "yes");;
  99. "gdb");;
  100. *) AC_MSG_ERROR([[invalid argument --enable-debug=$enableval... stopping]]);;
  101. esac
  102. ],
  103. [enable_debug="no"]
  104. )
  105. #
  106. # renewal
  107. #
  108. AC_ARG_ENABLE(
  109. [prere],
  110. AC_HELP_STRING(
  111. [--enable-prere@<:@=ARG@:>@],
  112. [
  113. Compiles serv in prere mode. (disabled by default)
  114. (available options: yes, no)
  115. ]
  116. ),
  117. [
  118. enable_prere="$enableval"
  119. case $enableval in
  120. "no");;
  121. "yes");;
  122. *) AC_MSG_ERROR([[invalid argument --enable-prere=$enableval... stopping]]);;
  123. esac
  124. ],
  125. [enable_prere="no"]
  126. )
  127. #
  128. # VIP
  129. #
  130. AC_ARG_ENABLE(
  131. [vip],
  132. AC_HELP_STRING(
  133. [--enable-vip@<:@=ARG@:>@],
  134. [
  135. Compiles serv with vip features. (disabled by default)
  136. (available options: yes, no)
  137. ]
  138. ),
  139. [
  140. enable_vip="$enableval"
  141. case $enableval in
  142. "no");;
  143. "yes");;
  144. *) AC_MSG_ERROR([[invalid argument --enable-vip=$enableval... stopping]]);;
  145. esac
  146. ],
  147. [enable_vip="no"]
  148. )
  149. #
  150. # warn
  151. #
  152. AC_ARG_ENABLE(
  153. [warn],
  154. AC_HELP_STRING(
  155. [--enable-warn@<:@=ARG@:>@],
  156. [
  157. Compiles with warnings. (disabled by default)
  158. (available options: yes, no, extra)
  159. ]
  160. ),
  161. [
  162. enable_warn="$enableval"
  163. case $enableval in
  164. "no");;
  165. "yes");;
  166. "extra");;
  167. *) AC_MSG_ERROR([[invalid argument --enable-warn=$enableval... stopping]]);;
  168. esac
  169. ],
  170. [enable_warn="no"]
  171. )
  172. #
  173. # Buildbot
  174. #
  175. AC_ARG_ENABLE(
  176. [buildbot],
  177. AC_HELP_STRING(
  178. [--enable-buildbot@<:@=ARG@:>@],
  179. [(available options: yes, no)]
  180. ),
  181. [
  182. enable_buildbot="$enableval"
  183. case $enableval in
  184. "no");;
  185. "yes");;
  186. *) AC_MSG_ERROR([[invalid argument --enable-buildbot=$enableval... stopping]]);;
  187. esac
  188. ],
  189. [enable_buildbot="no"]
  190. )
  191. #
  192. # RDTSC as Tick Source
  193. #
  194. AC_ARG_ENABLE(
  195. [rdtsc],
  196. AC_HELP_STRING(
  197. [--enable-rdtsc],
  198. [
  199. Uses rdtsc as timing source (disabled by default)
  200. Enable it when you've timing issues.
  201. (For example: in conjunction with XEN or Other Virtualization mechanisms)
  202. Note:
  203. Please ensure that you've disabled dynamic CPU-Frequencys, such as power saving options.
  204. (On the most modern Dedicated Servers cpufreq is preconfigured, see your distribution's manual
  205. how to disable it)
  206. ]
  207. ),
  208. [
  209. enable_rdtsc=1
  210. ],
  211. [enable_rdtsc=0]
  212. )
  213. #
  214. # Profiler
  215. #
  216. AC_ARG_ENABLE(
  217. [profiler],
  218. AC_HELP_STRING(
  219. [--enable-profiler=ARG],
  220. [Profilers: no, gprof (disabled by default)]
  221. ),
  222. [
  223. enable_profiler="$enableval"
  224. case $enableval in
  225. "no");;
  226. "gprof");;
  227. *) AC_MSG_ERROR([[invalid argument --enable-profiler=$enableval... stopping]]);;
  228. esac
  229. ],
  230. [enable_profiler="no"]
  231. )
  232. #
  233. # 64bit
  234. #
  235. AC_ARG_ENABLE(
  236. [64bit],
  237. AC_HELP_STRING(
  238. [--disable-64bit],
  239. [
  240. Enforce 32bit output on x86_64 systems.
  241. ]
  242. ),
  243. [
  244. enable_64bit="$enableval"
  245. case $enableval in
  246. "no");;
  247. "yes");;
  248. *) AC_MSG_ERROR([[invalid argument --enable-64bit=$enableval... stopping]]);;
  249. esac
  250. ],
  251. [enable_64bit="yes"]
  252. )
  253. #
  254. # LTO
  255. #
  256. AC_ARG_ENABLE(
  257. [lto],
  258. AC_HELP_STRING(
  259. [--enable-lto],
  260. [
  261. Enables or Disables Linktime Code Optimization (LTO is enabled by default)
  262. ]
  263. ),
  264. [
  265. enable_lto="$enableval"
  266. case $enableval in
  267. "no");;
  268. "yes");;
  269. *) AC_MSG_ERROR([[invalid argument --enable-lto=$disableval... stopping]]);;
  270. esac
  271. ],
  272. [enable_lto="no"]
  273. )
  274. #
  275. # Optionally set the maximum number of network connections
  276. # the core will be able to handle
  277. #
  278. AC_ARG_WITH(
  279. [maxconn],
  280. AC_HELP_STRING(
  281. [--with-maxconn@<:@=ARG@:>@],
  282. [optionally set the maximum connections the core can handle. By default the system header value will be used.
  283. This will only be the compile time limit, make sure you set the correct limit with ulimit on your OS.]
  284. ),
  285. [
  286. if ! test "$withval" -ge 0 -o "$withval" -lt 0 2>&- ; then
  287. AC_MSG_ERROR([Invalid argument --with-maxconn=$withval ... stopping])
  288. else
  289. CPPFLAGS="$CPPFLAGS -DMAXCONN=$withval"
  290. fi
  291. ],
  292. [
  293. CPPFLAGS="$CPPFLAGS"
  294. ]
  295. )
  296. #
  297. # output bin name
  298. #
  299. AC_ARG_WITH(
  300. [outputlogin],
  301. AC_HELP_STRING(
  302. [--with-outputlogin@<:@=ARG@:>@],
  303. [Specify the login-serv output name (defaults to login-server)]
  304. ),
  305. [output_login="$withval"],
  306. [output_login="login-server"]
  307. )
  308. AC_SUBST([OLOG],$output_login)
  309. AC_ARG_WITH(
  310. [outputchar],
  311. AC_HELP_STRING(
  312. [--with-outputchar@<:@=ARG@:>@],
  313. [Specify the char-serv output name (defaults to char-server)]
  314. ),
  315. [output_char="$withval"],
  316. [output_char="char-server"]
  317. )
  318. AC_SUBST([OCHR],$output_char)
  319. AC_ARG_WITH(
  320. [outputmap],
  321. AC_HELP_STRING(
  322. [--with-outputmap@<:@=ARG@:>@],
  323. [Specify the map-serv output name (defaults to map-server)]
  324. ),
  325. [output_map="$withval"],
  326. [output_map="map-server"]
  327. )
  328. AC_SUBST([OMAP],$output_map)
  329. AC_ARG_WITH(
  330. [outputweb],
  331. AC_HELP_STRING(
  332. [--with-outputweb@<:@=ARG@:>@],
  333. [Specify the web-serv output name (defaults to web-server)]
  334. ),
  335. [output_web="$withval"],
  336. [output_web="web-server"]
  337. )
  338. AC_SUBST([OWEB],$output_web)
  339. #
  340. # Optionally specify the path to mysql_config
  341. #
  342. AC_ARG_WITH(
  343. [mysql],
  344. AC_HELP_STRING(
  345. [--with-mysql@<:@=ARG@:>@],
  346. [optionally specify the path to the mysql_config executable]
  347. ),
  348. [
  349. if test "$withval" != "no" ; then
  350. if test ! -x "$withval" ; then
  351. AC_MSG_ERROR([$withval is not an executable file])
  352. fi
  353. MYSQL_CONFIG_HOME="$withval"
  354. fi
  355. ]
  356. )
  357. #
  358. # Manual MYSQL_CFLAGS (optional)
  359. #
  360. AC_ARG_WITH(
  361. [MYSQL_CFLAGS],
  362. AC_HELP_STRING(
  363. [--with-MYSQL_CFLAGS=ARG],
  364. [specify MYSQL_CFLAGS manually (instead of using "mysql_config --include")]
  365. ),
  366. [
  367. manual_MYSQL_CFLAGS="yes"
  368. MYSQL_CFLAGS="$withval"
  369. ],
  370. [manual_MYSQL_CFLAGS="no"]
  371. )
  372. #
  373. # Manual MYSQL_LIBS (optional)
  374. #
  375. AC_ARG_WITH(
  376. [MYSQL_LIBS],
  377. AC_HELP_STRING(
  378. [--with-MYSQL_LIBS=ARG],
  379. [specify MYSQL_LIBS manually (instead of using "mysql_config --libs")]
  380. ),
  381. [
  382. manual_MYSQL_LIBS="yes"
  383. MYSQL_LIBS="$withval"
  384. ],
  385. [manual_MYSQL_LIBS="no"]
  386. )
  387. #
  388. # Enable/disable PCRE and optionally specify the path (optional library)
  389. #
  390. AC_ARG_WITH(
  391. [pcre],
  392. AC_HELP_STRING(
  393. [--with-pcre@<:@=ARG@:>@],
  394. [use PCRE library, optionally specify the full path of pcre installation directory (by default pcre is used if found)]
  395. ),
  396. [
  397. if test "$withval" = "no" ; then
  398. want_pcre="no"
  399. else
  400. want_pcre="yes"
  401. require_pcre="yes"
  402. if test "$withval" != "yes" ; then
  403. if test ! -d "$withval" ; then
  404. AC_MSG_ERROR([$withval is not a directoy])
  405. fi
  406. PCRE_HOME="$withval"
  407. fi
  408. fi
  409. ],
  410. [want_pcre="yes" require_pcre="no"]
  411. )
  412. #
  413. # Specify the path of the zlib library (required library)
  414. #
  415. AC_ARG_WITH(
  416. [zlib],
  417. AC_HELP_STRING(
  418. [--with-zlib=DIR],
  419. [root directory path of zlib installation (defaults to /usr/local or /usr if not found in /usr/local).
  420. Assumes that the header files are in DIR/include and the library files are in DIR/lib]
  421. ),
  422. [
  423. test -n "$withval" && ZLIB_HOME="$withval"
  424. ],
  425. [
  426. ZLIB_HOME=/usr/local
  427. test ! -f "${ZLIB_HOME}/include/zlib.h" && ZLIB_HOME=/usr
  428. ]
  429. )
  430. ###############################################################################
  431. # Check for programs and types.
  432. #
  433. AC_PROG_MAKE_SET
  434. AC_PROG_CC
  435. AC_PROG_CXX
  436. AC_PATH_PROG(AR, ar)
  437. AC_LANG([C++])
  438. CFLAGS="$CFLAGS -pipe -ffast-math -Wall"
  439. CPPFLAGS="$CPPFLAGS -I../common"
  440. CXXFLAGS="$CXXFLAGS -std=c++14"
  441. #CXXFLAGS="$CXXFLAGS -std=gnu++14"
  442. CXXFLAG_CLEARS="-std=c++14"
  443. AC_C_BIGENDIAN(
  444. [AC_MSG_ERROR([[bigendian is not supported... stopping]])],
  445. ,
  446. [AC_MSG_WARN([[unable to determine endianess, only little endian is supported]])]
  447. )
  448. if test "$enable_64bit" = "no" ; then
  449. AC_MSG_CHECKING([whether pointers can be stored in ints (old code)])
  450. pointers_fit_in_ints="no"
  451. AC_COMPILE_IFELSE(
  452. [AC_LANG_PROGRAM([[static int test_array[((long int)sizeof(int)) == ((long int)sizeof(void*)) ? 1 : -1];]])],
  453. [pointers_fit_in_ints="yes"],
  454. []
  455. )
  456. if test "$pointers_fit_in_ints" = "no" ; then
  457. CFLAGS="$CFLAGS -m32"
  458. LDFLAGS="$LDFLAGS -m32"
  459. AC_COMPILE_IFELSE(
  460. [AC_LANG_PROGRAM([[static int test_array[((long int)sizeof(int)) == ((long int)sizeof(void *)) ? 1 : -1];]])],
  461. [pointers_fit_in_ints="yes (with -m32)"],
  462. []
  463. )
  464. fi
  465. AC_MSG_RESULT($pointers_fit_in_ints)
  466. if test "$pointers_fit_in_ints" = "no" ; then
  467. AC_MSG_ERROR([pointers cannot be stored in ints, required for old code... stopping])
  468. fi
  469. fi
  470. #
  471. # check if we're producing 32bit code - so well produce binarys for at least i686 (speedup: cmovs, and cmpchg8 support)
  472. #
  473. AC_MSG_CHECKING([whether $CC produces 32bit code])
  474. AC_RUN_IFELSE(
  475. [AC_LANG_SOURCE([
  476. int main(int argc, char **argv){
  477. if(sizeof(void*) == 4) return 0;
  478. else return 1;
  479. }
  480. ])],
  481. [
  482. AC_MSG_RESULT([yes])
  483. AC_MSG_CHECKING([whether $CC supports -march=i686 (and we can run it)])
  484. OLD_CFLAGS="$CFLAGS"
  485. OLD_LDFLAGS="$LDFLAGS"
  486. CFLAGS="$CFLAGS -march=i686"
  487. LDFLAGS="$LDFLAGS -march=i686"
  488. AC_RUN_IFELSE(
  489. [AC_LANG_SOURCE([
  490. int main(int argc, char **argv) { return 0; }
  491. ])],
  492. [
  493. AC_MSG_RESULT([yes])
  494. ],
  495. [
  496. AC_MSG_RESULT([no])
  497. CFLAGS="$OLD_CFLAGS"
  498. LDFLAGS="$OLD_LDFLAGS"
  499. ],
  500. [
  501. AC_MSG_RESULT([guessing no])
  502. CFLAGS="$OLD_CFLAGS"
  503. LDFLAGS="$OLD_LDFLAGS"
  504. ]
  505. )
  506. ],
  507. [
  508. AC_MSG_RESULT([no])
  509. ],
  510. [
  511. AC_MSG_RESULT([guessing no])
  512. ]
  513. )
  514. #
  515. # Check if CC supports __thread attribute (Thread Local Storage)
  516. # (Usually our OSX friends 're lacking support of it in older llvm versions ..)
  517. #
  518. AC_MSG_CHECKING([whether $CC supports __thread specifier (TLS)])
  519. AC_RUN_IFELSE(
  520. [AC_LANG_SOURCE([
  521. __thread int g_Test = -1;
  522. int main(int argc, char **argv){
  523. g_Test = 0;
  524. return g_Test;
  525. }
  526. ])],
  527. [
  528. AC_MSG_RESULT([yes])
  529. CPPFLAGS="$CPPFLAGS -DHAS_TLS"
  530. ],
  531. [
  532. AC_MSG_RESULT([no])
  533. ]
  534. )
  535. #
  536. # LTO Support test
  537. #
  538. if test "$enable_lto" != "no" ; then
  539. OPT_LTO_AR=""
  540. OPT_LTO=""
  541. OLD_CFLAGS="$CFLAGS"
  542. CFLAGS="$CFLAGS -flto -fuse-linker-plugin -ffat-lto-objects"
  543. OLD_LDFLAGS="$LDFLAGS"
  544. LDFLAGS="$LDFLAGS -flto -fuse-linker-plugin -ffat-lto-objects"
  545. AC_MSG_CHECKING([whether $CC supports -ffat-lto-objects])
  546. AC_RUN_IFELSE(
  547. [AC_LANG_SOURCE([
  548. int main(int argc, char **argv){
  549. return 0;
  550. }
  551. ])],
  552. [
  553. AC_MSG_RESULT([yes])
  554. OPT_LTO_AR="-ffat-lto-objects"
  555. ],
  556. [
  557. AC_MSG_RESULT([no])
  558. ],
  559. [
  560. AC_MSG_RESULT([guessing no])
  561. ]
  562. )
  563. CFLAGS="$OLD_CFLAGS"
  564. LDFLAGS="$OLD_LDFLAGS"
  565. CFLAGS="$CFLAGS -flto -fuse-linker-plugin"
  566. LDFLAGS="$LDFLAGS -flto -fuse-linker-plugin"
  567. AC_MSG_CHECKING([whether $CC supports -flto -fuse-linker-plugin])
  568. AC_RUN_IFELSE(
  569. [AC_LANG_SOURCE([
  570. int main(int argc, char **argv){
  571. return 0;
  572. }
  573. ])],
  574. [
  575. AC_MSG_RESULT([yes])
  576. OPT_LTO_AR="-flto -fuse-linker-plugin $OPT_LTO_AR"
  577. OPT_LTO="-flto -fuse-linker-plugin"
  578. ],
  579. [
  580. AC_MSG_RESULT([no])
  581. ],
  582. [
  583. AC_MSG_RESULT([guessing no])
  584. ]
  585. )
  586. CFLAGS="$OLD_CFLAGS"
  587. LDFLAGS="$OLD_LDFLAGS"
  588. fi
  589. AC_DEFUN([AC_CHECK_COMPILER_WFLAG],
  590. [
  591. AC_MSG_CHECKING([whether $CC supports -W$1])
  592. OLD_CFLAGS="$CFLAGS"
  593. CFLAGS="$CFLAGS -Werror -W$1"
  594. AC_COMPILE_IFELSE(
  595. [AC_LANG_SOURCE([int foo;])],
  596. [
  597. AC_MSG_RESULT([yes])
  598. CFLAGS="$OLD_CFLAGS -W$1"
  599. # Optionally, run a test
  600. if test "x$2" != "x"; then
  601. AC_MSG_CHECKING([whether $CC can actually use -W$1])
  602. CFLAGS="$OLD_CFLAGS -Werror -W$1"
  603. AC_COMPILE_IFELSE(
  604. [AC_LANG_SOURCE([$2])],
  605. [
  606. AC_MSG_RESULT([no])
  607. CFLAGS="$OLD_CFLAGS"
  608. ]
  609. [
  610. AC_MSG_RESULT([yes])
  611. CFLAGS="$OLD_CFLAGS -W$1"
  612. ],
  613. )
  614. fi
  615. ],
  616. [
  617. AC_MSG_RESULT([no])
  618. CFLAGS="$OLD_CFLAGS"
  619. ]
  620. )
  621. ]
  622. )
  623. AC_DEFUN([AC_CHECK_COMPILER_WNOFLAG],
  624. [
  625. AC_MSG_CHECKING([whether $CC supports -Wno-$1])
  626. OLD_CFLAGS="$CFLAGS"
  627. CFLAGS="$CFLAGS -Werror -Wno-$1"
  628. AC_COMPILE_IFELSE(
  629. [AC_LANG_SOURCE([int foo;])],
  630. [
  631. # Recent versions of gcc don't fail if -Wno-foo is not recognized
  632. # (unless there are also other warnings), so we also check for -Wfoo
  633. # which always fails if not supported
  634. CFLAGS="$OLD_CFLAGS -Werror -W$1"
  635. AC_COMPILE_IFELSE(
  636. [AC_LANG_SOURCE([int foo;])],
  637. [
  638. AC_MSG_RESULT([yes])
  639. CFLAGS="$OLD_CFLAGS -Wno-$1"
  640. # Optionally, run a test
  641. if test "x$2" != "x"; then
  642. AC_MSG_CHECKING([whether $CC can actually use -Wno-$1])
  643. CFLAGS="$OLD_CFLAGS -Werror -W$1"
  644. AC_COMPILE_IFELSE(
  645. [AC_LANG_SOURCE([$2])],
  646. [
  647. AC_MSG_RESULT([not needed but enabled])
  648. CFLAGS="$OLD_CFLAGS"
  649. ],
  650. [
  651. CFLAGS="$OLD_CFLAGS -Werror -Wno-$1"
  652. AC_COMPILE_IFELSE(
  653. [AC_LANG_SOURCE([$2])],
  654. [
  655. AC_MSG_RESULT([yes])
  656. CFLAGS="$OLD_CFLAGS -Wno-$1"
  657. ],
  658. [
  659. AC_MSG_RESULT([no])
  660. CFLAGS="$OLD_CFLAGS"
  661. ]
  662. )
  663. ]
  664. )
  665. fi
  666. ],
  667. [
  668. AC_MSG_RESULT([no])
  669. CFLAGS="$OLD_CFLAGS"
  670. ]
  671. )
  672. ],
  673. [
  674. AC_MSG_RESULT([no])
  675. CFLAGS="$OLD_CFLAGS"
  676. ]
  677. )
  678. ]
  679. )
  680. AC_CHECK_COMPILER_WNOFLAG(unused-parameter, [int foo(int bar) { return 0; }])
  681. AC_CHECK_COMPILER_WFLAG(empty-body)
  682. AC_CHECK_COMPILER_WNOFLAG(switch)
  683. AC_CHECK_COMPILER_WNOFLAG(missing-field-initializers)
  684. AC_MSG_CHECKING([whether compiler is clang])
  685. if test -n "`$CC --version | grep -i clang`" ; then
  686. AC_MSG_RESULT([yes, skipping some flags..])
  687. else
  688. AC_MSG_RESULT([no])
  689. AC_CHECK_COMPILER_WNOFLAG(maybe-uninitialized)
  690. AC_CHECK_COMPILER_WNOFLAG(clobbered)
  691. fi
  692. # Certain versions of gcc make -Wshadow completely useless by making it flood
  693. # you with unnecessary warnings <https://lkml.org/lkml/2006/11/28/239>
  694. # Let's check if we can really use it
  695. SAVED_OLD_CFLAGS="$CFLAGS"
  696. AC_CHECK_COMPILER_WFLAG(shadow)
  697. if test "x$CFLAGS" != "x$SAVED_OLD_CFLAGS"; then
  698. AC_MSG_CHECKING([whether $CC can efficiently use -Wshadow])
  699. NEW_CFLAGS="$CFLAGS"
  700. CFLAGS="$CFLAGS -Werror -Wshadow"
  701. AC_COMPILE_IFELSE(
  702. [AC_LANG_SOURCE([
  703. int foo(void) {
  704. return 0;
  705. }
  706. int bar(void) {
  707. int foo = 0;
  708. return foo + 1;
  709. }
  710. ])],
  711. [
  712. AC_MSG_RESULT([yes])
  713. CFLAGS="$NEW_CFLAGS"
  714. ],
  715. [
  716. AC_MSG_RESULT([no])
  717. CFLAGS="$SAVED_OLD_CFLAGS"
  718. ]
  719. )
  720. fi
  721. AC_MSG_CHECKING([whether $CC supports -fPIC])
  722. OLD_CFLAGS="$CFLAGS"
  723. CFLAGS="$CFLAGS -fPIC"
  724. AC_COMPILE_IFELSE(
  725. [AC_LANG_SOURCE([int foo;])],
  726. [
  727. AC_MSG_RESULT([yes])
  728. compiler_supports_pic="yes"
  729. ],
  730. [
  731. AC_MSG_RESULT([no])
  732. compiler_supports_pic="no"
  733. ]
  734. )
  735. CFLAGS="$OLD_CFLAGS"
  736. #
  737. # option for shared objects
  738. #
  739. AC_MSG_CHECKING([how to make shared objects])
  740. OLD_CFLAGS="$CFLAGS"
  741. compiler_shared_objects=""
  742. compiler_supports_shared_objects="no"
  743. if test "$compiler_supports_pic" = "yes" ; then
  744. my_shared_test_flags="$CFLAGS -fPIC"
  745. fi
  746. # default
  747. CFLAGS="$my_shared_test_flags -shared"
  748. AC_LINK_IFELSE(
  749. [AC_LANG_SOURCE([
  750. int bar = 0;
  751. int foo(void)
  752. {
  753. return bar;
  754. }
  755. ])],
  756. [
  757. compiler_shared_objects="-shared"
  758. compiler_supports_shared_objects="yes"
  759. ]
  760. )
  761. # BeOS specific
  762. CFLAGS="$my_shared_test_flags -nostart"
  763. AC_LINK_IFELSE(
  764. [AC_LANG_SOURCE([
  765. int bar = 0;
  766. int foo(void)
  767. {
  768. return bar;
  769. }
  770. ])],
  771. [
  772. compiler_shared_objects="-nostart"
  773. compiler_supports_shared_objects="yes"
  774. ]
  775. )
  776. CFLAGS="$OLD_CFLAGS"
  777. if test "$compiler_supports_shared_objects" = "no" ; then
  778. AC_MSG_RESULT([not supported])
  779. AC_MSG_NOTICE([compiler is unable to generate shared objects, disabled plugins (optional)])
  780. WITH_PLUGINS="no"
  781. else
  782. AC_MSG_RESULT([$compiler_shared_objects $compiler_supports_shared_objects])
  783. SOFLAGS="$SOFLAGS $compiler_shared_objects"
  784. AC_SUBST([SOFLAGS])
  785. #
  786. # On certain platforms, undefined references on shared libraries won't be checked
  787. # unless explicitly required with the --no-undefined linker option
  788. #
  789. AC_MSG_CHECKING([whether $CC needs -Wl,--no-undefined to check for undefined references in shared objects])
  790. OLD_CFLAGS="$CFLAGS"
  791. CFLAGS="$SOFLAGS"
  792. AC_LINK_IFELSE(
  793. [AC_LANG_SOURCE([
  794. void foo(void) {
  795. foobar();
  796. }
  797. ])],
  798. [
  799. CFLAGS="$SOFLAGS -Wl,--no-undefined"
  800. AC_LINK_IFELSE(
  801. [AC_LANG_SOURCE([
  802. int bar = 0;
  803. int foo(void) {
  804. return bar;
  805. }
  806. ])],
  807. [
  808. AC_MSG_RESULT([yes])
  809. SOFLAGS="$SOFLAGS -Wl,--no-undefined"
  810. ],
  811. [
  812. AC_MSG_RESULT([unsupported (undefined references check will be ignored)])
  813. ]
  814. )
  815. ],
  816. [
  817. AC_MSG_RESULT([no])
  818. ]
  819. )
  820. CFLAGS="$OLD_CFLAGS"
  821. #
  822. # shared objects need position independent code; some platforms emit
  823. # it always, others need -fPIC
  824. #
  825. AC_MSG_CHECKING([whether $CC needs -fPIC for shared objects])
  826. OLD_CFLAGS="$CFLAGS"
  827. CFLAGS="$CFLAGS $SOFLAGS"
  828. WITH_PLUGINS="yes"
  829. AC_LINK_IFELSE(
  830. [AC_LANG_SOURCE([
  831. int bar = 0;
  832. int foo(void)
  833. {
  834. return bar;
  835. }
  836. ])],
  837. [
  838. AC_MSG_RESULT([no])
  839. CFLAGS="$OLD_CFLAGS"
  840. ],
  841. [
  842. if test "$compiler_supports_pic" = "yes" ; then
  843. # Verify if -shared really fails due to lack of -fPIC or something else
  844. CFLAGS="$CFLAGS -fPIC"
  845. AC_LINK_IFELSE(
  846. [AC_LANG_SOURCE([
  847. int bar = 0;
  848. int foo(void)
  849. {
  850. return bar;
  851. }
  852. ])],
  853. [
  854. AC_MSG_RESULT([yes])
  855. CFLAGS="$OLD_CFLAGS -fPIC"
  856. ],
  857. [
  858. AC_MSG_RESULT([no, but fails for another reason])
  859. AC_MSG_ERROR([compiler is unable to compile shared objects for an unhandled reason, please report this with attached config.log... stopping])
  860. ]
  861. )
  862. else
  863. # Disable compilation of plugins (optional), so 'make all' does not fail
  864. AC_MSG_RESULT([yes, but unsupported])
  865. AC_MSG_NOTICE([compiler is unable to generate position independent code, disabled plugins (optional)])
  866. WITH_PLUGINS="no"
  867. fi
  868. ]
  869. )
  870. fi
  871. my_shared_test_flags=""
  872. AC_SUBST([WITH_PLUGINS])
  873. #
  874. # -O2 implies -fstrict-aliasing, but the code is not safe for that
  875. #
  876. AC_MSG_CHECKING([whether $CC supports -fno-strict-aliasing])
  877. OLD_CPPFLAGS="$CPPFLAGS"
  878. CPPFLAGS="$CPPFLAGS -fno-strict-aliasing"
  879. AC_COMPILE_IFELSE(
  880. [AC_LANG_SOURCE([int foo;])],
  881. [AC_MSG_RESULT([yes])],
  882. [
  883. AC_MSG_RESULT([no])
  884. CPPFLAGS="$OLD_CPPFLAGS"
  885. ]
  886. )
  887. ###############################################################################
  888. # Check for libraries and header files.
  889. #
  890. #
  891. # setrlimit - used to set the socket limit
  892. #
  893. AC_CHECK_FUNC([setrlimit],[CPPFLAGS="$CPPFLAGS -DHAVE_SETRLIMIT"])
  894. #
  895. # strnlen - string length with upper scan bound
  896. #
  897. AC_CHECK_FUNC([strnlen],[CPPFLAGS="$CPPFLAGS -DHAVE_STRNLEN"])
  898. # libconfig
  899. AC_CHECK_FUNCS([uselocale])
  900. AC_CHECK_FUNCS([newlocale])
  901. AC_CHECK_FUNCS([freelocale])
  902. AC_CHECK_HEADERS([xlocale.h], [], [], [
  903. AC_LANG_SOURCE([#ifdef HAVE_XLOCALE_H
  904. # include <xlocale.h>
  905. #endif
  906. ])])
  907. #
  908. # Memory manager
  909. #
  910. case $enable_manager in
  911. "no")
  912. CPPFLAGS="$CPPFLAGS -DNO_MEMMGR"
  913. ;;
  914. "builtin")
  915. # enabled by default
  916. ;;
  917. "memwatch")
  918. CPPFLAGS="$CPPFLAGS -DMEMWATCH"
  919. AC_CHECK_HEADER([memwatch.h], , [AC_MSG_ERROR([memwatch header not found... stopping])])
  920. ;;
  921. "dmalloc")
  922. CPPFLAGS="$CPPFLAGS -DDMALLOC -DDMALLOC_FUNC_CHECK"
  923. LIBS="$LIBS -ldmalloc"
  924. AC_CHECK_HEADER([dmalloc.h], , [AC_MSG_ERROR([dmalloc header not found... stopping])])
  925. ;;
  926. "gcollect")
  927. CPPFLAGS="$CPPFLAGS -DGCOLLECT"
  928. LIBS="$LIBS -lgc"
  929. AC_CHECK_HEADER([gc.h], , [AC_MSG_ERROR([gcollect header not found... stopping])])
  930. ;;
  931. "bcheck")
  932. CPPFLAGS="$CPPFLAGS -DBCHECK"
  933. ;;
  934. esac
  935. #
  936. # Packetver
  937. #
  938. if test -n "$enable_packetver" ; then
  939. CPPFLAGS="$CPPFLAGS -DPACKETVER=$enable_packetver"
  940. fi
  941. #
  942. # Epoll
  943. #
  944. case $have_linux_epoll in
  945. "yes")
  946. CPPFLAGS="$CPPFLAGS -DSOCKET_EPOLL"
  947. ;;
  948. "no")
  949. # default value
  950. ;;
  951. esac
  952. #
  953. # Debug
  954. #
  955. case $enable_debug in
  956. "no")
  957. # default value
  958. CPPFLAGS="$CPPFLAGS"
  959. ;;
  960. "yes")
  961. if test $ac_cv_prog_cc_g = yes; then
  962. CPPFLAGS="$CPPFLAGS -g -DDEBUG"
  963. LDFLAGS="$LDFLAGS -g"
  964. else
  965. echo "error: --enable-debug flag=$enable_debug entered but the compiler does not support -g"
  966. exit 1
  967. fi
  968. ;;
  969. "gdb")
  970. if test $ac_cv_prog_cc_g = yes; then
  971. CPPFLAGS="$CPPFLAGS -ggdb -DDEBUG"
  972. LDFLAGS="$LDFLAGS -g"
  973. else
  974. echo "error: --enable-debug flag=$enable_debug entered but the compiler does not support -g"
  975. exit 1
  976. fi
  977. ;;
  978. esac
  979. #
  980. # Renewal
  981. #
  982. case $enable_prere in
  983. "no")
  984. # default value
  985. CPPFLAGS="$CPPFLAGS"
  986. ;;
  987. "yes")
  988. CPPFLAGS="$CPPFLAGS -DPRERE"
  989. ;;
  990. esac
  991. #
  992. # VIP
  993. #
  994. case $enable_vip in
  995. "no")
  996. # default value
  997. CPPFLAGS="$CPPFLAGS"
  998. ;;
  999. "yes")
  1000. CPPFLAGS="$CPPFLAGS -DVIP_ENABLE"
  1001. ;;
  1002. esac
  1003. #
  1004. # Warnings
  1005. #
  1006. case $enable_warn in
  1007. "no") #default
  1008. CPPFLAGS="$CPPFLAGS $PROD_WARN"
  1009. ;;
  1010. "yes")
  1011. CPPFLAGS="$CPPFLAGS"
  1012. ;;
  1013. "extra")
  1014. CPPFLAGS="$CPPFLAGS $EXTRA_WARN"
  1015. ;;
  1016. esac
  1017. #
  1018. # Buildbot
  1019. #
  1020. case $enable_buildbot in
  1021. "no")
  1022. # default value
  1023. ;;
  1024. "yes")
  1025. CPPFLAGS="$CPPFLAGS -DBUILDBOT"
  1026. ;;
  1027. esac
  1028. #
  1029. # RDTSC
  1030. #
  1031. case $enable_rdtsc in
  1032. 0)
  1033. #default value
  1034. ;;
  1035. 1)
  1036. CPPFLAGS="$CPPFLAGS -DENABLE_RDTSC"
  1037. ;;
  1038. esac
  1039. #
  1040. # Profiler
  1041. #
  1042. case $enable_profiler in
  1043. "no")
  1044. # default value
  1045. ;;
  1046. "gprof")
  1047. CFLAGS="$CFLAGS -pg"
  1048. LDFLAGS="$LDFLAGS -pg"
  1049. ;;
  1050. esac
  1051. #
  1052. # zlib library (required)
  1053. #
  1054. if test -n "${ZLIB_HOME}" ; then
  1055. LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib"
  1056. CPPFLAGS="$CPPFLAGS -I${ZLIB_HOME}/include"
  1057. fi
  1058. AC_SEARCH_LIBS([inflateEnd], [z], [],[AC_MSG_ERROR([zlib library not found or incompatible, please specify the correct path with --with-zlib=DIR... stopping])])
  1059. AC_CHECK_HEADER([zlib.h], [], [AC_MSG_ERROR([zlib header not found, please specify the correct path with --with-zlib=DIR... stopping])],
  1060. [AC_LANG_SOURCE([#ifdef HAVE_ZLIB_H
  1061. # include <zlib.h>
  1062. #endif
  1063. ])])
  1064. #
  1065. # math library (required)
  1066. #
  1067. AC_SEARCH_LIBS([sqrt], [m], [], [AC_MSG_ERROR([math library not found... stopping])])
  1068. #
  1069. # clock_gettime (optional, rt on Debian)
  1070. #
  1071. AC_SEARCH_LIBS([clock_gettime], [rt])
  1072. #
  1073. # CLOCK_MONOTONIC clock for clock_gettime
  1074. # Normally defines _POSIX_TIMERS > 0 and _POSIX_MONOTONIC_CLOCK (for posix
  1075. # compliant systems) and __FreeBSD_cc_version >= 500005 (for FreeBSD
  1076. # >= 5.1.0, which does not have the posix defines (ref. r11983)) would be
  1077. # checked but some systems define them even when they do not support it
  1078. # (ref. bugreport:1003).
  1079. #
  1080. if test "$ac_cv_search_clock_gettime" != "no" ; then
  1081. AC_MSG_CHECKING([whether CLOCK_MONOTONIC is supported and works])
  1082. AC_RUN_IFELSE(
  1083. [AC_LANG_SOURCE([
  1084. #include <sys/time.h>
  1085. #include <time.h>
  1086. #include <unistd.h>
  1087. int main(int argc, char** argv)
  1088. {
  1089. struct timespec tval;
  1090. return clock_gettime(CLOCK_MONOTONIC, &tval);
  1091. }
  1092. ])],
  1093. [
  1094. AC_MSG_RESULT([yes])
  1095. CPPFLAGS="$CPPFLAGS -DHAVE_MONOTONIC_CLOCK"
  1096. ],
  1097. [
  1098. # either it failed to compile (CLOCK_MONOTONIC undefined)
  1099. # or clock_gettime has returned a non-zero value
  1100. AC_MSG_RESULT([no])
  1101. ],
  1102. [
  1103. AC_MSG_RESULT([guessing no])
  1104. ]
  1105. )
  1106. fi
  1107. #
  1108. # pthread
  1109. #
  1110. AC_SEARCH_LIBS([pthread_create], [pthread], [], [AC_MSG_ERROR([pthread library not found or incompatible])])
  1111. AC_SEARCH_LIBS([pthread_sigmask], [pthread], [], [AC_MSG_ERROR([pthread library not found or incompatible])])
  1112. AC_SEARCH_LIBS([pthread_attr_init], [pthread], [], [AC_MSG_ERROR([pthread library not found or incompatible])])
  1113. AC_SEARCH_LIBS([pthread_attr_setstacksize], [pthread], [], [AC_MSG_ERROR([pthread library not found or incompatible])])
  1114. AC_SEARCH_LIBS([pthread_attr_destroy], [pthread], [], [AC_MSG_ERROR([pthread library not found or incompatible])])
  1115. AC_SEARCH_LIBS([pthread_cancel], [pthread], [], [AC_MSG_ERROR([pthread library not found or incompatible])])
  1116. AC_SEARCH_LIBS([pthread_join], [pthread], [], [AC_MSG_ERROR([pthread library not found or incompatible])])
  1117. #
  1118. # MySQL library
  1119. #
  1120. if test -z "$MYSQL_CONFIG_HOME"; then
  1121. AC_PATH_PROG([MYSQL_CONFIG_HOME], [mysql_config], [no])
  1122. fi
  1123. if test "$MYSQL_CONFIG_HOME" != "no" ; then
  1124. MYSQL_VERSION="`$MYSQL_CONFIG_HOME --version`"
  1125. if test "$manual_MYSQL_CFLAGS" = "no" ; then
  1126. MYSQL_CFLAGS="`$MYSQL_CONFIG_HOME --include`"
  1127. fi
  1128. if test "$manual_MYSQL_LIBS" = "no" ; then
  1129. MYSQL_LIBS="`$MYSQL_CONFIG_HOME --libs`"
  1130. fi
  1131. else
  1132. MYSQL_VERSION="unknown"
  1133. fi
  1134. MYSQL_OLD_LDFLAGS="$LDFLAGS" ; LDFLAGS="$LDFLAGS $MYSQL_LIBS"
  1135. MYSQL_OLD_CPPFLAGS="$CPPFLAGS" ; CPPFLAGS="$CPPFLAGS $MYSQL_CFLAGS"
  1136. AC_CHECK_LIB([mysqlclient], [mysql_init], [HAVE_MYSQL="yes"], [])
  1137. AC_CHECK_HEADER([mysql.h], [], [HAVE_MYSQL=""])
  1138. CPPFLAGS="$MYSQL_OLD_CPPFLAGS"
  1139. LDFLAGS="$MYSQL_OLD_LDFLAGS"
  1140. AC_MSG_CHECKING([MySQL library (required)])
  1141. if test "$HAVE_MYSQL" = "yes" ; then
  1142. AC_MSG_RESULT([yes ($MYSQL_VERSION)])
  1143. else
  1144. AC_MSG_RESULT([no])
  1145. AC_MSG_ERROR([MySQL not found or incompatible])
  1146. fi
  1147. AC_SUBST([HAVE_MYSQL])
  1148. AC_SUBST([MYSQL_VERSION])
  1149. AC_SUBST([MYSQL_CFLAGS])
  1150. AC_SUBST([MYSQL_LIBS])
  1151. #
  1152. # PCRE library (optional)
  1153. #
  1154. PCRE_LIBS=""
  1155. PCRE_CFLAGS=""
  1156. if test "$want_pcre" = "no" ; then
  1157. AC_MSG_NOTICE([ignoring PCRE (optional)])
  1158. else
  1159. host_os="`uname`"
  1160. if test "$host_os" = "FreeBSD" ; then
  1161. if test -z "$PCRE_HOME" ; then PCRE_HOME="/usr/local"; fi
  1162. fi
  1163. if test -z "$PCRE_HOME" ; then
  1164. AC_SEARCH_LIBS([pcre_study], [pcre], [HAVE_PCRE="yes"], [])
  1165. if test "$HAVE_PCRE" = "yes" ; then
  1166. PCRE_LIBS="-lpcre"
  1167. fi
  1168. else
  1169. PCRE_OLD_LDFLAGS="$LDFLAGS" ; LDFLAGS="$LDFLAGS -L$PCRE_HOME/lib"
  1170. PCRE_OLD_CPPFLAGS="$CPPFLAGS" ; CPPFLAGS="$CPPFLAGS -I$PCRE_HOME/include"
  1171. AC_CHECK_LIB(pcre, pcre_compile, [HAVE_PCRE="yes"], [])
  1172. CPPFLAGS="$PCRE_OLD_CPPFLAGS"
  1173. LDFLAGS="$PCRE_OLD_LDFLAGS"
  1174. if test "$HAVE_PCRE" = "yes" ; then
  1175. PCRE_LIBS="-L$PCRE_HOME/lib -lpcre"
  1176. test -d "$PCRE_HOME/include" && PCRE_CFLAGS="-I$PCRE_HOME/include"
  1177. fi
  1178. fi
  1179. AC_MSG_CHECKING([PCRE library (optional)])
  1180. if test "$HAVE_PCRE" = "yes" ; then
  1181. PCRE_VERSION="`pcre-config --version`"
  1182. AC_MSG_RESULT([yes ($PCRE_VERSION)])
  1183. else
  1184. AC_MSG_RESULT([no])
  1185. if test "$require_pcre" = "yes" ; then
  1186. AC_MSG_ERROR([PCRE not found or incompatible (requested)])
  1187. else
  1188. AC_MSG_NOTICE([disabling PCRE (optional)])
  1189. fi
  1190. fi
  1191. fi
  1192. AC_SUBST([HAVE_PCRE])
  1193. AC_SUBST([PCRE_VERSION])
  1194. AC_SUBST([PCRE_LIBS])
  1195. AC_SUBST([PCRE_CFLAGS])
  1196. #
  1197. # Host specific stuff
  1198. #
  1199. AC_MSG_CHECKING([host OS])
  1200. host_os="`uname`"
  1201. AC_MSG_RESULT([$host_os])
  1202. fd_setsize=""
  1203. DLLEXT=".so"
  1204. case $host_os in
  1205. Solaris* )
  1206. LIBS="$LIBS -lsocket -lnsl -ldl"
  1207. ;;
  1208. Linux* )
  1209. LIBS="$LIBS -ldl"
  1210. ;;
  1211. FreeBSD*)
  1212. CPPFLAGS="$CPPFLAGS -D__FREEBSD__"
  1213. ;;
  1214. NetBSD*)
  1215. CPPFLAGS="$CPPFLAGS -D__NETBSD__"
  1216. ;;
  1217. CYGWIN*)
  1218. CPPFLAGS="$CPPFLAGS -DFD_SETSIZE=4096 -DCYGWIN"
  1219. fd_setsize="done"
  1220. DLLEXT=".dll"
  1221. ;;
  1222. esac
  1223. AC_SUBST([DLLEXT])
  1224. AC_MSG_CHECKING([for MinGW])
  1225. if test -n "`$CC --version | grep -i mingw`" ; then
  1226. AC_MSG_RESULT([yes])
  1227. CPPFLAGS="$CPPFLAGS -DMINGW"
  1228. if test -z "$fd_setsize" ; then
  1229. CPPFLAGS="$CPPFLAGS -DFD_SETSIZE=4096"
  1230. fi
  1231. LIBS="$LIBS -lws2_32"
  1232. else
  1233. AC_MSG_RESULT([no])
  1234. fi
  1235. CXXFLAG_CLEARS="-std=c++14 $CPPFLAGS"
  1236. CFLAGS="$OPT_LTO $CFLAGS"
  1237. CFLAGS_AR="$OPT_LTO_AR $CFLAGS"
  1238. AC_SUBST([CFLAGS_AR])
  1239. AC_SUBST([CXXFLAG_CLEARS])
  1240. AC_MSG_NOTICE([Configure finish])
  1241. AC_MSG_NOTICE([CPPFLAGS= $CPPFLAGS])
  1242. AC_MSG_NOTICE([CFLAGS= $CFLAGS])
  1243. AC_MSG_NOTICE([CFLAGS_AR= $CFLAGS_AR])
  1244. AC_MSG_NOTICE([LDFLAGS= $LDFLAGS])
  1245. #AC_MSG_NOTICE([PROD_WARN= $PROD_WARN])
  1246. #AC_MSG_NOTICE([EXTRA_WARN= $EXTRA_WARN])
  1247. AC_MSG_NOTICE([output name = $output_login, $output_char, $output_map, $output_web])
  1248. ###############################################################################
  1249. AC_OUTPUT