List Info

Thread: Correct approach to detect the presence of apr_hash_clear in apr




Correct approach to detect the presence of apr_hash_clear in apr
user name
2006-09-21 07:04:41
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 <kameshcollab.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-unsubscribesubversion.tigris.org
For additional commands, e-mail: dev-helpsubversion.tigris.org
Correct approach to detect the presence of apr_hash_clear in apr
user name
2006-09-21 13:42:20
On 9/21/06, Kamesh Jayachandran <kameshcollab.net> wrote:
> 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.

Honestly, I think it's silly to waste people's CPU time on
autoconf
checks for this.  We know what version of APR it will show
up in, so
there's no reason to jump through the hoops of compiling a
test
program to see if it's there.

-garrett

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribesubversion.tigris.org
For additional commands, e-mail: dev-helpsubversion.tigris.org

Correct approach to detect the presence of apr_hash_clear in apr
user name
2006-09-21 16:29:37
On Thu, 21 Sep 2006, Garrett Rooney wrote:

> On 9/21/06, Kamesh Jayachandran <kameshcollab.net> wrote:
> >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.
> 
> Honestly, I think it's silly to waste people's CPU
time on autoconf
> checks for this.  We know what version of APR it will
show up in, so
> there's no reason to jump through the hoops of
compiling a test
> program to see if it's there.

Furthermore, we'd have to add additional autoconf checks
the next time
we needed an API from APR which isn't present in all the
versions of
it we support.  Using a macro is more easily supportable.
Correct approach to detect the presence of apr_hash_clear in apr
user name
2006-09-27 19:05:09
Daniel Rall wrote:
> On Thu, 21 Sep 2006, Garrett Rooney wrote:
>
>   
>> On 9/21/06, Kamesh Jayachandran <kameshcollab.net> wrote:
>>     
>>> 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.
>>>       
>> Honestly, I think it's silly to waste people's CPU
time on autoconf
>> checks for this.  We know what version of APR it
will show up in, so
>> there's no reason to jump through the hoops of
compiling a test
>> program to see if it's there.
>>     
>
> Furthermore, we'd have to add additional autoconf
checks the next time
> we needed an API from APR which isn't present in all
the versions of
> it we support.  Using a macro is more easily
supportable.
>   
Even further more, if it doesn't work on Windows, it can't
go in. 
Autoconf doesn't work on Windows. QED.

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribesubversion.tigris.org
For additional commands, e-mail: dev-helpsubversion.tigris.org

[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )