~ubuntu-branches/ubuntu/maverick/evolution-data-server/maverick-proposed

« back to all changes in this revision

Viewing changes to libdb/dist/aclocal/mutex.ac

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-05-17 17:02:06 UTC
  • mfrom: (1.1.79 upstream) (1.6.12 experimental)
  • Revision ID: james.westby@ubuntu.com-20100517170206-4ufr52vwrhh26yh0
Tags: 2.30.1-1ubuntu1
* Merge from debian experimental. Remaining change:
  (LP: #42199, #229669, #173703, #360344, #508494)
  + debian/control:
    - add Vcs-Bzr tag
    - don't use libgnome
    - Use Breaks instead of Conflicts against evolution 2.25 and earlier.
  + debian/evolution-data-server.install,
    debian/patches/45_libcamel_providers_version.patch:
    - use the upstream versioning, not a Debian-specific one 
  + debian/libedata-book1.2-dev.install, debian/libebackend-1.2-dev.install,
    debian/libcamel1.2-dev.install, debian/libedataserverui1.2-dev.install:
    - install html documentation
  + debian/rules:
    - don't build documentation it's shipped with the tarball

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# $Id$
2
 
 
3
 
# POSIX pthreads tests: inter-process safe and intra-process only.
4
 
#
5
 
# We need to run a test here, because the PTHREAD_PROCESS_SHARED flag compiles
6
 
# fine on problematic systems, but won't actually work.  This is a problem for
7
 
# cross-compilation environments.  I think inter-process mutexes are as likely
8
 
# to fail in cross-compilation environments as real ones (especially since the
9
 
# likely cross-compilation environment is Linux, where inter-process mutexes
10
 
# don't currently work -- the latest estimate I've heard is Q1 2002, as part
11
 
# of IBM's NGPT package).  So:
12
 
#
13
 
# If checking for inter-process pthreads mutexes:
14
 
#       If it's local, run a test.
15
 
#       If it's a cross-compilation, fail.
16
 
#
17
 
# If the user specified pthreads mutexes and we're checking for intra-process
18
 
# mutexes only:
19
 
#       If it's local, run a test.
20
 
#       If it's a cross-compilation, run a link-test.
21
 
#
22
 
# So, the thing you can't do here is configure for inter-process POSIX pthread
23
 
# mutexes when cross-compiling.  Since we're using the GNU/Cygnus toolchain for
24
 
# cross-compilation, the target system is likely Linux or *BSD, so we're doing
25
 
# the right thing.
26
 
AC_DEFUN(AM_PTHREADS_SHARED, [
27
 
AC_TRY_RUN([
28
 
#include <pthread.h>
29
 
main() {
30
 
        pthread_cond_t cond;
31
 
        pthread_mutex_t mutex;
32
 
        pthread_condattr_t condattr;
33
 
        pthread_mutexattr_t mutexattr;
34
 
        exit (
35
 
        pthread_condattr_init(&condattr) ||
36
 
        pthread_condattr_setpshared(&condattr, PTHREAD_PROCESS_SHARED) ||
37
 
        pthread_mutexattr_init(&mutexattr) ||
38
 
        pthread_mutexattr_setpshared(&mutexattr, PTHREAD_PROCESS_SHARED) ||
39
 
        pthread_cond_init(&cond, &condattr) ||
40
 
        pthread_mutex_init(&mutex, &mutexattr) ||
41
 
        pthread_mutex_lock(&mutex) ||
42
 
        pthread_mutex_unlock(&mutex) ||
43
 
        pthread_mutex_destroy(&mutex) ||
44
 
        pthread_cond_destroy(&cond) ||
45
 
        pthread_condattr_destroy(&condattr) ||
46
 
        pthread_mutexattr_destroy(&mutexattr));
47
 
}], [db_cv_mutex="$1"],, [db_cv_mutex="no"])])
48
 
AC_DEFUN(AM_PTHREADS_PRIVATE, [
49
 
AC_TRY_RUN([
50
 
#include <pthread.h>
51
 
main() {
52
 
        pthread_cond_t cond;
53
 
        pthread_mutex_t mutex;
54
 
        pthread_condattr_t condattr;
55
 
        pthread_mutexattr_t mutexattr;
56
 
        exit (
57
 
        pthread_condattr_init(&condattr) ||
58
 
        pthread_mutexattr_init(&mutexattr) ||
59
 
        pthread_cond_init(&cond, &condattr) ||
60
 
        pthread_mutex_init(&mutex, &mutexattr) ||
61
 
        pthread_mutex_lock(&mutex) ||
62
 
        pthread_mutex_unlock(&mutex) ||
63
 
        pthread_mutex_destroy(&mutex) ||
64
 
        pthread_cond_destroy(&cond) ||
65
 
        pthread_condattr_destroy(&condattr) ||
66
 
        pthread_mutexattr_destroy(&mutexattr));
67
 
}], [db_cv_mutex="$1"],,
68
 
AC_TRY_LINK([
69
 
#include <pthread.h>],[
70
 
        pthread_cond_t cond;
71
 
        pthread_mutex_t mutex;
72
 
        pthread_condattr_t condattr;
73
 
        pthread_mutexattr_t mutexattr;
74
 
        exit (
75
 
        pthread_condattr_init(&condattr) ||
76
 
        pthread_mutexattr_init(&mutexattr) ||
77
 
        pthread_cond_init(&cond, &condattr) ||
78
 
        pthread_mutex_init(&mutex, &mutexattr) ||
79
 
        pthread_mutex_lock(&mutex) ||
80
 
        pthread_mutex_unlock(&mutex) ||
81
 
        pthread_mutex_destroy(&mutex) ||
82
 
        pthread_cond_destroy(&cond) ||
83
 
        pthread_condattr_destroy(&condattr) ||
84
 
        pthread_mutexattr_destroy(&mutexattr));
85
 
], [db_cv_mutex="$1"]))])
86
 
 
87
 
# Figure out mutexes for this compiler/architecture.
88
 
AC_DEFUN(AM_DEFINE_MUTEXES, [
89
 
 
90
 
# Mutexes we don't test for, but want the #defines to exist for
91
 
# other ports.
92
 
AH_TEMPLATE(HAVE_MUTEX_VMS, [Define to 1 to use VMS mutexes.])
93
 
AH_TEMPLATE(HAVE_MUTEX_VXWORKS, [Define to 1 to use VxWorks mutexes.])
94
 
AH_TEMPLATE(HAVE_MUTEX_WIN32, [Define to 1 to use Windows mutexes.])
95
 
 
96
 
AC_CACHE_CHECK([for mutexes], db_cv_mutex, [
97
 
db_cv_mutex=no
98
 
 
99
 
orig_libs=$LIBS
100
 
 
101
 
# User-specified POSIX or UI mutexes.
102
 
#
103
 
# There are two different reasons to specify mutexes: First, the application
104
 
# is already using one type of mutex and doesn't want to mix-and-match (for
105
 
# example, on Solaris, which has POSIX, UI and LWP mutexes).  Second, the
106
 
# applications POSIX pthreads mutexes don't support inter-process locking,
107
 
# but the application wants to use them anyway (for example, current Linux
108
 
# and *BSD systems).
109
 
#
110
 
# If we're on Solaris, we insist that -lthread or -lpthread be used.  The
111
 
# problem is the Solaris C library has UI/POSIX interface stubs, but they're
112
 
# broken, configuring them for inter-process mutexes doesn't return an error,
113
 
# but it doesn't work either.   Otherwise, we try first without the library
114
 
# and then with it: there's some information that SCO/UnixWare/OpenUNIX needs
115
 
# this. [#4950]
116
 
#
117
 
# Test for LWP threads before testing for UI/POSIX threads, we prefer them
118
 
# on Solaris.  There's a bug in SunOS 5.7 where applications get pwrite, not
119
 
# pwrite64, if they load the C library before the appropriate threads library,
120
 
# e.g., tclsh using dlopen to load the DB library.  By using LWP threads we
121
 
# avoid answering lots of user questions, not to mention the bugs.
122
 
if test "$db_cv_posixmutexes" = yes; then
123
 
        case "$host_os" in
124
 
        solaris*)
125
 
                db_cv_mutex="posix_library_only";;
126
 
        *)
127
 
                db_cv_mutex="posix_only";;
128
 
        esac
129
 
fi
130
 
 
131
 
if test "$db_cv_uimutexes" = yes; then
132
 
        case "$host_os" in
133
 
        solaris*)
134
 
                db_cv_mutex="ui_library_only";;
135
 
        *)
136
 
                db_cv_mutex="ui_only";;
137
 
        esac
138
 
fi
139
 
 
140
 
# LWP threads: _lwp_XXX
141
 
if test "$db_cv_mutex" = no; then
142
 
AC_TRY_LINK([
143
 
#include <synch.h>],[
144
 
        static lwp_mutex_t mi = SHAREDMUTEX;
145
 
        static lwp_cond_t ci = SHAREDCV;
146
 
        lwp_mutex_t mutex = mi;
147
 
        lwp_cond_t cond = ci;
148
 
        exit (
149
 
        _lwp_mutex_lock(&mutex) ||
150
 
        _lwp_mutex_unlock(&mutex));
151
 
], [db_cv_mutex="Solaris/lwp"])
152
 
fi
153
 
 
154
 
# UI threads: thr_XXX
155
 
#
156
 
# Try with and without the -lthread library.
157
 
if test "$db_cv_mutex" = no -o "$db_cv_mutex" = "ui_only"; then
158
 
AC_TRY_LINK([
159
 
#include <thread.h>
160
 
#include <synch.h>],[
161
 
        mutex_t mutex;
162
 
        cond_t cond;
163
 
        int type = USYNC_PROCESS;
164
 
        exit (
165
 
        mutex_init(&mutex, type, NULL) ||
166
 
        cond_init(&cond, type, NULL) ||
167
 
        mutex_lock(&mutex) ||
168
 
        mutex_unlock(&mutex));
169
 
], [db_cv_mutex="UI/threads"])
170
 
fi
171
 
if test "$db_cv_mutex" = no -o \
172
 
    "$db_cv_mutex" = "ui_only" -o "$db_cv_mutex" = "ui_library_only"; then
173
 
LIBS="$LIBS -lthread"
174
 
AC_TRY_LINK([
175
 
#include <thread.h>
176
 
#include <synch.h>],[
177
 
        mutex_t mutex;
178
 
        cond_t cond;
179
 
        int type = USYNC_PROCESS;
180
 
        exit (
181
 
        mutex_init(&mutex, type, NULL) ||
182
 
        cond_init(&cond, type, NULL) ||
183
 
        mutex_lock(&mutex) ||
184
 
        mutex_unlock(&mutex));
185
 
], [db_cv_mutex="UI/threads/library"])
186
 
LIBS="$orig_libs"
187
 
fi
188
 
if test "$db_cv_mutex" = "ui_only" -o "$db_cv_mutex" = "ui_library_only"; then
189
 
        AC_MSG_ERROR([unable to find UI mutex interfaces])
190
 
fi
191
 
 
192
 
# POSIX.1 pthreads: pthread_XXX
193
 
#
194
 
# Try with and without the -lpthread library.  If the user specified we use
195
 
# POSIX pthreads mutexes, and we fail to find the full interface, try and
196
 
# configure for just intra-process support.
197
 
if test "$db_cv_pthreadsmutexes" = yes; then
198
 
        if test "$db_cv_mutex" = no -o "$db_cv_mutex" = "posix_only"; then
199
 
                AM_PTHREADS_SHARED("POSIX/pthreads")
200
 
        fi
201
 
        if test "$db_cv_mutex" = no -o \
202
 
            "$db_cv_mutex" = "posix_only" -o \
203
 
            "$db_cv_mutex" = "posix_library_only"; then
204
 
                LIBS="$LIBS -lpthread"
205
 
                AM_PTHREADS_SHARED("POSIX/pthreads/library")
206
 
                LIBS="$orig_libs"
207
 
        fi
208
 
        if test "$db_cv_mutex" = "posix_only"; then
209
 
                AM_PTHREADS_PRIVATE("POSIX/pthreads/private")
210
 
        fi
211
 
        if test "$db_cv_mutex" = "posix_only" -o \
212
 
            "$db_cv_mutex" = "posix_library_only"; then
213
 
                LIBS="$LIBS -lpthread"
214
 
                AM_PTHREADS_PRIVATE("POSIX/pthreads/library/private")
215
 
                LIBS="$orig_libs"
216
 
        fi
217
 
 
218
 
        if test "$db_cv_mutex" = "posix_only" -o \
219
 
            "$db_cv_mutex" = "posix_library_only"; then
220
 
                AC_MSG_ERROR([unable to find POSIX 1003.1 mutex interfaces])
221
 
        fi
222
 
fi
223
 
 
224
 
# msemaphore: HPPA only
225
 
# Try HPPA before general msem test, it needs special alignment.
226
 
if test "$db_cv_mutex" = no; then
227
 
AC_TRY_LINK([
228
 
#include <sys/mman.h>],[
229
 
#if defined(__hppa__)
230
 
        typedef msemaphore tsl_t;
231
 
        msemaphore x;
232
 
        msem_init(&x, 0);
233
 
        msem_lock(&x, 0);
234
 
        msem_unlock(&x, 0);
235
 
        exit(0);
236
 
#else
237
 
        FAIL TO COMPILE/LINK
238
 
#endif
239
 
], [db_cv_mutex="HP/msem_init"])
240
 
fi
241
 
 
242
 
# msemaphore: AIX, OSF/1
243
 
if test "$db_cv_mutex" = no; then
244
 
AC_TRY_LINK([
245
 
#include <sys/types.h>
246
 
#include <sys/mman.h>],[
247
 
        typedef msemaphore tsl_t;
248
 
        msemaphore x;
249
 
        msem_init(&x, 0);
250
 
        msem_lock(&x, 0);
251
 
        msem_unlock(&x, 0);
252
 
        exit(0);
253
 
], [db_cv_mutex="UNIX/msem_init"])
254
 
fi
255
 
 
256
 
# ReliantUNIX
257
 
if test "$db_cv_mutex" = no; then
258
 
LIBS="$LIBS -lmproc"
259
 
AC_TRY_LINK([
260
 
#include <ulocks.h>],[
261
 
        typedef spinlock_t tsl_t;
262
 
        spinlock_t x;
263
 
        initspin(&x, 1);
264
 
        cspinlock(&x);
265
 
        spinunlock(&x);
266
 
], [db_cv_mutex="ReliantUNIX/initspin"])
267
 
LIBS="$orig_libs"
268
 
fi
269
 
 
270
 
# SCO: UnixWare has threads in libthread, but OpenServer doesn't.
271
 
if test "$db_cv_mutex" = no; then
272
 
AC_TRY_COMPILE(,[
273
 
#if defined(__USLC__)
274
 
        exit(0);
275
 
#else
276
 
        FAIL TO COMPILE/LINK
277
 
#endif
278
 
], [db_cv_mutex="SCO/x86/cc-assembly"])
279
 
fi
280
 
 
281
 
# abilock_t: SGI
282
 
if test "$db_cv_mutex" = no; then
283
 
AC_TRY_LINK([
284
 
#include <abi_mutex.h>],[
285
 
        typedef abilock_t tsl_t;
286
 
        abilock_t x;
287
 
        init_lock(&x);
288
 
        acquire_lock(&x);
289
 
        release_lock(&x);
290
 
], [db_cv_mutex="SGI/init_lock"])
291
 
fi
292
 
 
293
 
# sema_t: Solaris
294
 
# The sema_XXX calls do not work on Solaris 5.5.  I see no reason to ever
295
 
# turn this test on, unless we find some other platform that uses the old
296
 
# POSIX.1 interfaces.  (I plan to move directly to pthreads on Solaris.)
297
 
if test "$db_cv_mutex" = DOESNT_WORK; then
298
 
AC_TRY_LINK([
299
 
#include <synch.h>],[
300
 
        typedef sema_t tsl_t;
301
 
        sema_t x;
302
 
        sema_init(&x, 1, USYNC_PROCESS, NULL);
303
 
        sema_wait(&x);
304
 
        sema_post(&x);
305
 
], [db_cv_mutex="UNIX/sema_init"])
306
 
fi
307
 
 
308
 
# _lock_try/_lock_clear: Solaris
309
 
# On Solaris systems without Pthread or UI mutex interfaces, DB uses the
310
 
# undocumented _lock_try _lock_clear function calls instead of either the
311
 
# sema_trywait(3T) or sema_wait(3T) function calls.  This is because of
312
 
# problems in those interfaces in some releases of the Solaris C library.
313
 
if test "$db_cv_mutex" = no; then
314
 
AC_TRY_LINK([
315
 
#include <sys/machlock.h>],[
316
 
        typedef lock_t tsl_t;
317
 
        lock_t x;
318
 
        _lock_try(&x);
319
 
        _lock_clear(&x);
320
 
], [db_cv_mutex="Solaris/_lock_try"])
321
 
fi
322
 
 
323
 
# _check_lock/_clear_lock: AIX
324
 
if test "$db_cv_mutex" = no; then
325
 
AC_TRY_LINK([
326
 
#include <sys/atomic_op.h>],[
327
 
        int x;
328
 
        _check_lock(&x,0,1);
329
 
        _clear_lock(&x,0);
330
 
], [db_cv_mutex="AIX/_check_lock"])
331
 
fi
332
 
 
333
 
# Alpha/gcc: OSF/1
334
 
if test "$db_cv_mutex" = no; then
335
 
AC_TRY_COMPILE(,[
336
 
#if defined(__alpha) && defined(__GNUC__)
337
 
        exit(0);
338
 
#else
339
 
        FAIL TO COMPILE/LINK
340
 
#endif
341
 
], [db_cv_mutex="ALPHA/gcc-assembly"])
342
 
fi
343
 
 
344
 
# ARM/gcc: Linux
345
 
if test "$db_cv_mutex" = no; then
346
 
AC_TRY_COMPILE(,[
347
 
#if defined(__arm__) && defined(__GNUC__)
348
 
        exit(0);
349
 
#else
350
 
        FAIL TO COMPILE/LINK
351
 
#endif
352
 
], [db_cv_mutex="ARM/gcc-assembly"])
353
 
fi
354
 
 
355
 
# MIPS/gcc: Linux
356
 
if test "$db_cv_mutex" = no; then
357
 
AC_TRY_COMPILE(,[
358
 
#if (defined(__mips) || defined(__mips__)) && defined(__GNUC__)
359
 
        exit(0);
360
 
#else
361
 
        FAIL TO COMPILE/LINK
362
 
#endif
363
 
], [db_cv_mutex="MIPS/gcc-assembly"])
364
 
fi
365
 
 
366
 
# PaRisc/gcc: HP/UX
367
 
if test "$db_cv_mutex" = no; then
368
 
AC_TRY_COMPILE(,[
369
 
#if (defined(__hppa) || defined(__hppa__)) && defined(__GNUC__)
370
 
        exit(0);
371
 
#else
372
 
        FAIL TO COMPILE/LINK
373
 
#endif
374
 
], [db_cv_mutex="HPPA/gcc-assembly"])
375
 
fi
376
 
 
377
 
# PPC/gcc:
378
 
# Test for Apple first, it requires slightly different assembly.
379
 
if test "$db_cv_mutex" = no; then
380
 
AC_TRY_COMPILE(,[
381
 
#if (defined(__powerpc__) || defined(__ppc__)) && defined(__GNUC__) && defined(__APPLE__)
382
 
        exit(0);
383
 
#else
384
 
        FAIL TO COMPILE/LINK
385
 
#endif
386
 
], [db_cv_mutex="PPC_APPLE/gcc-assembly"])
387
 
fi
388
 
if test "$db_cv_mutex" = no; then
389
 
AC_TRY_COMPILE(,[
390
 
#if (defined(__powerpc__) || defined(__ppc__)) && defined(__GNUC__)
391
 
        exit(0);
392
 
#else
393
 
        FAIL TO COMPILE/LINK
394
 
#endif
395
 
], [db_cv_mutex="PPC_GENERIC/gcc-assembly"])
396
 
fi
397
 
 
398
 
# Sparc/gcc: SunOS, Solaris
399
 
if test "$db_cv_mutex" = no; then
400
 
AC_TRY_COMPILE(,[
401
 
#if defined(__sparc__) && defined(__GNUC__)
402
 
        exit(0);
403
 
#else
404
 
        FAIL TO COMPILE/LINK
405
 
#endif
406
 
], [db_cv_mutex="Sparc/gcc-assembly"])
407
 
fi
408
 
 
409
 
# 68K/gcc: SunOS
410
 
if test "$db_cv_mutex" = no; then
411
 
AC_TRY_COMPILE(,[
412
 
#if (defined(mc68020) || defined(sun3)) && defined(__GNUC__)
413
 
        exit(0);
414
 
#else
415
 
        FAIL TO COMPILE/LINK
416
 
#endif
417
 
], [db_cv_mutex="68K/gcc-assembly"])
418
 
fi
419
 
 
420
 
# x86/gcc: FreeBSD, NetBSD, BSD/OS, Linux
421
 
if test "$db_cv_mutex" = no; then
422
 
AC_TRY_COMPILE(,[
423
 
#if (defined(i386) || defined(__i386__)) && defined(__GNUC__)
424
 
        exit(0);
425
 
#else
426
 
        FAIL TO COMPILE/LINK
427
 
#endif
428
 
], [db_cv_mutex="x86/gcc-assembly"])
429
 
fi
430
 
 
431
 
# S390/gcc: Linux
432
 
if test "$db_cv_mutex" = no; then
433
 
AC_TRY_COMPILE(,[
434
 
#if defined(__s390__) && defined(__GNUC__)
435
 
        exit(0);
436
 
#else
437
 
        FAIL TO COMPILE/LINK
438
 
#endif
439
 
], [db_cv_mutex="S390/gcc-assembly"])
440
 
fi
441
 
 
442
 
# AMD64/gcc: FreeBSD, NetBSD, BSD/OS, Linux
443
 
if test "$db_cv_mutex" = no; then
444
 
AC_TRY_COMPILE(,[
445
 
#if (defined(x86_64) || defined(__x86_64__)) && defined(__GNUC__)
446
 
        exit(0);
447
 
#else
448
 
        FAIL TO COMPILE/LINK
449
 
#endif
450
 
], [db_cv_mutex="x86_64/gcc-assembly"])
451
 
fi
452
 
 
453
 
# x86-64/gcc: FreeBSD, NetBSD, BSD/OS, Linux
454
 
if test "$db_cv_mutex" = no; then
455
 
AC_TRY_RUN([main(){
456
 
#if defined(__x86_64__)
457
 
#if defined(__GNUC__)
458
 
        exit(0);
459
 
#endif
460
 
#endif
461
 
        exit(1);
462
 
}], [db_cv_mutex="x86_64/gcc-assembly"])
463
 
fi
464
 
 
465
 
# ia86/gcc: Linux
466
 
if test "$db_cv_mutex" = no; then
467
 
AC_TRY_COMPILE(,[
468
 
#if defined(__ia64) && defined(__GNUC__)
469
 
        exit(0);
470
 
#else
471
 
        FAIL TO COMPILE/LINK
472
 
#endif
473
 
], [db_cv_mutex="ia64/gcc-assembly"])
474
 
fi
475
 
 
476
 
dnl alphalinux/gcc: Linux
477
 
if test "$db_cv_mutex" = no; then
478
 
AC_TRY_RUN([main(){
479
 
#if defined(__alpha__)
480
 
#if defined(__linux__)
481
 
       exit(0);
482
 
#endif
483
 
#endif
484
 
       exit(1);
485
 
}], [db_cv_mutex="alphalinux/gcc-assembly"])
486
 
fi
487
 
 
488
 
dnl sparc32linux/gcc: Linux
489
 
if test "$db_cv_mutex" = no; then
490
 
AC_TRY_RUN([main(){
491
 
#if defined(__sparc__) && !defined(__arch64__)
492
 
#if defined(__linux__)
493
 
       exit(0);
494
 
#endif
495
 
#endif
496
 
       exit(1);
497
 
}], [db_cv_mutex="sparc32linux/gcc-assembly"])
498
 
fi
499
 
 
500
 
dnl sparc64linux/gcc: Linux
501
 
if test "$db_cv_mutex" = no; then
502
 
AC_TRY_RUN([main(){
503
 
#if defined(__sparc__) && defined(__arch64__)
504
 
#if defined(__linux__)
505
 
       exit(0);
506
 
#endif
507
 
#endif
508
 
       exit(1);
509
 
}], [db_cv_mutex="sparc64linux/gcc-assembly"])
510
 
fi
511
 
 
512
 
dnl s390linux/gcc: Linux
513
 
if test "$db_cv_mutex" = no; then
514
 
AC_TRY_RUN([main(){
515
 
#if defined(__linux__) && defined(__s390__)
516
 
       exit(0);
517
 
#endif
518
 
       exit(1);
519
 
}], [db_cv_mutex="s390linux/gcc-assembly"])
520
 
fi
521
 
 
522
 
 
523
 
# uts/cc: UTS
524
 
if test "$db_cv_mutex" = no; then
525
 
AC_TRY_COMPILE(,[
526
 
#if defined(_UTS)
527
 
        exit(0);
528
 
#else
529
 
        FAIL TO COMPILE/LINK
530
 
#endif
531
 
], [db_cv_mutex="UTS/cc-assembly"])
532
 
fi
533
 
 
534
 
# default to UNIX fcntl system call mutexes.
535
 
if test "$db_cv_mutex" = no; then
536
 
        db_cv_mutex="UNIX/fcntl"
537
 
fi
538
 
])
539
 
 
540
 
case "$db_cv_mutex" in
541
 
68K/gcc-assembly)       ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
542
 
                        AC_DEFINE(HAVE_MUTEX_68K_GCC_ASSEMBLY)
543
 
                        AH_TEMPLATE(HAVE_MUTEX_68K_GCC_ASSEMBLY,
544
 
                            [Define to 1 to use the GCC compiler and 68K assembly language mutexes.]);;
545
 
AIX/_check_lock)        ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
546
 
                        AC_DEFINE(HAVE_MUTEX_AIX_CHECK_LOCK)
547
 
                        AH_TEMPLATE(HAVE_MUTEX_AIX_CHECK_LOCK,
548
 
                            [Define to 1 to use the AIX _check_lock mutexes.]);;
549
 
ALPHA/gcc-assembly)     ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
550
 
                        AC_DEFINE(HAVE_MUTEX_ALPHA_GCC_ASSEMBLY)
551
 
                        AH_TEMPLATE(HAVE_MUTEX_ALPHA_GCC_ASSEMBLY,
552
 
                            [Define to 1 to use the GCC compiler and Alpha assembly language mutexes.]);;
553
 
ARM/gcc-assembly)       ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
554
 
                        AC_DEFINE(HAVE_MUTEX_ARM_GCC_ASSEMBLY)
555
 
                        AH_TEMPLATE(HAVE_MUTEX_ARM_GCC_ASSEMBLY,
556
 
                            [Define to 1 to use the GCC compiler and ARM assembly language mutexes.]);;
557
 
HP/msem_init)           ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
558
 
                        AC_DEFINE(HAVE_MUTEX_HPPA_MSEM_INIT)
559
 
                        AH_TEMPLATE(HAVE_MUTEX_HPPA_MSEM_INIT,
560
 
                            [Define to 1 to use the msem_XXX mutexes on HP-UX.]);;
561
 
HPPA/gcc-assembly)      ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
562
 
                        AC_DEFINE(HAVE_MUTEX_HPPA_GCC_ASSEMBLY)
563
 
                        AH_TEMPLATE(HAVE_MUTEX_HPPA_GCC_ASSEMBLY,
564
 
                            [Define to 1 to use the GCC compiler and PaRisc assembly language mutexes.]);;
565
 
ia64/gcc-assembly)      ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
566
 
                        AC_DEFINE(HAVE_MUTEX_IA64_GCC_ASSEMBLY)
567
 
                        AH_TEMPLATE(HAVE_MUTEX_IA64_GCC_ASSEMBLY,
568
 
                            [Define to 1 to use the GCC compiler and IA64 assembly language mutexes.]);;
569
 
POSIX/pthreads)         ADDITIONAL_OBJS="mut_pthread${o} $ADDITIONAL_OBJS"
570
 
                        AC_DEFINE(HAVE_MUTEX_PTHREADS)
571
 
                        AH_TEMPLATE(HAVE_MUTEX_PTHREADS,
572
 
                            [Define to 1 to use POSIX 1003.1 pthread_XXX mutexes.]);;
573
 
POSIX/pthreads/private) ADDITIONAL_OBJS="mut_pthread${o} $ADDITIONAL_OBJS"
574
 
                        AC_DEFINE(HAVE_MUTEX_PTHREADS)
575
 
                        AH_TEMPLATE(HAVE_MUTEX_PTHREADS,
576
 
                            [Define to 1 to use POSIX 1003.1 pthread_XXX mutexes.])
577
 
                        AC_DEFINE(HAVE_MUTEX_THREAD_ONLY)
578
 
                        AH_TEMPLATE(HAVE_MUTEX_THREAD_ONLY,
579
 
                            [Define to 1 to configure mutexes intra-process only.]);;
580
 
POSIX/pthreads/library) LIBS="$LIBS -lpthread"
581
 
                        ADDITIONAL_OBJS="mut_pthread${o} $ADDITIONAL_OBJS"
582
 
                        AC_DEFINE(HAVE_MUTEX_PTHREADS)
583
 
                        AH_TEMPLATE(HAVE_MUTEX_PTHREADS,
584
 
                            [Define to 1 to use POSIX 1003.1 pthread_XXX mutexes.]);;
585
 
POSIX/pthreads/library/private)
586
 
                        LIBS="$LIBS -lpthread"
587
 
                        ADDITIONAL_OBJS="mut_pthread${o} $ADDITIONAL_OBJS"
588
 
                        AC_DEFINE(HAVE_MUTEX_PTHREADS)
589
 
                        AH_TEMPLATE(HAVE_MUTEX_PTHREADS,
590
 
                            [Define to 1 to use POSIX 1003.1 pthread_XXX mutexes.])
591
 
                        AC_DEFINE(HAVE_MUTEX_THREAD_ONLY)
592
 
                        AH_TEMPLATE(HAVE_MUTEX_THREAD_ONLY,
593
 
                            [Define to 1 to configure mutexes intra-process only.]);;
594
 
PPC_GENERIC/gcc-assembly)
595
 
                        ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
596
 
                        AC_DEFINE(HAVE_MUTEX_PPC_GENERIC_GCC_ASSEMBLY)
597
 
                        AH_TEMPLATE(HAVE_MUTEX_PPC_GENERIC_GCC_ASSEMBLY,
598
 
                            [Define to 1 to use the GCC compiler and generic PowerPC assembly language.]);;
599
 
PPC_APPLE/gcc-assembly) ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
600
 
                        AC_DEFINE(HAVE_MUTEX_PPC_APPLE_GCC_ASSEMBLY)
601
 
                        AH_TEMPLATE(HAVE_MUTEX_PPC_APPLE_GCC_ASSEMBLY,
602
 
                            [Define to 1 to use the GCC compiler and Apple PowerPC assembly language.]);;
603
 
ReliantUNIX/initspin)   LIBS="$LIBS -lmproc"
604
 
                        ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
605
 
                        AC_DEFINE(HAVE_MUTEX_RELIANTUNIX_INITSPIN)
606
 
                        AH_TEMPLATE(HAVE_MUTEX_RELIANTUNIX_INITSPIN,
607
 
                            [Define to 1 to use Reliant UNIX initspin mutexes.]);;
608
 
S390/gcc-assembly)      ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
609
 
                        AC_DEFINE(HAVE_MUTEX_S390_GCC_ASSEMBLY)
610
 
                        AH_TEMPLATE(HAVE_MUTEX_S390_GCC_ASSEMBLY,
611
 
                            [Define to 1 to use the GCC compiler and S/390 assembly language mutexes.]);;
612
 
SCO/x86/cc-assembly)    ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
613
 
                        AC_DEFINE(HAVE_MUTEX_SCO_X86_CC_ASSEMBLY)
614
 
                        AH_TEMPLATE(HAVE_MUTEX_SCO_X86_CC_ASSEMBLY,
615
 
                            [Define to 1 to use the SCO compiler and x86 assembly language mutexes.]);;
616
 
SGI/init_lock)          ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
617
 
                        AC_DEFINE(HAVE_MUTEX_SGI_INIT_LOCK)
618
 
                        AH_TEMPLATE(HAVE_MUTEX_SGI_INIT_LOCK,
619
 
                            [Define to 1 to use the SGI XXX_lock mutexes.]);;
620
 
Solaris/_lock_try)      ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
621
 
                        AC_DEFINE(HAVE_MUTEX_SOLARIS_LOCK_TRY)
622
 
                        AH_TEMPLATE(HAVE_MUTEX_SOLARIS_LOCK_TRY,
623
 
                            [Define to 1 to use the Solaris _lock_XXX mutexes.]);;
624
 
Solaris/lwp)            ADDITIONAL_OBJS="mut_pthread${o} $ADDITIONAL_OBJS"
625
 
                        AC_DEFINE(HAVE_MUTEX_SOLARIS_LWP)
626
 
                        AH_TEMPLATE(HAVE_MUTEX_SOLARIS_LWP,
627
 
                            [Define to 1 to use the Solaris lwp threads mutexes.]);;
628
 
Sparc/gcc-assembly)     ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
629
 
                        AC_DEFINE(HAVE_MUTEX_SPARC_GCC_ASSEMBLY)
630
 
                        AH_TEMPLATE(HAVE_MUTEX_SPARC_GCC_ASSEMBLY,
631
 
                            [Define to 1 to use the GCC compiler and Sparc assembly language mutexes.]);;
632
 
UI/threads)             ADDITIONAL_OBJS="mut_pthread${o} $ADDITIONAL_OBJS"
633
 
                        AC_DEFINE(HAVE_MUTEX_UI_THREADS)
634
 
                        AH_TEMPLATE(HAVE_MUTEX_UI_THREADS,
635
 
                            [Define to 1 to use the UNIX International mutexes.]);;
636
 
UI/threads/library)     LIBS="$LIBS -lthread"
637
 
                        ADDITIONAL_OBJS="mut_pthread${o} $ADDITIONAL_OBJS"
638
 
                        AC_DEFINE(HAVE_MUTEX_UI_THREADS)
639
 
                        AH_TEMPLATE(HAVE_MUTEX_UI_THREADS,
640
 
                            [Define to 1 to use the UNIX International mutexes.]);;
641
 
UNIX/msem_init)         ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
642
 
                        AC_DEFINE(HAVE_MUTEX_MSEM_INIT)
643
 
                        AH_TEMPLATE(HAVE_MUTEX_MSEM_INIT,
644
 
                            [Define to 1 to use the msem_XXX mutexes on systems other than HP-UX.]);;
645
 
UNIX/sema_init)         ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
646
 
                        AC_DEFINE(HAVE_MUTEX_SEMA_INIT)
647
 
                        AH_TEMPLATE(HAVE_MUTEX_SEMA_INIT,
648
 
                            [Define to 1 to use the obsolete POSIX 1003.1 sema_XXX mutexes.]);;
649
 
UTS/cc-assembly)        ADDITIONAL_OBJS="$ADDITIONAL_OBJS uts4.cc${o}"
650
 
                        AC_DEFINE(HAVE_MUTEX_UTS_CC_ASSEMBLY)
651
 
                        AH_TEMPLATE(HAVE_MUTEX_UTS_CC_ASSEMBLY,
652
 
                            [Define to 1 to use the UTS compiler and assembly language mutexes.]);;
653
 
MIPS/gcc-assembly)      ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
654
 
                        AC_DEFINE(HAVE_MUTEX_MIPS_GCC_ASSEMBLY)
655
 
                        AH_TEMPLATE(HAVE_MUTEX_MIPS_GCC_ASSEMBLY,
656
 
                            [Define to 1 to use the GCC compiler and Mips assembly language mutexes.]);;
657
 
x86/gcc-assembly)       ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
658
 
                        AC_DEFINE(HAVE_MUTEX_X86_GCC_ASSEMBLY)
659
 
                        AH_TEMPLATE(HAVE_MUTEX_X86_GCC_ASSEMBLY,
660
 
                            [Define to 1 to use the GCC compiler and x86 assembly language mutexes.]);;
661
 
x86_64/gcc-assembly)    ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
662
 
                        AC_DEFINE(HAVE_MUTEX_X86_64_GCC_ASSEMBLY)
663
 
                        AH_TEMPLATE(HAVE_MUTEX_X86_64_GCC_ASSEMBLY,
664
 
                            [Define to 1 to use the GCC compiler and amd64 assembly language mutexes.]);;
665
 
alphalinux/gcc-assembly)        ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
666
 
                        AC_DEFINE(HAVE_MUTEX_ALPHA_LINUX_ASSEMBLY)
667
 
                        AH_TEMPLATE(HAVE_MUTEX_ALPHA_LINUX_ASSEMBLY,
668
 
                           [Define to use the GCC compiler and alpha assembly language mutexes.]);;
669
 
sparc32linux/gcc-assembly)      ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
670
 
                        AC_DEFINE(HAVE_MUTEX_SPARC32_LINUX_ASSEMBLY)
671
 
                        AH_TEMPLATE(HAVE_MUTEX_SPARC32_LINUX_ASSEMBLY,
672
 
                           [Define to use the GCC compiler and sparc64 assembly language mutexes.]);;
673
 
sparc64linux/gcc-assembly)      ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
674
 
                        AC_DEFINE(HAVE_MUTEX_SPARC64_LINUX_ASSEMBLY)
675
 
                        AH_TEMPLATE(HAVE_MUTEX_SPARC64_LINUX_ASSEMBLY,
676
 
                           [Define to use the GCC compiler and sparc64 assembly language mutexes.]);;
677
 
s390linux/gcc-assembly) ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
678
 
                        AC_DEFINE(HAVE_MUTEX_S390_LINUX_ASSEMBLY)
679
 
                        AH_TEMPLATE(HAVE_MUTEX_S390_LINUX_ASSEMBLY,
680
 
                           [Define to use the GCC compiler and s390 assembly language mutexes.]);;
681
 
UNIX/fcntl)             AC_MSG_WARN(
682
 
                            [NO FAST MUTEXES FOUND FOR THIS COMPILER/ARCHITECTURE.])
683
 
                        ADDITIONAL_OBJS="mut_fcntl${o} $ADDITIONAL_OBJS"
684
 
                        AC_DEFINE(HAVE_MUTEX_FCNTL)
685
 
                        AH_TEMPLATE(HAVE_MUTEX_FCNTL,
686
 
                            [Define to 1 to use the UNIX fcntl system call mutexes.]);;
687
 
*)                      AC_MSG_ERROR([Unknown mutex interface: $db_cv_mutex]);;
688
 
esac
689
 
 
690
 
if test "$db_cv_mutex" != "UNIX/fcntl"; then
691
 
        AC_DEFINE(HAVE_MUTEX_THREADS)
692
 
        AH_TEMPLATE(HAVE_MUTEX_THREADS,
693
 
            [Define to 1 if fast mutexes are available.])
694
 
fi
695
 
 
696
 
# There are 3 classes of mutexes:
697
 
#
698
 
# 1: Mutexes requiring no cleanup, for example, test-and-set mutexes.
699
 
# 2: Mutexes that must be destroyed, but which don't hold permanent system
700
 
#    resources, for example, pthread mutexes on MVS aka OS/390 aka z/OS.
701
 
# 3: Mutexes that must be destroyed, even after the process is gone, for
702
 
#    example, pthread mutexes on QNX and binary semaphores on VxWorks.
703
 
#
704
 
# DB cannot currently distinguish between #2 and #3 because DB does not know
705
 
# if the application is running environment recovery as part of startup and
706
 
# does not need to do cleanup, or if the environment is being removed and/or
707
 
# recovered in a loop in the application, and so does need to clean up.  If
708
 
# we get it wrong, we're going to call the mutex destroy routine on a random
709
 
# piece of memory, which usually works, but just might drop core.  For now,
710
 
# we group #2 and #3 into the HAVE_MUTEX_SYSTEM_RESOURCES define, until we
711
 
# have a better solution or reason to solve this in a general way -- so far,
712
 
# the places we've needed to handle this are few.
713
 
AH_TEMPLATE(HAVE_MUTEX_SYSTEM_RESOURCES,
714
 
    [Define to 1 if mutexes hold system resources.])
715
 
 
716
 
case "$host_os$db_cv_mutex" in
717
 
*qnx*POSIX/pthread*|openedition*POSIX/pthread*)
718
 
        AC_DEFINE(HAVE_MUTEX_SYSTEM_RESOURCES);;
719
 
esac])