configure.ac 20 KB

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