configure.in 28 KB

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