Per gstein's comments, let's factor out configuration of APR into
a standard find_apr.m4 (see apr/build/find_apr.m4 - copy the
latest version into ac-helpers/).
I tried to maintain as much of the original logic as possible.
I hopefully succeeded.  Please review, test, and give feedback.  =)
Note that --with-apr-includes and --with-apr-lib aren't present in 
find_apr.m4.  I suppose it might be later, but that's discussion 
for dev@apr not dev@svn.  =)  I'd rather see APR have full-on layout
support first.  And, if we add apr-config, that'll help with all of 
the layout stuff later on.
Oh, for some odd reason libsvn_ra_dav.la wants to link against
libxml2.  I don't see how that makes any sense.  I'll chalk it up
to oddity on my local system perhaps.  -- justin
Index: ./ac-helpers/apr.m4
===================================================================
--- ./ac-helpers/.svn/text-base/apr.m4.svn-base	Mon Dec 10 01:49:38 2001
+++ ./ac-helpers/apr.m4	Tue Dec 11 02:20:48 2001
@@ -3,133 +3,54 @@
 dnl  Check configure options and assign variables related to
 dnl  the Apache Portable Runtime (APR) library.
 dnl
-dnl  If there is a apr/ subdir we assme we want to use it. In that 
-dnl  case an option telling us to use a locally installed apr 
-dnl  triggers an error.
-dnl
-dnl  TODO : check apr version, link a test program
-
 
 AC_DEFUN(SVN_LIB_APR,
 [
 
   AC_MSG_NOTICE([Apache Portable Runtime (APR) library configuration])
 
-  AC_ARG_WITH(apr-libs,
-              [AC_HELP_STRING([--with-apr-libs=PREFIX], 
-	      [Use Apache Portable Runtime (APR) library at PREFIX])],
-  [
-    if test -d $abs_srcdir/apr ; then
-      AC_MSG_ERROR([--with-apr-libs option but apr/ subdir exists. 
-Please either remove that subdir or don't use the --with-apr-libs option.])
-    fi
-
-    if test "$withval" = "yes" ; then
-      AC_MSG_ERROR([--with-apr-libs requires an argument.])
-    else
-      APRVARS="$withval/APRVARS"
-      APR_LIBS="$withval"
-    fi
-  ])
-  
-  AC_ARG_WITH(apr-includes,
-              [AC_HELP_STRING([--with-apr-includes=PREFIX], 
-	      [Use Apache Portable Runtime (APR) includes at PREFIX])],
-  [
-    if test -d $abs_srcdir/apr ; then
-      AC_MSG_ERROR([--with-apr-includes option but apr/ subdir exists.
-Please either remove that subdir or don't use the --with-apr-includes option.])
-    fi
-
-    if test "$withval" = "yes" ; then
-      AC_MSG_ERROR([--with-apr-includes requires an argument.])
-    else
-      APR_INCLUDES="$withval"
-    fi
-  ])
-  
-  AC_ARG_WITH(apr,
-              [AC_HELP_STRING([--with-apr=PREFIX], 
-	      [Use Apache Portable Runtime (APR) at PREFIX])],
-  [
-    if test -d $abs_srcdir/apr ; then
-      AC_MSG_ERROR([--with-apr option but apr/ subdir exists.
-Please either remove that subdir or don't use the --with-apr option.])
-    fi
-
-    if test "$withval" != "yes" ; then
-      APR_INCLUDES="$withval/include"
-      APRVARS="$withval/lib/APRVARS"
-      APR_LIBS="$withval/lib"
-    fi
-  ])
-
-  if test -d $abs_srcdir/apr ; then
-    echo "Using apr found in source directory"
-    APR_INCLUDES='$(abs_builddir)/apr/include'
-    APR_LIBS='$(abs_builddir)/apr'
-    APRVARS=$abs_builddir/apr/APRVARS
-    SVN_SUBDIR_CONFIG(apr)
-    SVN_SUBDIRS="$SVN_SUBDIRS apr"
-  else
-    SVN_FIND_APR
+  APR_FIND_APR(apr)
+
+  if test $apr_found = "no"; then
+    AC_MSG_WARN([APR not found])
+    SVN_DOWNLOAD_APR
   fi
 
+  if test $apr_found = "reconfig"; then
+    SVN_SUBDIR_CONFIG($apr_srcdir)
+    SVN_SUBDIRS="$SVN_SUBDIRS $apr_srcdir"
+  fi
 
   dnl Get libraries and thread flags from APR ---------------------
 
-  if test -f "$APRVARS"; then
-    . "$APRVARS"
+  if test -x "$apr_config"; then
+    CPPFLAGS="$CPPFLAGS `$apr_config --cppflags`"
+    CFLAGS="$CFLAGS `$apr_config --cflags`"
+    LIBS="$LIBS `$apr_config --libs`"
+  else if test -f "$apr_vars"; then
+    . "$apr_vars"
     CPPFLAGS="$CPPFLAGS $EXTRA_CPPFLAGS"
     CFLAGS="$CFLAGS $EXTRA_CFLAGS"
     LIBS="$LIBS $EXTRA_LIBS"
   else
-    AC_MSG_WARN([APRVARS not found])
+    AC_MSG_WARN([apr-config or APRVARS not found])
     SVN_DOWNLOAD_APR
   fi
+  fi
 
-  if test -n "$APR_INCLUDES" ; then
-    SVN_EXTRA_INCLUDES="$SVN_EXTRA_INCLUDES -I$APR_INCLUDES"
-    if test "$abs_srcdir" != "$abs_builddir" && test -d $abs_srcdir/apr ; then
+  SVN_EXTRA_INCLUDES="$SVN_EXTRA_INCLUDES $apr_includes"
+  if test "$abs_srcdir" != "$abs_builddir" && test -d $abs_srcdir/apr ; then
       SVN_EXTRA_INCLUDES="$SVN_EXTRA_INCLUDES -I$abs_srcdir/apr/include"
-    fi
   fi
 
-  if test -z "$APR_LIBS" ; then
+  if test -z "$apr_la_file" ; then
     SVN_APR_LIBS="-lapr $LIBTOOL_LIBS"
   else
-    SVN_APR_LIBS="$APR_LIBS/libapr.la $LIBTOOL_LIBS"
+    SVN_APR_LIBS="$apr_la_file $LIBTOOL_LIBS"
   fi
   AC_SUBST(SVN_APR_LIBS)
 
 ])
-
-dnl SVN_FIND_APR()
-dnl Look in standard places for APRVARS, apr.h, and -lapr.
-AC_DEFUN(SVN_FIND_APR,
-[
-  CPPFLAGS_save=$CPPFLAGS
-  if test -n "$APR_INCLUDES" ; then
-    CPPFLAGS="$CPPFLAGS -I$APR_INCLUDES"
-  fi
-  AC_CHECK_HEADER(apr.h, apr_h="yes", apr_h="no")
-  if test "$apr_h" = "no" ; then
-    echo "Couldn't find apr.h"
-    SVN_DOWNLOAD_APR
-  fi
-
-  CPPFLAGS=$CPPFLAGS_save
-  if test -z $APRVARS ; then
-    dirs="/etc /usr/lib /usr/local/lib /opt/apr/lib"
-    for dir in $dirs; do
-      if test -f $dir/APRVARS ; then
-        APRVARS=$dir/APRVARS
-        break
-      fi
-    done
-  fi
-])
-
 
 dnl SVN_DOWNLOAD_APR()
 dnl no apr found, print out a message telling the user what to do
Index: ./configure.in
===================================================================
--- ./.svn/text-base/configure.in.svn-base	Mon Dec 10 01:49:24 2001
+++ ./configure.in	Tue Dec 11 01:50:05 2001
@@ -30,6 +30,7 @@
 sinclude(ac-helpers/svn-apache.m4)
 sinclude(ac-helpers/svn-macros.m4)
 sinclude(ac-helpers/neon.m4)
+sinclude(ac-helpers/find_apr.m4)
 sinclude(ac-helpers/apr.m4)
 sinclude(ac-helpers/aprutil.m4)
 
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:52 2006