configure.ac 21 KB

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