/boa-0.94.14rc21/configure.in

# · Autoconf · 301 lines · 215 code · 33 blank · 53 comment · 28 complexity · 1ae84c23c35e4f960a85966ba1cf3b44 MD5 · raw file

  1. dnl $Id: configure.in,v 1.1.2.16 2003/10/05 04:00:05 jnelson Exp $
  2. dnl Process this file with autoconf to produce a configure script.
  3. AC_INIT
  4. AC_CONFIG_SRCDIR([src/boa.c])
  5. dnl Make config.h
  6. AC_CONFIG_HEADER(src/config.h)
  7. AC_CANONICAL_HOST
  8. dnl Checks for programs.
  9. AC_PROG_CC
  10. AC_PROG_CPP
  11. AC_C_VAR_FUNC
  12. CHECK_GNU_MAKE
  13. if test "x$_cv_gnu_make_command" != "x"; then
  14. MAKE="$_cv_gnu_make_command"
  15. ALLSOURCES="\$^"
  16. else
  17. MAKE="make"
  18. ALLSOURCES="\$(.ALLSRC)"
  19. fi
  20. AC_SUBST(ALLSOURCES)
  21. AC_SUBST(MAKE)
  22. dnl AC_MSG_RESULT($host) dnl i686-pc-linux-gnu
  23. dnl AC_MSG_RESULT($host_cpu) dnl i686
  24. dnl AC_MSG_RESULT($host_vendor) dnl pc
  25. dnl AC_MSG_RESULT($host_os) dnl linux-gnu
  26. dnl i386-unknown-freebsd4.2
  27. dnl Checks for libraries.
  28. # AC_SEARCH_LIBS (function, search-libs, [action-if-found], [action-if-not-found], [other-libraries])
  29. AC_SEARCH_LIBS(socket, socket net)
  30. AC_SEARCH_LIBS(inet_aton, resolv)
  31. AC_SEARCH_LIBS(gethostname, nsl)
  32. AC_SEARCH_LIBS(gethostbyname, nsl)
  33. dnl Checks for header files.
  34. AC_HEADER_DIRENT
  35. AC_HEADER_STDC
  36. AC_HEADER_SYS_WAIT
  37. AC_CHECK_HEADERS(fcntl.h sys/fcntl.h limits.h sys/time.h)
  38. AC_CHECK_HEADERS(getopt.h unistd.h)
  39. dnl Checks for typedefs, structures, and compiler characteristics.
  40. AC_C_CONST
  41. AC_TYPE_UID_T
  42. AC_TYPE_OFF_T
  43. AC_TYPE_PID_T
  44. AC_TYPE_SIZE_T
  45. AC_HEADER_TIME
  46. AC_STRUCT_TM
  47. dnl AC_CHECK_TYPE(sa_family_t,unsigned short int)
  48. dnl AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[],[]) (includes, function-body, [action-if-found], [action-if-not-found])
  49. AC_MSG_CHECKING(whether sa_family_t is defined)
  50. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  51. #include <sys/types.h>
  52. #include <sys/socket.h>
  53. ]], [[sa_family_t foo2;]])],[AC_MSG_RESULT(yes)],[
  54. AC_MSG_RESULT(no)
  55. AC_DEFINE(DONT_HAVE_SA_FAMILY_T,1,[Define if sa_family_t is not defined])
  56. ])
  57. dnl Checks for library functions.
  58. AC_FUNC_FNMATCH
  59. AC_FUNC_MEMCMP
  60. AC_FUNC_MMAP
  61. AC_FUNC_SETVBUF_REVERSED
  62. AC_CHECK_FUNCS(getcwd strdup strstr strcspn strtol)
  63. AC_CHECK_FUNCS(gethostname gethostbyname socket inet_aton herror inet_addr)
  64. AC_CHECK_FUNCS(scandir alphasort)
  65. AC_CHECK_FUNCS(madvise)
  66. AC_CHECK_STRUCT_FOR([
  67. #if TIME_WITH_SYS_TIME
  68. # include <sys/time.h>
  69. # include <time.h>
  70. #else
  71. # if HAVE_SYS_TIME_H
  72. # include <sys/time.h>
  73. # else
  74. # include <time.h>
  75. # endif
  76. #endif
  77. ],tm,tm_gmtoff)
  78. if test "$ac_cv_struct_tm_has_tm_gmtoff" = "yes"; then
  79. AC_DEFINE(HAVE_TM_GMTOFF,1,[Define if struct tm has a tm_gmtoff member])
  80. fi
  81. AC_CHECK_STRUCT_FOR([
  82. #if TIME_WITH_SYS_TIME
  83. # include <sys/time.h>
  84. # include <time.h>
  85. #else
  86. # if HAVE_SYS_TIME_H
  87. # include <sys/time.h>
  88. # else
  89. # include <time.h>
  90. # endif
  91. #endif
  92. ],tm,tm_zone)
  93. if test "$ac_cv_struct_tm_has_tm_zone" = "yes"; then
  94. AC_DEFINE(HAVE_TM_ZONE,1,[Define if struct tm has tm_zone member])
  95. fi
  96. AC_CHECK_STRUCT_FOR([
  97. #include <sys/types.h>
  98. #include <netinet/in.h>
  99. ],sockaddr_in,sin_len)
  100. if test "$ac_cv_struct_sockaddr_in_has_sin_len" = "yes"; then
  101. AC_DEFINE(HAVE_SIN_LEN,1,[Define if struct sockaddr_in has sin_len member])
  102. fi
  103. if test $ac_cv_func_scandir = no; then
  104. # scandir not defined, add it
  105. SCANDIR="scandir.o"
  106. AC_SUBST(SCANDIR)
  107. fi
  108. if test $ac_cv_func_alphasort = no; then
  109. # alphasort not defined, add it
  110. ALPHASORT="alphasort.o"
  111. AC_SUBST(ALPHASORT)
  112. fi
  113. if test $ac_cv_func_strdup = no -o $ac_cv_func_strstr = no; then
  114. # strdup or strstr not defined
  115. STRUTIL="strutil.o"
  116. AC_SUBST(STRUTIL)
  117. fi
  118. if test -n "$GCC"; then
  119. dnl if we are running gcc, use -pipe
  120. test -n "$GCC" && CFLAGS="$CFLAGS -pipe"
  121. AC_MSG_CHECKING(compile and link profiling code)
  122. AC_ARG_ENABLE(profiling,
  123. [ --enable-profiling Compile and link profiling code],
  124. [
  125. if test "$enableval" = "yes" ; then
  126. AC_MSG_RESULT(yes)
  127. CFLAGS="$CFLAGS -pg"
  128. LDFLAGS="$LDFLAGS -g -pg"
  129. else
  130. AC_MSG_RESULT(no)
  131. fi
  132. ],
  133. [
  134. AC_MSG_RESULT(no)
  135. ])
  136. fi
  137. AC_MSG_CHECKING(whether to enable gunzip support)
  138. AC_ARG_ENABLE(gunzip,
  139. [ --disable-gunzip Disable use of gunzip],
  140. [
  141. if test "$enableval" = "yes" ; then
  142. AC_MSG_RESULT(yes)
  143. AC_PATH_PROG(GUNZIP, gunzip)
  144. AC_DEFINE_UNQUOTED(GUNZIP, "$ac_cv_path_GUNZIP", [Define if gunzip can be found])
  145. else
  146. AC_MSG_RESULT(no)
  147. fi
  148. ],
  149. [
  150. AC_MSG_RESULT(yes)
  151. AC_PATH_PROG(GUNZIP, gunzip)
  152. AC_DEFINE_UNQUOTED(GUNZIP, "$ac_cv_path_GUNZIP", [Define if gunzip can be found])
  153. ])
  154. AC_MSG_CHECKING(whether to enable access control support)
  155. AC_ARG_ENABLE(access-control,
  156. [ --enable-access-control Enable support for allow/deny rules],
  157. [
  158. if test "$enableval" = "yes" ; then
  159. AC_MSG_RESULT(yes)
  160. CFLAGS="$CFLAGS -DACCESS_CONTROL"
  161. ACCESSCONTROL_SOURCE="access.c"
  162. else
  163. AC_MSG_RESULT(no)
  164. fi
  165. ],
  166. [
  167. AC_MSG_RESULT(no)
  168. ])
  169. AC_SUBST(ACCESSCONTROL_SOURCE)
  170. AC_MSG_CHECKING(whether to compile and link debugging code)
  171. AC_ARG_ENABLE(debug,
  172. [ --disable-debug Do not compile and link debugging code],
  173. [
  174. if test "$enableval" = "yes" ; then
  175. AC_MSG_RESULT(yes)
  176. LDFLAGS="$LDFLAGS -g"
  177. test -n "$GCC" && CFLAGS="$CFLAGS -Wall"
  178. else
  179. AC_MSG_RESULT(no)
  180. fi
  181. ],
  182. [
  183. AC_MSG_RESULT(yes)
  184. LDFLAGS="$LDFLAGS -g"
  185. test -n "$GCC" && CFLAGS="$CFLAGS -Wall"
  186. ])
  187. AC_MSG_CHECKING(whether to disable verbose/debug logging)
  188. AC_ARG_ENABLE(verbose,
  189. [ --disable-verbose Do not enable verbose/debug logging],
  190. [
  191. if test "$enableval" = "yes" ; then
  192. AC_MSG_RESULT(yes)
  193. else
  194. CFLAGS="$CFLAGS -DDISABLE_DEBUG"
  195. AC_MSG_RESULT(no)
  196. fi
  197. ],
  198. [
  199. AC_MSG_RESULT(yes)
  200. ])
  201. AC_MSG_CHECKING(whether to link with the Dmalloc memory debugger/profiler)
  202. AC_ARG_WITH(dmalloc,
  203. [ --with-dmalloc Link with the Dmalloc memory debugger/profiler],
  204. [
  205. if test "$withval" = "yes"; then
  206. AC_MSG_RESULT(trying)
  207. AC_CHECK_LIB(dmalloc, dmalloc_shutdown)
  208. else
  209. AC_MSG_RESULT(no)
  210. fi
  211. ],
  212. [
  213. AC_MSG_RESULT(no)
  214. ])
  215. AC_MSG_CHECKING(whether to link with the Electric Fence memory debugger)
  216. AC_ARG_WITH(efence,
  217. [ --with-efence Link with the Electric Fence memory debugger],
  218. [
  219. if test "$withval" = "yes"; then
  220. AC_MSG_RESULT(trying)
  221. AC_CHECK_LIB(efence, main)
  222. else
  223. AC_MSG_RESULT(no)
  224. fi
  225. ],
  226. [
  227. AC_MSG_RESULT(no)
  228. ])
  229. case $host_os in
  230. *linux*)
  231. AC_MSG_CHECKING(whether to enable the use of the sendfile(2) system call)
  232. AC_ARG_ENABLE(sendfile,
  233. [ --disable-sendfile Disable the use of the sendfile(2) system call],
  234. [
  235. if test "$enableval" = "no" ; then
  236. AC_MSG_RESULT(no)
  237. else
  238. AC_MSG_RESULT(yes)
  239. AC_CHECK_HEADERS(sys/sendfile.h)
  240. AC_CHECK_FUNCS(sendfile)
  241. fi
  242. ],
  243. [
  244. AC_MSG_RESULT(yes)
  245. AC_CHECK_HEADERS(sys/sendfile.h)
  246. AC_CHECK_FUNCS(sendfile)
  247. ])
  248. ;;
  249. *) ;;
  250. esac
  251. POLL_OR_SELECT
  252. if test "$BOA_ASYNC_IO" = "poll"; then
  253. ASYNCIO_SOURCE="poll.c"
  254. else
  255. ASYNCIO_SOURCE="select.c"
  256. fi
  257. AC_SUBST(ASYNCIO_SOURCE)
  258. # there are three scenarios
  259. # GNU make is installed as "make"
  260. # GNU make is installed as something else we detected
  261. # GNU make is not installed
  262. # Unfortunately, we can't deal with it one way or the other
  263. # Trying multiple AC_OUTPUT confuses autoconf, and using variables
  264. # *in* AC_OUTPUT is even worse.
  265. # *so*, make a default makefile that just forces make to call gmake
  266. # or whatever.
  267. AC_CONFIG_FILES([Makefile src/Makefile docs/Makefile])
  268. AC_OUTPUT