diff options
| author | Tom Lane | 2008-06-27 00:36:16 +0000 |
|---|---|---|
| committer | Tom Lane | 2008-06-27 00:36:16 +0000 |
| commit | 623f8a0969e9e4663dd27e065bfb8f67f9508006 (patch) | |
| tree | 09456605782b51d66ed3875c192d722c98fc37a3 /config/c-compiler.m4 | |
| parent | 68057055f687d986a4db5e5bb41ea55e1483d1cb (diff) | |
Modify the recently-added probe for -Wl,--as-needed some more, because RHEL-4
vintage Linux is even more broken than we realized: a link to libreadline
will succeed, and fail only at runtime. It seems that an AC_TRY_RUN test
is the only reliable way to check whether this is really safe. Per report
from Tatsuo.
Diffstat (limited to 'config/c-compiler.m4')
| -rw-r--r-- | config/c-compiler.m4 | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/config/c-compiler.m4 b/config/c-compiler.m4 index 7422f9572e..eeb2ee9494 100644 --- a/config/c-compiler.m4 +++ b/config/c-compiler.m4 @@ -1,5 +1,5 @@ # Macros to detect C compiler features -# $PostgreSQL: pgsql/config/c-compiler.m4,v 1.18 2008/05/20 03:30:21 tgl Exp $ +# $PostgreSQL: pgsql/config/c-compiler.m4,v 1.19 2008/06/27 00:36:16 tgl Exp $ # PGAC_C_SIGNED @@ -119,12 +119,15 @@ _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], # command-line option. If it does, add the string to LDFLAGS. # For reasons you'd really rather not know about, this checks whether # you can link to a particular function, not just whether you can link. +# In fact, we must actually check that the resulting program runs :-( AC_DEFUN([PGAC_PROG_CC_LDFLAGS_OPT], [AC_MSG_CHECKING([if $CC supports $1]) pgac_save_LDFLAGS=$LDFLAGS LDFLAGS="$pgac_save_LDFLAGS $1" -AC_LINK_IFELSE([AC_LANG_CALL([],[$2])], - AC_MSG_RESULT(yes), - [LDFLAGS="$pgac_save_LDFLAGS" - AC_MSG_RESULT(no)]) +AC_RUN_IFELSE([AC_LANG_PROGRAM([extern void $2 (); void (*fptr) () = $2;],[])], + AC_MSG_RESULT(yes), + [LDFLAGS="$pgac_save_LDFLAGS" + AC_MSG_RESULT(no)], + [LDFLAGS="$pgac_save_LDFLAGS" + AC_MSG_RESULT(assuming no)]) ])# PGAC_PROG_CC_LDFLAGS_OPT |
