Implement compiler #error if spinlock code not found, add configure flag

to bypass the error, --without-spinlocks.
This commit is contained in:
Bruce Momjian 2003-09-12 16:10:27 +00:00
parent 69a46e9ce1
commit 06e3ec7a54
5 changed files with 80 additions and 6 deletions

45
configure vendored
View File

@ -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

View 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])])

View 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>

View File

@ -357,6 +357,9 @@
/* 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

View 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