#!/bin/sh
build/buildcheck.sh || exit 1
libtoolize=`build/PrintPath glibtoolize1 glibtoolize libtoolize15 libtoolize14 libtoolize`
if [ "x$libtoolize" = "x" ]; then
echo "libtoolize not found in path"
exit 1
fi
echo "Copying libtool helper files ..."
(cd build ; rm -f ltconfig ltmain.sh libtool.m4)
$libtoolize --copy --automake
if [ -f libtool.m4 ]; then
ltfile=`pwd`/libtool.m4
elif grep all_pkgmacro_files $libtoolize > /dev/null; then
aclocal_dir=`sed -n '/^aclocaldir=/{s/.*=//;p;q;}' < $libtoolize`
ltfiles=`sed -n '/^all_pkgmacro_files=/{s/.*=//;;s/"//;p;q;}' < $libtoolize`
for f in $ltfiles; do
test -f "$aclocal_dir/$f" && cp "$aclocal_dir/$f" build
done
ltfile=$aclocal_dir/libtool.m4
else
ltfindcmd="`sed -n \"/=[^\\\`]/p;/libtool_m4=/{s/.*=/echo /p;q;}\" \
< $libtoolize`"
ltfile=${LIBTOOL_M4-`eval "$ltfindcmd"`}
if [ -z "$ltfile" -o ! -f "$ltfile" ]; then
ltpath=`dirname $libtoolize`
ltfile=`cd $ltpath/../share/aclocal ; pwd`/libtool.m4
fi
fi
if [ ! -f $ltfile ]; then
echo "$ltfile not found"
exit 1
fi
echo "buildconf: Using libtool.m4 at ${ltfile}."
cat $ltfile | sed -e 's/LIBTOOL=\(.*\)top_build/LIBTOOL=\1apr_build/' > build/libtool.m4
if [ -f ltsugar.m4 ]; then
rm -f build/ltsugar.m4
mv ltsugar.m4 build/ltsugar.m4
fi
rm -f aclocal.m4 libtool.m4
echo "Creating include/arch/unix/apr_private.h.in ..."
${AUTOHEADER:-autoheader}
echo "Creating configure ..."
${AUTOCONF:-autoconf}
rm -rf autom4te*.cache
echo "Generating 'make' outputs ..."
build/gen-build.py make
if [ -f `which cut` ]; then
echo rebuilding rpm spec file
( REVISION=`build/get-version.sh all include/apr_version.h APR`
VERSION=`echo $REVISION | cut -d- -s -f1`
RELEASE=`echo $REVISION | cut -d- -s -f2`
if [ "x$VERSION" = "x" ]; then
VERSION=$REVISION
RELEASE=1
fi
cat ./build/rpm/apr.spec.in | \
sed -e "s/APR_VERSION/$VERSION/" \
-e "s/APR_RELEASE/$RELEASE/" \
> apr.spec )
fi
exit 0