configure.ac 21 KB

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