From 49e7e5ee0b2848f5bf120a962e2e7eb11b86566a Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Sun, 10 Jan 1999 00:18:32 +0000 Subject: New makefiles. Includes support for out-of-source-tree builds. --- configure.in | 54 +++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 43 insertions(+), 11 deletions(-) (limited to 'configure.in') diff --git a/configure.in b/configure.in index 014c83d..e2c92c7 100644 --- a/configure.in +++ b/configure.in @@ -10,31 +10,61 @@ AC_ARG_ENABLE(debug,[ --enable-debug enable internal debugging routine AC_ARG_WITH(sysconfig,[ --with-sysconfig=FILE use specified BIRD system configuration file]) AC_ARG_WITH(protocols,[ --with-protocols=LIST include specified routing protocols (default: rip,static)],,[with_protocols="rip,static"]) +if test "$srcdir" = . ; then + # Building in current directory => create obj directory holding all objects + objdir=obj + mkdir -p obj + srcdir_rel=.. + makefiles="Makefile:tools/Makefile-top.in obj/Makefile:tools/Makefile.in obj/Rules:tools/Rules.in" + exedir=.. +else + # Building in separate directory + objdir=. + srcdir_rel=$srcdir + makefiles="Makefile:tools/Makefile.in Rules:tools/Rules.in" + exedir=. +fi +case $srcdir_rel in + /*) srcdir_rel_mf=$srcdir_rel ;; + *) srcdir_rel_mf="\$(root-rel)$srcdir_rel" ;; +esac +AC_SUBST(objdir) +AC_SUBST(exedir) +AC_SUBST(srcdir_rel_mf) + AC_CANONICAL_HOST AC_MSG_CHECKING([which OS configuration should we use]) if test -n "$with_sysconfig" -a "$with_sysconfig" != no ; then - case "$with_sysconfig" in *.h) ;; *) with_sysconfig="$with_sysconfig.h" ;; esac if test -f $with_sysconfig ; then - SYSDESC=$with_sysconfig + sysdesc=$with_sysconfig else - SYSDESC=sysdep/cf/$with_sysconfig + sysdesc=$srcdir/sysdep/cf/$with_sysconfig + if ! test -f $sysdesc ; then + sysdesc=$sysdesc.h + fi fi elif test -f sysconfig.h ; then - SYSDESC=sysconfig + sysdesc=sysconfig else case "$host_os" in - linux*) SYSDESC=linux-20 ;; + linux*) sysdesc=linux-20 ;; *) AC_MSG_RESULT(unknown) AC_MSG_ERROR([Cannot determine correct system configuration.]) ;; esac - SYSDESC=sysdep/cf/$SYSDESC.h + sysdesc=$srcdir/sysdep/cf/$sysdesc.h fi -AC_MSG_RESULT($SYSDESC) -if ! test -f $SYSDESC ; then +AC_MSG_RESULT($sysdesc) +if ! test -f $sysdesc ; then AC_MSG_ERROR([The system configuration file is missing.]) fi -AC_DEFINE_UNQUOTED(SYSCONF_INCLUDE, "$SYSDESC") +sysname=`echo $sysdesc | sed 's/\.h$//'` +AC_DEFINE_UNQUOTED(SYSCONF_INCLUDE, "$sysdesc") + +AC_MSG_CHECKING([system-dependent directories]) +sysdep_dirs="`sed <$sysdesc '/^Link: /!d;s/^Link: \(.*\)$/\1/' | tr '\012' ' '` lib" +AC_MSG_RESULT($sysdep_dirs) +AC_SUBST(sysdep_dirs) AC_MSG_CHECKING([protocols]) protocols=`echo "$with_protocols" | sed 's/,/ /g'` @@ -46,6 +76,7 @@ for a in $protocols ; do AC_DEFINE_UNQUOTED(CONFIG_`echo $a | tr 'a-z' 'A-Z'`) done AC_MSG_RESULT(ok) +AC_SUBST(protocols) AC_PROG_CC if test -z "$GCC" ; then @@ -82,12 +113,13 @@ else fi AC_CONFIG_HEADER(sysdep/autoconf.h) -AC_OUTPUT +AC_OUTPUT_COMMANDS(,[$srcdir/tools/mergedirs $srcdir $srcdir_rel $objdir $sysdep_dirs]) +AC_OUTPUT($makefiles) cat >&AC_FD_MSG <