[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH]Correct approach to detect the presence of apr_hash_clear in apr

From: Kamesh Jayachandran <kamesh_at_collab.net>
Date: 2006-09-21 09:04:41 CEST

Hi All,
Find the attached patch and log which in my opinion a correct way to
detect apr_hash_clear in an available apr.
Tested the same in apr-0.9.7 and apr-1.3.0.

With regards
Kamesh Jayachandran

[[[
Patch by: Kamesh Jayachandran <kamesh@collab.net>

Follow up to 'compile failures with versions of APR older than 1.3.0'
caused by r21561.

* subversion/libsvn_subr/hash.c
  Including svn_private_config.h.
  (svn_hash_clear): use 'configure' detected 'HAVE_APR_HASH_FUNC' to decide
   about the availability of 'apr_hash_clear'.
* build/ac-macros/apr.m4
  (SVN_LIB_APR): Check for 'apr_hash_clear', if available set
   HAVE_APR_HASH_CLEAR.
]]]

Index: subversion/libsvn_subr/hash.c
===================================================================
--- subversion/libsvn_subr/hash.c (revision 21583)
+++ subversion/libsvn_subr/hash.c (working copy)
@@ -32,6 +32,7 @@
 #include "svn_sorts.h"
 #include "svn_io.h"
 #include "svn_pools.h"
+#include "svn_private_config.h"
 
 
 
@@ -437,9 +438,7 @@
 svn_error_t *
 svn_hash_clear(apr_hash_t *hash)
 {
-/* The APR_VERSION_AT_LEAST() macro is new in APR 1.3.0, which also
- happens to be the minimum version we require. */
-#ifdef APR_VERSION_AT_LEAST /* 1.3.0 */
+#ifdef HAVE_APR_HASH_CLEAR
   apr_hash_clear(hash);
 #else
   apr_hash_index_t *hi;
Index: build/ac-macros/apr.m4
===================================================================
--- build/ac-macros/apr.m4 (revision 21583)
+++ build/ac-macros/apr.m4 (working copy)
@@ -59,6 +59,12 @@
     AC_MSG_ERROR([apr-config --cflags failed])
   fi
 
+ dnl APR_LINK_SWITCH
+ LDFLAGS="$LDFLAGS `$apr_config --link-ld`"
+ AC_CHECK_FUNC(apr_hash_clear, AC_DEFINE(HAVE_APR_HASH_CLEAR,,
+ [Define if we have apr_hash_clear in apr]))
+
+ dnl Actual LDFLAGS
   LDFLAGS="$LDFLAGS `$apr_config --ldflags`"
   if test $? -ne 0; then
     AC_MSG_ERROR([apr-config --ldflags failed])

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Sep 21 09:04:24 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.