configure.in.selinux 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716
  1. dnl
  2. dnl Autoconf configuration for Apache httpd
  3. dnl
  4. dnl Use ./buildconf to produce a configure script
  5. dnl
  6. AC_PREREQ(2.13)
  7. AC_INIT(ABOUT_APACHE)
  8. AC_CONFIG_HEADER(include/ap_config_auto.h)
  9. AC_CONFIG_AUX_DIR(build)
  10. dnl #
  11. dnl # Include our own M4 macros along with those for APR and libtool
  12. dnl #
  13. sinclude(build/apr_common.m4)
  14. sinclude(build/find_apr.m4)
  15. sinclude(build/find_apu.m4)
  16. sinclude(acinclude.m4)
  17. dnl Later versions of autoconf (>= 2.62) by default cause the produced
  18. dnl configure script to emit at least warnings when it comes across unknown
  19. dnl command line options. These versions also have the macro
  20. dnl AC_DISABLE_OPTION_CHECKING defined which turns this off by default.
  21. dnl We want to have this turned off here since our configure calls can
  22. dnl contain options for APR / APR-UTIL configure that are unknown to us.
  23. dnl So avoid confusing the user by turning this off. See also PR 45221.
  24. ifdef([AC_DISABLE_OPTION_CHECKING], [AC_DISABLE_OPTION_CHECKING])
  25. dnl XXX we can't just use AC_PREFIX_DEFAULT because that isn't subbed in
  26. dnl by configure until it is too late. Is that how it should be or not?
  27. dnl Something seems broken here.
  28. AC_PREFIX_DEFAULT(/usr/local/apache2)
  29. dnl Get the layout here, so we can pass the required variables to apr
  30. APR_ENABLE_LAYOUT(Apache, [errordir iconsdir htdocsdir cgidir])
  31. dnl reparse the configure arguments.
  32. APR_PARSE_ARGUMENTS
  33. dnl export expanded and relative configure argument variables
  34. APACHE_EXPORT_ARGUMENTS
  35. dnl Save user-defined environment settings for later restoration
  36. dnl
  37. APR_SAVE_THE_ENVIRONMENT(CPPFLAGS)
  38. APR_SAVE_THE_ENVIRONMENT(CFLAGS)
  39. APR_SAVE_THE_ENVIRONMENT(CXXFLAGS)
  40. APR_SAVE_THE_ENVIRONMENT(LDFLAGS)
  41. APR_SAVE_THE_ENVIRONMENT(LIBS)
  42. APR_SAVE_THE_ENVIRONMENT(INCLUDES)
  43. dnl Generate ./config.nice for reproducing runs of configure
  44. dnl
  45. APR_CONFIG_NICE(config.nice)
  46. nl='
  47. '
  48. dnl Check that mkdir -p works
  49. APR_MKDIR_P_CHECK($top_srcdir/build/mkdir.sh)
  50. dnl ## Run configure for packages Apache uses
  51. dnl shared library support for these packages doesn't currently
  52. dnl work on some platforms
  53. AC_CANONICAL_SYSTEM
  54. orig_prefix="$prefix"
  55. echo $ac_n "${nl}Configuring Apache Portable Runtime library ...${nl}"
  56. AC_ARG_WITH(included-apr,
  57. APACHE_HELP_STRING(--with-included-apr,Use bundled copies of APR/APR-Util))
  58. # Only APR 1.x is supported.
  59. apr_version=1
  60. if test "x$with_included_apr" = "xyes"; then
  61. apr_found=reconfig
  62. apr_config="$srcdir/srclib/apr/apr-${apr_version}-config"
  63. else
  64. APR_FIND_APR("$srcdir/srclib/apr", "./srclib/apr", 1, ${apr_version})
  65. fi
  66. if test "$apr_found" = "no"; then
  67. AC_MSG_ERROR([APR not found. Please read the documentation.])
  68. fi
  69. if test "$apr_found" = "reconfig"; then
  70. APR_SUBDIR_CONFIG(srclib/apr,
  71. [$apache_apr_flags --prefix=$prefix --exec-prefix=$exec_prefix --libdir=$libdir --includedir=$includedir --bindir=$bindir --datadir=$datadir --with-installbuilddir=$installbuilddir],
  72. [--enable-layout=*|\'--enable-layout=*])
  73. dnl We must be the first to build and the last to be cleaned
  74. AP_BUILD_SRCLIB_DIRS="apr $AP_BUILD_SRCLIB_DIRS"
  75. AP_CLEAN_SRCLIB_DIRS="$AP_CLEAN_SRCLIB_DIRS apr"
  76. fi
  77. APR_SETIFNULL(CC, `$apr_config --cc`)
  78. APR_SETIFNULL(CPP, `$apr_config --cpp`)
  79. APR_ADDTO(CFLAGS, `$apr_config --cflags`)
  80. APR_ADDTO(CPPFLAGS, `$apr_config --cppflags`)
  81. APR_ADDTO(LDFLAGS, `$apr_config --ldflags`)
  82. SHLIBPATH_VAR=`$apr_config --shlib-path-var`
  83. APR_BINDIR=`$apr_config --bindir`
  84. APR_INCLUDEDIR=`$apr_config --includedir`
  85. APR_VERSION=`$apr_config --version`
  86. APR_CONFIG="$APR_BINDIR/apr-`echo ${APR_VERSION} | sed 's,\..*,,'`-config"
  87. echo $ac_n "${nl}Configuring Apache Portable Runtime Utility library...${nl}"
  88. # Only APR-util 1.x is supported.
  89. apu_version=1
  90. if test "x$with_included_apr" = "xyes"; then
  91. apu_found=reconfig
  92. apu_config="${srcdir}/srclib/apr-util/apu-${apu_version}-config"
  93. else
  94. APR_FIND_APU("$srcdir/srclib/apr-util", "./srclib/apr-util", 1, ${apu_version})
  95. fi
  96. if test "$apu_found" = "no"; then
  97. AC_MSG_ERROR([APR-util not found. Please read the documentation.])
  98. fi
  99. # Catch some misconfigurations:
  100. case ${apr_found}.${apu_found} in
  101. reconfig.yes)
  102. AC_MSG_ERROR([Cannot use an external APR-util with the bundled APR])
  103. ;;
  104. yes.reconfig)
  105. AC_MSG_ERROR([Cannot use an external APR with the bundled APR-util])
  106. ;;
  107. esac
  108. if test "$apu_found" = "reconfig"; then
  109. APR_SUBDIR_CONFIG(srclib/apr-util,
  110. [--with-apr=../apr --prefix=$prefix --exec-prefix=$exec_prefix --libdir=$libdir --includedir=$includedir --bindir=$bindir],
  111. [--enable-layout=*|\'--enable-layout=*])
  112. dnl We must be the last to build and the first to be cleaned
  113. AP_BUILD_SRCLIB_DIRS="$AP_BUILD_SRCLIB_DIRS apr-util"
  114. AP_CLEAN_SRCLIB_DIRS="apr-util $AP_CLEAN_SRCLIB_DIRS"
  115. fi
  116. APR_ADDTO(LDFLAGS, `$apu_config --ldflags`)
  117. APU_BINDIR=`$apu_config --bindir`
  118. APU_INCLUDEDIR=`$apu_config --includedir`
  119. APU_VERSION=`$apu_config --version`
  120. APU_CONFIG="$APU_BINDIR/apu-`echo ${APU_VERSION} | sed 's,\..*,,'`-config"
  121. dnl In case we picked up CC and CPP from APR, get that info into the
  122. dnl config cache so that PCRE uses it. Otherwise, CC and CPP used for
  123. dnl PCRE and for our config tests will be whatever PCRE determines.
  124. AC_PROG_CC
  125. AC_PROG_CPP
  126. if test "x${cache_file}" = "x/dev/null"; then
  127. # Likewise, ensure that CC and CPP are passed through to the pcre
  128. # configure script iff caching is disabled (the autoconf 2.5x default).
  129. export CC; export CPP
  130. fi
  131. dnl Absolute source/build directory
  132. abs_srcdir=`(cd $srcdir && pwd)`
  133. abs_builddir=`pwd`
  134. AC_ARG_WITH(pcre,
  135. APACHE_HELP_STRING(--with-pcre=PATH,Use external PCRE library))
  136. case $with_pcre in
  137. yes) AC_PATH_PROG(PCRE_CONFIG, pcre-config, false) ;;
  138. /*) if test -d "$with_pcre" && test -x "$with_pcre/bin/pcre-config"; then
  139. PCRE_CONFIG=$with_pcre/bin/pcre-config
  140. elif test -x "$with_pcre"; then
  141. PCRE_CONFIG=$with_pcre
  142. fi
  143. if $PCRE_CONFIG --version >/dev/null 2>&1; then :; else
  144. AC_MSG_ERROR([Did not find pcre-config script at $PCRE_CONFIG])
  145. fi
  146. ;;
  147. *) PCRE_CONFIG=false ;;
  148. esac
  149. if test "$PCRE_CONFIG" != "false"; then
  150. AC_MSG_NOTICE([Using external PCRE library from $PCRE_CONFIG])
  151. APR_ADDTO(CFLAGS, [`$PCRE_CONFIG --cflags`])
  152. APR_ADDTO(LIBS, [`$PCRE_CONFIG --libs`])
  153. else
  154. # Build the bundled PCRE
  155. AC_MSG_NOTICE([Configuring PCRE regular expression library])
  156. APR_SUBDIR_CONFIG(srclib/pcre,
  157. [--prefix=$prefix --exec-prefix=$exec_prefix --libdir=$libdir --includedir=$includedir --bindir=$bindir])
  158. APR_ADDTO(AP_LIBS, [$abs_builddir/srclib/pcre/libpcre.la])
  159. APR_ADDTO(INCLUDES, [-I\$(top_builddir)/srclib/pcre])
  160. AP_BUILD_SRCLIB_DIRS="$AP_BUILD_SRCLIB_DIRS pcre"
  161. AP_CLEAN_SRCLIB_DIRS="$AP_CLEAN_SRCLIB_DIRS pcre"
  162. fi
  163. echo $ac_n "${nl}Configuring Apache httpd ...${nl}"
  164. dnl If the source dir is not equal to the build dir,
  165. dnl then we are running in VPATH mode.
  166. APR_ADDTO(INCLUDES, [-I.])
  167. if test "$abs_builddir" != "$abs_srcdir"; then
  168. APR_ADDTO(INCLUDES, [-I\$(top_builddir)/include])
  169. fi
  170. APR_ADDTO(INCLUDES, [-I\$(top_srcdir)/os/\$(OS_DIR) -I\$(top_srcdir)/server/mpm/\$(MPM_SUBDIR_NAME) -I\$(top_srcdir)/modules/http -I\$(top_srcdir)/modules/filters -I\$(top_srcdir)/modules/proxy -I\$(top_srcdir)/include -I\$(top_srcdir)/modules/generators -I\$(top_srcdir)/modules/mappers -I\$(top_srcdir)/modules/database])
  171. # apr/apr-util --includes may pick up system paths for dependent
  172. # libraries, so ensure these are later in INCLUDES than local source
  173. # directories.
  174. APR_ADDTO(INCLUDES, `$apr_config --includes`)
  175. APR_ADDTO(INCLUDES, `$apu_config --includes`)
  176. echo $ac_n "${nl}Applying OS-specific hints for httpd ...${nl}"
  177. case $host in
  178. *os2*)
  179. # Use a custom made libtool replacement
  180. echo "using aplibtool"
  181. LIBTOOL="$abs_srcdir/srclib/apr/build/aplibtool"
  182. SH_LIBTOOL="$LIBTOOL --shared --export-all"
  183. SH_LIBS="\$(ALL_LIBS)"
  184. CORE_IMPLIB_FILE="ApacheCoreOS2.la"
  185. CORE_IMPLIB="$abs_srcdir/server/$CORE_IMPLIB_FILE"
  186. MK_IMPLIB="emximp"
  187. other_targets="$other_targets os2core"
  188. INSTALL_PROG_FLAGS="-e .exe"
  189. SHLTCFLAGS=""
  190. LTCFLAGS=""
  191. ;;
  192. *)
  193. if test "x$LTFLAGS" = "x"; then
  194. LTFLAGS='--silent'
  195. fi
  196. my_libtool=`$apr_config --apr-libtool`
  197. LIBTOOL="$my_libtool \$(LTFLAGS)"
  198. libtoolversion=`$my_libtool --version`
  199. case $libtoolversion in
  200. *1.[[45]]* | *[[2-9]].[[0-9]]*)
  201. SH_LIBTOOL='$(LIBTOOL)'
  202. SHLTCFLAGS="-prefer-pic"
  203. LTCFLAGS="-prefer-non-pic -static"
  204. ;;
  205. *)
  206. SH_LIBTOOL='$(SHELL) $(top_builddir)/shlibtool $(LTFLAGS)'
  207. SHLTCFLAGS=""
  208. LTCFLAGS=""
  209. ;;
  210. esac
  211. ;;
  212. esac
  213. APACHE_SUBST(SHLTCFLAGS)
  214. APACHE_SUBST(LTCFLAGS)
  215. case $host in
  216. *-apple-aux3*)
  217. APR_SETVAR(APACHE_MPM, [prefork])
  218. APR_SETVAR(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, [1])
  219. ;;
  220. *-beos*)
  221. APR_SETVAR(APACHE_MPM, [beos])
  222. APR_SETVAR(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, [1])
  223. ;;
  224. *os2-emx*)
  225. APR_SETVAR(APACHE_MPM, [mpmt_os2])
  226. APR_SETVAR(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, [1])
  227. ;;
  228. *-linux-*)
  229. case `uname -r` in
  230. 2.[[2-9]]* )
  231. APR_SETVAR(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, [1])
  232. ;;
  233. * )
  234. ;;
  235. esac
  236. ;;
  237. *486-*-bsdi* | *-netbsd* | *-freebsd* | *-apple-darwin* | *-dec-osf* | *-qnx)
  238. APR_SETVAR(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, [1])
  239. ;;
  240. *-solaris2*)
  241. dnl This is a hack -- we should be using AC_TRY_RUN instead
  242. ap_platform_runtime_link_flag="-R"
  243. dnl solaris 8 and above don't have a thundering herd
  244. dnl not sure about rev's before this one.
  245. case `uname -r` in
  246. 5.[567]*)
  247. ;;
  248. * )
  249. APR_SETVAR(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, [1])
  250. ;;
  251. esac
  252. ;;
  253. *cygwin*)
  254. APR_SETVAR(APACHE_MPM, [prefork])
  255. APR_SETVAR(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, [1])
  256. ;;
  257. *aix*)
  258. aixver=`echo $host | sed 's/^[[^0-9]]*//' | sed 's/\.//g'`
  259. if test $aixver -ge 4320; then
  260. APR_SETVAR(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, [1])
  261. fi
  262. ;;
  263. *os390*)
  264. APR_SETVAR(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, [1])
  265. ;;
  266. esac
  267. APR_SETVAR(AP_NONBLOCK_WHEN_MULTI_LISTEN, [1])
  268. dnl
  269. dnl Process command line arguments. This is done early in the process so the
  270. dnl user can get feedback quickly in case of an error.
  271. dnl
  272. dnl ### need to move some of the arguments "up here"
  273. dnl ## Check for programs
  274. AC_PATH_PROG(RM, rm)
  275. AC_PATH_PROG(PKGCONFIG, pkg-config)
  276. AC_PATH_PROG(RSYNC, rsync)
  277. AC_PROG_AWK
  278. AC_PROG_LN_S
  279. AC_CHECK_TOOL(RANLIB, ranlib, true)
  280. dnl AC_PATH_PROG(PERL_PATH, perl)
  281. AC_CHECK_PROGS(LYNX_PATH,[lynx links elinks], [lynx])
  282. # Hard-coded install programs
  283. MKINSTALLDIRS="\$(abs_srcdir)/build/mkdir.sh"
  284. INSTALL="\$(LIBTOOL) --mode=install \$(abs_srcdir)/build/install.sh -c"
  285. APACHE_SUBST(MKINSTALLDIRS)
  286. APACHE_SUBST(INSTALL)
  287. dnl Various OS checks that apparently set required flags
  288. ifdef([AC_USE_SYSTEM_EXTENSIONS], [
  289. AC_USE_SYSTEM_EXTENSIONS
  290. ], [
  291. AC_AIX
  292. AC_MINIX
  293. ])
  294. AC_ISC_POSIX
  295. # Ensure that satisfactory versions of apr and apr-util are
  296. # found if external copies are configured.
  297. if test "${apr_found}" = "yes"; then
  298. # Require APR 1.2.x otherwise fail
  299. APACHE_CHECK_APxVER([apr], 1, 2)
  300. fi
  301. if test "${apu_found}" = "yes"; then
  302. # Require APR-util 1.2.x otherwise fail
  303. APACHE_CHECK_APxVER([apu], 1, 2)
  304. fi
  305. dnl Check for what we can generate dependency files with
  306. APR_CHECK_DEPEND
  307. dnl ## Check for libraries
  308. dnl ## Check for header files
  309. dnl I think these are just used all over the place, so just check for
  310. dnl them at the base of the tree. If some are specific to a single
  311. dnl directory, they should be moved (Comment #Spoon)
  312. dnl Regarding standard header files: AC_HEADER_STDC doesn't set symbols
  313. dnl HAVE_STRING_H, HAVE_STDLIB_H, etc., so those are checked for
  314. dnl explicitly so that the normal HAVE_xxx_H symbol is defined.
  315. AC_HEADER_STDC
  316. AC_CHECK_HEADERS( \
  317. string.h \
  318. limits.h \
  319. unistd.h \
  320. sys/socket.h \
  321. pwd.h \
  322. grp.h \
  323. strings.h \
  324. sys/prctl.h \
  325. sys/processor.h \
  326. sys/sem.h
  327. )
  328. AC_HEADER_SYS_WAIT
  329. dnl ## Check for typedefs, structures, and compiler characteristics.
  330. AC_C_CONST
  331. dnl ## Check for library functions
  332. AC_SEARCH_LIBS(sqrt, m)
  333. dnl See Comment #Spoon
  334. AC_CHECK_FUNCS( \
  335. getpwnam \
  336. getgrnam \
  337. initgroups \
  338. bindprocessor \
  339. prctl \
  340. timegm \
  341. getpgid
  342. )
  343. dnl confirm that a void pointer is large enough to store a long integer
  344. APACHE_CHECK_VOID_PTR_LEN
  345. dnl ## Check for the tm_gmtoff field in struct tm to get the timezone diffs
  346. AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_struct_tm_gmtoff,
  347. [AC_TRY_COMPILE([#include <sys/types.h>
  348. #include <time.h>], [struct tm tm; tm.tm_gmtoff;],
  349. ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no)])
  350. if test "$ac_cv_struct_tm_gmtoff" = "yes"; then
  351. AC_DEFINE(HAVE_GMTOFF, 1, [Define if struct tm has a tm_gmtoff field])
  352. fi
  353. dnl ## Set up any appropriate OS-specific environment variables for apachectl
  354. case $host in
  355. *aix*)
  356. # for 32-bit builds, increase MAXDATA to allow lots of threads
  357. if test x$OBJECT_MODE != x64; then
  358. OS_SPECIFIC_VARS="LDR_CNTRL=\"MAXDATA=0x80000000\" ; export LDR_CNTRL ;"
  359. fi
  360. OS_SPECIFIC_VARS="$OS_SPECIFIC_VARS AIXTHREAD_SCOPE=S ; export AIXTHREAD_SCOPE"
  361. OS_SPECIFIC_VARS="$OS_SPECIFIC_VARS ; AIXTHREAD_MUTEX_DEBUG=OFF ; export AIXTHREAD_MUTEX_DEBUG"
  362. OS_SPECIFIC_VARS="$OS_SPECIFIC_VARS ; AIXTHREAD_RWLOCK_DEBUG=OFF ; export AIXTHREAD_RWLOCK_DEBUG"
  363. OS_SPECIFIC_VARS="$OS_SPECIFIC_VARS ; AIXTHREAD_COND_DEBUG=OFF ; export AIXTHREAD_COND_DEBUG"
  364. OS_SPECIFIC_VARS="$OS_SPECIFIC_VARS ; SPINLOOPTIME=1000 ; export SPINLOOPTIME"
  365. OS_SPECIFIC_VARS="$OS_SPECIFIC_VARS ; YIELDLOOPTIME=8 ; export YIELDLOOPTIME"
  366. OS_SPECIFIC_VARS="$OS_SPECIFIC_VARS ; MALLOCMULTIHEAP=considersize,heaps:8 ; export MALLOCMULTIHEAP"
  367. ;;
  368. *os390*)
  369. OS_SPECIFIC_VARS="export _CEE_RUNOPTS=\"STACK(,,ANY)\" ; export _EDC_ADD_ERRNO2=1"
  370. ;;
  371. *)
  372. OS_SPECIFIC_VARS=""
  373. esac
  374. AC_ARG_WITH(port,APACHE_HELP_STRING(--with-port=PORT,Port on which to listen (default is 80)),
  375. [if test "$withval" = "yes"; then AC_MSG_ERROR('option --with-port requires a value (the TCP port number)'); else PORT="$withval"; fi],
  376. [PORT=80])
  377. AC_ARG_WITH(sslport,APACHE_HELP_STRING(--with-sslport=SSLPORT,Port on which to securelisten (default is 443)),
  378. [if test "$withval" = "yes"; then AC_MSG_ERROR('option --with-sslport requires a value (the SSL TCP port number)'); else SSLPORT="$withval"; fi],
  379. [SSLPORT=443])
  380. APR_CHECK_APR_DEFINE(APR_HAVE_IPV6)
  381. AC_ARG_ENABLE(v4-mapped,APACHE_HELP_STRING(--enable-v4-mapped,Allow IPv6 sockets to handle IPv4 connections),
  382. [
  383. v4mapped=$enableval
  384. ],
  385. [
  386. case $host in
  387. *freebsd5*|*netbsd*|*openbsd*)
  388. v4mapped=no
  389. ;;
  390. *)
  391. v4mapped=yes
  392. ;;
  393. esac
  394. ])
  395. if test $v4mapped = "yes" -a $ac_cv_define_APR_HAVE_IPV6 = "yes"; then
  396. AC_DEFINE(AP_ENABLE_V4_MAPPED, 1,
  397. [Allow IPv4 connections on IPv6 listening sockets])
  398. fi
  399. AC_ARG_ENABLE(exception-hook,APACHE_HELP_STRING(--enable-exception-hook,Enable fatal exception hook),
  400. [
  401. AC_DEFINE(AP_ENABLE_EXCEPTION_HOOK, 1,
  402. [Allow modules to run hook after a fatal exception])
  403. ])dnl
  404. AC_ARG_ENABLE(maintainer-mode,APACHE_HELP_STRING(--enable-maintainer-mode,Turn on debugging and compile time warnings),
  405. [
  406. APR_ADDTO(CPPFLAGS, -DAP_DEBUG)
  407. ])dnl
  408. dnl Conditionally enable PIE support for GNU toolchains.
  409. AC_ARG_ENABLE(pie,APACHE_HELP_STRING(--enable-pie,Build httpd as a Position Independent Executable))
  410. if test "$enable_pie" = "yes"; then
  411. AC_CACHE_CHECK([whether $CC accepts PIE flags], [ap_cv_cc_pie], [
  412. save_CFLAGS=$CFLAGS
  413. save_LDFLAGS=$LDFLAGS
  414. CFLAGS="$CFLAGS -fPIE"
  415. LDFLAGS="$LDFLAGS -pie"
  416. AC_TRY_RUN([static int foo[30000]; int main () { return 0; }],
  417. [ap_cv_cc_pie=yes], [ap_cv_cc_pie=no], [ap_cv_cc_pie=yes])
  418. CFLAGS=$save_CFLAGS
  419. LDFLAGS=$save_LDFLAGS
  420. ])
  421. if test "$ap_cv_cc_pie" = "yes"; then
  422. PICFLAGS="-fPIE"
  423. PILDFLAGS="-pie"
  424. else
  425. AC_ERROR([--enable-pie requested but $CC failed using PIE flags])
  426. fi
  427. fi
  428. AC_SUBST(PICFLAGS)
  429. AC_SUBST(PILDFLAGS)
  430. prefix="$orig_prefix"
  431. APACHE_ENABLE_MODULES
  432. dnl reading config stubs
  433. esyscmd(./build/config-stubs .)
  434. APACHE_SUBST(progname)
  435. APACHE_SUBST(MPM_LIB)
  436. APACHE_SUBST(OS)
  437. APACHE_SUBST(OS_DIR)
  438. APACHE_SUBST(BUILTIN_LIBS)
  439. APACHE_SUBST(SHLIBPATH_VAR)
  440. APACHE_SUBST(OS_SPECIFIC_VARS)
  441. PRE_SHARED_CMDS='echo ""'
  442. POST_SHARED_CMDS='echo ""'
  443. dnl apache_need_shared tells us if Apache modules are being built as DSOs
  444. if test "$apache_need_shared" = "yes"; then
  445. if test -f $ac_aux_dir/ltconfig; then
  446. $SHELL $ac_aux_dir/ltconfig --output=shlibtool --disable-static --srcdir=$ac_aux_dir --cache-file=./config.cache $ac_aux_dir/ltmain.sh
  447. fi
  448. shared_build="shared-build"
  449. fi
  450. dnl enable_so tells us if *any* modules can be built as DSOs
  451. if test "$enable_so" = "yes"; then
  452. case $host in
  453. *-ibm-aix*)
  454. HTTPD_LDFLAGS="$HTTPD_LDFLAGS -Wl,-uXML_Parse -Wl,-bE:$abs_builddir/server/httpd.exp"
  455. SH_LDFLAGS="$SH_LDFLAGS \$(EXTRA_LDFLAGS) \$(EXTRA_LIBS)"
  456. UTIL_LDFLAGS="$UTIL_LDFLAGS -Wl,-uXML_Parse"
  457. ;;
  458. *beos)
  459. SH_LDFLAGS='$(top_builddir)/_APP_'
  460. PRE_SHARED_CMDS='ln -s $(top_builddir)/httpd $(top_builddir)/_APP_'
  461. POST_SHARED_CMDS='rm $(top_builddir)/_APP_'
  462. ;;
  463. *os390)
  464. HTTPD_LDFLAGS="$HTTPD_LDFLAGS --main=$abs_srcdir/server/main.o --core-dll=$abs_srcdir/apachecore.dll"
  465. SH_LDFLAGS="$SH_LDFLAGS --core-dll=$abs_srcdir/apachecore.dll"
  466. esac
  467. fi
  468. APACHE_SUBST(PRE_SHARED_CMDS)
  469. APACHE_SUBST(POST_SHARED_CMDS)
  470. APACHE_SUBST(shared_build)
  471. AC_ARG_WITH(program-name,
  472. APACHE_HELP_STRING(--with-program-name,alternate executable name),[
  473. progname="$withval" ], [
  474. progname="httpd"] )
  475. # SuExec parameters
  476. AC_ARG_WITH(suexec-bin,
  477. APACHE_HELP_STRING(--with-suexec-bin,Path to suexec binary),[
  478. AC_DEFINE_UNQUOTED(SUEXEC_BIN, "$withval", [Path to suexec binary] )
  479. ] )
  480. AC_ARG_WITH(suexec-caller,
  481. APACHE_HELP_STRING(--with-suexec-caller,User allowed to call SuExec),[
  482. AC_DEFINE_UNQUOTED(AP_HTTPD_USER, "$withval", [User allowed to call SuExec] ) ] )
  483. AC_ARG_WITH(suexec-userdir,
  484. APACHE_HELP_STRING(--with-suexec-userdir,User subdirectory),[
  485. AC_DEFINE_UNQUOTED(AP_USERDIR_SUFFIX, "$withval", [User subdirectory] ) ] )
  486. AC_ARG_WITH(suexec-docroot,
  487. APACHE_HELP_STRING(--with-suexec-docroot,SuExec root directory),[
  488. AC_DEFINE_UNQUOTED(AP_DOC_ROOT, "$withval", [SuExec root directory] ) ] )
  489. AC_ARG_WITH(suexec-uidmin,
  490. APACHE_HELP_STRING(--with-suexec-uidmin,Minimal allowed UID),[
  491. AC_DEFINE_UNQUOTED(AP_UID_MIN, $withval, [Minimum allowed UID] ) ] )
  492. AC_ARG_WITH(suexec-gidmin,
  493. APACHE_HELP_STRING(--with-suexec-gidmin,Minimal allowed GID),[
  494. AC_DEFINE_UNQUOTED(AP_GID_MIN, $withval, [Minimum allowed GID] ) ] )
  495. AC_ARG_WITH(suexec-logfile,
  496. APACHE_HELP_STRING(--with-suexec-logfile,Set the logfile),[
  497. AC_DEFINE_UNQUOTED(AP_LOG_EXEC, "$withval", [SuExec log file] ) ] )
  498. AC_ARG_WITH(suexec-safepath,
  499. APACHE_HELP_STRING(--with-suexec-safepath,Set the safepath),[
  500. AC_DEFINE_UNQUOTED(AP_SAFE_PATH, "$withval", [safe shell path for SuExec] ) ] )
  501. AC_ARG_WITH(suexec-umask,
  502. APACHE_HELP_STRING(--with-suexec-umask,umask for suexec'd process),[
  503. AC_DEFINE_UNQUOTED(AP_SUEXEC_UMASK, 0$withval, [umask for suexec'd process] ) ] )
  504. dnl APR should go after the other libs, so the right symbols can be picked up
  505. apulinklibs="`$apu_config --link-libtool`"
  506. AP_LIBS="$AP_LIBS $apulinklibs `$apr_config --link-libtool`"
  507. APACHE_SUBST(AP_LIBS)
  508. APACHE_SUBST(AP_BUILD_SRCLIB_DIRS)
  509. APACHE_SUBST(AP_CLEAN_SRCLIB_DIRS)
  510. AC_DEFINE(AP_USING_AUTOCONF, 1,
  511. [Using autoconf to configure Apache])
  512. if test "$SINGLE_LISTEN_UNSERIALIZED_ACCEPT" = "1"; then
  513. AC_DEFINE(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, 1,
  514. [This platform doesn't suffer from the thundering herd problem])
  515. fi
  516. if test "$AP_NONBLOCK_WHEN_MULTI_LISTEN" = "1"; then
  517. AC_DEFINE(AP_NONBLOCK_WHEN_MULTI_LISTEN, 1,
  518. [Listening sockets are non-blocking when there are more than 1])
  519. fi
  520. APACHE_FAST_OUTPUT(Makefile modules/Makefile srclib/Makefile)
  521. APACHE_FAST_OUTPUT(os/Makefile server/Makefile)
  522. APACHE_FAST_OUTPUT(support/Makefile srclib/pcre/Makefile)
  523. if test -d ./test; then
  524. APACHE_FAST_OUTPUT(test/Makefile)
  525. fi
  526. dnl ## Finalize the variables
  527. echo $ac_n "${nl}Restore user-defined environment settings...${nl}"
  528. APR_RESTORE_THE_ENVIRONMENT(CPPFLAGS, EXTRA_)
  529. APR_RESTORE_THE_ENVIRONMENT(CFLAGS, EXTRA_)
  530. APR_RESTORE_THE_ENVIRONMENT(CXXFLAGS, EXTRA_)
  531. APR_RESTORE_THE_ENVIRONMENT(LDFLAGS, EXTRA_)
  532. APR_RESTORE_THE_ENVIRONMENT(LIBS, EXTRA_)
  533. APR_RESTORE_THE_ENVIRONMENT(INCLUDES, EXTRA_)
  534. echo $ac_n "${nl}Construct makefiles and header files...${nl}"
  535. APACHE_GEN_CONFIG_VARS
  536. dnl ## Build modules.c
  537. rm -f modules.c
  538. echo $MODLIST | $AWK -f $srcdir/build/build-modules-c.awk > modules.c
  539. APR_EXPAND_VAR(ap_prefix, $prefix)
  540. AC_DEFINE_UNQUOTED(HTTPD_ROOT, "${ap_prefix}",
  541. [Root directory of the Apache install area])
  542. AC_DEFINE_UNQUOTED(SERVER_CONFIG_FILE, "${rel_sysconfdir}/${progname}.conf",
  543. [Location of the config file, relative to the Apache root directory])
  544. AC_DEFINE_UNQUOTED(AP_TYPES_CONFIG_FILE, "${rel_sysconfdir}/mime.types",
  545. [Location of the MIME types config file, relative to the Apache root directory])
  546. AC_DEFINE_UNQUOTED(APACHE_MPM_DIR, "$MPM_DIR",
  547. [Location of the source for the current MPM])
  548. perlbin=`$ac_aux_dir/PrintPath perl`
  549. if test "x$perlbin" = "x"; then
  550. perlbin="/replace/with/path/to/perl/interpreter"
  551. fi
  552. AC_SUBST(perlbin)
  553. dnl If we are running on BSD/OS, we need to use the BSD .include syntax.
  554. BSD_MAKEFILE=no
  555. ap_make_include=include
  556. ap_make_delimiter=' '
  557. case $host in
  558. *bsdi*)
  559. # Check whether they've installed GNU make
  560. if make --version > /dev/null 2>&1; then
  561. true
  562. else
  563. BSD_MAKEFILE=yes
  564. ap_make_include=.include
  565. ap_make_delimiter='"'
  566. fi
  567. ;;
  568. esac
  569. AC_SUBST(ap_make_include)
  570. AC_SUBST(ap_make_delimiter)
  571. dnl Ensure that docs/conf is created.
  572. test -d docs/conf||$mkdir_p docs/conf
  573. dnl Ensure that the httpd version is included
  574. HTTPD_VERSION=`$abs_srcdir/build/get-version.sh all $abs_srcdir/include/ap_release.h AP_SERVER`
  575. AC_SUBST(HTTPD_VERSION)
  576. AC_OUTPUT($APACHE_OUTPUT_FILES docs/conf/httpd.conf docs/conf/extra/httpd-autoindex.conf docs/conf/extra/httpd-dav.conf docs/conf/extra/httpd-default.conf docs/conf/extra/httpd-info.conf docs/conf/extra/httpd-languages.conf docs/conf/extra/httpd-manual.conf docs/conf/extra/httpd-mpm.conf docs/conf/extra/httpd-multilang-errordoc.conf docs/conf/extra/httpd-ssl.conf docs/conf/extra/httpd-userdir.conf docs/conf/extra/httpd-vhosts.conf include/ap_config_layout.h support/apxs support/apachectl support/dbmmanage support/envvars-std support/log_server_status support/logresolve.pl support/phf_abuse_log.cgi support/split-logfile build/rules.mk build/pkg/pkginfo build/config_vars.sh,[true],[
  577. APACHE_GEN_MAKEFILES
  578. ])
  579. case $MPM_SUBDIR_NAME in
  580. *experimental*)
  581. echo ""
  582. echo ""
  583. echo "============================================================"
  584. echo " WARNING: THE '${APACHE_MPM}' MPM IS EXPERIMENTAL"
  585. echo "============================================================"
  586. echo " The selected MPM might not be fully functional!"
  587. echo ""
  588. echo " Development of this MPM is not complete. Do not use this"
  589. echo " MPM unless you are a programmer willing to help fix it."
  590. echo ""
  591. echo " If you are looking for a stable server, you should not use"
  592. echo " the '${APACHE_MPM}' MPM until it is moved out of experimental."
  593. echo "============================================================"
  594. echo ""
  595. echo ""
  596. ;;
  597. esac