diff --git a/configure.ac b/configure.ac index 72021882..45c74776 100644 --- a/configure.ac +++ b/configure.ac @@ -437,14 +437,6 @@ case $enable_threads in ;; esac -# The Win95 threading lacks thread-safe one-time initialization function. -# It's better to disallow it instead of allowing threaded but thread-unsafe -# build. -if test "x$enable_small$enable_threads" = xyeswin95; then - AC_MSG_ERROR([--enable-threads=win95 and --enable-small cannot be - used at the same time]) -fi - # We use the actual result a little later. @@ -862,6 +854,19 @@ AC_COMPILE_IFELSE([ CFLAGS="$OLD_CFLAGS" +# The Win95 threading lacks a thread-safe one-time initialization function. +# The one-time initialization is needed for crc32_small.c and crc64_small.c +# create the CRC tables. So if small mode is enabled, the threading mode is +# win95, and the compiler does not support attribute constructor, then we +# would end up with a multithreaded build that is thread-unsafe. As a +# result this configuration is not allowed. +if test "x$enable_small$enable_threads$have_func_attribute_constructor"\ + = xyeswin95no; then + AC_MSG_ERROR([--enable-threads=win95 and --enable-small cannot be + used at the same time with a compiler that doesn't support + __attribute__((__constructor__))]) +fi + ############################################################################### # Checks for library functions. ###############################################################################