1 | dnl -------------------------------------------------------- -*- autoconf -*- |
---|
2 | dnl Licensed to the Apache Software Foundation (ASF) under one or more |
---|
3 | dnl contributor license agreements. See the NOTICE file distributed with |
---|
4 | dnl this work for additional information regarding copyright ownership. |
---|
5 | dnl The ASF licenses this file to You under the Apache License, Version 2.0 |
---|
6 | dnl (the "License"); you may not use this file except in compliance with |
---|
7 | dnl the License. You may obtain a copy of the License at |
---|
8 | dnl |
---|
9 | dnl http://www.apache.org/licenses/LICENSE-2.0 |
---|
10 | dnl |
---|
11 | dnl Unless required by applicable law or agreed to in writing, software |
---|
12 | dnl distributed under the License is distributed on an "AS IS" BASIS, |
---|
13 | dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
14 | dnl See the License for the specific language governing permissions and |
---|
15 | dnl limitations under the License. |
---|
16 | |
---|
17 | dnl |
---|
18 | dnl apr_common.m4: APR's general-purpose autoconf macros |
---|
19 | dnl |
---|
20 | |
---|
21 | dnl |
---|
22 | dnl APR_CONFIG_NICE(filename) |
---|
23 | dnl |
---|
24 | dnl Saves a snapshot of the configure command-line for later reuse |
---|
25 | dnl |
---|
26 | AC_DEFUN([APR_CONFIG_NICE], [ |
---|
27 | rm -f $1 |
---|
28 | cat >$1<<EOF |
---|
29 | #! /bin/sh |
---|
30 | # |
---|
31 | # Created by configure |
---|
32 | |
---|
33 | EOF |
---|
34 | if test -n "$CC"; then |
---|
35 | echo "CC=\"$CC\"; export CC" >> $1 |
---|
36 | fi |
---|
37 | if test -n "$CFLAGS"; then |
---|
38 | echo "CFLAGS=\"$CFLAGS\"; export CFLAGS" >> $1 |
---|
39 | fi |
---|
40 | if test -n "$CPPFLAGS"; then |
---|
41 | echo "CPPFLAGS=\"$CPPFLAGS\"; export CPPFLAGS" >> $1 |
---|
42 | fi |
---|
43 | if test -n "$LDFLAGS"; then |
---|
44 | echo "LDFLAGS=\"$LDFLAGS\"; export LDFLAGS" >> $1 |
---|
45 | fi |
---|
46 | if test -n "$LTFLAGS"; then |
---|
47 | echo "LTFLAGS=\"$LTFLAGS\"; export LTFLAGS" >> $1 |
---|
48 | fi |
---|
49 | if test -n "$LIBS"; then |
---|
50 | echo "LIBS=\"$LIBS\"; export LIBS" >> $1 |
---|
51 | fi |
---|
52 | if test -n "$INCLUDES"; then |
---|
53 | echo "INCLUDES=\"$INCLUDES\"; export INCLUDES" >> $1 |
---|
54 | fi |
---|
55 | if test -n "$NOTEST_CFLAGS"; then |
---|
56 | echo "NOTEST_CFLAGS=\"$NOTEST_CFLAGS\"; export NOTEST_CFLAGS" >> $1 |
---|
57 | fi |
---|
58 | if test -n "$NOTEST_CPPFLAGS"; then |
---|
59 | echo "NOTEST_CPPFLAGS=\"$NOTEST_CPPFLAGS\"; export NOTEST_CPPFLAGS" >> $1 |
---|
60 | fi |
---|
61 | if test -n "$NOTEST_LDFLAGS"; then |
---|
62 | echo "NOTEST_LDFLAGS=\"$NOTEST_LDFLAGS\"; export NOTEST_LDFLAGS" >> $1 |
---|
63 | fi |
---|
64 | if test -n "$NOTEST_LIBS"; then |
---|
65 | echo "NOTEST_LIBS=\"$NOTEST_LIBS\"; export NOTEST_LIBS" >> $1 |
---|
66 | fi |
---|
67 | |
---|
68 | # Retrieve command-line arguments. |
---|
69 | eval "set x $[0] $ac_configure_args" |
---|
70 | shift |
---|
71 | |
---|
72 | for arg |
---|
73 | do |
---|
74 | APR_EXPAND_VAR(arg, $arg) |
---|
75 | echo "\"[$]arg\" \\" >> $1 |
---|
76 | done |
---|
77 | echo '"[$]@"' >> $1 |
---|
78 | chmod +x $1 |
---|
79 | ])dnl |
---|
80 | |
---|
81 | dnl APR_MKDIR_P_CHECK(fallback-mkdir-p) |
---|
82 | dnl checks whether mkdir -p works |
---|
83 | AC_DEFUN([APR_MKDIR_P_CHECK], [ |
---|
84 | AC_CACHE_CHECK(for working mkdir -p, ac_cv_mkdir_p,[ |
---|
85 | test -d conftestdir && rm -rf conftestdir |
---|
86 | mkdir -p conftestdir/somedir >/dev/null 2>&1 |
---|
87 | if test -d conftestdir/somedir; then |
---|
88 | ac_cv_mkdir_p=yes |
---|
89 | else |
---|
90 | ac_cv_mkdir_p=no |
---|
91 | fi |
---|
92 | rm -rf conftestdir |
---|
93 | ]) |
---|
94 | if test "$ac_cv_mkdir_p" = "yes"; then |
---|
95 | mkdir_p="mkdir -p" |
---|
96 | else |
---|
97 | mkdir_p="$1" |
---|
98 | fi |
---|
99 | ]) |
---|
100 | |
---|
101 | dnl |
---|
102 | dnl APR_SUBDIR_CONFIG(dir [, sub-package-cmdline-args, args-to-drop]) |
---|
103 | dnl |
---|
104 | dnl dir: directory to find configure in |
---|
105 | dnl sub-package-cmdline-args: arguments to add to the invocation (optional) |
---|
106 | dnl args-to-drop: arguments to drop from the invocation (optional) |
---|
107 | dnl |
---|
108 | dnl Note: This macro relies on ac_configure_args being set properly. |
---|
109 | dnl |
---|
110 | dnl The args-to-drop argument is shoved into a case statement, so |
---|
111 | dnl multiple arguments can be separated with a |. |
---|
112 | dnl |
---|
113 | dnl Note: Older versions of autoconf do not single-quote args, while 2.54+ |
---|
114 | dnl places quotes around every argument. So, if you want to drop the |
---|
115 | dnl argument called --enable-layout, you must pass the third argument as: |
---|
116 | dnl [--enable-layout=*|\'--enable-layout=*] |
---|
117 | dnl |
---|
118 | dnl Trying to optimize this is left as an exercise to the reader who wants |
---|
119 | dnl to put up with more autoconf craziness. I give up. |
---|
120 | dnl |
---|
121 | AC_DEFUN([APR_SUBDIR_CONFIG], [ |
---|
122 | # save our work to this point; this allows the sub-package to use it |
---|
123 | AC_CACHE_SAVE |
---|
124 | |
---|
125 | echo "configuring package in $1 now" |
---|
126 | ac_popdir=`pwd` |
---|
127 | apr_config_subdirs="$1" |
---|
128 | test -d $1 || $mkdir_p $1 |
---|
129 | ac_abs_srcdir=`(cd $srcdir/$1 && pwd)` |
---|
130 | cd $1 |
---|
131 | |
---|
132 | changequote(, )dnl |
---|
133 | # A "../" for each directory in /$config_subdirs. |
---|
134 | ac_dots=`echo $apr_config_subdirs|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'` |
---|
135 | changequote([, ])dnl |
---|
136 | |
---|
137 | # Make the cache file pathname absolute for the subdirs |
---|
138 | # required to correctly handle subdirs that might actually |
---|
139 | # be symlinks |
---|
140 | case "$cache_file" in |
---|
141 | /*) # already absolute |
---|
142 | ac_sub_cache_file=$cache_file ;; |
---|
143 | *) # Was relative path. |
---|
144 | ac_sub_cache_file="$ac_popdir/$cache_file" ;; |
---|
145 | esac |
---|
146 | |
---|
147 | ifelse($3, [], [apr_configure_args=$ac_configure_args],[ |
---|
148 | apr_configure_args= |
---|
149 | apr_sep= |
---|
150 | for apr_configure_arg in $ac_configure_args |
---|
151 | do |
---|
152 | case "$apr_configure_arg" in |
---|
153 | $3) |
---|
154 | continue ;; |
---|
155 | esac |
---|
156 | apr_configure_args="$apr_configure_args$apr_sep'$apr_configure_arg'" |
---|
157 | apr_sep=" " |
---|
158 | done |
---|
159 | ]) |
---|
160 | |
---|
161 | # autoconf doesn't add --silent to ac_configure_args; explicitly pass it |
---|
162 | test "x$silent" = "xyes" && apr_configure_args="$apr_configure_args --silent" |
---|
163 | |
---|
164 | dnl The eval makes quoting arguments work - specifically the second argument |
---|
165 | dnl where the quoting mechanisms used is "" rather than []. |
---|
166 | dnl |
---|
167 | dnl We need to execute another shell because some autoconf/shell combinations |
---|
168 | dnl will choke after doing repeated APR_SUBDIR_CONFIG()s. (Namely Solaris |
---|
169 | dnl and autoconf-2.54+) |
---|
170 | if eval $SHELL $ac_abs_srcdir/configure $apr_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_abs_srcdir $2 |
---|
171 | then : |
---|
172 | echo "$1 configured properly" |
---|
173 | else |
---|
174 | echo "configure failed for $1" |
---|
175 | exit 1 |
---|
176 | fi |
---|
177 | |
---|
178 | cd $ac_popdir |
---|
179 | |
---|
180 | # grab any updates from the sub-package |
---|
181 | AC_CACHE_LOAD |
---|
182 | ])dnl |
---|
183 | |
---|
184 | dnl |
---|
185 | dnl APR_SAVE_THE_ENVIRONMENT(variable_name) |
---|
186 | dnl |
---|
187 | dnl Stores the variable (usually a Makefile macro) for later restoration |
---|
188 | dnl |
---|
189 | AC_DEFUN([APR_SAVE_THE_ENVIRONMENT], [ |
---|
190 | apr_ste_save_$1="$$1" |
---|
191 | ])dnl |
---|
192 | |
---|
193 | dnl |
---|
194 | dnl APR_RESTORE_THE_ENVIRONMENT(variable_name, prefix_) |
---|
195 | dnl |
---|
196 | dnl Uses the previously saved variable content to figure out what configure |
---|
197 | dnl has added to the variable, moving the new bits to prefix_variable_name |
---|
198 | dnl and restoring the original variable contents. This makes it possible |
---|
199 | dnl for a user to override configure when it does something stupid. |
---|
200 | dnl |
---|
201 | AC_DEFUN([APR_RESTORE_THE_ENVIRONMENT], [ |
---|
202 | if test "x$apr_ste_save_$1" = "x"; then |
---|
203 | $2$1="$$1" |
---|
204 | $1= |
---|
205 | else |
---|
206 | if test "x$apr_ste_save_$1" = "x$$1"; then |
---|
207 | $2$1= |
---|
208 | else |
---|
209 | $2$1=`echo $$1 | sed -e "s%${apr_ste_save_$1}%%"` |
---|
210 | $1="$apr_ste_save_$1" |
---|
211 | fi |
---|
212 | fi |
---|
213 | if test "x$silent" != "xyes"; then |
---|
214 | echo " restoring $1 to \"$$1\"" |
---|
215 | echo " setting $2$1 to \"$$2$1\"" |
---|
216 | fi |
---|
217 | AC_SUBST($2$1) |
---|
218 | ])dnl |
---|
219 | |
---|
220 | dnl |
---|
221 | dnl APR_SETIFNULL(variable, value) |
---|
222 | dnl |
---|
223 | dnl Set variable iff it's currently null |
---|
224 | dnl |
---|
225 | AC_DEFUN([APR_SETIFNULL], [ |
---|
226 | if test -z "$$1"; then |
---|
227 | test "x$silent" != "xyes" && echo " setting $1 to \"$2\"" |
---|
228 | $1="$2" |
---|
229 | fi |
---|
230 | ])dnl |
---|
231 | |
---|
232 | dnl |
---|
233 | dnl APR_SETVAR(variable, value) |
---|
234 | dnl |
---|
235 | dnl Set variable no matter what |
---|
236 | dnl |
---|
237 | AC_DEFUN([APR_SETVAR], [ |
---|
238 | test "x$silent" != "xyes" && echo " forcing $1 to \"$2\"" |
---|
239 | $1="$2" |
---|
240 | ])dnl |
---|
241 | |
---|
242 | dnl |
---|
243 | dnl APR_ADDTO(variable, value) |
---|
244 | dnl |
---|
245 | dnl Add value to variable |
---|
246 | dnl |
---|
247 | AC_DEFUN([APR_ADDTO], [ |
---|
248 | if test "x$$1" = "x"; then |
---|
249 | test "x$silent" != "xyes" && echo " setting $1 to \"$2\"" |
---|
250 | $1="$2" |
---|
251 | else |
---|
252 | apr_addto_bugger="$2" |
---|
253 | for i in $apr_addto_bugger; do |
---|
254 | apr_addto_duplicate="0" |
---|
255 | for j in $$1; do |
---|
256 | if test "x$i" = "x$j"; then |
---|
257 | apr_addto_duplicate="1" |
---|
258 | break |
---|
259 | fi |
---|
260 | done |
---|
261 | if test $apr_addto_duplicate = "0"; then |
---|
262 | test "x$silent" != "xyes" && echo " adding \"$i\" to $1" |
---|
263 | $1="$$1 $i" |
---|
264 | fi |
---|
265 | done |
---|
266 | fi |
---|
267 | ])dnl |
---|
268 | |
---|
269 | dnl |
---|
270 | dnl APR_REMOVEFROM(variable, value) |
---|
271 | dnl |
---|
272 | dnl Remove a value from a variable |
---|
273 | dnl |
---|
274 | AC_DEFUN([APR_REMOVEFROM], [ |
---|
275 | if test "x$$1" = "x$2"; then |
---|
276 | test "x$silent" != "xyes" && echo " nulling $1" |
---|
277 | $1="" |
---|
278 | else |
---|
279 | apr_new_bugger="" |
---|
280 | apr_removed=0 |
---|
281 | for i in $$1; do |
---|
282 | if test "x$i" != "x$2"; then |
---|
283 | apr_new_bugger="$apr_new_bugger $i" |
---|
284 | else |
---|
285 | apr_removed=1 |
---|
286 | fi |
---|
287 | done |
---|
288 | if test $apr_removed = "1"; then |
---|
289 | test "x$silent" != "xyes" && echo " removed \"$2\" from $1" |
---|
290 | $1=$apr_new_bugger |
---|
291 | fi |
---|
292 | fi |
---|
293 | ]) dnl |
---|
294 | |
---|
295 | dnl |
---|
296 | dnl APR_CHECK_DEFINE_FILES( symbol, header_file [header_file ...] ) |
---|
297 | dnl |
---|
298 | AC_DEFUN([APR_CHECK_DEFINE_FILES], [ |
---|
299 | AC_CACHE_CHECK([for $1 in $2],ac_cv_define_$1,[ |
---|
300 | ac_cv_define_$1=no |
---|
301 | for curhdr in $2 |
---|
302 | do |
---|
303 | AC_EGREP_CPP(YES_IS_DEFINED, [ |
---|
304 | #include <$curhdr> |
---|
305 | #ifdef $1 |
---|
306 | YES_IS_DEFINED |
---|
307 | #endif |
---|
308 | ], ac_cv_define_$1=yes) |
---|
309 | done |
---|
310 | ]) |
---|
311 | if test "$ac_cv_define_$1" = "yes"; then |
---|
312 | AC_DEFINE(HAVE_$1, 1, [Define if $1 is defined]) |
---|
313 | fi |
---|
314 | ]) |
---|
315 | |
---|
316 | |
---|
317 | dnl |
---|
318 | dnl APR_CHECK_DEFINE(symbol, header_file) |
---|
319 | dnl |
---|
320 | AC_DEFUN([APR_CHECK_DEFINE], [ |
---|
321 | AC_CACHE_CHECK([for $1 in $2],ac_cv_define_$1,[ |
---|
322 | AC_EGREP_CPP(YES_IS_DEFINED, [ |
---|
323 | #include <$2> |
---|
324 | #ifdef $1 |
---|
325 | YES_IS_DEFINED |
---|
326 | #endif |
---|
327 | ], ac_cv_define_$1=yes, ac_cv_define_$1=no) |
---|
328 | ]) |
---|
329 | if test "$ac_cv_define_$1" = "yes"; then |
---|
330 | AC_DEFINE(HAVE_$1, 1, [Define if $1 is defined in $2]) |
---|
331 | fi |
---|
332 | ]) |
---|
333 | |
---|
334 | dnl |
---|
335 | dnl APR_CHECK_APR_DEFINE( symbol ) |
---|
336 | dnl |
---|
337 | AC_DEFUN([APR_CHECK_APR_DEFINE], [ |
---|
338 | apr_old_cppflags=$CPPFLAGS |
---|
339 | CPPFLAGS="$CPPFLAGS $INCLUDES" |
---|
340 | AC_EGREP_CPP(YES_IS_DEFINED, [ |
---|
341 | #include <apr.h> |
---|
342 | #if $1 |
---|
343 | YES_IS_DEFINED |
---|
344 | #endif |
---|
345 | ], ac_cv_define_$1=yes, ac_cv_define_$1=no) |
---|
346 | CPPFLAGS=$apr_old_cppflags |
---|
347 | ]) |
---|
348 | |
---|
349 | dnl APR_CHECK_FILE(filename); set ac_cv_file_filename to |
---|
350 | dnl "yes" if 'filename' is readable, else "no". |
---|
351 | dnl @deprecated! - use AC_CHECK_FILE instead |
---|
352 | AC_DEFUN([APR_CHECK_FILE], [ |
---|
353 | dnl Pick a safe variable name |
---|
354 | define([apr_cvname], ac_cv_file_[]translit([$1], [./+-], [__p_])) |
---|
355 | AC_CACHE_CHECK([for $1], [apr_cvname], |
---|
356 | [if test -r $1; then |
---|
357 | apr_cvname=yes |
---|
358 | else |
---|
359 | apr_cvname=no |
---|
360 | fi]) |
---|
361 | ]) |
---|
362 | |
---|
363 | define(APR_IFALLYES,[dnl |
---|
364 | ac_rc=yes |
---|
365 | for ac_spec in $1; do |
---|
366 | ac_type=`echo "$ac_spec" | sed -e 's/:.*$//'` |
---|
367 | ac_item=`echo "$ac_spec" | sed -e 's/^.*://'` |
---|
368 | case $ac_type in |
---|
369 | header ) |
---|
370 | ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'` |
---|
371 | ac_var="ac_cv_header_$ac_item" |
---|
372 | ;; |
---|
373 | file ) |
---|
374 | ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'` |
---|
375 | ac_var="ac_cv_file_$ac_item" |
---|
376 | ;; |
---|
377 | func ) ac_var="ac_cv_func_$ac_item" ;; |
---|
378 | struct ) ac_var="ac_cv_struct_$ac_item" ;; |
---|
379 | define ) ac_var="ac_cv_define_$ac_item" ;; |
---|
380 | custom ) ac_var="$ac_item" ;; |
---|
381 | esac |
---|
382 | eval "ac_val=\$$ac_var" |
---|
383 | if test ".$ac_val" != .yes; then |
---|
384 | ac_rc=no |
---|
385 | break |
---|
386 | fi |
---|
387 | done |
---|
388 | if test ".$ac_rc" = .yes; then |
---|
389 | : |
---|
390 | $2 |
---|
391 | else |
---|
392 | : |
---|
393 | $3 |
---|
394 | fi |
---|
395 | ]) |
---|
396 | |
---|
397 | |
---|
398 | define(APR_BEGIN_DECISION,[dnl |
---|
399 | ac_decision_item='$1' |
---|
400 | ac_decision_msg='FAILED' |
---|
401 | ac_decision='' |
---|
402 | ]) |
---|
403 | |
---|
404 | |
---|
405 | AC_DEFUN([APR_DECIDE],[dnl |
---|
406 | dnl Define the flag (or not) in apr_private.h via autoheader |
---|
407 | AH_TEMPLATE($1, [Define if $2 will be used]) |
---|
408 | ac_decision='$1' |
---|
409 | ac_decision_msg='$2' |
---|
410 | ac_decision_$1=yes |
---|
411 | ac_decision_$1_msg='$2' |
---|
412 | ]) |
---|
413 | |
---|
414 | |
---|
415 | define(APR_DECISION_OVERRIDE,[dnl |
---|
416 | ac_decision='' |
---|
417 | for ac_item in $1; do |
---|
418 | eval "ac_decision_this=\$ac_decision_${ac_item}" |
---|
419 | if test ".$ac_decision_this" = .yes; then |
---|
420 | ac_decision=$ac_item |
---|
421 | eval "ac_decision_msg=\$ac_decision_${ac_item}_msg" |
---|
422 | fi |
---|
423 | done |
---|
424 | ]) |
---|
425 | |
---|
426 | |
---|
427 | define(APR_DECISION_FORCE,[dnl |
---|
428 | ac_decision="$1" |
---|
429 | eval "ac_decision_msg=\"\$ac_decision_${ac_decision}_msg\"" |
---|
430 | ]) |
---|
431 | |
---|
432 | |
---|
433 | define(APR_END_DECISION,[dnl |
---|
434 | if test ".$ac_decision" = .; then |
---|
435 | echo "[$]0:Error: decision on $ac_decision_item failed" 1>&2 |
---|
436 | exit 1 |
---|
437 | else |
---|
438 | if test ".$ac_decision_msg" = .; then |
---|
439 | ac_decision_msg="$ac_decision" |
---|
440 | fi |
---|
441 | AC_DEFINE_UNQUOTED(${ac_decision_item}) |
---|
442 | AC_MSG_RESULT([decision on $ac_decision_item... $ac_decision_msg]) |
---|
443 | fi |
---|
444 | ]) |
---|
445 | |
---|
446 | |
---|
447 | dnl |
---|
448 | dnl APR_CHECK_SIZEOF_EXTENDED(INCLUDES, TYPE [, CROSS_SIZE]) |
---|
449 | dnl |
---|
450 | dnl A variant of AC_CHECK_SIZEOF which allows the checking of |
---|
451 | dnl sizes of non-builtin types |
---|
452 | dnl |
---|
453 | AC_DEFUN([APR_CHECK_SIZEOF_EXTENDED], |
---|
454 | [changequote(<<, >>)dnl |
---|
455 | dnl The name to #define. |
---|
456 | define(<<AC_TYPE_NAME>>, translit(sizeof_$2, [a-z *], [A-Z_P]))dnl |
---|
457 | dnl The cache variable name. |
---|
458 | define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$2, [ *], [_p]))dnl |
---|
459 | changequote([, ])dnl |
---|
460 | AC_MSG_CHECKING(size of $2) |
---|
461 | AC_CACHE_VAL(AC_CV_NAME, |
---|
462 | [AC_TRY_RUN([#include <stdio.h> |
---|
463 | $1 |
---|
464 | main() |
---|
465 | { |
---|
466 | FILE *f=fopen("conftestval", "w"); |
---|
467 | if (!f) exit(1); |
---|
468 | fprintf(f, "%d\n", sizeof($2)); |
---|
469 | exit(0); |
---|
470 | }], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$3],,, |
---|
471 | AC_CV_NAME=$3))])dnl |
---|
472 | AC_MSG_RESULT($AC_CV_NAME) |
---|
473 | AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The size of ]$2) |
---|
474 | undefine([AC_TYPE_NAME])dnl |
---|
475 | undefine([AC_CV_NAME])dnl |
---|
476 | ]) |
---|
477 | |
---|
478 | |
---|
479 | dnl |
---|
480 | dnl APR_TRY_COMPILE_NO_WARNING(INCLUDES, FUNCTION-BODY, |
---|
481 | dnl [ACTIONS-IF-NO-WARNINGS], [ACTIONS-IF-WARNINGS]) |
---|
482 | dnl |
---|
483 | dnl Tries a compile test with warnings activated so that the result |
---|
484 | dnl is false if the code doesn't compile cleanly. For compilers |
---|
485 | dnl where it is not known how to activate a "fail-on-error" mode, |
---|
486 | dnl it is undefined which of the sets of actions will be run. |
---|
487 | dnl |
---|
488 | AC_DEFUN([APR_TRY_COMPILE_NO_WARNING], |
---|
489 | [apr_save_CFLAGS=$CFLAGS |
---|
490 | CFLAGS="$CFLAGS $CFLAGS_WARN" |
---|
491 | if test "$ac_cv_prog_gcc" = "yes"; then |
---|
492 | CFLAGS="$CFLAGS -Werror" |
---|
493 | fi |
---|
494 | AC_COMPILE_IFELSE( |
---|
495 | [#include "confdefs.h" |
---|
496 | ] |
---|
497 | [[$1]] |
---|
498 | [int main(int argc, const char *const *argv) {] |
---|
499 | [[$2]] |
---|
500 | [ return 0; }], |
---|
501 | [$3], [$4]) |
---|
502 | CFLAGS=$apr_save_CFLAGS |
---|
503 | ]) |
---|
504 | |
---|
505 | dnl |
---|
506 | dnl APR_CHECK_STRERROR_R_RC |
---|
507 | dnl |
---|
508 | dnl Decide which style of retcode is used by this system's |
---|
509 | dnl strerror_r(). It either returns int (0 for success, -1 |
---|
510 | dnl for failure), or it returns a pointer to the error |
---|
511 | dnl string. |
---|
512 | dnl |
---|
513 | dnl |
---|
514 | AC_DEFUN([APR_CHECK_STRERROR_R_RC], [ |
---|
515 | AC_MSG_CHECKING(for type of return code from strerror_r) |
---|
516 | AC_TRY_RUN([ |
---|
517 | #include <errno.h> |
---|
518 | #include <string.h> |
---|
519 | #include <stdio.h> |
---|
520 | main() |
---|
521 | { |
---|
522 | char buf[1024]; |
---|
523 | if (strerror_r(ERANGE, buf, sizeof buf) < 1) { |
---|
524 | exit(0); |
---|
525 | } |
---|
526 | else { |
---|
527 | exit(1); |
---|
528 | } |
---|
529 | }], [ |
---|
530 | ac_cv_strerror_r_rc_int=yes ], [ |
---|
531 | ac_cv_strerror_r_rc_int=no ], [ |
---|
532 | ac_cv_strerror_r_rc_int=no ] ) |
---|
533 | if test "x$ac_cv_strerror_r_rc_int" = xyes; then |
---|
534 | AC_DEFINE(STRERROR_R_RC_INT, 1, [Define if strerror returns int]) |
---|
535 | msg="int" |
---|
536 | else |
---|
537 | msg="pointer" |
---|
538 | fi |
---|
539 | AC_MSG_RESULT([$msg]) |
---|
540 | ] ) |
---|
541 | |
---|
542 | dnl |
---|
543 | dnl APR_CHECK_DIRENT_INODE |
---|
544 | dnl |
---|
545 | dnl Decide if d_fileno or d_ino are available in the dirent |
---|
546 | dnl structure on this platform. Single UNIX Spec says d_ino, |
---|
547 | dnl BSD uses d_fileno. Undef to find the real beast. |
---|
548 | dnl |
---|
549 | AC_DEFUN([APR_CHECK_DIRENT_INODE], [ |
---|
550 | AC_CACHE_CHECK([for inode member of struct dirent], apr_cv_dirent_inode, [ |
---|
551 | apr_cv_dirent_inode=no |
---|
552 | AC_TRY_COMPILE([ |
---|
553 | #include <sys/types.h> |
---|
554 | #include <dirent.h> |
---|
555 | ],[ |
---|
556 | #ifdef d_ino |
---|
557 | #undef d_ino |
---|
558 | #endif |
---|
559 | struct dirent de; de.d_fileno; |
---|
560 | ], apr_cv_dirent_inode=d_fileno) |
---|
561 | if test "$apr_cv_dirent_inode" = "no"; then |
---|
562 | AC_TRY_COMPILE([ |
---|
563 | #include <sys/types.h> |
---|
564 | #include <dirent.h> |
---|
565 | ],[ |
---|
566 | #ifdef d_fileno |
---|
567 | #undef d_fileno |
---|
568 | #endif |
---|
569 | struct dirent de; de.d_ino; |
---|
570 | ], apr_cv_dirent_inode=d_ino) |
---|
571 | fi |
---|
572 | ]) |
---|
573 | if test "$apr_cv_dirent_inode" != "no"; then |
---|
574 | AC_DEFINE_UNQUOTED(DIRENT_INODE, $apr_cv_dirent_inode, |
---|
575 | [Define if struct dirent has an inode member]) |
---|
576 | fi |
---|
577 | ]) |
---|
578 | |
---|
579 | dnl |
---|
580 | dnl APR_CHECK_DIRENT_TYPE |
---|
581 | dnl |
---|
582 | dnl Decide if d_type is available in the dirent structure |
---|
583 | dnl on this platform. Not part of the Single UNIX Spec. |
---|
584 | dnl Note that this is worthless without DT_xxx macros, so |
---|
585 | dnl look for one while we are at it. |
---|
586 | dnl |
---|
587 | AC_DEFUN([APR_CHECK_DIRENT_TYPE], [ |
---|
588 | AC_CACHE_CHECK([for file type member of struct dirent], apr_cv_dirent_type,[ |
---|
589 | apr_cv_dirent_type=no |
---|
590 | AC_TRY_COMPILE([ |
---|
591 | #include <sys/types.h> |
---|
592 | #include <dirent.h> |
---|
593 | ],[ |
---|
594 | struct dirent de; de.d_type = DT_REG; |
---|
595 | ], apr_cv_dirent_type=d_type) |
---|
596 | ]) |
---|
597 | if test "$apr_cv_dirent_type" != "no"; then |
---|
598 | AC_DEFINE_UNQUOTED(DIRENT_TYPE, $apr_cv_dirent_type, |
---|
599 | [Define if struct dirent has a d_type member]) |
---|
600 | fi |
---|
601 | ]) |
---|
602 | |
---|
603 | dnl the following is a newline, a space, a tab, and a backslash (the |
---|
604 | dnl backslash is used by the shell to skip newlines, but m4 sees it; |
---|
605 | dnl treat it like whitespace). |
---|
606 | dnl WARNING: don't reindent these lines, or the space/tab will be lost! |
---|
607 | define([apr_whitespace],[ |
---|
608 | \]) |
---|
609 | |
---|
610 | dnl |
---|
611 | dnl APR_COMMA_ARGS(ARG1 ...) |
---|
612 | dnl convert the whitespace-separated arguments into comman-separated |
---|
613 | dnl arguments. |
---|
614 | dnl |
---|
615 | dnl APR_FOREACH(CODE-BLOCK, ARG1, ARG2, ...) |
---|
616 | dnl subsitute CODE-BLOCK for each ARG[i]. "eachval" will be set to ARG[i] |
---|
617 | dnl within each iteration. |
---|
618 | dnl |
---|
619 | changequote({,}) |
---|
620 | define({APR_COMMA_ARGS},{patsubst([$}{1],[[}apr_whitespace{]+],[,])}) |
---|
621 | define({APR_FOREACH}, |
---|
622 | {ifelse($}{2,,, |
---|
623 | [define([eachval], |
---|
624 | $}{2)$}{1[]APR_FOREACH([$}{1], |
---|
625 | builtin([shift], |
---|
626 | builtin([shift], $}{@)))])}) |
---|
627 | changequote([,]) |
---|
628 | |
---|
629 | dnl APR_FLAG_HEADERS(HEADER-FILE ... [, FLAG-TO-SET ] [, "yes" ]) |
---|
630 | dnl we set FLAG-TO-SET to 1 if we find HEADER-FILE, otherwise we set to 0 |
---|
631 | dnl if FLAG-TO-SET is null, we automagically determine it's name |
---|
632 | dnl by changing all "/" to "_" in the HEADER-FILE and dropping |
---|
633 | dnl all "." and "-" chars. If the 3rd parameter is "yes" then instead of |
---|
634 | dnl setting to 1 or 0, we set FLAG-TO-SET to yes or no. |
---|
635 | dnl |
---|
636 | AC_DEFUN([APR_FLAG_HEADERS], [ |
---|
637 | AC_CHECK_HEADERS($1) |
---|
638 | for aprt_i in $1 |
---|
639 | do |
---|
640 | ac_safe=`echo "$aprt_i" | sed 'y%./+-%__p_%'` |
---|
641 | aprt_2=`echo "$aprt_i" | sed -e 's%/%_%g' -e 's/\.//g' -e 's/-//g'` |
---|
642 | if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then |
---|
643 | eval "ifelse($2,,$aprt_2,$2)=ifelse($3,yes,yes,1)" |
---|
644 | else |
---|
645 | eval "ifelse($2,,$aprt_2,$2)=ifelse($3,yes,no,0)" |
---|
646 | fi |
---|
647 | done |
---|
648 | ]) |
---|
649 | |
---|
650 | dnl APR_FLAG_FUNCS(FUNC ... [, FLAG-TO-SET] [, "yes" ]) |
---|
651 | dnl if FLAG-TO-SET is null, we automagically determine it's name |
---|
652 | dnl prepending "have_" to the function name in FUNC, otherwise |
---|
653 | dnl we use what's provided as FLAG-TO-SET. If the 3rd parameter |
---|
654 | dnl is "yes" then instead of setting to 1 or 0, we set FLAG-TO-SET |
---|
655 | dnl to yes or no. |
---|
656 | dnl |
---|
657 | AC_DEFUN([APR_FLAG_FUNCS], [ |
---|
658 | AC_CHECK_FUNCS($1) |
---|
659 | for aprt_j in $1 |
---|
660 | do |
---|
661 | aprt_3="have_$aprt_j" |
---|
662 | if eval "test \"`echo '$ac_cv_func_'$aprt_j`\" = yes"; then |
---|
663 | eval "ifelse($2,,$aprt_3,$2)=ifelse($3,yes,yes,1)" |
---|
664 | else |
---|
665 | eval "ifelse($2,,$aprt_3,$2)=ifelse($3,yes,no,0)" |
---|
666 | fi |
---|
667 | done |
---|
668 | ]) |
---|
669 | |
---|
670 | dnl Iteratively interpolate the contents of the second argument |
---|
671 | dnl until interpolation offers no new result. Then assign the |
---|
672 | dnl final result to $1. |
---|
673 | dnl |
---|
674 | dnl Example: |
---|
675 | dnl |
---|
676 | dnl foo=1 |
---|
677 | dnl bar='${foo}/2' |
---|
678 | dnl baz='${bar}/3' |
---|
679 | dnl APR_EXPAND_VAR(fraz, $baz) |
---|
680 | dnl $fraz is now "1/2/3" |
---|
681 | dnl |
---|
682 | AC_DEFUN([APR_EXPAND_VAR], [ |
---|
683 | ap_last= |
---|
684 | ap_cur="$2" |
---|
685 | while test "x${ap_cur}" != "x${ap_last}"; |
---|
686 | do |
---|
687 | ap_last="${ap_cur}" |
---|
688 | ap_cur=`eval "echo ${ap_cur}"` |
---|
689 | done |
---|
690 | $1="${ap_cur}" |
---|
691 | ]) |
---|
692 | |
---|
693 | dnl |
---|
694 | dnl Removes the value of $3 from the string in $2, strips of any leading |
---|
695 | dnl slashes, and returns the value in $1. |
---|
696 | dnl |
---|
697 | dnl Example: |
---|
698 | dnl orig_path="${prefix}/bar" |
---|
699 | dnl APR_PATH_RELATIVE(final_path, $orig_path, $prefix) |
---|
700 | dnl $final_path now contains "bar" |
---|
701 | AC_DEFUN([APR_PATH_RELATIVE], [ |
---|
702 | ap_stripped=`echo $2 | sed -e "s#^$3##"` |
---|
703 | # check if the stripping was successful |
---|
704 | if test "x$2" != "x${ap_stripped}"; then |
---|
705 | # it was, so strip of any leading slashes |
---|
706 | $1="`echo ${ap_stripped} | sed -e 's#^/*##'`" |
---|
707 | else |
---|
708 | # it wasn't so return the original |
---|
709 | $1="$2" |
---|
710 | fi |
---|
711 | ]) |
---|
712 | |
---|
713 | dnl APR_HELP_STRING(LHS, RHS) |
---|
714 | dnl Autoconf 2.50 can not handle substr correctly. It does have |
---|
715 | dnl AC_HELP_STRING, so let's try to call it if we can. |
---|
716 | dnl Note: this define must be on one line so that it can be properly returned |
---|
717 | dnl as the help string. When using this macro with a multi-line RHS, ensure |
---|
718 | dnl that you surround the macro invocation with []s |
---|
719 | AC_DEFUN([APR_HELP_STRING], [ifelse(regexp(AC_ACVERSION, 2\.1), -1, AC_HELP_STRING([$1],[$2]),[ ][$1] substr([ ],len($1))[$2])]) |
---|
720 | |
---|
721 | dnl |
---|
722 | dnl APR_LAYOUT(configlayout, layoutname [, extravars]) |
---|
723 | dnl |
---|
724 | AC_DEFUN([APR_LAYOUT], [ |
---|
725 | if test ! -f $srcdir/config.layout; then |
---|
726 | echo "** Error: Layout file $srcdir/config.layout not found" |
---|
727 | echo "** Error: Cannot use undefined layout '$LAYOUT'" |
---|
728 | exit 1 |
---|
729 | fi |
---|
730 | # Catch layout names including a slash which will otherwise |
---|
731 | # confuse the heck out of the sed script. |
---|
732 | case $2 in |
---|
733 | */*) |
---|
734 | echo "** Error: $2 is not a valid layout name" |
---|
735 | exit 1 ;; |
---|
736 | esac |
---|
737 | pldconf=./config.pld |
---|
738 | changequote({,}) |
---|
739 | sed -e "1s/[ ]*<[lL]ayout[ ]*$2[ ]*>[ ]*//;1t" \ |
---|
740 | -e "1,/[ ]*<[lL]ayout[ ]*$2[ ]*>[ ]*/d" \ |
---|
741 | -e '/[ ]*<\/Layout>[ ]*/,$d' \ |
---|
742 | -e "s/^[ ]*//g" \ |
---|
743 | -e "s/:[ ]*/=\'/g" \ |
---|
744 | -e "s/[ ]*$/'/g" \ |
---|
745 | $1 > $pldconf |
---|
746 | layout_name=$2 |
---|
747 | if test ! -s $pldconf; then |
---|
748 | echo "** Error: unable to find layout $layout_name" |
---|
749 | exit 1 |
---|
750 | fi |
---|
751 | . $pldconf |
---|
752 | rm $pldconf |
---|
753 | for var in prefix exec_prefix bindir sbindir libexecdir mandir \ |
---|
754 | sysconfdir datadir includedir localstatedir runtimedir \ |
---|
755 | logfiledir libdir installbuilddir libsuffix $3; do |
---|
756 | eval "val=\"\$$var\"" |
---|
757 | case $val in |
---|
758 | *+) |
---|
759 | val=`echo $val | sed -e 's;\+$;;'` |
---|
760 | eval "$var=\"\$val\"" |
---|
761 | autosuffix=yes |
---|
762 | ;; |
---|
763 | *) |
---|
764 | autosuffix=no |
---|
765 | ;; |
---|
766 | esac |
---|
767 | val=`echo $val | sed -e 's:\(.\)/*$:\1:'` |
---|
768 | val=`echo $val | sed -e 's:[\$]\([a-z_]*\):${\1}:g'` |
---|
769 | if test "$autosuffix" = "yes"; then |
---|
770 | if echo $val | grep apache >/dev/null; then |
---|
771 | addtarget=no |
---|
772 | else |
---|
773 | addtarget=yes |
---|
774 | fi |
---|
775 | if test "$addtarget" = "yes"; then |
---|
776 | val="$val/apache2" |
---|
777 | fi |
---|
778 | fi |
---|
779 | eval "$var='$val'" |
---|
780 | done |
---|
781 | changequote([,]) |
---|
782 | ])dnl |
---|
783 | |
---|
784 | dnl |
---|
785 | dnl APR_ENABLE_LAYOUT(default layout name [, extra vars]) |
---|
786 | dnl |
---|
787 | AC_DEFUN([APR_ENABLE_LAYOUT], [ |
---|
788 | AC_ARG_ENABLE(layout, |
---|
789 | [ --enable-layout=LAYOUT],[ |
---|
790 | LAYOUT=$enableval |
---|
791 | ]) |
---|
792 | |
---|
793 | if test -z "$LAYOUT"; then |
---|
794 | LAYOUT="$1" |
---|
795 | fi |
---|
796 | APR_LAYOUT($srcdir/config.layout, $LAYOUT, $2) |
---|
797 | |
---|
798 | AC_MSG_CHECKING(for chosen layout) |
---|
799 | AC_MSG_RESULT($layout_name) |
---|
800 | ]) |
---|
801 | |
---|
802 | |
---|
803 | dnl |
---|
804 | dnl APR_PARSE_ARGUMENTS |
---|
805 | dnl a reimplementation of autoconf's argument parser, |
---|
806 | dnl used here to allow us to co-exist layouts and argument based |
---|
807 | dnl set ups. |
---|
808 | AC_DEFUN([APR_PARSE_ARGUMENTS], [ |
---|
809 | ac_prev= |
---|
810 | # Retrieve the command-line arguments. The eval is needed because |
---|
811 | # the arguments are quoted to preserve accuracy. |
---|
812 | eval "set x $ac_configure_args" |
---|
813 | shift |
---|
814 | for ac_option |
---|
815 | do |
---|
816 | # If the previous option needs an argument, assign it. |
---|
817 | if test -n "$ac_prev"; then |
---|
818 | eval "$ac_prev=\$ac_option" |
---|
819 | ac_prev= |
---|
820 | continue |
---|
821 | fi |
---|
822 | |
---|
823 | ac_optarg=`expr "x$ac_option" : 'x[[^=]]*=\(.*\)'` |
---|
824 | |
---|
825 | case $ac_option in |
---|
826 | |
---|
827 | -bindir | --bindir | --bindi | --bind | --bin | --bi) |
---|
828 | ac_prev=bindir ;; |
---|
829 | -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) |
---|
830 | bindir="$ac_optarg" ;; |
---|
831 | |
---|
832 | -datadir | --datadir | --datadi | --datad | --data | --dat | --da) |
---|
833 | ac_prev=datadir ;; |
---|
834 | -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ |
---|
835 | | --da=*) |
---|
836 | datadir="$ac_optarg" ;; |
---|
837 | |
---|
838 | -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ |
---|
839 | | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ |
---|
840 | | --exec | --exe | --ex) |
---|
841 | ac_prev=exec_prefix ;; |
---|
842 | -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ |
---|
843 | | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ |
---|
844 | | --exec=* | --exe=* | --ex=*) |
---|
845 | exec_prefix="$ac_optarg" ;; |
---|
846 | |
---|
847 | -includedir | --includedir | --includedi | --included | --include \ |
---|
848 | | --includ | --inclu | --incl | --inc) |
---|
849 | ac_prev=includedir ;; |
---|
850 | -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ |
---|
851 | | --includ=* | --inclu=* | --incl=* | --inc=*) |
---|
852 | includedir="$ac_optarg" ;; |
---|
853 | |
---|
854 | -infodir | --infodir | --infodi | --infod | --info | --inf) |
---|
855 | ac_prev=infodir ;; |
---|
856 | -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) |
---|
857 | infodir="$ac_optarg" ;; |
---|
858 | |
---|
859 | -libdir | --libdir | --libdi | --libd) |
---|
860 | ac_prev=libdir ;; |
---|
861 | -libdir=* | --libdir=* | --libdi=* | --libd=*) |
---|
862 | libdir="$ac_optarg" ;; |
---|
863 | |
---|
864 | -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ |
---|
865 | | --libexe | --libex | --libe) |
---|
866 | ac_prev=libexecdir ;; |
---|
867 | -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ |
---|
868 | | --libexe=* | --libex=* | --libe=*) |
---|
869 | libexecdir="$ac_optarg" ;; |
---|
870 | |
---|
871 | -localstatedir | --localstatedir | --localstatedi | --localstated \ |
---|
872 | | --localstate | --localstat | --localsta | --localst \ |
---|
873 | | --locals | --local | --loca | --loc | --lo) |
---|
874 | ac_prev=localstatedir ;; |
---|
875 | -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ |
---|
876 | | --localstate=* | --localstat=* | --localsta=* | --localst=* \ |
---|
877 | | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) |
---|
878 | localstatedir="$ac_optarg" ;; |
---|
879 | |
---|
880 | -mandir | --mandir | --mandi | --mand | --man | --ma | --m) |
---|
881 | ac_prev=mandir ;; |
---|
882 | -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) |
---|
883 | mandir="$ac_optarg" ;; |
---|
884 | |
---|
885 | -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) |
---|
886 | ac_prev=prefix ;; |
---|
887 | -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) |
---|
888 | prefix="$ac_optarg" ;; |
---|
889 | |
---|
890 | -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) |
---|
891 | ac_prev=sbindir ;; |
---|
892 | -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ |
---|
893 | | --sbi=* | --sb=*) |
---|
894 | sbindir="$ac_optarg" ;; |
---|
895 | |
---|
896 | -sharedstatedir | --sharedstatedir | --sharedstatedi \ |
---|
897 | | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ |
---|
898 | | --sharedst | --shareds | --shared | --share | --shar \ |
---|
899 | | --sha | --sh) |
---|
900 | ac_prev=sharedstatedir ;; |
---|
901 | -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ |
---|
902 | | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ |
---|
903 | | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ |
---|
904 | | --sha=* | --sh=*) |
---|
905 | sharedstatedir="$ac_optarg" ;; |
---|
906 | |
---|
907 | -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ |
---|
908 | | --syscon | --sysco | --sysc | --sys | --sy) |
---|
909 | ac_prev=sysconfdir ;; |
---|
910 | -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ |
---|
911 | | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) |
---|
912 | sysconfdir="$ac_optarg" ;; |
---|
913 | |
---|
914 | esac |
---|
915 | done |
---|
916 | |
---|
917 | # Be sure to have absolute paths. |
---|
918 | for ac_var in exec_prefix prefix |
---|
919 | do |
---|
920 | eval ac_val=$`echo $ac_var` |
---|
921 | case $ac_val in |
---|
922 | [[\\/$]]* | ?:[[\\/]]* | NONE | '' ) ;; |
---|
923 | *) AC_MSG_ERROR([expected an absolute path for --$ac_var: $ac_val]);; |
---|
924 | esac |
---|
925 | done |
---|
926 | |
---|
927 | ])dnl |
---|
928 | |
---|
929 | dnl |
---|
930 | dnl APR_CHECK_DEPEND |
---|
931 | dnl |
---|
932 | dnl Determine what program we can use to generate .deps-style dependencies |
---|
933 | dnl |
---|
934 | AC_DEFUN([APR_CHECK_DEPEND], [ |
---|
935 | dnl Try to determine what depend program we can use |
---|
936 | dnl All GCC-variants should have -MM. |
---|
937 | dnl If not, then we can check on those, too. |
---|
938 | if test "$GCC" = "yes"; then |
---|
939 | MKDEP='$(CC) -MM' |
---|
940 | else |
---|
941 | rm -f conftest.c |
---|
942 | dnl <sys/types.h> should be available everywhere! |
---|
943 | cat > conftest.c <<EOF |
---|
944 | #include <sys/types.h> |
---|
945 | int main() { return 0; } |
---|
946 | EOF |
---|
947 | MKDEP="true" |
---|
948 | for i in "$CC -MM" "$CC -M" "$CPP -MM" "$CPP -M" "cpp -M"; do |
---|
949 | AC_MSG_CHECKING([if $i can create proper make dependencies]) |
---|
950 | if $i conftest.c 2>/dev/null | grep 'conftest.o: conftest.c' >/dev/null; then |
---|
951 | MKDEP=$i |
---|
952 | AC_MSG_RESULT(yes) |
---|
953 | break; |
---|
954 | fi |
---|
955 | AC_MSG_RESULT(no) |
---|
956 | done |
---|
957 | rm -f conftest.c |
---|
958 | fi |
---|
959 | |
---|
960 | AC_SUBST(MKDEP) |
---|
961 | ]) |
---|
962 | |
---|
963 | dnl |
---|
964 | dnl APR_CHECK_TYPES_COMPATIBLE(TYPE-1, TYPE-2, [ACTION-IF-TRUE]) |
---|
965 | dnl |
---|
966 | dnl Try to determine whether two types are the same. Only works |
---|
967 | dnl for gcc and icc. |
---|
968 | dnl |
---|
969 | AC_DEFUN([APR_CHECK_TYPES_COMPATIBLE], [ |
---|
970 | define([apr_cvname], apr_cv_typematch_[]translit([$1], [ ], [_])_[]translit([$2], [ ], [_])) |
---|
971 | AC_CACHE_CHECK([whether $1 and $2 are the same], apr_cvname, [ |
---|
972 | AC_TRY_COMPILE(AC_INCLUDES_DEFAULT, [ |
---|
973 | int foo[0 - !__builtin_types_compatible_p($1, $2)]; |
---|
974 | ], [apr_cvname=yes |
---|
975 | $3], [apr_cvname=no])]) |
---|
976 | ]) |
---|