]> granicus.if.org Git - apache/blob - acinclude.m4
That's the end of things broken this morning... now to try Jeff's patch
[apache] / acinclude.m4
1  
2 AC_DEFUN(APACHE_CONFIG_NICE,[
3   rm -f $1
4   cat >$1<<EOF
5 #! /bin/sh
6 #
7 # Created by configure
8
9 EOF
10
11   for arg in [$]0 "[$]@"; do
12     echo "\"[$]arg\" \\" >> $1
13   done
14   echo '"[$]@"' >> $1
15   chmod +x $1
16 ])
17
18 AC_DEFUN(APACHE_PASSTHRU,[
19   unset ac_cv_pass_$1
20   AC_CACHE_VAL(ac_cv_pass_$1, [ac_cv_pass_$1=$$1])
21 ])
22
23 dnl APACHE_SUBST(VARIABLE)
24 dnl Makes VARIABLE available in generated files
25 dnl (do not use @variable@ in Makefiles, but $(variable))
26 AC_DEFUN(APACHE_SUBST,[
27   APACHE_VAR_SUBST="$APACHE_VAR_SUBST $1"
28   AC_SUBST($1)
29 ])
30
31 dnl APACHE_FAST_OUTPUT(FILENAME)
32 dnl Perform substitutions on FILENAME (Makefiles only)
33 AC_DEFUN(APACHE_FAST_OUTPUT,[
34   APACHE_FAST_OUTPUT_FILES="$APACHE_FAST_OUTPUT_FILES $1"
35 ])
36
37 dnl APACHE_MKDIR_P_CHECK
38 dnl checks whether mkdir -p works
39 AC_DEFUN(APACHE_MKDIR_P_CHECK,[
40   AC_CACHE_CHECK(for working mkdir -p, ac_cv_mkdir_p,[
41     test -d conftestdir && rm -rf conftestdir
42     mkdir -p conftestdir/somedir >/dev/null 2>&1
43     if test -d conftestdir/somedir; then
44       ac_cv_mkdir_p=yes
45     else
46       ac_cv_mkdir_p=no
47     fi
48     rm -rf conftestdir
49   ])
50 ])
51
52 dnl APACHE_GEN_CONFIG_VARS
53 dnl Creates config_vars.mk
54 AC_DEFUN(APACHE_GEN_CONFIG_VARS,[
55   APACHE_SUBST(abs_srcdir)
56   APACHE_SUBST(bindir)
57   APACHE_SUBST(cgidir)
58   APACHE_SUBST(logdir)
59   APACHE_SUBST(exec_prefix)
60   APACHE_SUBST(datadir)
61   APACHE_SUBST(localstatedir)
62   APACHE_SUBST(libexecdir)
63   APACHE_SUBST(htdocsdir)
64   APACHE_SUBST(includedir)
65   APACHE_SUBST(iconsdir)
66   APACHE_SUBST(sysconfdir)
67   APACHE_SUBST(progname)
68   APACHE_SUBST(prefix)
69   APACHE_SUBST(CC)
70   APACHE_SUBST(CFLAGS)
71   APACHE_SUBST(CPPFLAGS)
72   APACHE_SUBST(CXX)
73   APACHE_SUBST(CXXFLAGS)
74   APACHE_SUBST(LTFLAGS)
75   APACHE_SUBST(LDFLAGS)
76   APACHE_SUBST(DEFS)
77   APACHE_SUBST(LIBTOOL)
78   APACHE_SUBST(SHELL)
79   APACHE_SUBST(MODULE_DIRS)
80   APACHE_SUBST(PORT)
81
82   abs_srcdir="`(cd $srcdir && pwd)`"
83
84   APACHE_MKDIR_P_CHECK
85   echo creating config_vars.mk
86   > config_vars.mk
87   for i in $APACHE_VAR_SUBST; do
88     eval echo "$i = \$$i" >> config_vars.mk
89   done
90 ])
91
92 dnl APACHE_GEN_MAKEFILES
93 dnl Creates Makefiles
94 AC_DEFUN(APACHE_GEN_MAKEFILES,[
95   $SHELL $srcdir/build/fastgen.sh $srcdir $ac_cv_mkdir_p $BSD_MAKEFILE $APACHE_FAST_OUTPUT_FILES
96 ])
97
98 AC_DEFUN(APACHE_LIBTOOL_SILENT,[
99   LIBTOOL='$(SHELL) $(top_builddir)/libtool --silent'
100 ])
101
102     
103 dnl ## APACHE_OUTPUT(file)
104 dnl ## adds "file" to the list of files generated by AC_OUTPUT
105 dnl ## This macro can be used several times.
106 AC_DEFUN(APACHE_OUTPUT, [
107   APACHE_OUTPUT_FILES="$APACHE_OUTPUT_FILES $1"
108 ])
109
110 dnl
111 dnl AC_ADD_LIBRARY(library)
112 dnl
113 dnl add a library to the link line
114 dnl
115 AC_DEFUN(AC_ADD_LIBRARY,[
116   APACHE_ONCE(LIBRARY, $1, [
117     EXTRA_LIBS="$EXTRA_LIBS -l$1"
118   ])
119 ])
120
121 dnl
122 dnl AC_CHECK_DEFINE(macro, headerfile)
123 dnl
124 dnl checks for the macro in the header file
125 dnl
126 AC_DEFUN(AC_CHECK_DEFINE,[
127   AC_CACHE_CHECK(for $1 in $2, ac_cv_define_$1,
128   AC_EGREP_CPP([YES_IS_DEFINED], [
129 #include <$2>
130 #ifdef $1
131 YES_IS_DEFINED
132 #endif
133   ], ac_cv_define_$1=yes, ac_cv_define_$1=no))
134   if test "$ac_cv_define_$1" = "yes" ; then
135       AC_DEFINE(HAVE_$1,,
136           [Define if the macro "$1" is defined on this system])
137   fi
138 ])
139
140 dnl
141 dnl AC_TYPE_RLIM_T
142 dnl
143 dnl If rlim_t is not defined, define it to int
144 dnl
145 AC_DEFUN(AC_TYPE_RLIM_T, [
146   AC_CACHE_CHECK([for rlim_t], ac_cv_type_rlim_t, [
147     AC_TRY_COMPILE([
148 #include <sys/types.h>
149 #include <sys/time.h>
150 #include <sys/resource.h>
151 ], [rlim_t spoon;], [
152       ac_cv_type_rlim_t=yes
153     ],[ac_cv_type_rlim_t=no
154     ])
155   ])
156   if test "$ac_cv_type_rlim_t" = "no" ; then
157       AC_DEFINE(rlim_t, int,
158           [Define to 'int' if <sys/resource.h> doesn't define it for us])
159   fi
160 ])
161
162 dnl
163 dnl APACHE_ONCE(namespace, variable, code)
164 dnl
165 dnl execute code, if variable is not set in namespace
166 dnl
167 AC_DEFUN(APACHE_ONCE,[
168   unique=`echo $ac_n "$2$ac_c" | tr -cd a-zA-Z0-9`
169   cmd="echo $ac_n \"\$$1$unique$ac_c\""
170   if test -n "$unique" && test "`eval $cmd`" = "" ; then
171     eval "$1$unique=set"
172     $3
173   fi
174 ])
175
176 sinclude(lib/apr/apr_common.m4)
177 sinclude(lib/apr/hints.m4)
178
179 dnl
180 dnl APACHE_INADDR_NONE
181 dnl
182 dnl checks for missing INADDR_NONE macro
183 dnl
184 AC_DEFUN(APACHE_INADDR_NONE,[
185   AC_CACHE_CHECK(whether system defines INADDR_NONE, ac_cv_inaddr_none,[
186   AC_TRY_COMPILE([
187 #ifdef HAVE_SYS_TYPES_H
188 #include <sys/types.h>
189 #endif
190 #ifdef HAVE_SYS_SOCKET_H
191 #include <sys/socket.h>
192 #endif
193 #ifdef HAVE_NETINET_IN_H
194 #include <netinet/in.h>
195 #endif
196 #ifdef HAVE_ARPA_INET_H
197 #include <arpa/inet.h>
198 #endif
199 ],[
200 unsigned long foo = INADDR_NONE;
201 ],[
202     ac_cv_inaddr_none=yes
203 ],[
204     ac_cv_inaddr_none=no
205 ])])
206   if test "$ac_cv_inaddr_none" = "no"; then     
207     AC_DEFINE(INADDR_NONE, ((unsigned int) 0xffffffff), [ ])
208   fi
209 ])
210
211 AC_DEFUN(APACHE_CHECK_SIGWAIT_ONE_ARG,[
212   AC_CACHE_CHECK(whether sigwait takes one argument,ac_cv_sigwait_one_arg,[
213   AC_TRY_COMPILE([
214 #ifdef __NETBSD__
215     /* When using the unproven-pthreads package, we need to pull in this 
216      * header to get a prototype for sigwait().  Else things will fail later
217      * on.  XXX Should probably be fixed in the unproven-pthreads package.
218      */
219 #include <pthread.h>
220 #endif
221 #include <signal.h>
222 ],[
223   sigset_t set;
224
225   sigwait(&set);
226 ],[
227   ac_cv_sigwait_one_arg=yes
228 ],[
229   ac_cv_sigwait_one_arg=no
230 ])])
231   if test "$ac_cv_sigwait_one_arg" = "yes"; then
232     AC_DEFINE(SIGWAIT_TAKES_ONE_ARG,1,[ ])
233   fi
234 ])
235
236 AC_DEFUN(APACHE_EBCDIC,[
237   AC_CACHE_CHECK([whether system uses EBCDIC],ac_cv_ebcdic,[
238   AC_TRY_RUN( [
239 int main(void) { 
240   return (unsigned char)'A' != (unsigned char)0xC1; 
241
242 ],[
243   ac_cv_ebcdic="yes"
244 ],[
245   ac_cv_ebcdic="no"
246 ],[
247   ac_cv_ebcdic="no"
248 ])])
249   if test "$ac_cv_ebcdic" = "yes"; then
250     AC_DEFINE(CHARSET_EBCDIC,, [Define if system uses EBCDIC])
251   fi
252 ])
253
254 dnl APACHE_MODPATH_INIT(modpath)
255 AC_DEFUN(APACHE_MODPATH_INIT,[
256   current_dir=$1
257   modpath_current=modules/$1
258   modpath_static=
259   modpath_shared=
260   test -d $1 || $srcdir/helpers/mkdir.sh $modpath_current
261   > $modpath_current/modules.mk
262 ])dnl
263 dnl
264 AC_DEFUN(APACHE_MODPATH_FINISH,[
265   echo "static = $modpath_static" >> $modpath_current/modules.mk
266   echo "shared = $modpath_shared" >> $modpath_current/modules.mk
267   if test ! -z "$modpath_static" -o ! -z "$modpath_shared"; then
268     MODULE_DIRS="$MODULE_DIRS $current_dir"
269   fi
270   APACHE_FAST_OUTPUT($modpath_current/Makefile)
271 ])dnl
272 dnl
273 dnl APACHE_MODPATH_ADD(name[, shared[, objects [, ldflags[, libs]]]])
274 AC_DEFUN(APACHE_MODPATH_ADD,[
275   if test -z "$3"; then
276     objects="mod_$1.lo"
277   else
278     objects="$3"
279   fi
280
281   if test -z "$module_standalone"; then
282     if test -z "$2"; then
283       libname="libapachemod_$1.la"
284       BUILTIN_LIBS="$BUILTIN_LIBS $modpath_current/$libname"
285       modpath_static="$modpath_static $libname"
286       cat >>$modpath_current/modules.mk<<EOF
287 $libname: $objects
288         \$(LINK) $objects
289 EOF
290     else
291       apache_need_shared=yes
292       libname="mod_$1.la"
293       shobjects=`echo $objects | sed 's/\.lo/.slo/'`
294       modpath_shared="$modpath_shared $libname"
295       cat >>$modpath_current/modules.mk<<EOF
296 $libname: $shobjects
297         \$(SH_LINK) -rpath \$(libexecdir) -module -avoid-version $4 $objects $5
298 EOF
299     fi
300   fi
301 ])dnl
302 dnl
303 dnl APACHE_MODULE(name, helptext[, objects[, structname[, default[, config]]]])
304 AC_DEFUN(APACHE_MODULE,[
305   AC_MSG_CHECKING(whether to enable mod_$1)
306   define([optname],[  --]ifelse($5,yes,disable,enable)[-]translit($1,_,-))dnl
307   AC_ARG_ENABLE(translit($1,_,-),optname() substr([                         ],len(optname()))$2,,enable_$1=ifelse($5,,no,$5))
308   undefine([optname])dnl
309   AC_MSG_RESULT($enable_$1)
310   if test "$enable_$1" != "no"; then
311     case "$enable_$1" in
312     shared*)
313       enable_$1=`echo $ac_n $enable_$1$ac_c|sed 's/shared,*//'`
314       sharedobjs=yes
315       shared=yes;;
316     *)
317       MODLIST="$MODLIST ifelse($4,,$1,$4)"
318       if test "$1" = "so"; then
319           sharedobjs=yes
320       fi
321       shared="";;
322     esac
323     ifelse([$6],,:,[$6])
324     APACHE_MODPATH_ADD($1, $shared, $3)
325   fi
326 ])dnl
327 dnl
328 dnl APACHE_LAYOUT(configlayout, layoutname)
329 AC_DEFUN(APACHE_LAYOUT,[
330   if test ! -f $srcdir/../config.layout; then
331     echo "** Error: Layout file $srcdir/../config.layout not found"
332     echo "** Error: Cannot use undefined layout '$LAYOUT'"
333     exit 1
334   fi
335   pldconf=config.pld
336   changequote({,})
337   sed -e "1,/[  ]*<[lL]ayout[   ]*$2[   ]*>[    ]*/d" \
338       -e '/[    ]*<\/Layout>[   ]*/,$d' \
339       -e "s/^[  ]*//g" \
340       -e "s/:[  ]*/=\'/g" \
341       -e "s/[   ]*$/'/g" \
342       $1 > $pldconf
343   layout_name=$2
344   . $pldconf
345   rm $pldconf
346   for var in prefix exec_prefix bindir sbindir libexecdir mandir \
347              sysconfdir datadir iconsdir htdocsdir cgidir includedir \
348              localstatedir runtimedir logdir proxycachedir; do
349     eval "val=\"\$$var\""
350     case $val in
351       *+)
352         val=`echo $val | sed -e 's;\+$;;'`
353         eval "$var=\"\$val\""
354         autosuffix=yes
355         ;;
356       *)
357         autosuffix=no
358         ;;
359     esac
360     val=`echo $val | sed -e 's:\(.\)/*$:\1:'`
361     val=`echo $val | sed -e 's:$\([a-z_]*\):$(\1):g'`
362     if test "$autosuffix" = "yes"; then
363       if echo $val | grep apache >/dev/null; then
364         addtarget=no
365       else
366         addtarget=yes
367       fi
368       if test "$addtarget" = "yes"; then
369         val="$val/apache"
370       fi
371     fi
372     eval "$var='$val'"
373   done
374   changequote([,])
375 ])dnl
376 dnl
377 dnl APACHE_ENABLE_LAYOUT
378 dnl
379 AC_DEFUN(APACHE_ENABLE_LAYOUT,[
380 AC_ARG_ENABLE(layout,
381 [  --enable-layout=LAYOUT],[
382   LAYOUT=$enableval
383 ])
384
385 if test -z "$LAYOUT"; then
386   htdocsdir='$(prefix)/htdocs'
387   iconsdir='$(prefix)/icons'
388   cgidir='$(prefix)/cgi-bin'
389   logdir='$(prefix)/logs'
390   sysconfdir='${prefix}/conf'
391   layout_name=Apache
392 else  
393   APACHE_LAYOUT($srcdir/../config.layout, $LAYOUT)
394 fi
395
396 AC_MSG_CHECKING(for chosen layout)
397 AC_MSG_RESULT($layout_name)
398 ])dnl
399 dnl
400 dnl APACHE_ENABLE_SHARED
401 dnl
402 AC_DEFUN(APACHE_ENABLE_SHARED,[
403 AC_ARG_ENABLE(mods-shared,
404 [  --enable-mods-shared=MODULE-LIST],[
405   for i in $enableval; do
406         eval "enable_$i=shared"
407   done
408 ])
409 ])dnl
410 dnl
411 dnl APACHE_ENABLE_MODULES
412 dnl
413 AC_DEFUN(APACHE_ENABLE_MODULES,[
414 AC_ARG_ENABLE(modules,
415 [  --enable-modules=MODULE-LIST],[
416   for i in $enableval; do
417     eval "enable_$i=yes"
418   done
419 ])
420 ])dnl
421
422 AC_DEFUN(APACHE_REQUIRE_CXX,[
423   if test -z "$apache_cxx_done"; then
424     AC_PROG_CXX
425     AC_PROG_CXXCPP
426     apache_cxx_done=yes
427   fi
428 ])