configure.ng 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729
  1. #
  2. # ngIRCd -- The Next Generation IRC Daemon
  3. # Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors
  4. #
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2 of the License, or
  8. # (at your option) any later version.
  9. # Please read the file COPYING, README and AUTHORS for more information.
  10. #
  11. define(VERSION_ID,esyscmd([
  12. V=`git describe 2>/dev/null | sed -e 's/rel-//g' | sed -e 's/-/~/'`;
  13. [ -z "$V" -a -r configure ] \
  14. && V=`grep "PACKAGE_STRING=" configure | cut -d"'" -f2 | cut -d' ' -f2`
  15. ( [ -n "$V" ] && echo "$V" || echo "??" ) | tr -d '\n';
  16. ]))
  17. m4_ifdef([AM_SILENT_RULES],
  18. [m4_define([ng_color_tests], [color-tests])],
  19. [m4_define([ng_color_tests], [])])
  20. # -- Initialisation --
  21. AC_PREREQ([2.61])
  22. AC_INIT([ngIRCd], VERSION_ID,
  23. [ngircd-ml@ngircd.barton.de], [ngircd], [http://ngircd.barton.de/])
  24. AC_CONFIG_SRCDIR([src/ngircd/ngircd.c])
  25. AC_CONFIG_HEADER([src/config.h])
  26. AC_CANONICAL_HOST
  27. AM_INIT_AUTOMAKE([-Wall 1.10 ]ng_color_tests)
  28. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  29. # -- Templates for config.h --
  30. AH_TEMPLATE([DEBUG], [Define if debug-mode should be enabled])
  31. AH_TEMPLATE([HAVE_sockaddr_in_len], [Define if sockaddr_in.sin_len exists])
  32. AH_TEMPLATE([HAVE_socklen_t], [Define if socklen_t exists])
  33. AH_TEMPLATE([ICONV], [Define if libiconv can be used, e.g. for CHARCONV])
  34. AH_TEMPLATE([IDENTAUTH], [Define if the server should do IDENT requests])
  35. AH_TEMPLATE([IRCPLUS], [Define if IRC+ protocol should be used])
  36. AH_TEMPLATE([PAM], [Define if PAM should be used])
  37. AH_TEMPLATE([SNIFFER], [Define if IRC sniffer should be enabled])
  38. AH_TEMPLATE([STRICT_RFC], [Define if ngIRCd should behave strict RFC compliant])
  39. AH_TEMPLATE([SYSLOG], [Define if syslog should be used for logging])
  40. AH_TEMPLATE([TCPWRAP], [Define if TCP wrappers should be used])
  41. AH_TEMPLATE([WANT_IPV6], [Define if IPV6 protocol should be enabled])
  42. AH_TEMPLATE([ZLIB], [Define if zlib compression should be enabled])
  43. AH_TEMPLATE([HOST_OS], [Target operating system name])
  44. AH_TEMPLATE([HOST_VENDOR], [Target system vendor])
  45. AH_TEMPLATE([HOST_CPU], [Target CPU name])
  46. # -- C Compiler --
  47. AC_PROG_CC
  48. AC_PROG_CC_STDC
  49. # -- Helper programs --
  50. m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
  51. AC_PROG_AWK
  52. AC_PROG_INSTALL
  53. AC_PROG_LN_S
  54. AC_PROG_MAKE_SET
  55. AC_PROG_RANLIB
  56. # -- Compiler Features --
  57. AC_C_CONST
  58. AC_C_INLINE
  59. __ng_PROTOTYPES__
  60. # -- Hard coded system and compiler dependencies/features/options ... --
  61. AC_DEFUN([GCC_STACK_PROTECT_CC],[
  62. ssp_cc=yes
  63. # we use -fstack-protector-all for the test to enfoce the use of the guard variable
  64. AC_MSG_CHECKING([whether ${CC} accepts -fstack-protector])
  65. ssp_old_cflags="$CFLAGS"
  66. CFLAGS="$CFLAGS -fstack-protector-all"
  67. AC_TRY_LINK(,,, ssp_cc=no)
  68. echo $ssp_cc
  69. CFLAGS="$ssp_old_cflags"
  70. if test "X$ssp_cc" = "Xyes"; then
  71. CFLAGS="$CFLAGS -fstack-protector"
  72. AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.])
  73. fi
  74. ])
  75. if test "$GCC" = "yes"; then
  76. # We are using the GNU C compiler. Good!
  77. CFLAGS="$CFLAGS -pipe -W -Wall -Wpointer-arith -Wstrict-prototypes"
  78. GCC_STACK_PROTECT_CC
  79. fi
  80. case "$host_os" in
  81. hpux*)
  82. # This is HP/UX, we need to define _XOPEN_SOURCE_EXTENDED
  83. # (tested with HP/UX 11.11)
  84. CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED"
  85. ;;
  86. esac
  87. # Add additional CFLAGS, eventually specified on the command line:
  88. test -n "$CFLAGS_ADD" && CFLAGS="$CFLAGS $CFLAGS_ADD"
  89. CFLAGS="$CFLAGS -DSYSCONFDIR='\"\$(sysconfdir)\"' -DDOCDIR='\"\$(docdir)\"'"
  90. # -- Headers --
  91. AC_HEADER_STDC
  92. AC_HEADER_SYS_WAIT
  93. AC_HEADER_TIME
  94. # Required header files
  95. AC_CHECK_HEADERS([ \
  96. fcntl.h netdb.h netinet/in.h stdlib.h string.h \
  97. strings.h sys/socket.h sys/time.h unistd.h \
  98. ],,AC_MSG_ERROR([required C header missing!]))
  99. # Optional header files
  100. AC_CHECK_HEADERS_ONCE([ \
  101. arpa/inet.h inttypes.h malloc.h netinet/in_systm.h netinet/ip.h \
  102. stdbool.h stddef.h stdint.h varargs.h \
  103. ])
  104. # -- Datatypes --
  105. AC_MSG_CHECKING(whether socklen_t exists)
  106. AC_TRY_COMPILE([
  107. #include <sys/types.h>
  108. #include <sys/socket.h>
  109. ],[
  110. socklen_t a, b;
  111. a = 2; b = 4; a += b;
  112. ],[
  113. AC_DEFINE(HAVE_socklen_t) AC_MSG_RESULT(yes)
  114. ],[
  115. AC_MSG_RESULT(no)
  116. ])
  117. AC_TYPE_PID_T
  118. AC_TYPE_SIGNAL
  119. AC_TYPE_SIZE_T
  120. AC_TYPE_SSIZE_T
  121. AC_TYPE_UID_T
  122. AC_TYPE_UINT16_T
  123. AC_TYPE_UINT32_T
  124. AC_TYPE_UINT8_T
  125. AC_CHECK_MEMBER([struct sockaddr_in.sin_len], AC_DEFINE(HAVE_sockaddr_in_len),,
  126. [#include <arpa/inet.h>])
  127. # -- Libraries --
  128. # memmove: A/UX libUTIL
  129. AC_SEARCH_LIBS([memmove], [UTIL], [], [
  130. AC_MSG_ERROR([unable to find the memmove() function])
  131. ])
  132. # gethostbyname: Solaris libnsl
  133. AC_SEARCH_LIBS([gethostbyname], [bind nsl network], [], [
  134. AC_MSG_ERROR([unable to find the gethostbyname() function])
  135. ])
  136. # bind: SVR4 libsocket
  137. AC_SEARCH_LIBS([bind], [socket network], [], [
  138. AC_MSG_ERROR([unable to find the bind() function])
  139. ])
  140. # -- Functions --
  141. AC_FUNC_FORK
  142. AC_FUNC_STRFTIME
  143. # Required functions
  144. AC_CHECK_FUNCS([ \
  145. alarm dup2 endpwent gethostbyaddr gethostbyname gethostname \
  146. gettimeofday inet_ntoa memmove memset setsid socket strcasecmp \
  147. strchr strcspn strerror strncasecmp strrchr strspn strstr \
  148. ],,
  149. AC_MSG_ERROR([required function missing!]))
  150. # Optional functions
  151. AC_CHECK_FUNCS_ONCE([ \
  152. arc4random arc4random_stir gai_strerror getaddrinfo getnameinfo inet_aton
  153. sigaction sigprocmask snprintf vsnprintf strdup strndup strlcpy strlcat \
  154. strtok_r waitpid])
  155. # -- Configuration options --
  156. # use syslog?
  157. x_syslog_on=no
  158. AC_ARG_WITH(syslog,
  159. AS_HELP_STRING([--without-syslog],
  160. [disable syslog (autodetected by default)]),
  161. [ if test "$withval" != "no"; then
  162. if test "$withval" != "yes"; then
  163. CFLAGS="-I$withval/include $CFLAGS"
  164. CPPFLAGS="-I$withval/include $CPPFLAGS"
  165. LDFLAGS="-L$withval/lib $LDFLAGS"
  166. fi
  167. AC_SEARCH_LIBS([syslog], [be], [x_syslog_on=yes], [
  168. AC_MSG_ERROR([Can't enable syslog!])
  169. ])
  170. fi
  171. ],
  172. [ AC_SEARCH_LIBS([syslog], [be], [x_syslog_on=yes])
  173. ]
  174. )
  175. if test "$x_syslog_on" = "yes"; then
  176. AC_DEFINE(SYSLOG, 1)
  177. AC_CHECK_HEADERS(syslog.h,,AC_MSG_ERROR([required C header missing!]))
  178. fi
  179. # use zlib compression?
  180. x_zlib_on=no
  181. AC_ARG_WITH(zlib,
  182. AS_HELP_STRING([--without-zlib],
  183. [disable zlib compression (autodetected by default)]),
  184. [ if test "$withval" != "no"; then
  185. if test "$withval" != "yes"; then
  186. CFLAGS="-I$withval/include $CFLAGS"
  187. CPPFLAGS="-I$withval/include $CPPFLAGS"
  188. LDFLAGS="-L$withval/lib $LDFLAGS"
  189. fi
  190. AC_CHECK_LIB(z, deflate)
  191. AC_CHECK_FUNCS(deflate, x_zlib_on=yes,
  192. AC_MSG_ERROR([Can't enable zlib!])
  193. )
  194. fi
  195. ],
  196. [ AC_CHECK_LIB(z, deflate)
  197. AC_CHECK_FUNCS(deflate, x_zlib_on=yes)
  198. ]
  199. )
  200. if test "$x_zlib_on" = "yes"; then
  201. AC_DEFINE(ZLIB, 1)
  202. AC_CHECK_HEADERS(zlib.h,,AC_MSG_ERROR([required C header missing!]))
  203. fi
  204. # detect which IO API to use:
  205. x_io_backend=none
  206. AC_ARG_WITH(select,
  207. AS_HELP_STRING([--without-select],
  208. [disable select IO support (autodetected by default)]),
  209. [ if test "$withval" != "no"; then
  210. if test "$withval" != "yes"; then
  211. CFLAGS="-I$withval/include $CFLAGS"
  212. CPPFLAGS="-I$withval/include $CPPFLAGS"
  213. LDFLAGS="-L$withval/lib $LDFLAGS"
  214. fi
  215. AC_CHECK_FUNCS(select, x_io_select=yes,
  216. AC_MSG_ERROR([Can't enable select IO support!])
  217. )
  218. fi
  219. ],
  220. [
  221. AC_CHECK_FUNCS(select, x_io_select=yes)
  222. ]
  223. )
  224. AC_ARG_WITH(poll,
  225. AS_HELP_STRING([--without-poll],
  226. [disable poll support (autodetected by default)]),
  227. [ if test "$withval" != "no"; then
  228. if test "$withval" != "yes"; then
  229. CFLAGS="-I$withval/include $CFLAGS"
  230. CPPFLAGS="-I$withval/include $CPPFLAGS"
  231. LDFLAGS="-L$withval/lib $LDFLAGS"
  232. fi
  233. AC_CHECK_FUNCS(poll, [
  234. AC_CHECK_HEADERS(poll.h,
  235. x_io_backend=poll\(\),
  236. AC_MSG_ERROR(
  237. [Can't enable poll IO support!])
  238. )
  239. ], [
  240. AC_MSG_ERROR([Can't enable poll IO support!])
  241. ])
  242. fi
  243. ],
  244. [
  245. AC_CHECK_FUNCS(poll, [
  246. AC_CHECK_HEADERS(poll.h, x_io_backend=poll\(\))
  247. ])
  248. ]
  249. )
  250. AC_ARG_WITH(devpoll,
  251. AS_HELP_STRING([--without-devpoll],
  252. [disable /dev/poll IO support (autodetected by default)]),
  253. [ if test "$withval" != "no"; then
  254. if test "$withval" != "yes"; then
  255. CFLAGS="-I$withval/include $CFLAGS"
  256. CPPFLAGS="-I$withval/include $CPPFLAGS"
  257. LDFLAGS="-L$withval/lib $LDFLAGS"
  258. fi
  259. AC_CHECK_HEADERS(sys/devpoll.h,,AC_MSG_ERROR([required C header missing!]))
  260. fi
  261. ],
  262. [
  263. AC_CHECK_HEADERS(sys/devpoll.h, x_io_backend=/dev/poll)
  264. ]
  265. )
  266. AC_ARG_WITH(epoll,
  267. AS_HELP_STRING([--without-epoll],
  268. [disable epoll IO support (autodetected by default)]),
  269. [ if test "$withval" != "no"; then
  270. if test "$withval" != "yes"; then
  271. CFLAGS="-I$withval/include $CFLAGS"
  272. CPPFLAGS="-I$withval/include $CPPFLAGS"
  273. LDFLAGS="-L$withval/lib $LDFLAGS"
  274. fi
  275. AC_CHECK_FUNCS(epoll_create, x_io_epoll=yes,
  276. AC_MSG_ERROR([Can't enable epoll IO support!])
  277. )
  278. fi
  279. ],
  280. [
  281. AC_CHECK_FUNCS(epoll_create, x_io_epoll=yes)
  282. ]
  283. )
  284. AC_ARG_WITH(kqueue,
  285. AS_HELP_STRING([--without-kqueue],
  286. [disable kqueue IO support (autodetected by default)]),
  287. [ if test "$withval" != "no"; then
  288. if test "$withval" != "yes"; then
  289. CFLAGS="-I$withval/include $CFLAGS"
  290. CPPFLAGS="-I$withval/include $CPPFLAGS"
  291. LDFLAGS="-L$withval/lib $LDFLAGS"
  292. fi
  293. AC_CHECK_FUNCS(kqueue, x_io_backend=kqueue\(\),
  294. AC_MSG_ERROR([Can't enable kqueue IO support!])
  295. )
  296. fi
  297. ],
  298. [
  299. AC_CHECK_FUNCS(kqueue, x_io_backend=kqueue\(\))
  300. ]
  301. )
  302. if test "$x_io_epoll" = "yes" -a "$x_io_select" = "yes"; then
  303. # when epoll() and select() are available, we'll use both!
  304. x_io_backend="epoll(), select()"
  305. else
  306. if test "$x_io_epoll" = "yes"; then
  307. # we prefere epoll() if it is available
  308. x_io_backend="epoll()"
  309. else
  310. if test "$x_io_select" = "yes" -a "$x_io_backend" = "none"; then
  311. # we'll use select, when available and no "better"
  312. # interface has been detected ...
  313. x_io_backend="select()"
  314. fi
  315. fi
  316. fi
  317. if test "$x_io_backend" = "none"; then
  318. AC_MSG_ERROR([No useable IO API activated/found!?])
  319. fi
  320. # use SSL?
  321. AC_ARG_WITH(openssl,
  322. AS_HELP_STRING([--with-openssl],
  323. [enable SSL support using OpenSSL]),
  324. [ if test "$withval" != "no"; then
  325. if test "$withval" != "yes"; then
  326. CFLAGS="-I$withval/include $CFLAGS"
  327. CPPFLAGS="-I$withval/include $CPPFLAGS"
  328. LDFLAGS="-L$withval/lib $LDFLAGS"
  329. fi
  330. AC_CHECK_LIB(crypto, BIO_s_mem)
  331. AC_CHECK_LIB(ssl, SSL_library_init)
  332. AC_CHECK_FUNCS(SSL_library_init, x_ssl_openssl=yes,
  333. AC_MSG_ERROR([Can't enable openssl])
  334. )
  335. fi
  336. ]
  337. )
  338. AC_ARG_WITH(gnutls,
  339. AS_HELP_STRING([--with-gnutls],
  340. [enable SSL support using gnutls]),
  341. [ if test "$withval" != "no"; then
  342. if test "$withval" != "yes"; then
  343. CFLAGS="-I$withval/include $CFLAGS"
  344. CPPFLAGS="-I$withval/include $CPPFLAGS"
  345. LDFLAGS="-L$withval/lib $LDFLAGS"
  346. fi
  347. AC_CHECK_LIB(gnutls, gnutls_global_init)
  348. AC_CHECK_FUNCS(gnutls_global_init, x_ssl_gnutls=yes,
  349. AC_MSG_ERROR([Can't enable gnutls])
  350. )
  351. fi
  352. ]
  353. )
  354. x_ssl_lib="no"
  355. if test "$x_ssl_gnutls" = "yes"; then
  356. if test "$x_ssl_openssl" = "yes";then
  357. AC_MSG_ERROR([Cannot enable both gnutls and openssl])
  358. fi
  359. x_ssl_lib=gnutls
  360. fi
  361. if test "$x_ssl_openssl" = "yes"; then
  362. x_ssl_lib=openssl
  363. fi
  364. # use TCP wrappers?
  365. x_tcpwrap_on=no
  366. AC_ARG_WITH(tcp-wrappers,
  367. AS_HELP_STRING([--with-tcp-wrappers],
  368. [enable TCP wrappers support]),
  369. [ if test "$withval" != "no"; then
  370. if test "$withval" != "yes"; then
  371. CFLAGS="-I$withval/include $CFLAGS"
  372. CPPFLAGS="-I$withval/include $CPPFLAGS"
  373. LDFLAGS="-L$withval/lib $LDFLAGS"
  374. fi
  375. AC_MSG_CHECKING(for hosts_access)
  376. LIBS="-lwrap $LIBS"
  377. AC_TRY_LINK([
  378. #include <tcpd.h>
  379. int allow_severity = 0;
  380. int deny_severity = 0;
  381. ],[
  382. tcpd_warn("link test");
  383. ],[
  384. AC_MSG_RESULT(yes)
  385. AC_DEFINE(TCPWRAP, 1)
  386. x_tcpwrap_on=yes
  387. ],[
  388. AC_MSG_RESULT(no)
  389. AC_MSG_ERROR([Can't enable TCP wrappers!])
  390. ])
  391. fi
  392. ]
  393. )
  394. # do IDENT requests using libident?
  395. x_identauth_on=no
  396. AC_ARG_WITH(ident,
  397. AS_HELP_STRING([--with-ident],
  398. [enable "IDENT" ("AUTH") protocol support]),
  399. [ if test "$withval" != "no"; then
  400. if test "$withval" != "yes"; then
  401. CFLAGS="-I$withval/include $CFLAGS"
  402. CPPFLAGS="-I$withval/include $CPPFLAGS"
  403. LDFLAGS="-L$withval/lib $LDFLAGS"
  404. fi
  405. AC_CHECK_LIB(ident, ident_id)
  406. AC_CHECK_FUNCS(ident_id, x_identauth_on=yes,
  407. AC_MSG_ERROR([Can't enable IDENT support!])
  408. )
  409. fi
  410. ]
  411. )
  412. if test "$x_identauth_on" = "yes"; then
  413. AC_DEFINE(IDENTAUTH, 1)
  414. AC_CHECK_HEADERS(ident.h,,AC_MSG_ERROR([required C header missing!]))
  415. fi
  416. # compile in PAM support?
  417. x_pam_on=no
  418. AC_ARG_WITH(pam,
  419. AS_HELP_STRING([--with-pam],
  420. [enable user authentication using PAM]),
  421. [ if test "$withval" != "no"; then
  422. if test "$withval" != "yes"; then
  423. CFLAGS="-I$withval/include $CFLAGS"
  424. CPPFLAGS="-I$withval/include $CPPFLAGS"
  425. LDFLAGS="-L$withval/lib $LDFLAGS"
  426. fi
  427. AC_CHECK_LIB(pam, pam_authenticate)
  428. AC_CHECK_FUNCS(pam_authenticate, x_pam_on=yes,
  429. AC_MSG_ERROR([Can't enable PAM support!])
  430. )
  431. fi
  432. ]
  433. )
  434. if test "$x_pam_on" = "yes"; then
  435. AC_DEFINE(PAM, 1)
  436. AC_CHECK_HEADERS(security/pam_appl.h,pam_ok=yes)
  437. if test "$pam_ok" != "yes"; then
  438. AC_CHECK_HEADERS(pam/pam_appl.h,pam_ok=yes,
  439. AC_MSG_ERROR([required C header missing!]))
  440. fi
  441. fi
  442. # compile in IRC+ protocol support?
  443. x_ircplus_on=yes
  444. AC_ARG_ENABLE(ircplus,
  445. AS_HELP_STRING([--disable-ircplus],
  446. [disable IRC+ protocol]),
  447. if test "$enableval" = "no"; then x_ircplus_on=no; fi
  448. )
  449. if test "$x_ircplus_on" = "yes"; then
  450. AC_DEFINE(IRCPLUS, 1)
  451. # Compile in iconv support?
  452. # We only check for it when IRC+ is enabled, because the IRC+ command
  453. # CHARCONV is the only function depending on it.
  454. x_iconv_on=no
  455. AC_ARG_WITH(iconv,
  456. AS_HELP_STRING([--with-iconv],
  457. [enable character conversion using libiconv]),
  458. [ if test "$withval" != "no"; then
  459. if test "$withval" != "yes"; then
  460. CFLAGS="-I$withval/include $CFLAGS"
  461. CPPFLAGS="-I$withval/include $CPPFLAGS"
  462. LDFLAGS="-L$withval/lib $LDFLAGS"
  463. fi
  464. AC_CHECK_LIB(iconv, iconv_open)
  465. AC_CHECK_FUNCS(iconv_open, x_iconv_on=yes)
  466. if test "$x_iconv_on" != "yes"; then
  467. AC_CHECK_LIB(iconv, libiconv_open)
  468. AC_CHECK_FUNCS(libiconv_open, x_iconv_on=yes)
  469. fi
  470. if test "$x_iconv_on" != "yes"; then
  471. AC_MSG_ERROR([Can't enable libiconv support!])
  472. fi
  473. fi ]
  474. )
  475. if test "$x_iconv_on" = "yes"; then
  476. AC_DEFINE(ICONV, 1)
  477. fi
  478. fi
  479. # enable support for IPv6?
  480. x_ipv6_on=no
  481. AC_ARG_ENABLE(ipv6,
  482. AS_HELP_STRING([--enable-ipv6],
  483. [enable IPv6 protocol support]),
  484. if test "$enableval" = "yes"; then x_ipv6_on=yes; fi
  485. )
  486. if test "$x_ipv6_on" = "yes"; then
  487. # getaddrinfo() and getnameinfo() are optional when not compiling
  488. # with IPv6 support, but are required for IPv6 to work!
  489. AC_CHECK_FUNCS([ \
  490. getaddrinfo getnameinfo \
  491. ],,AC_MSG_ERROR([required function missing for IPv6 support!]))
  492. AC_DEFINE(WANT_IPV6, 1)
  493. fi
  494. # compile in IRC "sniffer"?
  495. x_sniffer_on=no; x_debug_on=no
  496. AC_ARG_ENABLE(sniffer,
  497. AS_HELP_STRING([--enable-sniffer],
  498. [enable IRC traffic sniffer (enables debug mode)]),
  499. if test "$enableval" = "yes"; then
  500. AC_DEFINE(SNIFFER, 1)
  501. x_sniffer_on=yes; x_debug_on=yes
  502. fi
  503. )
  504. # enable additional debugging code?
  505. AC_ARG_ENABLE(debug,
  506. AS_HELP_STRING([--enable-debug],
  507. [show additional debug output]),
  508. if test "$enableval" = "yes"; then x_debug_on=yes; fi
  509. )
  510. if test "$x_debug_on" = "yes"; then
  511. AC_DEFINE(DEBUG, 1)
  512. test "$GCC" = "yes" && CFLAGS="-pedantic $CFLAGS"
  513. AC_CHECK_FUNCS(mtrace)
  514. fi
  515. # enable "strict RFC rules"?
  516. x_strict_rfc_on=no
  517. AC_ARG_ENABLE(strict-rfc,
  518. AS_HELP_STRING([--enable-strict-rfc],
  519. [strict RFC conformance -- may break clients!]),
  520. if test "$enableval" = "yes"; then
  521. AC_DEFINE(STRICT_RFC, 1)
  522. x_strict_rfc_on=yes
  523. fi
  524. )
  525. # -- Definitions --
  526. AC_DEFINE_UNQUOTED(HOST_CPU, "$host_cpu" )
  527. AC_DEFINE_UNQUOTED(HOST_VENDOR, "$host_vendor" )
  528. AC_DEFINE_UNQUOTED(HOST_OS, "$host_os" )
  529. # Add additional CFLAGS, eventually specified on the command line, but after
  530. # running this configure script. Useful for "-Werror" for example.
  531. test -n "$CFLAGS_END" && CFLAGS="$CFLAGS $CFLAGS_END"
  532. # -- Generate files --
  533. AC_CONFIG_FILES([ \
  534. Makefile \
  535. contrib/Debian/Makefile \
  536. contrib/MacOSX/Makefile \
  537. contrib/MacOSX/ngIRCd.pmdoc/Makefile \
  538. contrib/MacOSX/ngIRCd.xcodeproj/Makefile \
  539. contrib/Makefile \
  540. doc/Makefile \
  541. doc/src/Makefile \
  542. man/Makefile \
  543. src/ipaddr/Makefile \
  544. src/Makefile \
  545. src/ngircd/Makefile \
  546. src/portab/Makefile \
  547. src/testsuite/Makefile \
  548. src/tool/Makefile \
  549. ])
  550. AC_OUTPUT
  551. type dpkg >/dev/null 2>&1
  552. if test $? -eq 0; then
  553. # Generate debian/ link if the dpkg command exists
  554. # (read: if we are running on a debian compatible system)
  555. echo "creating Debian-specific links ..."
  556. test -f debian/rules || ln -s contrib/Debian debian
  557. fi
  558. # -- Result --
  559. echo
  560. echo "ngIRCd $PACKAGE_VERSION has been configured with the following options:"
  561. echo
  562. # Someone please show me a better way :) [borrowed by OpenSSH]
  563. B=`eval echo ${bindir}` ; B=`eval echo ${B}`
  564. S=`eval echo ${sbindir}` ; S=`eval echo ${S}`
  565. C=`eval echo ${sysconfdir}` ; C=`eval echo ${C}`
  566. M=`eval echo ${mandir}` ; M=`eval echo ${M}`
  567. D=`eval echo ${docdir}` ; D=`eval echo ${D}`
  568. echo " Host: ${host}"
  569. echo " Compiler: ${CC}"
  570. test -n "$CFLAGS" && echo " Compiler flags: ${CFLAGS}"
  571. test -n "$CPPFLAGS" && echo " Preprocessor flags: ${CPPFLAGS}"
  572. test -n "$LDFLAGS" && echo " Linker flags: ${LDFLAGS}"
  573. test -n "$LIBS" && echo " Libraries: ${LIBS}"
  574. echo
  575. echo " 'ngircd' binary: $S"
  576. echo " Configuration file: $C"
  577. echo " Manual pages: $M"
  578. echo " Documentation: $D"
  579. echo
  580. echo $ECHO_N " Syslog support: $ECHO_C"
  581. test "$x_syslog_on" = "yes" \
  582. && echo $ECHO_N "yes $ECHO_C" \
  583. || echo $ECHO_N "no $ECHO_C"
  584. echo $ECHO_N " Enable debug code: $ECHO_C"
  585. test "$x_debug_on" = "yes" \
  586. && echo "yes" \
  587. || echo "no"
  588. echo $ECHO_N " zlib compression: $ECHO_C"
  589. test "$x_zlib_on" = "yes" \
  590. && echo $ECHO_N "yes $ECHO_C" \
  591. || echo $ECHO_N "no $ECHO_C"
  592. echo $ECHO_N " IRC sniffer: $ECHO_C"
  593. test "$x_sniffer_on" = "yes" \
  594. && echo "yes" \
  595. || echo "no"
  596. echo $ECHO_N " Use TCP Wrappers: $ECHO_C"
  597. test "$x_tcpwrap_on" = "yes" \
  598. && echo $ECHO_N "yes $ECHO_C" \
  599. || echo $ECHO_N "no $ECHO_C"
  600. echo $ECHO_N " Strict RFC mode: $ECHO_C"
  601. test "$x_strict_rfc_on" = "yes" \
  602. && echo "yes" \
  603. || echo "no"
  604. echo $ECHO_N " IDENT support: $ECHO_C"
  605. test "$x_identauth_on" = "yes" \
  606. && echo $ECHO_N "yes $ECHO_C" \
  607. || echo $ECHO_N "no $ECHO_C"
  608. echo $ECHO_N " IRC+ protocol: $ECHO_C"
  609. test "$x_ircplus_on" = "yes" \
  610. && echo "yes" \
  611. || echo "no"
  612. echo $ECHO_N " IPv6 protocol: $ECHO_C"
  613. test "$x_ipv6_on" = "yes" \
  614. && echo $ECHO_N "yes $ECHO_C" \
  615. || echo $ECHO_N "no $ECHO_C"
  616. echo $ECHO_N " I/O backend: $ECHO_C"
  617. echo "$x_io_backend"
  618. echo $ECHO_N " PAM support: $ECHO_C"
  619. test "$x_pam_on" = "yes" \
  620. && echo $ECHO_N "yes $ECHO_C" \
  621. || echo $ECHO_N "no $ECHO_C"
  622. echo $ECHO_N " SSL support: $ECHO_C"
  623. echo "$x_ssl_lib"
  624. echo $ECHO_N " libiconv support: $ECHO_C"
  625. echo "$x_iconv_on"
  626. echo
  627. define(_automake_regex_,[[^AUTOMAKE_OPTIONS = [a-z .\-]*/portab/ansi2knr]])
  628. if ! grep "_automake_regex_" src/ngircd/Makefile.am >/dev/null 2>&1; then
  629. echo "WARNING:"
  630. echo "This GNU automake generated build system does not support \"de-ANSI-fication\","
  631. echo "therefore don't use it to generate \"official\" distribution archives!"
  632. echo "(Most probably you want to use GNU automake 1.11.x for this purpose ...)"
  633. echo
  634. fi
  635. # -eof-