NetBSD Problem Report #47595

From  Mon Feb 25 19:45:01 2013
Return-Path: <>
Received: from ( [])
	by (Postfix) with ESMTP id 014E363E522
	for <>; Mon, 25 Feb 2013 19:45:00 +0000 (UTC)
Message-Id: <>
Date: Mon, 25 Feb 2013 19:44:59 +0000 (UTC)
Subject: databases/nss_ldap configure fails to detect pthread_once()
X-Send-Pr-Version: www-1.0

>Number:         47595
>Category:       pkg
>Synopsis:       databases/nss_ldap configure fails to detect pthread_once()
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 25 19:50:00 +0000 2013
>Originator:     Edgar Fuß
>Release:        pkgsrc-2012Q4
Mathematisches Institut der Uni Bonn
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 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.

databases/nss_ldap is marked ONLY_FOR_PLATORM NetBSD, so probably a ssimple-minded patch is OK.

The issue has been reported upstream ( over two years ago to no avail.
cd databases/nss_ldap; make configure
look for "pthread_once"
--- 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>

-#undef $ac_func
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
-/* 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.  */

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD:,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.