configure.ng 20 KB

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