]> granicus.if.org Git - apache/blob - acinclude.m4
Tweak a message. No function change.
[apache] / acinclude.m4
1  
2 AC_DEFUN(APACHE_PASSTHRU,[
3   unset ac_cv_pass_$1
4   AC_CACHE_VAL(ac_cv_pass_$1, [ac_cv_pass_$1=$$1])
5 ])
6
7 dnl APACHE_SUBST(VARIABLE)
8 dnl Makes VARIABLE available in generated files
9 dnl (do not use @variable@ in Makefiles, but $(variable))
10 AC_DEFUN(APACHE_SUBST,[
11   APACHE_VAR_SUBST="$APACHE_VAR_SUBST $1"
12   AC_SUBST($1)
13 ])
14
15 dnl APACHE_FAST_OUTPUT(FILENAME)
16 dnl Perform substitutions on FILENAME (Makefiles only)
17 AC_DEFUN(APACHE_FAST_OUTPUT,[
18   APACHE_FAST_OUTPUT_FILES="$APACHE_FAST_OUTPUT_FILES $1"
19 ])
20
21 dnl APACHE_MKDIR_P_CHECK
22 dnl checks whether mkdir -p works
23 AC_DEFUN(APACHE_MKDIR_P_CHECK,[
24   AC_CACHE_CHECK(for working mkdir -p, ac_cv_mkdir_p,[
25     test -d conftestdir && rm -rf conftestdir
26     mkdir -p conftestdir/somedir >/dev/null 2>&1
27     if test -d conftestdir/somedir; then
28       ac_cv_mkdir_p=yes
29     else
30       ac_cv_mkdir_p=no
31     fi
32     rm -rf conftestdir
33   ])
34 ])
35
36 dnl APACHE_GEN_CONFIG_VARS
37 dnl Creates config_vars.mk
38 AC_DEFUN(APACHE_GEN_CONFIG_VARS,[
39   APACHE_SUBST(abs_srcdir)
40   APACHE_SUBST(bindir)
41   APACHE_SUBST(sbindir)
42   APACHE_SUBST(cgidir)
43   APACHE_SUBST(logfiledir)
44   APACHE_SUBST(exec_prefix)
45   APACHE_SUBST(datadir)
46   APACHE_SUBST(localstatedir)
47   APACHE_SUBST(libexecdir)
48   APACHE_SUBST(htdocsdir)
49   APACHE_SUBST(includedir)
50   APACHE_SUBST(iconsdir)
51   APACHE_SUBST(sysconfdir)
52   APACHE_SUBST(other_targets)
53   APACHE_SUBST(progname)
54   APACHE_SUBST(prefix)
55   APACHE_SUBST(AWK)
56   APACHE_SUBST(CC)
57   APACHE_SUBST(CFLAGS)
58   APACHE_SUBST(CPPFLAGS)
59   APACHE_SUBST(CXX)
60   APACHE_SUBST(CXXFLAGS)
61   APACHE_SUBST(LTFLAGS)
62   APACHE_SUBST(LDFLAGS)
63   APACHE_SUBST(SH_LDFLAGS)
64   APACHE_SUBST(HTTPD_LDFLAGS)
65   APACHE_SUBST(DEFS)
66   APACHE_SUBST(LIBTOOL)
67   APACHE_SUBST(SHELL)
68   APACHE_SUBST(MODULE_DIRS)
69   APACHE_SUBST(PORT)
70   APACHE_SUBST(NOTEST_CFLAGS)
71   APACHE_SUBST(NOTEST_LDFLAGS)
72   APACHE_SUBST(CORE_IMPLIB_FILE)
73   APACHE_SUBST(CORE_IMPLIB)
74   APACHE_SUBST(SH_LIBTOOL)
75   APACHE_SUBST(MK_IMPLIB)
76
77   abs_srcdir="`(cd $srcdir && pwd)`"
78
79   APACHE_MKDIR_P_CHECK
80   echo creating config_vars.mk
81   > config_vars.mk
82   for i in $APACHE_VAR_SUBST; do
83     eval echo "$i = \$$i" >> config_vars.mk
84   done
85 ])
86
87 dnl APACHE_GEN_MAKEFILES
88 dnl Creates Makefiles
89 AC_DEFUN(APACHE_GEN_MAKEFILES,[
90   $SHELL $srcdir/build/fastgen.sh $srcdir $ac_cv_mkdir_p $BSD_MAKEFILE $APACHE_FAST_OUTPUT_FILES
91 ])
92
93 AC_DEFUN(APACHE_LIBTOOL_SILENT,[
94   LIBTOOL='$(SHELL) $(top_builddir)/libtool --silent'
95 ])
96
97     
98 dnl ## APACHE_OUTPUT(file)
99 dnl ## adds "file" to the list of files generated by AC_OUTPUT
100 dnl ## This macro can be used several times.
101 AC_DEFUN(APACHE_OUTPUT, [
102   APACHE_OUTPUT_FILES="$APACHE_OUTPUT_FILES $1"
103 ])
104
105 dnl
106 dnl AC_ADD_LIBRARY(library)
107 dnl
108 dnl add a library to the link line
109 dnl
110 AC_DEFUN(AC_ADD_LIBRARY,[
111   APACHE_ONCE(LIBRARY, $1, [
112     EXTRA_LIBS="$EXTRA_LIBS -l$1"
113   ])
114 ])
115
116 dnl
117 dnl AC_CHECK_DEFINE(macro, headerfile)
118 dnl
119 dnl checks for the macro in the header file
120 dnl
121 AC_DEFUN(AC_CHECK_DEFINE,[
122   AC_CACHE_CHECK(for $1 in $2, ac_cv_define_$1,
123   AC_EGREP_CPP([YES_IS_DEFINED], [
124 #include <$2>
125 #ifdef $1
126 YES_IS_DEFINED
127 #endif
128   ], ac_cv_define_$1=yes, ac_cv_define_$1=no))
129   if test "$ac_cv_define_$1" = "yes" ; then
130       AC_DEFINE(HAVE_$1,,
131           [Define if the macro "$1" is defined on this system])
132   fi
133 ])
134
135 dnl
136 dnl AC_TYPE_RLIM_T
137 dnl
138 dnl If rlim_t is not defined, define it to int
139 dnl
140 AC_DEFUN(AC_TYPE_RLIM_T, [
141   AC_CACHE_CHECK([for rlim_t], ac_cv_type_rlim_t, [
142     AC_TRY_COMPILE([
143 #include <sys/types.h>
144 #include <sys/time.h>
145 #include <sys/resource.h>
146 ], [rlim_t spoon;], [
147       ac_cv_type_rlim_t=yes
148     ],[ac_cv_type_rlim_t=no
149     ])
150   ])
151   if test "$ac_cv_type_rlim_t" = "no" ; then
152       AC_DEFINE(rlim_t, int,
153           [Define to 'int' if <sys/resource.h> doesn't define it for us])
154   fi
155 ])
156
157 dnl
158 dnl APACHE_ONCE(namespace, variable, code)
159 dnl
160 dnl execute code, if variable is not set in namespace
161 dnl
162 AC_DEFUN(APACHE_ONCE,[
163   unique=`echo $ac_n "$2$ac_c" | tr -cd a-zA-Z0-9`
164   cmd="echo $ac_n \"\$$1$unique$ac_c\""
165   if test -n "$unique" && test "`eval $cmd`" = "" ; then
166     eval "$1$unique=set"
167     $3
168   fi
169 ])
170
171 dnl APACHE_MODPATH_INIT(modpath)
172 AC_DEFUN(APACHE_MODPATH_INIT,[
173   current_dir=$1
174   modpath_current=modules/$1
175   modpath_static=
176   modpath_shared=
177   test -d $1 || $srcdir/build/mkdir.sh $modpath_current
178   > $modpath_current/modules.mk
179 ])dnl
180 dnl
181 AC_DEFUN(APACHE_MODPATH_FINISH,[
182   echo "DISTCLEAN_TARGETS = modules.mk" >> $modpath_current/modules.mk
183   echo "static = $modpath_static" >> $modpath_current/modules.mk
184   echo "shared = $modpath_shared" >> $modpath_current/modules.mk
185   if test ! -z "$modpath_static" -o ! -z "$modpath_shared"; then
186     MODULE_DIRS="$MODULE_DIRS $current_dir"
187   fi
188   APACHE_FAST_OUTPUT($modpath_current/Makefile)
189 ])dnl
190 dnl
191 dnl APACHE_MODPATH_ADD(name[, shared[, objects [, ldflags[, libs]]]])
192 AC_DEFUN(APACHE_MODPATH_ADD,[
193   if test -z "$3"; then
194     objects="mod_$1.lo"
195   else
196     objects="$3"
197   fi
198
199   if test -z "$module_standalone"; then
200     if test -z "$2"; then
201       libname="mod_$1.la"
202       BUILTIN_LIBS="$BUILTIN_LIBS $modpath_current/$libname"
203       modpath_static="$modpath_static $libname"
204       cat >>$modpath_current/modules.mk<<EOF
205 $libname: $objects
206         \$(MOD_LINK) $objects
207 EOF
208     else
209       apache_need_shared=yes
210       libname="mod_$1.la"
211       shobjects=`echo $objects | sed 's/\.lo/.slo/g'`
212       modpath_shared="$modpath_shared $libname"
213       cat >>$modpath_current/modules.mk<<EOF
214 $libname: $shobjects
215         \$(SH_LINK) -rpath \$(libexecdir) -module -avoid-version $4 $objects $5
216 EOF
217     fi
218   fi
219 ])dnl
220
221 dnl
222 dnl APACHE_MODULE(name, helptext[, objects[, structname[, default[, config]]]])
223 dnl
224 dnl default is one of:
225 dnl   yes  -- enabled by default. user must explicitly disable.
226 dnl   no   -- disabled under default, most, all. user must explicitly enable.
227 dnl   most -- disabled by default. enabled explicitly or with most or all.
228 dnl   ""   -- disabled under default, most. enabled explicitly or with all.
229 dnl
230 dnl basically: yes/no is a hard setting. "most" means follow the "most"
231 dnl            setting. otherwise, fall under the "all" setting.
232 dnl            explicit yes/no always overrides.
233 dnl
234 AC_DEFUN(APACHE_MODULE,[
235   AC_MSG_CHECKING(whether to enable mod_$1)
236   define([optname],[  --]ifelse($5,yes,disable,enable)[-]translit($1,_,-))dnl
237   AC_ARG_ENABLE(translit($1,_,-),optname() substr([                         ],len(optname()))$2,,enable_$1=ifelse($5,,maybe-all,$5))
238   undefine([optname])dnl
239   _apmod_extra_msg=""
240   if test "$enable_$1" = "most"; then
241     if test "$module_selection" = "most" -o "$module_selection" = "all"; then
242       enable_$1=$module_default
243       _apmod_extra_msg=" ($module_selection)"
244     else
245       enable_$1=no
246     fi
247   elif test "$enable_$1" = "maybe-all"; then
248     if test "$module_selection" = "all"; then
249       enable_$1=$module_default
250       _apmod_extra_msg=" (all)"
251     else
252       enable_$1=no
253     fi
254   fi
255   AC_MSG_RESULT($enable_$1$_apmod_extra_msg)
256   if test "$enable_$1" != "no"; then
257     case "$enable_$1" in
258     shared*)
259       enable_$1=`echo $ac_n $enable_$1$ac_c|sed 's/shared,*//'`
260       sharedobjs=yes
261       shared=yes;;
262     *)
263       MODLIST="$MODLIST ifelse($4,,$1,$4)"
264       if test "$1" = "so"; then
265           sharedobjs=yes
266       fi
267       shared="";;
268     esac
269     ifelse([$6],,:,[$6])
270     APACHE_MODPATH_ADD($1, $shared, $3)
271   fi
272 ])dnl
273 dnl
274 dnl APACHE_LAYOUT(configlayout, layoutname)
275 AC_DEFUN(APACHE_LAYOUT,[
276   if test ! -f $srcdir/config.layout; then
277     echo "** Error: Layout file $srcdir/config.layout not found"
278     echo "** Error: Cannot use undefined layout '$LAYOUT'"
279     exit 1
280   fi
281   pldconf=./config.pld
282   changequote({,})
283   sed -e "1,/[  ]*<[lL]ayout[   ]*$2[   ]*>[    ]*/d" \
284       -e '/[    ]*<\/Layout>[   ]*/,$d' \
285       -e "s/^[  ]*//g" \
286       -e "s/:[  ]*/=\'/g" \
287       -e "s/[   ]*$/'/g" \
288       $1 > $pldconf
289   layout_name=$2
290   . $pldconf
291   rm $pldconf
292   for var in prefix exec_prefix bindir sbindir libexecdir mandir \
293              sysconfdir datadir iconsdir htdocsdir cgidir includedir \
294              localstatedir runtimedir logfiledir proxycachedir; do
295     eval "val=\"\$$var\""
296     case $val in
297       *+)
298         val=`echo $val | sed -e 's;\+$;;'`
299         eval "$var=\"\$val\""
300         autosuffix=yes
301         ;;
302       *)
303         autosuffix=no
304         ;;
305     esac
306     val=`echo $val | sed -e 's:\(.\)/*$:\1:'`
307     val=`echo $val | sed -e 's:$\([a-z_]*\):$(\1):g'`
308     if test "$autosuffix" = "yes"; then
309       if echo $val | grep apache >/dev/null; then
310         addtarget=no
311       else
312         addtarget=yes
313       fi
314       if test "$addtarget" = "yes"; then
315         val="$val/apache"
316       fi
317     fi
318     eval "$var='$val'"
319   done
320   changequote([,])
321 ])dnl
322 dnl
323 dnl APACHE_ENABLE_LAYOUT
324 dnl
325 AC_DEFUN(APACHE_ENABLE_LAYOUT,[
326 AC_ARG_ENABLE(layout,
327 [  --enable-layout=LAYOUT],[
328   LAYOUT=$enableval
329 ])
330
331 if test -z "$LAYOUT"; then
332   # XXX FIXME: this isn't a complete list of things that have to be set to 
333   # create the Apache layout in config.layout, and it really should just
334   # use what is specified in config.layout instead of duping it.
335   htdocsdir='$(prefix)/htdocs'
336   iconsdir='$(prefix)/icons'
337   cgidir='$(prefix)/cgi-bin'
338   logfiledir='$(prefix)/logs'
339   sysconfdir='${prefix}/conf'
340   libexecdir='${prefix}/modules'
341   layout_name=Apache
342 else 
343   APACHE_LAYOUT($srcdir/config.layout, $LAYOUT)
344 fi
345
346 AC_MSG_CHECKING(for chosen layout)
347 AC_MSG_RESULT($layout_name)
348 ])
349
350 dnl
351 dnl APACHE_ENABLE_MODULES
352 dnl
353 AC_DEFUN(APACHE_ENABLE_MODULES,[
354   module_selection=default
355   module_default=yes
356
357   AC_ARG_ENABLE(modules,
358   [  --enable-modules=MODULE-LIST],[
359     for i in $enableval; do
360       if test "$i" = "all" -o "$i" = "most"; then
361         module_selection=$i
362       else
363         eval "enable_$i=yes"
364       fi
365     done
366   ])
367   
368   AC_ARG_ENABLE(mods-shared,
369   [  --enable-mods-shared=MODULE-LIST],[
370     for i in $enableval; do
371       if test "$i" = "all" -o "$i" = "most"; then
372         module_selection=$i
373         module_default=shared
374       else
375         eval "enable_$i=shared"
376       fi
377     done
378   ])
379 ])
380
381 AC_DEFUN(APACHE_REQUIRE_CXX,[
382   if test -z "$apache_cxx_done"; then
383     AC_PROG_CXX
384     AC_PROG_CXXCPP
385     apache_cxx_done=yes
386   fi
387 ])