diff options
Diffstat (limited to 'build')
-rw-r--r-- | build/apr_common.m4 | 979 | ||||
-rw-r--r-- | build/apu-conf.m4 | 454 | ||||
-rw-r--r-- | build/apu-hints.m4 | 62 | ||||
-rw-r--r-- | build/apu-iconv.m4 | 132 | ||||
-rwxr-xr-x | build/config.guess | 1502 | ||||
-rwxr-xr-x | build/config.sub | 1731 | ||||
-rw-r--r-- | build/crypto.m4 | 202 | ||||
-rw-r--r-- | build/dbd.m4 | 572 | ||||
-rw-r--r-- | build/dbm.m4 | 1031 | ||||
-rw-r--r-- | build/dso.m4 | 117 | ||||
-rw-r--r-- | build/find_apr.m4 | 202 | ||||
-rw-r--r-- | build/find_apu.m4 | 211 | ||||
-rwxr-xr-x | build/get-version.sh | 37 | ||||
-rwxr-xr-x | build/install.sh | 112 | ||||
-rwxr-xr-x | build/mkdir.sh | 37 | ||||
-rw-r--r-- | build/nw_apu_export.inc | 43 | ||||
-rw-r--r-- | build/pkg/README | 20 | ||||
-rwxr-xr-x | build/pkg/buildpkg.sh | 99 | ||||
-rw-r--r-- | build/pkg/pkginfo.in | 11 | ||||
-rw-r--r-- | build/preaprutil.dsp | 131 | ||||
-rw-r--r-- | build/rpm/apr-util.spec.in | 214 | ||||
-rw-r--r-- | build/w32locatedb.pl | 217 |
22 files changed, 8116 insertions, 0 deletions
diff --git a/build/apr_common.m4 b/build/apr_common.m4 new file mode 100644 index 0000000..4b3f658 --- /dev/null +++ b/build/apr_common.m4 @@ -0,0 +1,979 @@ +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], [ +if test "x$apr_ste_save_$1" = "x"; 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_CHECK_SIZEOF_EXTENDED(INCLUDES, TYPE [, CROSS_SIZE]) +dnl +dnl A variant of AC_CHECK_SIZEOF which allows the checking of +dnl sizes of non-builtin types +dnl +AC_DEFUN([APR_CHECK_SIZEOF_EXTENDED], +[changequote(<<, >>)dnl +dnl The name to #define. +define(<<AC_TYPE_NAME>>, translit(sizeof_$2, [a-z *], [A-Z_P]))dnl +dnl The cache variable name. +define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$2, [ *], [_p]))dnl +changequote([, ])dnl +AC_MSG_CHECKING(size of $2) +AC_CACHE_VAL(AC_CV_NAME, +[AC_TRY_RUN([#include <stdio.h> +$1 +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof($2)); + exit(0); +}], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$3],,, +AC_CV_NAME=$3))])dnl +AC_MSG_RESULT($AC_CV_NAME) +AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The size of ]$2) +undefine([AC_TYPE_NAME])dnl +undefine([AC_CV_NAME])dnl +]) + + +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( + [#include "confdefs.h" + ] + [[$1]] + [int main(int argc, const char *const *argv) {] + [[$2]] + [ return 0; }], + [$3], [$4]) + CFLAGS=$apr_save_CFLAGS +]) + +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_MSG_CHECKING(for type of return code from strerror_r) +AC_TRY_RUN([ +#include <errno.h> +#include <string.h> +#include <stdio.h> +main() +{ + 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]) + msg="int" +else + msg="pointer" +fi +AC_MSG_RESULT([$msg]) +] ) + +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_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 +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..8fc3da1 --- /dev/null +++ b/build/apu-conf.m4 @@ -0,0 +1,454 @@ +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 (or use bundled) +dnl +AC_DEFUN([APU_FIND_EXPAT], [ + +save_cppflags="$CPPFLAGS" +save_ldflags="$LDFLAGS" + +apu_has_expat=0 + +# Default: will use either external or bundled expat. +apu_try_external_expat=1 +apu_try_builtin_expat=1 + +AC_ARG_WITH([expat], +[ --with-expat=DIR specify Expat location, or 'builtin'], [ + 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)]) + elif test "$withval" = "builtin"; then + apu_try_external_expat=0 + 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 + # ...and refuse to fall back on the builtin expat. + apu_try_builtin_expat=0 + fi +]) + +if test $apu_try_external_expat = 1; then + APU_SYSTEM_EXPAT +fi + +if test "${apu_has_expat}${apu_try_builtin_expat}" = "01"; then + dnl This is a bit of a hack. This only works because we know that + dnl we are working with the bundled version of the software. + bundled_subdir="xml/expat" + APR_SUBDIR_CONFIG($bundled_subdir, [--prefix=$prefix --exec-prefix=$exec_prefix --libdir=$libdir --includedir=$includedir --bindir=$bindir]) + APR_ADDTO(APRUTIL_INCLUDES, [-I$abs_srcdir/$bundled_subdir/lib]) + APR_ADDTO(LDFLAGS, [-L$top_builddir/$bundled_subdir/lib]) + apu_expat_libs="$top_builddir/$bundled_subdir/libexpat.la" +fi + +APR_ADDTO(APRUTIL_EXPORT_LIBS, [$apu_expat_libs]) +APR_ADDTO(APRUTIL_LIBS, [$apu_expat_libs]) + +APR_XML_DIR=$bundled_subdir +AC_SUBST(APR_XML_DIR) + +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="-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="" + +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 + + test ${apu_has_ldap} != "1" && AC_MSG_ERROR(could not find an LDAP library) + AC_CHECK_LIB($apu_liblber_name, ber_init, + [LDADD_ldap="${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..115f944 --- /dev/null +++ b/build/config.guess @@ -0,0 +1,1502 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +# Free Software Foundation, Inc. + +timestamp='2010-04-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 2 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, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# 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. + + +# Originally written by Per Bothner. Please send patches (context +# diff format) to <config-patches@gnu.org> and include a ChangeLog +# entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -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 (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 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 + +trap 'exit 1' HUP INT TERM + +# 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. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" HUP INT PIPE TERM ; +: ${TMPDIR=/tmp} ; + { 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) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; 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 ; set_cc_for_build= ;' + +# 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) >/dev/null 2>&1 ; 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 + +# 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 tupples: *-*-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". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-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. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $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 + # 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/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + 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. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + s390x:SunOS:*:*) + echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux${UNAME_RELEASE} + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + eval $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 [ "$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 + echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + 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. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + 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'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + 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) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # 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:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $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; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $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 + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[456]) + 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 [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 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 [ -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 [ "${HP_ARCH}" = "" ]; then + eval $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 [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $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 + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $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; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + 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*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + 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:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + 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/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 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/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + *:Interix*:*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + authenticamd | genuineintel | EM64T) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + 8664:Windows_NT:*) + echo x86_64-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` 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="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; + arm*:Linux:*:*) + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-gnu + else + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; + i*86:Linux:*:*) + LIBC=gnu + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + mips:Linux:*:* | mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef ${UNAME_MACHINE} + #undef ${UNAME_MACHINE}el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=${UNAME_MACHINE}el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=${UNAME_MACHINE} + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-gnu + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + 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. + echo i386-sequent-sysv4 + exit ;; + 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. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + 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 + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` + echo ${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 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + 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 configury will decide that + # this is a cross-build. + echo i586-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + 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*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says <Richard.M.Bartel@ccMail.Census.GOV> + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes <hewes@openmarket.com>. + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + i386) + eval $set_cc_for_build + if [ "$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 + UNAME_PROCESSOR="x86_64" + fi + fi ;; + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *: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 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; + i*86:AROS:*:*) + echo ${UNAME_MACHINE}-pc-aros + exit ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c <<EOF +#ifdef _SEQUENT_ +# include <sys/types.h> +# include <sys/utsname.h> +#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 (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#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 + printf ("vax-dec-ultrix\n"); exit (0); +# 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; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + +cat >&2 <<EOF +$0: unable to guess system type + +This script, last modified $timestamp, has failed to recognize +the operating system you are using. It is advised that you +download the most up to date version of the config scripts from + + http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +and + http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + +If the version you run ($0) is already up to date, please +send the following data and any information you think might be +pertinent to <config-patches@gnu.org> in order to provide the needed +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 + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks '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..204218c --- /dev/null +++ b/build/config.sub @@ -0,0 +1,1731 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +# Free Software Foundation, Inc. + +timestamp='2010-05-21' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# 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 2 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, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# 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. + + +# Please send patches to <config-patches@gnu.org>. Submit a context +# diff and a properly formatted GNU ChangeLog entry. +# +# 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: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + +# 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. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -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 (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 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" + 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 + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ + linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | \ + kopensolaris*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -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) + os= + basic_machine=$1 + ;; + -bluegene*) + os=-cnk + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fido | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore | mep | metag \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nios | nios2 \ + | ns16k | ns32k \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | rx \ + | score \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu | strongarm \ + | tahoe | thumb | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ + | ubicom32 \ + | v850 | v850e \ + | we32k \ + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ + | z8k | z80) + basic_machine=$basic_machine-unknown + ;; + c54x) + basic_machine=tic54x-unknown + ;; + c55x) + basic_machine=tic55x-unknown + ;; + c6x) + basic_machine=tic6x-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12 | picochip) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-unknown + ;; + + # 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) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64octeon-* | mips64octeonel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64r5900-* | mips64r5900el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* | rx-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tile-* | tilegx-* \ + | tron-* \ + | ubicom32-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa*-* \ + | ymp-* \ + | z8k-* | z80-*) + ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aros) + basic_machine=i386-pc + os=-aros + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + bluegene*) + basic_machine=powerpc-ibm + os=-cnk + ;; + c54x-*) + basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c55x-*) + basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c6x-*) + basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16) + basic_machine=cr16-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + microblaze) + basic_machine=microblaze-xilinx + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh5el) + basic_machine=sh5le-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + # This must be matched before tile*. + tilegx*) + basic_machine=tilegx-unknown + os=-linux-gnu + ;; + tile*) + basic_machine=tile-unknown + os=-linux-gnu + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + z80-*-coff) + basic_machine=z80-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# 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) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +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 + ;; + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ + | -sym* | -kopensolaris* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* | -aros* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* | -cegcc* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -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 + ;; + -nsk*) + os=-nsk + ;; + # 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 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -dicos*) + os=-dicos + ;; + -nacl*) + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +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. + +case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + 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 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + 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 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-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 + ;; + *-next) + os=-nextstep3 + ;; + *-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 + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $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 + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + 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 + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks '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..e9a65c9 --- /dev/null +++ b/build/crypto.m4 @@ -0,0 +1,202 @@ +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 + + old_libs="$LIBS" + old_cppflags="$CPPFLAGS" + old_ldflags="$LDFLAGS" + + AC_ARG_WITH([crypto], [APR_HELP_STRING([--with-crypto], [enable crypto support])], + [ + if test "$withval" = "yes"; then + APU_CHECK_CRYPTO_OPENSSL + APU_CHECK_CRYPTO_NSS + dnl add checks for other varieties of ssl here + fi + ], [ + apu_have_crypto=0 + ]) + + AC_SUBST(apu_have_crypto) + +]) +dnl + +AC_DEFUN([APU_CHECK_CRYPTO_OPENSSL], [ + apu_have_openssl=0 + 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, BN_init, 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, BN_init, 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 + + if test "$apu_have_openssl" != "1"; then + AC_CHECK_HEADERS(openssl/x509.h, [openssl_have_headers=1]) + AC_CHECK_LIB(crypto, BN_init, 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 + 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 + 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], [ + apu_have_nss=0 + nss_have_headers=0 + 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 + AC_CHECK_HEADERS(prerror.h nss/nss.h nss.h nss/pk11pub.h pk11pub.h, [nss_have_headers=1]) + AC_CHECK_LIB(nspr4, PR_Initialize, AC_CHECK_LIB(nss3, PK11_CreatePBEV2AlgorithmID, [nss_have_libs=1],,-lnspr4)) + if test "$nss_have_headers" != "0" && 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) + AC_CHECK_HEADERS(prerror.h nss/nss.h nss.h nss/pk11pub.h pk11pub.h, [nss_have_headers=1]) + AC_CHECK_LIB(nspr4, PR_Initialize, AC_CHECK_LIB(nss3, PK11_CreatePBEV2AlgorithmID, [nss_have_libs=1],,-lnspr4)) + if test "$nss_have_headers" != "0" && 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 + 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" +]) +dnl diff --git a/build/dbd.m4 b/build/dbd.m4 new file mode 100644 index 0000000..d418d8b --- /dev/null +++ b/build/dbd.m4 @@ -0,0 +1,572 @@ +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 + 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" + + 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 + 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]) + fi + + AC_CHECK_HEADERS([mysql.h my_global.h my_sys.h], + AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]), + [apu_have_mysql=0; break], + [#include <my_global.h>]) + if test "$apu_have_mysql" = "0"; then + AC_CHECK_HEADERS([mysql/mysql.h mysql/my_global.h mysql/my_sys.h], + AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]), + [apu_have_mysql=0; break], + [#include <mysql/my_global.h>]) + fi + if test "$apu_have_mysql" != "0" && 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 + mysql_CPPFLAGS="`$MYSQL_CONFIG --include`" + mysql_LDFLAGS="`$MYSQL_CONFIG --libs_r | sed -e 's/-l[[^ ]]\+//g'`" + mysql_LIBS="`$MYSQL_CONFIG --libs_r`" + 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 my_global.h my_sys.h], + AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]), + [apu_have_mysql=0; break], + [#include <my_global.h>]) + + if test "$apu_have_mysql" != "1"; then + AC_CHECK_HEADERS([mysql/mysql.h mysql/my_global.h mysql/my_sys.h], + AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]), + [apu_have_mysql=0; break], + [#include <mysql/my_global.h>]) + fi + if test "$apu_have_mysql" != "0"; 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 + LDADD_dbd_mysql="$mysql_LDFLAGS -lmysqlclient_r $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 + 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 + 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 + 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_FREETDS], [ + apu_have_freetds=0 + + old_libs="$LIBS" + old_cppflags="$CPPFLAGS" + old_ldflags="$LDFLAGS" + + AC_ARG_WITH([freetds], + APR_HELP_STRING([--with-freetds=DIR], [specify FreeTDS location]), + [ + if test "$withval" = "yes"; then + AC_CHECK_HEADERS(sybdb.h, AC_CHECK_LIB(sybdb, tdsdbopen, [apu_have_freetds=1])) + if test "$apu_have_freetds" = "0"; then + AC_CHECK_HEADERS(freetds/sybdb.h, AC_CHECK_LIB(sybdb, tdsdbopen, [apu_have_freetds=1])) + fi + elif test "$withval" = "no"; then + : + else + sybdb_CPPFLAGS="-I$withval/include" + sybdb_LDFLAGS="-L$withval/lib " + + APR_ADDTO(CPPFLAGS, [$sybdb_CPPFLAGS]) + APR_ADDTO(LDFLAGS, [$sybdb_LDFLAGS]) + + AC_MSG_NOTICE(checking for freetds in $withval) + AC_CHECK_HEADERS(sybdb.h, AC_CHECK_LIB(sybdb, tdsdbopen, [apu_have_freetds=1])) + if test "$apu_have_freetds" = "0"; then + AC_CHECK_HEADERS(freetds/sybdb.h, AC_CHECK_LIB(sybdb, tdsdbopen, [apu_have_freetds=1])) + fi + if test "$apu_have_freetds" != "0"; then + APR_ADDTO(APRUTIL_PRIV_INCLUDES, [-I$withval/include]) + fi + fi + ], [ + AC_CHECK_HEADERS(sybdb.h, AC_CHECK_LIB(sybdb, tdsdbopen, [apu_have_freetds=1])) + if test "$apu_have_freetds" = "0"; then + AC_CHECK_HEADERS(freetds/sybdb.h, AC_CHECK_LIB(sybdb, tdsdbopen, [apu_have_freetds=1])) + fi + ]) + + AC_SUBST(apu_have_freetds) + + 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_freetds" = "1"; then + LDADD_dbd_freetds="$sybdb_LDFLAGS -lsybdb" + dnl Erm, I needed pcreposix, but I think that dependency has gone + dnl from the current code + dnl LDADD_dbd_freetds="$LDADD_dbd_freetds -lsybdb -lpcreposix" + fi + AC_SUBST(LDADD_dbd_freetds) + + 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 + 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_freetds = 1 && apu_dbd_tests="$apu_dbd_tests freetds" + 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..1b229f4 --- /dev/null +++ b/build/dbm.m4 @@ -0,0 +1,1031 @@ +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"; 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_DB4: is DB4 present? +dnl +dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version +dnl +AC_DEFUN([APU_CHECK_DB4], [ + places=$1 + if test -z "$places"; then + places="std /usr/local /usr/local/BerkeleyDB.4.0 /boot/home/config" + fi + APU_CHECK_BERKELEY_DB("4", "0", "-1", + "$places", + "db4/db.h db.h", + "db-4.0 db4 db" + ) + if test "$apu_have_db" = "1"; then + apu_db_version=4 + fi +]) + + +dnl +dnl APU_CHECK_DB41: is DB4.1 present? +dnl +dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version +dnl +AC_DEFUN([APU_CHECK_DB41], [ + places=$1 + if test -z "$places"; then + places="std /usr/local /usr/local/BerkeleyDB.4.1 /boot/home/config" + fi + APU_CHECK_BERKELEY_DB("4", "1", "-1", + "$places", + "db41/db.h db4/db.h db.h", + "db-4.1 db41 db4 db" + ) + if test "$apu_have_db" = "1"; then + apu_db_version=4 + fi +]) + + +dnl +dnl APU_CHECK_DB42: is DB4.2 present? +dnl +dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version +dnl +AC_DEFUN([APU_CHECK_DB42], [ + places=$1 + if test -z "$places"; then + places="std /usr/local /usr/local/BerkeleyDB.4.2 /boot/home/config" + fi + APU_CHECK_BERKELEY_DB("4", "2", "-1", + "$places", + "db42/db.h db4/db.h db.h", + "db-4.2 db42 db4 db" + ) + if test "$apu_have_db" = "1"; then + apu_db_version=4 + fi +]) +dnl +dnl APU_CHECK_DB43: is DB4.3 present? +dnl +dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version +dnl +AC_DEFUN([APU_CHECK_DB43], [ + places=$1 + if test -z "$places"; then + places="std /usr/local/BerkeleyDB.4.3 /boot/home/config" + fi + APU_CHECK_BERKELEY_DB("4", "3", "-1", + "$places", + "db43/db.h db4/db.h db.h", + "db-4.3 db4-4.3 db43 db4 db" + ) + if test "$apu_have_db" = "1"; then + apu_db_version=4 + fi +]) +dnl +dnl APU_CHECK_DB44: is DB4.4 present? +dnl +dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version +dnl +AC_DEFUN([APU_CHECK_DB44], [ + places=$1 + if test -z "$places"; then + places="std /usr/local/BerkeleyDB.4.4 /boot/home/config" + fi + APU_CHECK_BERKELEY_DB("4", "4", "-1", + "$places", + "db44/db.h db4/db.h db.h", + "db-4.4 db4-4.4 db44 db4 db" + ) + if test "$apu_have_db" = "1"; then + apu_db_version=4 + fi +]) +dnl +dnl APU_CHECK_DB45: is DB4.5 present? +dnl +dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version +dnl +AC_DEFUN([APU_CHECK_DB45], [ + places=$1 + if test -z "$places"; then + places="std /usr/local/BerkeleyDB.4.5 /boot/home/config" + fi + APU_CHECK_BERKELEY_DB("4", "5", "-1", + "$places", + "db45/db.h db4/db.h db.h", + "db-4.5 db4-4.5 db45 db4 db" + ) + if test "$apu_have_db" = "1"; then + apu_db_version=4 + fi +]) +dnl +dnl APU_CHECK_DB46: is DB4.6 present? +dnl +dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version +dnl +AC_DEFUN([APU_CHECK_DB46], [ + places=$1 + if test -z "$places"; then + places="std /usr/local/BerkeleyDB.4.6 /boot/home/config" + fi + APU_CHECK_BERKELEY_DB("4", "6", "-1", + "$places", + "db46/db.h db4/db.h db.h", + "db-4.6 db4-4.6 db46 db4 db" + ) + if test "$apu_have_db" = "1"; then + apu_db_version=4 + fi +]) +dnl +dnl APU_CHECK_DB47: is DB4.7 present? +dnl +dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version +dnl +AC_DEFUN([APU_CHECK_DB47], [ + places=$1 + if test -z "$places"; then + places="std /usr/local/BerkeleyDB.4.7 /boot/home/config" + fi + APU_CHECK_BERKELEY_DB("4", "7", "-1", + "$places", + "db47/db.h db4/db.h db.h", + "db-4.7 db4-4.7 db47 db4 db" + ) + if test "$apu_have_db" = "1"; then + apu_db_version=4 + fi +]) +dnl +dnl APU_CHECK_DB48: is DB4.8 present? +dnl +dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version +dnl +AC_DEFUN([APU_CHECK_DB48], [ + places=$1 + if test -z "$places"; then + places="std /usr/local/BerkeleyDB.4.8 /boot/home/config" + fi + APU_CHECK_BERKELEY_DB("4", "8", "-1", + "$places", + "db48/db.h db4/db.h db.h", + "db-4.8 db4-4.8 db48 db4 db" + ) + if test "$apu_have_db" = "1"; then + apu_db_version=4 + fi +]) +dnl +dnl APU_CHECK_DB50: is DB5.0 present? +dnl +dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version +dnl +AC_DEFUN([APU_CHECK_DB50], [ + places=$1 + if test -z "$places"; then + places="std /usr/local/BerkeleyDB.5.0 /boot/home/config" + fi + APU_CHECK_BERKELEY_DB("5", "0", "-1", + "$places", + "db50/db.h db5/db.h db.h", + "db-5.0 db5-5.0 db50 db5 db" + ) + if test "$apu_have_db" = "1"; then + apu_db_version=5 + fi +]) +dnl +dnl APU_CHECK_DB51: is DB5.1 present? +dnl +dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version +dnl +AC_DEFUN([APU_CHECK_DB51], [ + places=$1 + if test -z "$places"; then + places="std /usr/local/BerkeleyDB.5.1 /boot/home/config" + fi + APU_CHECK_BERKELEY_DB("5", "1", "-1", + "$places", + "db51/db.h db5/db.h db.h", + "db-5.1 db5-5.1 db51 db5 db" + ) + if test "$apu_have_db" = "1"; then + apu_db_version=5 + 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 + ;; + db4) + APU_CHECK_DB4("$check_places") + if test "$apu_db_version" != "4"; then + AC_MSG_ERROR(Berkeley db4 not found) + fi + ;; + db41) + APU_CHECK_DB41("$check_places") + if test "$apu_db_version" != "4"; then + AC_MSG_ERROR(Berkeley db4 not found) + fi + ;; + db42) + APU_CHECK_DB42("$check_places") + if test "$apu_db_version" != "4"; then + AC_MSG_ERROR(Berkeley db4 not found) + fi + ;; + db43) + APU_CHECK_DB43("$check_places") + if test "$apu_db_version" != "4"; then + AC_MSG_ERROR(Berkeley db4 not found) + fi + ;; + db44) + APU_CHECK_DB44("$check_places") + if test "$apu_db_version" != "4"; then + AC_MSG_ERROR(Berkeley db4 not found) + fi + ;; + db45) + APU_CHECK_DB45("$check_places") + if test "$apu_db_version" != "4"; then + AC_MSG_ERROR(Berkeley db4 not found) + fi + ;; + db46) + APU_CHECK_DB46("$check_places") + if test "$apu_db_version" != "4"; then + AC_MSG_ERROR(Berkeley db4 not found) + fi + ;; + db47) + APU_CHECK_DB47("$check_places") + if test "$apu_db_version" != "4"; then + AC_MSG_ERROR(Berkeley db4 not found) + fi + ;; + db48) + APU_CHECK_DB48("$check_places") + if test "$apu_db_version" != "4"; then + AC_MSG_ERROR(Berkeley db4 not found) + fi + ;; + db50) + APU_CHECK_DB50("$check_places") + if test "$apu_db_version" != "5"; then + AC_MSG_ERROR(Berkeley db5 not found) + fi + ;; + db51) + APU_CHECK_DB51("$check_places") + if test "$apu_db_version" != "5"; then + AC_MSG_ERROR(Berkeley db5 not found) + fi + ;; + default) + APU_CHECK_DB_ALL("$check_places") + ;; + esac +]) + +dnl +dnl APU_CHECK_DB_ALL: Try all Berkeley DB versions, from 5.1 to 1. +dnl +AC_DEFUN([APU_CHECK_DB_ALL], [ + all_places=$1 + + APU_CHECK_DB51("$all_places") + if test "$apu_db_version" != "5"; then + APU_CHECK_DB50("$all_places") + if test "$apu_db_version" != "5"; then + APU_CHECK_DB48("$all_places") + if test "$apu_db_version" != "4"; then + APU_CHECK_DB47("$all_places") + if test "$apu_db_version" != "4"; then + APU_CHECK_DB46("$all_places") + if test "$apu_db_version" != "4"; then + APU_CHECK_DB45("$all_places") + if test "$apu_db_version" != "4"; then + APU_CHECK_DB44("$all_places") + if test "$apu_db_version" != "4"; then + APU_CHECK_DB43("$all_places") + if test "$apu_db_version" != "4"; then + APU_CHECK_DB42("$all_places") + if test "$apu_db_version" != "4"; then + APU_CHECK_DB41("$all_places") + if test "$apu_db_version" != "4"; then + APU_CHECK_DB4("$all_places") + if test "$apu_db_version" != "4"; then + APU_CHECK_DB3("$all_places") + if test "$apu_db_version" != "3"; then + APU_CHECK_DB2("$all_places") + if test "$apu_db_version" != "2"; then + APU_CHECK_DB1("$all_places") + if test "$apu_db_version" != "1"; then + APU_CHECK_DB185("$all_places") + fi + fi + fi + fi + fi + fi + fi + fi + fi + fi + fi + fi + fi + 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 + + 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,db41,db42,db43,db44,db45,db46,db47,db48,db50,db51}])], + [ + if test "$withval" = "yes"; then + AC_MSG_ERROR([--with-dbm needs to specify a DBM type to use. + One of: sdbm, gdbm, ndbm, db, db1, db185, db2, db3, db4, db41, db42, db43, db44, db45, db46, db47, db48, db50, db51]) + 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) + apu_use_sdbm=1 + apu_default_dbm=sdbm + ;; + gdbm) + apu_use_gdbm=1 + apu_default_dbm=gdbm + ;; + ndbm) + apu_use_ndbm=1 + apu_default_dbm=ndbm + ;; + db) + apu_use_db=1 + apu_default_dbm=db + ;; + db1) + apu_use_db=1 + apu_default_dbm=db1 + ;; + db185) + apu_use_db=1 + apu_default_dbm=db185 + ;; + db2) + apu_use_db=1 + apu_default_dbm=db2 + ;; + db3) + apu_use_db=1 + apu_default_dbm=db3 + ;; + db4) + apu_use_db=1 + apu_default_dbm=db4 + ;; + db41) + apu_use_db=1 + apu_default_dbm=db4 + ;; + db42) + apu_use_db=1 + apu_default_dbm=db4 + ;; + db43) + apu_use_db=1 + apu_default_dbm=db4 + ;; + db44) + apu_use_db=1 + apu_default_dbm=db4 + ;; + db45) + apu_use_db=1 + apu_default_dbm=db4 + ;; + db46) + apu_use_db=1 + apu_default_dbm=db4 + ;; + db47) + apu_use_db=1 + apu_default_dbm=db4 + ;; + db48) + apu_use_db=1 + apu_default_dbm=db4 + ;; + db50) + apu_use_db=1 + apu_default_dbm=db5 + ;; + db51) + apu_use_db=1 + apu_default_dbm=db5 + ;; + default) + dnl ### use more sophisticated DBMs for the default? + apu_default_dbm="sdbm (default)" + apu_use_sdbm=1 + ;; + *) + AC_MSG_ERROR([--with-dbm=$look_for is an unknown DBM type. + Use one of: sdbm, gdbm, ndbm, db, db1, db185, db2, db3, db4, db41, db42, db43, db44, db45, db46, db47, db48, db50, db51]) + ;; + 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 + LDADD_dbm_db="-l$apu_db_lib" + if test -n "apu_db_xtra_libs"; then + LDADD_dbm_db="$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 + LDADD_dbm_gdbm="-lgdbm" + fi + + if test "$apu_have_ndbm" = "1"; then + 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..ec2f5c9 --- /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_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_freetds = 1 && objs="$objs dbd/apr_dbd_freetds.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" + APRUTIL_LIBS="$APRUTIL_LIBS $LDADD_dbd_pgsql $LDADD_dbd_sqlite2 $LDADD_dbd_sqlite3 $LDADD_dbd_oracle $LDADD_dbd_mysql $LDADD_dbd_freetds $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" + APRUTIL_EXPORT_LIBS="$APRUTIL_EXPORT_LIBS $LDADD_dbd_pgsql $LDADD_dbd_sqlite2 $LDADD_dbd_sqlite3 $LDADD_dbd_oracle $LDADD_dbd_mysql $LDADD_dbd_freetds $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_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_freetds = 1 && dsos="$dsos dbd/apr_dbd_freetds.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..b947c92 --- /dev/null +++ b/build/mkdir.sh @@ -0,0 +1,37 @@ +#!/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 + mkdir "$pathcomp" || errstatus=$? + 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..e883b1c --- /dev/null +++ b/build/nw_apu_export.inc @@ -0,0 +1,43 @@ + +/* 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_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..bc6be9a --- /dev/null +++ b/build/rpm/apr-util.spec.in @@ -0,0 +1,214 @@ + +%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 freetds +Group: Development/Libraries +Summary: APR utility library FreeTDS DBD driver +BuildRequires: freetds-devel +Requires: apr-util = %{version}-%{release} + +%description freetds +This package provides the FreeTDS 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-freetds --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 freetds +%defattr(-,root,root,-) +%{_libdir}/apr-util-%{apuver}/apr_dbd_freetds* + +%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 --parents 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); +} |