summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2019-01-27 18:30:16 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2019-01-27 18:30:16 +0000
commit592bf5d9862783d712f906e6014515abae90c64a (patch)
treebc189d25235745886f7b9a785082b9177d12680d /configure.ac
parentf79ac796ca6326648311669eebe001379c315b17 (diff)
downloadmpfr-592bf5d9862783d712f906e6014515abae90c64a.tar.gz
Shared cache: cleanup and various improvements / corrections.
* acinclude.m4: - test $enable_shared_cache instead of $mpfr_want_shared_cache; - check ISO C11 thread support and/or POSIX thread support only when necessary; - when checking support for POSIX threads (pthread), also check that pthread_rwlock_t is supported, as it is needed by MPFR and conditionally defined in glibc's bits/pthreadtypes.h (via <pthread.h>); - with POSIX threads, also set CC="$PTHREAD_CC" as documented by ax_pthread (autoconf-archive). This is not guaranteed to work, but according to the ax_pthread.m4 source, in the cases where "$PTHREAD_CC" != "$CC", not setting it will probably not work either; - handle --enable-shared-cache early in MPFR_CONFIGS, because the use of POSIX threads (pthread) may need to change CC, CFLAGS, and LIBS (thus affecting other tests); - removed the now useless MPFR_CHECK_SHARED_CACHE function. * configure.ac: no longer set the mpfr_want_shared_cache variable, as enable_shared_cache (now used) already has the same usage. * acinclude.m4, configure.ac: moved the compatibility test of the configure options even earlier, from acinclude.m4 to configure.ac, just after the code that defines them. Also added an associated AC_MSG_CHECKING message for better clarity. * src/mpfr-impl.h: added a comment about the cache-related types, which depend on the locking methods. * src/mpfr-thread.h: fixed the lock macros: - in case of failure, one must abort, otherwise this would generally be undefined behavior; - added missing "do {} while (0)" (currently not mandatory). * tests/tversion.c: update concerning the shared cache, to be consistent with the other mpfr_buildopt_*_p features: - check that mpfr_buildopt_sharedcache_p() and MPFR_WANT_SHARED_CACHE match; - for the output of the value, test mpfr_buildopt_sharedcache_p() instead of the macro. * NEWS: update. (merged changesets r13032,13390-13396,13410,13412 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/4.0@13416 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac26
1 files changed, 25 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 2f8ae8fd3..19f83b85d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -167,7 +167,7 @@ AC_ARG_ENABLE(shared-cache,
for all MPFR constants. It usually makes MPFR
dependent on PTHREAD [[default=no]]],
[ case $enableval in
- yes) mpfr_want_shared_cache=yes
+ yes)
AC_DEFINE([MPFR_WANT_SHARED_CACHE],1,[Want shared cache]) ;;
no) ;;
*) AC_MSG_ERROR([bad value for --enable-shared-cache: yes or no]) ;;
@@ -204,6 +204,30 @@ AC_ARG_ENABLE(tune-for-coverage,
*) AC_MSG_ERROR([bad value for --enable-tune-for-coverage]) ;;
esac])
+dnl First, detect incompatibilities between the above configure options.
+AC_MSG_CHECKING([whether configure options are compatible])
+if test "$enable_logging" = yes; then
+ if test "$enable_thread_safe" = yes; then
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([enable either logging or thread-safe, not both])
+ fi
+dnl The following test is done only to output a specific error message,
+dnl as there would otherwise be an error due to enable_thread_safe=no.
+ if test "$enable_shared_cache" = yes; then
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([shared cache does not work with logging support])
+ fi
+ enable_thread_safe=no
+fi
+if test "$enable_shared_cache" = yes; then
+ if test "$enable_thread_safe" = no; then
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([shared cache needs thread-safe support])
+ fi
+ enable_thread_safe=yes
+fi
+AC_MSG_RESULT([yes])
+
dnl
dnl Setup CC and CFLAGS