]> granicus.if.org Git - postgresql/commitdiff
Implement compiler #error if spinlock code not found, add configure flag
authorBruce Momjian <bruce@momjian.us>
Fri, 12 Sep 2003 16:10:27 +0000 (16:10 +0000)
committerBruce Momjian <bruce@momjian.us>
Fri, 12 Sep 2003 16:10:27 +0000 (16:10 +0000)
to bypass the error, --without-spinlocks.

configure
configure.in
doc/src/sgml/installation.sgml
src/include/pg_config.h.in
src/include/storage/s_lock.h

index 9d729d91cc46d37bd89a04b7ddd1664333d0f8c1..02c38e4c509ee37327e2ed098a626ec7908ecbb3 100755 (executable)
--- a/configure
+++ b/configure
@@ -869,6 +869,7 @@ Optional Packages:
   --with-rendezvous       build with Rendezvous support
   --with-openssl[=DIR]    build with OpenSSL support [/usr/local/ssl]
   --without-readline      do not use Readline
+  --without-spinlocks     do not use Spinlocks
   --without-zlib          do not use Zlib
   --with-gnu-ld           assume the C compiler uses GNU ld default=no
 
@@ -3493,6 +3494,36 @@ else
 fi;
 
 
+#
+# Spinlocks
+#
+
+
+
+# Check whether --with-spinlocks or --without-spinlocks was given.
+if test "${with_spinlocks+set}" = set; then
+  withval="$with_spinlocks"
+
+  case $withval in
+    yes)
+      :
+      ;;
+    no)
+      :
+      ;;
+    *)
+      { { echo "$as_me:$LINENO: error: no argument expected for --with-spinlocks option" >&5
+echo "$as_me: error: no argument expected for --with-spinlocks option" >&2;}
+   { (exit 1); exit 1; }; }
+      ;;
+  esac
+
+else
+  with_spinlocks=yes
+
+fi;
+
+
 #
 # Zlib
 #
@@ -3523,7 +3554,6 @@ else
 fi;
 
 
-
 #
 # Elf
 #
@@ -6062,6 +6092,19 @@ fi
 
 fi
 
+if test "$with_spinlocks" = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_SPINLOCKS 1
+_ACEOF
+
+else
+  { echo "$as_me:$LINENO: WARNING:
+*** Not using spinlocks will cause poor performance." >&5
+echo "$as_me: WARNING:
+*** Not using spinlocks will cause poor performance." >&2;}
+fi
+
 if test "$with_krb4" = yes ; then
 
 echo "$as_me:$LINENO: checking for des_encrypt in -ldes" >&5
index 58db85abd0c1834e646bb537a912d99e1e3a5e83..62c14eeb28699a61c08116a19562b981704ecab9 100644 (file)
@@ -1,5 +1,5 @@
 dnl Process this file with autoconf to produce a configure script.
-dnl $Header: /cvsroot/pgsql/configure.in,v 1.286 2003/09/07 16:38:05 momjian Exp $
+dnl $Header: /cvsroot/pgsql/configure.in,v 1.287 2003/09/12 16:10:26 momjian Exp $
 dnl
 dnl Developers, please strive to achieve this order:
 dnl
@@ -521,13 +521,18 @@ AC_SUBST(with_openssl)
 PGAC_ARG_BOOL(with, readline, yes,
               [  --without-readline      do not use Readline])
 
+#
+# Spinlocks
+#
+PGAC_ARG_BOOL(with, spinlocks, yes,
+              [  --without-spinlocks     do not use Spinlocks])
+
 #
 # Zlib
 #
 PGAC_ARG_BOOL(with, zlib, yes,
               [  --without-zlib          do not use Zlib])
 
-
 #
 # Elf
 #
@@ -678,6 +683,13 @@ failure.  It is possible the compiler isn't looking in the proper directory.
 Use --without-zlib to disable zlib support.])])
 fi
 
+if test "$with_spinlocks" = yes; then
+  AC_DEFINE(HAVE_SPINLOCKS, 1, [Define to 1 if you have spinlocks.])
+else
+  AC_MSG_WARN([
+*** Not using spinlocks will cause poor performance.])
+fi
+
 if test "$with_krb4" = yes ; then
   AC_CHECK_LIB(des, des_encrypt, [], [AC_MSG_ERROR([library 'des' is required for Kerberos 4])])
   AC_CHECK_LIB(krb, krb_sendauth, [], [AC_MSG_ERROR([library 'krb' is required for Kerberos 4])])
index 02a77afcb6b37ee20c5417ba963aa2c4b9f54760..4a298251b7aa38d04908c25056c999aae8a08ab9 100644 (file)
@@ -1,4 +1,4 @@
-<!-- $Header: /cvsroot/pgsql/doc/src/sgml/installation.sgml,v 1.141 2003/09/11 21:42:20 momjian Exp $ -->
+<!-- $Header: /cvsroot/pgsql/doc/src/sgml/installation.sgml,v 1.142 2003/09/12 16:10:26 momjian Exp $ -->
 
 <chapter id="installation">
  <title><![%standalone-include[<productname>PostgreSQL</>]]>
@@ -899,6 +899,18 @@ JAVACMD=$JAVA_HOME/bin/java
        </listitem>
       </varlistentry>
 
+      <varlistentry>
+       <term><option>--without-spinlocks</option></term>
+       <listitem>
+        <para>
+         Allows source builds to succeed without CPU spinlock support.
+         Lack of spinlock support will produce poor performance.
+         This option is to be used only by platforms without
+         spinlock support.
+        </para>
+       </listitem>
+      </varlistentry>
+
       <varlistentry>
        <term><option>--enable-thread-safety</option></term>
        <listitem>
index 03874772cd0b38ecf26fb3c4137c738b980b93cd..8c04b8e6b47a257d325c0655fe4d259c0028633d 100644 (file)
 /* Define to 1 if you have the `snprintf' function. */
 #undef HAVE_SNPRINTF
 
+/* Define to 1 if you have spinlocks. */
+#undef HAVE_SPINLOCKS
+
 /* Define to 1 if you have the `srandom' function. */
 #undef HAVE_SRANDOM
 
index 827951804394ddce59f23a5bd15d90dc2eb8a721..4d49c52c7117c8cb8cb48baa30940f24a61de847 100644 (file)
@@ -63,7 +63,7 @@
  * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- *       $Id: s_lock.h,v 1.112 2003/08/04 02:40:15 momjian Exp $
+ *       $Id: s_lock.h,v 1.113 2003/09/12 16:10:27 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -537,7 +537,11 @@ extern slock_t wc_tas(volatile slock_t *lock);
 
 
 
-#else                                                  /* !HAS_TEST_AND_SET */
+#else   /* HAS_TEST_AND_SET */
+
+#ifdef HAVE_SPINLOCKS
+#error This platform does not support native spinlocks.  To continue the compile, rerun configure using --without-spinlocks.  However, performance will be poor.  Please report this to pgsql-bugs@postgresql.org.
+#endif
 
 /*
  * Fake spinlock implementation using semaphores --- slow and prone