configure.in 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. #
  2. # ngIRCd -- The Next Generation IRC Daemon
  3. # Copyright (c)2001-2005 Alexander Barton <alex@barton.de>
  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. # $Id: configure.in,v 1.111.2.6 2005/10/15 12:44:08 alex Exp $
  12. #
  13. # -- Initialisation --
  14. AC_PREREQ(2.50)
  15. AC_INIT(ngircd, 0.9.2)
  16. AC_CONFIG_SRCDIR(src/ngircd/ngircd.c)
  17. AC_CANONICAL_TARGET
  18. AM_INIT_AUTOMAKE(1.6)
  19. AM_CONFIG_HEADER(src/config.h)
  20. # -- Templates for config.h --
  21. AH_TEMPLATE([DEBUG], [Define if debug-mode should be enabled])
  22. AH_TEMPLATE([HAVE_socklen_t], [Define if socklen_t exists])
  23. AH_TEMPLATE([SNIFFER], [Define if IRC sniffer should be enabled])
  24. AH_TEMPLATE([STRICT_RFC], [Define if ngIRCd should behave strict RFC compliant])
  25. AH_TEMPLATE([SYSLOG], [Define if syslog should be used for logging])
  26. AH_TEMPLATE([ZLIB], [Define if zlib compression should be enabled])
  27. AH_TEMPLATE([TCPWRAP], [Define if TCP wrappers should be used])
  28. AH_TEMPLATE([IRCPLUS], [Define if IRC+ protocol should be used])
  29. AH_TEMPLATE([RENDEZVOUS], [Define if Rendezvous support should be included])
  30. AH_TEMPLATE([IDENTAUTH], [Define if the server should do IDENT requests])
  31. AH_TEMPLATE([TARGET_OS], [Target operating system name])
  32. AH_TEMPLATE([TARGET_VENDOR], [Target system vendor])
  33. AH_TEMPLATE([TARGET_CPU], [Target CPU name])
  34. # -- C Compiler --
  35. AC_PROG_CC
  36. # -- Helper programs --
  37. AC_PROG_AWK
  38. AC_PROG_INSTALL
  39. AC_PROG_LN_S
  40. AC_PROG_MAKE_SET
  41. AC_PROG_RANLIB
  42. # -- Compiler Features --
  43. AM_C_PROTOTYPES
  44. AC_C_CONST
  45. # -- Hard coded system and compiler dependencies/features/options ... --
  46. if test "$GCC" = "yes"; then
  47. # We are using the GNU C compiler. Good!
  48. CFLAGS="$CFLAGS -pipe -W -Wall -Wpointer-arith -Wstrict-prototypes"
  49. fi
  50. case "$target_os" in
  51. hpux*)
  52. # This is HP/UX, we need to define _XOPEN_SOURCE_EXTENDED
  53. # (tested with HP/UX 11.11)
  54. CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED"
  55. ;;
  56. esac
  57. # Add additional CFLAGS, eventually specified on the command line:
  58. test -n "$CFLAGS_ADD" && CFLAGS="$CFLAGS $CFLAGS_ADD"
  59. CFLAGS="$CFLAGS -DSYSCONFDIR='\"\$(sysconfdir)\"'"
  60. # -- Headers --
  61. AC_HEADER_STDC
  62. AC_HEADER_TIME
  63. AC_HEADER_SYS_WAIT
  64. AC_CHECK_HEADERS([ \
  65. ctype.h errno.h fcntl.h netdb.h netinet/in.h stdlib.h string.h \
  66. strings.h sys/socket.h sys/time.h unistd.h \
  67. ],,AC_MSG_ERROR([required C header missing!]))
  68. AC_CHECK_HEADERS([arpa/inet.h ctype.h malloc.h stdbool.h stddef.h varargs.h])
  69. # -- Datatypes --
  70. AC_MSG_CHECKING(whether socklen_t exists)
  71. AC_TRY_COMPILE([
  72. #include <sys/types.h>
  73. #include <sys/socket.h>
  74. ],[
  75. socklen_t a, b;
  76. a = 2; b = 4; a += b;
  77. ],[
  78. AC_DEFINE(HAVE_socklen_t) AC_MSG_RESULT(yes)
  79. ],[
  80. AC_MSG_RESULT(no)
  81. ])
  82. AC_TYPE_SIGNAL
  83. AC_TYPE_SIZE_T
  84. # -- Libraries --
  85. AC_CHECK_LIB(UTIL,memmove)
  86. AC_CHECK_LIB(socket,bind)
  87. AC_CHECK_LIB(nsl,gethostent)
  88. # -- Functions --
  89. AC_FUNC_FORK
  90. AC_FUNC_STRFTIME
  91. AC_CHECK_FUNCS([ \
  92. bind gethostbyaddr gethostbyname gethostname inet_ntoa malloc memmove \
  93. memset realloc setsid setsockopt socket strcasecmp strchr strerror \
  94. strstr waitpid],,AC_MSG_ERROR([required function missing!]))
  95. AC_CHECK_FUNCS(inet_aton isdigit sigaction snprintf vsnprintf strdup strlcpy strlcat)
  96. AC_CHECK_FUNCS(select,[AC_CHECK_HEADERS(sys/select.h)],
  97. AC_MSG_ERROR([required function select() is missing!])
  98. )
  99. # -- Configuration options --
  100. x_syslog_on=no
  101. AC_ARG_WITH(syslog,
  102. [ --without-syslog disable syslog (autodetected by default)],
  103. [ if test "$withval" != "no"; then
  104. if test "$withval" != "yes"; then
  105. CFLAGS="-I$withval/include $CFLAGS"
  106. CPPFLAGS="-I$withval/include $CPPFLAGS"
  107. LDFLAGS="-L$withval/lib $LDFLAGS"
  108. fi
  109. AC_CHECK_LIB(be, syslog)
  110. AC_CHECK_FUNCS(syslog, x_syslog_on=yes,
  111. AC_MSG_ERROR([Can't enable syslog!])
  112. )
  113. fi
  114. ],
  115. [
  116. AC_CHECK_LIB(be, syslog)
  117. AC_CHECK_FUNCS(syslog, x_syslog_on=yes)
  118. ]
  119. )
  120. if test "$x_syslog_on" = "yes"; then
  121. AC_DEFINE(SYSLOG, 1)
  122. AC_CHECK_HEADERS(syslog.h,,AC_MSG_ERROR([required C header missing!]))
  123. fi
  124. x_zlib_on=no
  125. AC_ARG_WITH(zlib,
  126. [ --without-zlib disable zlib compression (autodetected by default)],
  127. [ if test "$withval" != "no"; then
  128. if test "$withval" != "yes"; then
  129. CFLAGS="-I$withval/include $CFLAGS"
  130. CPPFLAGS="-I$withval/include $CPPFLAGS"
  131. LDFLAGS="-L$withval/lib $LDFLAGS"
  132. fi
  133. AC_CHECK_LIB(z, deflate)
  134. AC_CHECK_FUNCS(deflate, x_zlib_on=yes,
  135. AC_MSG_ERROR([Can't enable zlib!])
  136. )
  137. fi
  138. ],
  139. [ AC_CHECK_LIB(z, deflate)
  140. AC_CHECK_FUNCS(deflate, x_zlib_on=yes)
  141. ]
  142. )
  143. if test "$x_zlib_on" = "yes"; then
  144. AC_DEFINE(ZLIB, 1)
  145. AC_CHECK_HEADERS(zlib.h,,AC_MSG_ERROR([required C header missing!]))
  146. fi
  147. x_tcpwrap_on=no
  148. AC_ARG_WITH(tcp-wrappers,
  149. [ --with-tcp-wrappers enable TCP wrappers support],
  150. [ if test "$withval" != "no"; then
  151. if test "$withval" != "yes"; then
  152. CFLAGS="-I$withval/include $CFLAGS"
  153. CPPFLAGS="-I$withval/include $CPPFLAGS"
  154. LDFLAGS="-L$withval/lib $LDFLAGS"
  155. fi
  156. AC_MSG_CHECKING(for hosts_access)
  157. LIBS="-lwrap $LIBS"
  158. AC_TRY_LINK([
  159. #include <tcpd.h>
  160. int allow_severity = 0;
  161. int deny_severity = 0;
  162. ],[
  163. tcpd_warn("link test");
  164. ],[
  165. AC_MSG_RESULT(yes)
  166. AC_DEFINE(TCPWRAP, 1)
  167. x_tcpwrap_on=yes
  168. ],[
  169. AC_MSG_RESULT(no)
  170. AC_MSG_ERROR([Can't enable TCP wrappers!])
  171. ])
  172. fi
  173. ]
  174. )
  175. x_rendezvous_on=no
  176. AC_ARG_WITH(rendezvous,
  177. [ --with-rendezvous enable support for "Rendezvous"],
  178. [ if test "$withval" != "no"; then
  179. if test "$withval" != "yes"; then
  180. CFLAGS="-I$withval/include $CFLAGS"
  181. CPPFLAGS="-I$withval/include $CPPFLAGS"
  182. LDFLAGS="-L$withval/lib $LDFLAGS"
  183. fi
  184. AC_CHECK_FUNCS(DNSServiceRegistrationCreate, x_rendezvous_on=osx,
  185. [
  186. AC_CHECK_LIB(pthread, pthread_mutexattr_init)
  187. AC_CHECK_LIB(howl, sw_discovery_init)
  188. AC_CHECK_FUNCS(sw_discovery_init, \
  189. x_rendezvous_on=howl, \
  190. AC_MSG_ERROR([Can't enable Rendezvous!]))
  191. ])
  192. fi
  193. ]
  194. )
  195. if test "$x_rendezvous_on" = "osx"; then
  196. AC_CHECK_HEADERS([DNSServiceDiscovery/DNSServiceDiscovery.h \
  197. mach/port.h],,AC_MSG_ERROR([required C header missing!]))
  198. AC_DEFINE(RENDEZVOUS, 1)
  199. fi
  200. if test "$x_rendezvous_on" = "howl"; then
  201. for dir in /usr/local/include /usr/local/include/howl* \
  202. /usr/include /usr/include/howl*; do
  203. test -d "$dir" || continue
  204. AC_MSG_CHECKING([for Howl headers in $dir])
  205. if test -f "$dir/rendezvous/rendezvous.h"; then
  206. if test "$dir" != "/usr/local/include" -a \
  207. "$dir" != "/usr/include"; then
  208. CFLAGS="-I$dir $CFLAGS"
  209. CPPFLAGS="-I$dir $CPPFLAGS"
  210. fi
  211. AC_MSG_RESULT(yes)
  212. break
  213. else
  214. AC_MSG_RESULT(no)
  215. fi
  216. done
  217. AC_CHECK_HEADERS([rendezvous/rendezvous.h],, \
  218. AC_MSG_ERROR([required C header missing!]))
  219. AC_DEFINE(RENDEZVOUS, 1)
  220. fi
  221. x_identauth_on=no
  222. AC_ARG_WITH(ident,
  223. [ --with-ident enable "IDENT" ("AUTH") protocol support],
  224. [ if test "$withval" != "no"; then
  225. if test "$withval" != "yes"; then
  226. CFLAGS="-I$withval/include $CFLAGS"
  227. CPPFLAGS="-I$withval/include $CPPFLAGS"
  228. LDFLAGS="-L$withval/lib $LDFLAGS"
  229. fi
  230. AC_CHECK_LIB(ident, ident_id)
  231. AC_CHECK_FUNCS(ident_id, x_identauth_on=yes,
  232. AC_MSG_ERROR([Can't enable IDENT support!])
  233. )
  234. fi
  235. ]
  236. )
  237. if test "$x_identauth_on" = "yes"; then
  238. AC_DEFINE(IDENTAUTH, 1)
  239. AC_CHECK_HEADERS(ident.h,,AC_MSG_ERROR([required C header missing!]))
  240. fi
  241. x_ircplus_on=yes
  242. AC_ARG_ENABLE(ircplus,
  243. [ --disable-ircplus disable IRC+ protocol],
  244. if test "$enableval" = "no"; then x_ircplus_on=no; fi
  245. )
  246. if test "$x_ircplus_on" = "yes"; then
  247. AC_DEFINE(IRCPLUS, 1)
  248. fi
  249. x_sniffer_on=no; x_debug_on=no
  250. AC_ARG_ENABLE(sniffer,
  251. [ --enable-sniffer enable IRC traffic sniffer (enables debug mode)],
  252. if test "$enableval" = "yes"; then
  253. AC_DEFINE(SNIFFER, 1)
  254. x_sniffer_on=yes; x_debug_on=yes
  255. fi
  256. )
  257. AC_ARG_ENABLE(debug,
  258. [ --enable-debug show additional debug output],
  259. if test "$enableval" = "yes"; then x_debug_on=yes; fi
  260. )
  261. if test "$x_debug_on" = "yes"; then
  262. AC_DEFINE(DEBUG, 1)
  263. test "$GCC" = "yes" && CFLAGS="-pedantic $CFLAGS"
  264. fi
  265. x_strict_rfc_on=no
  266. AC_ARG_ENABLE(strict-rfc,
  267. [ --enable-strict-rfc strict RFC conformance -- may break clients!],
  268. if test "$enableval" = "yes"; then
  269. AC_DEFINE(STRICT_RFC, 1)
  270. x_strict_rfc_on=yes
  271. fi
  272. )
  273. # -- Definitions --
  274. AC_DEFINE_UNQUOTED(TARGET_CPU, "$target_cpu" )
  275. AC_DEFINE_UNQUOTED(TARGET_VENDOR, "$target_vendor" )
  276. AC_DEFINE_UNQUOTED(TARGET_OS, "$target_os" )
  277. # Add additional CFLAGS, eventually specified on the command line, but after
  278. # running this configure script. Useful for "-Werror" for example.
  279. test -n "$CFLAGS_END" && CFLAGS="$CFLAGS $CFLAGS_END"
  280. # -- Generate files --
  281. AC_OUTPUT([ \
  282. Makefile \
  283. doc/Makefile \
  284. src/Makefile \
  285. src/portab/Makefile \
  286. src/tool/Makefile \
  287. src/ngircd/Makefile \
  288. src/testsuite/Makefile \
  289. man/Makefile \
  290. contrib/Makefile \
  291. contrib/Debian/Makefile \
  292. contrib/MacOSX/Makefile \
  293. ])
  294. type dpkg >/dev/null 2>&1
  295. if test $? -eq 0; then
  296. # Generate debian/ link if the dpkg command exists
  297. # (read: if we are running on a debian compatible system)
  298. echo "creating Debian-specific links ..."
  299. test -f debian/rules || ln -s contrib/Debian debian
  300. fi
  301. # -- Result --
  302. echo
  303. echo "ngIRCd $PACKAGE_VERSION has been configured with the following options:"
  304. echo
  305. # Someone please show me a better way :) [borrowed by OpenSSH]
  306. B=`eval echo ${bindir}` ; B=`eval echo ${B}`
  307. S=`eval echo ${sbindir}` ; S=`eval echo ${S}`
  308. C=`eval echo ${sysconfdir}` ; C=`eval echo ${C}`
  309. M=`eval echo ${mandir}` ; M=`eval echo ${M}`
  310. D=`eval echo ${datadir}/doc/${PACKAGE}` ; D=`eval echo ${D}`
  311. echo " Target: ${target}"
  312. test "$target" != "$host" && echo " Host: ${host}"
  313. echo " Compiler: ${CC}"
  314. test -n "$CFLAGS" && echo " Compiler flags: ${CFLAGS}"
  315. test -n "$CPPFLAGS" && echo " Preprocessor flags: ${CPPFLAGS}"
  316. test -n "$LDFLAGS" && echo " Linker flags: ${LDFLAGS}"
  317. test -n "$LIBS" && echo " Libraries: ${LIBS}"
  318. echo
  319. echo " 'ngircd' binary: $S"
  320. echo " Configuration file: $C"
  321. echo " Manual pages: $M"
  322. echo " Documentation: $D"
  323. echo
  324. echo $ECHO_N " Syslog support: $ECHO_C"
  325. test "$x_syslog_on" = "yes" \
  326. && echo $ECHO_N "yes $ECHO_C" \
  327. || echo $ECHO_N "no $ECHO_C"
  328. echo $ECHO_N " Enable debug code: $ECHO_C"
  329. test "$x_debug_on" = "yes" \
  330. && echo "yes" \
  331. || echo "no"
  332. echo $ECHO_N " zlib compression: $ECHO_C"
  333. test "$x_zlib_on" = "yes" \
  334. && echo $ECHO_N "yes $ECHO_C" \
  335. || echo $ECHO_N "no $ECHO_C"
  336. echo $ECHO_N " IRC sniffer: $ECHO_C"
  337. test "$x_sniffer_on" = "yes" \
  338. && echo "yes" \
  339. || echo "no"
  340. echo $ECHO_N " Use TCP Wrappers: $ECHO_C"
  341. test "$x_tcpwrap_on" = "yes" \
  342. && echo $ECHO_N "yes $ECHO_C" \
  343. || echo $ECHO_N "no $ECHO_C"
  344. echo $ECHO_N " Strict RFC mode: $ECHO_C"
  345. test "$x_strict_rfc_on" = "yes" \
  346. && echo "yes" \
  347. || echo "no"
  348. echo $ECHO_N " Rendezvous support: $ECHO_C"
  349. test "$x_rendezvous_on" = "osx" -o "$x_rendezvous_on" = "howl" \
  350. && echo $ECHO_N "yes $ECHO_C" \
  351. || echo $ECHO_N "no $ECHO_C"
  352. echo $ECHO_N " IRC+ protocol: $ECHO_C"
  353. test "$x_ircplus_on" = "yes" \
  354. && echo "yes" \
  355. || echo "no"
  356. echo $ECHO_N " IDENT support: $ECHO_C"
  357. test "$x_identauth_on" = "yes" \
  358. && echo $ECHO_N "yes $ECHO_C" \
  359. || echo $ECHO_N "no $ECHO_C"
  360. echo; echo
  361. # -eof-