jorton 2004/01/06 07:07:46
Modified: . configure.in
include apr.h.in
atomic/unix apr_atomic.c
Log:
Clean up configure logic for enabling "nonportable" atomics: don't
export the result via apr.h, and enable use of inline asm by default
on ppc64 and x86_64.
* configure.in: Define USE_GENERIC_ATOMICS on i[456]86 unless
--enable-nonportable-atomics was used.
* include/apr.h.in: Remove APR_FORCE_GENERIC_ATOMICS.
* atomic/unix/apr_atomic.c: Check for !defined(USE_GENERIC_ATOMICS)
rather than defined(APR_FORCE_GENERIC_ATOMICS).
Revision Changes Path
1.562 +19 -28 apr/configure.in
Index: configure.in
===================================================================
RCS file: /home/cvs/apr/configure.in,v
retrieving revision 1.561
retrieving revision 1.562
diff -b -d -u -r1.561 -r1.562
--- configure.in 5 Jan 2004 11:16:26 -0000 1.561
+++ configure.in 6 Jan 2004 15:07:46 -0000 1.562
@@ -339,22 +339,7 @@
dnl Check the depend program we can use
APR_CHECK_DEPEND
-# force_atomic_generic flag
-# this will be set we find a cpu/OS combo
-# which is historical and doesn't work with the method
-# we are using for the more up to date cpu/OS
-# (ie.. old sparcs)
-apr_force_atomic_generic=0
proc_mutex_is_global=0
-nonportable_atomics_enabled=0
-
-AC_ARG_ENABLE(nonportable-atomics,
-[ --enable-nonportable-atomics Turn on optimized atomic code which may produce nonportable
binaries],
-[
- if test "$enableval" = "yes"; then
- nonportable_atomics_enabled=1
- fi
-])
config_subdirs="none"
INSTALL_SUBDIRS="none"
@@ -406,18 +391,6 @@
enable_threads="no"
eolstr="\\n"
;;
- *linux*)
- apr_force_atomic_generic=1
- case $host_cpu in
- i486|i586|i686|powerpc64)
- if test "$nonportable_atomics_enabled" = 1; then
- apr_force_atomic_generic=0
- fi
- ;;
- esac
- OSDIR="unix"
- eolstr="\\n"
- ;;
*hpux10* )
enable_threads="no"
OSDIR="unix"
@@ -429,7 +402,25 @@
;;
esac
-AC_SUBST(apr_force_atomic_generic)
+AC_ARG_ENABLE(nonportable-atomics,
+[ --enable-nonportable-atomics Use optimized atomic code which may produce nonportable
binaries],
+[if test $enableval = yes; then
+ force_generic_atomics=no
+ else
+ force_generic_atomics=yes
+ fi
+],
+[case $host_cpu in
+ i[[456]]86) force_generic_atomics=yes ;;
+ *) force_generic_atomics=no ;;
+esac
+])
+
+if test $force_generic_atomics = yes; then
+ AC_DEFINE([USE_GENERIC_ATOMICS], 1,
+ [Define if use of generic atomics is requested])
+fi
+
AC_SUBST(proc_mutex_is_global)
AC_SUBST(eolstr)
AC_SUBST(INSTALL_SUBDIRS)
1.133 +0 -3 apr/include/apr.h.in
Index: apr.h.in
===================================================================
RCS file: /home/cvs/apr/include/apr.h.in,v
retrieving revision 1.132
retrieving revision 1.133
diff -b -d -u -r1.132 -r1.133
--- apr.h.in 9 Dec 2003 10:06:55 -0000 1.132
+++ apr.h.in 6 Jan 2004 15:07:46 -0000 1.133
@@ -399,9 +399,6 @@
#define APR_HAVE_INT64_STRFN @have_int64_strfn@
#define APR_INT64_STRFN @int64_strfn@
-/* are we going to force the generic atomic operations */
-#define APR_FORCE_ATOMIC_GENERIC @apr_force_atomic_generic@
-
/* Does the proc mutex lock threads too */
#define APR_PROC_MUTEX_IS_GLOBAL @proc_mutex_is_global@
1.44 +6 -2 apr/atomic/unix/apr_atomic.c
Index: apr_atomic.c
===================================================================
RCS file: /home/cvs/apr/atomic/unix/apr_atomic.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -b -d -u -r1.43 -r1.44
--- apr_atomic.c 6 Jan 2004 13:58:18 -0000 1.43
+++ apr_atomic.c 6 Jan 2004 15:07:46 -0000 1.44
@@ -56,10 +56,12 @@
#include "apr_atomic.h"
#include "apr_thread_mutex.h"
+#include "apr_private.h"
+
#include <stdlib.h>
#if (defined(__i386__) || defined(__x86_64__)) \
- && defined(__GNUC__) && !APR_FORCE_ATOMIC_GENERIC
+ && defined(__GNUC__) && !defined(USE_GENERIC_ATOMICS)
APR_DECLARE(apr_uint32_t) apr_atomic_cas32(volatile apr_uint32_t *mem,
apr_uint32_t with,
@@ -142,7 +144,9 @@
#endif /* (__linux__ || __EMX__ || __FreeBSD__) && __i386__ */
-#if (defined(__PPC__) || defined(__ppc__)) && defined(__GNUC__) && !APR_FORCE_ATOMIC_GENERIC
+#if (defined(__PPC__) || defined(__ppc__)) && defined(__GNUC__) \
+ && !defined(USE_GENERIC_ATOMICS)
+
APR_DECLARE(apr_uint32_t) apr_atomic_cas32(volatile apr_uint32_t *mem,
apr_uint32_t swap,
apr_uint32_t cmp)
|