1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

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.
This commit is contained in:
Tom Lane
2008-06-27 00:36:16 +00:00
parent 68057055f6
commit 623f8a0969
3 changed files with 67 additions and 58 deletions

View File

@ -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