Line 0
Link Here
|
|
|
1 |
Index: ldap-nss.c |
2 |
=================================================================== |
3 |
--- ldap-nss.c.orig |
4 |
+++ ldap-nss.c |
5 |
@@ -142,7 +142,7 @@ static void (*__sigpipe_handler) (int) = |
6 |
*/ |
7 |
static ldap_session_t __session = { NULL, NULL, 0, LS_UNINITIALIZED }; |
8 |
|
9 |
-#if defined(HAVE_PTHREAD_ATFORK) || defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H) |
10 |
+#if defined(HAVE_PTHREAD_ATFORK) || defined(HAVE___LIBC_ONCE) |
11 |
static pthread_once_t __once = PTHREAD_ONCE_INIT; |
12 |
#endif |
13 |
|
14 |
@@ -150,7 +150,7 @@ static pthread_once_t __once = PTHREAD_O |
15 |
static FILE *__debugfile; |
16 |
#endif /* LBER_OPT_LOG_PRINT_FILE */ |
17 |
|
18 |
-#ifndef HAVE_PTHREAD_ATFORK |
19 |
+#if !defined(HAVE_PTHREAD_ATFORK) || !defined(HAVE___LIBC_ONCE) |
20 |
/* |
21 |
* Process ID that opened the session. |
22 |
*/ |
23 |
@@ -162,7 +162,7 @@ static uid_t __euid = -1; |
24 |
static int __ssl_initialized = 0; |
25 |
#endif /* HAVE_LDAPSSL_CLIENT_INIT */ |
26 |
|
27 |
-#if defined(HAVE_PTHREAD_ATFORK) || defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H) |
28 |
+#if defined(HAVE_PTHREAD_ATFORK) || defined(HAVE___LIBC_ONCE) |
29 |
/* |
30 |
* Prepare for fork(); lock mutex. |
31 |
*/ |
32 |
@@ -513,7 +513,7 @@ _nss_ldap_default_constr (nss_ldap_backe |
33 |
} |
34 |
#endif /* HAVE_NSSWITCH_H */ |
35 |
|
36 |
-#if defined(HAVE_PTHREAD_ATFORK) || defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H) |
37 |
+#if defined(HAVE_PTHREAD_ATFORK) || defined(HAVE___LIBC_ONCE) |
38 |
static void |
39 |
do_atfork_prepare (void) |
40 |
{ |
41 |
@@ -547,7 +547,7 @@ do_atfork_setup (void) |
42 |
#ifdef HAVE_PTHREAD_ATFORK |
43 |
(void) pthread_atfork (do_atfork_prepare, do_atfork_parent, |
44 |
do_atfork_child); |
45 |
-#elif defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H) |
46 |
+#elif defined(HAVE___LIBC_ATFORK) |
47 |
(void) __libc_atfork (do_atfork_prepare, do_atfork_parent, do_atfork_child); |
48 |
#endif |
49 |
|
50 |
@@ -1096,7 +1096,7 @@ static NSS_STATUS |
51 |
do_init (void) |
52 |
{ |
53 |
ldap_config_t *cfg; |
54 |
-#ifndef HAVE_PTHREAD_ATFORK |
55 |
+#if !defined(HAVE_PTHREAD_ATFORK) || !defined(HAVE___LIBC_ONCE) |
56 |
pid_t pid; |
57 |
#endif |
58 |
uid_t euid; |
59 |
@@ -1113,7 +1113,7 @@ do_init (void) |
60 |
} |
61 |
|
62 |
#ifndef HAVE_PTHREAD_ATFORK |
63 |
-#if defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H) |
64 |
+#if defined(HAVE___LIBC_ONCE) |
65 |
/* |
66 |
* This bogosity is necessary because Linux uses different |
67 |
* PIDs for different threads (like IRIX, which we don't |
68 |
@@ -1145,7 +1145,7 @@ do_init (void) |
69 |
pid = -1; /* linked against libpthreads, don't care */ |
70 |
#else |
71 |
pid = getpid (); |
72 |
-#endif /* HAVE_LIBC_LOCK_H || HAVE_BITS_LIBC_LOCK_H */ |
73 |
+#endif /* HAVE___LIBC_ONCE */ |
74 |
#endif /* HAVE_PTHREAD_ATFORK */ |
75 |
|
76 |
euid = geteuid (); |
77 |
@@ -1155,7 +1155,7 @@ do_init (void) |
78 |
syslog (LOG_DEBUG, |
79 |
"nss_ldap: __session.ls_state=%d, __session.ls_conn=%p, __euid=%i, euid=%i", |
80 |
__session.ls_state, __session.ls_conn, __euid, euid); |
81 |
-#elif defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H) |
82 |
+#elif defined(HAVE___LIBC_ONCE) |
83 |
syslog (LOG_DEBUG, |
84 |
"nss_ldap: libpthreads=%s, __session.ls_state=%d, __session.ls_conn=%p, __pid=%i, pid=%i, __euid=%i, euid=%i", |
85 |
((__pthread_once == NULL || __pthread_atfork == NULL) ? "FALSE" : "TRUE"), |
86 |
@@ -1179,11 +1179,11 @@ do_init (void) |
87 |
} |
88 |
else |
89 |
#ifndef HAVE_PTHREAD_ATFORK |
90 |
-#if defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H) |
91 |
+#if defined(HAVE___LIBC_ONCE) |
92 |
if ((__pthread_once == NULL || __pthread_atfork == NULL) && __pid != pid) |
93 |
#else |
94 |
if (__pid != pid) |
95 |
-#endif /* HAVE_LIBC_LOCK_H || HAVE_BITS_LIBC_LOCK_H */ |
96 |
+#endif /* HAVE___LIBC_ONCE */ |
97 |
{ |
98 |
do_close_no_unbind (); |
99 |
} |
100 |
@@ -1244,9 +1244,9 @@ do_init (void) |
101 |
debug ("<== do_init (pthread_once failed)"); |
102 |
return NSS_UNAVAIL; |
103 |
} |
104 |
-#elif defined(HAVE_PTHREAD_ATFORK) && ( defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H) ) |
105 |
+#elif defined(HAVE_PTHREAD_ATFORK) && defined(HAVE___LIBC_ONCE) |
106 |
__libc_once (__once, do_atfork_setup); |
107 |
-#elif defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H) |
108 |
+#elif defined(HAVE___LIBC_ONCE) |
109 |
/* |
110 |
* Only install the pthread_atfork() handlers i |
111 |
* we are linked against libpthreads. Otherwise, |
112 |
Index: ldap-nss.h |
113 |
=================================================================== |
114 |
--- ldap-nss.h.orig |
115 |
+++ ldap-nss.h |
116 |
@@ -670,7 +670,7 @@ extern int __multi_threaded; |
117 |
#define NSS_LDAP_LOCK(m) mutex_lock(&m) |
118 |
#define NSS_LDAP_UNLOCK(m) mutex_unlock(&m) |
119 |
#define NSS_LDAP_DEFINE_LOCK(m) static mutex_t m = DEFAULTMUTEX |
120 |
-#elif defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H) |
121 |
+#elif defined(HAVE___LIBC_LOCK_LOCK) && defined(HAVE___LIBC_LOCK_UNLOCK) |
122 |
#define NSS_LDAP_LOCK(m) __libc_lock_lock(m) |
123 |
#define NSS_LDAP_UNLOCK(m) __libc_lock_unlock(m) |
124 |
#define NSS_LDAP_DEFINE_LOCK(m) static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER |
125 |
Index: configure.in |
126 |
=================================================================== |
127 |
--- configure.in.orig |
128 |
+++ configure.in |
129 |
@@ -1,6 +1,7 @@ |
130 |
AC_INIT(ldap-nss.c) |
131 |
AC_CANONICAL_SYSTEM |
132 |
AC_PREFIX_DEFAULT() |
133 |
+AC_CONFIG_MACRO_DIR([m4]) |
134 |
|
135 |
AM_INIT_AUTOMAKE(nss_ldap, 265) |
136 |
AM_CONFIG_HEADER(config.h) |
137 |
@@ -229,11 +230,18 @@ fi |
138 |
AC_CHECK_FUNCS(snprintf) |
139 |
AC_CHECK_FUNCS(gethostbyname) |
140 |
AC_CHECK_FUNCS(nsdispatch) |
141 |
+AC_CHECK_FUNCS(ether_aton) |
142 |
+AC_CHECK_FUNCS(ether_ntoa) |
143 |
+ |
144 |
+AX_PTHREAD |
145 |
+LIBS="$PTHREAD_LIBS $LIBS" |
146 |
+CFLAGS="$CFLAGS $PTHREAD_CFLAGS" |
147 |
+CC="$PTHREAD_CC" |
148 |
+ |
149 |
AC_CHECK_LIB(pthread_nonshared, main) |
150 |
AC_CHECK_FUNCS(pthread_atfork) |
151 |
AC_CHECK_FUNCS(pthread_once) |
152 |
-AC_CHECK_FUNCS(ether_aton) |
153 |
-AC_CHECK_FUNCS(ether_ntoa) |
154 |
+AC_CHECK_FUNCS(__libc_once __libc_atfork __libc_lock_lock __libc_lock_unlock) |
155 |
|
156 |
AC_MSG_CHECKING(for struct ether_addr) |
157 |
AC_TRY_COMPILE([#include <sys/types.h> |
158 |
Index: m4/ax_pthread.m4 |
159 |
=================================================================== |
160 |
--- /dev/null |
161 |
+++ m4/ax_pthread.m4 |
162 |
@@ -0,0 +1,309 @@ |
163 |
+# =========================================================================== |
164 |
+# http://www.gnu.org/software/autoconf-archive/ax_pthread.html |
165 |
+# =========================================================================== |
166 |
+# |
167 |
+# SYNOPSIS |
168 |
+# |
169 |
+# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) |
170 |
+# |
171 |
+# DESCRIPTION |
172 |
+# |
173 |
+# This macro figures out how to build C programs using POSIX threads. It |
174 |
+# sets the PTHREAD_LIBS output variable to the threads library and linker |
175 |
+# flags, and the PTHREAD_CFLAGS output variable to any special C compiler |
176 |
+# flags that are needed. (The user can also force certain compiler |
177 |
+# flags/libs to be tested by setting these environment variables.) |
178 |
+# |
179 |
+# Also sets PTHREAD_CC to any special C compiler that is needed for |
180 |
+# multi-threaded programs (defaults to the value of CC otherwise). (This |
181 |
+# is necessary on AIX to use the special cc_r compiler alias.) |
182 |
+# |
183 |
+# NOTE: You are assumed to not only compile your program with these flags, |
184 |
+# but also link it with them as well. e.g. you should link with |
185 |
+# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS |
186 |
+# |
187 |
+# If you are only building threads programs, you may wish to use these |
188 |
+# variables in your default LIBS, CFLAGS, and CC: |
189 |
+# |
190 |
+# LIBS="$PTHREAD_LIBS $LIBS" |
191 |
+# CFLAGS="$CFLAGS $PTHREAD_CFLAGS" |
192 |
+# CC="$PTHREAD_CC" |
193 |
+# |
194 |
+# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant |
195 |
+# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name |
196 |
+# (e.g. PTHREAD_CREATE_UNDETACHED on AIX). |
197 |
+# |
198 |
+# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the |
199 |
+# PTHREAD_PRIO_INHERIT symbol is defined when compiling with |
200 |
+# PTHREAD_CFLAGS. |
201 |
+# |
202 |
+# ACTION-IF-FOUND is a list of shell commands to run if a threads library |
203 |
+# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it |
204 |
+# is not found. If ACTION-IF-FOUND is not specified, the default action |
205 |
+# will define HAVE_PTHREAD. |
206 |
+# |
207 |
+# Please let the authors know if this macro fails on any platform, or if |
208 |
+# you have any other suggestions or comments. This macro was based on work |
209 |
+# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help |
210 |
+# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by |
211 |
+# Alejandro Forero Cuervo to the autoconf macro repository. We are also |
212 |
+# grateful for the helpful feedback of numerous users. |
213 |
+# |
214 |
+# Updated for Autoconf 2.68 by Daniel Richard G. |
215 |
+# |
216 |
+# LICENSE |
217 |
+# |
218 |
+# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu> |
219 |
+# Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG> |
220 |
+# |
221 |
+# This program is free software: you can redistribute it and/or modify it |
222 |
+# under the terms of the GNU General Public License as published by the |
223 |
+# Free Software Foundation, either version 3 of the License, or (at your |
224 |
+# option) any later version. |
225 |
+# |
226 |
+# This program is distributed in the hope that it will be useful, but |
227 |
+# WITHOUT ANY WARRANTY; without even the implied warranty of |
228 |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
229 |
+# Public License for more details. |
230 |
+# |
231 |
+# You should have received a copy of the GNU General Public License along |
232 |
+# with this program. If not, see <http://www.gnu.org/licenses/>. |
233 |
+# |
234 |
+# As a special exception, the respective Autoconf Macro's copyright owner |
235 |
+# gives unlimited permission to copy, distribute and modify the configure |
236 |
+# scripts that are the output of Autoconf when processing the Macro. You |
237 |
+# need not follow the terms of the GNU General Public License when using |
238 |
+# or distributing such scripts, even though portions of the text of the |
239 |
+# Macro appear in them. The GNU General Public License (GPL) does govern |
240 |
+# all other use of the material that constitutes the Autoconf Macro. |
241 |
+# |
242 |
+# This special exception to the GPL applies to versions of the Autoconf |
243 |
+# Macro released by the Autoconf Archive. When you make and distribute a |
244 |
+# modified version of the Autoconf Macro, you may extend this special |
245 |
+# exception to the GPL to apply to your modified version as well. |
246 |
+ |
247 |
+#serial 18 |
248 |
+ |
249 |
+AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) |
250 |
+AC_DEFUN([AX_PTHREAD], [ |
251 |
+AC_REQUIRE([AC_CANONICAL_HOST]) |
252 |
+AC_LANG_PUSH([C]) |
253 |
+ax_pthread_ok=no |
254 |
+ |
255 |
+# We used to check for pthread.h first, but this fails if pthread.h |
256 |
+# requires special compiler flags (e.g. on True64 or Sequent). |
257 |
+# It gets checked for in the link test anyway. |
258 |
+ |
259 |
+# First of all, check if the user has set any of the PTHREAD_LIBS, |
260 |
+# etcetera environment variables, and if threads linking works using |
261 |
+# them: |
262 |
+if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then |
263 |
+ save_CFLAGS="$CFLAGS" |
264 |
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS" |
265 |
+ save_LIBS="$LIBS" |
266 |
+ LIBS="$PTHREAD_LIBS $LIBS" |
267 |
+ AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) |
268 |
+ AC_TRY_LINK_FUNC(pthread_join, ax_pthread_ok=yes) |
269 |
+ AC_MSG_RESULT($ax_pthread_ok) |
270 |
+ if test x"$ax_pthread_ok" = xno; then |
271 |
+ PTHREAD_LIBS="" |
272 |
+ PTHREAD_CFLAGS="" |
273 |
+ fi |
274 |
+ LIBS="$save_LIBS" |
275 |
+ CFLAGS="$save_CFLAGS" |
276 |
+fi |
277 |
+ |
278 |
+# We must check for the threads library under a number of different |
279 |
+# names; the ordering is very important because some systems |
280 |
+# (e.g. DEC) have both -lpthread and -lpthreads, where one of the |
281 |
+# libraries is broken (non-POSIX). |
282 |
+ |
283 |
+# Create a list of thread flags to try. Items starting with a "-" are |
284 |
+# C compiler flags, and other items are library names, except for "none" |
285 |
+# which indicates that we try without any flags at all, and "pthread-config" |
286 |
+# which is a program returning the flags for the Pth emulation library. |
287 |
+ |
288 |
+ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" |
289 |
+ |
290 |
+# The ordering *is* (sometimes) important. Some notes on the |
291 |
+# individual items follow: |
292 |
+ |
293 |
+# pthreads: AIX (must check this before -lpthread) |
294 |
+# none: in case threads are in libc; should be tried before -Kthread and |
295 |
+# other compiler flags to prevent continual compiler warnings |
296 |
+# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) |
297 |
+# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) |
298 |
+# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) |
299 |
+# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) |
300 |
+# -pthreads: Solaris/gcc |
301 |
+# -mthreads: Mingw32/gcc, Lynx/gcc |
302 |
+# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it |
303 |
+# doesn't hurt to check since this sometimes defines pthreads too; |
304 |
+# also defines -D_REENTRANT) |
305 |
+# ... -mt is also the pthreads flag for HP/aCC |
306 |
+# pthread: Linux, etcetera |
307 |
+# --thread-safe: KAI C++ |
308 |
+# pthread-config: use pthread-config program (for GNU Pth library) |
309 |
+ |
310 |
+case ${host_os} in |
311 |
+ solaris*) |
312 |
+ |
313 |
+ # On Solaris (at least, for some versions), libc contains stubbed |
314 |
+ # (non-functional) versions of the pthreads routines, so link-based |
315 |
+ # tests will erroneously succeed. (We need to link with -pthreads/-mt/ |
316 |
+ # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather |
317 |
+ # a function called by this macro, so we could check for that, but |
318 |
+ # who knows whether they'll stub that too in a future libc.) So, |
319 |
+ # we'll just look for -pthreads and -lpthread first: |
320 |
+ |
321 |
+ ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags" |
322 |
+ ;; |
323 |
+ |
324 |
+ darwin*) |
325 |
+ ax_pthread_flags="-pthread $ax_pthread_flags" |
326 |
+ ;; |
327 |
+esac |
328 |
+ |
329 |
+if test x"$ax_pthread_ok" = xno; then |
330 |
+for flag in $ax_pthread_flags; do |
331 |
+ |
332 |
+ case $flag in |
333 |
+ none) |
334 |
+ AC_MSG_CHECKING([whether pthreads work without any flags]) |
335 |
+ ;; |
336 |
+ |
337 |
+ -*) |
338 |
+ AC_MSG_CHECKING([whether pthreads work with $flag]) |
339 |
+ PTHREAD_CFLAGS="$flag" |
340 |
+ ;; |
341 |
+ |
342 |
+ pthread-config) |
343 |
+ AC_CHECK_PROG(ax_pthread_config, pthread-config, yes, no) |
344 |
+ if test x"$ax_pthread_config" = xno; then continue; fi |
345 |
+ PTHREAD_CFLAGS="`pthread-config --cflags`" |
346 |
+ PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" |
347 |
+ ;; |
348 |
+ |
349 |
+ *) |
350 |
+ AC_MSG_CHECKING([for the pthreads library -l$flag]) |
351 |
+ PTHREAD_LIBS="-l$flag" |
352 |
+ ;; |
353 |
+ esac |
354 |
+ |
355 |
+ save_LIBS="$LIBS" |
356 |
+ save_CFLAGS="$CFLAGS" |
357 |
+ LIBS="$PTHREAD_LIBS $LIBS" |
358 |
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS" |
359 |
+ |
360 |
+ # Check for various functions. We must include pthread.h, |
361 |
+ # since some functions may be macros. (On the Sequent, we |
362 |
+ # need a special flag -Kthread to make this header compile.) |
363 |
+ # We check for pthread_join because it is in -lpthread on IRIX |
364 |
+ # while pthread_create is in libc. We check for pthread_attr_init |
365 |
+ # due to DEC craziness with -lpthreads. We check for |
366 |
+ # pthread_cleanup_push because it is one of the few pthread |
367 |
+ # functions on Solaris that doesn't have a non-functional libc stub. |
368 |
+ # We try pthread_create on general principles. |
369 |
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h> |
370 |
+ static void routine(void *a) { a = 0; } |
371 |
+ static void *start_routine(void *a) { return a; }], |
372 |
+ [pthread_t th; pthread_attr_t attr; |
373 |
+ pthread_create(&th, 0, start_routine, 0); |
374 |
+ pthread_join(th, 0); |
375 |
+ pthread_attr_init(&attr); |
376 |
+ pthread_cleanup_push(routine, 0); |
377 |
+ pthread_cleanup_pop(0) /* ; */])], |
378 |
+ [ax_pthread_ok=yes], |
379 |
+ []) |
380 |
+ |
381 |
+ LIBS="$save_LIBS" |
382 |
+ CFLAGS="$save_CFLAGS" |
383 |
+ |
384 |
+ AC_MSG_RESULT($ax_pthread_ok) |
385 |
+ if test "x$ax_pthread_ok" = xyes; then |
386 |
+ break; |
387 |
+ fi |
388 |
+ |
389 |
+ PTHREAD_LIBS="" |
390 |
+ PTHREAD_CFLAGS="" |
391 |
+done |
392 |
+fi |
393 |
+ |
394 |
+# Various other checks: |
395 |
+if test "x$ax_pthread_ok" = xyes; then |
396 |
+ save_LIBS="$LIBS" |
397 |
+ LIBS="$PTHREAD_LIBS $LIBS" |
398 |
+ save_CFLAGS="$CFLAGS" |
399 |
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS" |
400 |
+ |
401 |
+ # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. |
402 |
+ AC_MSG_CHECKING([for joinable pthread attribute]) |
403 |
+ attr_name=unknown |
404 |
+ for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do |
405 |
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>], |
406 |
+ [int attr = $attr; return attr /* ; */])], |
407 |
+ [attr_name=$attr; break], |
408 |
+ []) |
409 |
+ done |
410 |
+ AC_MSG_RESULT($attr_name) |
411 |
+ if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then |
412 |
+ AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name, |
413 |
+ [Define to necessary symbol if this constant |
414 |
+ uses a non-standard name on your system.]) |
415 |
+ fi |
416 |
+ |
417 |
+ AC_MSG_CHECKING([if more special flags are required for pthreads]) |
418 |
+ flag=no |
419 |
+ case ${host_os} in |
420 |
+ aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";; |
421 |
+ osf* | hpux*) flag="-D_REENTRANT";; |
422 |
+ solaris*) |
423 |
+ if test "$GCC" = "yes"; then |
424 |
+ flag="-D_REENTRANT" |
425 |
+ else |
426 |
+ flag="-mt -D_REENTRANT" |
427 |
+ fi |
428 |
+ ;; |
429 |
+ esac |
430 |
+ AC_MSG_RESULT(${flag}) |
431 |
+ if test "x$flag" != xno; then |
432 |
+ PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" |
433 |
+ fi |
434 |
+ |
435 |
+ AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT], |
436 |
+ ax_cv_PTHREAD_PRIO_INHERIT, [ |
437 |
+ AC_LINK_IFELSE([ |
438 |
+ AC_LANG_PROGRAM([[#include <pthread.h>]], [[int i = PTHREAD_PRIO_INHERIT;]])], |
439 |
+ [ax_cv_PTHREAD_PRIO_INHERIT=yes], |
440 |
+ [ax_cv_PTHREAD_PRIO_INHERIT=no]) |
441 |
+ ]) |
442 |
+ AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"], |
443 |
+ AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], 1, [Have PTHREAD_PRIO_INHERIT.])) |
444 |
+ |
445 |
+ LIBS="$save_LIBS" |
446 |
+ CFLAGS="$save_CFLAGS" |
447 |
+ |
448 |
+ # More AIX lossage: must compile with xlc_r or cc_r |
449 |
+ if test x"$GCC" != xyes; then |
450 |
+ AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC}) |
451 |
+ else |
452 |
+ PTHREAD_CC=$CC |
453 |
+ fi |
454 |
+else |
455 |
+ PTHREAD_CC="$CC" |
456 |
+fi |
457 |
+ |
458 |
+AC_SUBST(PTHREAD_LIBS) |
459 |
+AC_SUBST(PTHREAD_CFLAGS) |
460 |
+AC_SUBST(PTHREAD_CC) |
461 |
+ |
462 |
+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: |
463 |
+if test x"$ax_pthread_ok" = xyes; then |
464 |
+ ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) |
465 |
+ : |
466 |
+else |
467 |
+ ax_pthread_ok=no |
468 |
+ $2 |
469 |
+fi |
470 |
+AC_LANG_POP |
471 |
+])dnl AX_PTHREAD |
472 |
Index: Makefile.am |
473 |
=================================================================== |
474 |
--- Makefile.am.orig |
475 |
+++ Makefile.am |
476 |
@@ -1,3 +1,5 @@ |
477 |
+ACLOCAL_AMFLAGS = -I m4 |
478 |
+ |
479 |
if AIX |
480 |
authmod = NSS_LDAP |
481 |
else |