configure.in 28 KB

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