blob: f1ec5a71c3646b959d18d63dce4bd6113e167186 [file] [log] [blame]
dnl
dnl Process this file with autoconf to produce a configure script
dnl
AC_PREREQ(2.13)
AC_INIT(build/rules.mk.in)
AC_CONFIG_HEADER(include/private/apu_config.h)
AC_CONFIG_AUX_DIR(build)
AC_PROG_CC
AC_PROG_AWK
AC_CHECK_PROG(RM, rm, rm)
dnl Absolute source/build directory
abs_srcdir=`(cd $srcdir && pwd)`
abs_builddir=`pwd`
if test "$abs_builddir" != "$abs_srcdir"; then
USE_VPATH=1
fi
dnl
dnl compute the top directory of the build
dnl note: this is needed for LIBTOOL and exporting the bundled Expat
dnl
top_builddir="$abs_builddir"
AC_SUBST(top_builddir)
AC_SUBST(abs_srcdir)
dnl
dnl set up the compilation flags and stuff
dnl
INCLUDES="$INCLUDES -I\$(top_builddir)/include/private -I\$(top_builddir)/include"
if test -n "$USE_VPATH"; then
INCLUDES="$INCLUDES -I\$(top_srcdir)/include"
fi
dnl
dnl 1. Find the APR includes directory and (possibly) the source (base) dir.
dnl 2. Determine what DBM backend type to use.
dnl 3. Find Expat
dnl
APU_FIND_APR
APU_CHECK_DBM
APU_FIND_EXPAT
INCLUDES="$INCLUDES $APR_INCLUDES"
dnl
dnl prep libtool
dnl
echo "performing libtool configuration..."
AC_CANONICAL_SYSTEM
LDFLAGS=""
EXPAT_LINK=""
case "$host_alias" in
*beos*)
# Horrible Hack !!!
# if we're building a shared lib then we need to add in the
# apr library to the build...
LDFLAGS="$APR_SOURCE_DIR/libapr.la"
EXPAT_LINK="\$(top_builddir)/xml/expat/lib/libexpat.so"
;;
*)
;;
esac
dnl AC_PROG_LIBTOOL can't be invoked more than once, so this
dnl logic can't be combined with the previous case statement
case "$host_alias" in
*os2*)
# Use a custom-made libtool replacement
echo "using aplibtool"
LIBTOOL="$APR_SOURCE_DIR/build/aplibtool"
;;
*) dnl libtoolize requires that the following not be indented
AC_PROG_LIBTOOL
if test "x$LTFLAGS" = "x"; then
LTFLAGS='--silent'
fi
;;
esac
AC_ARG_ENABLE(libtool, [--with-libtool use libtool to link the library],
[ use_libtool=$withval ], [ use_libtool="yes" ] )
if test "x$use_libtool" = "xyes"; then
lt_compile='$(LIBTOOL) $(LTFLAGS) --mode=compile $(COMPILE) -c $< && touch $@'
link='$(LIBTOOL) $(LTFLAGS) --mode=link $(LT_LDFLAGS) $(COMPILE) $(LDFLAGS) -o $@'
so_ext='lo'
lib_target='-rpath $(libdir) $$objects'
else
lt_compile='$(COMPILE) -c $<'
link='$(AR) cr $(TARGET_LIB) $$objects; $(RANLIB) $(TARGET_LIB)'
so_ext='o'
lib_target=''
fi
AC_SUBST(lt_compile)
AC_SUBST(link)
AC_SUBST(so_ext)
AC_SUBST(lib_target)
AC_SUBST(LTFLAGS)
AC_SUBST(LT_LDFLAGS)
AC_SUBST(EXPAT_LINK)
dnl
dnl Prep all the flags and stuff for compilation and export to other builds
dnl
CFLAGS="$CFLAGS $INCLUDES $APR_EXPORT_CFLAGS $APR_EXPORT_CPPFLAGS"
LIBS="$LIBS $APR_EXPORT_LIBS"
AC_SUBST(APRUTIL_EXPORT_LIBS)
AC_SUBST(LDFLAGS)
dnl
dnl BSD/OS (BSDi) needs to use a different include syntax in the Makefiles
dnl
case "$host_alias" in
*bsdi*)
INCLUDE_RULES=".include \"$top_builddir/build/rules.mk\""
;;
*)
INCLUDE_RULES="include $top_builddir/build/rules.mk"
;;
esac
AC_SUBST(INCLUDE_RULES)
if test -d ./test; then
test_Makefile="test/Makefile"
fi
dnl
dnl everthing is done.
MAKEFILES=" Makefile build/Makefile buckets/Makefile crypto/Makefile dbm/Makefile dbm/sdbm/Makefile encoding/Makefile hooks/Makefile uri/Makefile xml/Makefile misc/Makefile $test_Makefile"
AC_OUTPUT([
export_vars.sh
build/rules.mk
include/private/apu_select_dbm.h
include/apu.h
$MAKEFILES
])
dnl #----------------------------- Fixup Makefiles for VPATH support
changequote({,})
if test -n "$USE_VPATH"; then
for makefile in $MAKEFILES; do
dir=`echo $makefile|sed 's%[^/][^/]*$%%'`
(cat <<EOF
srcdir = $abs_srcdir/$dir
VPATH = $abs_srcdir/$dir
EOF
) | cat - $makefile > tmp
cp tmp $makefile
done
rm -f tmp
fi
changequote([,])