]> granicus.if.org Git - apache/blob - acinclude.m4
Rewrite ap_byterange_filter so that it can work with data that does not
[apache] / acinclude.m4
1
2 dnl APACHE_HELP_STRING(LHS, RHS)
3 dnl Autoconf 2.50 can not handle substr correctly.  It does have 
4 dnl AC_HELP_STRING, so let's try to call it if we can.
5 dnl Note: this define must be on one line so that it can be properly returned
6 dnl as the help string.
7 AC_DEFUN(APACHE_HELP_STRING,[ifelse(regexp(AC_ACVERSION, 2\.1), -1, AC_HELP_STRING($1,$2),[  ]$1 substr([                       ],len($1))$2)])dnl
8
9 dnl APACHE_SUBST(VARIABLE)
10 dnl Makes VARIABLE available in generated files
11 dnl (do not use @variable@ in Makefiles, but $(variable))
12 AC_DEFUN(APACHE_SUBST,[
13   APACHE_VAR_SUBST="$APACHE_VAR_SUBST $1"
14   AC_SUBST($1)
15 ])
16
17 dnl APACHE_FAST_OUTPUT(FILENAME)
18 dnl Perform substitutions on FILENAME (Makefiles only)
19 AC_DEFUN(APACHE_FAST_OUTPUT,[
20   APACHE_FAST_OUTPUT_FILES="$APACHE_FAST_OUTPUT_FILES $1"
21 ])
22
23 dnl APACHE_MKDIR_P_CHECK
24 dnl checks whether mkdir -p works
25 AC_DEFUN(APACHE_MKDIR_P_CHECK,[
26   AC_CACHE_CHECK(for working mkdir -p, ac_cv_mkdir_p,[
27     test -d conftestdir && rm -rf conftestdir
28     mkdir -p conftestdir/somedir >/dev/null 2>&1
29     if test -d conftestdir/somedir; then
30       ac_cv_mkdir_p=yes
31     else
32       ac_cv_mkdir_p=no
33     fi
34     rm -rf conftestdir
35   ])
36   if test "$ac_cv_mkdir_p" = "yes"; then
37       mkdir_p="mkdir -p"
38   else
39       mkdir_p="$top_srcdir/build/mkdir.sh"
40   fi
41 ])
42
43 dnl APACHE_GEN_CONFIG_VARS
44 dnl Creates config_vars.mk
45 AC_DEFUN(APACHE_GEN_CONFIG_VARS,[
46   APACHE_SUBST(abs_srcdir)
47   APACHE_SUBST(bindir)
48   APACHE_SUBST(sbindir)
49   APACHE_SUBST(cgidir)
50   APACHE_SUBST(logfiledir)
51   APACHE_SUBST(exec_prefix)
52   APACHE_SUBST(datadir)
53   APACHE_SUBST(localstatedir)
54   APACHE_SUBST(mandir)
55   APACHE_SUBST(libdir)
56   APACHE_SUBST(libexecdir)
57   APACHE_SUBST(htdocsdir)
58   APACHE_SUBST(manualdir)
59   APACHE_SUBST(includedir)
60   APACHE_SUBST(errordir)
61   APACHE_SUBST(iconsdir)
62   APACHE_SUBST(sysconfdir)
63   APACHE_SUBST(installbuilddir)
64   APACHE_SUBST(runtimedir)
65   APACHE_SUBST(proxycachedir)
66   APACHE_SUBST(other_targets)
67   APACHE_SUBST(progname)
68   APACHE_SUBST(prefix)
69   APACHE_SUBST(AWK)
70   APACHE_SUBST(CC)
71   APACHE_SUBST(CPP)
72   APACHE_SUBST(CXX)
73   APACHE_SUBST(CPPFLAGS)
74   APACHE_SUBST(CFLAGS)
75   APACHE_SUBST(CXXFLAGS)
76   APACHE_SUBST(LTFLAGS)
77   APACHE_SUBST(LDFLAGS)
78   APACHE_SUBST(LT_LDFLAGS)
79   APACHE_SUBST(SH_LDFLAGS)
80   APACHE_SUBST(HTTPD_LDFLAGS)
81   APACHE_SUBST(UTIL_LDFLAGS)
82   APACHE_SUBST(LIBS)
83   APACHE_SUBST(DEFS)
84   APACHE_SUBST(INCLUDES)
85   APACHE_SUBST(NOTEST_CPPFLAGS)
86   APACHE_SUBST(NOTEST_CFLAGS)
87   APACHE_SUBST(NOTEST_CXXFLAGS)
88   APACHE_SUBST(NOTEST_LDFLAGS)
89   APACHE_SUBST(NOTEST_LIBS)
90   APACHE_SUBST(EXTRA_CPPFLAGS)
91   APACHE_SUBST(EXTRA_CFLAGS)
92   APACHE_SUBST(EXTRA_CXXFLAGS)
93   APACHE_SUBST(EXTRA_LDFLAGS)
94   APACHE_SUBST(EXTRA_LIBS)
95   APACHE_SUBST(EXTRA_INCLUDES)
96   APACHE_SUBST(LIBTOOL)
97   APACHE_SUBST(SHELL)
98   APACHE_SUBST(MODULE_DIRS)
99   APACHE_SUBST(MODULE_CLEANDIRS)
100   APACHE_SUBST(PORT)
101   APACHE_SUBST(CORE_IMPLIB_FILE)
102   APACHE_SUBST(CORE_IMPLIB)
103   APACHE_SUBST(SH_LIBS)
104   APACHE_SUBST(SH_LIBTOOL)
105   APACHE_SUBST(MK_IMPLIB)
106   APACHE_SUBST(INSTALL_PROG_FLAGS)
107   APACHE_SUBST(DSO_MODULES)
108
109   abs_srcdir="`(cd $srcdir && pwd)`"
110
111   echo creating config_vars.mk
112   test -d build || $mkdir_p build
113   > build/config_vars.mk
114   for i in $APACHE_VAR_SUBST; do
115     eval echo "$i = \$$i" >> build/config_vars.mk
116   done
117 ])
118
119 dnl APACHE_GEN_MAKEFILES
120 dnl Creates Makefiles
121 AC_DEFUN(APACHE_GEN_MAKEFILES,[
122   $SHELL $srcdir/build/fastgen.sh $srcdir $ac_cv_mkdir_p $BSD_MAKEFILE $APACHE_FAST_OUTPUT_FILES
123 ])
124
125 dnl ## APACHE_OUTPUT(file)
126 dnl ## adds "file" to the list of files generated by AC_OUTPUT
127 dnl ## This macro can be used several times.
128 AC_DEFUN(APACHE_OUTPUT, [
129   APACHE_OUTPUT_FILES="$APACHE_OUTPUT_FILES $1"
130 ])
131
132 dnl
133 dnl APACHE_TYPE_RLIM_T
134 dnl
135 dnl If rlim_t is not defined, define it to int
136 dnl
137 AC_DEFUN(APACHE_TYPE_RLIM_T, [
138   AC_CACHE_CHECK([for rlim_t], ac_cv_type_rlim_t, [
139     AC_TRY_COMPILE([
140 #include <sys/types.h>
141 #include <sys/time.h>
142 #include <sys/resource.h>
143 ], [rlim_t spoon;], [
144       ac_cv_type_rlim_t=yes
145     ],[ac_cv_type_rlim_t=no
146     ])
147   ])
148   if test "$ac_cv_type_rlim_t" = "no" ; then
149       AC_DEFINE(rlim_t, int,
150           [Define to 'int' if <sys/resource.h> doesn't define it for us])
151   fi
152 ])
153
154 dnl APACHE_MODPATH_INIT(modpath)
155 AC_DEFUN(APACHE_MODPATH_INIT,[
156   current_dir=$1
157   modpath_current=modules/$1
158   modpath_static=
159   modpath_shared=
160   test -d $1 || $srcdir/build/mkdir.sh $modpath_current
161   > $modpath_current/modules.mk
162 ])dnl
163 dnl
164 AC_DEFUN(APACHE_MODPATH_FINISH,[
165   echo "DISTCLEAN_TARGETS = modules.mk" >> $modpath_current/modules.mk
166   echo "static = $modpath_static" >> $modpath_current/modules.mk
167   echo "shared = $modpath_shared" >> $modpath_current/modules.mk
168   if test ! -z "$modpath_static" -o ! -z "$modpath_shared"; then
169     MODULE_DIRS="$MODULE_DIRS $current_dir"
170   else
171     MODULE_CLEANDIRS="$MODULE_CLEANDIRS $current_dir"
172   fi
173   APACHE_FAST_OUTPUT($modpath_current/Makefile)
174 ])dnl
175 dnl
176 dnl APACHE_MODPATH_ADD(name[, shared[, objects [, ldflags[, libs]]]])
177 AC_DEFUN(APACHE_MODPATH_ADD,[
178   if test -z "$3"; then
179     objects="mod_$1.lo"
180   else
181     objects="$3"
182   fi
183
184   if test -z "$module_standalone"; then
185     if test -z "$2"; then
186       libname="mod_$1.la"
187       BUILTIN_LIBS="$BUILTIN_LIBS $modpath_current/$libname"
188       modpath_static="$modpath_static $libname"
189       cat >>$modpath_current/modules.mk<<EOF
190 $libname: $objects
191         \$(MOD_LINK) $objects
192 EOF
193     else
194       apache_need_shared=yes
195       libname="mod_$1.la"
196       shobjects=`echo $objects | sed 's/\.lo/.slo/g'`
197       modpath_shared="$modpath_shared $libname"
198       cat >>$modpath_current/modules.mk<<EOF
199 $libname: $shobjects
200         \$(SH_LINK) -rpath \$(libexecdir) -module -avoid-version $4 $objects $5
201 EOF
202     fi
203   fi
204 ])dnl
205
206 dnl
207 dnl APACHE_MODULE(name, helptext[, objects[, structname[, default[, config]]]])
208 dnl
209 dnl default is one of:
210 dnl   yes    -- enabled by default. user must explicitly disable.
211 dnl   no     -- disabled under default, most, all. user must explicitly enable.
212 dnl   most   -- disabled by default. enabled explicitly or with most or all.
213 dnl   static -- enabled as static by default, must be explicitly changed.
214 dnl   ""     -- disabled under default, most. enabled explicitly or with all.
215 dnl
216 dnl basically: yes/no is a hard setting. "most" means follow the "most"
217 dnl            setting. otherwise, fall under the "all" setting.
218 dnl            explicit yes/no always overrides.
219 dnl
220 AC_DEFUN(APACHE_MODULE,[
221   AC_MSG_CHECKING(whether to enable mod_$1)
222   define([optname],[--]ifelse($5,yes,disable,enable)[-]translit($1,_,-))dnl
223   AC_ARG_ENABLE(translit($1,_,-),APACHE_HELP_STRING(optname(),$2),,enable_$1=ifelse($5,,maybe-all,$5))
224   undefine([optname])dnl
225   _apmod_extra_msg=""
226   dnl When --enable-modules=most is set and the module was not explicitly
227   dnl requested, allow a module to disable itself if its pre-reqs fail.
228   if test "$module_selection" = "most" -a "$enable_$1" = "most"; then
229     _apmod_error_fatal="no"
230   else
231     _apmod_error_fatal="yes"
232   fi
233   if test "$enable_$1" = "static"; then
234     enable_$1=yes
235   elif test "$enable_$1" = "yes"; then
236     enable_$1=$module_default
237     _apmod_extra_msg=" ($module_selection)"
238   elif test "$enable_$1" = "most"; then
239     if test "$module_selection" = "most" -o "$module_selection" = "all"; then
240       enable_$1=$module_default
241       _apmod_extra_msg=" ($module_selection)"
242     elif test "$enable_$1" != "yes"; then
243       enable_$1=no
244     fi
245   elif test "$enable_$1" = "maybe-all"; then
246     if test "$module_selection" = "all"; then
247       enable_$1=$module_default
248       _apmod_extra_msg=" (all)"
249     else
250       enable_$1=no
251     fi
252   fi
253   if test "$enable_$1" != "no"; then
254     dnl If we plan to enable it, allow the module to run some autoconf magic
255     dnl that may disable it because of missing dependencies.
256     ifelse([$6],,:,[AC_MSG_RESULT([checking dependencies])
257                     $6
258                     AC_MSG_CHECKING(whether to enable mod_$1)
259                     if test "$enable_$1" = "no"; then
260                       if test "$_apmod_error_fatal" = "no"; then
261                         _apmod_extra_msg=" (disabled)"
262                       else
263                         AC_MSG_ERROR([mod_$1 has been requested but can not be built due to prerequisite failures])
264                       fi
265                     fi])
266   fi
267   AC_MSG_RESULT($enable_$1$_apmod_extra_msg)
268   if test "$enable_$1" != "no"; then
269     case "$enable_$1" in
270     shared*)
271       enable_$1=`echo $ac_n $enable_$1$ac_c|sed 's/shared,*//'`
272       sharedobjs=yes
273       shared=yes
274       DSO_MODULES="$DSO_MODULES $1"
275       ;;
276     *)
277       MODLIST="$MODLIST ifelse($4,,$1,$4)"
278       if test "$1" = "so"; then
279           sharedobjs=yes
280       fi
281       shared="";;
282     esac
283     APACHE_MODPATH_ADD($1, $shared, $3)
284   fi
285 ])dnl
286
287 dnl
288 dnl APACHE_LAYOUT_DEFAULTS
289 dnl
290 AC_DEFUN(APACHE_LAYOUT_DEFAULTS,[
291   dnl Apache defaults for autoconf variables.
292   test "x${prefix}" = "xNONE" && prefix='/usr/local/apache2'
293   test "x${exec_prefix}" = "xNONE" && exec_prefix='${prefix}'
294   dnl Now we need to check the non-autoconf variables.
295   test "x${cgidir}" = "x" && cgidir='${datadir}/cgi-bin'
296   test "x${logfiledir}" = "x" && logfiledir='${localstatedir}/logs'
297   test "x${htdocsdir}" = "x" && htdocsdir='${datadir}/htdocs'
298   test "x${manualdir}" = "x" && manualdir='${datadir}/manual'
299   test "x${errordir}" = "x" && errordir='${datadir}/error'
300   test "x${iconsdir}" = "x" && iconsdir='${datadir}/icons'
301   test "x${installbuilddir}" = "x" && installbuilddir='${datadir}/build'
302   test "x${runtimedir}" = "x" && runtimedir='${localstatedir}/logs'
303   test "x${proxycachedir}" = "x" && proxycachedir='${localstatedir}/proxy'
304 ])dnl
305
306 dnl
307 dnl APACHE_LAYOUT(configlayout, layoutname)
308 dnl
309 AC_DEFUN(APACHE_LAYOUT,[
310   if test ! -f $srcdir/config.layout; then
311     echo "** Error: Layout file $srcdir/config.layout not found"
312     echo "** Error: Cannot use undefined layout '$LAYOUT'"
313     exit 1
314   fi
315   pldconf=./config.pld
316   changequote({,})
317   sed -e "1,/[  ]*<[lL]ayout[   ]*$2[   ]*>[    ]*/d" \
318       -e '/[    ]*<\/Layout>[   ]*/,$d' \
319       -e "s/^[  ]*//g" \
320       -e "s/:[  ]*/=\'/g" \
321       -e "s/[   ]*$/'/g" \
322       $1 > $pldconf
323   layout_name=$2
324   . $pldconf
325   rm $pldconf
326   for var in prefix exec_prefix bindir sbindir libexecdir mandir \
327              sysconfdir datadir errordir iconsdir htdocsdir cgidir \
328              includedir localstatedir runtimedir logfiledir libdir \
329              manualdir proxycachedir installbuilddir; do
330     eval "val=\"\$$var\""
331     case $val in
332       *+)
333         val=`echo $val | sed -e 's;\+$;;'`
334         eval "$var=\"\$val\""
335         autosuffix=yes
336         ;;
337       *)
338         autosuffix=no
339         ;;
340     esac
341     val=`echo $val | sed -e 's:\(.\)/*$:\1:'`
342     val=`echo $val | sed -e 's:[\$]\([a-z_]*\):${\1}:g'`
343     if test "$autosuffix" = "yes"; then
344       if echo $val | grep apache >/dev/null; then
345         addtarget=no
346       else
347         addtarget=yes
348       fi
349       if test "$addtarget" = "yes"; then
350         val="$val/apache2"
351       fi
352     fi
353     eval "$var='$val'"
354   done
355   changequote([,])
356 ])dnl
357
358 dnl
359 dnl APACHE_ENABLE_LAYOUT
360 dnl
361 AC_DEFUN(APACHE_ENABLE_LAYOUT,[
362 AC_ARG_ENABLE(layout,
363 [  --enable-layout=LAYOUT],[
364   LAYOUT=$enableval
365 ])
366
367 if test -z "$LAYOUT"; then
368   LAYOUT="Apache"
369 fi
370 APACHE_LAYOUT($srcdir/config.layout, $LAYOUT)
371
372 AC_MSG_CHECKING(for chosen layout)
373 AC_MSG_RESULT($layout_name)
374 ])
375
376 dnl
377 dnl APACHE_ENABLE_MODULES
378 dnl
379 AC_DEFUN(APACHE_ENABLE_MODULES,[
380   module_selection=default
381   module_default=yes
382
383   AC_ARG_ENABLE(modules,
384   APACHE_HELP_STRING(--enable-modules=MODULE-LIST,Modules to enable),[
385     for i in $enableval; do
386       if test "$i" = "all" -o "$i" = "most"; then
387         module_selection=$i
388       else
389         eval "enable_$i=yes"
390       fi
391     done
392   ])
393   
394   AC_ARG_ENABLE(mods-shared,
395   APACHE_HELP_STRING(--enable-mods-shared=MODULE-LIST,Shared modules to enable),[
396     for i in $enableval; do
397       if test "$i" = "all" -o "$i" = "most"; then
398         module_selection=$i
399         module_default=shared
400       else
401         i=`echo $i | sed 's/-/_/g'`
402         eval "enable_$i=shared"
403       fi
404     done
405   ])
406 ])
407
408 AC_DEFUN(APACHE_REQUIRE_CXX,[
409   if test -z "$apache_cxx_done"; then
410     AC_PROG_CXX
411     AC_PROG_CXXCPP
412     apache_cxx_done=yes
413   fi
414 ])
415
416 dnl
417 dnl APACHE_CHECK_SSL_TOOLKIT
418 dnl
419 dnl Find the openssl toolkit installation and check it for the right
420 dnl version, then add its flags to INCLUDES and LIBS.  This should
421 dnl really be using a custom AC_TRY_COMPILE function to test the includes
422 dnl and then AC_TRY_LINK to test the libraries directly for the version,
423 dnl but that will require someone who knows how to program openssl.
424 dnl
425 AC_DEFUN(APACHE_CHECK_SSL_TOOLKIT,[
426 if test "x$ap_ssltk_base" = "x"; then
427   AC_MSG_CHECKING(for SSL/TLS toolkit base)
428   ap_ssltk_base=""
429   AC_ARG_WITH(ssl, APACHE_HELP_STRING(--with-ssl=DIR,SSL/TLS toolkit (OpenSSL)), [
430     if test "x$withval" != "xyes" -a "x$withval" != "x"; then
431       ap_ssltk_base="$withval"
432     fi
433   ])
434   if test "x$ap_ssltk_base" = "x"; then
435     AC_CACHE_VAL(ap_cv_ssltk,[
436       #
437       # shotgun approach: find all occurrences of the openssl program
438       #
439       ap_ssltk_try=""
440       # The IFS=... trick eliminates the colons from $PATH, without using an external program
441       for p in `IFS=":$IFS"; echo $PATH` /usr/local/openssl/bin /usr/local/ssl/bin; do
442         if test -f "$p/openssl"; then
443           ap_ssltk_try="$ap_ssltk_try $p"
444         fi
445       done
446       if test "x$ap_ssltk_try" = "x"; then
447         AC_MSG_ERROR(['openssl' not found in path])
448       fi
449       for p in $ap_ssltk_try; do
450         ap_ssltk_version="`$p/openssl version`"
451         case "$ap_ssltk_version" in
452             "OpenSSL "[[1-9]]* | \
453             "OpenSSL "0.9.[[6-9]]* | \
454             "OpenSSL "0.[[1-9]][[0-9]]* )
455                 ap_cv_ssltk="`(cd $p/.. && pwd)`"
456                 break
457                 ;;
458             *)
459                 # skip because it is too old or a bad result
460                 ;;
461         esac
462       done
463       if test "x$ap_cv_ssltk" = "x"; then
464         AC_MSG_ERROR([requires OpenSSL 0.9.6 or higher])
465       fi
466     ])
467     ap_ssltk_base="$ap_cv_ssltk"
468   fi
469   if test ! -d $ap_ssltk_base; then
470     AC_MSG_ERROR([invalid SSL/TLS toolkit base directory $ap_ssltk_base])
471   fi
472   AC_MSG_RESULT($ap_ssltk_base)
473     
474   AC_MSG_CHECKING(for SSL/TLS toolkit version)
475   AC_MSG_RESULT($ap_ssltk_version)
476     
477   AC_MSG_CHECKING(for SSL/TLS toolkit includes)
478   ap_ssltk_incdir=""
479   for p in $ap_ssltk_base/include /usr/local/openssl/include \
480            /usr/local/ssl/include /usr/local/include /usr/include; do
481     if test -f "$p/openssl/ssl.h"; then
482       ap_ssltk_incdir="$p"
483       break
484     elif test -f "$p/ssl.h"; then
485       ap_ssltk_incdir="$p"
486       break
487     fi
488   done
489   if test "x$ap_ssltk_incdir" = "x"; then
490     AC_MSG_ERROR([OpenSSL headers not found])
491   fi
492   AC_MSG_RESULT($ap_ssltk_incdir)
493
494   AC_MSG_CHECKING(for SSL/TLS toolkit libraries)
495   ap_ssltk_libdir=""
496   for p in $ap_ssltk_base/lib /usr/local/openssl/lib \
497            /usr/local/ssl/lib /usr/local/lib /usr/lib /lib; do
498     if test -f "$p/libssl.a" -o -f "$p/libssl.so"; then
499       ap_ssltk_libdir="$p"
500       break
501     fi
502   done
503   if test ".$ap_ssltk_libdir" = .; then
504     AC_MSG_ERROR([OpenSSL libraries not found])
505   fi
506   AC_MSG_RESULT($ap_ssltk_libdir)
507
508   dnl #  annotate the Apache build environment with determined information
509   APR_ADDTO(INCLUDES, [-I$ap_ssltk_incdir/openssl])
510   if test "x$ap_ssltk_incdir" != "x/usr/include"; then
511     APR_ADDTO(INCLUDES, [-I$ap_ssltk_incdir])
512   fi
513   if test "x$ap_ssltk_libdir" != "x/usr/lib"; then
514     APR_ADDTO(LDFLAGS, [-L$ap_ssltk_libdir])
515     if test "x$ap_platform_runtime_link_flag" != "x"; then
516       APR_ADDTO(LDFLAGS, [$ap_platform_runtime_link_flag$ap_ssltk_libdir])
517     fi
518   fi
519   APR_ADDTO(LIBS, [-lssl -lcrypto])
520   ap_cv_ssltk="$ap_ssltk_base"
521 fi
522 ])
523
524 dnl
525 dnl APACHE_PARSE_ARGUMENTS
526 dnl a reimplementation of autoconf's argument parser,
527 dnl used here to allow us to co-exist layouts and argument based
528 dnl set ups.
529 AC_DEFUN(APACHE_PARSE_ARGUMENTS,[
530 ac_prev=
531 for ac_option
532 do
533   # If the previous option needs an argument, assign it.
534   if test -n "$ac_prev"; then
535     eval "$ac_prev=\$ac_option"
536     ac_prev=
537     continue
538   fi
539
540   ac_optarg=`expr "x$ac_option" : 'x[[^=]]*=\(.*\)'`
541
542   case $ac_option in
543
544   -bindir | --bindir | --bindi | --bind | --bin | --bi)
545     ac_prev=bindir ;;
546   -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
547     bindir="$ac_optarg" ;;
548
549   -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
550     ac_prev=datadir ;;
551   -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
552   | --da=*)
553     datadir="$ac_optarg" ;;
554
555   -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
556   | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
557   | --exec | --exe | --ex)
558     ac_prev=exec_prefix ;;
559   -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
560   | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
561   | --exec=* | --exe=* | --ex=*)
562     exec_prefix="$ac_optarg" ;;
563
564   -includedir | --includedir | --includedi | --included | --include \
565   | --includ | --inclu | --incl | --inc)
566     ac_prev=includedir ;;
567   -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
568   | --includ=* | --inclu=* | --incl=* | --inc=*)
569     includedir="$ac_optarg" ;;
570
571   -infodir | --infodir | --infodi | --infod | --info | --inf)
572     ac_prev=infodir ;;
573   -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
574     infodir="$ac_optarg" ;;
575
576   -libdir | --libdir | --libdi | --libd)
577     ac_prev=libdir ;;
578   -libdir=* | --libdir=* | --libdi=* | --libd=*)
579     libdir="$ac_optarg" ;;
580
581   -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
582   | --libexe | --libex | --libe)
583     ac_prev=libexecdir ;;
584   -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
585   | --libexe=* | --libex=* | --libe=*)
586     libexecdir="$ac_optarg" ;;
587
588   -localstatedir | --localstatedir | --localstatedi | --localstated \
589   | --localstate | --localstat | --localsta | --localst \
590   | --locals | --local | --loca | --loc | --lo)
591     ac_prev=localstatedir ;;
592   -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
593   | --localstate=* | --localstat=* | --localsta=* | --localst=* \
594   | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
595     localstatedir="$ac_optarg" ;;
596
597   -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
598     ac_prev=mandir ;;
599   -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
600     mandir="$ac_optarg" ;;
601
602   -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
603     ac_prev=prefix ;;
604   -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
605     prefix="$ac_optarg" ;;
606
607   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
608     ac_prev=sbindir ;;
609   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
610   | --sbi=* | --sb=*)
611     sbindir="$ac_optarg" ;;
612
613   -sharedstatedir | --sharedstatedir | --sharedstatedi \
614   | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
615   | --sharedst | --shareds | --shared | --share | --shar \
616   | --sha | --sh)
617     ac_prev=sharedstatedir ;;
618   -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
619   | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
620   | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
621   | --sha=* | --sh=*)
622     sharedstatedir="$ac_optarg" ;;
623
624   -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
625   | --syscon | --sysco | --sysc | --sys | --sy)
626     ac_prev=sysconfdir ;;
627   -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
628   | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
629     sysconfdir="$ac_optarg" ;;
630
631   esac
632 done
633
634 # Be sure to have absolute paths.
635 for ac_var in exec_prefix prefix
636 do
637   eval ac_val=$`echo $ac_var`
638   case $ac_val in
639     [[\\/$]]* | ?:[[\\/]]* | NONE | '' ) ;;
640     *)  AC_MSG_ERROR([expected an absolute path for --$ac_var: $ac_val]);;
641   esac
642 done
643
644 ])dnl
645
646 dnl
647 dnl APACHE_EXPORT_ARGUMENTS
648 dnl Export (via APACHE_SUBST) the various path-related variables that
649 dnl apache will use while generating scripts like autoconf and apxs and
650 dnl the default config file.
651
652 AC_DEFUN(APACHE_SUBST_EXPANDED_ARG,[
653   APR_EXPAND_VAR(exp_$1, [$]$1)
654   APACHE_SUBST(exp_$1)
655   APR_PATH_RELATIVE(rel_$1, [$]exp_$1, ${prefix})
656   APACHE_SUBST(rel_$1)
657 ])
658
659 AC_DEFUN(APACHE_EXPORT_ARGUMENTS,[
660   APACHE_SUBST_EXPANDED_ARG(exec_prefix)
661   APACHE_SUBST_EXPANDED_ARG(bindir)
662   APACHE_SUBST_EXPANDED_ARG(sbindir)
663   APACHE_SUBST_EXPANDED_ARG(libdir)
664   APACHE_SUBST_EXPANDED_ARG(libexecdir)
665   APACHE_SUBST_EXPANDED_ARG(mandir)
666   APACHE_SUBST_EXPANDED_ARG(sysconfdir)
667   APACHE_SUBST_EXPANDED_ARG(datadir)
668   APACHE_SUBST_EXPANDED_ARG(installbuilddir)
669   APACHE_SUBST_EXPANDED_ARG(errordir)
670   APACHE_SUBST_EXPANDED_ARG(iconsdir)
671   APACHE_SUBST_EXPANDED_ARG(htdocsdir)
672   APACHE_SUBST_EXPANDED_ARG(manualdir)
673   APACHE_SUBST_EXPANDED_ARG(cgidir)
674   APACHE_SUBST_EXPANDED_ARG(includedir)
675   APACHE_SUBST_EXPANDED_ARG(localstatedir)
676   APACHE_SUBST_EXPANDED_ARG(runtimedir)
677   APACHE_SUBST_EXPANDED_ARG(logfiledir)
678   APACHE_SUBST_EXPANDED_ARG(proxycachedir)
679 ])
680