blob: 4084d184d20df49bb59183cbb071ff57c7d9ff5e [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
dnl compute the top directory of the build
dnl note: this is needed for LIBTOOL and exporting the bundled Expat
dnl
top_builddir="`cd $srcdir ; pwd`"
AC_SUBST(top_builddir)
dnl
dnl set up the compilation flags and stuff
dnl
INCLUDES="$INCLUDES -I\$(top_builddir)/include/private -I\$(top_builddir)/include"
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 -I$APR_INCLUDES"
dnl
dnl prep libtool
dnl
echo "performing libtool configuration..."
AC_CANONICAL_SYSTEM
LDFLAGS=""
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"
;;
*)
;;
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)
dnl
dnl grab flags from APR.
dnl ### APR doesn't have "nice" names for its exports (yet), but it isn't
dnl ### a problem to deal with them right here
dnl
. "$APR_SOURCE_DIR/APRVARS"
APR_EXPORT_CPPFLAGS="$EXTRA_CPPFLAGS"
APR_EXPORT_CFLAGS="$EXTRA_CFLAGS"
APR_EXPORT_LIBS="$EXTRA_LIBS"
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.
AC_OUTPUT([
Makefile
export_vars.sh
build/Makefile
build/rules.mk
include/private/apu_select_dbm.h
include/apu.h
buckets/Makefile
crypto/Makefile
dbm/Makefile
dbm/sdbm/Makefile
encoding/Makefile
hooks/Makefile
uri/Makefile
xml/Makefile
$test_Makefile
])