3
# POSIX pthreads tests: inter-process safe and intra-process only.
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:
13
# If checking for inter-process pthreads mutexes:
14
# If it's local, run a test.
15
# If it's a cross-compilation, fail.
17
# If the user specified pthreads mutexes and we're checking for intra-process
19
# If it's local, run a test.
20
# If it's a cross-compilation, run a link-test.
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
26
AC_DEFUN(AM_PTHREADS_SHARED, [
31
pthread_mutex_t mutex;
32
pthread_condattr_t condattr;
33
pthread_mutexattr_t mutexattr;
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, [
53
pthread_mutex_t mutex;
54
pthread_condattr_t condattr;
55
pthread_mutexattr_t mutexattr;
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"],,
69
#include <pthread.h>],[
71
pthread_mutex_t mutex;
72
pthread_condattr_t condattr;
73
pthread_mutexattr_t mutexattr;
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"]))])
87
# Figure out mutexes for this compiler/architecture.
88
AC_DEFUN(AM_DEFINE_MUTEXES, [
90
# Mutexes we don't test for, but want the #defines to exist for
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.])
96
AC_CACHE_CHECK([for mutexes], db_cv_mutex, [
101
# User-specified POSIX or UI mutexes.
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
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
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
125
db_cv_mutex="posix_library_only";;
127
db_cv_mutex="posix_only";;
131
if test "$db_cv_uimutexes" = yes; then
134
db_cv_mutex="ui_library_only";;
136
db_cv_mutex="ui_only";;
140
# LWP threads: _lwp_XXX
141
if test "$db_cv_mutex" = no; then
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;
149
_lwp_mutex_lock(&mutex) ||
150
_lwp_mutex_unlock(&mutex));
151
], [db_cv_mutex="Solaris/lwp"])
154
# UI threads: thr_XXX
156
# Try with and without the -lthread library.
157
if test "$db_cv_mutex" = no -o "$db_cv_mutex" = "ui_only"; then
160
#include <synch.h>],[
163
int type = USYNC_PROCESS;
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"])
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"
176
#include <synch.h>],[
179
int type = USYNC_PROCESS;
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"])
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])
192
# POSIX.1 pthreads: pthread_XXX
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")
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")
208
if test "$db_cv_mutex" = "posix_only"; then
209
AM_PTHREADS_PRIVATE("POSIX/pthreads/private")
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")
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])
224
# msemaphore: HPPA only
225
# Try HPPA before general msem test, it needs special alignment.
226
if test "$db_cv_mutex" = no; then
228
#include <sys/mman.h>],[
229
#if defined(__hppa__)
230
typedef msemaphore tsl_t;
239
], [db_cv_mutex="HP/msem_init"])
242
# msemaphore: AIX, OSF/1
243
if test "$db_cv_mutex" = no; then
245
#include <sys/types.h>
246
#include <sys/mman.h>],[
247
typedef msemaphore tsl_t;
253
], [db_cv_mutex="UNIX/msem_init"])
257
if test "$db_cv_mutex" = no; then
260
#include <ulocks.h>],[
261
typedef spinlock_t tsl_t;
266
], [db_cv_mutex="ReliantUNIX/initspin"])
270
# SCO: UnixWare has threads in libthread, but OpenServer doesn't.
271
if test "$db_cv_mutex" = no; then
273
#if defined(__USLC__)
278
], [db_cv_mutex="SCO/x86/cc-assembly"])
282
if test "$db_cv_mutex" = no; then
284
#include <abi_mutex.h>],[
285
typedef abilock_t tsl_t;
290
], [db_cv_mutex="SGI/init_lock"])
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
299
#include <synch.h>],[
300
typedef sema_t tsl_t;
302
sema_init(&x, 1, USYNC_PROCESS, NULL);
305
], [db_cv_mutex="UNIX/sema_init"])
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
315
#include <sys/machlock.h>],[
316
typedef lock_t tsl_t;
320
], [db_cv_mutex="Solaris/_lock_try"])
323
# _check_lock/_clear_lock: AIX
324
if test "$db_cv_mutex" = no; then
326
#include <sys/atomic_op.h>],[
330
], [db_cv_mutex="AIX/_check_lock"])
334
if test "$db_cv_mutex" = no; then
336
#if defined(__alpha) && defined(__GNUC__)
341
], [db_cv_mutex="ALPHA/gcc-assembly"])
345
if test "$db_cv_mutex" = no; then
347
#if defined(__arm__) && defined(__GNUC__)
352
], [db_cv_mutex="ARM/gcc-assembly"])
356
if test "$db_cv_mutex" = no; then
358
#if (defined(__mips) || defined(__mips__)) && defined(__GNUC__)
363
], [db_cv_mutex="MIPS/gcc-assembly"])
367
if test "$db_cv_mutex" = no; then
369
#if (defined(__hppa) || defined(__hppa__)) && defined(__GNUC__)
374
], [db_cv_mutex="HPPA/gcc-assembly"])
378
# Test for Apple first, it requires slightly different assembly.
379
if test "$db_cv_mutex" = no; then
381
#if (defined(__powerpc__) || defined(__ppc__)) && defined(__GNUC__) && defined(__APPLE__)
386
], [db_cv_mutex="PPC_APPLE/gcc-assembly"])
388
if test "$db_cv_mutex" = no; then
390
#if (defined(__powerpc__) || defined(__ppc__)) && defined(__GNUC__)
395
], [db_cv_mutex="PPC_GENERIC/gcc-assembly"])
398
# Sparc/gcc: SunOS, Solaris
399
if test "$db_cv_mutex" = no; then
401
#if defined(__sparc__) && defined(__GNUC__)
406
], [db_cv_mutex="Sparc/gcc-assembly"])
410
if test "$db_cv_mutex" = no; then
412
#if (defined(mc68020) || defined(sun3)) && defined(__GNUC__)
417
], [db_cv_mutex="68K/gcc-assembly"])
420
# x86/gcc: FreeBSD, NetBSD, BSD/OS, Linux
421
if test "$db_cv_mutex" = no; then
423
#if (defined(i386) || defined(__i386__)) && defined(__GNUC__)
428
], [db_cv_mutex="x86/gcc-assembly"])
432
if test "$db_cv_mutex" = no; then
434
#if defined(__s390__) && defined(__GNUC__)
439
], [db_cv_mutex="S390/gcc-assembly"])
442
# AMD64/gcc: FreeBSD, NetBSD, BSD/OS, Linux
443
if test "$db_cv_mutex" = no; then
445
#if (defined(x86_64) || defined(__x86_64__)) && defined(__GNUC__)
450
], [db_cv_mutex="x86_64/gcc-assembly"])
453
# x86-64/gcc: FreeBSD, NetBSD, BSD/OS, Linux
454
if test "$db_cv_mutex" = no; then
456
#if defined(__x86_64__)
457
#if defined(__GNUC__)
462
}], [db_cv_mutex="x86_64/gcc-assembly"])
466
if test "$db_cv_mutex" = no; then
468
#if defined(__ia64) && defined(__GNUC__)
473
], [db_cv_mutex="ia64/gcc-assembly"])
476
dnl alphalinux/gcc: Linux
477
if test "$db_cv_mutex" = no; then
479
#if defined(__alpha__)
480
#if defined(__linux__)
485
}], [db_cv_mutex="alphalinux/gcc-assembly"])
488
dnl sparc32linux/gcc: Linux
489
if test "$db_cv_mutex" = no; then
491
#if defined(__sparc__) && !defined(__arch64__)
492
#if defined(__linux__)
497
}], [db_cv_mutex="sparc32linux/gcc-assembly"])
500
dnl sparc64linux/gcc: Linux
501
if test "$db_cv_mutex" = no; then
503
#if defined(__sparc__) && defined(__arch64__)
504
#if defined(__linux__)
509
}], [db_cv_mutex="sparc64linux/gcc-assembly"])
512
dnl s390linux/gcc: Linux
513
if test "$db_cv_mutex" = no; then
515
#if defined(__linux__) && defined(__s390__)
519
}], [db_cv_mutex="s390linux/gcc-assembly"])
524
if test "$db_cv_mutex" = no; then
531
], [db_cv_mutex="UTS/cc-assembly"])
534
# default to UNIX fcntl system call mutexes.
535
if test "$db_cv_mutex" = no; then
536
db_cv_mutex="UNIX/fcntl"
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]);;
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.])
696
# There are 3 classes of mutexes:
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.
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.])
716
case "$host_os$db_cv_mutex" in
717
*qnx*POSIX/pthread*|openedition*POSIX/pthread*)
718
AC_DEFINE(HAVE_MUTEX_SYSTEM_RESOURCES);;