Fix memory leak when maintaining resources. When extra resources are
[apr-util.git] / buildconf
blobee0a9bda28435f8eaef592f3f72a4b72f038b470
1 #!/bin/sh
3 # Default place to look for apr source. Can be overridden with
4 # --with-apr=[directory]
5 apr_src_dir=../apr
7 while test $# -gt 0
8 do
9 # Normalize
10 case "$1" in
11 -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
12 *) optarg= ;;
13 esac
15 case "$1" in
16 --with-apr=*)
17 apr_src_dir=$optarg
19 esac
21 shift
22 done
24 if test -d "$apr_src_dir"
25 then
26 echo ""
27 echo "Looking for apr source in $apr_src_dir"
28 else
29 echo ""
30 echo "Problem finding apr source in $apr_src_dir."
31 echo "Use:"
32 echo " --with-apr=[directory]"
33 exit 1
36 # Remove some files, then copy them from apr source tree
37 rm -f build/apr_common.m4 build/find_apr.m4 build/install.sh \
38 build/config.guess build/config.sub
39 cp $apr_src_dir/build/apr_common.m4 $apr_src_dir/build/find_apr.m4 \
40 $apr_src_dir/build/install.sh $apr_src_dir/build/config.guess \
41 $apr_src_dir/build/config.sub build
43 # Remove aclocal.m4 as it'll break some builds...
44 rm -rf aclocal.m4 autom4te*.cache
47 # Generate the autoconf header (include/apu_config.h) and ./configure
49 echo "Creating include/private/apu_config.h ..."
50 ${AUTOHEADER:-autoheader}
52 echo "Creating configure ..."
53 ### do some work to toss config.cache?
54 if ${AUTOCONF:-autoconf}; then
56 else
57 echo "autoconf failed"
58 exit 1
62 # Generate build-outputs.mk for the build systme
64 echo "Generating 'make' outputs ..."
65 $apr_src_dir/build/gen-build.py make
68 # If Expat has been bundled, then go and configure the thing
70 if test -d xml/expat; then
71 echo "Invoking xml/expat/buildconf.sh ..."
72 (cd xml/expat; ./buildconf.sh)
75 # Remove autoconf cache again
76 rm -rf autom4te*.cache
78 # Create RPM Spec file
79 if [ -f `which cut` ]; then
80 echo rebuilding rpm spec file
81 ( REVISION=`build/get-version.sh all include/apu_version.h APU`
82 VERSION=`echo $REVISION | cut -d- -s -f1`
83 RELEASE=`echo $REVISION | cut -d- -s -f2`
84 if [ "x$VERSION" = "x" ]; then
85 VERSION=$REVISION
86 RELEASE=1
88 cat ./build/rpm/apr-util.spec.in | \
89 sed -e "s/APU_VERSION/$VERSION/" \
90 -e "s/APU_RELEASE/$RELEASE/" \
91 > apr-util.spec )