dnl
m4_pattern_forbid(^PGAC_)dnl to catch undefined macros
-AC_INIT([PostgreSQL], [12devel], [pgsql-bugs@postgresql.org])
+AC_INIT([PostgreSQL], [12devel], [pgsql-bugs@lists.postgresql.org])
m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.69], [], [m4_fatal([Autoconf version 2.69 is required.
Untested combinations of 'autoconf' and PostgreSQL versions are not
recommended. You can remove the check from 'configure.in' but it is then
your responsibility whether the result works or not.])])
-AC_COPYRIGHT([Copyright (c) 1996-2018, PostgreSQL Global Development Group])
+AC_COPYRIGHT([Copyright (c) 1996-2019, PostgreSQL Global Development Group])
AC_CONFIG_SRCDIR([src/backend/access/common/heaptuple.c])
AC_CONFIG_AUX_DIR(config)
AC_PREFIX_DEFAULT(/usr/local/pgsql)
To try a manual configuration, look into the src/template directory
for a similar platform and use the '--with-template=' option.
-Please also contact <pgsql-bugs@postgresql.org> to see about
+Please also contact <pgsql-bugs@lists.postgresql.org> to see about
rectifying this. Include the above 'checking host system type...'
line.
*******************************************************************
PGAC_ARG_BOOL(enable, atomics, yes,
[do not use atomic operations])
-#
-# Random number generation
-#
-PGAC_ARG_BOOL(enable, strong-random, yes,
- [do not use a strong random number source])
-AC_SUBST(enable_strong_random)
-
#
# --enable-debug adds -g to compiler flags
#
PGAC_ARG_BOOL(with, llvm, no, [build with LLVM based JIT support],
[AC_DEFINE([USE_LLVM], 1, [Define to 1 to build with LLVM based JIT support. (--with-llvm)])])
AC_SUBST(with_llvm)
-if test "$with_llvm" = yes ; then
- PGAC_LLVM_SUPPORT()
-fi
+dnl must use AS_IF here, else AC_REQUIRES inside PGAC_LLVM_SUPPORT malfunctions
+AS_IF([test "$with_llvm" = yes], [
+ PGAC_LLVM_SUPPORT()
+]) # fi
unset CFLAGS
CFLAGS="-Wall -Wmissing-prototypes -Wpointer-arith"
CXXFLAGS="-Wall -Wpointer-arith"
# These work in some but not all gcc versions
+ save_CFLAGS=$CFLAGS
PGAC_PROG_CC_CFLAGS_OPT([-Wdeclaration-after-statement])
- # -Wdeclaration-after-statement isn't applicable for C++
+ # -Wdeclaration-after-statement isn't applicable for C++. Specific C files
+ # disable it, so AC_SUBST the negative form.
+ PERMIT_DECLARATION_AFTER_STATEMENT=
+ if test x"$save_CFLAGS" != x"$CFLAGS"; then
+ PERMIT_DECLARATION_AFTER_STATEMENT=-Wno-declaration-after-statement
+ fi
+ AC_SUBST(PERMIT_DECLARATION_AFTER_STATEMENT)
# Really don't want VLAs to be used in our dialect of C
PGAC_PROG_CC_CFLAGS_OPT([-Werror=vla])
# -Wvla is not applicable for C++
if test "$with_libxml" = yes ; then
PGAC_PATH_PROGS(XML2_CONFIG, xml2-config)
+ AC_ARG_VAR(XML2_CONFIG, [path to xml2-config utility])dnl
if test -n "$XML2_CONFIG"; then
for pgac_option in `$XML2_CONFIG --cflags`; do
case $pgac_option in
PGAC_PATH_PROGS(TAR, tar)
AC_PROG_LN_S
-AC_PROG_AWK
AC_PROG_MKDIR_P
# When Autoconf chooses install-sh as mkdir -p program it tries to generate
# a relative path to it in each makefile where it substitutes it. This clashes
# other libraries can pull in the pthread functions as a side-effect. We
# want to use the -pthread or similar flags directly, and not rely on
# the side-effects of linking with some other library.
-#
-# note: We have to use AS_IF here rather than plain if. The AC_CHECK_HEADER
-# invocation below is the first one in the script, and autoconf generates
-# additional code for that, which must not be inside the if-block. AS_IF
-# knows how to do that.
+
+dnl note: We have to use AS_IF here rather than plain if. The AC_CHECK_HEADER
+dnl invocation below is the first one in the script, and autoconf generates
+dnl additional code for that, which must not be inside the if-block. AS_IF
+dnl knows how to do that.
AS_IF([test "$enable_thread_safety" = yes -a "$PORTNAME" != "win32"],
[ # then
AX_PTHREAD # set thread flags
AC_CHECK_HEADERS(m4_normalize([
atomic.h
+ copyfile.h
crypt.h
fp_class.h
getopt.h
PGAC_C_STATIC_ASSERT
PGAC_C_TYPEOF
PGAC_C_TYPES_COMPATIBLE
-PGAC_C_BUILTIN_BSWAP16
-PGAC_C_BUILTIN_BSWAP32
-PGAC_C_BUILTIN_BSWAP64
PGAC_C_BUILTIN_CONSTANT_P
PGAC_C_BUILTIN_UNREACHABLE
PGAC_C_COMPUTED_GOTO
[#include <zlib.h>])
fi
-# On PPC, check if assembler supports LWARX instruction's mutex hint bit
case $host_cpu in
+ x86_64)
+ # On x86_64, check if we can compile a popcntq instruction
+ AC_CACHE_CHECK([whether assembler supports x86_64 popcntq],
+ [pgac_cv_have_x86_64_popcntq],
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
+ [long long x = 1; long long r;
+ __asm__ __volatile__ (" popcntq %1,%0\n" : "=q"(r) : "rm"(x));])],
+ [pgac_cv_have_x86_64_popcntq=yes],
+ [pgac_cv_have_x86_64_popcntq=no])])
+ if test x"$pgac_cv_have_x86_64_popcntq" = xyes ; then
+ AC_DEFINE(HAVE_X86_64_POPCNTQ, 1, [Define to 1 if the assembler supports X86_64's POPCNTQ instruction.])
+ fi
+ ;;
ppc*|powerpc*)
- AC_MSG_CHECKING([whether assembler supports lwarx hint bit])
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
+ # On PPC, check if assembler supports LWARX instruction's mutex hint bit
+ AC_CACHE_CHECK([whether assembler supports lwarx hint bit],
+ [pgac_cv_have_ppc_mutex_hint],
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
[int a = 0; int *p = &a; int r;
__asm__ __volatile__ (" lwarx %0,0,%1,1\n" : "=&r"(r) : "r"(p));])],
[pgac_cv_have_ppc_mutex_hint=yes],
- [pgac_cv_have_ppc_mutex_hint=no])
- AC_MSG_RESULT([$pgac_cv_have_ppc_mutex_hint])
+ [pgac_cv_have_ppc_mutex_hint=no])])
if test x"$pgac_cv_have_ppc_mutex_hint" = xyes ; then
AC_DEFINE(HAVE_PPC_LWARX_MUTEX_HINT, 1, [Define to 1 if the assembler supports PPC's LWARX mutex hint bit.])
fi
AH_VERBATIM([_DARWIN_USE_64_BIT_INODE],[])
fi
-# Check for largefile support (must be after AC_SYS_LARGEFILE)
+dnl Check for largefile support (must be after AC_SYS_LARGEFILE)
AC_CHECK_SIZEOF([off_t])
# If we don't have largefile support, can't handle segsize >= 2GB.
AC_CHECK_FUNCS(m4_normalize([
cbrt
clock_gettime
+ copyfile
fdatasync
getifaddrs
getpeerucred
setsid
shm_open
strchrnul
+ strsignal
symlink
sync_file_range
+ uselocale
utime
utimes
wcstombs_l
]))
+# These typically are compiler builtins, for which AC_CHECK_FUNCS fails.
+PGAC_CHECK_BUILTIN_FUNC([__builtin_bswap16], [int x])
+PGAC_CHECK_BUILTIN_FUNC([__builtin_bswap32], [int x])
+PGAC_CHECK_BUILTIN_FUNC([__builtin_bswap64], [long int x])
+# We assume that we needn't test all widths of these explicitly:
+PGAC_CHECK_BUILTIN_FUNC([__builtin_clz], [unsigned int x])
+PGAC_CHECK_BUILTIN_FUNC([__builtin_ctz], [unsigned int x])
+PGAC_CHECK_BUILTIN_FUNC([__builtin_popcount], [unsigned int x])
+
AC_REPLACE_FUNCS(fseeko)
case $host_os in
# NetBSD uses a custom fseeko/ftello built on fsetpos/fgetpos
# posix_fadvise() is a no-op on Solaris, so don't incur function overhead
# by calling it, 2009-04-02
# http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libc/port/gen/posix_fadvise.c
-if test "$PORTNAME" != "solaris"; then
+dnl must use AS_IF here, else AC_REQUIRES inside AC_CHECK_DECLS malfunctions
+AS_IF([test "$PORTNAME" != "solaris"], [
AC_CHECK_FUNCS(posix_fadvise)
AC_CHECK_DECLS(posix_fadvise, [], [], [#include <fcntl.h>])
-fi
+]) # fi
AC_CHECK_DECLS(fdatasync, [], [], [#include <unistd.h>])
AC_CHECK_DECLS([strlcat, strlcpy, strnlen])
strlcat
strlcpy
strnlen
+ strtof
]))
+case $host_os in
+ # Cygwin and (apparently, based on test results) Mingw both
+ # have a broken strtof(), so substitute the same replacement
+ # code we use with VS2013. That's not a perfect fix, since
+ # (unlike with VS2013) it doesn't avoid double-rounding, but
+ # we have no better options. To get that, though, we have to
+ # force the file to be compiled despite HAVE_STRTOF.
+ mingw*|cygwin*)
+ AC_LIBOBJ([strtof])
+ AC_MSG_NOTICE([On $host_os we will use our strtof wrapper.])
+ ;;
+esac
+
case $host_os in
# Windows uses a specialised env handler
AC_LIBOBJ(getopt_long)
fi
-# Solaris' getopt() doesn't do what we want for long options, so always use
-# our version on that platform.
-if test "$PORTNAME" = "solaris"; then
+# On OpenBSD and Solaris, getopt() doesn't do what we want for long options
+# (i.e., allow '-' as a flag character), so use our version on those platforms.
+if test "$PORTNAME" = "openbsd" -o "$PORTNAME" = "solaris"; then
AC_LIBOBJ(getopt)
fi
# Win32 (really MinGW) support
if test "$PORTNAME" = "win32"; then
+ AC_CHECK_FUNCS(_configthreadlocale)
AC_REPLACE_FUNCS(gettimeofday)
AC_LIBOBJ(dirmod)
AC_LIBOBJ(kill)
AC_LIBOBJ(dirmod)
fi
-AC_CHECK_DECLS([sys_siglist], [], [],
-[#include <signal.h>
-/* NetBSD declares sys_siglist in unistd.h. */
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-])
-
AC_CHECK_FUNC(syslog,
[AC_CHECK_HEADER(syslog.h,
[AC_DEFINE(HAVE_SYSLOG, 1, [Define to 1 if you have the syslog interface.])])])
CPPFLAGS=$ac_save_CPPFLAGS
fi
+if test "$with_llvm" = yes; then
+ PGAC_CHECK_LLVM_FUNCTIONS()
+fi
+
# Lastly, restore full LIBS list and check for readline/libedit symbols
LIBS="$LIBS_including_readline"
# in the template or configure command line.
# If not selected manually, try to select a source automatically.
-if test "$enable_strong_random" = "yes" && test x"$USE_OPENSSL_RANDOM" = x"" && test x"$USE_WIN32_RANDOM" = x"" && test x"$USE_DEV_URANDOM" = x"" ; then
+if test x"$USE_OPENSSL_RANDOM" = x"" && test x"$USE_WIN32_RANDOM" = x"" && test x"$USE_DEV_URANDOM" = x"" ; then
if test x"$with_openssl" = x"yes" ; then
USE_OPENSSL_RANDOM=1
elif test "$PORTNAME" = "win32" ; then
fi
AC_MSG_CHECKING([which random number source to use])
-if test "$enable_strong_random" = yes ; then
- if test x"$USE_OPENSSL_RANDOM" = x"1" ; then
- AC_DEFINE(USE_OPENSSL_RANDOM, 1, [Define to use OpenSSL for random number generation])
- AC_MSG_RESULT([OpenSSL])
- elif test x"$USE_WIN32_RANDOM" = x"1" ; then
- AC_DEFINE(USE_WIN32_RANDOM, 1, [Define to use native Windows API for random number generation])
- AC_MSG_RESULT([Windows native])
- elif test x"$USE_DEV_URANDOM" = x"1" ; then
- AC_DEFINE(USE_DEV_URANDOM, 1, [Define to use /dev/urandom for random number generation])
- AC_MSG_RESULT([/dev/urandom])
- else
- AC_MSG_ERROR([
-no source of strong random numbers was found
-PostgreSQL can use OpenSSL or /dev/urandom as a source of random numbers,
-for authentication protocols. You can use --disable-strong-random to use a
-built-in pseudo random number generator, but that may be insecure.])
- fi
- AC_DEFINE(HAVE_STRONG_RANDOM, 1, [Define to use have a strong random number source])
+if test x"$USE_OPENSSL_RANDOM" = x"1" ; then
+ AC_DEFINE(USE_OPENSSL_RANDOM, 1, [Define to use OpenSSL for random number generation])
+ AC_MSG_RESULT([OpenSSL])
+elif test x"$USE_WIN32_RANDOM" = x"1" ; then
+ AC_DEFINE(USE_WIN32_RANDOM, 1, [Define to use native Windows API for random number generation])
+ AC_MSG_RESULT([Windows native])
+elif test x"$USE_DEV_URANDOM" = x"1" ; then
+ AC_DEFINE(USE_DEV_URANDOM, 1, [Define to use /dev/urandom for random number generation])
+ AC_MSG_RESULT([/dev/urandom])
else
- AC_MSG_RESULT([weak builtin PRNG])
- AC_MSG_WARN([
-*** Not using a strong random number source may be insecure.])
+ AC_MSG_ERROR([
+no source of strong random numbers was found
+PostgreSQL can use OpenSSL or /dev/urandom as a source of random numbers.])
fi
# If not set in template file, set bytes to use libc memset()