Brings APRUTIL up to speed with recent APR changes that are intended to
eventually make shared builds work on AIX.

- Now creating exports.c and export_vars.h from APR awk scripts.
- Those are used to created exports.lo which can be linked to any
  binary to force all symbols to be "used" so the linker will resolve them.
- Also used to create a list of exported symbols which is necessary for
  linkers like AIX.

I had to explicitly state where to include APR files from, but this may
not be absolutely necessary once I trim out some of the unneeded parts
of make_exports.awk and make_var_export.awk.


git-svn-id: https://svn.apache.org/repos/asf/apr/apr-util/trunk@58431 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/.cvsignore b/.cvsignore
index 7ef057c..6912672 100644
--- a/.cvsignore
+++ b/.cvsignore
@@ -8,7 +8,9 @@
 configure
 libtool
 libaprutil.la
-aprutil.exports
+aprutil.exp
+exports.c
+export_vars.h
 export_vars.sh
 Debug
 Release
diff --git a/Makefile.in b/Makefile.in
index 661f50d..41dd21c 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -2,11 +2,12 @@
 # Top-level Makefile for APRUTIL
 #
 
+INCLUDES=-I./include -I../include -I@APR_SOURCE_DIR@/include
+
 TARGET_LIB = libaprutil.la
-TARGET_EXPORTS = aprutil.exports
 INSTALL_SUBDIRS = @APR_XML_DIR@
 
-TARGETS = delete-lib $(TARGET_LIB) delete-exports $(TARGET_EXPORTS)
+TARGETS = delete-lib $(TARGET_LIB) delete-exports aprutil.exp export_vars.h
 
 # bring in rules.mk for standard functionality
 @INCLUDE_RULES@
@@ -14,16 +15,21 @@
 SUBDIRS = buckets crypto dbm encoding hooks ldap uri xml misc
 CLEAN_SUBDIRS = . test
 
-CLEAN_TARGETS = $(TARGET_EXPORTS)
+CLEAN_TARGETS =
 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/apu.h export_vars.sh
-EXTRACLEAN_TARGETS = configure aclocal.m4 include/private/apu_config.h.in
+	include/private/apu_select_dbm.h include/apu.h export_vars.sh \
+	aprutil.exp
+EXTRACLEAN_TARGETS = configure aclocal.m4 include/private/apu_config.h.in \
+	exports.c export_vars.h
 
 prefix=@prefix@
 exec_prefix=@exec_prefix@
 libdir=@libdir@
 includedir=@includedir@
+top_srcdir=@top_srcdir@
+
+EXPORT_FILES = $(top_srcdir)/include/*.h
 
 delete-lib:
 	@if test -f $(TARGET_LIB); then \
@@ -53,17 +59,27 @@
 	    $(LINK) @lib_target@ @EXTRA_OS_LINK@
 
 delete-exports:
-	@if test -f $(TARGET_EXPORTS); then \
-	    headers="`find include/*.h -newer $(TARGET_EXPORTS) -print`" ; \
+	@if test -f aprutil.exp; then \
+	    headers="`find include/*.h -newer aprutil.exp -print`" ; \
 	    if test -n "$$headers"; then \
-		echo Found newer headers. Will rebuild $(TARGET_EXPORTS). ; \
-		echo $(RM) -f $(TARGET_EXPORTS) ; \
-		$(RM) -f $(TARGET_EXPORTS) ; \
+		echo Found newer headers. Will rebuild aprutil.exp. ; \
+		echo $(RM) -f aprutil.exp ; \
+		$(RM) -f aprutil.exp ; \
 	    fi \
 	fi
 
-$(TARGET_EXPORTS):
-	$(AWK) -f @APR_SOURCE_DIR@/build/make_export.awk include/*.h > $@ ;
+exports.c:
+	$(AWK) -f @APR_SOURCE_DIR@/build/make_exports.awk $(EXPORT_FILES) > $@
+
+export_vars.h:
+	$(AWK) -f @APR_SOURCE_DIR@/build/make_var_export.awk $(EXPORT_FILES) > $@
+
+aprutil.exp: exports.c export_vars.h
+	@echo "#! ." > $@
+	@echo "* This file was AUTOGENERATED at build time." >> $@
+	@echo "* Please do not edit by hand." >> $@
+	$(CPP) $(ALL_CPPFLAGS) $(ALL_INCLUDES) exports.c | grep "ap_hack_" | sed -e 's/^.*[)]\(.*\);$$/\1/' >> $@
+	$(CPP) $(ALL_CPPFLAGS) $(ALL_INCLUDES) export_vars.h | sed -e 's/^\#[^!]*//' | sed -e '/^$$/d' >> $@
 
 docs:
 	mkdir ./docs