summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
Diffstat (limited to 'build')
-rw-r--r--build/apr_common.m4987
-rw-r--r--build/apu-conf.m4439
-rw-r--r--build/apu-hints.m462
-rw-r--r--build/apu-iconv.m4132
-rwxr-xr-xbuild/config.guess1748
-rwxr-xr-xbuild/config.sub1884
-rw-r--r--build/crypto.m4290
-rw-r--r--build/dbd.m4524
-rw-r--r--build/dbm.m4745
-rw-r--r--build/dso.m4117
-rw-r--r--build/find_apr.m4202
-rw-r--r--build/find_apu.m4211
-rwxr-xr-xbuild/get-version.sh37
-rwxr-xr-xbuild/install.sh112
-rwxr-xr-xbuild/mkdir.sh43
-rw-r--r--build/nw_apu_export.inc44
-rw-r--r--build/pkg/README20
-rwxr-xr-xbuild/pkg/buildpkg.sh99
-rw-r--r--build/pkg/pkginfo.in11
-rw-r--r--build/preaprutil.dsp131
-rw-r--r--build/rpm/apr-util.spec.in200
-rw-r--r--build/w32locatedb.pl217
22 files changed, 8255 insertions, 0 deletions
diff --git a/build/apr_common.m4 b/build/apr_common.m4
new file mode 100644
index 0000000..ac2312c
--- /dev/null
+++ b/build/apr_common.m4
@@ -0,0 +1,987 @@
+dnl -------------------------------------------------------- -*- autoconf -*-
+dnl Licensed to the Apache Software Foundation (ASF) under one or more
+dnl contributor license agreements. See the NOTICE file distributed with
+dnl this work for additional information regarding copyright ownership.
+dnl The ASF licenses this file to You under the Apache License, Version 2.0
+dnl (the "License"); you may not use this file except in compliance with
+dnl the License. You may obtain a copy of the License at
+dnl
+dnl http://www.apache.org/licenses/LICENSE-2.0
+dnl
+dnl Unless required by applicable law or agreed to in writing, software
+dnl distributed under the License is distributed on an "AS IS" BASIS,
+dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+dnl See the License for the specific language governing permissions and
+dnl limitations under the License.
+
+dnl
+dnl apr_common.m4: APR's general-purpose autoconf macros
+dnl
+
+dnl
+dnl APR_CONFIG_NICE(filename)
+dnl
+dnl Saves a snapshot of the configure command-line for later reuse
+dnl
+AC_DEFUN([APR_CONFIG_NICE], [
+ rm -f $1
+ cat >$1<<EOF
+#! /bin/sh
+#
+# Created by configure
+
+EOF
+ if test -n "$CC"; then
+ echo "CC=\"$CC\"; export CC" >> $1
+ fi
+ if test -n "$CFLAGS"; then
+ echo "CFLAGS=\"$CFLAGS\"; export CFLAGS" >> $1
+ fi
+ if test -n "$CPPFLAGS"; then
+ echo "CPPFLAGS=\"$CPPFLAGS\"; export CPPFLAGS" >> $1
+ fi
+ if test -n "$LDFLAGS"; then
+ echo "LDFLAGS=\"$LDFLAGS\"; export LDFLAGS" >> $1
+ fi
+ if test -n "$LTFLAGS"; then
+ echo "LTFLAGS=\"$LTFLAGS\"; export LTFLAGS" >> $1
+ fi
+ if test -n "$LIBS"; then
+ echo "LIBS=\"$LIBS\"; export LIBS" >> $1
+ fi
+ if test -n "$INCLUDES"; then
+ echo "INCLUDES=\"$INCLUDES\"; export INCLUDES" >> $1
+ fi
+ if test -n "$NOTEST_CFLAGS"; then
+ echo "NOTEST_CFLAGS=\"$NOTEST_CFLAGS\"; export NOTEST_CFLAGS" >> $1
+ fi
+ if test -n "$NOTEST_CPPFLAGS"; then
+ echo "NOTEST_CPPFLAGS=\"$NOTEST_CPPFLAGS\"; export NOTEST_CPPFLAGS" >> $1
+ fi
+ if test -n "$NOTEST_LDFLAGS"; then
+ echo "NOTEST_LDFLAGS=\"$NOTEST_LDFLAGS\"; export NOTEST_LDFLAGS" >> $1
+ fi
+ if test -n "$NOTEST_LIBS"; then
+ echo "NOTEST_LIBS=\"$NOTEST_LIBS\"; export NOTEST_LIBS" >> $1
+ fi
+
+ # Retrieve command-line arguments.
+ eval "set x $[0] $ac_configure_args"
+ shift
+
+ for arg
+ do
+ APR_EXPAND_VAR(arg, $arg)
+ echo "\"[$]arg\" \\" >> $1
+ done
+ echo '"[$]@"' >> $1
+ chmod +x $1
+])dnl
+
+dnl APR_MKDIR_P_CHECK(fallback-mkdir-p)
+dnl checks whether mkdir -p works
+AC_DEFUN([APR_MKDIR_P_CHECK], [
+ AC_CACHE_CHECK(for working mkdir -p, ac_cv_mkdir_p,[
+ test -d conftestdir && rm -rf conftestdir
+ mkdir -p conftestdir/somedir >/dev/null 2>&1
+ if test -d conftestdir/somedir; then
+ ac_cv_mkdir_p=yes
+ else
+ ac_cv_mkdir_p=no
+ fi
+ rm -rf conftestdir
+ ])
+ if test "$ac_cv_mkdir_p" = "yes"; then
+ mkdir_p="mkdir -p"
+ else
+ mkdir_p="$1"
+ fi
+])
+
+dnl
+dnl APR_SUBDIR_CONFIG(dir [, sub-package-cmdline-args, args-to-drop])
+dnl
+dnl dir: directory to find configure in
+dnl sub-package-cmdline-args: arguments to add to the invocation (optional)
+dnl args-to-drop: arguments to drop from the invocation (optional)
+dnl
+dnl Note: This macro relies on ac_configure_args being set properly.
+dnl
+dnl The args-to-drop argument is shoved into a case statement, so
+dnl multiple arguments can be separated with a |.
+dnl
+dnl Note: Older versions of autoconf do not single-quote args, while 2.54+
+dnl places quotes around every argument. So, if you want to drop the
+dnl argument called --enable-layout, you must pass the third argument as:
+dnl [--enable-layout=*|\'--enable-layout=*]
+dnl
+dnl Trying to optimize this is left as an exercise to the reader who wants
+dnl to put up with more autoconf craziness. I give up.
+dnl
+AC_DEFUN([APR_SUBDIR_CONFIG], [
+ # save our work to this point; this allows the sub-package to use it
+ AC_CACHE_SAVE
+
+ echo "configuring package in $1 now"
+ ac_popdir=`pwd`
+ apr_config_subdirs="$1"
+ test -d $1 || $mkdir_p $1
+ ac_abs_srcdir=`(cd $srcdir/$1 && pwd)`
+ cd $1
+
+changequote(, )dnl
+ # A "../" for each directory in /$config_subdirs.
+ ac_dots=`echo $apr_config_subdirs|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'`
+changequote([, ])dnl
+
+ # Make the cache file pathname absolute for the subdirs
+ # required to correctly handle subdirs that might actually
+ # be symlinks
+ case "$cache_file" in
+ /*) # already absolute
+ ac_sub_cache_file=$cache_file ;;
+ *) # Was relative path.
+ ac_sub_cache_file="$ac_popdir/$cache_file" ;;
+ esac
+
+ ifelse($3, [], [apr_configure_args=$ac_configure_args],[
+ apr_configure_args=
+ apr_sep=
+ for apr_configure_arg in $ac_configure_args
+ do
+ case "$apr_configure_arg" in
+ $3)
+ continue ;;
+ esac
+ apr_configure_args="$apr_configure_args$apr_sep'$apr_configure_arg'"
+ apr_sep=" "
+ done
+ ])
+
+ dnl autoconf doesn't add --silent to ac_configure_args; explicitly pass it
+ test "x$silent" = "xyes" && apr_configure_args="$apr_configure_args --silent"
+
+ dnl AC_CONFIG_SUBDIRS silences option warnings, emulate this for 2.62
+ apr_configure_args="--disable-option-checking $apr_configure_args"
+
+ dnl The eval makes quoting arguments work - specifically the second argument
+ dnl where the quoting mechanisms used is "" rather than [].
+ dnl
+ dnl We need to execute another shell because some autoconf/shell combinations
+ dnl will choke after doing repeated APR_SUBDIR_CONFIG()s. (Namely Solaris
+ dnl and autoconf-2.54+)
+ if eval $SHELL $ac_abs_srcdir/configure $apr_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_abs_srcdir $2
+ then :
+ echo "$1 configured properly"
+ else
+ echo "configure failed for $1"
+ exit 1
+ fi
+
+ cd $ac_popdir
+
+ # grab any updates from the sub-package
+ AC_CACHE_LOAD
+])dnl
+
+dnl
+dnl APR_SAVE_THE_ENVIRONMENT(variable_name)
+dnl
+dnl Stores the variable (usually a Makefile macro) for later restoration
+dnl
+AC_DEFUN([APR_SAVE_THE_ENVIRONMENT], [
+ apr_ste_save_$1="$$1"
+])dnl
+
+dnl
+dnl APR_RESTORE_THE_ENVIRONMENT(variable_name, prefix_)
+dnl
+dnl Uses the previously saved variable content to figure out what configure
+dnl has added to the variable, moving the new bits to prefix_variable_name
+dnl and restoring the original variable contents. This makes it possible
+dnl for a user to override configure when it does something stupid.
+dnl
+AC_DEFUN([APR_RESTORE_THE_ENVIRONMENT], [
+dnl Check whether $apr_ste_save_$1 is empty or
+dnl only whitespace. The verbatim "X" is token number 1,
+dnl the following whitespace will be ignored.
+set X $apr_ste_save_$1
+if test ${#} -eq 1; then
+ $2$1="$$1"
+ $1=
+else
+ if test "x$apr_ste_save_$1" = "x$$1"; then
+ $2$1=
+ else
+ $2$1=`echo "$$1" | sed -e "s%${apr_ste_save_$1}%%"`
+ $1="$apr_ste_save_$1"
+ fi
+fi
+if test "x$silent" != "xyes"; then
+ echo " restoring $1 to \"$$1\""
+ echo " setting $2$1 to \"$$2$1\""
+fi
+AC_SUBST($2$1)
+])dnl
+
+dnl
+dnl APR_SETIFNULL(variable, value)
+dnl
+dnl Set variable iff it's currently null
+dnl
+AC_DEFUN([APR_SETIFNULL], [
+ if test -z "$$1"; then
+ test "x$silent" != "xyes" && echo " setting $1 to \"$2\""
+ $1="$2"
+ fi
+])dnl
+
+dnl
+dnl APR_SETVAR(variable, value)
+dnl
+dnl Set variable no matter what
+dnl
+AC_DEFUN([APR_SETVAR], [
+ test "x$silent" != "xyes" && echo " forcing $1 to \"$2\""
+ $1="$2"
+])dnl
+
+dnl
+dnl APR_ADDTO(variable, value)
+dnl
+dnl Add value to variable
+dnl
+AC_DEFUN([APR_ADDTO], [
+ if test "x$$1" = "x"; then
+ test "x$silent" != "xyes" && echo " setting $1 to \"$2\""
+ $1="$2"
+ else
+ apr_addto_bugger="$2"
+ for i in $apr_addto_bugger; do
+ apr_addto_duplicate="0"
+ for j in $$1; do
+ if test "x$i" = "x$j"; then
+ apr_addto_duplicate="1"
+ break
+ fi
+ done
+ if test $apr_addto_duplicate = "0"; then
+ test "x$silent" != "xyes" && echo " adding \"$i\" to $1"
+ $1="$$1 $i"
+ fi
+ done
+ fi
+])dnl
+
+dnl
+dnl APR_REMOVEFROM(variable, value)
+dnl
+dnl Remove a value from a variable
+dnl
+AC_DEFUN([APR_REMOVEFROM], [
+ if test "x$$1" = "x$2"; then
+ test "x$silent" != "xyes" && echo " nulling $1"
+ $1=""
+ else
+ apr_new_bugger=""
+ apr_removed=0
+ for i in $$1; do
+ if test "x$i" != "x$2"; then
+ apr_new_bugger="$apr_new_bugger $i"
+ else
+ apr_removed=1
+ fi
+ done
+ if test $apr_removed = "1"; then
+ test "x$silent" != "xyes" && echo " removed \"$2\" from $1"
+ $1=$apr_new_bugger
+ fi
+ fi
+]) dnl
+
+dnl
+dnl APR_CHECK_DEFINE_FILES( symbol, header_file [header_file ...] )
+dnl
+AC_DEFUN([APR_CHECK_DEFINE_FILES], [
+ AC_CACHE_CHECK([for $1 in $2],ac_cv_define_$1,[
+ ac_cv_define_$1=no
+ for curhdr in $2
+ do
+ AC_EGREP_CPP(YES_IS_DEFINED, [
+#include <$curhdr>
+#ifdef $1
+YES_IS_DEFINED
+#endif
+ ], ac_cv_define_$1=yes)
+ done
+ ])
+ if test "$ac_cv_define_$1" = "yes"; then
+ AC_DEFINE(HAVE_$1, 1, [Define if $1 is defined])
+ fi
+])
+
+
+dnl
+dnl APR_CHECK_DEFINE(symbol, header_file)
+dnl
+AC_DEFUN([APR_CHECK_DEFINE], [
+ AC_CACHE_CHECK([for $1 in $2],ac_cv_define_$1,[
+ AC_EGREP_CPP(YES_IS_DEFINED, [
+#include <$2>
+#ifdef $1
+YES_IS_DEFINED
+#endif
+ ], ac_cv_define_$1=yes, ac_cv_define_$1=no)
+ ])
+ if test "$ac_cv_define_$1" = "yes"; then
+ AC_DEFINE(HAVE_$1, 1, [Define if $1 is defined in $2])
+ fi
+])
+
+dnl
+dnl APR_CHECK_APR_DEFINE( symbol )
+dnl
+AC_DEFUN([APR_CHECK_APR_DEFINE], [
+apr_old_cppflags=$CPPFLAGS
+CPPFLAGS="$CPPFLAGS $INCLUDES"
+AC_EGREP_CPP(YES_IS_DEFINED, [
+#include <apr.h>
+#if $1
+YES_IS_DEFINED
+#endif
+], ac_cv_define_$1=yes, ac_cv_define_$1=no)
+CPPFLAGS=$apr_old_cppflags
+])
+
+dnl APR_CHECK_FILE(filename); set ac_cv_file_filename to
+dnl "yes" if 'filename' is readable, else "no".
+dnl @deprecated! - use AC_CHECK_FILE instead
+AC_DEFUN([APR_CHECK_FILE], [
+dnl Pick a safe variable name
+define([apr_cvname], ac_cv_file_[]translit([$1], [./+-], [__p_]))
+AC_CACHE_CHECK([for $1], [apr_cvname],
+[if test -r $1; then
+ apr_cvname=yes
+ else
+ apr_cvname=no
+ fi])
+])
+
+define(APR_IFALLYES,[dnl
+ac_rc=yes
+for ac_spec in $1; do
+ ac_type=`echo "$ac_spec" | sed -e 's/:.*$//'`
+ ac_item=`echo "$ac_spec" | sed -e 's/^.*://'`
+ case $ac_type in
+ header )
+ ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
+ ac_var="ac_cv_header_$ac_item"
+ ;;
+ file )
+ ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
+ ac_var="ac_cv_file_$ac_item"
+ ;;
+ func ) ac_var="ac_cv_func_$ac_item" ;;
+ struct ) ac_var="ac_cv_struct_$ac_item" ;;
+ define ) ac_var="ac_cv_define_$ac_item" ;;
+ custom ) ac_var="$ac_item" ;;
+ esac
+ eval "ac_val=\$$ac_var"
+ if test ".$ac_val" != .yes; then
+ ac_rc=no
+ break
+ fi
+done
+if test ".$ac_rc" = .yes; then
+ :
+ $2
+else
+ :
+ $3
+fi
+])
+
+
+define(APR_BEGIN_DECISION,[dnl
+ac_decision_item='$1'
+ac_decision_msg='FAILED'
+ac_decision=''
+])
+
+
+AC_DEFUN([APR_DECIDE],[dnl
+dnl Define the flag (or not) in apr_private.h via autoheader
+AH_TEMPLATE($1, [Define if $2 will be used])
+ac_decision='$1'
+ac_decision_msg='$2'
+ac_decision_$1=yes
+ac_decision_$1_msg='$2'
+])
+
+
+define(APR_DECISION_OVERRIDE,[dnl
+ ac_decision=''
+ for ac_item in $1; do
+ eval "ac_decision_this=\$ac_decision_${ac_item}"
+ if test ".$ac_decision_this" = .yes; then
+ ac_decision=$ac_item
+ eval "ac_decision_msg=\$ac_decision_${ac_item}_msg"
+ fi
+ done
+])
+
+
+define(APR_DECISION_FORCE,[dnl
+ac_decision="$1"
+eval "ac_decision_msg=\"\$ac_decision_${ac_decision}_msg\""
+])
+
+
+define(APR_END_DECISION,[dnl
+if test ".$ac_decision" = .; then
+ echo "[$]0:Error: decision on $ac_decision_item failed" 1>&2
+ exit 1
+else
+ if test ".$ac_decision_msg" = .; then
+ ac_decision_msg="$ac_decision"
+ fi
+ AC_DEFINE_UNQUOTED(${ac_decision_item})
+ AC_MSG_RESULT([decision on $ac_decision_item... $ac_decision_msg])
+fi
+])
+
+
+dnl
+dnl APR_TRY_COMPILE_NO_WARNING(INCLUDES, FUNCTION-BODY,
+dnl [ACTIONS-IF-NO-WARNINGS], [ACTIONS-IF-WARNINGS])
+dnl
+dnl Tries a compile test with warnings activated so that the result
+dnl is false if the code doesn't compile cleanly. For compilers
+dnl where it is not known how to activate a "fail-on-error" mode,
+dnl it is undefined which of the sets of actions will be run.
+dnl
+AC_DEFUN([APR_TRY_COMPILE_NO_WARNING],
+[apr_save_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS $CFLAGS_WARN"
+ if test "$ac_cv_prog_gcc" = "yes"; then
+ CFLAGS="$CFLAGS -Werror"
+ fi
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [
+#ifndef PACKAGE_NAME
+#include "confdefs.h"
+#endif
+ ]
+ [[$1]]
+ [int main(int argc, const char *const *argv) {]
+ [[$2]]
+ [ return 0; }]
+ )], [CFLAGS=$apr_save_CFLAGS
+$3], [CFLAGS=$apr_save_CFLAGS
+$4])
+])
+
+dnl
+dnl APR_CHECK_STRERROR_R_RC
+dnl
+dnl Decide which style of retcode is used by this system's
+dnl strerror_r(). It either returns int (0 for success, -1
+dnl for failure), or it returns a pointer to the error
+dnl string.
+dnl
+dnl
+AC_DEFUN([APR_CHECK_STRERROR_R_RC], [
+AC_CACHE_CHECK([whether return code from strerror_r has type int],
+[ac_cv_strerror_r_rc_int],
+[AC_TRY_RUN([
+#include <errno.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+int main(void)
+{
+ char buf[1024];
+ if (strerror_r(ERANGE, buf, sizeof buf) < 1) {
+ exit(0);
+ }
+ else {
+ exit(1);
+ }
+}], [
+ ac_cv_strerror_r_rc_int=yes ], [
+ ac_cv_strerror_r_rc_int=no ], [
+ ac_cv_strerror_r_rc_int=no ] ) ] )
+if test "x$ac_cv_strerror_r_rc_int" = xyes; then
+ AC_DEFINE(STRERROR_R_RC_INT, 1, [Define if strerror returns int])
+fi
+] )
+
+dnl
+dnl APR_CHECK_DIRENT_INODE
+dnl
+dnl Decide if d_fileno or d_ino are available in the dirent
+dnl structure on this platform. Single UNIX Spec says d_ino,
+dnl BSD uses d_fileno. Undef to find the real beast.
+dnl
+AC_DEFUN([APR_CHECK_DIRENT_INODE], [
+AC_CACHE_CHECK([for inode member of struct dirent], apr_cv_dirent_inode, [
+apr_cv_dirent_inode=no
+AC_TRY_COMPILE([
+#include <sys/types.h>
+#include <dirent.h>
+],[
+#ifdef d_ino
+#undef d_ino
+#endif
+struct dirent de; de.d_fileno;
+], apr_cv_dirent_inode=d_fileno)
+if test "$apr_cv_dirent_inode" = "no"; then
+AC_TRY_COMPILE([
+#include <sys/types.h>
+#include <dirent.h>
+],[
+#ifdef d_fileno
+#undef d_fileno
+#endif
+struct dirent de; de.d_ino;
+], apr_cv_dirent_inode=d_ino)
+fi
+])
+if test "$apr_cv_dirent_inode" != "no"; then
+ AC_DEFINE_UNQUOTED(DIRENT_INODE, $apr_cv_dirent_inode,
+ [Define if struct dirent has an inode member])
+fi
+])
+
+dnl
+dnl APR_CHECK_DIRENT_TYPE
+dnl
+dnl Decide if d_type is available in the dirent structure
+dnl on this platform. Not part of the Single UNIX Spec.
+dnl Note that this is worthless without DT_xxx macros, so
+dnl look for one while we are at it.
+dnl
+AC_DEFUN([APR_CHECK_DIRENT_TYPE], [
+AC_CACHE_CHECK([for file type member of struct dirent], apr_cv_dirent_type,[
+apr_cv_dirent_type=no
+AC_TRY_COMPILE([
+#include <sys/types.h>
+#include <dirent.h>
+],[
+struct dirent de; de.d_type = DT_REG;
+], apr_cv_dirent_type=d_type)
+])
+if test "$apr_cv_dirent_type" != "no"; then
+ AC_DEFINE_UNQUOTED(DIRENT_TYPE, $apr_cv_dirent_type,
+ [Define if struct dirent has a d_type member])
+fi
+])
+
+dnl the following is a newline, a space, a tab, and a backslash (the
+dnl backslash is used by the shell to skip newlines, but m4 sees it;
+dnl treat it like whitespace).
+dnl WARNING: don't reindent these lines, or the space/tab will be lost!
+define([apr_whitespace],[
+ \])
+
+dnl
+dnl APR_COMMA_ARGS(ARG1 ...)
+dnl convert the whitespace-separated arguments into comman-separated
+dnl arguments.
+dnl
+dnl APR_FOREACH(CODE-BLOCK, ARG1, ARG2, ...)
+dnl subsitute CODE-BLOCK for each ARG[i]. "eachval" will be set to ARG[i]
+dnl within each iteration.
+dnl
+changequote({,})
+define({APR_COMMA_ARGS},{patsubst([$}{1],[[}apr_whitespace{]+],[,])})
+define({APR_FOREACH},
+ {ifelse($}{2,,,
+ [define([eachval],
+ $}{2)$}{1[]APR_FOREACH([$}{1],
+ builtin([shift],
+ builtin([shift], $}{@)))])})
+changequote([,])
+
+dnl APR_FLAG_HEADERS(HEADER-FILE ... [, FLAG-TO-SET ] [, "yes" ])
+dnl we set FLAG-TO-SET to 1 if we find HEADER-FILE, otherwise we set to 0
+dnl if FLAG-TO-SET is null, we automagically determine it's name
+dnl by changing all "/" to "_" in the HEADER-FILE and dropping
+dnl all "." and "-" chars. If the 3rd parameter is "yes" then instead of
+dnl setting to 1 or 0, we set FLAG-TO-SET to yes or no.
+dnl
+AC_DEFUN([APR_FLAG_HEADERS], [
+AC_CHECK_HEADERS($1)
+for aprt_i in $1
+do
+ ac_safe=`echo "$aprt_i" | sed 'y%./+-%__p_%'`
+ aprt_2=`echo "$aprt_i" | sed -e 's%/%_%g' -e 's/\.//g' -e 's/-//g'`
+ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ eval "ifelse($2,,$aprt_2,$2)=ifelse($3,yes,yes,1)"
+ else
+ eval "ifelse($2,,$aprt_2,$2)=ifelse($3,yes,no,0)"
+ fi
+done
+])
+
+dnl APR_FLAG_FUNCS(FUNC ... [, FLAG-TO-SET] [, "yes" ])
+dnl if FLAG-TO-SET is null, we automagically determine it's name
+dnl prepending "have_" to the function name in FUNC, otherwise
+dnl we use what's provided as FLAG-TO-SET. If the 3rd parameter
+dnl is "yes" then instead of setting to 1 or 0, we set FLAG-TO-SET
+dnl to yes or no.
+dnl
+AC_DEFUN([APR_FLAG_FUNCS], [
+AC_CHECK_FUNCS($1)
+for aprt_j in $1
+do
+ aprt_3="have_$aprt_j"
+ if eval "test \"`echo '$ac_cv_func_'$aprt_j`\" = yes"; then
+ eval "ifelse($2,,$aprt_3,$2)=ifelse($3,yes,yes,1)"
+ else
+ eval "ifelse($2,,$aprt_3,$2)=ifelse($3,yes,no,0)"
+ fi
+done
+])
+
+dnl Iteratively interpolate the contents of the second argument
+dnl until interpolation offers no new result. Then assign the
+dnl final result to $1.
+dnl
+dnl Example:
+dnl
+dnl foo=1
+dnl bar='${foo}/2'
+dnl baz='${bar}/3'
+dnl APR_EXPAND_VAR(fraz, $baz)
+dnl $fraz is now "1/2/3"
+dnl
+AC_DEFUN([APR_EXPAND_VAR], [
+ap_last=
+ap_cur="$2"
+while test "x${ap_cur}" != "x${ap_last}";
+do
+ ap_last="${ap_cur}"
+ ap_cur=`eval "echo ${ap_cur}"`
+done
+$1="${ap_cur}"
+])
+
+dnl
+dnl Removes the value of $3 from the string in $2, strips of any leading
+dnl slashes, and returns the value in $1.
+dnl
+dnl Example:
+dnl orig_path="${prefix}/bar"
+dnl APR_PATH_RELATIVE(final_path, $orig_path, $prefix)
+dnl $final_path now contains "bar"
+AC_DEFUN([APR_PATH_RELATIVE], [
+ap_stripped=`echo $2 | sed -e "s#^$3##"`
+# check if the stripping was successful
+if test "x$2" != "x${ap_stripped}"; then
+ # it was, so strip of any leading slashes
+ $1="`echo ${ap_stripped} | sed -e 's#^/*##'`"
+else
+ # it wasn't so return the original
+ $1="$2"
+fi
+])
+
+dnl APR_HELP_STRING(LHS, RHS)
+dnl Autoconf 2.50 can not handle substr correctly. It does have
+dnl AC_HELP_STRING, so let's try to call it if we can.
+dnl Note: this define must be on one line so that it can be properly returned
+dnl as the help string. When using this macro with a multi-line RHS, ensure
+dnl that you surround the macro invocation with []s
+AC_DEFUN([APR_HELP_STRING], [ifelse(regexp(AC_ACVERSION, 2\.1), -1, AC_HELP_STRING([$1],[$2]),[ ][$1] substr([ ],len($1))[$2])])
+
+dnl
+dnl APR_LAYOUT(configlayout, layoutname [, extravars])
+dnl
+AC_DEFUN([APR_LAYOUT], [
+ if test ! -f $srcdir/config.layout; then
+ echo "** Error: Layout file $srcdir/config.layout not found"
+ echo "** Error: Cannot use undefined layout '$LAYOUT'"
+ exit 1
+ fi
+ # Catch layout names including a slash which will otherwise
+ # confuse the heck out of the sed script.
+ case $2 in
+ */*)
+ echo "** Error: $2 is not a valid layout name"
+ exit 1 ;;
+ esac
+ pldconf=./config.pld
+ changequote({,})
+ sed -e "1s/[ ]*<[lL]ayout[ ]*$2[ ]*>[ ]*//;1t" \
+ -e "1,/[ ]*<[lL]ayout[ ]*$2[ ]*>[ ]*/d" \
+ -e '/[ ]*<\/Layout>[ ]*/,$d' \
+ -e "s/^[ ]*//g" \
+ -e "s/:[ ]*/=\'/g" \
+ -e "s/[ ]*$/'/g" \
+ $1 > $pldconf
+ layout_name=$2
+ if test ! -s $pldconf; then
+ echo "** Error: unable to find layout $layout_name"
+ exit 1
+ fi
+ . $pldconf
+ rm $pldconf
+ for var in prefix exec_prefix bindir sbindir libexecdir mandir \
+ sysconfdir datadir includedir localstatedir runtimedir \
+ logfiledir libdir installbuilddir libsuffix $3; do
+ eval "val=\"\$$var\""
+ case $val in
+ *+)
+ val=`echo $val | sed -e 's;\+$;;'`
+ eval "$var=\"\$val\""
+ autosuffix=yes
+ ;;
+ *)
+ autosuffix=no
+ ;;
+ esac
+ val=`echo $val | sed -e 's:\(.\)/*$:\1:'`
+ val=`echo $val | sed -e 's:[\$]\([a-z_]*\):${\1}:g'`
+ if test "$autosuffix" = "yes"; then
+ if echo $val | grep apache >/dev/null; then
+ addtarget=no
+ else
+ addtarget=yes
+ fi
+ if test "$addtarget" = "yes"; then
+ val="$val/apache2"
+ fi
+ fi
+ eval "$var='$val'"
+ done
+ changequote([,])
+])dnl
+
+dnl
+dnl APR_ENABLE_LAYOUT(default layout name [, extra vars])
+dnl
+AC_DEFUN([APR_ENABLE_LAYOUT], [
+AC_ARG_ENABLE(layout,
+[ --enable-layout=LAYOUT],[
+ LAYOUT=$enableval
+])
+
+if test -z "$LAYOUT"; then
+ LAYOUT="$1"
+fi
+APR_LAYOUT($srcdir/config.layout, $LAYOUT, $2)
+
+AC_MSG_CHECKING(for chosen layout)
+AC_MSG_RESULT($layout_name)
+])
+
+
+dnl
+dnl APR_PARSE_ARGUMENTS
+dnl a reimplementation of autoconf's argument parser,
+dnl used here to allow us to co-exist layouts and argument based
+dnl set ups.
+AC_DEFUN([APR_PARSE_ARGUMENTS], [
+ac_prev=
+# Retrieve the command-line arguments. The eval is needed because
+# the arguments are quoted to preserve accuracy.
+eval "set x $ac_configure_args"
+shift
+for ac_option
+do
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval "$ac_prev=\$ac_option"
+ ac_prev=
+ continue
+ fi
+
+ ac_optarg=`expr "x$ac_option" : 'x[[^=]]*=\(.*\)'`
+
+ case $ac_option in
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir="$ac_optarg" ;;
+
+ -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+ | --da=*)
+ datadir="$ac_optarg" ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix="$ac_optarg" ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir="$ac_optarg" ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir="$ac_optarg" ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir="$ac_optarg" ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir="$ac_optarg" ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst \
+ | --locals | --local | --loca | --loc | --lo)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ localstatedir="$ac_optarg" ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir="$ac_optarg" ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix="$ac_optarg" ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir="$ac_optarg" ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir="$ac_optarg" ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir="$ac_optarg" ;;
+
+ esac
+done
+
+# Be sure to have absolute paths.
+for ac_var in exec_prefix prefix
+do
+ eval ac_val=$`echo $ac_var`
+ case $ac_val in
+ [[\\/$]]* | ?:[[\\/]]* | NONE | '' ) ;;
+ *) AC_MSG_ERROR([expected an absolute path for --$ac_var: $ac_val]);;
+ esac
+done
+
+])dnl
+
+dnl
+dnl APR_CHECK_DEPEND
+dnl
+dnl Determine what program we can use to generate .deps-style dependencies
+dnl
+AC_DEFUN([APR_CHECK_DEPEND], [
+dnl Try to determine what depend program we can use
+dnl All GCC-variants should have -MM.
+dnl If not, then we can check on those, too.
+if test "$GCC" = "yes"; then
+ MKDEP='$(CC) -MM'
+else
+ rm -f conftest.c
+dnl <sys/types.h> should be available everywhere!
+ cat > conftest.c <<EOF
+#include <sys/types.h>
+ int main() { return 0; }
+EOF
+ MKDEP="true"
+ for i in "$CC -MM" "$CC -M" "$CPP -MM" "$CPP -M" "cpp -M"; do
+ AC_MSG_CHECKING([if $i can create proper make dependencies])
+ if $i conftest.c 2>/dev/null | grep 'conftest.o: conftest.c' >/dev/null; then
+ MKDEP=$i
+ AC_MSG_RESULT(yes)
+ break;
+ fi
+ AC_MSG_RESULT(no)
+ done
+ rm -f conftest.c
+fi
+
+AC_SUBST(MKDEP)
+])
+
+dnl
+dnl APR_CHECK_TYPES_FMT_COMPATIBLE(TYPE-1, TYPE-2, FMT-TAG,
+dnl [ACTION-IF-TRUE], [ACTION-IF-FALSE])
+dnl
+dnl Try to determine whether two types are the same and accept the given
+dnl printf formatter (bare token, e.g. literal d, ld, etc).
+dnl
+AC_DEFUN([APR_CHECK_TYPES_FMT_COMPATIBLE], [
+define([apr_cvname], apr_cv_typematch_[]translit([$1], [ ], [_])_[]translit([$2], [ ], [_])_[][$3])
+AC_CACHE_CHECK([whether $1 and $2 use fmt %$3], apr_cvname, [
+APR_TRY_COMPILE_NO_WARNING([#include <sys/types.h>
+#include <stdio.h>
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+], [
+ $1 chk1, *ptr1;
+ $2 chk2, *ptr2 = &chk1;
+ ptr1 = &chk2;
+ *ptr1 = *ptr2 = 0;
+ printf("%$3 %$3", chk1, chk2);
+], [apr_cvname=yes], [apr_cvname=no])])
+if test "$apr_cvname" = "yes"; then
+ :
+ $4
+else
+ :
+ $5
+fi
+])
+
+dnl
+dnl APR_CHECK_TYPES_COMPATIBLE(TYPE-1, TYPE-2, [ACTION-IF-TRUE])
+dnl
+dnl Try to determine whether two types are the same. Only works
+dnl for gcc and icc.
+dnl
+dnl @deprecated @see APR_CHECK_TYPES_FMT_COMPATIBLE
+dnl
+AC_DEFUN([APR_CHECK_TYPES_COMPATIBLE], [
+define([apr_cvname], apr_cv_typematch_[]translit([$1], [ ], [_])_[]translit([$2], [ ], [_]))
+AC_CACHE_CHECK([whether $1 and $2 are the same], apr_cvname, [
+AC_TRY_COMPILE(AC_INCLUDES_DEFAULT, [
+ int foo[0 - !__builtin_types_compatible_p($1, $2)];
+], [apr_cvname=yes
+$3], [apr_cvname=no])])
+])
diff --git a/build/apu-conf.m4 b/build/apu-conf.m4
new file mode 100644
index 0000000..127d75f
--- /dev/null
+++ b/build/apu-conf.m4
@@ -0,0 +1,439 @@
+dnl -------------------------------------------------------- -*- autoconf -*-
+dnl Licensed to the Apache Software Foundation (ASF) under one or more
+dnl contributor license agreements. See the NOTICE file distributed with
+dnl this work for additional information regarding copyright ownership.
+dnl The ASF licenses this file to You under the Apache License, Version 2.0
+dnl (the "License"); you may not use this file except in compliance with
+dnl the License. You may obtain a copy of the License at
+dnl
+dnl http://www.apache.org/licenses/LICENSE-2.0
+dnl
+dnl Unless required by applicable law or agreed to in writing, software
+dnl distributed under the License is distributed on an "AS IS" BASIS,
+dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+dnl See the License for the specific language governing permissions and
+dnl limitations under the License.
+
+
+dnl
+dnl custom autoconf rules for APRUTIL
+dnl
+
+dnl
+dnl APU_FIND_APR: figure out where APR is located
+dnl
+AC_DEFUN([APU_FIND_APR], [
+
+ dnl use the find_apr.m4 script to locate APR. sets apr_found and apr_config
+ APR_FIND_APR(,,,[1])
+ if test "$apr_found" = "no"; then
+ AC_MSG_ERROR(APR could not be located. Please use the --with-apr option.)
+ fi
+
+ APR_BUILD_DIR="`$apr_config --installbuilddir`"
+
+ dnl make APR_BUILD_DIR an absolute directory (we'll need it in the
+ dnl sub-projects in some cases)
+ APR_BUILD_DIR="`cd $APR_BUILD_DIR && pwd`"
+
+ APR_INCLUDES="`$apr_config --includes`"
+ APR_LIBS="`$apr_config --link-libtool --libs`"
+ APR_SO_EXT="`$apr_config --apr-so-ext`"
+ APR_LIB_TARGET="`$apr_config --apr-lib-target`"
+
+ AC_SUBST(APR_INCLUDES)
+ AC_SUBST(APR_LIBS)
+ AC_SUBST(APR_BUILD_DIR)
+])
+
+dnl
+dnl APU_TRY_EXPAT_LINK(
+dnl test-message, cache-var-name, hdrs, libs,
+dnl [actions-on-success], [actions-on-failure])
+dnl
+dnl Tests linking against expat with libraries 'libs' and includes
+dnl 'hdrs', passing message + cache-var-name to AC_CACHE_CHECK.
+dnl On success, sets $expat_libs to libs, sets $apu_have_expat to 1,
+dnl and runs actions-on-success; on failure runs actions-on-failure.
+dnl
+AC_DEFUN([APU_TRY_EXPAT_LINK], [
+AC_CACHE_CHECK([$1], [$2], [
+ apu_expat_LIBS=$LIBS
+ LIBS="$LIBS $4"
+ AC_TRY_LINK([#include <stdlib.h>
+#include <$3>], [XML_ParserCreate(NULL);],
+ [$2=yes], [$2=no])
+ LIBS=$apu_expat_LIBS
+])
+
+if test $[$2] = yes; then
+ AC_DEFINE([HAVE_]translit([$3], [a-z./], [A-Z__]), 1,
+ [Define if $3 is available])
+ apu_expat_libs="$4"
+ apu_has_expat=1
+ $5
+else
+ apu_has_expat=0
+ $6
+fi
+])
+
+dnl
+dnl APU_SYSTEM_EXPAT: tests for a system expat installation
+dnl If present, sets $apu_has_expat to 1 and adjusts LDFLAGS/CPPFLAGS
+dnl appropriately. This is mostly for compatibility with existing
+dnl expat releases; all but the first APU_TRY_EXPAT_LINK call could
+dnl be dropped later.
+dnl
+AC_DEFUN([APU_SYSTEM_EXPAT], [
+
+ APU_TRY_EXPAT_LINK([Expat 1.95.x], apu_cv_expat_system,
+ [expat.h], [-lexpat])
+
+ if test $apu_has_expat = 0; then
+ APU_TRY_EXPAT_LINK([old Debian-packaged expat], apu_cv_expat_debian,
+ [xmltok/xmlparse.h], [-lxmlparse -lxmltok])
+ fi
+
+ if test $apu_has_expat = 0; then
+ APU_TRY_EXPAT_LINK([old FreeBSD-packaged expat], apu_cv_expat_freebsd,
+ [xml/xmlparse.h], [-lexpat])
+ fi
+
+ if test $apu_has_expat = 0; then
+ APU_TRY_EXPAT_LINK([Expat 1.0/1.1], apu_cv_expat_1011,
+ [xmlparse/xmlparse.h], [-lexpat])
+ fi
+
+ if test $apu_has_expat = 0; then
+ APR_ADDTO(LDFLAGS, [-L/usr/local/lib])
+ APR_ADDTO(CPPFLAGS, [-I/usr/local/include])
+
+ APU_TRY_EXPAT_LINK([Expat 1.95.x in /usr/local],
+ apu_cv_expat_usrlocal, [expat.h], [-lexpat],
+ [APR_ADDTO(APRUTIL_INCLUDES, [-I/usr/local/include])
+ APR_ADDTO(APRUTIL_LDFLAGS, [-L/usr/local/lib])],[
+ APR_REMOVEFROM(LDFLAGS, [-L/usr/local/lib])
+ APR_REMOVEFROM(CPPFLAGS, [-I/usr/local/include])
+ ])
+ fi
+])
+
+
+dnl
+dnl APU_FIND_EXPAT: figure out where EXPAT is located
+dnl
+AC_DEFUN([APU_FIND_EXPAT], [
+
+save_cppflags="$CPPFLAGS"
+save_ldflags="$LDFLAGS"
+
+apu_has_expat=0
+
+apu_try_external_expat=1
+
+AC_ARG_WITH([expat],
+[ --with-expat=DIR specify Expat location], [
+ if test "$withval" = "yes"; then
+ AC_MSG_ERROR([a directory must be specified for --with-expat])
+ elif test "$withval" = "no"; then
+ AC_MSG_ERROR([Expat cannot be disabled (at this time)])
+ else
+ # Add given path to standard search paths if appropriate:
+ if test "$withval" != "/usr"; then
+ APR_ADDTO(LDFLAGS, [-L$withval/lib])
+ APR_ADDTO(CPPFLAGS, [-I$withval/include])
+ APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include])
+ APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
+ fi
+ fi
+])
+
+if test $apu_try_external_expat = 1; then
+ APU_SYSTEM_EXPAT
+fi
+
+APR_ADDTO(APRUTIL_EXPORT_LIBS, [$apu_expat_libs])
+APR_ADDTO(APRUTIL_LIBS, [$apu_expat_libs])
+
+CPPFLAGS=$save_cppflags
+LDFLAGS=$save_ldflags
+])
+
+
+dnl
+dnl Find a particular LDAP library
+dnl
+AC_DEFUN([APU_FIND_LDAPLIB], [
+ if test ${apu_has_ldap} != "1"; then
+ ldaplib=$1
+ extralib=$2
+ # Clear the cache entry for subsequent APU_FIND_LDAPLIB invocations.
+ changequote(,)
+ ldaplib_cache_id="`echo $ldaplib | sed -e 's/[^a-zA-Z0-9_]/_/g'`"
+ changequote([,])
+ unset ac_cv_lib_${ldaplib_cache_id}_ldap_init
+ unset ac_cv_lib_${ldaplib_cache_id}___ldap_init
+ AC_CHECK_LIB(${ldaplib}, ldap_init,
+ [
+ LDADD_ldap_found="-l${ldaplib} ${extralib}"
+ AC_CHECK_LIB(${ldaplib}, ldapssl_client_init, apu_has_ldapssl_client_init="1", , ${extralib})
+ AC_CHECK_LIB(${ldaplib}, ldapssl_client_deinit, apu_has_ldapssl_client_deinit="1", , ${extralib})
+ AC_CHECK_LIB(${ldaplib}, ldapssl_add_trusted_cert, apu_has_ldapssl_add_trusted_cert="1", , ${extralib})
+ AC_CHECK_LIB(${ldaplib}, ldap_start_tls_s, apu_has_ldap_start_tls_s="1", , ${extralib})
+ AC_CHECK_LIB(${ldaplib}, ldap_sslinit, apu_has_ldap_sslinit="1", , ${extralib})
+ AC_CHECK_LIB(${ldaplib}, ldapssl_init, apu_has_ldapssl_init="1", , ${extralib})
+ AC_CHECK_LIB(${ldaplib}, ldapssl_install_routines, apu_has_ldapssl_install_routines="1", , ${extralib})
+ apu_has_ldap="1";
+ ], , ${extralib})
+ fi
+])
+
+
+dnl
+dnl APU_FIND_LDAP: figure out where LDAP is located
+dnl
+AC_DEFUN([APU_FIND_LDAP], [
+
+echo $ac_n "${nl}checking for ldap support..."
+
+apu_has_ldap="0";
+apu_has_ldapssl_client_init="0"
+apu_has_ldapssl_client_deinit="0"
+apu_has_ldapssl_add_trusted_cert="0"
+apu_has_ldap_start_tls_s="0"
+apu_has_ldapssl_init="0"
+apu_has_ldap_sslinit="0"
+apu_has_ldapssl_install_routines="0"
+apu_has_ldap_openldap="0"
+apu_has_ldap_solaris="0"
+apu_has_ldap_novell="0"
+apu_has_ldap_microsoft="0"
+apu_has_ldap_netscape="0"
+apu_has_ldap_mozilla="0"
+apu_has_ldap_tivoli="0"
+apu_has_ldap_zos="0"
+apu_has_ldap_other="0"
+LDADD_ldap_found=""
+
+AC_ARG_WITH(lber,[ --with-lber=library lber library to use],
+ [
+ if test "$withval" = "yes"; then
+ apu_liblber_name="lber"
+ else
+ apu_liblber_name="$withval"
+ fi
+ ],
+ [
+ apu_liblber_name="lber"
+ ])
+
+AC_ARG_WITH(ldap-include,[ --with-ldap-include=path path to ldap include files with trailing slash])
+AC_ARG_WITH(ldap-lib,[ --with-ldap-lib=path path to ldap lib file])
+AC_ARG_WITH(ldap,[ --with-ldap=library ldap library to use],
+ [
+ if test "$with_ldap" != "no"; then
+ save_cppflags="$CPPFLAGS"
+ save_ldflags="$LDFLAGS"
+ save_libs="$LIBS"
+ if test -n "$with_ldap_include"; then
+ CPPFLAGS="$CPPFLAGS -I$with_ldap_include"
+ APR_ADDTO(APRUTIL_INCLUDES, [-I$with_ldap_include])
+ fi
+ if test -n "$with_ldap_lib"; then
+ LDFLAGS="$LDFLAGS -L$with_ldap_lib"
+ APR_ADDTO(APRUTIL_LDFLAGS, [-L$with_ldap_lib])
+ fi
+
+ LIBLDAP="$withval"
+ if test "$LIBLDAP" = "yes"; then
+ dnl The iPlanet C SDK 5.0 is as yet untested...
+ APU_FIND_LDAPLIB("ldap50", "-lnspr4 -lplc4 -lplds4 -liutil50 -llber50 -lldif50 -lnss3 -lprldap50 -lssl3 -lssldap50")
+ APU_FIND_LDAPLIB("ldapssl41", "-lnspr3 -lplc3 -lplds3")
+ APU_FIND_LDAPLIB("ldapssl40")
+ APU_FIND_LDAPLIB("ldapssl30")
+ APU_FIND_LDAPLIB("ldapssl20")
+ APU_FIND_LDAPLIB("ldapsdk", "-lldapx -lldapssl -lldapgss -lgssapi_krb5")
+ APU_FIND_LDAPLIB("ldapsdk", "-lldapx -lldapssl -lldapgss -lgss -lresolv -lsocket")
+ APU_FIND_LDAPLIB("ldap", "-llber")
+ APU_FIND_LDAPLIB("ldap", "-llber -lresolv")
+ APU_FIND_LDAPLIB("ldap", "-llber -lresolv -lsocket -lnsl")
+ APU_FIND_LDAPLIB("ldap", "-ldl -lpthread")
+ else
+ APU_FIND_LDAPLIB($LIBLDAP)
+ APU_FIND_LDAPLIB($LIBLDAP, "-lresolv")
+ APU_FIND_LDAPLIB($LIBLDAP, "-lresolv -lsocket -lnsl")
+ APU_FIND_LDAPLIB($LIBLDAP, "-ldl -lpthread")
+ fi
+
+ if test ${apu_has_ldap} != "1"; then
+ AC_MSG_ERROR(could not find an LDAP library)
+ else
+ APR_ADDTO(LDADD_ldap, [$LDADD_ldap_found])
+ fi
+ AC_CHECK_LIB($apu_liblber_name, ber_init,
+ [APR_ADDTO(LDADD_ldap, [-l${apu_liblber_name}])])
+
+ AC_CHECK_HEADERS(lber.h, lber_h=["#include <lber.h>"])
+
+ # Solaris has a problem in <ldap.h> which prevents it from
+ # being included by itself. Check for <ldap.h> manually,
+ # including lber.h first.
+ AC_CACHE_CHECK([for ldap.h], [apr_cv_hdr_ldap_h],
+ [AC_TRY_CPP(
+ [#ifdef HAVE_LBER_H
+ #include <lber.h>
+ #endif
+ #include <ldap.h>
+ ], [apr_cv_hdr_ldap_h=yes], [apr_cv_hdr_ldap_h=no])])
+ if test "$apr_cv_hdr_ldap_h" = "yes"; then
+ ldap_h=["#include <ldap.h>"]
+ AC_DEFINE([HAVE_LDAP_H], 1, [Defined if ldap.h is present])
+ fi
+
+ AC_CHECK_HEADERS(ldap_ssl.h, ldap_ssl_h=["#include <ldap_ssl.h>"])
+
+ if test "$apr_cv_hdr_ldap_h" = "yes"; then
+ AC_CACHE_CHECK([for LDAP toolkit],
+ [apr_cv_ldap_toolkit], [
+ if test "x$apr_cv_ldap_toolkit" = "x"; then
+ AC_EGREP_CPP([OpenLDAP], [$lber_h
+ $ldap_h
+ LDAP_VENDOR_NAME], [apu_has_ldap_openldap="1"
+ apr_cv_ldap_toolkit="OpenLDAP"])
+ fi
+ if test "x$apr_cv_ldap_toolkit" = "x"; then
+ AC_EGREP_CPP([Sun Microsystems Inc.], [$lber_h
+ $ldap_h
+ LDAP_VENDOR_NAME], [apu_has_ldap_solaris="1"
+ apr_cv_ldap_toolkit="Solaris"])
+ fi
+ if test "x$apr_cv_ldap_toolkit" = "x"; then
+ AC_EGREP_CPP([Novell], [$lber_h
+ $ldap_h
+ LDAP_VENDOR_NAME], [apu_has_ldap_novell="1"
+ apr_cv_ldap_toolkit="Novell"])
+ fi
+ if test "x$apr_cv_ldap_toolkit" = "x"; then
+ AC_EGREP_CPP([Microsoft Corporation.], [$lber_h
+ $ldap_h
+ LDAP_VENDOR_NAME], [apu_has_ldap_microsoft="1"
+ apr_cv_ldap_toolkit="Microsoft"])
+ fi
+ if test "x$apr_cv_ldap_toolkit" = "x"; then
+ AC_EGREP_CPP([Netscape Communications Corp.], [$lber_h
+ $ldap_h
+ LDAP_VENDOR_NAME], [apu_has_ldap_netscape="1"
+ apr_cv_ldap_toolkit="Netscape"])
+ fi
+ if test "x$apr_cv_ldap_toolkit" = "x"; then
+ AC_EGREP_CPP([mozilla.org], [$lber_h
+ $ldap_h
+ LDAP_VENDOR_NAME], [apu_has_ldap_mozilla="1"
+ apr_cv_ldap_toolkit="Mozilla"])
+ fi
+ if test "x$apr_cv_ldap_toolkit" = "x"; then
+ AC_EGREP_CPP([International Business Machines], [$lber_h
+ $ldap_h
+ LDAP_VENDOR_NAME], [apu_has_ldap_tivoli="1"
+ apr_cv_ldap_toolkit="Tivoli"])
+ fi
+ if test "x$apr_cv_ldap_toolkit" = "x"; then
+ case "$host" in
+ *-ibm-os390)
+ AC_EGREP_CPP([IBM], [$lber_h
+ $ldap_h], [apu_has_ldap_zos="1"
+ apr_cv_ldap_toolkit="z/OS"])
+ ;;
+ esac
+ fi
+ if test "x$apr_cv_ldap_toolkit" = "x"; then
+ apu_has_ldap_other="1"
+ apr_cv_ldap_toolkit="unknown"
+ fi
+ ])
+ fi
+
+ CPPFLAGS=$save_cppflags
+ LDFLAGS=$save_ldflags
+ LIBS=$save_libs
+ fi
+ ])
+
+if test "$apu_has_ldap_openldap" = "1"; then
+ save_cppflags="$CPPFLAGS"
+ save_ldflags="$LDFLAGS"
+ save_libs="$LIBS"
+
+ CPPFLAGS="$CPPFLAGS $APRUTIL_INCLUDES"
+ LDFLAGS="$LDFLAGS $APRUTIL_LDFLAGS"
+ AC_CACHE_CHECK([style of ldap_set_rebind_proc routine], ac_cv_ldap_set_rebind_proc_style,
+ APR_TRY_COMPILE_NO_WARNING([
+ #ifdef HAVE_LBER_H
+ #include <lber.h>
+ #endif
+ #ifdef HAVE_LDAP_H
+ #include <ldap.h>
+ #endif
+ ], [
+ ldap_set_rebind_proc((LDAP *)0, (LDAP_REBIND_PROC *)0, (void *)0);
+ ], ac_cv_ldap_set_rebind_proc_style=three, ac_cv_ldap_set_rebind_proc_style=two))
+
+ if test "$ac_cv_ldap_set_rebind_proc_style" = "three"; then
+ AC_DEFINE(LDAP_SET_REBIND_PROC_THREE, 1, [Define if ldap_set_rebind_proc takes three arguments])
+ fi
+
+ CPPFLAGS="$save_cppflags"
+ LDFLAGS="$save_ldflags"
+ LIBS="$save_libs"
+fi
+
+AC_SUBST(ldap_h)
+AC_SUBST(lber_h)
+AC_SUBST(ldap_ssl_h)
+AC_SUBST(apu_has_ldapssl_client_init)
+AC_SUBST(apu_has_ldapssl_client_deinit)
+AC_SUBST(apu_has_ldapssl_add_trusted_cert)
+AC_SUBST(apu_has_ldap_start_tls_s)
+AC_SUBST(apu_has_ldapssl_init)
+AC_SUBST(apu_has_ldap_sslinit)
+AC_SUBST(apu_has_ldapssl_install_routines)
+AC_SUBST(apu_has_ldap)
+AC_SUBST(apu_has_ldap_openldap)
+AC_SUBST(apu_has_ldap_solaris)
+AC_SUBST(apu_has_ldap_novell)
+AC_SUBST(apu_has_ldap_microsoft)
+AC_SUBST(apu_has_ldap_netscape)
+AC_SUBST(apu_has_ldap_mozilla)
+AC_SUBST(apu_has_ldap_tivoli)
+AC_SUBST(apu_has_ldap_zos)
+AC_SUBST(apu_has_ldap_other)
+AC_SUBST(LDADD_ldap)
+
+])
+
+dnl
+dnl APU_CHECK_CRYPT_R_STYLE
+dnl
+dnl Decide which of a couple of flavors of crypt_r() is necessary for
+dnl this platform.
+dnl
+AC_DEFUN([APU_CHECK_CRYPT_R_STYLE], [
+
+AC_CACHE_CHECK([style of crypt_r], apr_cv_crypt_r_style,
+[AC_TRY_COMPILE([#include <crypt.h>],
+ [CRYPTD buffer;
+ crypt_r("passwd", "hash", &buffer);],
+ [apr_cv_crypt_r_style=cryptd],
+ [AC_TRY_COMPILE([#include <crypt.h>],
+ [struct crypt_data buffer;
+ crypt_r("passwd", "hash", &buffer);],
+ [apr_cv_crypt_r_style=struct_crypt_data],
+ [apr_cv_crypt_r_style=none])])])
+
+if test "$apr_cv_crypt_r_style" = "cryptd"; then
+ AC_DEFINE(CRYPT_R_CRYPTD, 1, [Define if crypt_r has uses CRYPTD])
+elif test "$apr_cv_crypt_r_style" = "struct_crypt_data"; then
+ AC_DEFINE(CRYPT_R_STRUCT_CRYPT_DATA, 1, [Define if crypt_r uses struct crypt_data])
+fi
+])
diff --git a/build/apu-hints.m4 b/build/apu-hints.m4
new file mode 100644
index 0000000..6d6784a
--- /dev/null
+++ b/build/apu-hints.m4
@@ -0,0 +1,62 @@
+dnl -------------------------------------------------------- -*- autoconf -*-
+dnl Licensed to the Apache Software Foundation (ASF) under one or more
+dnl contributor license agreements. See the NOTICE file distributed with
+dnl this work for additional information regarding copyright ownership.
+dnl The ASF licenses this file to You under the Apache License, Version 2.0
+dnl (the "License"); you may not use this file except in compliance with
+dnl the License. You may obtain a copy of the License at
+dnl
+dnl http://www.apache.org/licenses/LICENSE-2.0
+dnl
+dnl Unless required by applicable law or agreed to in writing, software
+dnl distributed under the License is distributed on an "AS IS" BASIS,
+dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+dnl See the License for the specific language governing permissions and
+dnl limitations under the License.
+
+dnl -----------------------------------------------------------------
+dnl apu-hints.m4: apr-util's autoconf macros for platform-specific hints
+dnl
+dnl We preload various configure settings depending
+dnl on previously obtained platform knowledge.
+dnl We allow all settings to be overridden from
+dnl the command-line.
+
+dnl
+dnl APU_PRELOAD
+dnl
+dnl Preload various build parameters based on outside knowledge.
+dnl
+AC_DEFUN([APU_PRELOAD], [
+if test "x$apu_preload_done" != "xyes" ; then
+ apu_preload_done="yes"
+
+ echo "Applying apr-util hints file rules for $host"
+
+ case "$host" in
+ *-dec-osf*)
+ APR_SETIFNULL(apu_crypt_threadsafe, [1])
+ ;;
+ *-hp-hpux11.*)
+ APR_SETIFNULL(apu_crypt_threadsafe, [1])
+ ;;
+ *-ibm-aix4*|*-ibm-aix5.1*)
+ APR_SETIFNULL(apu_iconv_inbuf_const, [1])
+ ;;
+ *-ibm-os390)
+ APR_SETIFNULL(apu_crypt_threadsafe, [1])
+ ;;
+ *-solaris2*)
+ APR_SETIFNULL(apu_iconv_inbuf_const, [1])
+ APR_SETIFNULL(apu_crypt_threadsafe, [1])
+ AC_SEARCH_LIBS(fdatasync, [rt posix4])
+ ;;
+ *-sco3.2v5*)
+ APR_SETIFNULL(apu_db_xtra_libs, [-lsocket])
+ ;;
+ esac
+
+fi
+])
+
+
diff --git a/build/apu-iconv.m4 b/build/apu-iconv.m4
new file mode 100644
index 0000000..1304227
--- /dev/null
+++ b/build/apu-iconv.m4
@@ -0,0 +1,132 @@
+dnl -------------------------------------------------------- -*- autoconf -*-
+dnl Licensed to the Apache Software Foundation (ASF) under one or more
+dnl contributor license agreements. See the NOTICE file distributed with
+dnl this work for additional information regarding copyright ownership.
+dnl The ASF licenses this file to You under the Apache License, Version 2.0
+dnl (the "License"); you may not use this file except in compliance with
+dnl the License. You may obtain a copy of the License at
+dnl
+dnl http://www.apache.org/licenses/LICENSE-2.0
+dnl
+dnl Unless required by applicable law or agreed to in writing, software
+dnl distributed under the License is distributed on an "AS IS" BASIS,
+dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+dnl See the License for the specific language governing permissions and
+dnl limitations under the License.
+
+dnl
+dnl APU_TRY_ICONV[ IF-SUCCESS, IF-FAILURE ]: try to compile for iconv.
+dnl
+AC_DEFUN([APU_TRY_ICONV], [
+ AC_TRY_LINK([
+#include <stdlib.h>
+#include <iconv.h>
+],
+[
+ iconv_t cd = iconv_open("", "");
+ iconv(cd, NULL, NULL, NULL, NULL);
+], [$1], [$2])
+])
+
+dnl
+dnl APU_FIND_ICONV: find an iconv library
+dnl
+AC_DEFUN([APU_FIND_ICONV], [
+
+apu_iconv_dir="unknown"
+have_apr_iconv="0"
+want_iconv="1"
+AC_ARG_WITH(iconv,[ --with-iconv[=DIR] path to iconv installation],
+ [ apu_iconv_dir="$withval"
+ if test "$apu_iconv_dir" = "no"; then
+ have_apr_iconv="0"
+ have_iconv="0"
+ want_iconv="0"
+ elif test "$apu_iconv_dir" != "yes"; then
+ if test -f "$apu_iconv_dir/include/apr-1/api_version.h"; then
+ have_apr_iconv="1"
+ have_iconv="0"
+ APR_ADDTO(APRUTIL_INCLUDES,[-I$apu_iconv_dir/include/apr-1])
+ APR_ADDTO(APRUTIL_LIBS,[$apu_iconv_dir/lib/libapriconv-1.la])
+ AC_MSG_RESULT(using apr-iconv)
+ elif test -f "$apu_iconv_dir/include/iconv.h"; then
+ have_apr_iconv="0"
+ have_iconv="1"
+ APR_ADDTO(CPPFLAGS,[-I$apu_iconv_dir/include])
+ APR_ADDTO(LDFLAGS,[-L$apu_iconv_dir/lib])
+ fi
+ fi
+ ])
+
+if test "$want_iconv" = "1" -a "$have_apr_iconv" != "1"; then
+ AC_CHECK_HEADER(iconv.h, [
+ APU_TRY_ICONV([ have_iconv="1" ], [
+
+ APR_ADDTO(LIBS,[-liconv])
+
+ APU_TRY_ICONV([
+ APR_ADDTO(APRUTIL_LIBS,[-liconv])
+ APR_ADDTO(APRUTIL_EXPORT_LIBS,[-liconv])
+ have_iconv="1" ],
+ [ have_iconv="0" ])
+
+ APR_REMOVEFROM(LIBS,[-liconv])
+
+ ])
+ ], [ have_iconv="0" ])
+fi
+
+if test "$want_iconv" = "1" -a "$apu_iconv_dir" != "unknown"; then
+ if test "$have_iconv" != "1"; then
+ if test "$have_apr_iconv" != "1"; then
+ AC_MSG_ERROR([iconv support requested, but not found])
+ fi
+ fi
+ APR_REMOVEFROM(CPPFLAGS,[-I$apu_iconv_dir/include])
+ APR_REMOVEFROM(LDFLAGS,[-L$apu_iconv_dir/lib])
+ APR_ADDTO(APRUTIL_INCLUDES,[-I$apu_iconv_dir/include])
+ APR_ADDTO(APRUTIL_LDFLAGS,[-L$apu_iconv_dir/lib])
+fi
+
+if test "$have_iconv" = "1"; then
+ APU_CHECK_ICONV_INBUF
+fi
+
+APR_FLAG_HEADERS(iconv.h langinfo.h)
+APR_FLAG_FUNCS(nl_langinfo)
+APR_CHECK_DEFINE(CODESET, langinfo.h, [CODESET defined in langinfo.h])
+
+AC_SUBST(have_iconv)
+AC_SUBST(have_apr_iconv)
+])dnl
+
+dnl
+dnl APU_CHECK_ICONV_INBUF
+dnl
+dnl Decide whether or not the inbuf parameter to iconv() is const.
+dnl
+dnl We try to compile something without const. If it fails to
+dnl compile, we assume that the system's iconv() has const.
+dnl Unfortunately, we won't realize when there was a compile
+dnl warning, so we allow a variable -- apu_iconv_inbuf_const -- to
+dnl be set in hints.m4 to specify whether or not iconv() has const
+dnl on this parameter.
+dnl
+AC_DEFUN([APU_CHECK_ICONV_INBUF], [
+AC_MSG_CHECKING(for type of inbuf parameter to iconv)
+if test "x$apu_iconv_inbuf_const" = "x"; then
+ APR_TRY_COMPILE_NO_WARNING([
+ #include <stddef.h>
+ #include <iconv.h>
+ ],[
+ iconv(0,(char **)0,(size_t *)0,(char **)0,(size_t *)0);
+ ], apu_iconv_inbuf_const="0", apu_iconv_inbuf_const="1")
+fi
+if test "$apu_iconv_inbuf_const" = "1"; then
+ AC_DEFINE(APU_ICONV_INBUF_CONST, 1, [Define if the inbuf parm to iconv() is const char **])
+ msg="const char **"
+else
+ msg="char **"
+fi
+AC_MSG_RESULT([$msg])
+])dnl
diff --git a/build/config.guess b/build/config.guess
new file mode 100755
index 0000000..e81d3ae
--- /dev/null
+++ b/build/config.guess
@@ -0,0 +1,1748 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+# Copyright 1992-2021 Free Software Foundation, Inc.
+
+# shellcheck disable=SC2006,SC2268 # see below for rationale
+
+timestamp='2021-06-03'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <https://www.gnu.org/licenses/>.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that
+# program. This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
+#
+# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
+#
+# You can get the latest version of this script from:
+# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
+#
+# Please send patches to <config-patches@gnu.org>.
+
+
+# The "shellcheck disable" line above the timestamp inhibits complaints
+# about features and limitations of the classic Bourne shell that were
+# superseded or lifted in POSIX. However, this script identifies a wide
+# variety of pre-POSIX systems that do not have POSIX shells at all, and
+# even some reasonably current systems (Solaris 10 as case-in-point) still
+# have a pre-POSIX /bin/sh.
+
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Options:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright 1992-2021 Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit ;;
+ --version | -v )
+ echo "$version" ; exit ;;
+ --help | --h* | -h )
+ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help" >&2
+ exit 1 ;;
+ * )
+ break ;;
+ esac
+done
+
+if test $# != 0; then
+ echo "$me: too many arguments$help" >&2
+ exit 1
+fi
+
+# Just in case it came from the environment.
+GUESS=
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+tmp=
+# shellcheck disable=SC2172
+trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
+
+set_cc_for_build() {
+ # prevent multiple calls if $tmp is already set
+ test "$tmp" && return 0
+ : "${TMPDIR=/tmp}"
+ # shellcheck disable=SC2039,SC3028
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
+ dummy=$tmp/dummy
+ case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
+ ,,) echo "int x;" > "$dummy.c"
+ for driver in cc gcc c89 c99 ; do
+ if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
+ CC_FOR_BUILD=$driver
+ break
+ fi
+ done
+ if test x"$CC_FOR_BUILD" = x ; then
+ CC_FOR_BUILD=no_compiler_found
+ fi
+ ;;
+ ,,*) CC_FOR_BUILD=$CC ;;
+ ,*,*) CC_FOR_BUILD=$HOST_CC ;;
+ esac
+}
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if test -f /.attbin/uname ; then
+ PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+case $UNAME_SYSTEM in
+Linux|GNU|GNU/*)
+ LIBC=unknown
+
+ set_cc_for_build
+ cat <<-EOF > "$dummy.c"
+ #include <features.h>
+ #if defined(__UCLIBC__)
+ LIBC=uclibc
+ #elif defined(__dietlibc__)
+ LIBC=dietlibc
+ #elif defined(__GLIBC__)
+ LIBC=gnu
+ #else
+ #include <stdarg.h>
+ /* First heuristic to detect musl libc. */
+ #ifdef __DEFINED_va_list
+ LIBC=musl
+ #endif
+ #endif
+ EOF
+ cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
+ eval "$cc_set_libc"
+
+ # Second heuristic to detect musl libc.
+ if [ "$LIBC" = unknown ] &&
+ command -v ldd >/dev/null &&
+ ldd --version 2>&1 | grep -q ^musl; then
+ LIBC=musl
+ fi
+
+ # If the system lacks a compiler, then just pick glibc.
+ # We could probably try harder.
+ if [ "$LIBC" = unknown ]; then
+ LIBC=gnu
+ fi
+ ;;
+esac
+
+# Note: order is significant - the case branches are not exclusive.
+
+case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
+ *:NetBSD:*:*)
+ # NetBSD (nbsd) targets should (where applicable) match one or
+ # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
+ # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
+ # switched to ELF, *-*-netbsd* would select the old
+ # object file format. This provides both forward
+ # compatibility and a consistent mechanism for selecting the
+ # object file format.
+ #
+ # Note: NetBSD doesn't particularly care about the vendor
+ # portion of the name. We always set it to "unknown".
+ UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
+ /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
+ /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
+ echo unknown)`
+ case $UNAME_MACHINE_ARCH in
+ aarch64eb) machine=aarch64_be-unknown ;;
+ armeb) machine=armeb-unknown ;;
+ arm*) machine=arm-unknown ;;
+ sh3el) machine=shl-unknown ;;
+ sh3eb) machine=sh-unknown ;;
+ sh5el) machine=sh5le-unknown ;;
+ earmv*)
+ arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
+ endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
+ machine=${arch}${endian}-unknown
+ ;;
+ *) machine=$UNAME_MACHINE_ARCH-unknown ;;
+ esac
+ # The Operating System including object format, if it has switched
+ # to ELF recently (or will in the future) and ABI.
+ case $UNAME_MACHINE_ARCH in
+ earm*)
+ os=netbsdelf
+ ;;
+ arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+ set_cc_for_build
+ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep -q __ELF__
+ then
+ # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+ # Return netbsd for either. FIX?
+ os=netbsd
+ else
+ os=netbsdelf
+ fi
+ ;;
+ *)
+ os=netbsd
+ ;;
+ esac
+ # Determine ABI tags.
+ case $UNAME_MACHINE_ARCH in
+ earm*)
+ expr='s/^earmv[0-9]/-eabi/;s/eb$//'
+ abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
+ ;;
+ esac
+ # The OS release
+ # Debian GNU/NetBSD machines have a different userland, and
+ # thus, need a distinct triplet. However, they do not need
+ # kernel version information, so it can be replaced with a
+ # suitable tag, in the style of linux-gnu.
+ case $UNAME_VERSION in
+ Debian*)
+ release='-gnu'
+ ;;
+ *)
+ release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
+ ;;
+ esac
+ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+ # contains redundant information, the shorter form:
+ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ GUESS=$machine-${os}${release}${abi-}
+ ;;
+ *:Bitrig:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
+ GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
+ ;;
+ *:OpenBSD:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+ GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
+ ;;
+ *:SecBSD:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
+ GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
+ ;;
+ *:LibertyBSD:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
+ GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
+ ;;
+ *:MidnightBSD:*:*)
+ GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
+ ;;
+ *:ekkoBSD:*:*)
+ GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
+ ;;
+ *:SolidBSD:*:*)
+ GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
+ ;;
+ *:OS108:*:*)
+ GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
+ ;;
+ macppc:MirBSD:*:*)
+ GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
+ ;;
+ *:MirBSD:*:*)
+ GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
+ ;;
+ *:Sortix:*:*)
+ GUESS=$UNAME_MACHINE-unknown-sortix
+ ;;
+ *:Twizzler:*:*)
+ GUESS=$UNAME_MACHINE-unknown-twizzler
+ ;;
+ *:Redox:*:*)
+ GUESS=$UNAME_MACHINE-unknown-redox
+ ;;
+ mips:OSF1:*.*)
+ GUESS=mips-dec-osf1
+ ;;
+ alpha:OSF1:*:*)
+ # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
+ trap '' 0
+ case $UNAME_RELEASE in
+ *4.0)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+ ;;
+ *5.*)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+ ;;
+ esac
+ # According to Compaq, /usr/sbin/psrinfo has been available on
+ # OSF/1 and Tru64 systems produced since 1995. I hope that
+ # covers most systems running today. This code pipes the CPU
+ # types through head -n 1, so we only detect the type of CPU 0.
+ ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+ case $ALPHA_CPU_TYPE in
+ "EV4 (21064)")
+ UNAME_MACHINE=alpha ;;
+ "EV4.5 (21064)")
+ UNAME_MACHINE=alpha ;;
+ "LCA4 (21066/21068)")
+ UNAME_MACHINE=alpha ;;
+ "EV5 (21164)")
+ UNAME_MACHINE=alphaev5 ;;
+ "EV5.6 (21164A)")
+ UNAME_MACHINE=alphaev56 ;;
+ "EV5.6 (21164PC)")
+ UNAME_MACHINE=alphapca56 ;;
+ "EV5.7 (21164PC)")
+ UNAME_MACHINE=alphapca57 ;;
+ "EV6 (21264)")
+ UNAME_MACHINE=alphaev6 ;;
+ "EV6.7 (21264A)")
+ UNAME_MACHINE=alphaev67 ;;
+ "EV6.8CB (21264C)")
+ UNAME_MACHINE=alphaev68 ;;
+ "EV6.8AL (21264B)")
+ UNAME_MACHINE=alphaev68 ;;
+ "EV6.8CX (21264D)")
+ UNAME_MACHINE=alphaev68 ;;
+ "EV6.9A (21264/EV69A)")
+ UNAME_MACHINE=alphaev69 ;;
+ "EV7 (21364)")
+ UNAME_MACHINE=alphaev7 ;;
+ "EV7.9 (21364A)")
+ UNAME_MACHINE=alphaev79 ;;
+ esac
+ # A Pn.n version is a patched version.
+ # A Vn.n version is a released version.
+ # A Tn.n version is a released field test version.
+ # A Xn.n version is an unreleased experimental baselevel.
+ # 1.2 uses "1.2" for uname -r.
+ OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
+ GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
+ ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ GUESS=m68k-unknown-sysv4
+ ;;
+ *:[Aa]miga[Oo][Ss]:*:*)
+ GUESS=$UNAME_MACHINE-unknown-amigaos
+ ;;
+ *:[Mm]orph[Oo][Ss]:*:*)
+ GUESS=$UNAME_MACHINE-unknown-morphos
+ ;;
+ *:OS/390:*:*)
+ GUESS=i370-ibm-openedition
+ ;;
+ *:z/VM:*:*)
+ GUESS=s390-ibm-zvmoe
+ ;;
+ *:OS400:*:*)
+ GUESS=powerpc-ibm-os400
+ ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ GUESS=arm-acorn-riscix$UNAME_RELEASE
+ ;;
+ arm*:riscos:*:*|arm*:RISCOS:*:*)
+ GUESS=arm-unknown-riscos
+ ;;
+ SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+ GUESS=hppa1.1-hitachi-hiuxmpp
+ ;;
+ Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+ # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+ case `(/bin/universe) 2>/dev/null` in
+ att) GUESS=pyramid-pyramid-sysv3 ;;
+ *) GUESS=pyramid-pyramid-bsd ;;
+ esac
+ ;;
+ NILE*:*:*:dcosx)
+ GUESS=pyramid-pyramid-svr4
+ ;;
+ DRS?6000:unix:4.0:6*)
+ GUESS=sparc-icl-nx6
+ ;;
+ DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+ case `/usr/bin/uname -p` in
+ sparc) GUESS=sparc-icl-nx7 ;;
+ esac
+ ;;
+ s390x:SunOS:*:*)
+ SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+ GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
+ ;;
+ sun4H:SunOS:5.*:*)
+ SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+ GUESS=sparc-hal-solaris2$SUN_REL
+ ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+ GUESS=sparc-sun-solaris2$SUN_REL
+ ;;
+ i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
+ GUESS=i386-pc-auroraux$UNAME_RELEASE
+ ;;
+ i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
+ set_cc_for_build
+ SUN_ARCH=i386
+ # If there is a compiler, see if it is configured for 64-bit objects.
+ # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
+ # This test works for both compilers.
+ if test "$CC_FOR_BUILD" != no_compiler_found; then
+ if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
+ then
+ SUN_ARCH=x86_64
+ fi
+ fi
+ SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+ GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
+ ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+ GUESS=sparc-sun-solaris3$SUN_REL
+ ;;
+ sun4*:SunOS:*:*)
+ case `/usr/bin/arch -k` in
+ Series*|S4*)
+ UNAME_RELEASE=`uname -v`
+ ;;
+ esac
+ # Japanese Language versions have a version number like `4.1.3-JL'.
+ SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
+ GUESS=sparc-sun-sunos$SUN_REL
+ ;;
+ sun3*:SunOS:*:*)
+ GUESS=m68k-sun-sunos$UNAME_RELEASE
+ ;;
+ sun*:*:4.2BSD:*)
+ UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
+ case `/bin/arch` in
+ sun3)
+ GUESS=m68k-sun-sunos$UNAME_RELEASE
+ ;;
+ sun4)
+ GUESS=sparc-sun-sunos$UNAME_RELEASE
+ ;;
+ esac
+ ;;
+ aushp:SunOS:*:*)
+ GUESS=sparc-auspex-sunos$UNAME_RELEASE
+ ;;
+ # The situation for MiNT is a little confusing. The machine name
+ # can be virtually everything (everything which is not
+ # "atarist" or "atariste" at least should have a processor
+ # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
+ # to the lowercase version "mint" (or "freemint"). Finally
+ # the system name "TOS" denotes a system which is actually not
+ # MiNT. But MiNT is downward compatible to TOS, so this should
+ # be no problem.
+ atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+ GUESS=m68k-atari-mint$UNAME_RELEASE
+ ;;
+ atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+ GUESS=m68k-atari-mint$UNAME_RELEASE
+ ;;
+ *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+ GUESS=m68k-atari-mint$UNAME_RELEASE
+ ;;
+ milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+ GUESS=m68k-milan-mint$UNAME_RELEASE
+ ;;
+ hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+ GUESS=m68k-hades-mint$UNAME_RELEASE
+ ;;
+ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+ GUESS=m68k-unknown-mint$UNAME_RELEASE
+ ;;
+ m68k:machten:*:*)
+ GUESS=m68k-apple-machten$UNAME_RELEASE
+ ;;
+ powerpc:machten:*:*)
+ GUESS=powerpc-apple-machten$UNAME_RELEASE
+ ;;
+ RISC*:Mach:*:*)
+ GUESS=mips-dec-mach_bsd4.3
+ ;;
+ RISC*:ULTRIX:*:*)
+ GUESS=mips-dec-ultrix$UNAME_RELEASE
+ ;;
+ VAX*:ULTRIX*:*:*)
+ GUESS=vax-dec-ultrix$UNAME_RELEASE
+ ;;
+ 2020:CLIX:*:* | 2430:CLIX:*:*)
+ GUESS=clipper-intergraph-clix$UNAME_RELEASE
+ ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ set_cc_for_build
+ sed 's/^ //' << EOF > "$dummy.c"
+#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+ #if defined (host_mips) && defined (MIPSEB)
+ #if defined (SYSTYPE_SYSV)
+ printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_SVR4)
+ printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+ printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
+ #endif
+ #endif
+ exit (-1);
+ }
+EOF
+ $CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
+ dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+ SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
+ { echo "$SYSTEM_NAME"; exit; }
+ GUESS=mips-mips-riscos$UNAME_RELEASE
+ ;;
+ Motorola:PowerMAX_OS:*:*)
+ GUESS=powerpc-motorola-powermax
+ ;;
+ Motorola:*:4.3:PL8-*)
+ GUESS=powerpc-harris-powermax
+ ;;
+ Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+ GUESS=powerpc-harris-powermax
+ ;;
+ Night_Hawk:Power_UNIX:*:*)
+ GUESS=powerpc-harris-powerunix
+ ;;
+ m88k:CX/UX:7*:*)
+ GUESS=m88k-harris-cxux7
+ ;;
+ m88k:*:4*:R4*)
+ GUESS=m88k-motorola-sysv4
+ ;;
+ m88k:*:3*:R3*)
+ GUESS=m88k-motorola-sysv3
+ ;;
+ AViiON:dgux:*:*)
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
+ then
+ if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
+ test "$TARGET_BINARY_INTERFACE"x = x
+ then
+ GUESS=m88k-dg-dgux$UNAME_RELEASE
+ else
+ GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
+ fi
+ else
+ GUESS=i586-dg-dgux$UNAME_RELEASE
+ fi
+ ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ GUESS=m88k-dolphin-sysv3
+ ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ GUESS=m88k-motorola-sysv3
+ ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ GUESS=m88k-tektronix-sysv3
+ ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ GUESS=m68k-tektronix-bsd
+ ;;
+ *:IRIX*:*:*)
+ IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
+ GUESS=mips-sgi-irix$IRIX_REL
+ ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+ GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i*86:AIX:*:*)
+ GUESS=i386-ibm-aix
+ ;;
+ ia64:AIX:*:*)
+ if test -x /usr/bin/oslevel ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
+ fi
+ GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
+ ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ set_cc_for_build
+ sed 's/^ //' << EOF > "$dummy.c"
+ #include <sys/systemcfg.h>
+
+ main()
+ {
+ if (!__power_pc())
+ exit(1);
+ puts("powerpc-ibm-aix3.2.5");
+ exit(0);
+ }
+EOF
+ if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
+ then
+ GUESS=$SYSTEM_NAME
+ else
+ GUESS=rs6000-ibm-aix3.2.5
+ fi
+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ GUESS=rs6000-ibm-aix3.2.4
+ else
+ GUESS=rs6000-ibm-aix3.2
+ fi
+ ;;
+ *:AIX:*:[4567])
+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+ if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+ else
+ IBM_ARCH=powerpc
+ fi
+ if test -x /usr/bin/lslpp ; then
+ IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
+ awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
+ else
+ IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
+ fi
+ GUESS=$IBM_ARCH-ibm-aix$IBM_REV
+ ;;
+ *:AIX:*:*)
+ GUESS=rs6000-ibm-aix
+ ;;
+ ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
+ GUESS=romp-ibm-bsd4.4
+ ;;
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
+ GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to
+ ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ GUESS=rs6000-bull-bosx
+ ;;
+ DPX/2?00:B.O.S.:*:*)
+ GUESS=m68k-bull-sysv3
+ ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ GUESS=m68k-hp-bsd
+ ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ GUESS=m68k-hp-bsd4.4
+ ;;
+ 9000/[34678]??:HP-UX:*:*)
+ HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
+ case $UNAME_MACHINE in
+ 9000/31?) HP_ARCH=m68000 ;;
+ 9000/[34]??) HP_ARCH=m68k ;;
+ 9000/[678][0-9][0-9])
+ if test -x /usr/bin/getconf; then
+ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+ case $sc_cpu_version in
+ 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
+ 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
+ 532) # CPU_PA_RISC2_0
+ case $sc_kernel_bits in
+ 32) HP_ARCH=hppa2.0n ;;
+ 64) HP_ARCH=hppa2.0w ;;
+ '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20
+ esac ;;
+ esac
+ fi
+ if test "$HP_ARCH" = ""; then
+ set_cc_for_build
+ sed 's/^ //' << EOF > "$dummy.c"
+
+ #define _HPUX_SOURCE
+ #include <stdlib.h>
+ #include <unistd.h>
+
+ int main ()
+ {
+ #if defined(_SC_KERNEL_BITS)
+ long bits = sysconf(_SC_KERNEL_BITS);
+ #endif
+ long cpu = sysconf (_SC_CPU_VERSION);
+
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+ case CPU_PA_RISC2_0:
+ #if defined(_SC_KERNEL_BITS)
+ switch (bits)
+ {
+ case 64: puts ("hppa2.0w"); break;
+ case 32: puts ("hppa2.0n"); break;
+ default: puts ("hppa2.0"); break;
+ } break;
+ #else /* !defined(_SC_KERNEL_BITS) */
+ puts ("hppa2.0"); break;
+ #endif
+ default: puts ("hppa1.0"); break;
+ }
+ exit (0);
+ }
+EOF
+ (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
+ test -z "$HP_ARCH" && HP_ARCH=hppa
+ fi ;;
+ esac
+ if test "$HP_ARCH" = hppa2.0w
+ then
+ set_cc_for_build
+
+ # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+ # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
+ # generating 64-bit code. GNU and HP use different nomenclature:
+ #
+ # $ CC_FOR_BUILD=cc ./config.guess
+ # => hppa2.0w-hp-hpux11.23
+ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+ # => hppa64-hp-hpux11.23
+
+ if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
+ grep -q __LP64__
+ then
+ HP_ARCH=hppa2.0w
+ else
+ HP_ARCH=hppa64
+ fi
+ fi
+ GUESS=$HP_ARCH-hp-hpux$HPUX_REV
+ ;;
+ ia64:HP-UX:*:*)
+ HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
+ GUESS=ia64-hp-hpux$HPUX_REV
+ ;;
+ 3050*:HI-UX:*:*)
+ set_cc_for_build
+ sed 's/^ //' << EOF > "$dummy.c"
+ #include <unistd.h>
+ int
+ main ()
+ {
+ long cpu = sysconf (_SC_CPU_VERSION);
+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
+ results, however. */
+ if (CPU_IS_PA_RISC (cpu))
+ {
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+ default: puts ("hppa-hitachi-hiuxwe2"); break;
+ }
+ }
+ else if (CPU_IS_HP_MC68K (cpu))
+ puts ("m68k-hitachi-hiuxwe2");
+ else puts ("unknown-hitachi-hiuxwe2");
+ exit (0);
+ }
+EOF
+ $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
+ { echo "$SYSTEM_NAME"; exit; }
+ GUESS=unknown-hitachi-hiuxwe2
+ ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
+ GUESS=hppa1.1-hp-bsd
+ ;;
+ 9000/8??:4.3bsd:*:*)
+ GUESS=hppa1.0-hp-bsd
+ ;;
+ *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+ GUESS=hppa1.0-hp-mpeix
+ ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
+ GUESS=hppa1.1-hp-osf
+ ;;
+ hp8??:OSF1:*:*)
+ GUESS=hppa1.0-hp-osf
+ ;;
+ i*86:OSF1:*:*)
+ if test -x /usr/sbin/sysversion ; then
+ GUESS=$UNAME_MACHINE-unknown-osf1mk
+ else
+ GUESS=$UNAME_MACHINE-unknown-osf1
+ fi
+ ;;
+ parisc*:Lites*:*:*)
+ GUESS=hppa1.1-hp-lites
+ ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ GUESS=c1-convex-bsd
+ ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ GUESS=c34-convex-bsd
+ ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ GUESS=c38-convex-bsd
+ ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ GUESS=c4-convex-bsd
+ ;;
+ CRAY*Y-MP:*:*:*)
+ CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
+ GUESS=ymp-cray-unicos$CRAY_REL
+ ;;
+ CRAY*[A-Z]90:*:*:*)
+ echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+ -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*TS:*:*:*)
+ CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
+ GUESS=t90-cray-unicos$CRAY_REL
+ ;;
+ CRAY*T3E:*:*:*)
+ CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
+ GUESS=alphaev5-cray-unicosmk$CRAY_REL
+ ;;
+ CRAY*SV1:*:*:*)
+ CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
+ GUESS=sv1-cray-unicos$CRAY_REL
+ ;;
+ *:UNICOS/mp:*:*)
+ CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
+ GUESS=craynv-cray-unicosmp$CRAY_REL
+ ;;
+ F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+ FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
+ FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
+ FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
+ GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
+ ;;
+ 5000:UNIX_System_V:4.*:*)
+ FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
+ FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
+ GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
+ ;;
+ i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+ GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
+ ;;
+ sparc*:BSD/OS:*:*)
+ GUESS=sparc-unknown-bsdi$UNAME_RELEASE
+ ;;
+ *:BSD/OS:*:*)
+ GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
+ ;;
+ arm:FreeBSD:*:*)
+ UNAME_PROCESSOR=`uname -p`
+ set_cc_for_build
+ if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep -q __ARM_PCS_VFP
+ then
+ FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
+ GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
+ else
+ FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
+ GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
+ fi
+ ;;
+ *:FreeBSD:*:*)
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ case $UNAME_PROCESSOR in
+ amd64)
+ UNAME_PROCESSOR=x86_64 ;;
+ i386)
+ UNAME_PROCESSOR=i586 ;;
+ esac
+ FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
+ GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
+ ;;
+ i*:CYGWIN*:*)
+ GUESS=$UNAME_MACHINE-pc-cygwin
+ ;;
+ *:MINGW64*:*)
+ GUESS=$UNAME_MACHINE-pc-mingw64
+ ;;
+ *:MINGW*:*)
+ GUESS=$UNAME_MACHINE-pc-mingw32
+ ;;
+ *:MSYS*:*)
+ GUESS=$UNAME_MACHINE-pc-msys
+ ;;
+ i*:PW*:*)
+ GUESS=$UNAME_MACHINE-pc-pw32
+ ;;
+ *:Interix*:*)
+ case $UNAME_MACHINE in
+ x86)
+ GUESS=i586-pc-interix$UNAME_RELEASE
+ ;;
+ authenticamd | genuineintel | EM64T)
+ GUESS=x86_64-unknown-interix$UNAME_RELEASE
+ ;;
+ IA64)
+ GUESS=ia64-unknown-interix$UNAME_RELEASE
+ ;;
+ esac ;;
+ i*:UWIN*:*)
+ GUESS=$UNAME_MACHINE-pc-uwin
+ ;;
+ amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+ GUESS=x86_64-pc-cygwin
+ ;;
+ prep*:SunOS:5.*:*)
+ SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+ GUESS=powerpcle-unknown-solaris2$SUN_REL
+ ;;
+ *:GNU:*:*)
+ # the GNU system
+ GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
+ GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
+ GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
+ ;;
+ *:GNU/*:*:*)
+ # other systems with GNU libc and userland
+ GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
+ GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
+ GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
+ ;;
+ *:Minix:*:*)
+ GUESS=$UNAME_MACHINE-unknown-minix
+ ;;
+ aarch64:Linux:*:*)
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
+ aarch64_be:Linux:*:*)
+ UNAME_MACHINE=aarch64_be
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
+ alpha:Linux:*:*)
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
+ EV5) UNAME_MACHINE=alphaev5 ;;
+ EV56) UNAME_MACHINE=alphaev56 ;;
+ PCA56) UNAME_MACHINE=alphapca56 ;;
+ PCA57) UNAME_MACHINE=alphapca56 ;;
+ EV6) UNAME_MACHINE=alphaev6 ;;
+ EV67) UNAME_MACHINE=alphaev67 ;;
+ EV68*) UNAME_MACHINE=alphaev68 ;;
+ esac
+ objdump --private-headers /bin/sh | grep -q ld.so.1
+ if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
+ arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
+ arm*:Linux:*:*)
+ set_cc_for_build
+ if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep -q __ARM_EABI__
+ then
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ else
+ if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep -q __ARM_PCS_VFP
+ then
+ GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
+ else
+ GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
+ fi
+ fi
+ ;;
+ avr32*:Linux:*:*)
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
+ cris:Linux:*:*)
+ GUESS=$UNAME_MACHINE-axis-linux-$LIBC
+ ;;
+ crisv32:Linux:*:*)
+ GUESS=$UNAME_MACHINE-axis-linux-$LIBC
+ ;;
+ e2k:Linux:*:*)
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
+ frv:Linux:*:*)
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
+ hexagon:Linux:*:*)
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
+ i*86:Linux:*:*)
+ GUESS=$UNAME_MACHINE-pc-linux-$LIBC
+ ;;
+ ia64:Linux:*:*)
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
+ k1om:Linux:*:*)
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
+ loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*)
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
+ m32r*:Linux:*:*)
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
+ m68*:Linux:*:*)
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
+ mips:Linux:*:* | mips64:Linux:*:*)
+ set_cc_for_build
+ IS_GLIBC=0
+ test x"${LIBC}" = xgnu && IS_GLIBC=1
+ sed 's/^ //' << EOF > "$dummy.c"
+ #undef CPU
+ #undef mips
+ #undef mipsel
+ #undef mips64
+ #undef mips64el
+ #if ${IS_GLIBC} && defined(_ABI64)
+ LIBCABI=gnuabi64
+ #else
+ #if ${IS_GLIBC} && defined(_ABIN32)
+ LIBCABI=gnuabin32
+ #else
+ LIBCABI=${LIBC}
+ #endif
+ #endif
+
+ #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
+ CPU=mipsisa64r6
+ #else
+ #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
+ CPU=mipsisa32r6
+ #else
+ #if defined(__mips64)
+ CPU=mips64
+ #else
+ CPU=mips
+ #endif
+ #endif
+ #endif
+
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ MIPS_ENDIAN=el
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ MIPS_ENDIAN=
+ #else
+ MIPS_ENDIAN=
+ #endif
+ #endif
+EOF
+ cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
+ eval "$cc_set_vars"
+ test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
+ ;;
+ mips64el:Linux:*:*)
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
+ openrisc*:Linux:*:*)
+ GUESS=or1k-unknown-linux-$LIBC
+ ;;
+ or32:Linux:*:* | or1k*:Linux:*:*)
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
+ padre:Linux:*:*)
+ GUESS=sparc-unknown-linux-$LIBC
+ ;;
+ parisc64:Linux:*:* | hppa64:Linux:*:*)
+ GUESS=hppa64-unknown-linux-$LIBC
+ ;;
+ parisc:Linux:*:* | hppa:Linux:*:*)
+ # Look for CPU level
+ case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+ PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
+ PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
+ *) GUESS=hppa-unknown-linux-$LIBC ;;
+ esac
+ ;;
+ ppc64:Linux:*:*)
+ GUESS=powerpc64-unknown-linux-$LIBC
+ ;;
+ ppc:Linux:*:*)
+ GUESS=powerpc-unknown-linux-$LIBC
+ ;;
+ ppc64le:Linux:*:*)
+ GUESS=powerpc64le-unknown-linux-$LIBC
+ ;;
+ ppcle:Linux:*:*)
+ GUESS=powerpcle-unknown-linux-$LIBC
+ ;;
+ riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
+ s390:Linux:*:* | s390x:Linux:*:*)
+ GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
+ ;;
+ sh64*:Linux:*:*)
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
+ sh*:Linux:*:*)
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
+ sparc:Linux:*:* | sparc64:Linux:*:*)
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
+ tile*:Linux:*:*)
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
+ vax:Linux:*:*)
+ GUESS=$UNAME_MACHINE-dec-linux-$LIBC
+ ;;
+ x86_64:Linux:*:*)
+ set_cc_for_build
+ LIBCABI=$LIBC
+ if test "$CC_FOR_BUILD" != no_compiler_found; then
+ if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_X32 >/dev/null
+ then
+ LIBCABI=${LIBC}x32
+ fi
+ fi
+ GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI
+ ;;
+ xtensa*:Linux:*:*)
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
+ i*86:DYNIX/ptx:4*:*)
+ # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+ # earlier versions are messed up and put the nodename in both
+ # sysname and nodename.
+ GUESS=i386-sequent-sysv4
+ ;;
+ i*86:UNIX_SV:4.2MP:2.*)
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+ # I am not positive that other SVR4 systems won't match this,
+ # I just have to hope. -- rms.
+ # Use sysv4.2uw... so that sysv4* matches it.
+ GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
+ ;;
+ i*86:OS/2:*:*)
+ # If we were able to find `uname', then EMX Unix compatibility
+ # is probably installed.
+ GUESS=$UNAME_MACHINE-pc-os2-emx
+ ;;
+ i*86:XTS-300:*:STOP)
+ GUESS=$UNAME_MACHINE-unknown-stop
+ ;;
+ i*86:atheos:*:*)
+ GUESS=$UNAME_MACHINE-unknown-atheos
+ ;;
+ i*86:syllable:*:*)
+ GUESS=$UNAME_MACHINE-pc-syllable
+ ;;
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
+ GUESS=i386-unknown-lynxos$UNAME_RELEASE
+ ;;
+ i*86:*DOS:*:*)
+ GUESS=$UNAME_MACHINE-pc-msdosdjgpp
+ ;;
+ i*86:*:4.*:*)
+ UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+ GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
+ else
+ GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
+ fi
+ ;;
+ i*86:*:5:[678]*)
+ # UnixWare 7.x, OpenUNIX and OpenServer 6.
+ case `/bin/uname -X | grep "^Machine"` in
+ *486*) UNAME_MACHINE=i486 ;;
+ *Pentium) UNAME_MACHINE=i586 ;;
+ *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+ esac
+ GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+ ;;
+ i*86:*:3.2:*)
+ if test -f /usr/options/cb.name; then
+ UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL
+ elif /bin/uname -X 2>/dev/null >/dev/null ; then
+ UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+ && UNAME_MACHINE=i686
+ (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+ && UNAME_MACHINE=i686
+ GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
+ else
+ GUESS=$UNAME_MACHINE-pc-sysv32
+ fi
+ ;;
+ pc:*:*:*)
+ # Left here for compatibility:
+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
+ # the processor, so we play safe by assuming i586.
+ # Note: whatever this is, it MUST be the same as what config.sub
+ # prints for the "djgpp" host, or else GDB configure will decide that
+ # this is a cross-build.
+ GUESS=i586-pc-msdosdjgpp
+ ;;
+ Intel:Mach:3*:*)
+ GUESS=i386-pc-mach3
+ ;;
+ paragon:*:*:*)
+ GUESS=i860-intel-osf1
+ ;;
+ i860:*:4.*:*) # i860-SVR4
+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+ GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4
+ fi
+ ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ GUESS=m68010-convergent-sysv
+ ;;
+ mc68k:UNIX:SYSTEM5:3.51m)
+ GUESS=m68k-convergent-sysv
+ ;;
+ M680?0:D-NIX:5.3:*)
+ GUESS=m68k-diab-dnix
+ ;;
+ M68*:*:R3V[5678]*:*)
+ test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+ 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4; exit; } ;;
+ NCR*:*:4.2:* | MPRAS*:*:4.2:*)
+ OS_REL='.3'
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
+ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
+ m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+ GUESS=m68k-unknown-lynxos$UNAME_RELEASE
+ ;;
+ mc68030:UNIX_System_V:4.*:*)
+ GUESS=m68k-atari-sysv4
+ ;;
+ TSUNAMI:LynxOS:2.*:*)
+ GUESS=sparc-unknown-lynxos$UNAME_RELEASE
+ ;;
+ rs6000:LynxOS:2.*:*)
+ GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
+ ;;
+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
+ GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
+ ;;
+ SM[BE]S:UNIX_SV:*:*)
+ GUESS=mips-dde-sysv$UNAME_RELEASE
+ ;;
+ RM*:ReliantUNIX-*:*:*)
+ GUESS=mips-sni-sysv4
+ ;;
+ RM*:SINIX-*:*:*)
+ GUESS=mips-sni-sysv4
+ ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ GUESS=$UNAME_MACHINE-sni-sysv4
+ else
+ GUESS=ns32k-sni-sysv
+ fi
+ ;;
+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
+ GUESS=i586-unisys-sysv4
+ ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes <hewes@openmarket.com>.
+ # How about differentiating between stratus architectures? -djm
+ GUESS=hppa1.1-stratus-sysv4
+ ;;
+ *:*:*:FTX*)
+ # From seanf@swdc.stratus.com.
+ GUESS=i860-stratus-sysv4
+ ;;
+ i*86:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ GUESS=$UNAME_MACHINE-stratus-vos
+ ;;
+ *:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ GUESS=hppa1.1-stratus-vos
+ ;;
+ mc68*:A/UX:*:*)
+ GUESS=m68k-apple-aux$UNAME_RELEASE
+ ;;
+ news*:NEWS-OS:6*:*)
+ GUESS=mips-sony-newsos6
+ ;;
+ R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+ if test -d /usr/nec; then
+ GUESS=mips-nec-sysv$UNAME_RELEASE
+ else
+ GUESS=mips-unknown-sysv$UNAME_RELEASE
+ fi
+ ;;
+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
+ GUESS=powerpc-be-beos
+ ;;
+ BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
+ GUESS=powerpc-apple-beos
+ ;;
+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
+ GUESS=i586-pc-beos
+ ;;
+ BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
+ GUESS=i586-pc-haiku
+ ;;
+ x86_64:Haiku:*:*)
+ GUESS=x86_64-unknown-haiku
+ ;;
+ SX-4:SUPER-UX:*:*)
+ GUESS=sx4-nec-superux$UNAME_RELEASE
+ ;;
+ SX-5:SUPER-UX:*:*)
+ GUESS=sx5-nec-superux$UNAME_RELEASE
+ ;;
+ SX-6:SUPER-UX:*:*)
+ GUESS=sx6-nec-superux$UNAME_RELEASE
+ ;;
+ SX-7:SUPER-UX:*:*)
+ GUESS=sx7-nec-superux$UNAME_RELEASE
+ ;;
+ SX-8:SUPER-UX:*:*)
+ GUESS=sx8-nec-superux$UNAME_RELEASE
+ ;;
+ SX-8R:SUPER-UX:*:*)
+ GUESS=sx8r-nec-superux$UNAME_RELEASE
+ ;;
+ SX-ACE:SUPER-UX:*:*)
+ GUESS=sxace-nec-superux$UNAME_RELEASE
+ ;;
+ Power*:Rhapsody:*:*)
+ GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
+ ;;
+ *:Rhapsody:*:*)
+ GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
+ ;;
+ arm64:Darwin:*:*)
+ GUESS=aarch64-apple-darwin$UNAME_RELEASE
+ ;;
+ *:Darwin:*:*)
+ UNAME_PROCESSOR=`uname -p`
+ case $UNAME_PROCESSOR in
+ unknown) UNAME_PROCESSOR=powerpc ;;
+ esac
+ if command -v xcode-select > /dev/null 2> /dev/null && \
+ ! xcode-select --print-path > /dev/null 2> /dev/null ; then
+ # Avoid executing cc if there is no toolchain installed as
+ # cc will be a stub that puts up a graphical alert
+ # prompting the user to install developer tools.
+ CC_FOR_BUILD=no_compiler_found
+ else
+ set_cc_for_build
+ fi
+ if test "$CC_FOR_BUILD" != no_compiler_found; then
+ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
+ then
+ case $UNAME_PROCESSOR in
+ i386) UNAME_PROCESSOR=x86_64 ;;
+ powerpc) UNAME_PROCESSOR=powerpc64 ;;
+ esac
+ fi
+ # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
+ if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_PPC >/dev/null
+ then
+ UNAME_PROCESSOR=powerpc
+ fi
+ elif test "$UNAME_PROCESSOR" = i386 ; then
+ # uname -m returns i386 or x86_64
+ UNAME_PROCESSOR=$UNAME_MACHINE
+ fi
+ GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
+ ;;
+ *:procnto*:*:* | *:QNX:[0123456789]*:*)
+ UNAME_PROCESSOR=`uname -p`
+ if test "$UNAME_PROCESSOR" = x86; then
+ UNAME_PROCESSOR=i386
+ UNAME_MACHINE=pc
+ fi
+ GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
+ ;;
+ *:QNX:*:4*)
+ GUESS=i386-pc-qnx
+ ;;
+ NEO-*:NONSTOP_KERNEL:*:*)
+ GUESS=neo-tandem-nsk$UNAME_RELEASE
+ ;;
+ NSE-*:NONSTOP_KERNEL:*:*)
+ GUESS=nse-tandem-nsk$UNAME_RELEASE
+ ;;
+ NSR-*:NONSTOP_KERNEL:*:*)
+ GUESS=nsr-tandem-nsk$UNAME_RELEASE
+ ;;
+ NSV-*:NONSTOP_KERNEL:*:*)
+ GUESS=nsv-tandem-nsk$UNAME_RELEASE
+ ;;
+ NSX-*:NONSTOP_KERNEL:*:*)
+ GUESS=nsx-tandem-nsk$UNAME_RELEASE
+ ;;
+ *:NonStop-UX:*:*)
+ GUESS=mips-compaq-nonstopux
+ ;;
+ BS2000:POSIX*:*:*)
+ GUESS=bs2000-siemens-sysv
+ ;;
+ DS/*:UNIX_System_V:*:*)
+ GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
+ ;;
+ *:Plan9:*:*)
+ # "uname -m" is not consistent, so use $cputype instead. 386
+ # is converted to i386 for consistency with other x86
+ # operating systems.
+ if test "${cputype-}" = 386; then
+ UNAME_MACHINE=i386
+ elif test "x${cputype-}" != x; then
+ UNAME_MACHINE=$cputype
+ fi
+ GUESS=$UNAME_MACHINE-unknown-plan9
+ ;;
+ *:TOPS-10:*:*)
+ GUESS=pdp10-unknown-tops10
+ ;;
+ *:TENEX:*:*)
+ GUESS=pdp10-unknown-tenex
+ ;;
+ KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+ GUESS=pdp10-dec-tops20
+ ;;
+ XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+ GUESS=pdp10-xkl-tops20
+ ;;
+ *:TOPS-20:*:*)
+ GUESS=pdp10-unknown-tops20
+ ;;
+ *:ITS:*:*)
+ GUESS=pdp10-unknown-its
+ ;;
+ SEI:*:*:SEIUX)
+ GUESS=mips-sei-seiux$UNAME_RELEASE
+ ;;
+ *:DragonFly:*:*)
+ DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
+ GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
+ ;;
+ *:*VMS:*:*)
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ case $UNAME_MACHINE in
+ A*) GUESS=alpha-dec-vms ;;
+ I*) GUESS=ia64-dec-vms ;;
+ V*) GUESS=vax-dec-vms ;;
+ esac ;;
+ *:XENIX:*:SysV)
+ GUESS=i386-pc-xenix
+ ;;
+ i*86:skyos:*:*)
+ SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
+ GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
+ ;;
+ i*86:rdos:*:*)
+ GUESS=$UNAME_MACHINE-pc-rdos
+ ;;
+ *:AROS:*:*)
+ GUESS=$UNAME_MACHINE-unknown-aros
+ ;;
+ x86_64:VMkernel:*:*)
+ GUESS=$UNAME_MACHINE-unknown-esx
+ ;;
+ amd64:Isilon\ OneFS:*:*)
+ GUESS=x86_64-unknown-onefs
+ ;;
+ *:Unleashed:*:*)
+ GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
+ ;;
+esac
+
+# Do we have a guess based on uname results?
+if test "x$GUESS" != x; then
+ echo "$GUESS"
+ exit
+fi
+
+# No uname command or uname output not recognized.
+set_cc_for_build
+cat > "$dummy.c" <<EOF
+#ifdef _SEQUENT_
+#include <sys/types.h>
+#include <sys/utsname.h>
+#endif
+#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
+#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
+#include <signal.h>
+#if defined(_SIZE_T_) || defined(SIGLOST)
+#include <sys/utsname.h>
+#endif
+#endif
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ if (version < 4)
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ else
+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+#endif
+
+#if defined (vax)
+#if !defined (ultrix)
+#include <sys/param.h>
+#if defined (BSD)
+#if BSD == 43
+ printf ("vax-dec-bsd4.3\n"); exit (0);
+#else
+#if BSD == 199006
+ printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#else
+ printf ("vax-dec-bsd\n"); exit (0);
+#endif
+#endif
+#else
+ printf ("vax-dec-bsd\n"); exit (0);
+#endif
+#else
+#if defined(_SIZE_T_) || defined(SIGLOST)
+ struct utsname un;
+ uname (&un);
+ printf ("vax-dec-ultrix%s\n", un.release); exit (0);
+#else
+ printf ("vax-dec-ultrix\n"); exit (0);
+#endif
+#endif
+#endif
+#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
+#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
+#if defined(_SIZE_T_) || defined(SIGLOST)
+ struct utsname *un;
+ uname (&un);
+ printf ("mips-dec-ultrix%s\n", un.release); exit (0);
+#else
+ printf ("mips-dec-ultrix\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
+ { echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
+
+echo "$0: unable to guess system type" >&2
+
+case $UNAME_MACHINE:$UNAME_SYSTEM in
+ mips:Linux | mips64:Linux)
+ # If we got here on MIPS GNU/Linux, output extra information.
+ cat >&2 <<EOF
+
+NOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
+the system type. Please install a C compiler and try again.
+EOF
+ ;;
+esac
+
+cat >&2 <<EOF
+
+This script (version $timestamp), has failed to recognize the
+operating system you are using. If your script is old, overwrite *all*
+copies of config.guess and config.sub with the latest versions from:
+
+ https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
+and
+ https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
+EOF
+
+our_year=`echo $timestamp | sed 's,-.*,,'`
+thisyear=`date +%Y`
+# shellcheck disable=SC2003
+script_age=`expr "$thisyear" - "$our_year"`
+if test "$script_age" -lt 3 ; then
+ cat >&2 <<EOF
+
+If $0 has already been updated, send the following data and any
+information you think might be pertinent to config-patches@gnu.org to
+provide the necessary information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo = `(hostinfo) 2>/dev/null`
+/bin/universe = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = "$UNAME_MACHINE"
+UNAME_RELEASE = "$UNAME_RELEASE"
+UNAME_SYSTEM = "$UNAME_SYSTEM"
+UNAME_VERSION = "$UNAME_VERSION"
+EOF
+fi
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'before-save-hook 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/build/config.sub b/build/config.sub
new file mode 100755
index 0000000..d74fb6d
--- /dev/null
+++ b/build/config.sub
@@ -0,0 +1,1884 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+# Copyright 1992-2021 Free Software Foundation, Inc.
+
+# shellcheck disable=SC2006,SC2268 # see below for rationale
+
+timestamp='2021-08-14'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <https://www.gnu.org/licenses/>.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that
+# program. This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
+
+
+# Please send patches to <config-patches@gnu.org>.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# You can get the latest version of this script from:
+# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support. The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+# The "shellcheck disable" line above the timestamp inhibits complaints
+# about features and limitations of the classic Bourne shell that were
+# superseded or lifted in POSIX. However, this script identifies a wide
+# variety of pre-POSIX systems that do not have POSIX shells at all, and
+# even some reasonably current systems (Solaris 10 as case-in-point) still
+# have a pre-POSIX /bin/sh.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
+
+Canonicalize a configuration name.
+
+Options:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright 1992-2021 Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit ;;
+ --version | -v )
+ echo "$version" ; exit ;;
+ --help | --h* | -h )
+ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help" >&2
+ exit 1 ;;
+
+ *local*)
+ # First pass through any local machine types.
+ echo "$1"
+ exit ;;
+
+ * )
+ break ;;
+ esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+ exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+ exit 1;;
+esac
+
+# Split fields of configuration type
+# shellcheck disable=SC2162
+saved_IFS=$IFS
+IFS="-" read field1 field2 field3 field4 <<EOF
+$1
+EOF
+IFS=$saved_IFS
+
+# Separate into logical components for further validation
+case $1 in
+ *-*-*-*-*)
+ echo Invalid configuration \`"$1"\': more than four components >&2
+ exit 1
+ ;;
+ *-*-*-*)
+ basic_machine=$field1-$field2
+ basic_os=$field3-$field4
+ ;;
+ *-*-*)
+ # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two
+ # parts
+ maybe_os=$field2-$field3
+ case $maybe_os in
+ nto-qnx* | linux-* | uclinux-uclibc* \
+ | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \
+ | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
+ | storm-chaos* | os2-emx* | rtmk-nova*)
+ basic_machine=$field1
+ basic_os=$maybe_os
+ ;;
+ android-linux)
+ basic_machine=$field1-unknown
+ basic_os=linux-android
+ ;;
+ *)
+ basic_machine=$field1-$field2
+ basic_os=$field3
+ ;;
+ esac
+ ;;
+ *-*)
+ # A lone config we happen to match not fitting any pattern
+ case $field1-$field2 in
+ decstation-3100)
+ basic_machine=mips-dec
+ basic_os=
+ ;;
+ *-*)
+ # Second component is usually, but not always the OS
+ case $field2 in
+ # Prevent following clause from handling this valid os
+ sun*os*)
+ basic_machine=$field1
+ basic_os=$field2
+ ;;
+ zephyr*)
+ basic_machine=$field1-unknown
+ basic_os=$field2
+ ;;
+ # Manufacturers
+ dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \
+ | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \
+ | unicom* | ibm* | next | hp | isi* | apollo | altos* \
+ | convergent* | ncr* | news | 32* | 3600* | 3100* \
+ | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \
+ | ultra | tti* | harris | dolphin | highlevel | gould \
+ | cbm | ns | masscomp | apple | axis | knuth | cray \
+ | microblaze* | sim | cisco \
+ | oki | wec | wrs | winbond)
+ basic_machine=$field1-$field2
+ basic_os=
+ ;;
+ *)
+ basic_machine=$field1
+ basic_os=$field2
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ *)
+ # Convert single-component short-hands not valid as part of
+ # multi-component configurations.
+ case $field1 in
+ 386bsd)
+ basic_machine=i386-pc
+ basic_os=bsd
+ ;;
+ a29khif)
+ basic_machine=a29k-amd
+ basic_os=udi
+ ;;
+ adobe68k)
+ basic_machine=m68010-adobe
+ basic_os=scout
+ ;;
+ alliant)
+ basic_machine=fx80-alliant
+ basic_os=
+ ;;
+ altos | altos3068)
+ basic_machine=m68k-altos
+ basic_os=
+ ;;
+ am29k)
+ basic_machine=a29k-none
+ basic_os=bsd
+ ;;
+ amdahl)
+ basic_machine=580-amdahl
+ basic_os=sysv
+ ;;
+ amiga)
+ basic_machine=m68k-unknown
+ basic_os=
+ ;;
+ amigaos | amigados)
+ basic_machine=m68k-unknown
+ basic_os=amigaos
+ ;;
+ amigaunix | amix)
+ basic_machine=m68k-unknown
+ basic_os=sysv4
+ ;;
+ apollo68)
+ basic_machine=m68k-apollo
+ basic_os=sysv
+ ;;
+ apollo68bsd)
+ basic_machine=m68k-apollo
+ basic_os=bsd
+ ;;
+ aros)
+ basic_machine=i386-pc
+ basic_os=aros
+ ;;
+ aux)
+ basic_machine=m68k-apple
+ basic_os=aux
+ ;;
+ balance)
+ basic_machine=ns32k-sequent
+ basic_os=dynix
+ ;;
+ blackfin)
+ basic_machine=bfin-unknown
+ basic_os=linux
+ ;;
+ cegcc)
+ basic_machine=arm-unknown
+ basic_os=cegcc
+ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ basic_os=bsd
+ ;;
+ convex-c2)
+ basic_machine=c2-convex
+ basic_os=bsd
+ ;;
+ convex-c32)
+ basic_machine=c32-convex
+ basic_os=bsd
+ ;;
+ convex-c34)
+ basic_machine=c34-convex
+ basic_os=bsd
+ ;;
+ convex-c38)
+ basic_machine=c38-convex
+ basic_os=bsd
+ ;;
+ cray)
+ basic_machine=j90-cray
+ basic_os=unicos
+ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ basic_os=
+ ;;
+ da30)
+ basic_machine=m68k-da30
+ basic_os=
+ ;;
+ decstation | pmax | pmin | dec3100 | decstatn)
+ basic_machine=mips-dec
+ basic_os=
+ ;;
+ delta88)
+ basic_machine=m88k-motorola
+ basic_os=sysv3
+ ;;
+ dicos)
+ basic_machine=i686-pc
+ basic_os=dicos
+ ;;
+ djgpp)
+ basic_machine=i586-pc
+ basic_os=msdosdjgpp
+ ;;
+ ebmon29k)
+ basic_machine=a29k-amd
+ basic_os=ebmon
+ ;;
+ es1800 | OSE68k | ose68k | ose | OSE)
+ basic_machine=m68k-ericsson
+ basic_os=ose
+ ;;
+ gmicro)
+ basic_machine=tron-gmicro
+ basic_os=sysv
+ ;;
+ go32)
+ basic_machine=i386-pc
+ basic_os=go32
+ ;;
+ h8300hms)
+ basic_machine=h8300-hitachi
+ basic_os=hms
+ ;;
+ h8300xray)
+ basic_machine=h8300-hitachi
+ basic_os=xray
+ ;;
+ h8500hms)
+ basic_machine=h8500-hitachi
+ basic_os=hms
+ ;;
+ harris)
+ basic_machine=m88k-harris
+ basic_os=sysv3
+ ;;
+ hp300 | hp300hpux)
+ basic_machine=m68k-hp
+ basic_os=hpux
+ ;;
+ hp300bsd)
+ basic_machine=m68k-hp
+ basic_os=bsd
+ ;;
+ hppaosf)
+ basic_machine=hppa1.1-hp
+ basic_os=osf
+ ;;
+ hppro)
+ basic_machine=hppa1.1-hp
+ basic_os=proelf
+ ;;
+ i386mach)
+ basic_machine=i386-mach
+ basic_os=mach
+ ;;
+ isi68 | isi)
+ basic_machine=m68k-isi
+ basic_os=sysv
+ ;;
+ m68knommu)
+ basic_machine=m68k-unknown
+ basic_os=linux
+ ;;
+ magnum | m3230)
+ basic_machine=mips-mips
+ basic_os=sysv
+ ;;
+ merlin)
+ basic_machine=ns32k-utek
+ basic_os=sysv
+ ;;
+ mingw64)
+ basic_machine=x86_64-pc
+ basic_os=mingw64
+ ;;
+ mingw32)
+ basic_machine=i686-pc
+ basic_os=mingw32
+ ;;
+ mingw32ce)
+ basic_machine=arm-unknown
+ basic_os=mingw32ce
+ ;;
+ monitor)
+ basic_machine=m68k-rom68k
+ basic_os=coff
+ ;;
+ morphos)
+ basic_machine=powerpc-unknown
+ basic_os=morphos
+ ;;
+ moxiebox)
+ basic_machine=moxie-unknown
+ basic_os=moxiebox
+ ;;
+ msdos)
+ basic_machine=i386-pc
+ basic_os=msdos
+ ;;
+ msys)
+ basic_machine=i686-pc
+ basic_os=msys
+ ;;
+ mvs)
+ basic_machine=i370-ibm
+ basic_os=mvs
+ ;;
+ nacl)
+ basic_machine=le32-unknown
+ basic_os=nacl
+ ;;
+ ncr3000)
+ basic_machine=i486-ncr
+ basic_os=sysv4
+ ;;
+ netbsd386)
+ basic_machine=i386-pc
+ basic_os=netbsd
+ ;;
+ netwinder)
+ basic_machine=armv4l-rebel
+ basic_os=linux
+ ;;
+ news | news700 | news800 | news900)
+ basic_machine=m68k-sony
+ basic_os=newsos
+ ;;
+ news1000)
+ basic_machine=m68030-sony
+ basic_os=newsos
+ ;;
+ necv70)
+ basic_machine=v70-nec
+ basic_os=sysv
+ ;;
+ nh3000)
+ basic_machine=m68k-harris
+ basic_os=cxux
+ ;;
+ nh[45]000)
+ basic_machine=m88k-harris
+ basic_os=cxux
+ ;;
+ nindy960)
+ basic_machine=i960-intel
+ basic_os=nindy
+ ;;
+ mon960)
+ basic_machine=i960-intel
+ basic_os=mon960
+ ;;
+ nonstopux)
+ basic_machine=mips-compaq
+ basic_os=nonstopux
+ ;;
+ os400)
+ basic_machine=powerpc-ibm
+ basic_os=os400
+ ;;
+ OSE68000 | ose68000)
+ basic_machine=m68000-ericsson
+ basic_os=ose
+ ;;
+ os68k)
+ basic_machine=m68k-none
+ basic_os=os68k
+ ;;
+ paragon)
+ basic_machine=i860-intel
+ basic_os=osf
+ ;;
+ parisc)
+ basic_machine=hppa-unknown
+ basic_os=linux
+ ;;
+ psp)
+ basic_machine=mipsallegrexel-sony
+ basic_os=psp
+ ;;
+ pw32)
+ basic_machine=i586-unknown
+ basic_os=pw32
+ ;;
+ rdos | rdos64)
+ basic_machine=x86_64-pc
+ basic_os=rdos
+ ;;
+ rdos32)
+ basic_machine=i386-pc
+ basic_os=rdos
+ ;;
+ rom68k)
+ basic_machine=m68k-rom68k
+ basic_os=coff
+ ;;
+ sa29200)
+ basic_machine=a29k-amd
+ basic_os=udi
+ ;;
+ sei)
+ basic_machine=mips-sei
+ basic_os=seiux
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ basic_os=
+ ;;
+ sps7)
+ basic_machine=m68k-bull
+ basic_os=sysv2
+ ;;
+ st2000)
+ basic_machine=m68k-tandem
+ basic_os=
+ ;;
+ stratus)
+ basic_machine=i860-stratus
+ basic_os=sysv4
+ ;;
+ sun2)
+ basic_machine=m68000-sun
+ basic_os=
+ ;;
+ sun2os3)
+ basic_machine=m68000-sun
+ basic_os=sunos3
+ ;;
+ sun2os4)
+ basic_machine=m68000-sun
+ basic_os=sunos4
+ ;;
+ sun3)
+ basic_machine=m68k-sun
+ basic_os=
+ ;;
+ sun3os3)
+ basic_machine=m68k-sun
+ basic_os=sunos3
+ ;;
+ sun3os4)
+ basic_machine=m68k-sun
+ basic_os=sunos4
+ ;;
+ sun4)
+ basic_machine=sparc-sun
+ basic_os=
+ ;;
+ sun4os3)
+ basic_machine=sparc-sun
+ basic_os=sunos3
+ ;;
+ sun4os4)
+ basic_machine=sparc-sun
+ basic_os=sunos4
+ ;;
+ sun4sol2)
+ basic_machine=sparc-sun
+ basic_os=solaris2
+ ;;
+ sun386 | sun386i | roadrunner)
+ basic_machine=i386-sun
+ basic_os=
+ ;;
+ sv1)
+ basic_machine=sv1-cray
+ basic_os=unicos
+ ;;
+ symmetry)
+ basic_machine=i386-sequent
+ basic_os=dynix
+ ;;
+ t3e)
+ basic_machine=alphaev5-cray
+ basic_os=unicos
+ ;;
+ t90)
+ basic_machine=t90-cray
+ basic_os=unicos
+ ;;
+ toad1)
+ basic_machine=pdp10-xkl
+ basic_os=tops20
+ ;;
+ tpf)
+ basic_machine=s390x-ibm
+ basic_os=tpf
+ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ basic_os=udi
+ ;;
+ ultra3)
+ basic_machine=a29k-nyu
+ basic_os=sym1
+ ;;
+ v810 | necv810)
+ basic_machine=v810-nec
+ basic_os=none
+ ;;
+ vaxv)
+ basic_machine=vax-dec
+ basic_os=sysv
+ ;;
+ vms)
+ basic_machine=vax-dec
+ basic_os=vms
+ ;;
+ vsta)
+ basic_machine=i386-pc
+ basic_os=vsta
+ ;;
+ vxworks960)
+ basic_machine=i960-wrs
+ basic_os=vxworks
+ ;;
+ vxworks68)
+ basic_machine=m68k-wrs
+ basic_os=vxworks
+ ;;
+ vxworks29k)
+ basic_machine=a29k-wrs
+ basic_os=vxworks
+ ;;
+ xbox)
+ basic_machine=i686-pc
+ basic_os=mingw32
+ ;;
+ ymp)
+ basic_machine=ymp-cray
+ basic_os=unicos
+ ;;
+ *)
+ basic_machine=$1
+ basic_os=
+ ;;
+ esac
+ ;;
+esac
+
+# Decode 1-component or ad-hoc basic machines
+case $basic_machine in
+ # Here we handle the default manufacturer of certain CPU types. It is in
+ # some cases the only manufacturer, in others, it is the most popular.
+ w89k)
+ cpu=hppa1.1
+ vendor=winbond
+ ;;
+ op50n)
+ cpu=hppa1.1
+ vendor=oki
+ ;;
+ op60c)
+ cpu=hppa1.1
+ vendor=oki
+ ;;
+ ibm*)
+ cpu=i370
+ vendor=ibm
+ ;;
+ orion105)
+ cpu=clipper
+ vendor=highlevel
+ ;;
+ mac | mpw | mac-mpw)
+ cpu=m68k
+ vendor=apple
+ ;;
+ pmac | pmac-mpw)
+ cpu=powerpc
+ vendor=apple
+ ;;
+
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+ 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+ cpu=m68000
+ vendor=att
+ ;;
+ 3b*)
+ cpu=we32k
+ vendor=att
+ ;;
+ bluegene*)
+ cpu=powerpc
+ vendor=ibm
+ basic_os=cnk
+ ;;
+ decsystem10* | dec10*)
+ cpu=pdp10
+ vendor=dec
+ basic_os=tops10
+ ;;
+ decsystem20* | dec20*)
+ cpu=pdp10
+ vendor=dec
+ basic_os=tops20
+ ;;
+ delta | 3300 | motorola-3300 | motorola-delta \
+ | 3300-motorola | delta-motorola)
+ cpu=m68k
+ vendor=motorola
+ ;;
+ dpx2*)
+ cpu=m68k
+ vendor=bull
+ basic_os=sysv3
+ ;;
+ encore | umax | mmax)
+ cpu=ns32k
+ vendor=encore
+ ;;
+ elxsi)
+ cpu=elxsi
+ vendor=elxsi
+ basic_os=${basic_os:-bsd}
+ ;;
+ fx2800)
+ cpu=i860
+ vendor=alliant
+ ;;
+ genix)
+ cpu=ns32k
+ vendor=ns
+ ;;
+ h3050r* | hiux*)
+ cpu=hppa1.1
+ vendor=hitachi
+ basic_os=hiuxwe2
+ ;;
+ hp3k9[0-9][0-9] | hp9[0-9][0-9])
+ cpu=hppa1.0
+ vendor=hp
+ ;;
+ hp9k2[0-9][0-9] | hp9k31[0-9])
+ cpu=m68000
+ vendor=hp
+ ;;
+ hp9k3[2-9][0-9])
+ cpu=m68k
+ vendor=hp
+ ;;
+ hp9k6[0-9][0-9] | hp6[0-9][0-9])
+ cpu=hppa1.0
+ vendor=hp
+ ;;
+ hp9k7[0-79][0-9] | hp7[0-79][0-9])
+ cpu=hppa1.1
+ vendor=hp
+ ;;
+ hp9k78[0-9] | hp78[0-9])
+ # FIXME: really hppa2.0-hp
+ cpu=hppa1.1
+ vendor=hp
+ ;;
+ hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+ # FIXME: really hppa2.0-hp
+ cpu=hppa1.1
+ vendor=hp
+ ;;
+ hp9k8[0-9][13679] | hp8[0-9][13679])
+ cpu=hppa1.1
+ vendor=hp
+ ;;
+ hp9k8[0-9][0-9] | hp8[0-9][0-9])
+ cpu=hppa1.0
+ vendor=hp
+ ;;
+ i*86v32)
+ cpu=`echo "$1" | sed -e 's/86.*/86/'`
+ vendor=pc
+ basic_os=sysv32
+ ;;
+ i*86v4*)
+ cpu=`echo "$1" | sed -e 's/86.*/86/'`
+ vendor=pc
+ basic_os=sysv4
+ ;;
+ i*86v)
+ cpu=`echo "$1" | sed -e 's/86.*/86/'`
+ vendor=pc
+ basic_os=sysv
+ ;;
+ i*86sol2)
+ cpu=`echo "$1" | sed -e 's/86.*/86/'`
+ vendor=pc
+ basic_os=solaris2
+ ;;
+ j90 | j90-cray)
+ cpu=j90
+ vendor=cray
+ basic_os=${basic_os:-unicos}
+ ;;
+ iris | iris4d)
+ cpu=mips
+ vendor=sgi
+ case $basic_os in
+ irix*)
+ ;;
+ *)
+ basic_os=irix4
+ ;;
+ esac
+ ;;
+ miniframe)
+ cpu=m68000
+ vendor=convergent
+ ;;
+ *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*)
+ cpu=m68k
+ vendor=atari
+ basic_os=mint
+ ;;
+ news-3600 | risc-news)
+ cpu=mips
+ vendor=sony
+ basic_os=newsos
+ ;;
+ next | m*-next)
+ cpu=m68k
+ vendor=next
+ case $basic_os in
+ openstep*)
+ ;;
+ nextstep*)
+ ;;
+ ns2*)
+ basic_os=nextstep2
+ ;;
+ *)
+ basic_os=nextstep3
+ ;;
+ esac
+ ;;
+ np1)
+ cpu=np1
+ vendor=gould
+ ;;
+ op50n-* | op60c-*)
+ cpu=hppa1.1
+ vendor=oki
+ basic_os=proelf
+ ;;
+ pa-hitachi)
+ cpu=hppa1.1
+ vendor=hitachi
+ basic_os=hiuxwe2
+ ;;
+ pbd)
+ cpu=sparc
+ vendor=tti
+ ;;
+ pbb)
+ cpu=m68k
+ vendor=tti
+ ;;
+ pc532)
+ cpu=ns32k
+ vendor=pc532
+ ;;
+ pn)
+ cpu=pn
+ vendor=gould
+ ;;
+ power)
+ cpu=power
+ vendor=ibm
+ ;;
+ ps2)
+ cpu=i386
+ vendor=ibm
+ ;;
+ rm[46]00)
+ cpu=mips
+ vendor=siemens
+ ;;
+ rtpc | rtpc-*)
+ cpu=romp
+ vendor=ibm
+ ;;
+ sde)
+ cpu=mipsisa32
+ vendor=sde
+ basic_os=${basic_os:-elf}
+ ;;
+ simso-wrs)
+ cpu=sparclite
+ vendor=wrs
+ basic_os=vxworks
+ ;;
+ tower | tower-32)
+ cpu=m68k
+ vendor=ncr
+ ;;
+ vpp*|vx|vx-*)
+ cpu=f301
+ vendor=fujitsu
+ ;;
+ w65)
+ cpu=w65
+ vendor=wdc
+ ;;
+ w89k-*)
+ cpu=hppa1.1
+ vendor=winbond
+ basic_os=proelf
+ ;;
+ none)
+ cpu=none
+ vendor=none
+ ;;
+ leon|leon[3-9])
+ cpu=sparc
+ vendor=$basic_machine
+ ;;
+ leon-*|leon[3-9]-*)
+ cpu=sparc
+ vendor=`echo "$basic_machine" | sed 's/-.*//'`
+ ;;
+
+ *-*)
+ # shellcheck disable=SC2162
+ saved_IFS=$IFS
+ IFS="-" read cpu vendor <<EOF
+$basic_machine
+EOF
+ IFS=$saved_IFS
+ ;;
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+ # (2) the word "unknown" tends to confuse beginning users.
+ i*86 | x86_64)
+ cpu=$basic_machine
+ vendor=pc
+ ;;
+ # These rules are duplicated from below for sake of the special case above;
+ # i.e. things that normalized to x86 arches should also default to "pc"
+ pc98)
+ cpu=i386
+ vendor=pc
+ ;;
+ x64 | amd64)
+ cpu=x86_64
+ vendor=pc
+ ;;
+ # Recognize the basic CPU types without company name.
+ *)
+ cpu=$basic_machine
+ vendor=unknown
+ ;;
+esac
+
+unset -v basic_machine
+
+# Decode basic machines in the full and proper CPU-Company form.
+case $cpu-$vendor in
+ # Here we handle the default manufacturer of certain CPU types in canonical form. It is in
+ # some cases the only manufacturer, in others, it is the most popular.
+ craynv-unknown)
+ vendor=cray
+ basic_os=${basic_os:-unicosmp}
+ ;;
+ c90-unknown | c90-cray)
+ vendor=cray
+ basic_os=${Basic_os:-unicos}
+ ;;
+ fx80-unknown)
+ vendor=alliant
+ ;;
+ romp-unknown)
+ vendor=ibm
+ ;;
+ mmix-unknown)
+ vendor=knuth
+ ;;
+ microblaze-unknown | microblazeel-unknown)
+ vendor=xilinx
+ ;;
+ rs6000-unknown)
+ vendor=ibm
+ ;;
+ vax-unknown)
+ vendor=dec
+ ;;
+ pdp11-unknown)
+ vendor=dec
+ ;;
+ we32k-unknown)
+ vendor=att
+ ;;
+ cydra-unknown)
+ vendor=cydrome
+ ;;
+ i370-ibm*)
+ vendor=ibm
+ ;;
+ orion-unknown)
+ vendor=highlevel
+ ;;
+ xps-unknown | xps100-unknown)
+ cpu=xps100
+ vendor=honeywell
+ ;;
+
+ # Here we normalize CPU types with a missing or matching vendor
+ dpx20-unknown | dpx20-bull)
+ cpu=rs6000
+ vendor=bull
+ basic_os=${basic_os:-bosx}
+ ;;
+
+ # Here we normalize CPU types irrespective of the vendor
+ amd64-*)
+ cpu=x86_64
+ ;;
+ blackfin-*)
+ cpu=bfin
+ basic_os=linux
+ ;;
+ c54x-*)
+ cpu=tic54x
+ ;;
+ c55x-*)
+ cpu=tic55x
+ ;;
+ c6x-*)
+ cpu=tic6x
+ ;;
+ e500v[12]-*)
+ cpu=powerpc
+ basic_os=${basic_os}"spe"
+ ;;
+ mips3*-*)
+ cpu=mips64
+ ;;
+ ms1-*)
+ cpu=mt
+ ;;
+ m68knommu-*)
+ cpu=m68k
+ basic_os=linux
+ ;;
+ m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*)
+ cpu=s12z
+ ;;
+ openrisc-*)
+ cpu=or32
+ ;;
+ parisc-*)
+ cpu=hppa
+ basic_os=linux
+ ;;
+ pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+ cpu=i586
+ ;;
+ pentiumpro-* | p6-* | 6x86-* | athlon-* | athalon_*-*)
+ cpu=i686
+ ;;
+ pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+ cpu=i686
+ ;;
+ pentium4-*)
+ cpu=i786
+ ;;
+ pc98-*)
+ cpu=i386
+ ;;
+ ppc-* | ppcbe-*)
+ cpu=powerpc
+ ;;
+ ppcle-* | powerpclittle-*)
+ cpu=powerpcle
+ ;;
+ ppc64-*)
+ cpu=powerpc64
+ ;;
+ ppc64le-* | powerpc64little-*)
+ cpu=powerpc64le
+ ;;
+ sb1-*)
+ cpu=mipsisa64sb1
+ ;;
+ sb1el-*)
+ cpu=mipsisa64sb1el
+ ;;
+ sh5e[lb]-*)
+ cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'`
+ ;;
+ spur-*)
+ cpu=spur
+ ;;
+ strongarm-* | thumb-*)
+ cpu=arm
+ ;;
+ tx39-*)
+ cpu=mipstx39
+ ;;
+ tx39el-*)
+ cpu=mipstx39el
+ ;;
+ x64-*)
+ cpu=x86_64
+ ;;
+ xscale-* | xscalee[bl]-*)
+ cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
+ ;;
+ arm64-*)
+ cpu=aarch64
+ ;;
+
+ # Recognize the canonical CPU Types that limit and/or modify the
+ # company names they are paired with.
+ cr16-*)
+ basic_os=${basic_os:-elf}
+ ;;
+ crisv32-* | etraxfs*-*)
+ cpu=crisv32
+ vendor=axis
+ ;;
+ cris-* | etrax*-*)
+ cpu=cris
+ vendor=axis
+ ;;
+ crx-*)
+ basic_os=${basic_os:-elf}
+ ;;
+ neo-tandem)
+ cpu=neo
+ vendor=tandem
+ ;;
+ nse-tandem)
+ cpu=nse
+ vendor=tandem
+ ;;
+ nsr-tandem)
+ cpu=nsr
+ vendor=tandem
+ ;;
+ nsv-tandem)
+ cpu=nsv
+ vendor=tandem
+ ;;
+ nsx-tandem)
+ cpu=nsx
+ vendor=tandem
+ ;;
+ mipsallegrexel-sony)
+ cpu=mipsallegrexel
+ vendor=sony
+ ;;
+ tile*-*)
+ basic_os=${basic_os:-linux-gnu}
+ ;;
+
+ *)
+ # Recognize the canonical CPU types that are allowed with any
+ # company name.
+ case $cpu in
+ 1750a | 580 \
+ | a29k \
+ | aarch64 | aarch64_be \
+ | abacus \
+ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \
+ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \
+ | alphapca5[67] | alpha64pca5[67] \
+ | am33_2.0 \
+ | amdgcn \
+ | arc | arceb | arc32 | arc64 \
+ | arm | arm[lb]e | arme[lb] | armv* \
+ | avr | avr32 \
+ | asmjs \
+ | ba \
+ | be32 | be64 \
+ | bfin | bpf | bs2000 \
+ | c[123]* | c30 | [cjt]90 | c4x \
+ | c8051 | clipper | craynv | csky | cydra \
+ | d10v | d30v | dlx | dsp16xx \
+ | e2k | elxsi | epiphany \
+ | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \
+ | h8300 | h8500 \
+ | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ | hexagon \
+ | i370 | i*86 | i860 | i960 | ia16 | ia64 \
+ | ip2k | iq2000 \
+ | k1om \
+ | le32 | le64 \
+ | lm32 \
+ | loongarch32 | loongarch64 | loongarchx32 \
+ | m32c | m32r | m32rle \
+ | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \
+ | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \
+ | m88110 | m88k | maxq | mb | mcore | mep | metag \
+ | microblaze | microblazeel \
+ | mips | mipsbe | mipseb | mipsel | mipsle \
+ | mips16 \
+ | mips64 | mips64eb | mips64el \
+ | mips64octeon | mips64octeonel \
+ | mips64orion | mips64orionel \
+ | mips64r5900 | mips64r5900el \
+ | mips64vr | mips64vrel \
+ | mips64vr4100 | mips64vr4100el \
+ | mips64vr4300 | mips64vr4300el \
+ | mips64vr5000 | mips64vr5000el \
+ | mips64vr5900 | mips64vr5900el \
+ | mipsisa32 | mipsisa32el \
+ | mipsisa32r2 | mipsisa32r2el \
+ | mipsisa32r3 | mipsisa32r3el \
+ | mipsisa32r5 | mipsisa32r5el \
+ | mipsisa32r6 | mipsisa32r6el \
+ | mipsisa64 | mipsisa64el \
+ | mipsisa64r2 | mipsisa64r2el \
+ | mipsisa64r3 | mipsisa64r3el \
+ | mipsisa64r5 | mipsisa64r5el \
+ | mipsisa64r6 | mipsisa64r6el \
+ | mipsisa64sb1 | mipsisa64sb1el \
+ | mipsisa64sr71k | mipsisa64sr71kel \
+ | mipsr5900 | mipsr5900el \
+ | mipstx39 | mipstx39el \
+ | mmix \
+ | mn10200 | mn10300 \
+ | moxie \
+ | mt \
+ | msp430 \
+ | nds32 | nds32le | nds32be \
+ | nfp \
+ | nios | nios2 | nios2eb | nios2el \
+ | none | np1 | ns16k | ns32k | nvptx \
+ | open8 \
+ | or1k* \
+ | or32 \
+ | orion \
+ | picochip \
+ | pdp10 | pdp11 | pj | pjl | pn | power \
+ | powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \
+ | pru \
+ | pyramid \
+ | riscv | riscv32 | riscv32be | riscv64 | riscv64be \
+ | rl78 | romp | rs6000 | rx \
+ | s390 | s390x \
+ | score \
+ | sh | shl \
+ | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \
+ | sh[1234]e[lb] | sh[12345][lb]e | sh[23]ele | sh64 | sh64le \
+ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \
+ | sparclite \
+ | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \
+ | spu \
+ | tahoe \
+ | thumbv7* \
+ | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \
+ | tron \
+ | ubicom32 \
+ | v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \
+ | vax \
+ | visium \
+ | w65 \
+ | wasm32 | wasm64 \
+ | we32k \
+ | x86 | x86_64 | xc16x | xgate | xps100 \
+ | xstormy16 | xtensa* \
+ | ymp \
+ | z8k | z80)
+ ;;
+
+ *)
+ echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2
+ exit 1
+ ;;
+ esac
+ ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $vendor in
+ digital*)
+ vendor=dec
+ ;;
+ commodore*)
+ vendor=cbm
+ ;;
+ *)
+ ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if test x$basic_os != x
+then
+
+# First recognize some ad-hoc caes, or perhaps split kernel-os, or else just
+# set os.
+case $basic_os in
+ gnu/linux*)
+ kernel=linux
+ os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'`
+ ;;
+ os2-emx)
+ kernel=os2
+ os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'`
+ ;;
+ nto-qnx*)
+ kernel=nto
+ os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'`
+ ;;
+ *-*)
+ # shellcheck disable=SC2162
+ saved_IFS=$IFS
+ IFS="-" read kernel os <<EOF
+$basic_os
+EOF
+ IFS=$saved_IFS
+ ;;
+ # Default OS when just kernel was specified
+ nto*)
+ kernel=nto
+ os=`echo "$basic_os" | sed -e 's|nto|qnx|'`
+ ;;
+ linux*)
+ kernel=linux
+ os=`echo "$basic_os" | sed -e 's|linux|gnu|'`
+ ;;
+ *)
+ kernel=
+ os=$basic_os
+ ;;
+esac
+
+# Now, normalize the OS (knowing we just have one component, it's not a kernel,
+# etc.)
+case $os in
+ # First match some system type aliases that might get confused
+ # with valid system types.
+ # solaris* is a basic system type, with this one exception.
+ auroraux)
+ os=auroraux
+ ;;
+ bluegene*)
+ os=cnk
+ ;;
+ solaris1 | solaris1.*)
+ os=`echo "$os" | sed -e 's|solaris1|sunos4|'`
+ ;;
+ solaris)
+ os=solaris2
+ ;;
+ unixware*)
+ os=sysv4.2uw
+ ;;
+ # es1800 is here to avoid being matched by es* (a different OS)
+ es1800*)
+ os=ose
+ ;;
+ # Some version numbers need modification
+ chorusos*)
+ os=chorusos
+ ;;
+ isc)
+ os=isc2.2
+ ;;
+ sco6)
+ os=sco5v6
+ ;;
+ sco5)
+ os=sco3.2v5
+ ;;
+ sco4)
+ os=sco3.2v4
+ ;;
+ sco3.2.[4-9]*)
+ os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'`
+ ;;
+ sco*v* | scout)
+ # Don't match below
+ ;;
+ sco*)
+ os=sco3.2v2
+ ;;
+ psos*)
+ os=psos
+ ;;
+ qnx*)
+ os=qnx
+ ;;
+ hiux*)
+ os=hiuxwe2
+ ;;
+ lynx*178)
+ os=lynxos178
+ ;;
+ lynx*5)
+ os=lynxos5
+ ;;
+ lynxos*)
+ # don't get caught up in next wildcard
+ ;;
+ lynx*)
+ os=lynxos
+ ;;
+ mac[0-9]*)
+ os=`echo "$os" | sed -e 's|mac|macos|'`
+ ;;
+ opened*)
+ os=openedition
+ ;;
+ os400*)
+ os=os400
+ ;;
+ sunos5*)
+ os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
+ ;;
+ sunos6*)
+ os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
+ ;;
+ wince*)
+ os=wince
+ ;;
+ utek*)
+ os=bsd
+ ;;
+ dynix*)
+ os=bsd
+ ;;
+ acis*)
+ os=aos
+ ;;
+ atheos*)
+ os=atheos
+ ;;
+ syllable*)
+ os=syllable
+ ;;
+ 386bsd)
+ os=bsd
+ ;;
+ ctix* | uts*)
+ os=sysv
+ ;;
+ nova*)
+ os=rtmk-nova
+ ;;
+ ns2)
+ os=nextstep2
+ ;;
+ # Preserve the version number of sinix5.
+ sinix5.*)
+ os=`echo "$os" | sed -e 's|sinix|sysv|'`
+ ;;
+ sinix*)
+ os=sysv4
+ ;;
+ tpf*)
+ os=tpf
+ ;;
+ triton*)
+ os=sysv3
+ ;;
+ oss*)
+ os=sysv3
+ ;;
+ svr4*)
+ os=sysv4
+ ;;
+ svr3)
+ os=sysv3
+ ;;
+ sysvr4)
+ os=sysv4
+ ;;
+ ose*)
+ os=ose
+ ;;
+ *mint | mint[0-9]* | *MiNT | MiNT[0-9]*)
+ os=mint
+ ;;
+ dicos*)
+ os=dicos
+ ;;
+ pikeos*)
+ # Until real need of OS specific support for
+ # particular features comes up, bare metal
+ # configurations are quite functional.
+ case $cpu in
+ arm*)
+ os=eabi
+ ;;
+ *)
+ os=elf
+ ;;
+ esac
+ ;;
+ *)
+ # No normalization, but not necessarily accepted, that comes below.
+ ;;
+esac
+
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system. Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+kernel=
+case $cpu-$vendor in
+ score-*)
+ os=elf
+ ;;
+ spu-*)
+ os=elf
+ ;;
+ *-acorn)
+ os=riscix1.2
+ ;;
+ arm*-rebel)
+ kernel=linux
+ os=gnu
+ ;;
+ arm*-semi)
+ os=aout
+ ;;
+ c4x-* | tic4x-*)
+ os=coff
+ ;;
+ c8051-*)
+ os=elf
+ ;;
+ clipper-intergraph)
+ os=clix
+ ;;
+ hexagon-*)
+ os=elf
+ ;;
+ tic54x-*)
+ os=coff
+ ;;
+ tic55x-*)
+ os=coff
+ ;;
+ tic6x-*)
+ os=coff
+ ;;
+ # This must come before the *-dec entry.
+ pdp10-*)
+ os=tops20
+ ;;
+ pdp11-*)
+ os=none
+ ;;
+ *-dec | vax-*)
+ os=ultrix4.2
+ ;;
+ m68*-apollo)
+ os=domain
+ ;;
+ i386-sun)
+ os=sunos4.0.2
+ ;;
+ m68000-sun)
+ os=sunos3
+ ;;
+ m68*-cisco)
+ os=aout
+ ;;
+ mep-*)
+ os=elf
+ ;;
+ mips*-cisco)
+ os=elf
+ ;;
+ mips*-*)
+ os=elf
+ ;;
+ or32-*)
+ os=coff
+ ;;
+ *-tti) # must be before sparc entry or we get the wrong os.
+ os=sysv3
+ ;;
+ sparc-* | *-sun)
+ os=sunos4.1.1
+ ;;
+ pru-*)
+ os=elf
+ ;;
+ *-be)
+ os=beos
+ ;;
+ *-ibm)
+ os=aix
+ ;;
+ *-knuth)
+ os=mmixware
+ ;;
+ *-wec)
+ os=proelf
+ ;;
+ *-winbond)
+ os=proelf
+ ;;
+ *-oki)
+ os=proelf
+ ;;
+ *-hp)
+ os=hpux
+ ;;
+ *-hitachi)
+ os=hiux
+ ;;
+ i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+ os=sysv
+ ;;
+ *-cbm)
+ os=amigaos
+ ;;
+ *-dg)
+ os=dgux
+ ;;
+ *-dolphin)
+ os=sysv3
+ ;;
+ m68k-ccur)
+ os=rtu
+ ;;
+ m88k-omron*)
+ os=luna
+ ;;
+ *-next)
+ os=nextstep
+ ;;
+ *-sequent)
+ os=ptx
+ ;;
+ *-crds)
+ os=unos
+ ;;
+ *-ns)
+ os=genix
+ ;;
+ i370-*)
+ os=mvs
+ ;;
+ *-gould)
+ os=sysv
+ ;;
+ *-highlevel)
+ os=bsd
+ ;;
+ *-encore)
+ os=bsd
+ ;;
+ *-sgi)
+ os=irix
+ ;;
+ *-siemens)
+ os=sysv4
+ ;;
+ *-masscomp)
+ os=rtu
+ ;;
+ f30[01]-fujitsu | f700-fujitsu)
+ os=uxpv
+ ;;
+ *-rom68k)
+ os=coff
+ ;;
+ *-*bug)
+ os=coff
+ ;;
+ *-apple)
+ os=macos
+ ;;
+ *-atari*)
+ os=mint
+ ;;
+ *-wrs)
+ os=vxworks
+ ;;
+ *)
+ os=none
+ ;;
+esac
+
+fi
+
+# Now, validate our (potentially fixed-up) OS.
+case $os in
+ # Sometimes we do "kernel-libc", so those need to count as OSes.
+ musl* | newlib* | relibc* | uclibc*)
+ ;;
+ # Likewise for "kernel-abi"
+ eabi* | gnueabi*)
+ ;;
+ # VxWorks passes extra cpu info in the 4th filed.
+ simlinux | simwindows | spe)
+ ;;
+ # Now accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST end in a * to match a version number.
+ gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \
+ | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \
+ | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
+ | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \
+ | hiux* | abug | nacl* | netware* | windows* \
+ | os9* | macos* | osx* | ios* \
+ | mpw* | magic* | mmixware* | mon960* | lnews* \
+ | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
+ | aos* | aros* | cloudabi* | sortix* | twizzler* \
+ | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
+ | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \
+ | mirbsd* | netbsd* | dicos* | openedition* | ose* \
+ | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \
+ | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \
+ | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
+ | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
+ | udi* | lites* | ieee* | go32* | aux* | hcos* \
+ | chorusrdb* | cegcc* | glidix* | serenity* \
+ | cygwin* | msys* | pe* | moss* | proelf* | rtems* \
+ | midipix* | mingw32* | mingw64* | mint* \
+ | uxpv* | beos* | mpeix* | udk* | moxiebox* \
+ | interix* | uwin* | mks* | rhapsody* | darwin* \
+ | openstep* | oskit* | conix* | pw32* | nonstopux* \
+ | storm-chaos* | tops10* | tenex* | tops20* | its* \
+ | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \
+ | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \
+ | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \
+ | skyos* | haiku* | rdos* | toppers* | drops* | es* \
+ | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
+ | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
+ | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr*)
+ ;;
+ # This one is extra strict with allowed versions
+ sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
+ # Don't forget version if it is 3.2v4 or newer.
+ ;;
+ none)
+ ;;
+ *)
+ echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# As a final step for OS-related things, validate the OS-kernel combination
+# (given a valid OS), if there is a kernel.
+case $kernel-$os in
+ linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \
+ | linux-musl* | linux-relibc* | linux-uclibc* )
+ ;;
+ uclinux-uclibc* )
+ ;;
+ -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* )
+ # These are just libc implementations, not actual OSes, and thus
+ # require a kernel.
+ echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2
+ exit 1
+ ;;
+ kfreebsd*-gnu* | kopensolaris*-gnu*)
+ ;;
+ vxworks-simlinux | vxworks-simwindows | vxworks-spe)
+ ;;
+ nto-qnx*)
+ ;;
+ os2-emx)
+ ;;
+ *-eabi* | *-gnueabi*)
+ ;;
+ -*)
+ # Blank kernel with real OS is always fine.
+ ;;
+ *-*)
+ echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2
+ exit 1
+ ;;
+esac
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer. We pick the logical manufacturer.
+case $vendor in
+ unknown)
+ case $cpu-$os in
+ *-riscix*)
+ vendor=acorn
+ ;;
+ *-sunos*)
+ vendor=sun
+ ;;
+ *-cnk* | *-aix*)
+ vendor=ibm
+ ;;
+ *-beos*)
+ vendor=be
+ ;;
+ *-hpux*)
+ vendor=hp
+ ;;
+ *-mpeix*)
+ vendor=hp
+ ;;
+ *-hiux*)
+ vendor=hitachi
+ ;;
+ *-unos*)
+ vendor=crds
+ ;;
+ *-dgux*)
+ vendor=dg
+ ;;
+ *-luna*)
+ vendor=omron
+ ;;
+ *-genix*)
+ vendor=ns
+ ;;
+ *-clix*)
+ vendor=intergraph
+ ;;
+ *-mvs* | *-opened*)
+ vendor=ibm
+ ;;
+ *-os400*)
+ vendor=ibm
+ ;;
+ s390-* | s390x-*)
+ vendor=ibm
+ ;;
+ *-ptx*)
+ vendor=sequent
+ ;;
+ *-tpf*)
+ vendor=ibm
+ ;;
+ *-vxsim* | *-vxworks* | *-windiss*)
+ vendor=wrs
+ ;;
+ *-aux*)
+ vendor=apple
+ ;;
+ *-hms*)
+ vendor=hitachi
+ ;;
+ *-mpw* | *-macos*)
+ vendor=apple
+ ;;
+ *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*)
+ vendor=atari
+ ;;
+ *-vos*)
+ vendor=stratus
+ ;;
+ esac
+ ;;
+esac
+
+echo "$cpu-$vendor-${kernel:+$kernel-}$os"
+exit
+
+# Local variables:
+# eval: (add-hook 'before-save-hook 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/build/crypto.m4 b/build/crypto.m4
new file mode 100644
index 0000000..3e856e4
--- /dev/null
+++ b/build/crypto.m4
@@ -0,0 +1,290 @@
+dnl -------------------------------------------------------- -*- autoconf -*-
+dnl Copyright 2006 The Apache Software Foundation or its licensors, as
+dnl applicable.
+dnl
+dnl Licensed under the Apache License, Version 2.0 (the "License");
+dnl you may not use this file except in compliance with the License.
+dnl You may obtain a copy of the License at
+dnl
+dnl http://www.apache.org/licenses/LICENSE-2.0
+dnl
+dnl Unless required by applicable law or agreed to in writing, software
+dnl distributed under the License is distributed on an "AS IS" BASIS,
+dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+dnl See the License for the specific language governing permissions and
+dnl limitations under the License.
+
+dnl
+dnl Crypto module
+dnl
+
+dnl
+dnl APU_CHECK_CRYPTO: look for crypto libraries and headers
+dnl
+AC_DEFUN([APU_CHECK_CRYPTO], [
+ apu_have_crypto=0
+ apu_have_openssl=0
+ apu_have_nss=0
+ apu_have_commoncrypto=0
+
+ old_libs="$LIBS"
+ old_cppflags="$CPPFLAGS"
+ old_ldflags="$LDFLAGS"
+
+ AC_ARG_WITH([crypto], [APR_HELP_STRING([--with-crypto], [enable crypto support])],
+ [
+ cryptolibs="openssl nss commoncrypto"
+
+ if test "$withval" = "yes"; then
+
+ crypto_library_enabled=0
+ for cryptolib in $cryptolibs; do
+ eval v=\$with_$cryptolib
+ if test "$v" != "" -a "$v" != "no"; then
+ crypto_library_enabled=1
+ fi
+ done
+
+ if test "$crypto_library_enabled" = "0"; then
+ for cryptolib in $cryptolibs; do
+ eval v=\$with_$cryptolib
+ if test "$v" != "no"; then
+ eval with_$cryptolib=yes
+ crypto_library_enabled=1
+ fi
+ done
+ if test "$crypto_library_enabled" = "1"; then
+ AC_MSG_NOTICE([Crypto was requested but no crypto library was found; autodetecting possible libraries])
+ else
+ AC_ERROR([Crypto was requested but all possible crypto libraries were disabled.])
+ fi
+ fi
+
+ APU_CHECK_CRYPTO_OPENSSL
+ APU_CHECK_CRYPTO_NSS
+ APU_CHECK_CRYPTO_COMMONCRYPTO
+ dnl add checks for other varieties of ssl here
+ if test "$apu_have_crypto" = "0"; then
+ AC_ERROR([Crypto was requested but no crypto library could be enabled; specify the location of a crypto library using --with-openssl, --with-nss, and/or --with-commoncrypto.])
+ fi
+ fi
+ ], [
+ apu_have_crypto=0
+ ])
+
+ AC_SUBST(apu_have_crypto)
+
+])
+dnl
+
+AC_DEFUN([APU_CHECK_CRYPTO_OPENSSL], [
+ openssl_have_headers=0
+ openssl_have_libs=0
+
+ old_libs="$LIBS"
+ old_cppflags="$CPPFLAGS"
+ old_ldflags="$LDFLAGS"
+
+ AC_ARG_WITH([openssl],
+ [APR_HELP_STRING([--with-openssl=DIR], [specify location of OpenSSL])],
+ [
+ if test "$withval" = "yes"; then
+ AC_CHECK_HEADERS(openssl/x509.h, [openssl_have_headers=1])
+ AC_CHECK_LIB(crypto, EVP_CIPHER_CTX_new, AC_CHECK_LIB(ssl, SSL_accept, [openssl_have_libs=1],,-lcrypto))
+ if test "$openssl_have_headers" != "0" && test "$openssl_have_libs" != "0"; then
+ apu_have_openssl=1
+ fi
+ elif test "$withval" = "no"; then
+ apu_have_openssl=0
+ else
+
+ openssl_CPPFLAGS="-I$withval/include"
+ openssl_LDFLAGS="-L$withval/lib "
+
+ APR_ADDTO(CPPFLAGS, [$openssl_CPPFLAGS])
+ APR_ADDTO(LDFLAGS, [$openssl_LDFLAGS])
+
+ AC_MSG_NOTICE(checking for openssl in $withval)
+ AC_CHECK_HEADERS(openssl/x509.h, [openssl_have_headers=1])
+ AC_CHECK_LIB(crypto, EVP_CIPHER_CTX_new, AC_CHECK_LIB(ssl, SSL_accept, [openssl_have_libs=1],,-lcrypto))
+ if test "$openssl_have_headers" != "0" && test "$openssl_have_libs" != "0"; then
+ apu_have_openssl=1
+ APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
+ APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include])
+ fi
+
+ AC_CHECK_DECLS([EVP_PKEY_CTX_new], [], [],
+ [#include <openssl/evp.h>])
+
+ fi
+ ], [
+ apu_have_openssl=0
+ ])
+
+ AC_SUBST(apu_have_openssl)
+
+ dnl Since we have already done the AC_CHECK_LIB tests, if we have it,
+ dnl we know the library is there.
+ if test "$apu_have_openssl" = "1"; then
+ APR_ADDTO(LDADD_crypto_openssl, [$openssl_LDFLAGS -lssl -lcrypto])
+ apu_have_crypto=1
+
+ AC_MSG_CHECKING([for const input buffers in OpenSSL])
+ AC_TRY_COMPILE([#include <openssl/rsa.h>],
+ [ const unsigned char * buf;
+ unsigned char * outbuf;
+ RSA rsa;
+
+ RSA_private_decrypt(1,
+ buf,
+ outbuf,
+ &rsa,
+ RSA_PKCS1_PADDING);
+
+ ],
+ [AC_MSG_RESULT([yes])]
+ [AC_DEFINE([CRYPTO_OPENSSL_CONST_BUFFERS], 1, [Define that OpenSSL uses const buffers])],
+ [AC_MSG_RESULT([no])])
+
+ fi
+ AC_SUBST(LDADD_crypto_openssl)
+ AC_SUBST(apu_have_crypto)
+
+ LIBS="$old_libs"
+ CPPFLAGS="$old_cppflags"
+ LDFLAGS="$old_ldflags"
+])
+
+AC_DEFUN([APU_CHECK_CRYPTO_NSS], [
+ nss_have_libs=0
+
+ old_libs="$LIBS"
+ old_cppflags="$CPPFLAGS"
+ old_ldflags="$LDFLAGS"
+
+ AC_ARG_WITH([nss],
+ [APR_HELP_STRING([--with-nss=DIR], [specify location of NSS])],
+ [
+ if test "$withval" = "yes"; then
+ AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+ if test -n "$PKG_CONFIG"; then
+ nss_CPPFLAGS=`$PKG_CONFIG --cflags-only-I nss`
+ nss_LDFLAGS=`$PKG_CONFIG --libs nss`
+ APR_ADDTO(CPPFLAGS, [$nss_CPPFLAGS])
+ APR_ADDTO(LDFLAGS, [$nss_LDFLAGS])
+ fi
+ nss_have_prerrorh=0
+ nss_have_nssh=0
+ nss_have_pk11pubh=0
+ AC_CHECK_HEADERS(prerror.h, [nss_have_prerrorh=1])
+ AC_CHECK_HEADERS(nss/nss.h nss.h, [nss_have_nssh=1])
+ AC_CHECK_HEADERS(nss/pk11pub.h pk11pub.h, [nss_have_pk11pubh=1])
+ nss_have_headers=${nss_have_prerrorh}${nss_have_nssh}${nss_have_pk11pubh}
+ AC_CHECK_LIB(nspr4, PR_Initialize, AC_CHECK_LIB(nss3, PK11_CreatePBEV2AlgorithmID, [nss_have_libs=1],,-lnspr4))
+ if test "$nss_have_headers" = "111" && test "$nss_have_libs" != "0"; then
+ apu_have_nss=1
+ fi
+ elif test "$withval" = "no"; then
+ apu_have_nss=0
+ elif test "x$withval" != "x"; then
+
+ nss_CPPFLAGS="-I$withval/include/nss -I$withval/include/nss3 -I$withval/include/nspr -I$withval/include/nspr4 -I$withval/include -I$withval/../public"
+ nss_LDFLAGS="-L$withval/lib "
+
+ APR_ADDTO(CPPFLAGS, [$nss_CPPFLAGS])
+ APR_ADDTO(LDFLAGS, [$nss_LDFLAGS])
+
+ AC_MSG_NOTICE(checking for nss in $withval)
+ nss_have_prerrorh=0
+ nss_have_nssh=0
+ nss_have_pk11pubh=0
+ AC_CHECK_HEADERS(prerror.h, [nss_have_prerrorh=1])
+ AC_CHECK_HEADERS(nss/nss.h nss.h, [nss_have_nssh=1])
+ AC_CHECK_HEADERS(nss/pk11pub.h pk11pub.h, [nss_have_pk11pubh=1])
+ nss_have_headers=${nss_have_prerrorh}${nss_have_nssh}${nss_have_pk11pubh}
+ AC_CHECK_LIB(nspr4, PR_Initialize, AC_CHECK_LIB(nss3, PK11_CreatePBEV2AlgorithmID, [nss_have_libs=1],,-lnspr4))
+ if test "$nss_have_headers" = "111" && test "$nss_have_libs" != "0"; then
+ apu_have_nss=1
+ fi
+
+ fi
+ if test "$apu_have_nss" != "0"; then
+ APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$nss_CPPFLAGS])
+ fi
+ ], [
+ apu_have_nss=0
+ ])
+
+ AC_SUBST(apu_have_nss)
+
+ dnl Since we have already done the AC_CHECK_LIB tests, if we have it,
+ dnl we know the library is there.
+ if test "$apu_have_nss" = "1"; then
+ APR_ADDTO(LDADD_crypto_nss, [$nss_LDFLAGS -lnspr4 -lnss3])
+ apu_have_crypto=1
+ fi
+ AC_SUBST(LDADD_crypto_nss)
+ AC_SUBST(apu_have_crypto)
+
+ LIBS="$old_libs"
+ CPPFLAGS="$old_cppflags"
+ LDFLAGS="$old_ldflags"
+])
+
+AC_DEFUN([APU_CHECK_CRYPTO_COMMONCRYPTO], [
+ apu_have_commoncrypto=0
+ commoncrypto_have_headers=0
+ commoncrypto_have_libs=0
+
+ old_libs="$LIBS"
+ old_cppflags="$CPPFLAGS"
+ old_ldflags="$LDFLAGS"
+
+ AC_ARG_WITH([commoncrypto],
+ [APR_HELP_STRING([--with-commoncrypto=DIR], [specify location of CommonCrypto])],
+ [
+ if test "$withval" = "yes"; then
+ AC_CHECK_HEADERS(CommonCrypto/CommonKeyDerivation.h, [commoncrypto_have_headers=1])
+ AC_CHECK_LIB(System, CCKeyDerivationPBKDF, AC_CHECK_LIB(System, CCCryptorCreate, [commoncrypto_have_libs=1]))
+ if test "$commoncrypto_have_headers" != "0" && test "$commoncrypto_have_libs" != "0"; then
+ apu_have_commoncrypto=1
+ fi
+ elif test "$withval" = "no"; then
+ apu_have_commoncrypto=0
+ else
+
+ commoncrypto_CPPFLAGS="-I$withval/include"
+ commoncrypto_LDFLAGS="-L$withval/lib "
+
+ APR_ADDTO(CPPFLAGS, [$commoncrypto_CPPFLAGS])
+ APR_ADDTO(LDFLAGS, [$commoncrypto_LDFLAGS])
+
+ AC_MSG_NOTICE(checking for commoncrypto in $withval)
+ AC_CHECK_HEADERS(CommonCrypto/CommonKeyDerivation.h, [commoncrypto_have_headers=1])
+ AC_CHECK_LIB(System, CCKeyDerivationPBKDF, AC_CHECK_LIB(System, CCCryptorCreate, [commoncrypto_have_libs=1]))
+ if test "$commoncrypto_have_headers" != "0" && test "$commoncrypto_have_libs" != "0"; then
+ apu_have_commoncrypto=1
+ APR_ADDTO(LDFLAGS, [-L$withval/lib])
+ APR_ADDTO(INCLUDES, [-I$withval/include])
+ fi
+
+ fi
+ ], [
+ apu_have_commoncrypto=0
+ ])
+
+ dnl Since we have already done the AC_CHECK_LIB tests, if we have it,
+ dnl we know the library is there.
+ if test "$apu_have_commoncrypto" = "1"; then
+ apu_have_crypto=1
+ fi
+ AC_SUBST(apu_have_commoncrypto)
+ AC_SUBST(LDADD_crypto_commoncrypto)
+ AC_SUBST(apu_have_crypto)
+
+ LIBS="$old_libs"
+ CPPFLAGS="$old_cppflags"
+ LDFLAGS="$old_ldflags"
+])
+
+dnl
diff --git a/build/dbd.m4 b/build/dbd.m4
new file mode 100644
index 0000000..46ba465
--- /dev/null
+++ b/build/dbd.m4
@@ -0,0 +1,524 @@
+dnl -------------------------------------------------------- -*- autoconf -*-
+dnl Licensed to the Apache Software Foundation (ASF) under one or more
+dnl contributor license agreements. See the NOTICE file distributed with
+dnl this work for additional information regarding copyright ownership.
+dnl The ASF licenses this file to You under the Apache License, Version 2.0
+dnl (the "License"); you may not use this file except in compliance with
+dnl the License. You may obtain a copy of the License at
+dnl
+dnl http://www.apache.org/licenses/LICENSE-2.0
+dnl
+dnl Unless required by applicable law or agreed to in writing, software
+dnl distributed under the License is distributed on an "AS IS" BASIS,
+dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+dnl See the License for the specific language governing permissions and
+dnl limitations under the License.
+
+dnl
+dnl DBD module
+dnl
+
+dnl
+dnl APU_CHECK_DBD: compile backends for apr_dbd.
+dnl
+AC_DEFUN([APU_CHECK_DBD], [
+ apu_have_pgsql=0
+
+ old_libs="$LIBS"
+ old_cppflags="$CPPFLAGS"
+ old_ldflags="$LDFLAGS"
+
+ AC_ARG_WITH([pgsql], APR_HELP_STRING([--with-pgsql=DIR], [specify PostgreSQL location]),
+ [
+ if test "$withval" = "yes"; then
+ AC_PATH_PROG([PGSQL_CONFIG],[pg_config])
+ if test "x$PGSQL_CONFIG" != 'x'; then
+ pgsql_CPPFLAGS="-I`$PGSQL_CONFIG --includedir`"
+ pgsql_LDFLAGS="-L`$PGSQL_CONFIG --libdir`"
+
+ APR_ADDTO(CPPFLAGS, [$pgsql_CPPFLAGS])
+ APR_ADDTO(LDFLAGS, [$pgsql_LDFLAGS])
+ fi
+
+ AC_CHECK_HEADERS(libpq-fe.h, [
+ AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1],[
+ if test "x$PGSQL_CONFIG" != 'x'; then
+ unset ac_cv_lib_pq_PQsendQueryPrepared
+ pgsql_LIBS="`$PGSQL_CONFIG --libs`"
+ APR_ADDTO(LIBS, [$pgsql_LIBS])
+ AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1])
+ fi
+ ])
+ ])
+ if test "$apu_have_pgsql" = "0"; then
+ AC_CHECK_HEADERS(postgresql/libpq-fe.h, [
+ AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1],[
+ if test "x$PGSQL_CONFIG" != 'x'; then
+ unset ac_cv_lib_pq_PQsendQueryPrepared
+ pgsql_LIBS="`$PGSQL_CONFIG --libs`"
+ APR_ADDTO(LIBS, [$pgsql_LIBS])
+ AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1])
+ fi
+ ])
+ ])
+ fi
+ if test "$apu_have_pgsql" != "0" && test "x$PGSQL_CONFIG" != 'x'; then
+ APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$pgsql_CPPFLAGS])
+ fi
+ elif test "$withval" = "no"; then
+ :
+ else
+ AC_PATH_PROG([PGSQL_CONFIG],[pg_config],,[$withval/bin])
+ if test "x$PGSQL_CONFIG" != 'x'; then
+ pgsql_CPPFLAGS="-I`$PGSQL_CONFIG --includedir`"
+ pgsql_LDFLAGS="-L`$PGSQL_CONFIG --libdir`"
+ else
+ pgsql_CPPFLAGS="-I$withval/include"
+ pgsql_LDFLAGS="-L$withval/lib "
+ fi
+
+ APR_ADDTO(CPPFLAGS, [$pgsql_CPPFLAGS])
+ APR_ADDTO(LDFLAGS, [$pgsql_LDFLAGS])
+
+ AC_MSG_NOTICE(checking for pgsql in $withval)
+ AC_CHECK_HEADERS(libpq-fe.h, [
+ AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1],[
+ if test "x$PGSQL_CONFIG" != 'x'; then
+ unset ac_cv_lib_pq_PQsendQueryPrepared
+ pgsql_LIBS="`$PGSQL_CONFIG --libs`"
+ APR_ADDTO(LIBS, [$pgsql_LIBS])
+ AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1])
+ fi
+ ])
+ ])
+ if test "$apu_have_pgsql" != "1"; then
+ AC_CHECK_HEADERS(postgresql/libpq-fe.h, [
+ AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1],[
+ if test "x$PGSQL_CONFIG" != 'x'; then
+ unset ac_cv_lib_pq_PQsendQueryPrepared
+ pgsql_LIBS="`$PGSQL_CONFIG --libs`"
+ APR_ADDTO(LIBS, [$pgsql_LIBS])
+ AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1])
+ fi
+ ])
+ ])
+ fi
+ if test "$apu_have_pgsql" != "0"; then
+ APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$pgsql_CPPFLAGS])
+ fi
+ fi
+ ], [
+ AC_PATH_PROG([PGSQL_CONFIG],[pg_config])
+ if test "x$PGSQL_CONFIG" != 'x'; then
+ pgsql_CPPFLAGS="-I`$PGSQL_CONFIG --includedir`"
+ pgsql_LDFLAGS="-L`$PGSQL_CONFIG --libdir`"
+
+ APR_ADDTO(CPPFLAGS, [$pgsql_CPPFLAGS])
+ APR_ADDTO(LDFLAGS, [$pgsql_LDFLAGS])
+ fi
+
+ AC_CHECK_HEADERS(libpq-fe.h, [
+ AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1],[
+ if test "x$PGSQL_CONFIG" != 'x'; then
+ unset ac_cv_lib_pq_PQsendQueryPrepared
+ pgsql_LIBS="`$PGSQL_CONFIG --libs`"
+ APR_ADDTO(LIBS, [$pgsql_LIBS])
+ AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1])
+ fi
+ ])
+ ])
+ if test "$apu_have_pgsql" = "0"; then
+ AC_CHECK_HEADERS(postgresql/libpq-fe.h, [
+ AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1],[
+ if test "x$PGSQL_CONFIG" != 'x'; then
+ unset ac_cv_lib_pq_PQsendQueryPrepared
+ pgsql_LIBS="`$PGSQL_CONFIG --libs`"
+ APR_ADDTO(LIBS, [$pgsql_LIBS])
+ AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1])
+ fi
+ ])
+ ])
+ fi
+ if test "$apu_have_pgsql" != "0" && test "x$PGSQL_CONFIG" != 'x'; then
+ APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$pgsql_CPPFLAGS])
+ fi
+ ])
+ AC_SUBST(apu_have_pgsql)
+ dnl Since we have already done the AC_CHECK_LIB tests, if we have it,
+ dnl we know the library is there.
+ if test "$apu_have_pgsql" = "1"; then
+ APR_ADDTO(LDADD_dbd_pgsql, [$pgsql_LDFLAGS -lpq $pgsql_LIBS])
+ fi
+ AC_SUBST(LDADD_dbd_pgsql)
+
+ LIBS="$old_libs"
+ CPPFLAGS="$old_cppflags"
+ LDFLAGS="$old_ldflags"
+])
+dnl
+AC_DEFUN([APU_CHECK_DBD_MYSQL], [
+ apu_have_mysql=0
+
+ old_libs="$LIBS"
+ old_cppflags="$CPPFLAGS"
+ old_ldflags="$LDFLAGS"
+
+ my_library="mysqlclient"
+
+ AC_ARG_WITH([mysql], APR_HELP_STRING([--with-mysql=DIR], [enable MySQL DBD driver]),
+ [
+ if test "$withval" = "yes"; then
+ AC_PATH_PROG([MYSQL_CONFIG],[mysql_config])
+ if test "x$MYSQL_CONFIG" = "x"; then
+ AC_PATH_PROG([MYSQL_CONFIG],[mariadb_config])
+ fi
+ if test "x$MYSQL_CONFIG" != 'x'; then
+ mysql_CPPFLAGS="`$MYSQL_CONFIG --include`"
+ mysql_LDFLAGS="`$MYSQL_CONFIG --libs_r | sed -e 's/-l[[^ ]]\+//g'`"
+ mysql_LIBS="`$MYSQL_CONFIG --libs_r`"
+
+ APR_ADDTO(CPPFLAGS, [$mysql_CPPFLAGS])
+ APR_ADDTO(LIBS, [$mysql_LIBS])
+
+ if $MYSQL_CONFIG --libs_r | grep -q mariadb; then
+ my_library="mariadb"
+ fi
+ fi
+
+ AC_CHECK_HEADERS([mysql.h errmsg.h], [apu_have_mysql=1], [apu_have_mysql=0; break])
+ if test "$apr_have_mysql" = "0"; then
+ AC_CHECK_HEADERS([mysql/mysql.h mysql/errmsg.h], [apu_have_mysql=1], [apu_have_mysql=0; break])
+ fi
+ if test "$apr_have_mysql" = "1"; then
+ AC_CHECK_HEADERS([my_global.h my_sys.h mysql/my_global.h mysql/my_sys.h])
+ AC_CHECK_LIB($my_library, mysql_init,, [apu_have_mysql=0])
+ fi
+ if test "$apu_have_mysql" = "1" && test "x$MYSQL_CONFIG" != 'x'; then
+ APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$mysql_CPPFLAGS])
+ fi
+ elif test "$withval" = "no"; then
+ :
+ else
+ AC_PATH_PROG([MYSQL_CONFIG],[mysql_config],,[$withval/bin])
+ if test "x$MYSQL_CONFIG" = "x"; then
+ AC_PATH_PROG([MYSQL_CONFIG],[mariadb_config],,[$withval/bin])
+ fi
+ if test "x$MYSQL_CONFIG" != 'x'; then
+ mysql_CPPFLAGS="`$MYSQL_CONFIG --include`"
+ mysql_LDFLAGS="`$MYSQL_CONFIG --libs_r | sed -e 's/-l[[^ ]]\+//g'`"
+ mysql_LIBS="`$MYSQL_CONFIG --libs_r`"
+ if $MYSQL_CONFIG --libs_r | grep -q mariadb; then
+ my_library="mariadb"
+ fi
+ else
+ mysql_CPPFLAGS="-I$withval/include"
+ mysql_LDFLAGS="-L$withval/lib "
+ fi
+
+ APR_ADDTO(CPPFLAGS, [$mysql_CPPFLAGS])
+ APR_ADDTO(LDFLAGS, [$mysql_LDFLAGS])
+ APR_ADDTO(LIBS, [$mysql_LIBS])
+
+ AC_MSG_NOTICE(checking for mysql in $withval)
+ AC_CHECK_HEADERS([mysql.h errmsg.h], [apu_have_mysql=1], [apu_have_mysql=0; break])
+ if test "$apr_have_mysql" = "0"; then
+ AC_CHECK_HEADERS([mysql/mysql.h mysql/errmsg.h], [apu_have_mysql=1], [apu_have_mysql=0; break])
+ fi
+ if test "$apr_have_mysql" = "1"; then
+ AC_CHECK_HEADERS([my_global.h my_sys.h mysql/my_global.h mysql/my_sys.h])
+ AC_CHECK_LIB($my_library, mysql_init,, [apu_have_mysql=0])
+ fi
+ if test "$apu_have_mysql" = "1"; then
+ APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$mysql_CPPFLAGS])
+ fi
+ fi
+ ])
+
+ AC_SUBST(apu_have_mysql)
+
+ dnl Since we have already done the AC_CHECK_LIB tests, if we have it,
+ dnl we know the library is there.
+ if test "$apu_have_mysql" = "1"; then
+ APR_ADDTO(LDADD_dbd_mysql, [$mysql_LDFLAGS -l$my_library $mysql_LIBS])
+ fi
+ AC_SUBST(LDADD_dbd_mysql)
+
+ LIBS="$old_libs"
+ CPPFLAGS="$old_cppflags"
+ LDFLAGS="$old_ldflags"
+])
+dnl
+AC_DEFUN([APU_CHECK_DBD_SQLITE3], [
+ apu_have_sqlite3=0
+
+ old_libs="$LIBS"
+ old_cppflags="$CPPFLAGS"
+ old_ldflags="$LDFLAGS"
+
+ AC_ARG_WITH([sqlite3], APR_HELP_STRING([--with-sqlite3=DIR], [enable sqlite3 DBD driver]),
+ [
+ if test "$withval" = "yes"; then
+ AC_CHECK_HEADERS(sqlite3.h, AC_CHECK_LIB(sqlite3, sqlite3_open, [apu_have_sqlite3=1]))
+ elif test "$withval" = "no"; then
+ :
+ else
+ sqlite3_CPPFLAGS="-I$withval/include"
+ sqlite3_LDFLAGS="-L$withval/lib "
+
+ APR_ADDTO(CPPFLAGS, [$sqlite3_CPPFLAGS])
+ APR_ADDTO(LDFLAGS, [$sqlite3_LDFLAGS])
+
+ AC_MSG_NOTICE(checking for sqlite3 in $withval)
+ AC_CHECK_HEADERS(sqlite3.h, AC_CHECK_LIB(sqlite3, sqlite3_open, [apu_have_sqlite3=1]))
+ if test "$apu_have_sqlite3" != "0"; then
+ APR_ADDTO(APRUTIL_PRIV_INCLUDES, [-I$withval/include])
+ fi
+ fi
+ ], [
+ AC_CHECK_HEADERS(sqlite3.h, AC_CHECK_LIB(sqlite3, sqlite3_open, [apu_have_sqlite3=1]))
+ ])
+
+ AC_SUBST(apu_have_sqlite3)
+
+ dnl Since we have already done the AC_CHECK_LIB tests, if we have it,
+ dnl we know the library is there.
+ if test "$apu_have_sqlite3" = "1"; then
+ APR_ADDTO(LDADD_dbd_sqlite3, [$sqlite3_LDFLAGS -lsqlite3])
+ fi
+ AC_SUBST(LDADD_dbd_sqlite3)
+
+ LIBS="$old_libs"
+ CPPFLAGS="$old_cppflags"
+ LDFLAGS="$old_ldflags"
+])
+dnl
+AC_DEFUN([APU_CHECK_DBD_SQLITE2], [
+ apu_have_sqlite2=0
+
+ old_libs="$LIBS"
+ old_cppflags="$CPPFLAGS"
+ old_ldflags="$LDFLAGS"
+
+ AC_ARG_WITH([sqlite2], APR_HELP_STRING([--with-sqlite2=DIR], [enable sqlite2 DBD driver]),
+ [
+ if test "$withval" = "yes"; then
+ AC_CHECK_HEADERS(sqlite.h, AC_CHECK_LIB(sqlite, sqlite_open, [apu_have_sqlite2=1]))
+ elif test "$withval" = "no"; then
+ :
+ else
+ sqlite2_CPPFLAGS="-I$withval/include"
+ sqlite2_LDFLAGS="-L$withval/lib "
+
+ APR_ADDTO(CPPFLAGS, [$sqlite2_CPPFLAGS])
+ APR_ADDTO(LDFLAGS, [$sqlite2_LDFLAGS])
+
+ AC_MSG_NOTICE(checking for sqlite2 in $withval)
+ AC_CHECK_HEADERS(sqlite.h, AC_CHECK_LIB(sqlite, sqlite_open, [apu_have_sqlite2=1]))
+ if test "$apu_have_sqlite2" != "0"; then
+ APR_ADDTO(APRUTIL_PRIV_INCLUDES, [-I$withval/include])
+ fi
+ fi
+ ], [
+ AC_CHECK_HEADERS(sqlite.h, AC_CHECK_LIB(sqlite, sqlite_open, [apu_have_sqlite2=1]))
+ ])
+
+ AC_SUBST(apu_have_sqlite2)
+
+ dnl Since we have already done the AC_CHECK_LIB tests, if we have it,
+ dnl we know the library is there.
+ if test "$apu_have_sqlite2" = "1"; then
+ APR_ADDTO(LDADD_dbd_sqlite2, [$sqlite2_LDFLAGS -lsqlite])
+ fi
+ AC_SUBST(LDADD_dbd_sqlite2)
+
+ LIBS="$old_libs"
+ CPPFLAGS="$old_cppflags"
+ LDFLAGS="$old_ldflags"
+])
+dnl
+AC_DEFUN([APU_CHECK_DBD_ORACLE], [
+ apu_have_oracle=0
+
+ old_libs="$LIBS"
+ old_cppflags="$CPPFLAGS"
+ old_ldflags="$LDFLAGS"
+
+ AC_ARG_WITH([oracle-include],
+ APR_HELP_STRING([--with-oracle-include=DIR], [path to Oracle include files]))
+ AC_ARG_WITH([oracle],
+ APR_HELP_STRING([--with-oracle=DIR], [enable Oracle DBD driver; giving ORACLE_HOME as DIR]),
+ [
+ if test "$withval" = "yes"; then
+ if test -n "$with_oracle_include"; then
+ oracle_CPPFLAGS="$CPPFLAGS -I$with_oracle_include"
+ APR_ADDTO(APRUTIL_PRIV_INCLUDES, [-I$with_oracle_include])
+ fi
+
+ APR_ADDTO(CPPFLAGS, [$oracle_CPPFLAGS])
+
+ AC_CHECK_HEADERS(oci.h, AC_CHECK_LIB(clntsh, OCIEnvCreate, [apu_have_oracle=1],[
+ unset ac_cv_lib_clntsh_OCIEnvCreate
+ oracle_LIBS="-lnnz11"
+ APR_ADDTO(LIBS, [$oracle_LIBS])
+ AC_CHECK_LIB(clntsh, OCIEnvCreate, [apu_have_oracle=1],[
+ unset ac_cv_lib_clntsh_OCIEnvCreate
+ APR_REMOVEFROM(LIBS, [$oracle_LIBS])
+ oracle_LIBS="-lnnz10"
+ APR_ADDTO(LIBS, [$oracle_LIBS])
+ AC_CHECK_LIB(clntsh, OCIEnvCreate, [apu_have_oracle=1])
+ ])
+ ]))
+ elif test "$withval" = "no"; then
+ :
+ else
+ if test -n "$with_oracle_include"; then
+ oracle_CPPFLAGS="$CPPFLAGS -I$with_oracle_include"
+ APR_ADDTO(APRUTIL_PRIV_INCLUDES, [-I$with_oracle_include])
+ else
+ oracle_CPPFLAGS="-I$withval/rdbms/demo -I$withval/rdbms/public"
+ fi
+ oracle_LDFLAGS="-L$withval/lib "
+
+ APR_ADDTO(CPPFLAGS, [$oracle_CPPFLAGS])
+ APR_ADDTO(LDFLAGS, [$oracle_LDFLAGS])
+
+ AC_MSG_NOTICE(checking for oracle in $withval)
+ AC_CHECK_HEADERS(oci.h, AC_CHECK_LIB(clntsh, OCIEnvCreate, [apu_have_oracle=1],[
+ unset ac_cv_lib_clntsh_OCIEnvCreate
+ oracle_LIBS="-lnnz11"
+ APR_ADDTO(LIBS, [$oracle_LIBS])
+ AC_CHECK_LIB(clntsh, OCIEnvCreate, [apu_have_oracle=1],[
+ unset ac_cv_lib_clntsh_OCIEnvCreate
+ APR_REMOVEFROM(LIBS, [$oracle_LIBS])
+ oracle_LIBS="-lnnz10"
+ APR_ADDTO(LIBS, [$oracle_LIBS])
+ AC_CHECK_LIB(clntsh, OCIEnvCreate, [apu_have_oracle=1])
+ ])
+ ]))
+ if test "$apu_have_oracle" != "0"; then
+ oracle_LDFLAGS="$oracle_LDFLAGS -R$withval/lib"
+ if test -z "$with_oracle_include"; then
+ APR_ADDTO(APRUTIL_PRIV_INCLUDES, [-I$withval/rdbms/demo])
+ APR_ADDTO(APRUTIL_PRIV_INCLUDES, [-I$withval/rdbms/public])
+ fi
+ fi
+ fi
+ ])
+
+ AC_SUBST(apu_have_oracle)
+
+ dnl Since we have already done the AC_CHECK_LIB tests, if we have it,
+ dnl we know the library is there.
+ if test "$apu_have_oracle" = "1"; then
+ APR_ADDTO(LDADD_dbd_oracle, [$oracle_LDFLAGS -lclntsh $oracle_LIBS])
+ fi
+ AC_SUBST(LDADD_dbd_oracle)
+
+ LIBS="$old_libs"
+ CPPFLAGS="$old_cppflags"
+ LDFLAGS="$old_ldflags"
+])
+
+dnl
+
+AC_DEFUN([APU_CHECK_DBD_ODBC], [
+ apu_have_odbc=0
+
+ old_libs="$LIBS"
+ old_cppflags="$CPPFLAGS"
+ old_ldflags="$LDFLAGS"
+
+ AC_ARG_WITH([odbc], APR_HELP_STRING([--with-odbc=DIR], [specify ODBC location]),
+ [
+ if test "$withval" = "yes"; then
+ AC_PATH_PROG([ODBC_CONFIG],[odbc_config])
+ if test "x$ODBC_CONFIG" != 'x'; then
+ odbc_CPPFLAGS="-I`$ODBC_CONFIG --include-prefix`"
+ odbc_LDFLAGS="-L`$ODBC_CONFIG --lib-prefix`"
+ odbc_LIBS="`$ODBC_CONFIG --libs`"
+
+ APR_ADDTO(CPPFLAGS, [$odbc_CPPFLAGS])
+ APR_ADDTO(LDFLAGS, [$odbc_LDFLAGS])
+ APR_ADDTO(LIBS, [$odbc_LIBS])
+ fi
+
+ AC_CHECK_HEADERS(sql.h, AC_CHECK_LIB(odbc, SQLAllocHandle, [apu_have_odbc=1]))
+ if test "$apu_have_odbc" = "0"; then
+ AC_CHECK_HEADERS(odbc/sql.h, AC_CHECK_LIB(odbc, SQLAllocHandle, [apu_have_odbc=1]))
+ fi
+ if test "$apu_have_odbc" != "0" && test "x$ODBC_CONFIG" != 'x'; then
+ APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$odbc_CPPFLAGS])
+ fi
+ elif test "$withval" = "no"; then
+ :
+ else
+ AC_PATH_PROG([ODBC_CONFIG],[odbc_config],,[$withval/bin])
+ if test "x$ODBC_CONFIG" != 'x'; then
+ odbc_CPPFLAGS="-I`$ODBC_CONFIG --include-prefix`"
+ odbc_LDFLAGS="-L`$ODBC_CONFIG --lib-prefix`"
+ odbc_LIBS="`$ODBC_CONFIG --libs`"
+ else
+ if test -f "$withval" && test -x "$withval"; then
+ odbc_CPPFLAGS="-I`$withval --include-prefix`"
+ odbc_LDFLAGS="-L`$withval --lib-prefix`"
+ odbc_LIBS="`$withval --libs`"
+ else
+ odbc_CPPFLAGS="-I$withval/include"
+ odbc_LDFLAGS="-L$withval/lib "
+ fi
+ fi
+
+ APR_ADDTO(CPPFLAGS, [$odbc_CPPFLAGS])
+ APR_ADDTO(LDFLAGS, [$odbc_LDFLAGS])
+ APR_ADDTO(LIBS, [$odbc_LIBS])
+
+ AC_MSG_NOTICE(checking for odbc in $withval)
+ AC_CHECK_HEADERS(sql.h, AC_CHECK_LIB(odbc, SQLAllocHandle, [apu_have_odbc=1]))
+ if test "$apu_have_odbc" = "0"; then
+ AC_CHECK_HEADERS(odbc/sql.h, AC_CHECK_LIB(odbc, SQLAllocHandle, [apu_have_odbc=1]))
+ fi
+ if test "$apu_have_odbc" != "0" && test "x$ODBC_CONFIG" != 'x'; then
+ APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$odbc_CPPFLAGS])
+ fi
+ fi
+ ], [
+ AC_PATH_PROG([ODBC_CONFIG],[odbc_config])
+ if test "x$ODBC_CONFIG" != 'x'; then
+ odbc_CPPFLAGS="-I`$ODBC_CONFIG --include-prefix`"
+ odbc_LDFLAGS="-L`$ODBC_CONFIG --lib-prefix`"
+ odbc_LIBS="`$ODBC_CONFIG --libs`"
+
+ APR_ADDTO(CPPFLAGS, [$odbc_CPPFLAGS])
+ APR_ADDTO(LDFLAGS, [$odbc_LDFLAGS])
+ APR_ADDTO(LIBS, [$odbc_LIBS])
+ fi
+
+ AC_CHECK_HEADERS(sql.h, AC_CHECK_LIB(odbc, SQLAllocHandle, [apu_have_odbc=1]))
+ if test "$apu_have_odbc" = "0"; then
+ AC_CHECK_HEADERS(odbc/sql.h, AC_CHECK_LIB(odbc, SQLAllocHandle, [apu_have_odbc=1]))
+ fi
+ if test "$apu_have_odbc" != "0" && test "x$ODBC_CONFIG" != 'x'; then
+ APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$odbc_CPPFLAGS])
+ fi
+ ])
+ AC_SUBST(apu_have_odbc)
+ dnl Since we have already done the AC_CHECK_LIB tests, if we have it,
+ dnl we know the library is there.
+ if test "$apu_have_odbc" = "1"; then
+ APR_ADDTO(LDADD_dbd_odbc, [$odbc_LDFLAGS -lodbc $odbc_LIBS])
+ fi
+ AC_SUBST(LDADD_dbd_odbc)
+
+ LIBS="$old_libs"
+ CPPFLAGS="$old_cppflags"
+ LDFLAGS="$old_ldflags"
+
+ apu_dbd_tests=""
+ test $apu_have_oracle = 1 && apu_dbd_tests="$apu_dbd_tests oracle"
+ test $apu_have_pgsql = 1 && apu_dbd_tests="$apu_dbd_tests pgsql"
+ test $apu_have_mysql = 1 && apu_dbd_tests="$apu_dbd_tests mysql"
+ test $apu_have_sqlite2 = 1 && apu_dbd_tests="$apu_dbd_tests sqlite2"
+ test $apu_have_sqlite3 = 1 && apu_dbd_tests="$apu_dbd_tests sqlite3"
+ test $apu_have_odbc = 1 && apu_dbd_tests="$apu_dbd_tests odbc"
+ AC_SUBST(apu_dbd_tests)
+])
diff --git a/build/dbm.m4 b/build/dbm.m4
new file mode 100644
index 0000000..57bd131
--- /dev/null
+++ b/build/dbm.m4
@@ -0,0 +1,745 @@
+dnl -------------------------------------------------------- -*- autoconf -*-
+dnl Licensed to the Apache Software Foundation (ASF) under one or more
+dnl contributor license agreements. See the NOTICE file distributed with
+dnl this work for additional information regarding copyright ownership.
+dnl The ASF licenses this file to You under the Apache License, Version 2.0
+dnl (the "License"); you may not use this file except in compliance with
+dnl the License. You may obtain a copy of the License at
+dnl
+dnl http://www.apache.org/licenses/LICENSE-2.0
+dnl
+dnl Unless required by applicable law or agreed to in writing, software
+dnl distributed under the License is distributed on an "AS IS" BASIS,
+dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+dnl See the License for the specific language governing permissions and
+dnl limitations under the License.
+
+
+dnl
+dnl DBM module
+dnl
+
+dnl APU_LIB_BERKELEY_DB(major, minor, patch, places, headers, libnames)
+dnl
+dnl Search for a useable version of Berkeley DB in a number of
+dnl common places. The installed DB must be no older than the
+dnl version given by MAJOR, MINOR, and PATCH. All of these
+dnl arguments are allowed to be '-1', indicating we don't care.
+dnl PLACES is a list of places to search for a Berkeley DB
+dnl installation. HEADERS is a list of headers to try. LIBNAMES
+dnl is a list of names of the library to attempt to link against,
+dnl typically 'db' and 'db4'.
+dnl
+dnl If we find a useable version, set CPPFLAGS and LIBS as
+dnl appropriate, and set the shell variable `apu_have_db' to
+dnl `1', and apu_db_lib to the matching lib name, and apu_db_header
+dnl to the header to use. Otherwise, set `apu_have_db' to `0'.
+dnl
+dnl This macro also checks for the `--with-berkeley-db=PATH' flag;
+dnl if given, the macro will use the PATH specified, and the
+dnl configuration script will die if it can't find the library. If
+dnl the user gives the `--without-berkeley-db' flag, the entire
+dnl search is skipped.
+dnl
+dnl We cache the results of individual searches under particular
+dnl prefixes, not the overall result of whether we found Berkeley
+dnl DB. That way, the user can re-run the configure script with
+dnl different --with-berkeley-db switch values, without interference
+dnl from the cache.
+
+
+AC_DEFUN([APU_CHECK_BERKELEY_DB], [
+ bdb_version=$1
+ if test "$2" != "-1"; then
+ bdb_version="$bdb_version.$2"
+ if test "$3" != "-1"; then
+ bdb_version="$bdb_version.$3"
+ fi
+ fi
+ bdb_places=$4
+ bdb_default_search_headers=$5
+ bdb_default_search_lib_names=$6
+
+ apu_have_db=0
+
+ # Save the original values of the flags we tweak.
+ apu_check_lib_save_libs="$LIBS"
+ apu_check_lib_save_ldflags="$LDFLAGS"
+ apu_check_lib_save_cppflags="$CPPFLAGS"
+
+ # The variable `found' is the prefix under which we've found
+ # Berkeley DB, or `not' if we haven't found it anywhere yet.
+ found=not
+ for bdb_place in $bdb_places; do
+
+ LDFLAGS="$apu_check_lib_save_ldflags"
+ CPPFLAGS="$apu_check_lib_save_cppflags"
+ case "$bdb_place" in
+ "std" )
+ description="the standard places"
+ ;;
+ *":"* )
+ header="`echo $bdb_place | sed -e 's/:.*$//'`"
+ lib="`echo $bdb_place | sed -e 's/^.*://'`"
+ CPPFLAGS="$CPPFLAGS -I$header"
+ LDFLAGS="$LDFLAGS -L$lib"
+ description="$header and $lib"
+ ;;
+ * )
+ if test -d $bdb_place; then
+ LDFLAGS="$LDFLAGS -L$bdb_place/lib"
+ CPPFLAGS="$CPPFLAGS -I$bdb_place/include"
+ else
+ AC_MSG_CHECKING([for Berkeley DB $bdb_version in $bdb_place])
+ AC_MSG_RESULT([directory not found])
+ continue
+ fi
+ description="$bdb_place"
+ ;;
+ esac
+
+ # Since there is no AC_MSG_NOTICE in autoconf 2.13, we use this
+ # trick to display a message instead.
+ AC_MSG_CHECKING([for Berkeley DB $bdb_version in $description])
+ AC_MSG_RESULT()
+
+ for bdb_libname in $bdb_default_search_lib_names; do
+ for bdb_header in $bdb_default_search_headers; do
+ # Clear the header cache variable for each location
+ changequote(,)
+ cache_id="`echo ac_cv_header_${bdb_header} \
+ | sed -e 's/[^a-zA-Z0-9_]/_/g'`"
+ changequote([,])
+ unset $cache_id
+ AC_CHECK_HEADER([$bdb_header], [
+ if test "$1" = "3" -o "$1" = "4" -o "$1" = "5" -o "$1" = "6"; then
+ # We generate a separate cache variable for each prefix and libname
+ # we search under. That way, we avoid caching information that
+ # changes if the user runs `configure' with a different set of
+ # switches.
+ changequote(,)
+ cache_id="`echo apu_cv_check_berkeley_db_$1_$2_$3_${bdb_header}_${bdb_libname}_in_${bdb_place} \
+ | sed -e 's/[^a-zA-Z0-9_]/_/g'`"
+ changequote([,])
+
+ AC_MSG_CHECKING([for -l$bdb_libname])
+ dnl We can't use AC_CACHE_CHECK here, because that won't print out
+ dnl the value of the computed cache variable properly.
+ AC_CACHE_VAL($cache_id,
+ [
+ APU_TRY_BERKELEY_DB($1, $2, $3, $bdb_header, $bdb_libname)
+ eval "$cache_id=$apu_try_berkeley_db"
+ ])
+ result="`eval echo '$'$cache_id`"
+ AC_MSG_RESULT($result)
+ elif test "$1" = "1"; then
+ AC_CHECK_LIB($bdb_libname,
+ dbopen,
+ [result=yes],
+ [result=no]
+ )
+ elif test "$1" = "2"; then
+ AC_CHECK_LIB($bdb_libname,
+ db_open,
+ [result=yes],
+ [result=no]
+ )
+ fi
+ ], [result="no"])
+
+ # If we found it, no need to search any more.
+ if test "$result" = "yes"; then
+ found="$bdb_place"
+ break
+ fi
+ done
+ test "$found" != "not" && break
+ done
+ test "$found" != "not" && break
+ done
+
+ # Restore the original values of the flags we tweak.
+ LDFLAGS="$apu_check_lib_save_ldflags"
+ CPPFLAGS="$apu_check_lib_save_cppflags"
+
+ case "$found" in
+ "not")
+ apu_have_db=0
+ ;;
+ "std")
+ apu_db_header=$bdb_header
+ apu_db_lib=$bdb_libname
+ apu_have_db=1
+ ;;
+ *":"*)
+ header="`echo $found | sed -e 's/:.*$//'`"
+ lib="`echo $found | sed -e 's/^.*://'`"
+
+ APR_ADDTO(APRUTIL_INCLUDES, [-I$header])
+ APR_ADDTO(APRUTIL_LDFLAGS, [-L$lib])
+ apu_db_header=$bdb_header
+ apu_db_lib=$bdb_libname
+ apu_have_db=1
+ ;;
+ *)
+ APR_ADDTO(APRUTIL_INCLUDES, [-I$found/include])
+ APR_ADDTO(APRUTIL_LDFLAGS, [-L$found/lib])
+ apu_db_header=$bdb_header
+ apu_db_lib=$bdb_libname
+ apu_have_db=1
+ ;;
+ esac
+])
+
+
+dnl APU_TRY_BERKELEY_DB(major, minor, patch, header, libname)
+dnl
+dnl A subroutine of APU_CHECK_BERKELEY_DB.
+dnl
+dnl Check that a new-enough version of Berkeley DB is installed.
+dnl "New enough" means no older than the version given by MAJOR,
+dnl MINOR, and PATCH. The result of the test is not cached; no
+dnl messages are printed. Use HEADER as the header file to include.
+dnl Use LIBNAME as the library to link against.
+dnl (e.g. LIBNAME should usually be "db" or "db4".)
+dnl
+dnl Set the shell variable `apu_try_berkeley_db' to `yes' if we found
+dnl an appropriate version installed, or `no' otherwise.
+dnl
+dnl This macro uses the Berkeley DB library function `db_version' to
+dnl find the version. If the library installed doesn't have this
+dnl function, then this macro assumes it is too old.
+
+dnl NOTE: This is pretty messed up. It seems that the FreeBSD port of
+dnl Berkeley DB 4 puts the header file in /usr/local/include/db4, but the
+dnl database library in /usr/local/lib, as libdb4.[a|so]. There is no
+dnl /usr/local/include/db.h. So if you check for /usr/local first, you'll
+dnl get the old header file from /usr/include, and the new library from
+dnl /usr/local/lib. Disaster. Thus this test compares the version constants
+dnl in the db.h header with the ones returned by db_version().
+
+
+AC_DEFUN([APU_TRY_BERKELEY_DB],
+ [
+ apu_try_berkeley_db_save_libs="$LIBS"
+
+ apu_check_berkeley_db_major=$1
+ apu_check_berkeley_db_minor=$2
+ apu_check_berkeley_db_patch=$3
+ apu_try_berkeley_db_header=$4
+ apu_try_berkeley_db_libname=$5
+
+ LIBS="$LIBS -l$apu_try_berkeley_db_libname"
+ AC_TRY_RUN(
+ [
+#include <stdlib.h>
+#include <stdio.h>
+#include <$apu_try_berkeley_db_header>
+main ()
+{
+ int major, minor, patch;
+
+ db_version(&major, &minor, &patch);
+
+ /* Sanity check: ensure that db.h constants actually match the db library */
+ if (major != DB_VERSION_MAJOR
+ || minor != DB_VERSION_MINOR
+ || patch != DB_VERSION_PATCH)
+ exit (1);
+
+ /* Run-time check: ensure the library claims to be the correct version. */
+
+ if ($apu_check_berkeley_db_major != -1) {
+ if (major < $apu_check_berkeley_db_major)
+ exit (1);
+ if (major > $apu_check_berkeley_db_major)
+ exit (0);
+ }
+
+ if ($apu_check_berkeley_db_minor != -1) {
+ if (minor < $apu_check_berkeley_db_minor)
+ exit (1);
+ if (minor > $apu_check_berkeley_db_minor)
+ exit (0);
+ }
+
+ if ($apu_check_berkeley_db_patch == -1
+ || patch >= $apu_check_berkeley_db_patch)
+ exit (0);
+ else
+ exit (1);
+}
+ ],
+ [apu_try_berkeley_db=yes],
+ [apu_try_berkeley_db=no],
+ [apu_try_berkeley_db=yes]
+ )
+
+ LIBS="$apu_try_berkeley_db_save_libs"
+ ]
+)
+
+
+dnl
+dnl APU_CHECK_DB1: is DB1 present?
+dnl
+dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version
+dnl
+AC_DEFUN([APU_CHECK_DB1], [
+ places=$1
+ if test -z "$places"; then
+ places="std"
+ fi
+ APU_CHECK_BERKELEY_DB(1, 0, 0,
+ "$places",
+ "db1/db.h db.h",
+ "db1"
+ )
+ if test "$apu_have_db" = "1"; then
+ apu_db_version=1
+ fi
+])
+
+
+dnl
+dnl APU_CHECK_DB185: is DB1.85 present?
+dnl
+dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version
+dnl
+dnl NB: BerkelyDB v2 and above can be compiled in 1.85 mode
+dnl which has a libdb not libdb1 or libdb185
+AC_DEFUN([APU_CHECK_DB185], [
+ places=$1
+ if test -z "$places"; then
+ places="std"
+ fi
+ APU_CHECK_BERKELEY_DB(1, -1, -1,
+ "$places",
+ "db_185.h",
+ "db"
+ )
+ if test "$apu_have_db" = "1"; then
+ apu_db_version=185
+ fi
+])
+
+
+dnl
+dnl APU_CHECK_DB2: is DB2 present?
+dnl
+dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version
+dnl
+AC_DEFUN([APU_CHECK_DB2], [
+ places=$1
+ if test -z "$places"; then
+ places="std"
+ fi
+ APU_CHECK_BERKELEY_DB(2, -1, -1,
+ "$places",
+ "db2/db.h db.h",
+ "db2 db"
+ )
+ if test "$apu_have_db" = "1"; then
+ apu_db_version=2
+ fi
+])
+
+
+dnl
+dnl APU_CHECK_DB3: is DB3 present?
+dnl
+dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version
+dnl
+AC_DEFUN([APU_CHECK_DB3], [
+ places=$1
+ if test -z "$places"; then
+ places="std"
+ fi
+ APU_CHECK_BERKELEY_DB(3, -1, -1,
+ "$places",
+ "db3/db.h db.h",
+ "db3 db"
+ )
+ if test "$apu_have_db" = "1"; then
+ apu_db_version=3
+ fi
+])
+
+
+dnl
+dnl APU_CHECK_DBXY: is DBX.Y present?
+dnl
+dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version
+dnl
+AC_DEFUN([APU_CHECK_DBXY], [
+ places=$1
+ db_major=$2
+ db_minor=$3
+ if test -z "$places"; then
+ places="std /usr/local /usr/local/BerkeleyDB.${db_major}.${db_minor} /boot/home/config"
+ fi
+ APU_CHECK_BERKELEY_DB("${db_major}", "${db_minor}", "-1",
+ "$places",
+ "db${db_major}${db_minor}/db.h db${db_major}/db.h db.h",
+ "db-${db_major}.${db_minor} db${db_major}-${db_major}.${db_minor} db${db_major}${db_minor} db-${db_major} db${db_major} db"
+ )
+ if test "$apu_have_db" = "1"; then
+ apu_db_version=${db_major}
+ fi
+])
+
+
+AC_DEFUN([APU_CHECK_DB], [
+ requested=$1
+ check_places=$2
+
+ case "$requested" in
+ db)
+ APU_CHECK_DB_ALL("$check_places")
+ if test "$apu_have_db" = "0"; then
+ AC_MSG_ERROR(Berkeley db requested, but not found)
+ fi
+ ;;
+ db1)
+ APU_CHECK_DB1("$check_places")
+ if test "$apu_db_version" != "1"; then
+ AC_MSG_ERROR(Berkeley db1 not found)
+ fi
+ ;;
+ db185)
+ APU_CHECK_DB185("$check_places")
+ if test "$apu_db_version" != "185"; then
+ AC_MSG_ERROR(Berkeley db185 not found)
+ fi
+ ;;
+ db2)
+ APU_CHECK_DB2("$check_places")
+ if test "$apu_db_version" != "2"; then
+ AC_MSG_ERROR(Berkeley db2 not found)
+ fi
+ ;;
+ db3)
+ APU_CHECK_DB3("$check_places")
+ if test "$apu_db_version" != "3"; then
+ AC_MSG_ERROR(Berkeley db3 not found)
+ fi
+ ;;
+ db[[456]][[0-9]])
+ db_major=`echo "$requested" | sed -e 's/db//' -e 's/.$//'`
+ db_minor=`echo "$requested" | sed -e 's/db//' -e 's/.//'`
+ APU_CHECK_DBXY("$check_places", "$db_major", "$db_minor")
+ if test "$apu_db_version" != "$db_major"; then
+ AC_MSG_ERROR(Berkeley db$db_major not found)
+ fi
+ ;;
+ db[[456]])
+ db_major=`echo "$requested" | sed -e 's/db//'`
+ # Start version search at version x.9
+ db_minor=9
+ while [[ $db_minor -ge 0 ]]
+ do
+ APU_CHECK_DBXY("$check_places", "$db_major", "$db_minor")
+ if test "$apu_have_db" = "1"; then
+ break
+ fi
+ db_minor=`expr $db_minor - 1`
+ done
+ if test "$apu_db_version" != "$db_major"; then
+ AC_MSG_ERROR(Berkeley db$db_major not found)
+ fi
+ ;;
+ default)
+ APU_CHECK_DB_ALL("$check_places")
+ ;;
+ esac
+])
+
+dnl
+dnl APU_CHECK_DB_ALL: Try all Berkeley DB versions, from 6.X to 1.
+dnl
+AC_DEFUN([APU_CHECK_DB_ALL], [
+ all_places=$1
+
+ # Start version search at version 6.9
+ db_version=69
+ while [[ $db_version -ge 40 ]]
+ do
+ db_major=`echo $db_version | sed -e 's/.$//'`
+ db_minor=`echo $db_version | sed -e 's/.//'`
+ APU_CHECK_DBXY("$all_places", "$db_major", "$db_minor")
+ if test "$apu_have_db" = "1"; then
+ break
+ fi
+ db_version=`expr $db_version - 1`
+ done
+ if test "$apu_have_db" = "0"; then
+ APU_CHECK_DB3("$all_places")
+ fi
+ if test "$apu_have_db" = "0"; then
+ APU_CHECK_DB2("$all_places")
+ fi
+ if test "$apu_have_db" = "0"; then
+ APU_CHECK_DB1("$all_places")
+ fi
+ if test "$apu_have_db" = "0"; then
+ APU_CHECK_DB185("$all_places")
+ fi
+ AC_MSG_CHECKING(for Berkeley DB)
+ if test "$apu_have_db" = "1"; then
+ AC_MSG_RESULT(found db$apu_db_version)
+ else
+ AC_MSG_RESULT(not found)
+ fi
+])
+
+
+dnl
+dnl APU_CHECK_DBM: see what kind of DBM backend to use for apr_dbm.
+dnl
+AC_DEFUN([APU_CHECK_DBM], [
+ apu_use_sdbm=0
+ apu_use_ndbm=0
+ apu_use_gdbm=0
+ apu_use_db=0
+ dnl it's in our codebase
+ apu_have_sdbm=1
+ apu_have_gdbm=0
+ apu_have_ndbm=0
+ apu_have_db=0
+
+ apu_db_header=db.h # default so apu_select_dbm.h is syntactically correct
+ apu_db_version=0
+
+ # Maximum supported version announced in help string.
+ # Although we search for all versions up to 6.9,
+ # we should only include existing versions in our
+ # help string.
+ dbm_list="sdbm, gdbm, ndbm, db, db1, db185, db2, db3, db4"
+ db_max_version=48
+ db_min_version=41
+ db_version="$db_min_version"
+ while [[ $db_version -le $db_max_version ]]
+ do
+ dbm_list="$dbm_list, db$db_version"
+ db_version=`expr $db_version + 1`
+ done
+ db_max_version=53
+ db_min_version=50
+ db_version="$db_min_version"
+ while [[ $db_version -le $db_max_version ]]
+ do
+ dbm_list="$dbm_list, db$db_version"
+ db_version=`expr $db_version + 1`
+ done
+ db_max_version=60
+ db_min_version=60
+ db_version="$db_min_version"
+ while [[ $db_version -le $db_max_version ]]
+ do
+ dbm_list="$dbm_list, db$db_version"
+ db_version=`expr $db_version + 1`
+ done
+
+ AC_ARG_WITH(dbm, [APR_HELP_STRING([--with-dbm=DBM], [choose the DBM type to use.
+ DBM={sdbm,gdbm,ndbm,db,db1,db185,db2,db3,db4,db4X,db5X,db6X} for some X=0,...,9])],
+ [
+ if test "$withval" = "yes"; then
+ AC_MSG_ERROR([--with-dbm needs to specify a DBM type to use.
+ One of: $dbm_list])
+ fi
+ requested="$withval"
+ ], [
+ requested=default
+ ])
+
+ dnl We don't pull in GDBM unless the user asks for it, since it's GPL
+ AC_ARG_WITH([gdbm], [APR_HELP_STRING([--with-gdbm=DIR], [enable GDBM support])],
+ [
+ apu_have_gdbm=0
+ if test "$withval" = "yes"; then
+ AC_CHECK_HEADER(gdbm.h, AC_CHECK_LIB(gdbm, gdbm_open, [apu_have_gdbm=1]))
+ elif test "$withval" = "no"; then
+ apu_have_gdbm=0
+ else
+ saved_cppflags="$CPPFLAGS"
+ saved_ldflags="$LDFLAGS"
+ CPPFLAGS="$CPPFLAGS -I$withval/include"
+ LDFLAGS="$LDFLAGS -L$withval/lib "
+
+ AC_MSG_CHECKING(checking for gdbm in $withval)
+ AC_CHECK_HEADER(gdbm.h, AC_CHECK_LIB(gdbm, gdbm_open, [apu_have_gdbm=1]))
+ if test "$apu_have_gdbm" != "0"; then
+ APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
+ APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include])
+ fi
+ CPPFLAGS="$saved_cppflags"
+ LDFLAGS="$saved_ldflags"
+ fi
+ ])
+
+ AC_ARG_WITH([ndbm], [APR_HELP_STRING([--with-ndbm=PATH], [
+ Find the NDBM header and library in `PATH/include' and
+ `PATH/lib'. If PATH is of the form `HEADER:LIB', then search
+ for header files in HEADER, and the library in LIB. If you omit
+ the `=PATH' part completely, the configure script will search
+ for NDBM in a number of standard places.])],
+ [
+ apu_have_ndbm=0
+ if test "$withval" = "yes"; then
+ AC_MSG_CHECKING(checking for ndbm in the usual places)
+ apu_want_ndbm=1
+ NDBM_INC=""
+ NDBM_LDFLAGS=""
+ elif test "$withval" = "no"; then
+ apu_want_ndbm=0
+ else
+ apu_want_ndbm=1
+ case "$withval" in
+ *":"*)
+ NDBM_INC="-I`echo $withval |sed -e 's/:.*$//'`"
+ NDBM_LDFLAGS="-L`echo $withval |sed -e 's/^.*://'`"
+ AC_MSG_CHECKING(checking for ndbm includes with $NDBM_INC libs with $NDBM_LDFLAGS )
+ ;;
+ *)
+ NDBM_INC="-I$withval/include"
+ NDBM_LDFLAGS="-L$withval/lib"
+ AC_MSG_CHECKING(checking for ndbm includes in $withval)
+ ;;
+ esac
+ fi
+
+ save_cppflags="$CPPFLAGS"
+ save_ldflags="$LDFLAGS"
+ CPPFLAGS="$CPPFLAGS $NDBM_INC"
+ LDFLAGS="$LDFLAGS $NDBM_LDFLAGS"
+ dnl db_ndbm_open is what sleepcat's compatibility library actually has in it's lib
+ if test "$apu_want_ndbm" != "0"; then
+ AC_CHECK_HEADER(ndbm.h,
+ AC_CHECK_LIB(c, dbm_open, [apu_have_ndbm=1;apu_ndbm_lib=c],
+ AC_CHECK_LIB(dbm, dbm_open, [apu_have_ndbm=1;apu_ndbm_lib=dbm],
+ AC_CHECK_LIB(db, dbm_open, [apu_have_ndbm=1;apu_ndbm_lib=db],
+ AC_CHECK_LIB(db, __db_ndbm_open, [apu_have_ndbm=1;apu_ndbm_lib=db])
+ )
+ )
+ )
+ )
+ if test "$apu_have_ndbm" != "0"; then
+ if test "$withval" != "yes"; then
+ APR_ADDTO(APRUTIL_INCLUDES, [$NDBM_INC])
+ APR_ADDTO(APRUTIL_LDFLAGS, [$NDBM_LDFLAGS])
+ fi
+ elif test "$withval" != "yes"; then
+ AC_ERROR( NDBM not found in the specified directory)
+ fi
+ fi
+ CPPFLAGS="$save_cppflags"
+ LDFLAGS="$save_ldflags"
+ ], [
+ dnl don't check it no one has asked us for it
+ apu_have_ndbm=0
+ ])
+
+
+ if test -n "$apu_db_xtra_libs"; then
+ saveddbxtralibs="$LIBS"
+ LIBS="$apu_db_xtra_libs $LIBS"
+ fi
+
+ dnl We're going to try to find the highest version of Berkeley DB supported.
+ dnl
+ dnl Note that we only do this if the user requested it, since the Sleepycat
+ dnl license is viral and requires distribution of source along with programs
+ dnl that use it.
+ AC_ARG_WITH([berkeley-db], [APR_HELP_STRING([--with-berkeley-db=PATH],
+ [Find the Berkeley DB header and library in `PATH/include' and
+ `PATH/lib'. If PATH is of the form `HEADER:LIB', then search
+ for header files in HEADER, and the library in LIB. If you omit
+ the `=PATH' part completely, the configure script will search
+ for Berkeley DB in a number of standard places.])],
+ [
+ if test "$withval" = "yes"; then
+ apu_want_db=1
+ user_places=""
+ elif test "$withval" = "no"; then
+ apu_want_db=0
+ else
+ apu_want_db=1
+ user_places="$withval"
+ fi
+
+ if test "$apu_want_db" != "0"; then
+ APU_CHECK_DB($requested, $user_places)
+ if test "$apu_have_db" = "0"; then
+ AC_ERROR(Berkeley DB not found.)
+ fi
+ fi
+ ])
+
+ if test -n "$apu_db_xtra_libs"; then
+ LIBS="$saveddbxtralibs"
+ fi
+
+ case "$requested" in
+ sdbm | gdbm | ndbm | db)
+ eval "apu_use_$requested=1"
+ apu_default_dbm=$requested
+ ;;
+ db185 | db[[123456]])
+ apu_use_db=1
+ apu_default_dbm=$requested
+ ;;
+ db[[456]][[0-9]])
+ apu_use_db=1
+ apu_default_dbm=`echo $requested | sed -e 's/.$//'`
+ ;;
+ default)
+ dnl ### use more sophisticated DBMs for the default?
+ apu_default_dbm="sdbm (default)"
+ apu_use_sdbm=1
+ ;;
+ *)
+ AC_MSG_ERROR([--with-dbm=$requested is an unknown DBM type.
+ Use one of: $dbm_list])
+ ;;
+ esac
+
+ dnl Yes, it'd be nice if we could collate the output in an order
+ dnl so that the AC_MSG_CHECKING would be output before the actual
+ dnl checks, but it isn't happening now.
+ AC_MSG_CHECKING(for default DBM)
+ AC_MSG_RESULT($apu_default_dbm)
+
+ AC_SUBST(apu_use_sdbm)
+ AC_SUBST(apu_use_gdbm)
+ AC_SUBST(apu_use_ndbm)
+ AC_SUBST(apu_use_db)
+
+ AC_SUBST(apu_have_sdbm)
+ AC_SUBST(apu_have_gdbm)
+ AC_SUBST(apu_have_ndbm)
+ AC_SUBST(apu_have_db)
+ AC_SUBST(apu_db_header)
+ AC_SUBST(apu_db_version)
+
+ if test "$apu_have_db" = "1"; then
+ APR_ADDTO(LDADD_dbm_db, [-l$apu_db_lib])
+ if test -n "apu_db_xtra_libs"; then
+ APR_ADDTO(LDADD_dbm_db, [$apu_db_xtra_libs])
+ fi
+ fi
+
+ dnl Since we have already done the AC_CHECK_LIB tests, if we have it,
+ dnl we know the library is there.
+ if test "$apu_have_gdbm" = "1"; then
+ APR_ADDTO(LDADD_dbm_gdbm, [-lgdbm])
+ fi
+
+ if test "$apu_have_ndbm" = "1"; then
+ APR_ADDTO(LDADD_dbm_ndbm, [-l$apu_ndbm_lib])
+ fi
+
+ AC_SUBST(LDADD_dbm_db)
+ AC_SUBST(LDADD_dbm_gdbm)
+ AC_SUBST(LDADD_dbm_ndbm)
+])
+
diff --git a/build/dso.m4 b/build/dso.m4
new file mode 100644
index 0000000..2c5df6b
--- /dev/null
+++ b/build/dso.m4
@@ -0,0 +1,117 @@
+dnl -------------------------------------------------------- -*- autoconf -*-
+dnl Licensed to the Apache Software Foundation (ASF) under one or more
+dnl contributor license agreements. See the NOTICE file distributed with
+dnl this work for additional information regarding copyright ownership.
+dnl The ASF licenses this file to You under the Apache License, Version 2.0
+dnl (the "License"); you may not use this file except in compliance with
+dnl the License. You may obtain a copy of the License at
+dnl
+dnl http://www.apache.org/licenses/LICENSE-2.0
+dnl
+dnl Unless required by applicable law or agreed to in writing, software
+dnl distributed under the License is distributed on an "AS IS" BASIS,
+dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+dnl See the License for the specific language governing permissions and
+dnl limitations under the License.
+
+dnl
+dnl DSO module
+dnl
+
+AC_DEFUN([APU_CHECK_UTIL_DSO], [
+
+ AC_ARG_ENABLE([util-dso],
+ APR_HELP_STRING([--disable-util-dso],
+ [disable DSO build of modular components (crypto, dbd, dbm, ldap)]))
+
+ if test "$enable_util_dso" = "no"; then
+ apu_dso_build="0"
+ else
+ AC_CACHE_CHECK([whether APR has DSO support], [apu_cv_aprdso],
+ [apu_save_CPPFLAGS=$CPPFLAGS
+ CPPFLAGS="$CPPFLAGS $APR_INCLUDES"
+ AC_EGREP_CPP([yes], [#include "apr.h"
+#if APR_HAS_DSO
+yes
+#endif
+], [apu_cv_aprdso=yes], [apu_cv_aprdso=no])
+ CPPFLAGS=$apu_save_CPPFLAGS])
+
+ if test $apu_cv_aprdso = yes; then
+ apu_dso_build=1
+ else
+ apu_dso_build=0
+ fi
+ fi
+
+ if test "$apu_dso_build" = "0"; then
+
+ # Statically link the drivers:
+ objs=
+ test $apu_have_openssl = 1 && objs="$objs crypto/apr_crypto_openssl.lo"
+ test $apu_have_nss = 1 && objs="$objs crypto/apr_crypto_nss.lo"
+ test $apu_have_commoncrypto = 1 && objs="$objs crypto/apr_crypto_commoncrypto.lo"
+ test $apu_have_oracle = 1 && objs="$objs dbd/apr_dbd_oracle.lo"
+ test $apu_have_pgsql = 1 && objs="$objs dbd/apr_dbd_pgsql.lo"
+ test $apu_have_mysql = 1 && objs="$objs dbd/apr_dbd_mysql.lo"
+ test $apu_have_sqlite2 = 1 && objs="$objs dbd/apr_dbd_sqlite2.lo"
+ test $apu_have_sqlite3 = 1 && objs="$objs dbd/apr_dbd_sqlite3.lo"
+ test $apu_have_odbc = 1 && objs="$objs dbd/apr_dbd_odbc.lo"
+ test $apu_have_db = 1 && objs="$objs dbm/apr_dbm_berkeleydb.lo"
+ test $apu_have_gdbm = 1 && objs="$objs dbm/apr_dbm_gdbm.lo"
+ test $apu_have_ndbm = 1 && objs="$objs dbm/apr_dbm_ndbm.lo"
+ test $apu_has_ldap = 1 && objs="$objs ldap/apr_ldap_init.lo"
+ test $apu_has_ldap = 1 && objs="$objs ldap/apr_ldap_option.lo"
+ test $apu_has_ldap = 1 && objs="$objs ldap/apr_ldap_rebind.lo"
+ EXTRA_OBJECTS="$EXTRA_OBJECTS $objs"
+
+ # Use libtool *.la for mysql if available
+ if test $apu_have_mysql = 1; then
+ for flag in $LDADD_dbd_mysql
+ do
+ dir=`echo $flag | grep "^-L" | sed s:-L::`
+ if test "x$dir" != 'x'; then
+ if test -f "$dir/libmysqlclient_r.la"; then
+ LDADD_dbd_mysql=$dir/libmysqlclient_r.la
+ break
+ fi
+ fi
+ done
+ fi
+
+ APRUTIL_LIBS="$APRUTIL_LIBS $LDADD_crypto_openssl $LDADD_crypto_nss $LDADD_crypto_commoncrypto"
+ APRUTIL_LIBS="$APRUTIL_LIBS $LDADD_dbd_pgsql $LDADD_dbd_sqlite2 $LDADD_dbd_sqlite3 $LDADD_dbd_oracle $LDADD_dbd_mysql $LDADD_dbd_odbc"
+ APRUTIL_LIBS="$APRUTIL_LIBS $LDADD_dbm_db $LDADD_dbm_gdbm $LDADD_dbm_ndbm"
+ APRUTIL_LIBS="$APRUTIL_LIBS $LDADD_ldap"
+ APRUTIL_EXPORT_LIBS="$APRUTIL_EXPORT_LIBS $LDADD_crypto_openssl $LDADD_crypto_nss $LDADD_crypto_commoncrypto"
+ APRUTIL_EXPORT_LIBS="$APRUTIL_EXPORT_LIBS $LDADD_dbd_pgsql $LDADD_dbd_sqlite2 $LDADD_dbd_sqlite3 $LDADD_dbd_oracle $LDADD_dbd_mysql $LDADD_dbd_odbc"
+ APRUTIL_EXPORT_LIBS="$APRUTIL_EXPORT_LIBS $LDADD_dbm_db $LDADD_dbm_gdbm $LDADD_dbm_ndbm"
+ APRUTIL_EXPORT_LIBS="$APRUTIL_EXPORT_LIBS $LDADD_ldap"
+
+ else
+
+ # Build the drivers as loadable modules:
+ dsos=
+ test $apu_have_openssl = 1 && dsos="$dsos crypto/apr_crypto_openssl.la"
+ test $apu_have_nss = 1 && dsos="$dsos crypto/apr_crypto_nss.la"
+ test $apu_have_commoncrypto = 1 && dsos="$dsos crypto/apr_crypto_commoncrypto.la"
+ test $apu_have_oracle = 1 && dsos="$dsos dbd/apr_dbd_oracle.la"
+ test $apu_have_pgsql = 1 && dsos="$dsos dbd/apr_dbd_pgsql.la"
+ test $apu_have_mysql = 1 && dsos="$dsos dbd/apr_dbd_mysql.la"
+ test $apu_have_sqlite2 = 1 && dsos="$dsos dbd/apr_dbd_sqlite2.la"
+ test $apu_have_sqlite3 = 1 && dsos="$dsos dbd/apr_dbd_sqlite3.la"
+ test $apu_have_odbc = 1 && dsos="$dsos dbd/apr_dbd_odbc.la"
+ test $apu_have_db = 1 && dsos="$dsos dbm/apr_dbm_db.la"
+ test $apu_have_gdbm = 1 && dsos="$dsos dbm/apr_dbm_gdbm.la"
+ test $apu_have_ndbm = 1 && dsos="$dsos dbm/apr_dbm_ndbm.la"
+ test $apu_has_ldap = 1 && dsos="$dsos ldap/apr_ldap.la"
+
+ if test -n "$dsos"; then
+ APU_MODULES="$APU_MODULES $dsos"
+ fi
+
+ fi
+
+ AC_DEFINE_UNQUOTED([APU_DSO_BUILD], $apu_dso_build,
+ [Define to 1 if modular components are built as DSOs])
+])
diff --git a/build/find_apr.m4 b/build/find_apr.m4
new file mode 100644
index 0000000..925e523
--- /dev/null
+++ b/build/find_apr.m4
@@ -0,0 +1,202 @@
+dnl -------------------------------------------------------- -*- autoconf -*-
+dnl Licensed to the Apache Software Foundation (ASF) under one or more
+dnl contributor license agreements. See the NOTICE file distributed with
+dnl this work for additional information regarding copyright ownership.
+dnl The ASF licenses this file to You under the Apache License, Version 2.0
+dnl (the "License"); you may not use this file except in compliance with
+dnl the License. You may obtain a copy of the License at
+dnl
+dnl http://www.apache.org/licenses/LICENSE-2.0
+dnl
+dnl Unless required by applicable law or agreed to in writing, software
+dnl distributed under the License is distributed on an "AS IS" BASIS,
+dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+dnl See the License for the specific language governing permissions and
+dnl limitations under the License.
+
+dnl
+dnl find_apr.m4 : locate the APR include files and libraries
+dnl
+dnl This macro file can be used by applications to find and use the APR
+dnl library. It provides a standardized mechanism for using APR. It supports
+dnl embedding APR into the application source, or locating an installed
+dnl copy of APR.
+dnl
+dnl APR_FIND_APR(srcdir, builddir, implicit-install-check, acceptable-majors,
+dnl detailed-check)
+dnl
+dnl where srcdir is the location of the bundled APR source directory, or
+dnl empty if source is not bundled.
+dnl
+dnl where builddir is the location where the bundled APR will will be built,
+dnl or empty if the build will occur in the srcdir.
+dnl
+dnl where implicit-install-check set to 1 indicates if there is no
+dnl --with-apr option specified, we will look for installed copies.
+dnl
+dnl where acceptable-majors is a space separated list of acceptable major
+dnl version numbers. Often only a single major version will be acceptable.
+dnl If multiple versions are specified, and --with-apr=PREFIX or the
+dnl implicit installed search are used, then the first (leftmost) version
+dnl in the list that is found will be used. Currently defaults to [0 1].
+dnl
+dnl where detailed-check is an M4 macro which sets the apr_acceptable to
+dnl either "yes" or "no". The macro will be invoked for each installed
+dnl copy of APR found, with the apr_config variable set appropriately.
+dnl Only installed copies of APR which are considered acceptable by
+dnl this macro will be considered found. If no installed copies are
+dnl considered acceptable by this macro, apr_found will be set to either
+dnl either "no" or "reconfig".
+dnl
+dnl Sets the following variables on exit:
+dnl
+dnl apr_found : "yes", "no", "reconfig"
+dnl
+dnl apr_config : If the apr-config tool exists, this refers to it. If
+dnl apr_found is "reconfig", then the bundled directory
+dnl should be reconfigured *before* using apr_config.
+dnl
+dnl Note: this macro file assumes that apr-config has been installed; it
+dnl is normally considered a required part of an APR installation.
+dnl
+dnl If a bundled source directory is available and needs to be (re)configured,
+dnl then apr_found is set to "reconfig". The caller should reconfigure the
+dnl (passed-in) source directory, placing the result in the build directory,
+dnl as appropriate.
+dnl
+dnl If apr_found is "yes" or "reconfig", then the caller should use the
+dnl value of apr_config to fetch any necessary build/link information.
+dnl
+
+AC_DEFUN([APR_FIND_APR], [
+ apr_found="no"
+
+ if test "$target_os" = "os2-emx"; then
+ # Scripts don't pass test -x on OS/2
+ TEST_X="test -f"
+ else
+ TEST_X="test -x"
+ fi
+
+ ifelse([$4], [], [
+ ifdef(AC_WARNING,AC_WARNING([$0: missing argument 4 (acceptable-majors): Defaulting to APR 0.x then APR 1.x]))
+ acceptable_majors="0 1"],
+ [acceptable_majors="$4"])
+
+ apr_temp_acceptable_apr_config=""
+ for apr_temp_major in $acceptable_majors
+ do
+ case $apr_temp_major in
+ 0)
+ apr_temp_acceptable_apr_config="$apr_temp_acceptable_apr_config apr-config"
+ ;;
+ *)
+ apr_temp_acceptable_apr_config="$apr_temp_acceptable_apr_config apr-$apr_temp_major-config"
+ ;;
+ esac
+ done
+
+ AC_MSG_CHECKING(for APR)
+ AC_ARG_WITH(apr,
+ [ --with-apr=PATH prefix for installed APR or the full path to
+ apr-config],
+ [
+ if test "$withval" = "no" || test "$withval" = "yes"; then
+ AC_MSG_ERROR([--with-apr requires a directory or file to be provided])
+ fi
+
+ for apr_temp_apr_config_file in $apr_temp_acceptable_apr_config
+ do
+ for lookdir in "$withval/bin" "$withval"
+ do
+ if $TEST_X "$lookdir/$apr_temp_apr_config_file"; then
+ apr_config="$lookdir/$apr_temp_apr_config_file"
+ ifelse([$5], [], [], [
+ apr_acceptable="yes"
+ $5
+ if test "$apr_acceptable" != "yes"; then
+ AC_MSG_WARN([Found APR in $apr_config, but we think it is considered unacceptable])
+ continue
+ fi])
+ apr_found="yes"
+ break 2
+ fi
+ done
+ done
+
+ if test "$apr_found" != "yes" && $TEST_X "$withval" && $withval --help > /dev/null 2>&1 ; then
+ apr_config="$withval"
+ ifelse([$5], [], [apr_found="yes"], [
+ apr_acceptable="yes"
+ $5
+ if test "$apr_acceptable" = "yes"; then
+ apr_found="yes"
+ fi])
+ fi
+
+ dnl if --with-apr is used, it is a fatal error for its argument
+ dnl to be invalid
+ if test "$apr_found" != "yes"; then
+ AC_MSG_ERROR([the --with-apr parameter is incorrect. It must specify an install prefix, a build directory, or an apr-config file.])
+ fi
+ ],[
+ dnl If we allow installed copies, check those before using bundled copy.
+ if test -n "$3" && test "$3" = "1"; then
+ for apr_temp_apr_config_file in $apr_temp_acceptable_apr_config
+ do
+ if $apr_temp_apr_config_file --help > /dev/null 2>&1 ; then
+ apr_config="$apr_temp_apr_config_file"
+ ifelse([$5], [], [], [
+ apr_acceptable="yes"
+ $5
+ if test "$apr_acceptable" != "yes"; then
+ AC_MSG_WARN([skipped APR at $apr_config, version not acceptable])
+ continue
+ fi])
+ apr_found="yes"
+ break
+ else
+ dnl look in some standard places
+ for lookdir in /usr /usr/local /usr/local/apr /opt/apr; do
+ if $TEST_X "$lookdir/bin/$apr_temp_apr_config_file"; then
+ apr_config="$lookdir/bin/$apr_temp_apr_config_file"
+ ifelse([$5], [], [], [
+ apr_acceptable="yes"
+ $5
+ if test "$apr_acceptable" != "yes"; then
+ AC_MSG_WARN([skipped APR at $apr_config, version not acceptable])
+ continue
+ fi])
+ apr_found="yes"
+ break 2
+ fi
+ done
+ fi
+ done
+ fi
+ dnl if we have not found anything yet and have bundled source, use that
+ if test "$apr_found" = "no" && test -d "$1"; then
+ apr_temp_abs_srcdir="`cd \"$1\" && pwd`"
+ apr_found="reconfig"
+ apr_bundled_major="`sed -n '/#define.*APR_MAJOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p' \"$1/include/apr_version.h\"`"
+ case $apr_bundled_major in
+ "")
+ AC_MSG_ERROR([failed to find major version of bundled APR])
+ ;;
+ 0)
+ apr_temp_apr_config_file="apr-config"
+ ;;
+ *)
+ apr_temp_apr_config_file="apr-$apr_bundled_major-config"
+ ;;
+ esac
+ if test -n "$2"; then
+ apr_config="$2/$apr_temp_apr_config_file"
+ else
+ apr_config="$1/$apr_temp_apr_config_file"
+ fi
+ fi
+ ])
+
+ AC_MSG_RESULT($apr_found)
+])
diff --git a/build/find_apu.m4 b/build/find_apu.m4
new file mode 100644
index 0000000..7937e00
--- /dev/null
+++ b/build/find_apu.m4
@@ -0,0 +1,211 @@
+dnl -------------------------------------------------------- -*- autoconf -*-
+dnl Licensed to the Apache Software Foundation (ASF) under one or more
+dnl contributor license agreements. See the NOTICE file distributed with
+dnl this work for additional information regarding copyright ownership.
+dnl The ASF licenses this file to You under the Apache License, Version 2.0
+dnl (the "License"); you may not use this file except in compliance with
+dnl the License. You may obtain a copy of the License at
+dnl
+dnl http://www.apache.org/licenses/LICENSE-2.0
+dnl
+dnl Unless required by applicable law or agreed to in writing, software
+dnl distributed under the License is distributed on an "AS IS" BASIS,
+dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+dnl See the License for the specific language governing permissions and
+dnl limitations under the License.
+
+dnl
+dnl find_apu.m4 : locate the APR-util (APU) include files and libraries
+dnl
+dnl This macro file can be used by applications to find and use the APU
+dnl library. It provides a standardized mechanism for using APU. It supports
+dnl embedding APU into the application source, or locating an installed
+dnl copy of APU.
+dnl
+dnl APR_FIND_APU(srcdir, builddir, implicit-install-check, acceptable-majors,
+dnl detailed-check)
+dnl
+dnl where srcdir is the location of the bundled APU source directory, or
+dnl empty if source is not bundled.
+dnl
+dnl where builddir is the location where the bundled APU will be built,
+dnl or empty if the build will occur in the srcdir.
+dnl
+dnl where implicit-install-check set to 1 indicates if there is no
+dnl --with-apr-util option specified, we will look for installed copies.
+dnl
+dnl where acceptable-majors is a space separated list of acceptable major
+dnl version numbers. Often only a single major version will be acceptable.
+dnl If multiple versions are specified, and --with-apr-util=PREFIX or the
+dnl implicit installed search are used, then the first (leftmost) version
+dnl in the list that is found will be used. Currently defaults to [0 1].
+dnl
+dnl where detailed-check is an M4 macro which sets the apu_acceptable to
+dnl either "yes" or "no". The macro will be invoked for each installed
+dnl copy of APU found, with the apu_config variable set appropriately.
+dnl Only installed copies of APU which are considered acceptable by
+dnl this macro will be considered found. If no installed copies are
+dnl considered acceptable by this macro, apu_found will be set to either
+dnl either "no" or "reconfig".
+dnl
+dnl Sets the following variables on exit:
+dnl
+dnl apu_found : "yes", "no", "reconfig"
+dnl
+dnl apu_config : If the apu-config tool exists, this refers to it. If
+dnl apu_found is "reconfig", then the bundled directory
+dnl should be reconfigured *before* using apu_config.
+dnl
+dnl Note: this macro file assumes that apr-config has been installed; it
+dnl is normally considered a required part of an APR installation.
+dnl
+dnl Note: At this time, we cannot find *both* a source dir and a build dir.
+dnl If both are available, the build directory should be passed to
+dnl the --with-apr-util switch.
+dnl
+dnl Note: the installation layout is presumed to follow the standard
+dnl PREFIX/lib and PREFIX/include pattern. If the APU config file
+dnl is available (and can be found), then non-standard layouts are
+dnl possible, since it will be described in the config file.
+dnl
+dnl If a bundled source directory is available and needs to be (re)configured,
+dnl then apu_found is set to "reconfig". The caller should reconfigure the
+dnl (passed-in) source directory, placing the result in the build directory,
+dnl as appropriate.
+dnl
+dnl If apu_found is "yes" or "reconfig", then the caller should use the
+dnl value of apu_config to fetch any necessary build/link information.
+dnl
+
+AC_DEFUN([APR_FIND_APU], [
+ apu_found="no"
+
+ if test "$target_os" = "os2-emx"; then
+ # Scripts don't pass test -x on OS/2
+ TEST_X="test -f"
+ else
+ TEST_X="test -x"
+ fi
+
+ ifelse([$4], [],
+ [
+ ifdef(AC_WARNING,([$0: missing argument 4 (acceptable-majors): Defaulting to APU 0.x then APU 1.x]))
+ acceptable_majors="0 1"
+ ], [acceptable_majors="$4"])
+
+ apu_temp_acceptable_apu_config=""
+ for apu_temp_major in $acceptable_majors
+ do
+ case $apu_temp_major in
+ 0)
+ apu_temp_acceptable_apu_config="$apu_temp_acceptable_apu_config apu-config"
+ ;;
+ *)
+ apu_temp_acceptable_apu_config="$apu_temp_acceptable_apu_config apu-$apu_temp_major-config"
+ ;;
+ esac
+ done
+
+ AC_MSG_CHECKING(for APR-util)
+ AC_ARG_WITH(apr-util,
+ [ --with-apr-util=PATH prefix for installed APU or the full path to
+ apu-config],
+ [
+ if test "$withval" = "no" || test "$withval" = "yes"; then
+ AC_MSG_ERROR([--with-apr-util requires a directory or file to be provided])
+ fi
+
+ for apu_temp_apu_config_file in $apu_temp_acceptable_apu_config
+ do
+ for lookdir in "$withval/bin" "$withval"
+ do
+ if $TEST_X "$lookdir/$apu_temp_apu_config_file"; then
+ apu_config="$lookdir/$apu_temp_apu_config_file"
+ ifelse([$5], [], [], [
+ apu_acceptable="yes"
+ $5
+ if test "$apu_acceptable" != "yes"; then
+ AC_MSG_WARN([Found APU in $apu_config, but it is considered unacceptable])
+ continue
+ fi])
+ apu_found="yes"
+ break 2
+ fi
+ done
+ done
+
+ if test "$apu_found" != "yes" && $TEST_X "$withval" && $withval --help > /dev/null 2>&1 ; then
+ apu_config="$withval"
+ ifelse([$5], [], [apu_found="yes"], [
+ apu_acceptable="yes"
+ $5
+ if test "$apu_acceptable" = "yes"; then
+ apu_found="yes"
+ fi])
+ fi
+
+ dnl if --with-apr-util is used, it is a fatal error for its argument
+ dnl to be invalid
+ if test "$apu_found" != "yes"; then
+ AC_MSG_ERROR([the --with-apr-util parameter is incorrect. It must specify an install prefix, a build directory, or an apu-config file.])
+ fi
+ ],[
+ if test -n "$3" && test "$3" = "1"; then
+ for apu_temp_apu_config_file in $apu_temp_acceptable_apu_config
+ do
+ if $apu_temp_apu_config_file --help > /dev/null 2>&1 ; then
+ apu_config="$apu_temp_apu_config_file"
+ ifelse([$5], [], [], [
+ apu_acceptable="yes"
+ $5
+ if test "$apu_acceptable" != "yes"; then
+ AC_MSG_WARN([skipped APR-util at $apu_config, version not acceptable])
+ continue
+ fi])
+ apu_found="yes"
+ break
+ else
+ dnl look in some standard places (apparently not in builtin/default)
+ for lookdir in /usr /usr/local /usr/local/apr /opt/apr; do
+ if $TEST_X "$lookdir/bin/$apu_temp_apu_config_file"; then
+ apu_config="$lookdir/bin/$apu_temp_apu_config_file"
+ ifelse([$5], [], [], [
+ apu_acceptable="yes"
+ $5
+ if test "$apu_acceptable" != "yes"; then
+ AC_MSG_WARN([skipped APR-util at $apu_config, version not acceptable])
+ continue
+ fi])
+ apu_found="yes"
+ break 2
+ fi
+ done
+ fi
+ done
+ fi
+ dnl if we have not found anything yet and have bundled source, use that
+ if test "$apu_found" = "no" && test -d "$1"; then
+ apu_temp_abs_srcdir="`cd \"$1\" && pwd`"
+ apu_found="reconfig"
+ apu_bundled_major="`sed -n '/#define.*APU_MAJOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p' \"$1/include/apu_version.h\"`"
+ case $apu_bundled_major in
+ "")
+ AC_MSG_ERROR([failed to find major version of bundled APU])
+ ;;
+ 0)
+ apu_temp_apu_config_file="apu-config"
+ ;;
+ *)
+ apu_temp_apu_config_file="apu-$apu_bundled_major-config"
+ ;;
+ esac
+ if test -n "$2"; then
+ apu_config="$2/$apu_temp_apu_config_file"
+ else
+ apu_config="$1/$apu_temp_apu_config_file"
+ fi
+ fi
+ ])
+
+ AC_MSG_RESULT($apu_found)
+])
diff --git a/build/get-version.sh b/build/get-version.sh
new file mode 100755
index 0000000..fd685b2
--- /dev/null
+++ b/build/get-version.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+#
+# extract version numbers from a header file
+#
+# USAGE: get-version.sh CMD VERSION_HEADER PREFIX
+# where CMD is one of: all, major, libtool
+# where PREFIX is the prefix to {MAJOR|MINOR|PATCH}_VERSION defines
+#
+# get-version.sh all returns a dotted version number
+# get-version.sh major returns just the major version number
+# get-version.sh libtool returns a version "libtool -version-info" format
+#
+
+if test $# != 3; then
+ echo "USAGE: $0 CMD VERSION_HEADER PREFIX"
+ echo " where CMD is one of: all, major, libtool"
+ exit 1
+fi
+
+major_sed="/#define.*$3_MAJOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p"
+minor_sed="/#define.*$3_MINOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p"
+patch_sed="/#define.*$3_PATCH_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p"
+major="`sed -n $major_sed $2`"
+minor="`sed -n $minor_sed $2`"
+patch="`sed -n $patch_sed $2`"
+
+if test "$1" = "all"; then
+ echo ${major}.${minor}.${patch}
+elif test "$1" = "major"; then
+ echo ${major}
+elif test "$1" = "libtool"; then
+ # Yes, ${minor}:${patch}:${minor} is correct due to libtool idiocy.
+ echo ${minor}:${patch}:${minor}
+else
+ echo "ERROR: unknown version CMD ($1)"
+ exit 1
+fi
diff --git a/build/install.sh b/build/install.sh
new file mode 100755
index 0000000..9a8821f
--- /dev/null
+++ b/build/install.sh
@@ -0,0 +1,112 @@
+#!/bin/sh
+##
+## install.sh -- install a program, script or datafile
+##
+## Based on `install-sh' from the X Consortium's X11R5 distribution
+## as of 89/12/18 which is freely available.
+## Cleaned up for Apache's Autoconf-style Interface (APACI)
+## by Ralf S. Engelschall <rse@apache.org>
+##
+#
+# This script falls under the Apache License.
+# See http://www.apache.org/docs/LICENSE
+
+
+#
+# put in absolute paths if you don't have them in your path;
+# or use env. vars.
+#
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+
+#
+# parse argument line
+#
+instcmd="$mvprog"
+chmodcmd=""
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+ext=""
+src=""
+dst=""
+while [ "x$1" != "x" ]; do
+ case $1 in
+ -c) instcmd="$cpprog"
+ shift; continue
+ ;;
+ -m) chmodcmd="$chmodprog $2"
+ shift; shift; continue
+ ;;
+ -o) chowncmd="$chownprog $2"
+ shift; shift; continue
+ ;;
+ -g) chgrpcmd="$chgrpprog $2"
+ shift; shift; continue
+ ;;
+ -s) stripcmd="$stripprog"
+ shift; continue
+ ;;
+ -S) stripcmd="$stripprog $2"
+ shift; shift; continue
+ ;;
+ -e) ext="$2"
+ shift; shift; continue
+ ;;
+ *) if [ "x$src" = "x" ]; then
+ src=$1
+ else
+ dst=$1
+ fi
+ shift; continue
+ ;;
+ esac
+done
+if [ "x$src" = "x" ]; then
+ echo "install.sh: no input file specified"
+ exit 1
+fi
+if [ "x$dst" = "x" ]; then
+ echo "install.sh: no destination specified"
+ exit 1
+fi
+
+#
+# If destination is a directory, append the input filename; if
+# your system does not like double slashes in filenames, you may
+# need to add some logic
+#
+if [ -d $dst ]; then
+ dst="$dst/`basename $src`"
+fi
+
+# Add a possible extension (such as ".exe") to src and dst
+src="$src$ext"
+dst="$dst$ext"
+
+# Make a temp file name in the proper directory.
+dstdir=`dirname $dst`
+dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+$instcmd $src $dsttmp
+
+# And set any options; do chmod last to preserve setuid bits
+if [ "x$chowncmd" != "x" ]; then $chowncmd $dsttmp; fi
+if [ "x$chgrpcmd" != "x" ]; then $chgrpcmd $dsttmp; fi
+if [ "x$stripcmd" != "x" ]; then $stripcmd $dsttmp; fi
+if [ "x$chmodcmd" != "x" ]; then $chmodcmd $dsttmp; fi
+
+# Now rename the file to the real destination.
+$rmcmd $dst
+$mvcmd $dsttmp $dst
+
+exit 0
+
diff --git a/build/mkdir.sh b/build/mkdir.sh
new file mode 100755
index 0000000..c59f03e
--- /dev/null
+++ b/build/mkdir.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+##
+## mkdir.sh -- make directory hierarchy
+##
+## Based on `mkinstalldirs' from Noah Friedman <friedman@prep.ai.mit.edu>
+## as of 1994-03-25, which was placed in the Public Domain.
+## Cleaned up for Apache's Autoconf-style Interface (APACI)
+## by Ralf S. Engelschall <rse@apache.org>
+##
+#
+# This script falls under the Apache License.
+# See http://www.apache.org/docs/LICENSE
+
+
+umask 022
+errstatus=0
+for file in ${1+"$@"} ; do
+ set fnord `echo ":$file" |\
+ sed -e 's/^:\//%/' -e 's/^://' -e 's/\// /g' -e 's/^%/\//'`
+ shift
+ pathcomp=
+ for d in ${1+"$@"}; do
+ pathcomp="$pathcomp$d"
+ case "$pathcomp" in
+ -* ) pathcomp=./$pathcomp ;;
+ ?: ) pathcomp="$pathcomp/"
+ continue ;;
+ esac
+ if test ! -d "$pathcomp"; then
+ echo "mkdir $pathcomp" 1>&2
+ thiserrstatus=0
+ mkdir "$pathcomp" || thiserrstatus=$?
+ # ignore errors due to races if a parallel mkdir.sh already
+ # created the dir
+ if test $thiserrstatus != 0 && test ! -d "$pathcomp" ; then
+ errstatus=$thiserrstatus
+ fi
+ fi
+ pathcomp="$pathcomp/"
+ done
+done
+exit $errstatus
+
diff --git a/build/nw_apu_export.inc b/build/nw_apu_export.inc
new file mode 100644
index 0000000..1bdfb1c
--- /dev/null
+++ b/build/nw_apu_export.inc
@@ -0,0 +1,44 @@
+
+/* Must include apu.h first so that we can undefine
+ the standard prototypes macros after it messes with
+ them. */
+#include "apu.h"
+
+#undef APU_DECLARE
+#undef APU_DECLARE_NONSTD
+#undef APU_DECLARE_DATA
+
+/* Preprocess all of the standard APR headers. */
+#include "apr_anylock.h"
+#include "apr_base64.h"
+#include "apr_buckets.h"
+#include "apr_crypto.h"
+#include "apr_date.h"
+#include "apr_dbd.h"
+#include "apr_dbm.h"
+#include "apr_dbm_private.h"
+#include "apr_hooks.h"
+#include "apr_ldap.h"
+#include "apr_ldap_init.h"
+#include "apr_ldap_option.h"
+#include "apr_ldap_rebind.h"
+#include "apr_ldap_url.h"
+#include "apr_md4.h"
+#include "apr_md5.h"
+#include "apr_memcache.h"
+#include "apr_optional.h"
+#include "apr_optional_hooks.h"
+#include "apr_queue.h"
+#include "apr_reslist.h"
+#include "apr_rmm.h"
+#include "apr_sdbm.h"
+#include "apr_sha1.h"
+#include "apr_siphash.h"
+#include "apr_strmatch.h"
+#include "apr_thread_pool.h"
+#include "apr_uri.h"
+#include "apr_uuid.h"
+#include "apr_xlate.h"
+#include "apr_xml.h"
+#include "apu_version.h"
+#include "apu_want.h"
diff --git a/build/pkg/README b/build/pkg/README
new file mode 100644
index 0000000..d7e61a7
--- /dev/null
+++ b/build/pkg/README
@@ -0,0 +1,20 @@
+The script in this directory will attempt to build a Solaris package
+out of a source tree for APR-util.
+
+To build a package, make sure you are in the root of the source tree,
+and run:
+
+build/pkg/buildpkg.sh
+
+A Solaris package called apr-util-<version>-<architecture>-local.gz will be
+created in the root of the source tree.
+
+By default, if you attempt to build packages for apr-util, it will
+search for the sources for apr in:
+
+../apr
+
+You may override the location of apr like so:
+
+build/pkg/buildpkg.sh --with-apr=some/other/path
+
diff --git a/build/pkg/buildpkg.sh b/build/pkg/buildpkg.sh
new file mode 100755
index 0000000..b0a35aa
--- /dev/null
+++ b/build/pkg/buildpkg.sh
@@ -0,0 +1,99 @@
+#!/bin/sh
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+# buildpkg.sh: This script builds a Solaris PKG from the source tree
+# provided.
+
+PREFIX=/usr/local
+TEMPDIR=/var/tmp/$USER/apr-util-root
+rm -rf $TEMPDIR
+
+apr_util_src_dir=.
+apr_src_dir=../apr
+expat_dir=/usr
+
+while test $# -gt 0
+do
+ # Normalize
+ case "$1" in
+ -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) optarg= ;;
+ esac
+
+ case "$1" in
+ --with-apr=*)
+ apr_src_dir=$optarg
+ ;;
+ esac
+
+ case "$1" in
+ --with-apr-util=*)
+ apr_util_src_dir=$optarg
+ ;;
+ esac
+
+ case "$1" in
+ --with-expat=*)
+ expat_dir=$optarg
+ ;;
+ esac
+
+ shift
+done
+
+if [ -f "$apr_util_src_dir/configure.in" ]; then
+ cd $apr_util_src_dir
+else
+ echo "The apr-util source could not be found within $apr_util_src_dir"
+ echo "Usage: buildpkg [--with-apr=dir] [--with-apr-util=dir] [--with-expat=dir]"
+ exit 1
+fi
+
+if [ ! -f "$apr_src_dir/configure.in" ]; then
+ echo "The apr source could not be found within $apr_src_dir"
+ echo "Usage: buildpkg [--with-apr=dir] [--with-apr-util=dir] [--with-expat=dir]"
+ exit 1
+fi
+
+if [ ! -d "$expat_dir" ]; then
+ echo "The expat directory could not be found within $expat_dir"
+ echo "Usage: buildpkg [--with-apr=dir] [--with-apr-util=dir] [--with-expat=dir]"
+ exit 1
+fi
+
+./configure --prefix=$PREFIX --with-apr=$apr_src_dir \
+ --with-ldap --with-expat=$expat_dir
+make
+make install DESTDIR=$TEMPDIR
+rm $TEMPDIR$PREFIX/lib/aprutil.exp
+. build/pkg/pkginfo
+cp build/pkg/pkginfo $TEMPDIR$PREFIX
+
+current=`pwd`
+cd $TEMPDIR$PREFIX
+echo "i pkginfo=./pkginfo" > prototype
+find . -print | grep -v ./prototype | grep -v ./pkginfo | pkgproto | awk '{print $1" "$2" "$3" "$4" root bin"}' >> prototype
+mkdir $TEMPDIR/pkg
+pkgmk -r $TEMPDIR$PREFIX -d $TEMPDIR/pkg
+
+cd $current
+pkgtrans -s $TEMPDIR/pkg $current/$NAME-$VERSION-$ARCH-local
+gzip $current/$NAME-$VERSION-$ARCH-local
+
+rm -rf $TEMPDIR
+
diff --git a/build/pkg/pkginfo.in b/build/pkg/pkginfo.in
new file mode 100644
index 0000000..1b6359a
--- /dev/null
+++ b/build/pkg/pkginfo.in
@@ -0,0 +1,11 @@
+PKG="ASFapu-1"
+NAME="apr-util"
+ARCH="@target_cpu@"
+VERSION="@APRUTIL_DOTTED_VERSION@"
+CATEGORY="application"
+VENDOR="Apache Software Foundation"
+EMAIL="dev@apr.apache.org"
+PSTAMP="dev@apr.apache.org"
+BASEDIR="@prefix@"
+CLASSES="none"
+
diff --git a/build/preaprutil.dsp b/build/preaprutil.dsp
new file mode 100644
index 0000000..9292149
--- /dev/null
+++ b/build/preaprutil.dsp
@@ -0,0 +1,131 @@
+# Microsoft Developer Studio Project File - Name="preaprutil" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) External Target" 0x0106
+
+CFG=preaprutil - Win32 Release
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "preaprutil.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "preaprutil.mak" CFG="preaprutil - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "preaprutil - Win32 Release" (based on "Win32 (x86) External Target")
+!MESSAGE "preaprutil - Win32 Debug" (based on "Win32 (x86) External Target")
+!MESSAGE "preaprutil - x64 Release" (based on "Win32 (x86) External Target")
+!MESSAGE "preaprutil - x64 Debug" (based on "Win32 (x86) External Target")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+
+!IF "$(CFG)" == "preaprutil - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir ""
+# PROP BASE Intermediate_Dir ""
+# PROP BASE Cmd_Line "NMAKE /nologo /f NUL"
+# PROP BASE Rebuild_Opt "/a"
+# PROP BASE Target_File "preaprutil.exe"
+# PROP BASE Bsc_Name "preaprutil.bsc"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ""
+# PROP Intermediate_Dir ""
+# PROP Cmd_Line "NMAKE /nologo /f NUL"
+# PROP Rebuild_Opt "/a"
+# PROP Bsc_Name ""
+# PROP Target_Dir ""
+
+!ELSEIF "$(CFG)" == "preaprutil - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir ""
+# PROP BASE Intermediate_Dir ""
+# PROP BASE Cmd_Line "NMAKE /nologo /f NUL"
+# PROP BASE Rebuild_Opt "/a"
+# PROP BASE Target_File "preaprutil.exe"
+# PROP BASE Bsc_Name "preaprutil.bsc"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir ""
+# PROP Cmd_Line "NMAKE /nologo /f NUL"
+# PROP Rebuild_Opt "/a"
+# PROP Bsc_Name ""
+# PROP Target_Dir ""
+
+!ELSEIF "$(CFG)" == "preaprutil - x64 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir ""
+# PROP BASE Intermediate_Dir ""
+# PROP BASE Cmd_Line "NMAKE /nologo /f NUL"
+# PROP BASE Rebuild_Opt "/a"
+# PROP BASE Target_File "preaprutil.exe"
+# PROP BASE Bsc_Name "preaprutil.bsc"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ""
+# PROP Intermediate_Dir ""
+# PROP Cmd_Line "NMAKE /nologo /f NUL"
+# PROP Rebuild_Opt "/a"
+# PROP Bsc_Name ""
+# PROP Target_Dir ""
+
+!ELSEIF "$(CFG)" == "preaprutil - x64 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir ""
+# PROP BASE Intermediate_Dir ""
+# PROP BASE Cmd_Line "NMAKE /nologo /f NUL"
+# PROP BASE Rebuild_Opt "/a"
+# PROP BASE Target_File "preaprutil.exe"
+# PROP BASE Bsc_Name "preaprutil.bsc"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir ""
+# PROP Cmd_Line "NMAKE /nologo /f NUL"
+# PROP Rebuild_Opt "/a"
+# PROP Bsc_Name ""
+# PROP Target_Dir ""
+
+!ENDIF
+
+# Begin Target
+
+# Name "preaprutil - Win32 Release"
+# Name "preaprutil - Win32 Debug"
+# Name "preaprutil - x64 Release"
+# Name "preaprutil - x64 Debug"
+
+!IF "$(CFG)" == "preaprutil - Win32 Release"
+
+!ELSEIF "$(CFG)" == "preaprutil - Win32 Debug"
+
+!ELSEIF "$(CFG)" == "preaprutil - x64 Release"
+
+!ELSEIF "$(CFG)" == "preaprutil - x64 Debug"
+
+!ENDIF
+
+# End Target
+# End Project
diff --git a/build/rpm/apr-util.spec.in b/build/rpm/apr-util.spec.in
new file mode 100644
index 0000000..e926034
--- /dev/null
+++ b/build/rpm/apr-util.spec.in
@@ -0,0 +1,200 @@
+
+%define apuver 1
+
+Summary: Apache Portable Runtime Utility library
+Name: apr-util
+Version: APU_VERSION
+Release: APU_RELEASE
+License: Apache Software License
+Group: System Environment/Libraries
+URL: http://apr.apache.org/
+Source0: http://www.apache.org/dist/apr/%{name}-%{version}.tar.bz2
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
+BuildRequires: autoconf, libtool, doxygen, apr-devel >= 1.4.0
+BuildRequires: expat-devel, libuuid-devel
+
+%description
+The mission of the Apache Portable Runtime (APR) is to provide a
+free library of C data structures and routines. This library
+contains additional utility interfaces for APR; including support
+for XML, LDAP, database interfaces, URI parsing and more.
+
+%package devel
+Group: Development/Libraries
+Summary: APR utility library development kit
+Requires: apr-util = %{version}-%{release}, apr-devel
+Requires: db4-devel, expat-devel
+
+%description devel
+This package provides the support files which can be used to
+build applications using the APR utility library. The mission
+of the Apache Portable Runtime (APR) is to provide a free
+library of C data structures and routines.
+
+%package dbm
+Group: Development/Libraries
+Summary: APR utility library DBM driver
+BuildRequires: db4-devel
+Requires: apr-util = %{version}-%{release}
+
+%description dbm
+This package provides the DBM driver for the apr-util.
+
+%package pgsql
+Group: Development/Libraries
+Summary: APR utility library PostgreSQL DBD driver
+BuildRequires: postgresql-devel
+Requires: apr-util = %{version}-%{release}
+
+%description pgsql
+This package provides the PostgreSQL driver for the apr-util
+DBD (database abstraction) interface.
+
+%package mysql
+Group: Development/Libraries
+Summary: APR utility library MySQL DBD driver
+BuildRequires: mysql-devel
+Requires: apr-util = %{version}-%{release}
+
+%description mysql
+This package provides the MySQL driver for the apr-util DBD
+(database abstraction) interface.
+
+%package sqlite
+Group: Development/Libraries
+Summary: APR utility library SQLite DBD driver
+BuildRequires: sqlite-devel >= 3.0.0
+Requires: apr-util = %{version}-%{release}
+
+%description sqlite
+This package provides the SQLite driver for the apr-util DBD
+(database abstraction) interface.
+
+%package odbc
+Group: Development/Libraries
+Summary: APR utility library ODBC DBD driver
+BuildRequires: unixODBC-devel
+Requires: apr-util = %{version}-%{release}
+
+%description odbc
+This package provides the ODBC driver for the apr-util DBD
+(database abstraction) interface.
+
+%package ldap
+Group: Development/Libraries
+Summary: APR utility library LDAP support
+BuildRequires: openldap-devel
+Requires: apr-util = %{version}-%{release}
+
+%description ldap
+This package provides the LDAP support for the apr-util.
+
+%package openssl
+Group: Development/Libraries
+Summary: APR utility library OpenSSL crypto support
+BuildRequires: openssl-devel
+Requires: apr-util = %{version}-%{release}
+
+%description openssl
+This package provides crypto support for apr-util based on OpenSSL.
+
+%package nss
+Group: Development/Libraries
+Summary: APR utility library NSS crypto support
+BuildRequires: nss-devel
+Requires: apr-util = %{version}-%{release}
+
+%description nss
+This package provides crypto support for apr-util based on Mozilla NSS.
+
+%prep
+%setup -q
+
+%build
+%configure --with-apr=%{_prefix} \
+ --includedir=%{_includedir}/apr-%{apuver} \
+ --with-ldap --without-gdbm \
+ --with-sqlite3 --with-pgsql --with-mysql --with-odbc \
+ --with-berkeley-db \
+ --with-crypto --with-openssl --with-nss \
+ --without-sqlite2
+make %{?_smp_mflags} && make dox
+
+%check
+# Run non-interactive tests
+pushd test
+make %{?_smp_mflags} all CFLAGS=-fno-strict-aliasing
+make check || exit 1
+popd
+
+%install
+rm -rf $RPM_BUILD_ROOT
+make install DESTDIR=$RPM_BUILD_ROOT
+
+# Documentation
+mv docs/dox/html html
+
+# Unpackaged files
+rm -f $RPM_BUILD_ROOT%{_libdir}/aprutil.exp
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%files
+%defattr(-,root,root,-)
+%doc CHANGES LICENSE NOTICE
+%{_libdir}/libaprutil-%{apuver}.so.*
+%dir %{_libdir}/apr-util-%{apuver}
+
+%files dbm
+%defattr(-,root,root,-)
+%{_libdir}/apr-util-%{apuver}/apr_dbm_db*
+
+%files pgsql
+%defattr(-,root,root,-)
+%{_libdir}/apr-util-%{apuver}/apr_dbd_pgsql*
+
+%files mysql
+%defattr(-,root,root,-)
+%{_libdir}/apr-util-%{apuver}/apr_dbd_mysql*
+
+%files sqlite
+%defattr(-,root,root,-)
+%{_libdir}/apr-util-%{apuver}/apr_dbd_sqlite*
+
+%files odbc
+%defattr(-,root,root,-)
+%{_libdir}/apr-util-%{apuver}/apr_dbd_odbc*
+
+%files ldap
+%defattr(-,root,root,-)
+%{_libdir}/apr-util-%{apuver}/apr_ldap*
+
+%files openssl
+%defattr(-,root,root,-)
+%{_libdir}/apr-util-%{apuver}/apr_crypto_openssl*
+
+%files nss
+%defattr(-,root,root,-)
+%{_libdir}/apr-util-%{apuver}/apr_crypto_nss*
+
+%files devel
+%defattr(-,root,root,-)
+%{_bindir}/apu-%{apuver}-config
+%{_libdir}/libaprutil-%{apuver}.*a
+%{_libdir}/libaprutil-%{apuver}.so
+%{_libdir}/pkgconfig/apr-util-%{apuver}.pc
+%{_includedir}/apr-%{apuver}/*.h
+%doc html
+
+%changelog
+* Tue Jun 22 2004 Graham Leggett <minfrin@sharp.fm> 1.0.0-1
+- update to support v1.0.0 of APR
+
+* Tue Jun 22 2004 Graham Leggett <minfrin@sharp.fm> 1.0.0-1
+- derived from Fedora Core apr.spec
+
diff --git a/build/w32locatedb.pl b/build/w32locatedb.pl
new file mode 100644
index 0000000..121dbf8
--- /dev/null
+++ b/build/w32locatedb.pl
@@ -0,0 +1,217 @@
+#! perl -w
+#
+# w32locatedb.pl -- Build apr-util with Berkeley DB on Win32
+#
+# Usage: perl w32locatedb.pl <type> <incdir> <libdir>
+# type: Library type to link with ('lib' or 'dll')
+# incdir: BDB includes directory (for db.h)
+# libdir: Library directory (for libdbXY[s][d].lib)
+#
+# This script falls under the Apache License.
+# See http://www.apache.org/docs/LICENSE
+
+require 5.008;
+use strict;
+use File::Spec::Functions qw(canonpath rel2abs
+ splitpath catpath splitdir catdir);
+
+########
+# Subroutine prototypes
+sub usage();
+sub find_srcdir();
+sub get_lib_name($$);
+sub edit_header($$);
+sub edit_project($$);
+
+########
+# Parse program arguments and set globals
+die usage() unless scalar @ARGV >= 3;
+
+my $type = lc($ARGV[0]);
+die "Invalid library type '$type'\n"
+ unless $type eq 'lib' or $type eq 'dll';
+
+my $incdir = $ARGV[1];
+die "No 'db.h' in $incdir\n" unless -f "$incdir/db.h";
+
+my $libdir = $ARGV[2];
+die "$libdir: $!" unless -d $libdir;
+
+my $libname = get_lib_name($type, $incdir);
+die "No '$libname.lib' in $libdir" unless -f "$libdir/$libname.lib";
+die "No '${libname}d.lib' in $libdir" unless -f "$libdir/${libname}d.lib";
+
+my $srcdir = find_srcdir();
+my $apu_hw = canonpath("$srcdir/include/apu.hw");
+my $apu_want_hw = canonpath("$srcdir/include/apu_want.hw");
+my $apu_select_dbm_hw = canonpath("$srcdir/include/private/apu_select_dbm.hw");
+my $aprutil_dsp = canonpath("$srcdir/aprutil.dsp");
+my $libaprutil_dsp = canonpath("$srcdir/libaprutil.dsp");
+die "Can't find $apu_hw" unless -f $apu_hw;
+die "Can't find $apu_want_hw" unless -f $apu_want_hw;
+die "Can't find $apu_select_dbm_hw" unless -f $apu_select_dbm_hw;
+die "Can't find $aprutil_dsp" unless -f $aprutil_dsp;
+die "Can't find $libaprutil_dsp" unless -f $libaprutil_dsp;
+
+
+########
+# Edit the header file templates
+my $db_h = rel2abs(canonpath("$incdir/db.h"));
+$db_h =~ s/\\/\//g;
+edit_header($apu_hw,
+ [['^\s*\#\s*define\s+APU_HAVE_DB\s+0\s*$',
+ '#define APU_HAVE_DB 1']]);
+edit_header($apu_want_hw,
+ [['^\s*\#\s*include\s+\<db\.h\>\s*$',
+ "#include \"$db_h\""]]);
+edit_header($apu_select_dbm_hw,
+ [['^\s*\#\s*define\s+APU_USE_DB\s+0\s*$',
+ '#define APU_USE_DB 1'],
+ ['^\s*\#\s*include\s+\<db\.h\>\s*$',
+ "#include \"$db_h\""]]);
+
+########
+# Edit the .dsp files
+my $libpath = rel2abs(canonpath("$libdir/$libname"));
+edit_project($aprutil_dsp, $libpath);
+edit_project($libaprutil_dsp, $libpath);
+
+
+########
+# Print usage
+sub usage()
+{
+ return ("Usage: perl w32locatedb.pl <type> <incdir> <libdir>\n"
+ . " type: Library type to link with ('lib' or 'dll')\n"
+ . " incdir: BDB includes directory (for db.h)\n"
+ . " libdir: Library directory (for libdbXY[s][d].lib)\n");
+}
+
+########
+# Calculate the (possibly relative) path to the top of the apr-util
+# source dir.
+sub find_srcdir()
+{
+ my $srcdir = rel2abs(canonpath($0));
+ my ($vol, $dir, $file) = splitpath($srcdir);
+ my @dirs = splitdir($dir);
+ die if scalar @dirs < 1;
+ do { $_ = pop @dirs } while ($_ eq '');
+ return catpath($vol, catdir(@dirs), '');
+}
+
+########
+# Construct the name of the BDB library, based on the type and
+# version information in db.h
+sub get_lib_name($$)
+{
+ my ($type, $incdir) = @_;
+ my $major = undef;
+ my $minor = undef;
+ my $patch = undef;
+
+ open(DBH, "< $incdir/db.h")
+ or die "Can't open $incdir/db.h: $!";
+ while (<DBH>) {
+ chomp;
+ m/^\s*\#\s*define\s+DB_VERSION_(MAJOR|MINOR|PATCH)\s+(\d+)\s*$/;
+ next unless defined $1 and defined $2;
+ if ($1 eq 'MAJOR') { $major = $2; }
+ elsif ($1 eq 'MINOR') { $minor = $2; }
+ elsif ($1 eq 'PATCH') { $patch = $2; }
+ last if defined $major and defined $minor and defined $patch;
+ }
+ close(DBH);
+ die "Can't determine BDB version\n"
+ unless defined $major and defined $minor and defined $patch;
+
+ print "Using BDB version $major.$minor.$patch\n";
+
+ my $libname = "libdb$major$minor";
+ $libname .= 's' if $type eq 'lib';
+ return $libname;
+}
+
+########
+# Replace a file, keeping a backup copy
+sub maybe_rename_with_backup($$$)
+{
+ my ($tmpfile, $file, $maybe) = @_;
+ if ($maybe) {
+ # Make the file writable by the owner. On Windows, this removes
+ # any read-only bits.
+ chmod((stat($file))[2] | 0600, $file);
+ rename($file, "${file}~");
+ rename($tmpfile, $file);
+ } else {
+ print "No changes in $file\n";
+ unlink($tmpfile);
+ }
+}
+
+########
+# Edit a header template in-place.
+sub edit_header($$)
+{
+ my ($file, $pairs) = @_;
+ my $tmpfile = "$file.tmp";
+ my $substs = 0;
+
+ open(IN, "< $file") or die "Can't open $file: $!";
+ open(TMP, "> $tmpfile") or die "Can't open $tmpfile: $!";
+ while (<IN>) {
+ chomp;
+ foreach my $pair (@$pairs) {
+ $substs += s/${$pair}[0]/${$pair}[1]/;
+ }
+ print TMP $_, "\n";
+ }
+ close(IN);
+ close(TMP);
+
+ maybe_rename_with_backup($tmpfile, $file, $substs > 0);
+}
+
+########
+# Edit a project file in-place
+sub edit_project($$)
+{
+ my ($file, $libpath) = @_;
+ my $tmpfile = "$file.tmp";
+ my $substs = 0;
+ my ($prog, $debug) = (undef, undef);
+
+ my $libsearch = $libpath;
+ $libsearch =~ s/\\/\\\\/g;
+
+ open(IN, "< $file") or die "Can't open $file: $!";
+ open(TMP, "> $tmpfile") or die "Can't open $tmpfile: $!";
+ while (<IN>) {
+ chomp;
+
+ if (m/^\# TARGTYPE \"[^\"]+\" 0x([0-9A-Za-z]+)/
+ and defined $1) {
+ $prog = 'LINK32' if $1 eq '0102';
+ $prog = 'LIB32' if $1 eq '0104';
+ die "Unknown project type 0x$1" unless defined $prog;
+ } elsif (defined $prog
+ and m/^\# PROP Use_Debug_Libraries ([01])/
+ and defined $1) {
+ $debug = $1;
+ } elsif (defined $prog and defined $debug
+ and m/^\# ADD $prog (\"$libsearch)?/
+ and not defined $1) {
+ my $fullpath =
+ ($debug eq '1' ? "${libpath}d.lib" : "$libpath.lib");
+ $substs += s/^\# ADD $prog /\# ADD $prog \"$fullpath\" /;
+ } elsif (m/^\# ADD CPP/) {
+ $substs += s/APU_USE_SDBM/APU_USE_DB/g;
+ }
+
+ print TMP $_, "\n";
+ }
+ close(IN);
+ close(TMP);
+
+ maybe_rename_with_backup($tmpfile, $file, $substs > 0);
+}