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
9 dnl http://www.apache.org/licenses/LICENSE-2.0
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.
18 dnl apr_common.m4: APR's general-purpose autoconf macros
22 dnl APR_CONFIG_NICE(filename)
24 dnl Saves a snapshot of the configure command-line for later reuse
26 AC_DEFUN([APR_CONFIG_NICE], [
31 # Created by configure
34 if test -n "$CC"; then
35 echo "CC=\"$CC\"; export CC" >> $1
37 if test -n "$CFLAGS"; then
38 echo "CFLAGS=\"$CFLAGS\"; export CFLAGS" >> $1
40 if test -n "$CPPFLAGS"; then
41 echo "CPPFLAGS=\"$CPPFLAGS\"; export CPPFLAGS" >> $1
43 if test -n "$LDFLAGS"; then
44 echo "LDFLAGS=\"$LDFLAGS\"; export LDFLAGS" >> $1
46 if test -n "$LTFLAGS"; then
47 echo "LTFLAGS=\"$LTFLAGS\"; export LTFLAGS" >> $1
49 if test -n "$LIBS"; then
50 echo "LIBS=\"$LIBS\"; export LIBS" >> $1
52 if test -n "$INCLUDES"; then
53 echo "INCLUDES=\"$INCLUDES\"; export INCLUDES" >> $1
55 if test -n "$NOTEST_CFLAGS"; then
56 echo "NOTEST_CFLAGS=\"$NOTEST_CFLAGS\"; export NOTEST_CFLAGS" >> $1
58 if test -n "$NOTEST_CPPFLAGS"; then
59 echo "NOTEST_CPPFLAGS=\"$NOTEST_CPPFLAGS\"; export NOTEST_CPPFLAGS" >> $1
61 if test -n "$NOTEST_LDFLAGS"; then
62 echo "NOTEST_LDFLAGS=\"$NOTEST_LDFLAGS\"; export NOTEST_LDFLAGS" >> $1
64 if test -n "$NOTEST_LIBS"; then
65 echo "NOTEST_LIBS=\"$NOTEST_LIBS\"; export NOTEST_LIBS" >> $1
68 # Retrieve command-line arguments.
69 eval "set x $[0] $ac_configure_args"
74 APR_EXPAND_VAR(arg, $arg)
75 echo "\"[$]arg\" \\" >> $1
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
94 if test "$ac_cv_mkdir_p" = "yes"; then
102 dnl APR_SUBDIR_CONFIG(dir [, sub-package-cmdline-args, args-to-drop])
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)
108 dnl Note: This macro relies on ac_configure_args being set properly.
110 dnl The args-to-drop argument is shoved into a case statement, so
111 dnl multiple arguments can be separated with a |.
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=*]
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.
121 AC_DEFUN([APR_SUBDIR_CONFIG], [
122 # save our work to this point; this allows the sub-package to use it
125 echo "configuring package in $1 now"
127 apr_config_subdirs="$1"
128 test -d $1 || $mkdir_p $1
129 ac_abs_srcdir=`(cd $srcdir/$1 && pwd)`
133 # A "../" for each directory in /$config_subdirs.
134 ac_dots=`echo $apr_config_subdirs|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'`
137 # Make the cache file pathname absolute for the subdirs
138 # required to correctly handle subdirs that might actually
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" ;;
147 ifelse($3, [], [apr_configure_args=$ac_configure_args],[
150 for apr_configure_arg in $ac_configure_args
152 case "$apr_configure_arg" in
156 apr_configure_args="$apr_configure_args$apr_sep'$apr_configure_arg'"
161 dnl autoconf doesn't add --silent to ac_configure_args; explicitly pass it
162 test "x$silent" = "xyes" && apr_configure_args="$apr_configure_args --silent"
164 dnl AC_CONFIG_SUBDIRS silences option warnings, emulate this for 2.62
165 apr_configure_args="--disable-option-checking $apr_configure_args"
167 dnl The eval makes quoting arguments work - specifically the second argument
168 dnl where the quoting mechanisms used is "" rather than [].
170 dnl We need to execute another shell because some autoconf/shell combinations
171 dnl will choke after doing repeated APR_SUBDIR_CONFIG()s. (Namely Solaris
172 dnl and autoconf-2.54+)
173 if eval $SHELL $ac_abs_srcdir/configure $apr_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_abs_srcdir $2
175 echo "$1 configured properly"
177 echo "configure failed for $1"
183 # grab any updates from the sub-package
188 dnl APR_SAVE_THE_ENVIRONMENT(variable_name)
190 dnl Stores the variable (usually a Makefile macro) for later restoration
192 AC_DEFUN([APR_SAVE_THE_ENVIRONMENT], [
193 apr_ste_save_$1="$$1"
197 dnl APR_RESTORE_THE_ENVIRONMENT(variable_name, prefix_)
199 dnl Uses the previously saved variable content to figure out what configure
200 dnl has added to the variable, moving the new bits to prefix_variable_name
201 dnl and restoring the original variable contents. This makes it possible
202 dnl for a user to override configure when it does something stupid.
204 AC_DEFUN([APR_RESTORE_THE_ENVIRONMENT], [
205 dnl Check whether $apr_ste_save_$1 is empty or
206 dnl only whitespace. The verbatim "X" is token number 1,
207 dnl the following whitespace will be ignored.
208 set X $apr_ste_save_$1
209 if test ${#} -eq 1; then
213 if test "x$apr_ste_save_$1" = "x$$1"; then
216 $2$1=`echo "$$1" | sed -e "s%${apr_ste_save_$1}%%"`
217 $1="$apr_ste_save_$1"
220 if test "x$silent" != "xyes"; then
221 echo " restoring $1 to \"$$1\""
222 echo " setting $2$1 to \"$$2$1\""
228 dnl APR_SETIFNULL(variable, value)
230 dnl Set variable iff it's currently null
232 AC_DEFUN([APR_SETIFNULL], [
233 if test -z "$$1"; then
234 test "x$silent" != "xyes" && echo " setting $1 to \"$2\""
240 dnl APR_SETVAR(variable, value)
242 dnl Set variable no matter what
244 AC_DEFUN([APR_SETVAR], [
245 test "x$silent" != "xyes" && echo " forcing $1 to \"$2\""
250 dnl APR_ADDTO(variable, value)
252 dnl Add value to variable
254 AC_DEFUN([APR_ADDTO], [
255 if test "x$$1" = "x"; then
256 test "x$silent" != "xyes" && echo " setting $1 to \"$2\""
259 apr_addto_bugger="$2"
260 for i in $apr_addto_bugger; do
261 apr_addto_duplicate="0"
263 if test "x$i" = "x$j"; then
264 apr_addto_duplicate="1"
268 if test $apr_addto_duplicate = "0"; then
269 test "x$silent" != "xyes" && echo " adding \"$i\" to $1"
277 dnl APR_REMOVEFROM(variable, value)
279 dnl Remove a value from a variable
281 AC_DEFUN([APR_REMOVEFROM], [
282 if test "x$$1" = "x$2"; then
283 test "x$silent" != "xyes" && echo " nulling $1"
289 if test "x$i" != "x$2"; then
290 apr_new_bugger="$apr_new_bugger $i"
295 if test $apr_removed = "1"; then
296 test "x$silent" != "xyes" && echo " removed \"$2\" from $1"
303 dnl APR_CHECK_DEFINE_FILES( symbol, header_file [header_file ...] )
305 AC_DEFUN([APR_CHECK_DEFINE_FILES], [
306 AC_CACHE_CHECK([for $1 in $2],ac_cv_define_$1,[
310 AC_EGREP_CPP(YES_IS_DEFINED, [
315 ], ac_cv_define_$1=yes)
318 if test "$ac_cv_define_$1" = "yes"; then
319 AC_DEFINE(HAVE_$1, 1, [Define if $1 is defined])
325 dnl APR_CHECK_DEFINE(symbol, header_file)
327 AC_DEFUN([APR_CHECK_DEFINE], [
328 AC_CACHE_CHECK([for $1 in $2],ac_cv_define_$1,[
329 AC_EGREP_CPP(YES_IS_DEFINED, [
334 ], ac_cv_define_$1=yes, ac_cv_define_$1=no)
336 if test "$ac_cv_define_$1" = "yes"; then
337 AC_DEFINE(HAVE_$1, 1, [Define if $1 is defined in $2])
342 dnl APR_CHECK_APR_DEFINE( symbol )
344 AC_DEFUN([APR_CHECK_APR_DEFINE], [
345 apr_old_cppflags=$CPPFLAGS
346 CPPFLAGS="$CPPFLAGS $INCLUDES"
347 AC_EGREP_CPP(YES_IS_DEFINED, [
352 ], ac_cv_define_$1=yes, ac_cv_define_$1=no)
353 CPPFLAGS=$apr_old_cppflags
356 dnl APR_CHECK_FILE(filename); set ac_cv_file_filename to
357 dnl "yes" if 'filename' is readable, else "no".
358 dnl @deprecated! - use AC_CHECK_FILE instead
359 AC_DEFUN([APR_CHECK_FILE], [
360 dnl Pick a safe variable name
361 define([apr_cvname], ac_cv_file_[]translit([$1], [./+-], [__p_]))
362 AC_CACHE_CHECK([for $1], [apr_cvname],
370 define(APR_IFALLYES,[dnl
372 for ac_spec in $1; do
373 ac_type=`echo "$ac_spec" | sed -e 's/:.*$//'`
374 ac_item=`echo "$ac_spec" | sed -e 's/^.*://'`
377 ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
378 ac_var="ac_cv_header_$ac_item"
381 ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
382 ac_var="ac_cv_file_$ac_item"
384 func ) ac_var="ac_cv_func_$ac_item" ;;
385 struct ) ac_var="ac_cv_struct_$ac_item" ;;
386 define ) ac_var="ac_cv_define_$ac_item" ;;
387 custom ) ac_var="$ac_item" ;;
389 eval "ac_val=\$$ac_var"
390 if test ".$ac_val" != .yes; then
395 if test ".$ac_rc" = .yes; then
405 define(APR_BEGIN_DECISION,[dnl
406 ac_decision_item='$1'
407 ac_decision_msg='FAILED'
412 AC_DEFUN([APR_DECIDE],[dnl
413 dnl Define the flag (or not) in apr_private.h via autoheader
414 AH_TEMPLATE($1, [Define if $2 will be used])
418 ac_decision_$1_msg='$2'
422 define(APR_DECISION_OVERRIDE,[dnl
424 for ac_item in $1; do
425 eval "ac_decision_this=\$ac_decision_${ac_item}"
426 if test ".$ac_decision_this" = .yes; then
428 eval "ac_decision_msg=\$ac_decision_${ac_item}_msg"
434 define(APR_DECISION_FORCE,[dnl
436 eval "ac_decision_msg=\"\$ac_decision_${ac_decision}_msg\""
440 define(APR_END_DECISION,[dnl
441 if test ".$ac_decision" = .; then
442 echo "[$]0:Error: decision on $ac_decision_item failed" 1>&2
445 if test ".$ac_decision_msg" = .; then
446 ac_decision_msg="$ac_decision"
448 AC_DEFINE_UNQUOTED(${ac_decision_item})
449 AC_MSG_RESULT([decision on $ac_decision_item... $ac_decision_msg])
455 dnl APR_CHECK_SIZEOF_EXTENDED(INCLUDES, TYPE [, CROSS_SIZE])
457 dnl A variant of AC_CHECK_SIZEOF which allows the checking of
458 dnl sizes of non-builtin types
460 AC_DEFUN([APR_CHECK_SIZEOF_EXTENDED],
461 [changequote(<<, >>)dnl
462 dnl The name to #define.
463 define(<<AC_TYPE_NAME>>, translit(sizeof_$2, [a-z *], [A-Z_P]))dnl
464 dnl The cache variable name.
465 define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$2, [ *], [_p]))dnl
467 AC_MSG_CHECKING(size of $2)
468 AC_CACHE_VAL(AC_CV_NAME,
469 [AC_TRY_RUN([#include <stdio.h>
478 FILE *f=fopen("conftestval", "w" binmode);
480 fprintf(f, "%d\n", sizeof($2));
482 }], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$3],,,
484 AC_MSG_RESULT($AC_CV_NAME)
485 AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The size of ]$2)
486 undefine([AC_TYPE_NAME])dnl
487 undefine([AC_CV_NAME])dnl
492 dnl APR_TRY_COMPILE_NO_WARNING(INCLUDES, FUNCTION-BODY,
493 dnl [ACTIONS-IF-NO-WARNINGS], [ACTIONS-IF-WARNINGS])
495 dnl Tries a compile test with warnings activated so that the result
496 dnl is false if the code doesn't compile cleanly. For compilers
497 dnl where it is not known how to activate a "fail-on-error" mode,
498 dnl it is undefined which of the sets of actions will be run.
500 AC_DEFUN([APR_TRY_COMPILE_NO_WARNING],
501 [apr_save_CFLAGS=$CFLAGS
502 CFLAGS="$CFLAGS $CFLAGS_WARN"
503 if test "$ac_cv_prog_gcc" = "yes"; then
504 CFLAGS="$CFLAGS -Werror"
508 [#include "confdefs.h"
511 [int main(int argc, const char *const *argv) {]
516 CFLAGS=$apr_save_CFLAGS
520 dnl APR_CHECK_STRERROR_R_RC
522 dnl Decide which style of retcode is used by this system's
523 dnl strerror_r(). It either returns int (0 for success, -1
524 dnl for failure), or it returns a pointer to the error
528 AC_DEFUN([APR_CHECK_STRERROR_R_RC], [
529 AC_MSG_CHECKING(for type of return code from strerror_r)
537 if (strerror_r(ERANGE, buf, sizeof buf) < 1) {
544 ac_cv_strerror_r_rc_int=yes ], [
545 ac_cv_strerror_r_rc_int=no ], [
546 ac_cv_strerror_r_rc_int=no ] )
547 if test "x$ac_cv_strerror_r_rc_int" = xyes; then
548 AC_DEFINE(STRERROR_R_RC_INT, 1, [Define if strerror returns int])
553 AC_MSG_RESULT([$msg])
557 dnl APR_CHECK_DIRENT_INODE
559 dnl Decide if d_fileno or d_ino are available in the dirent
560 dnl structure on this platform. Single UNIX Spec says d_ino,
561 dnl BSD uses d_fileno. Undef to find the real beast.
563 AC_DEFUN([APR_CHECK_DIRENT_INODE], [
564 AC_CACHE_CHECK([for inode member of struct dirent], apr_cv_dirent_inode, [
565 apr_cv_dirent_inode=no
567 #include <sys/types.h>
573 struct dirent de; de.d_fileno;
574 ], apr_cv_dirent_inode=d_fileno)
575 if test "$apr_cv_dirent_inode" = "no"; then
577 #include <sys/types.h>
583 struct dirent de; de.d_ino;
584 ], apr_cv_dirent_inode=d_ino)
587 if test "$apr_cv_dirent_inode" != "no"; then
588 AC_DEFINE_UNQUOTED(DIRENT_INODE, $apr_cv_dirent_inode,
589 [Define if struct dirent has an inode member])
594 dnl APR_CHECK_DIRENT_TYPE
596 dnl Decide if d_type is available in the dirent structure
597 dnl on this platform. Not part of the Single UNIX Spec.
598 dnl Note that this is worthless without DT_xxx macros, so
599 dnl look for one while we are at it.
601 AC_DEFUN([APR_CHECK_DIRENT_TYPE], [
602 AC_CACHE_CHECK([for file type member of struct dirent], apr_cv_dirent_type,[
603 apr_cv_dirent_type=no
605 #include <sys/types.h>
608 struct dirent de; de.d_type = DT_REG;
609 ], apr_cv_dirent_type=d_type)
611 if test "$apr_cv_dirent_type" != "no"; then
612 AC_DEFINE_UNQUOTED(DIRENT_TYPE, $apr_cv_dirent_type,
613 [Define if struct dirent has a d_type member])
617 dnl the following is a newline, a space, a tab, and a backslash (the
618 dnl backslash is used by the shell to skip newlines, but m4 sees it;
619 dnl treat it like whitespace).
620 dnl WARNING: don't reindent these lines, or the space/tab will be lost!
621 define([apr_whitespace],[
625 dnl APR_COMMA_ARGS(ARG1 ...)
626 dnl convert the whitespace-separated arguments into comman-separated
629 dnl APR_FOREACH(CODE-BLOCK, ARG1, ARG2, ...)
630 dnl subsitute CODE-BLOCK for each ARG[i]. "eachval" will be set to ARG[i]
631 dnl within each iteration.
634 define({APR_COMMA_ARGS},{patsubst([$}{1],[[}apr_whitespace{]+],[,])})
635 define({APR_FOREACH},
638 $}{2)$}{1[]APR_FOREACH([$}{1],
640 builtin([shift], $}{@)))])})
643 dnl APR_FLAG_HEADERS(HEADER-FILE ... [, FLAG-TO-SET ] [, "yes" ])
644 dnl we set FLAG-TO-SET to 1 if we find HEADER-FILE, otherwise we set to 0
645 dnl if FLAG-TO-SET is null, we automagically determine it's name
646 dnl by changing all "/" to "_" in the HEADER-FILE and dropping
647 dnl all "." and "-" chars. If the 3rd parameter is "yes" then instead of
648 dnl setting to 1 or 0, we set FLAG-TO-SET to yes or no.
650 AC_DEFUN([APR_FLAG_HEADERS], [
654 ac_safe=`echo "$aprt_i" | sed 'y%./+-%__p_%'`
655 aprt_2=`echo "$aprt_i" | sed -e 's%/%_%g' -e 's/\.//g' -e 's/-//g'`
656 if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
657 eval "ifelse($2,,$aprt_2,$2)=ifelse($3,yes,yes,1)"
659 eval "ifelse($2,,$aprt_2,$2)=ifelse($3,yes,no,0)"
664 dnl APR_FLAG_FUNCS(FUNC ... [, FLAG-TO-SET] [, "yes" ])
665 dnl if FLAG-TO-SET is null, we automagically determine it's name
666 dnl prepending "have_" to the function name in FUNC, otherwise
667 dnl we use what's provided as FLAG-TO-SET. If the 3rd parameter
668 dnl is "yes" then instead of setting to 1 or 0, we set FLAG-TO-SET
671 AC_DEFUN([APR_FLAG_FUNCS], [
675 aprt_3="have_$aprt_j"
676 if eval "test \"`echo '$ac_cv_func_'$aprt_j`\" = yes"; then
677 eval "ifelse($2,,$aprt_3,$2)=ifelse($3,yes,yes,1)"
679 eval "ifelse($2,,$aprt_3,$2)=ifelse($3,yes,no,0)"
684 dnl Iteratively interpolate the contents of the second argument
685 dnl until interpolation offers no new result. Then assign the
686 dnl final result to $1.
693 dnl APR_EXPAND_VAR(fraz, $baz)
694 dnl $fraz is now "1/2/3"
696 AC_DEFUN([APR_EXPAND_VAR], [
699 while test "x${ap_cur}" != "x${ap_last}";
702 ap_cur=`eval "echo ${ap_cur}"`
708 dnl Removes the value of $3 from the string in $2, strips of any leading
709 dnl slashes, and returns the value in $1.
712 dnl orig_path="${prefix}/bar"
713 dnl APR_PATH_RELATIVE(final_path, $orig_path, $prefix)
714 dnl $final_path now contains "bar"
715 AC_DEFUN([APR_PATH_RELATIVE], [
716 ap_stripped=`echo $2 | sed -e "s#^$3##"`
717 # check if the stripping was successful
718 if test "x$2" != "x${ap_stripped}"; then
719 # it was, so strip of any leading slashes
720 $1="`echo ${ap_stripped} | sed -e 's#^/*##'`"
722 # it wasn't so return the original
727 dnl APR_HELP_STRING(LHS, RHS)
728 dnl Autoconf 2.50 can not handle substr correctly. It does have
729 dnl AC_HELP_STRING, so let's try to call it if we can.
730 dnl Note: this define must be on one line so that it can be properly returned
731 dnl as the help string. When using this macro with a multi-line RHS, ensure
732 dnl that you surround the macro invocation with []s
733 AC_DEFUN([APR_HELP_STRING], [ifelse(regexp(AC_ACVERSION, 2\.1), -1, AC_HELP_STRING([$1],[$2]),[ ][$1] substr([ ],len($1))[$2])])
736 dnl APR_LAYOUT(configlayout, layoutname [, extravars])
738 AC_DEFUN([APR_LAYOUT], [
739 if test ! -f $srcdir/config.layout; then
740 echo "** Error: Layout file $srcdir/config.layout not found"
741 echo "** Error: Cannot use undefined layout '$LAYOUT'"
744 # Catch layout names including a slash which will otherwise
745 # confuse the heck out of the sed script.
748 echo "** Error: $2 is not a valid layout name"
753 sed -e "1s/[ ]*<[lL]ayout[ ]*$2[ ]*>[ ]*//;1t" \
754 -e "1,/[ ]*<[lL]ayout[ ]*$2[ ]*>[ ]*/d" \
755 -e '/[ ]*<\/Layout>[ ]*/,$d' \
761 if test ! -s $pldconf; then
762 echo "** Error: unable to find layout $layout_name"
767 for var in prefix exec_prefix bindir sbindir libexecdir mandir \
768 sysconfdir datadir includedir localstatedir runtimedir \
769 logfiledir libdir installbuilddir libsuffix $3; do
770 eval "val=\"\$$var\""
773 val=`echo $val | sed -e 's;\+$;;'`
774 eval "$var=\"\$val\""
781 val=`echo $val | sed -e 's:\(.\)/*$:\1:'`
782 val=`echo $val | sed -e 's:[\$]\([a-z_]*\):${\1}:g'`
783 if test "$autosuffix" = "yes"; then
784 if echo $val | grep apache >/dev/null; then
789 if test "$addtarget" = "yes"; then
799 dnl APR_ENABLE_LAYOUT(default layout name [, extra vars])
801 AC_DEFUN([APR_ENABLE_LAYOUT], [
802 AC_ARG_ENABLE(layout,
803 [ --enable-layout=LAYOUT],[
807 if test -z "$LAYOUT"; then
810 APR_LAYOUT($srcdir/config.layout, $LAYOUT, $2)
812 AC_MSG_CHECKING(for chosen layout)
813 AC_MSG_RESULT($layout_name)
818 dnl APR_PARSE_ARGUMENTS
819 dnl a reimplementation of autoconf's argument parser,
820 dnl used here to allow us to co-exist layouts and argument based
822 AC_DEFUN([APR_PARSE_ARGUMENTS], [
824 # Retrieve the command-line arguments. The eval is needed because
825 # the arguments are quoted to preserve accuracy.
826 eval "set x $ac_configure_args"
830 # If the previous option needs an argument, assign it.
831 if test -n "$ac_prev"; then
832 eval "$ac_prev=\$ac_option"
837 ac_optarg=`expr "x$ac_option" : 'x[[^=]]*=\(.*\)'`
841 -bindir | --bindir | --bindi | --bind | --bin | --bi)
843 -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
844 bindir="$ac_optarg" ;;
846 -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
848 -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
850 datadir="$ac_optarg" ;;
852 -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
853 | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
854 | --exec | --exe | --ex)
855 ac_prev=exec_prefix ;;
856 -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
857 | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
858 | --exec=* | --exe=* | --ex=*)
859 exec_prefix="$ac_optarg" ;;
861 -includedir | --includedir | --includedi | --included | --include \
862 | --includ | --inclu | --incl | --inc)
863 ac_prev=includedir ;;
864 -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
865 | --includ=* | --inclu=* | --incl=* | --inc=*)
866 includedir="$ac_optarg" ;;
868 -infodir | --infodir | --infodi | --infod | --info | --inf)
870 -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
871 infodir="$ac_optarg" ;;
873 -libdir | --libdir | --libdi | --libd)
875 -libdir=* | --libdir=* | --libdi=* | --libd=*)
876 libdir="$ac_optarg" ;;
878 -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
879 | --libexe | --libex | --libe)
880 ac_prev=libexecdir ;;
881 -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
882 | --libexe=* | --libex=* | --libe=*)
883 libexecdir="$ac_optarg" ;;
885 -localstatedir | --localstatedir | --localstatedi | --localstated \
886 | --localstate | --localstat | --localsta | --localst \
887 | --locals | --local | --loca | --loc | --lo)
888 ac_prev=localstatedir ;;
889 -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
890 | --localstate=* | --localstat=* | --localsta=* | --localst=* \
891 | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
892 localstatedir="$ac_optarg" ;;
894 -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
896 -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
897 mandir="$ac_optarg" ;;
899 -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
901 -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
902 prefix="$ac_optarg" ;;
904 -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
906 -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
908 sbindir="$ac_optarg" ;;
910 -sharedstatedir | --sharedstatedir | --sharedstatedi \
911 | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
912 | --sharedst | --shareds | --shared | --share | --shar \
914 ac_prev=sharedstatedir ;;
915 -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
916 | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
917 | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
919 sharedstatedir="$ac_optarg" ;;
921 -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
922 | --syscon | --sysco | --sysc | --sys | --sy)
923 ac_prev=sysconfdir ;;
924 -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
925 | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
926 sysconfdir="$ac_optarg" ;;
931 # Be sure to have absolute paths.
932 for ac_var in exec_prefix prefix
934 eval ac_val=$`echo $ac_var`
936 [[\\/$]]* | ?:[[\\/]]* | NONE | '' ) ;;
937 *) AC_MSG_ERROR([expected an absolute path for --$ac_var: $ac_val]);;
946 dnl Determine what program we can use to generate .deps-style dependencies
948 AC_DEFUN([APR_CHECK_DEPEND], [
949 dnl Try to determine what depend program we can use
950 dnl All GCC-variants should have -MM.
951 dnl If not, then we can check on those, too.
952 if test "$GCC" = "yes"; then
956 dnl <sys/types.h> should be available everywhere!
957 cat > conftest.c <<EOF
958 #include <sys/types.h>
959 int main() { return 0; }
962 for i in "$CC -MM" "$CC -M" "$CPP -MM" "$CPP -M" "cpp -M"; do
963 AC_MSG_CHECKING([if $i can create proper make dependencies])
964 if $i conftest.c 2>/dev/null | grep 'conftest.o: conftest.c' >/dev/null; then
978 dnl APR_CHECK_TYPES_COMPATIBLE(TYPE-1, TYPE-2, [ACTION-IF-TRUE])
980 dnl Try to determine whether two types are the same. Only works
983 AC_DEFUN([APR_CHECK_TYPES_COMPATIBLE], [
984 define([apr_cvname], apr_cv_typematch_[]translit([$1], [ ], [_])_[]translit([$2], [ ], [_]))
985 AC_CACHE_CHECK([whether $1 and $2 are the same], apr_cvname, [
986 AC_TRY_COMPILE(AC_INCLUDES_DEFAULT, [
987 int foo[0 - !__builtin_types_compatible_p($1, $2)];
989 $3], [apr_cvname=no])])