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