David Reid wrote: > The changes to the apr-find macro have NOT been picked up in apr-util > and apr-iconv, so hopefully these tarballs will encourage people to fix > that?
Here is the apr-util part of that. (apr-iconv part will follow later) In addition to applying the equivalent changes from apr to apr-util, this patch also brings across some forgotten comment updates and OS/2 compat code from apr. In particular, please could people look at the two "dnl Note: " paragraphs in find_apu.m4 which this patch does _not_ touch. Copied here: 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. The fact that you can pass a build directory to the --with-apr(-util) options seems to be one of those occasionally useful but not very tested features. Perhaps we don't want to advertise it (yet?). 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. Is plain wrong, I think. The macro *requires* that a config file be found. Max.
Index: .cvsignore =================================================================== RCS file: /home/mirror/cvsmirror/misc-cvs/apr-util/.cvsignore,v retrieving revision 1.24 diff -u -p -r1.24 .cvsignore --- .cvsignore 30 Jul 2004 19:37:22 -0000 1.24 +++ .cvsignore 1 Aug 2004 17:08:26 -0000 @@ -14,6 +14,7 @@ exports.c export_vars.[ch] export_vars.sh apu-config +apu-*-config apu-config.out Debug Release Index: CHANGES =================================================================== RCS file: /home/mirror/cvsmirror/misc-cvs/apr-util/CHANGES,v retrieving revision 1.134 diff -u -p -r1.134 CHANGES --- CHANGES 1 Aug 2004 16:55:14 -0000 1.134 +++ CHANGES 1 Aug 2004 17:08:50 -0000 @@ -1,5 +1,8 @@ Changes with APR-util 1.0 + *) Only install apu-$MAJOR-config and add appropriate detection code to + find_apu.m4 (APU_FIND_APU). [Max Bowsher <maxb ukf.net>] + *) Add an apr_ldap_err_t structure to handle the return of LDAP specific error codes. [Graham Leggett, Brad Nicholes] Index: Makefile.in =================================================================== RCS file: /home/mirror/cvsmirror/misc-cvs/apr-util/Makefile.in,v retrieving revision 1.95 diff -u -p -r1.95 Makefile.in --- Makefile.in 1 Jul 2004 14:37:45 -0000 1.95 +++ Makefile.in 1 Aug 2004 16:57:05 -0000 @@ -33,7 +33,7 @@ CLEAN_TARGETS = exports.c export_vars.c DISTCLEAN_TARGETS = config.cache config.log config.status libtool \ include/private/apu_config.h include/private/apu_private.h \ include/private/apu_select_dbm.h include/apr_ldap.h include/apu.h \ - export_vars.sh apu-config build/rules.mk include/apu_want.h \ + export_vars.sh $(APU_CONFIG) build/rules.mk include/apu_want.h \ apr-util.pc EXTRACLEAN_TARGETS = configure aclocal.m4 include/private/apu_config.h.in \ exports.c build-outputs.mk \ @@ -49,8 +49,8 @@ [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ # Create apu-config script suitable for the install tree -apu-config.out: apu-config - sed 's,^\(location=\).*$$,\1installed,' < apu-config > $@ +apu-config.out: $(APU_CONFIG) + sed 's,^\(location=\).*$$,\1installed,' < $(APU_CONFIG) > $@ install: $(TARGET_LIB) apu-config.out if [ ! -d $(DESTDIR)$(includedir) ]; then \ @@ -76,9 +76,8 @@ install: $(TARGET_LIB) apu-config.out if [ ! -d $(DESTDIR)$(bindir) ]; then \ $(APR_MKDIR) $(DESTDIR)$(bindir); \ fi; - $(LIBTOOL) --mode=install cp apu-config.out $(DESTDIR)$(bindir)/apu-config $(LIBTOOL) --mode=install cp apu-config.out $(DESTDIR)$(bindir)/$(APU_CONFIG) - chmod 755 $(DESTDIR)$(bindir)/apu-config $(DESTDIR)$(bindir)/$(APU_CONFIG) + chmod 755 $(DESTDIR)$(bindir)/$(APU_CONFIG) $(TARGET_LIB): $(OBJECTS) $(LINK) @lib_target@ $(ALL_LIBS) $(EXTRA_OS_LINK) Index: apu-config.in =================================================================== RCS file: /home/mirror/cvsmirror/misc-cvs/apr-util/apu-config.in,v retrieving revision 1.36 diff -u -p -r1.36 apu-config.in --- apu-config.in 14 Jun 2004 15:43:40 -0000 1.36 +++ apu-config.in 1 Aug 2004 16:58:12 -0000 @@ -43,7 +43,7 @@ [EMAIL PROTECTED]@ show_usage() { cat << EOF -Usage: apu-config [OPTION] +Usage: apu-$APRUTIL_MAJOR_VERSION-config [OPTION] Known values for OPTION are: --prefix[=DIR] change prefix to DIR @@ -62,9 +62,9 @@ Known values for OPTION are: --help print this help When linking with libtool, an application should do something like: - APU_LIBS="\`apu-config --link-libtool --libs\`" + APU_LIBS="\`apu-$APRUTIL_MAJOR_VERSION-config --link-libtool --libs\`" or when linking directly: - APU_LIBS="\`apu-config --link-ld --libs\`" + APU_LIBS="\`apu-$APRUTIL_MAJOR_VERSION-config --link-ld --libs\`" An application should use the results of --includes, and --ldflags in their build process. Index: configure.in =================================================================== RCS file: /home/mirror/cvsmirror/misc-cvs/apr-util/configure.in,v retrieving revision 1.76 diff -u -p -r1.76 configure.in --- configure.in 14 Jun 2004 15:43:40 -0000 1.76 +++ configure.in 1 Aug 2004 16:59:49 -0000 @@ -199,7 +199,7 @@ dnl everthing is done. MAKEFILES="Makefile $test_Makefile" AC_OUTPUT([ export_vars.sh - apu-config + apu-$APRUTIL_MAJOR_VERSION-config:apu-config.in apr-util.pc include/private/apu_select_dbm.h include/apr_ldap.h @@ -207,5 +207,7 @@ AC_OUTPUT([ include/apu_want.h $MAKEFILES ],[ -chmod +x apu-config +chmod +x apu-$APRUTIL_MAJOR_VERSION-config +],[ +APRUTIL_MAJOR_VERSION=$APRUTIL_MAJOR_VERSION ]) Index: build/find_apu.m4 =================================================================== RCS file: /home/mirror/cvsmirror/misc-cvs/apr-util/build/find_apu.m4,v retrieving revision 1.7 diff -u -p -r1.7 find_apu.m4 --- build/find_apu.m4 5 Nov 2002 22:13:42 -0000 1.7 +++ build/find_apu.m4 3 Aug 2004 10:37:02 -0000 @@ -6,14 +6,22 @@ dnl library. It provides a standardized dnl embedding APU into the application source, or locating an installed dnl copy of APU. dnl -dnl APR_FIND_APU([srcdir, path, implicit-install-check]) +dnl APR_FIND_APU(srcdir, builddir, implicit-install-check, acceptable-majors) dnl dnl where srcdir is the location of the bundled APU source directory, or dnl empty if source is not bundled. -dnl where path is the prefix to the location where the bundled APU will -dnl will be built. +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 option specified, we will look for installed copies. +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 Sets the following variables on exit: dnl @@ -23,6 +31,9 @@ dnl apu_config : If the apu-config too 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. @@ -44,57 +55,105 @@ dnl AC_DEFUN(APR_FIND_APU, [ apu_found="no" + if test "$ac_cv_emxos2" = "yes"; then + # Scripts don't pass test -x on OS/2 + TEST_X="test -f" + else + TEST_X="test -x" + fi + + m4_if([$4], [], + [ + 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=DIR prefix for installed APU, or path to APU build tree], + [ --with-apr-util=PATH prefix for installed APU, path to APU build tree, + or the full path to apu-config], [ if test "$withval" = "no" || test "$withval" = "yes"; then - AC_MSG_ERROR([--with-apr-util requires a directory to be provided]) + AC_MSG_ERROR([--with-apr-util requires a directory or file to be provided]) fi - if test -x "$withval/bin/apu-config"; then - apu_found="yes" - apu_config="$withval/bin/apu-config" - elif test -x "$withval/apu-config"; then - dnl Already configured build dir - apu_found="yes" - apu_config="$withval/apu-config" - elif test -x "$withval" && $withval --help > /dev/null 2>&1 ; then - apu_found="yes" - apu_config="$withval" + 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_found="yes" + apu_config="$lookdir/$apu_temp_apu_config_file" + break 2 + fi + done + done + + if test "$apu_found" != "yes" && $TEST_X "$withval" && $withval --help > /dev/null 2>&1 ; then + apu_found="yes" + apu_config="$withval" fi - dnl if --with-apr-util is used, then the target prefix/directory must - dnl be valid + 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 directory given to --with-apr-util does not specify a prefix for an -installed APU, nor an APR-util build directory.]) + 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 ],[ dnl if we have a bundled source directory, use it if test -d "$1"; then + apu_temp_abs_srcdir="`cd $1 && pwd`" apu_found="reconfig" + echo "sed -n '/#define.*APU_MAJOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p' \"$1/include/apu_version.h\"" + 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-config" + apu_config="$2/$apu_temp_apu_config_file" else - apu_config="$1/apu-config" + apu_config="$1/$apu_temp_apu_config_file" fi fi if test "$apu_found" = "no" && test -n "$3" && test "$3" = "1"; then - if apu-config --help > /dev/null 2>&1 ; then - apu_found="yes" - apu_config="apu-config" - else - dnl look in the some standard places (apparently not in builtin/default) - for lookdir in /usr /usr/local /opt/apr /usr/local/apache2 ; do - if test -x "$lookdir/bin/apu-config"; then - apu_found="yes" - apu_config="$lookdir/bin/apu-config" - break - fi - done - fi + for apu_temp_apu_config_file in $apu_temp_acceptable_apu_config + dn + if $apu_temp_apu_config_file --help > /dev/null 2>&1 ; then + apu_found="yes" + apu_config="$apu_temp_apu_config_file" + break + else + dnl look in some standard places (apparently not in builtin/default) + for lookdir in /usr /usr/local /opt/apr /usr/local/apache2 ; do + if $TEST_X "$lookdir/bin/$apu_temp_apu_config_file"; then + apu_found="yes" + apu_config="$lookdir/bin/$apu_temp_apu_config_file" + break 2 + fi + done + fi + done fi ]) Index: build/rpm/apr-util.spec.in =================================================================== RCS file: /home/mirror/cvsmirror/misc-cvs/apr-util/build/rpm/apr-util.spec.in,v retrieving revision 1.1 diff -u -p -r1.1 apr-util.spec.in --- build/rpm/apr-util.spec.in 1 Jul 2004 22:45:06 -0000 1.1 +++ build/rpm/apr-util.spec.in 1 Aug 2004 17:04:44 -0000 @@ -73,7 +73,6 @@ rm -rf $RPM_BUILD_ROOT %files devel %defattr(-,root,root,-) -%{_bindir}/apu-config %{_bindir}/apu-%{apuver}-config %{_libdir}/libaprutil-%{apuver}.*a %{_libdir}/libaprutil-%{apuver}.so