configure.ng 20 KB

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