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