You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Justin Erenkrantz <je...@apache.org> on 2002/08/13 05:54:56 UTC

Attempt at teaching svn-config about in-tree dependencies

Well, here's an attempt at how I would teach svn-config about
the in-tree dependencies if I had the time to finish it.  Alas,
right now, I don't have the time to complete it.  Perhaps I will
in a few weeks, but not now.  So, if someone wants to take this
and run with it, *please* be my guest.

Anyway, the general concept is to set a flag when we are using
an intree version of a package and then have svn-config attempt to
adjust correctly.  So, if we're intree and we're in the source
directory, we use -L$srcdir/apr -lapr to point at APR, if we're using
VPATH, we use -L$thisdir/apr -lapr, and if we're installed we should
just use -L$libdir -lapr.

That's the concept and this is a running start towards that idea.
I have no idea how feasible this actually is, but it seems the
best way to handle this can of worms.  (if only everyone could
use pre-installed versions...)

Hope this makes some sense...  -- justin

Index: ac-helpers/apr.m4
===================================================================
--- ac-helpers/apr.m4
+++ ac-helpers/apr.m4	Sun Aug 11 13:30:59 2002
@@ -9,6 +9,8 @@
 [
   AC_MSG_NOTICE([Apache Portable Runtime (APR) library configuration])
 
+  SVN_APR_INTREE=0
+
   APR_FIND_APR("$srcdir/apr", "./apr")
 
   if test $apr_found = "no"; then
@@ -19,6 +21,7 @@
   if test $apr_found = "reconfig"; then
     SVN_SUBDIR_CONFIG(apr)
     SVN_SUBDIRS="$SVN_SUBDIRS apr"
+    SVN_APR_INTREE=1
   fi
 
   dnl Get build information from APR
@@ -43,21 +46,29 @@
     AC_MSG_ERROR([apr-config --includes failed])
   fi
 
+  SVN_APR_DEP_LIBS="`$apr_config --libs`"
+  if test $? -ne 0; then
+    AC_MSG_ERROR([apr-config --libs failed])
+  fi
+
+
   dnl When APR stores the dependent libs in the .la file, we don't need 
   dnl --libs.
-  SVN_APR_LIBS="`$apr_config --link-libtool --libs`"
+  SVN_APR_LIBS="`$apr_config --link-libtool` $SVN_APR_DEP_LIBS"
   if test $? -ne 0; then
     AC_MSG_ERROR([apr-config --link-libtool --libs failed])
   fi
 
-  SVN_APR_EXPORT_LIBS="`$apr_config --link-ld --libs`"
+  SVN_APR_EXPORT_LIBS="`$apr_config --link-ld` $SVN_APR_DEP_LIBS"
   if test $? -ne 0; then
     AC_MSG_ERROR([apr-config --link-ld --libs failed])
   fi
 
   AC_SUBST(SVN_APR_INCLUDES)
+  AC_SUBST(SVN_APR_DEP_LIBS)
   AC_SUBST(SVN_APR_LIBS)
   AC_SUBST(SVN_APR_EXPORT_LIBS)
+  AC_SUBST(SVN_APR_INTREE)
 ])
 
 dnl SVN_DOWNLOAD_APR()
Index: ac-helpers/aprutil.m4
===================================================================
--- ac-helpers/aprutil.m4
+++ ac-helpers/aprutil.m4	Sun Aug 11 13:31:59 2002
@@ -14,6 +14,8 @@
 [
   AC_MSG_NOTICE([Apache Portable Runtime Utility (APRUTIL) library configuration])
 
+  SVN_APRUTIL_INTREE=0
+
   APR_FIND_APU("$srcdir/apr-util", "./apr-util")
 
   if test $apu_found = "no"; then
@@ -24,6 +26,7 @@
   if test $apu_found = "reconfig"; then
     SVN_SUBDIR_CONFIG(apr-util, --with-apr=../apr)
     SVN_SUBDIRS="$SVN_SUBDIRS apr-util"
+    SVN_APRUTIL_INTREE=1
   fi
 
   dnl Get libraries and thread flags from APRUTIL ---------------------
@@ -38,21 +41,29 @@
     AC_MSG_ERROR([apu-config --includes failed])
   fi
 
+  SVN_APRUTIL_DEP_LIBS="`$apu_config --libs`"
+  if test $? -ne 0; then
+    AC_MSG_ERROR([apu-config --libs failed])
+  fi
+
   dnl When APR stores the dependent libs in the .la file, we don't need
   dnl --libs.
-  SVN_APRUTIL_LIBS="`$apu_config --link-libtool --libs`"
+  SVN_APRUTIL_LIBS="`$apu_config --link-libtool` $SVN_APRUTIL_DEP_LIBS"
   if test $? -ne 0; then
     AC_MSG_ERROR([apu-config --link-libtool --libs failed])
   fi
 
-  SVN_APRUTIL_EXPORT_LIBS="`$apu_config --link-ld --libs`"
+  SVN_APRUTIL_EXPORT_LIBS="`$apu_config --link-ld` $SVN_APRUTIL_DEP_LIBS"
   if test $? -ne 0; then
     AC_MSG_ERROR([apu-config --link-ld --libs failed])
   fi
 
   AC_SUBST(SVN_APRUTIL_INCLUDES)
+  AC_SUBST(SVN_APRUTIL_DEP_LIBS)
   AC_SUBST(SVN_APRUTIL_LIBS)
   AC_SUBST(SVN_APRUTIL_EXPORT_LIBS)
+  AC_SUBST(SVN_APRUTIL_INTREE)
+
 ])
 
 dnl SVN_DOWNLOAD_APRUTIL()
Index: ac-helpers/berkeley-db.m4
===================================================================
--- ac-helpers/berkeley-db.m4
+++ ac-helpers/berkeley-db.m4	Sat Aug 10 20:09:31 2002
@@ -47,20 +47,21 @@
   dnl 
   dnl  You'll notice that the value of the `--with-berkeley-db' switch is a
   dnl  place spec.
+  SVN_BDB_INTREE=0
 
   AC_ARG_WITH(berkeley-db,
   [  --with-berkeley-db=PATH
-	   Find the Berkeley DB header and library in \`PATH/include' and
-	   \`PATH/lib'.  If PATH is of the form \`HEADER:LIB', then search
-	   for header files in HEADER, and the library in LIB.  If you omit
-	   the \`=PATH' part completely, the configure script will search
-	   for Berkeley DB in a number of standard places.
-
-	   The Subversion server requires Berkeley DB $db_version or newer.  If
-	   you specify \`--without-berkeley-db', the server will not be
-	   built.  Otherwise, the configure script builds the server if and
-	   only if it can find a new enough version installed, or if a copy
-	   of Berkeley DB exists in the subversion tree as subdir \`db'.],
+           Find the Berkeley DB header and library in \`PATH/include' and
+           \`PATH/lib'.  If PATH is of the form \`HEADER:LIB', then search
+           for header files in HEADER, and the library in LIB.  If you omit
+           the \`=PATH' part completely, the configure script will search
+           for Berkeley DB in a number of standard places.
+
+           The Subversion server requires Berkeley DB $db_version or newer.  If
+           you specify \`--without-berkeley-db', the server will not be
+           built.  Otherwise, the configure script builds the server if and
+           only if it can find a new enough version installed, or if a copy
+           of Berkeley DB exists in the subversion tree as subdir \`db'.],
   [
     if test "$withval" = "yes"; then
       status=required
@@ -84,6 +85,7 @@
 
     if test -d db ; then
       status=builtin
+      SVN_BDB_INTREE=1
       AC_MSG_RESULT([yes])
     else
       status=if-found
@@ -142,14 +144,14 @@
         *":"* )
           header="`echo $place | sed -e 's/:.*$//'`"
           lib="`echo $place | sed -e 's/^.*://'`"
-	  CPPFLAGS="$CPPFLAGS -I$header"
-	  LIBS="$LIBS -L$lib"
-	  description="$header and $lib"
+          CPPFLAGS="$CPPFLAGS -I$header"
+          LIBS="$LIBS -L$lib"
+          description="$header and $lib"
         ;;
         * )
-	  LIBS="$LIBS -L$place/lib"
-	  CPPFLAGS="$CPPFLAGS -I$place/include"
-	  description="$place"
+          LIBS="$LIBS -L$place/lib"
+          CPPFLAGS="$CPPFLAGS -I$place/include"
+          description="$place"
         ;;
       esac
 
@@ -166,7 +168,7 @@
       AC_MSG_CHECKING([for Berkeley DB in $description])
       AC_CACHE_VAL($cache_id,
         [
-	  SVN_LIB_BERKELEY_DB_TRY($1, $2, $3)
+          SVN_LIB_BERKELEY_DB_TRY($1, $2, $3)
           eval "$cache_id=$svn_have_berkeley_db"
         ])
       result="`eval echo '$'$cache_id`"
@@ -174,8 +176,8 @@
 
       # If we found it, no need to search any more.
       if test "`eval echo '$'$cache_id`" = "yes"; then
-	found="$place"
-	break
+        found="$place"
+        break
       fi
 
     done
@@ -186,10 +188,10 @@
 
     case "$found" in
       "not" )
-	if test "$status" = "required"; then
-	  AC_MSG_ERROR([Could not find Berkeley DB $1.$2.$3.])
-	fi
-	svn_lib_berkeley_db=no
+        if test "$status" = "required"; then
+          AC_MSG_ERROR([Could not find Berkeley DB $1.$2.$3.])
+        fi
+        svn_lib_berkeley_db=no
       ;;
       "std" )
         SVN_DB_INCLUDES=
@@ -197,8 +199,8 @@
         svn_lib_berkeley_db=yes
       ;;
       *":"* )
-	header="`echo $found | sed -e 's/:.*$//'`"
-	lib="`echo $found | sed -e 's/^.*://'`"
+        header="`echo $found | sed -e 's/:.*$//'`"
+        lib="`echo $found | sed -e 's/^.*://'`"
         SVN_DB_INCLUDES="-I$header"
 dnl ### should look for a .la file
         SVN_DB_LIBS="-L$lib -ldb"
@@ -208,10 +210,11 @@
         SVN_DB_INCLUDES="-I$found/include"
 dnl ### should look for a .la file
         SVN_DB_LIBS="-L$found/lib -ldb"
-	svn_lib_berkeley_db=yes
+        svn_lib_berkeley_db=yes
       ;;
     esac
   fi
+  AC_SUBST(SVN_BDB_INTREE)
 ])
 
 
Index: ac-helpers/neon.m4
===================================================================
--- ac-helpers/neon.m4
+++ ac-helpers/neon.m4	Sat Aug 10 20:08:58 2002
@@ -22,6 +22,7 @@
   NEON_WANTED_REGEX="$1"
   NEON_LATEST_WORKING_VER="$2"
   NEON_URL="$3"
+  SVN_NEON_INTREE=0
 
   AC_MSG_NOTICE([checking neon library])
 
@@ -45,6 +46,7 @@
       AC_MSG_CHECKING([neon library version])
       NEON_VERSION=`$abs_srcdir/ac-helpers/get-neon-ver.sh $abs_srcdir/neon`
       AC_MSG_RESULT([$NEON_VERSION])
+      SVN_NEON_INTREE=1
       case "$NEON_VERSION" in
         $NEON_WANTED_REGEX)
           echo "Using neon found in source directory."
@@ -134,6 +136,7 @@
     echo "No suitable neon can be found."
     SVN_DOWNLOAD_NEON()
   fi
+  AC_SUBST(SVN_NEON_INTREE)
 ])
 
 dnl SVN_DOWNLOAD_NEON()
Index: svn-config.in
===================================================================
--- svn-config.in
+++ svn-config.in	Mon Aug 12 22:43:37 2002
@@ -22,10 +22,16 @@
 libdir="@libdir@"
 includedir="@includedir@"
 
-LIBS="@NEON_LIBS@ @SVN_APRUTIL_EXPORT_LIBS@ @SVN_APR_EXPORT_LIBS@ @SVN_DB_LIBS@ @LIBS@"
+# Dependency information
+SVN_APR_INTREE="@SVN_APR_INTREE@"
+SVN_APRUTIL_INTREE="@SVN_APRUTIL_INTREE@"
+SVN_NEON_INTREE="@SVN_NEON_INTREE@"
+SVN_BDB_INTREE="@SVN_BDB_INTREE@"
+
+LIBS="@LIBS@"
 CFLAGS="@CFLAGS@"
 CPPFLAGS="@CPPFLAGS@"
-INCLUDES="@SVN_NEON_INCLUDES@ @SVN_DB_INCLUDES@ @SVN_APR_INCLUDES@ @SVN_APRUTIL_INCLUDES@"
+INCLUDES=""
 LDFLAGS="@LDFLAGS@"
 
 SVN_SOURCE_DIR="@abs_srcdir@"
@@ -76,6 +82,64 @@
   location=source
 else
   location=build
+fi
+
+if test "$SVN_NEON_INTREE" != "1"; then
+  LIBS="$LIBS @NEON_LIBS@"
+  INCLUDES="$INCLUDES @SVN_NEON_INCLUDES@"
+else
+  if test "$location" = "source"; then
+    INCLUDES="$INCLUDES -I$SVN_SOURCE_DIR/neon/include"
+    LIBS="$LIBS -L$SVN_SOURCE_DIR/neon/ -lneon"
+  elif test "$location" = "build"; then
+    INCLUDES="$INCLUDES -I$thisdir/neon/include -I$SVN_SOURCE_DIR/neon/include"
+    LIBS="$LIBS -L$thisdir/neon/ -lneon"
+  elif test "$location" = "installed"; then
+    LIBS="$LIBS -L$libdir/ -lneon"
+  fi
+  LIBS="$LIBS @NEON_LIBS@"
+fi
+
+if test "$SVN_BDB_INTREE" != "1"; then
+  LIBS="$LIBS @SVN_DB_LIBS@"
+  INCLUDES="$INCLUDES @SVN_DB_INCLUDES@"
+else
+  if test "$location" = "source"; then
+    LIBS="$LIBS @SVN_DB_LIBS@"
+    INCLUDES="$INCLUDES -I$SVN_SOURCE_DIR/db/include"
+    LIBS="$LIBS -L$SVN_SOURCE_DIR/db/ -ldb"
+  elif test "$location" = "build"; then
+    INCLUDES="$INCLUDES -I$thisdir/db/include -I$SVN_SOURCE_DIR/db/include"
+    LIBS="$LIBS -L$thisdir/db/ -ldb"
+  fi
+fi
+
+if test "$SVN_APRUTIL_INTREE" != "1"; then
+  LIBS="$LIBS @SVN_APRUTIL_EXPORT_LIBS@"
+  INCLUDES="$INCLUDES @SVN_APRUTIL_INCLUDES@"
+else
+  if test "$location" = "source"; then
+    INCLUDES="$INCLUDES -I$SVN_SOURCE_DIR/apr-util/include"
+    LIBS="$LIBS -L$SVN_SOURCE_DIR/apr/ -lapr"
+  elif test "$location" = "build"; then
+    INCLUDES="$INCLUDES -I$thisdir/apr-util/include -I$SVN_SOURCE_DIR/apr-util/include"
+    LIBS="$LIBS -L$thisdir/apr-util/ -laprutil"
+  fi
+  LIBS="$LIBS @SVN_APRUTIL_DEP_LIBS@"
+fi
+
+if test "$SVN_APR_INTREE" != "1"; then
+  LIBS="$LIBS @SVN_APR_EXPORT_LIBS@"
+  INCLUDES="$INCLUDES @SVN_APR_INCLUDES@"
+else
+  if test "$location" = "source"; then
+    INCLUDES="$INCLUDES -I$SVN_SOURCE_DIR/apr/include"
+    LIBS="$LIBS -L$SVN_SOURCE_DIR/apr/ -lapr"
+  elif test "$location" = "build"; then
+    INCLUDES="$INCLUDES -I$thisdir/apr/include -I$SVN_SOURCE_DIR/apr/include"
+    LIBS="$LIBS -L$thisdir/apr/ -lapr"
+  fi
+  LIBS="$LIBS @SVN_APR_DEP_LIBS@"
 fi
 
 flags=""

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org