tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

databases/nss_ldap pthread_once() configure test



A very strange problem I had (people not being put into their secondary groups 
on ssh login after switching LDAP to use STARTTLS) boils down to nss_ldap's 
configure script failing to detect the presence of pthread_once() on NetBSD.
[It then doesn't register pthread_atfork handlers, but later doesn't manually 
detect forks by PID comparison either because that logic tests on the presence 
of pthread_atfork, which succeeds. Oh well.]

The test for pthread_once fails in the first place because the test program 
doesn't #include <pthread.h> (which I just learnt from ws@ does clever things 
to make ptherad_once() usable without linking against libpthread).
Even with #include <pthread.h>, it fails once because it does queer things 
#define'ing pthread_once itself, and another time by providing a built-in 
prototype differing from the real one.
With three patches, the test succeeds and the original problem disappears.

It probably doesn't matter because databases/nss_ldap is ONLY_FOR_PLATORM 
NetBSD, but how to better work around the problems than my simple-minded patch 
below?

--- configure.orig      2009-11-06 11:28:08.000000000 +0100
+++ configure   2011-08-06 16:46:23.000000000 +0200
@@ -10713,9 +10713,7 @@
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares 
$ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
+#include <pthread.h>
 
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func (); below.
@@ -10728,16 +10726,11 @@
 # include <assert.h>
 #endif
 
-#undef $ac_func
-
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
 {
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char $ac_func ();
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */



Home | Main Index | Thread Index | Old Index