You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by ia...@apache.org on 2002/02/22 00:34:11 UTC

cvs commit: apr/include apr.h.in apr_atomic.h

ianh        02/02/21 15:34:10

  Modified:    .        configure.in
               atomic/solaris_sparc .cvsignore Makefile.in
               include  apr.h.in apr_atomic.h
  Added:       atomic/solaris_sparc apr_atomic_sparc_no_support.c
  Log:
  deal with the case where some processors in a product line are ancient and don't
  have all the support we would like for atomic operations.
  this is intended for the sparc v7's out there which don't do CAS
  
  Revision  Changes    Path
  1.412     +33 -5     apr/configure.in
  
  Index: configure.in
  ===================================================================
  RCS file: /home/cvs/apr/configure.in,v
  retrieving revision 1.411
  retrieving revision 1.412
  diff -u -r1.411 -r1.412
  --- configure.in	21 Feb 2002 17:30:43 -0000	1.411
  +++ configure.in	21 Feb 2002 23:34:10 -0000	1.412
  @@ -276,6 +276,14 @@
   	APR_SETVAR(AR,ar)
   	;;
   esac
  +
  +dnl force_atomic_generic flag 
  +dnl this will be set we find a cpu/OS combo
  +dnl which is historical and doesn't work with the method
  +dnl we are using for the more up to date cpu/OS
  +dnl  (ie.. old sparcs)
  +apr_force_atomic_generic=0
  +
   config_subdirs="none"
   INSTALL_SUBDIRS="none"
   case $host in
  @@ -329,18 +337,37 @@
           *sparc*)
               OSDIR="solaris_sparc"
               eolstr="\\n"
  +            apr_atomic_sparc_compile=apr_atomic_sparc.lo
  +            sparc_arch=`uname -m`
               is_gnu_as=`${AS} --help 2>/dev/null | grep gnu.org`
               if [ -z "$is_gnu_as" ]
               then
  -                ASFLAGS="-xarch=v8plus -KPIC -q"
  -                ASCPPFLAGS="-D_ASM -D__STDC__=0"
  +                case "$sparc_arch" in
  +                 sun4c|sun4m|sun4d|sun4t|sun4)
  +                    apr_force_atomic_generic=1
  +                    apr_atomic_sparc_compile=apr_atomic_sparc_no_support.lo
  +                    ;;
  +                 *)
  +                    ASFLAGS="-xarch=v8plus -K PIC"
  +                    ASCPPFLAGS="-D_ASM -D__STDC__=0"
  +                    ;;
  +                esac
               else
  -                ASFLAGS="-K pic -P -D_ASM -D__STDC__=0 -xarch=v8plus"
  -                ASCPPFLAGS=""
  -                ASCPP="cat"
  +                case "$sparc_arch" in
  +                 sun4c|sun4m|sun4d|sun4t|sun4)
  +                    apr_force_atomic_generic=1
  +                    apr_atomic_sparc_compile=apr_atomic_sparc_no_support.lo
  +                    ;;
  +                 *)
  +                    ASFLAGS="-K pic -P -D_ASM -D__STDC__=0 -xarch=v8plus"
  +                    ASCPPFLAGS=""
  +                    ASCPP="cat"
  +                    ;;
  +                esac
               fi
               AC_SUBST(ASCPPFLAGS)
               AC_SUBST(ASFLAGS)
  +            AC_SUBST(apr_atomic_sparc_compile)
               ;;
           *)
               OSDIR="unix"
  @@ -354,6 +381,7 @@
          ;;
   esac
   
  +AC_SUBST(apr_force_atomic_generic)
   AC_SUBST(eolstr)
   AC_SUBST(INSTALL_SUBDIRS)
   
  
  
  
  1.2       +1 -0      apr/atomic/solaris_sparc/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  RCS file: /home/cvs/apr/atomic/solaris_sparc/.cvsignore,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- .cvsignore	20 Feb 2002 06:06:11 -0000	1.1
  +++ .cvsignore	21 Feb 2002 23:34:10 -0000	1.2
  @@ -1,3 +1,4 @@
   Makefile
   *.lo
  +*.S
   .libs
  
  
  
  1.3       +4 -4      apr/atomic/solaris_sparc/Makefile.in
  
  Index: Makefile.in
  ===================================================================
  RCS file: /home/cvs/apr/atomic/solaris_sparc/Makefile.in,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Makefile.in	21 Feb 2002 15:48:18 -0000	1.2
  +++ Makefile.in	21 Feb 2002 23:34:10 -0000	1.3
  @@ -1,18 +1,18 @@
   
  -TARGETS =  apr_atomic_sparc.lo
  +TARGETS =  @apr_atomic_sparc_compile@
   
   ASFLAGS += @ASFLAGS@
   ASCPPFLAGS = @ASCPPFLAGS@
   AS = @AS@
   ASCPP = @ASCPP@
   
  +# bring in rules.mk for standard functionality
  +@INCLUDE_RULES@
  +
   apr_atomic_sparc.lo: apr_atomic_sparc.s
   	$(ASCPP) $(ASCPPFLAGS) $*.s > $*.S
   	$(AS) $(ASFLAGS) -o $@ $*.S
   
  -
  -# bring in rules.mk for standard functionality
  -@INCLUDE_RULES@
   
   DEFOSDIR=$(INCDIR)/arch/@DEFAULT_OSDIR@
   INCDIR=../../include
  
  
  
  1.1                  apr/atomic/solaris_sparc/apr_atomic_sparc_no_support.c
  
  Index: apr_atomic_sparc_no_support.c
  ===================================================================
  #include "apr.h"
  #if APR_FORCE_ATOMIC_GENERIC 
  #include "../unix/apr_atomic.c"
  #else
  #endif
  
  
  
  1.100     +3 -0      apr/include/apr.h.in
  
  Index: apr.h.in
  ===================================================================
  RCS file: /home/cvs/apr/include/apr.h.in,v
  retrieving revision 1.99
  retrieving revision 1.100
  diff -u -r1.99 -r1.100
  --- apr.h.in	3 Feb 2002 17:17:31 -0000	1.99
  +++ apr.h.in	21 Feb 2002 23:34:10 -0000	1.100
  @@ -255,6 +255,9 @@
   /* And APR_INT64_T_FMT */
   @int64_t_fmt@
   
  +/* are we going to force the generic atomic operations */
  +#define APR_FORCE_ATOMIC_GENERIC @apr_force_atomic_generic@
  +
   /* Local machine definition for console and log output. */
   #define APR_EOL_STR              "@eolstr@"
   
  
  
  
  1.12      +14 -8     apr/include/apr_atomic.h
  
  Index: apr_atomic.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_atomic.h,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- apr_atomic.h	20 Feb 2002 20:00:28 -0000	1.11
  +++ apr_atomic.h	21 Feb 2002 23:34:10 -0000	1.12
  @@ -133,7 +133,13 @@
   apr_uint32_t apr_atomic_cas(volatile apr_uint32_t *mem,long with,long cmp);
   #else /* !DOXYGEN */
   
  -#ifdef WIN32
  +#if APR_FORCE_ATOMIC_GENERIC 
  +#if APR_HAS_THREADS
  +#define APR_ATOMIC_NEED_DEFAULT 1
  +#define APR_ATOMIC_NEED_CAS_DEFAULT 1
  +#endif /* APR_HAS_THREADS */
  +
  +#elif defined(WIN32)
   
   #define apr_atomic_t LONG;
   
  @@ -209,7 +215,13 @@
   
   #else
   #if APR_HAS_THREADS
  +#define APR_ATOMIC_NEED_DEFAULT 1
  +#define APR_ATOMIC_NEED_CAS_DEFAULT 1
  +#endif /* APR_HAS_THREADS */
  +
  +#endif /* !defined(WIN32) && !defined(__linux) */
   
  +#if defined(APR_ATOMIC_NEED_DEFAULT)
   #define apr_atomic_t apr_uint32_t
   #define apr_atomic_read(p)  *p
   apr_status_t apr_atomic_init(apr_pool_t *p);
  @@ -217,13 +229,7 @@
   void apr_atomic_add(volatile apr_atomic_t *mem, apr_uint32_t val);
   void apr_atomic_inc(volatile apr_atomic_t *mem);
   void apr_atomic_dec(volatile apr_atomic_t *mem);
  -
  -#define APR_ATOMIC_NEED_DEFAULT 1
  -#define APR_ATOMIC_NEED_CAS_DEFAULT 1
  -
  -#endif /* APR_HAS_THREADS */
  -
  -#endif /* !defined(WIN32) && !defined(__linux) */
  +#endif
   
   #if defined(APR_ATOMIC_NEED_CAS_DEFAULT)
   apr_status_t apr_atomic_init(apr_pool_t *p);