summaryrefslogtreecommitdiff
path: root/config/c-compiler.m4
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2017-12-12 17:19:44 -0800
committerAndres Freund <andres@anarazel.de>2017-12-12 17:21:37 -0800
commit85abb5b297c5b318738f09345ae226f780b88e92 (patch)
treee33fb6c2ab78a2294e31ed84e064a943b38221b8 /config/c-compiler.m4
parent101c7ee3ee847bac970c74b73b4f2858484383e5 (diff)
downloadpostgresql-85abb5b297c5b318738f09345ae226f780b88e92.tar.gz
Make PGAC_C_BUILTIN_OP_OVERFLOW link instead of just compiling.
Otherwise the detection can spuriously detect symbol as available, because the compiler may just emits reference to non-existant symbol.
Diffstat (limited to 'config/c-compiler.m4')
-rw-r--r--config/c-compiler.m45
1 files changed, 3 insertions, 2 deletions
diff --git a/config/c-compiler.m4 b/config/c-compiler.m4
index 28c372cd32..ed26644a48 100644
--- a/config/c-compiler.m4
+++ b/config/c-compiler.m4
@@ -305,10 +305,11 @@ fi])# PGAC_C_BUILTIN_CONSTANT_P
# and define HAVE__BUILTIN_OP_OVERFLOW if so.
#
# Check for the most complicated case, 64 bit multiplication, as a
-# proxy for all of the operations.
+# proxy for all of the operations. Have to link to be sure to
+# recognize a missing __builtin_mul_overflow.
AC_DEFUN([PGAC_C_BUILTIN_OP_OVERFLOW],
[AC_CACHE_CHECK(for __builtin_mul_overflow, pgac_cv__builtin_op_overflow,
-[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
+[AC_LINK_IFELSE([AC_LANG_PROGRAM([],
[PG_INT64_TYPE result;
__builtin_mul_overflow((PG_INT64_TYPE) 1, (PG_INT64_TYPE) 2, &result);]
)],