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);] )], diff --git a/configure b/configure index 4a4f13314e..ca76ef0ab2 100755 --- a/configure +++ b/configure @@ -14472,6 +14472,8 @@ esac fi +# has to be down here, rather than with the other builtins, because +# the test uses PG_INT64_TYPE. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_mul_overflow" >&5 $as_echo_n "checking for __builtin_mul_overflow... " >&6; } if ${pgac_cv__builtin_op_overflow+:} false; then : @@ -14490,12 +14492,13 @@ __builtin_mul_overflow((PG_INT64_TYPE) 1, (PG_INT64_TYPE) 2, &result); return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_link "$LINENO"; then : pgac_cv__builtin_op_overflow=yes else pgac_cv__builtin_op_overflow=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__builtin_op_overflow" >&5 $as_echo "$pgac_cv__builtin_op_overflow" >&6; }