summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortrawick <trawick@13f79535-47bb-0310-9956-ffa450edef68>2001-06-26 15:07:31 +0000
committertrawick <trawick@13f79535-47bb-0310-9956-ffa450edef68>2001-06-26 15:07:31 +0000
commitfea7e8783739d986f0e7438c1eb1491a93410917 (patch)
tree3f783a44fc8ac57e363cf367bd4b6f30b4c6d3eb
parent7609814b51ea4b1da52ba79ad6b213726aeda684 (diff)
downloadlibapr-fea7e8783739d986f0e7438c1eb1491a93410917.tar.gz
Export APR_HAS_foo_SERIALIZE symbols from APR so apps can tell which lock
mechanisms are available. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@61798 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--configure.in17
-rw-r--r--include/apr.h.in5
-rw-r--r--include/apr.hw5
-rw-r--r--include/arch/unix/locks.h23
4 files changed, 30 insertions, 20 deletions
diff --git a/configure.in b/configure.in
index 83446a237..2f5e419e2 100644
--- a/configure.in
+++ b/configure.in
@@ -938,11 +938,22 @@ if test "$threads" = "1"; then
APR_CHECK_DEFINE(PTHREAD_PROCESS_SHARED, pthread.h)
fi
+# See which lock mechanisms we can support on this system.
+hassysvser="0"
+hasflockser="0"
+hasfcntlser="0"
+hasprocpthreadser="0"
+APR_IFALLYES(func:semget func:semctl, hassysvser="1")
+APR_IFALLYES(func:flock define:LOCK_EX, hasflockser="1")
+APR_IFALLYES(header:fcntl.h define:F_SETLK, hasfcntlser="1")
+APR_IFALLYES(header:pthread.h define:PTHREAD_PROCESS_SHARED, hasprocpthreadser="1")
+
+# See which lock mechanism we'll select by default on this system.
# The last APR_DECIDE to execute sets the default
APR_BEGIN_DECISION([apr_lock implementation method])
APR_IFALLYES(func:semget func:semctl,
APR_DECIDE(USE_SYSVSEM_SERIALIZE, [SysV IPC semget()]))
-APR_IFALLYES(header:sys/file.h define:LOCK_EX,
+APR_IFALLYES(func:flock define:LOCK_EX,
APR_DECIDE(USE_FLOCK_SERIALIZE, [4.2BSD-style flock()]))
APR_IFALLYES(header:fcntl.h define:F_SETLK,
APR_DECIDE(USE_FCNTL_SERIALIZE, [SVR4-style fcntl()]))
@@ -980,6 +991,10 @@ else
lockcreatenp="1"
fi
+AC_SUBST(hasflockser)
+AC_SUBST(hassysvser)
+AC_SUBST(hasfcntlser)
+AC_SUBST(hasprocpthreadser)
AC_SUBST(flockser)
AC_SUBST(sysvser)
AC_SUBST(fcntlser)
diff --git a/include/apr.h.in b/include/apr.h.in
index db8277db1..ae898d3d8 100644
--- a/include/apr.h.in
+++ b/include/apr.h.in
@@ -64,6 +64,11 @@
#define APR_USE_PROC_PTHREAD_SERIALIZE @procpthreadser@
#define APR_USE_PTHREAD_SERIALIZE @pthreadser@
+#define APR_HAS_FLOCK_SERIALIZE @hasflockser@
+#define APR_HAS_SYSVSEM_SERIALIZE @hassysvser@
+#define APR_HAS_FCNTL_SERIALIZE @hasfcntlser@
+#define APR_HAS_PROC_PTHREAD_SERIALIZE @hasprocpthreadser@
+
#define APR_HAS_LOCK_CREATE_NP @lockcreatenp@
#define APR_PROCESS_LOCK_IS_GLOBAL @proclockglobal@
diff --git a/include/apr.hw b/include/apr.hw
index 7cc8b1a0f..a5c57ae15 100644
--- a/include/apr.hw
+++ b/include/apr.hw
@@ -157,6 +157,11 @@
#define APR_USE_PROC_PTHREAD_SERIALIZE 0
#define APR_USE_PTHREAD_SERIALIZE 0
+#define APR_HAS_FLOCK_SERIALIZE 0
+#define APR_HAS_SYSVSEM_SERIALIZE 0
+#define APR_HAS_FCNTL_SERIALIZE 0
+#define APR_HAS_PROC_PTHREAD_SERIALIZE 0
+
#define APR_HAS_LOCK_CREATE_NP 0
#define APR_PROCESS_LOCK_IS_GLOBAL 0
diff --git a/include/arch/unix/locks.h b/include/arch/unix/locks.h
index 02a96b97f..70b4476dd 100644
--- a/include/arch/unix/locks.h
+++ b/include/arch/unix/locks.h
@@ -109,32 +109,17 @@ struct apr_unix_lock_methods_t {
};
typedef struct apr_unix_lock_methods_t apr_unix_lock_methods_t;
-#if defined(HAVE_SEMCTL) && defined(HAVE_SEMGET)
-#define APR_HAS_SYSVSEM_SERIALIZE 1
+#if APR_HAS_SYSVSEM_SERIALIZE
extern const apr_unix_lock_methods_t apr_unix_sysv_methods;
-#else
-#define APR_HAS_SYSVSEM_SERIALIZE 0
#endif
-
-#if defined(HAVE_FCNTL_H) && defined(HAVE_F_SETLK)
-#define APR_HAS_FCNTL_SERIALIZE 1
+#if APR_HAS_FCNTL_SERIALIZE
extern const apr_unix_lock_methods_t apr_unix_fcntl_methods;
-#else
-#define APR_HAS_FCNTL_SERIALIZE 0
#endif
-
-#if defined(HAVE_FLOCK) && defined(HAVE_LOCK_EX)
-#define APR_HAS_FLOCK_SERIALIZE 1
+#if APR_HAS_FLOCK_SERIALIZE
extern const apr_unix_lock_methods_t apr_unix_flock_methods;
-#else
-#define APR_HAS_FLOCK_SERIALIZE 0
#endif
-
-#if defined(HAVE_PTHREAD_H) && defined(HAVE_PTHREAD_PROCESS_SHARED) && defined(HAVE_PTHREAD_MUTEXATTR_SETPSHARED)
-#define APR_HAS_PROC_PTHREAD_SERIALIZE 1
+#if APR_HAS_PROC_PTHREAD_SERIALIZE
extern const apr_unix_lock_methods_t apr_unix_proc_pthread_methods;
-#else
-#define APR_HAS_PROC_PTHREAD_SERIALIZE 0
#endif
#if defined(HAVE_PTHREAD_RWLOCK_INIT)