Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit623f8a0

Browse files
committed
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 libreadlinewill succeed, and fail only at runtime. It seems that an AC_TRY_RUN testis the only reliable way to check whether this is really safe. Per reportfrom Tatsuo.
1 parent6805705 commit623f8a0

File tree

3 files changed

+67
-58
lines changed

3 files changed

+67
-58
lines changed

‎config/c-compiler.m4

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Macros to detect C compiler features
2-
# $PostgreSQL: pgsql/config/c-compiler.m4,v 1.18 2008/05/20 03:30:21 tgl Exp $
2+
# $PostgreSQL: pgsql/config/c-compiler.m4,v 1.19 2008/06/27 00:36:16 tgl Exp $
33

44

55
# PGAC_C_SIGNED
@@ -119,12 +119,15 @@ _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
119119
# command-line option. If it does, add the string to LDFLAGS.
120120
# For reasons you'd really rather not know about, this checks whether
121121
# you can link to a particular function, not just whether you can link.
122+
# In fact, we must actually check that the resulting program runs :-(
122123
AC_DEFUN([PGAC_PROG_CC_LDFLAGS_OPT],
123124
[AC_MSG_CHECKING([if $CC supports$1])
124125
pgac_save_LDFLAGS=$LDFLAGS
125126
LDFLAGS="$pgac_save_LDFLAGS$1"
126-
AC_LINK_IFELSE([AC_LANG_CALL([],[$2])],
127-
AC_MSG_RESULT(yes),
128-
[LDFLAGS="$pgac_save_LDFLAGS"
129-
AC_MSG_RESULT(no)])
127+
AC_RUN_IFELSE([AC_LANG_PROGRAM([extern void$2 (); void (*fptr) () =$2;],[])],
128+
AC_MSG_RESULT(yes),
129+
[LDFLAGS="$pgac_save_LDFLAGS"
130+
AC_MSG_RESULT(no)],
131+
[LDFLAGS="$pgac_save_LDFLAGS"
132+
AC_MSG_RESULT(assumingno)])
130133
])# PGAC_PROG_CC_LDFLAGS_OPT

‎configure

Lines changed: 57 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -25633,7 +25633,7 @@ fi
2563325633

2563425634
# If compiler will take -Wl,--as-needed then add that to LDFLAGS.
2563525635
# This is much easier than trying to filter LIBS to the minimum for each
25636-
# executable. (Note that sharedlibraries won't use this switch, though.)
25636+
# executable. (Note that sharedlibrary links won't use this switch, though.)
2563725637
# On (at least) some Red-Hat-derived systems, this switch breaks linking to
2563825638
# libreadline; therefore we postpone testing it until we know what library
2563925639
# dependencies readline has. The test code will try to link with $LIBS.
@@ -25647,119 +25647,125 @@ if test "$PORTNAME" != "darwin"; then
2564725647
echo $ECHO_N "checking if $CC supports -Wl,--as-needed... $ECHO_C" >&6; }
2564825648
pgac_save_LDFLAGS=$LDFLAGS
2564925649
LDFLAGS="$pgac_save_LDFLAGS -Wl,--as-needed"
25650-
cat >conftest.$ac_ext <<_ACEOF
25650+
if test "$cross_compiling" = yes; then
25651+
LDFLAGS="$pgac_save_LDFLAGS"
25652+
{ echo "$as_me:$LINENO: result: assuming no" >&5
25653+
echo "${ECHO_T}assuming no" >&6; }
25654+
else
25655+
cat >conftest.$ac_ext <<_ACEOF
2565125656
/* confdefs.h. */
2565225657
_ACEOF
2565325658
cat confdefs.h >>conftest.$ac_ext
2565425659
cat >>conftest.$ac_ext <<_ACEOF
2565525660
/* end confdefs.h. */
25656-
25657-
/* Override any GCC internal prototype to avoid an error.
25658-
Use char because int might match the return type of a GCC
25659-
builtin and then its argument prototype would still apply. */
25660-
#ifdef __cplusplus
25661-
extern "C"
25662-
#endif
25663-
char $link_test_func ();
25661+
extern void $link_test_func (); void (*fptr) () = $link_test_func;
2566425662
int
2566525663
main ()
2566625664
{
25667-
return $link_test_func ();
25665+
2566825666
;
2566925667
return 0;
2567025668
}
2567125669
_ACEOF
25672-
rm -f conftest.$ac_objext conftest$ac_exeext
25670+
rm -f conftest$ac_exeext
2567325671
if { (ac_try="$ac_link"
2567425672
case "(($ac_try" in
2567525673
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
2567625674
*) ac_try_echo=$ac_try;;
2567725675
esac
2567825676
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
25679-
(eval "$ac_link") 2>conftest.er1
25677+
(eval "$ac_link") 2>&5
2568025678
ac_status=$?
25681-
grep -v '^ *+' conftest.er1 >conftest.err
25682-
rm -f conftest.er1
25683-
cat conftest.err >&5
2568425679
echo "$as_me:$LINENO: \$? = $ac_status" >&5
25685-
(exit $ac_status); } && {
25686-
test -z "$ac_c_werror_flag" ||
25687-
test ! -s conftest.err
25688-
} && test -s conftest$ac_exeext &&
25689-
$as_test_x conftest$ac_exeext; then
25680+
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
25681+
{ (case "(($ac_try" in
25682+
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
25683+
*) ac_try_echo=$ac_try;;
25684+
esac
25685+
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
25686+
(eval "$ac_try") 2>&5
25687+
ac_status=$?
25688+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
25689+
(exit $ac_status); }; }; then
2569025690
{ echo "$as_me:$LINENO: result: yes" >&5
2569125691
echo "${ECHO_T}yes" >&6; }
2569225692
else
25693-
echo "$as_me: failed program was:" >&5
25693+
echo "$as_me: program exited with status $ac_status" >&5
25694+
echo "$as_me: failed program was:" >&5
2569425695
sed 's/^/| /' conftest.$ac_ext >&5
2569525696

25696-
LDFLAGS="$pgac_save_LDFLAGS"
25697-
{ echo "$as_me:$LINENO: result: no" >&5
25697+
( exit $ac_status )
25698+
LDFLAGS="$pgac_save_LDFLAGS"
25699+
{ echo "$as_me:$LINENO: result: no" >&5
2569825700
echo "${ECHO_T}no" >&6; }
2569925701
fi
25702+
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
25703+
fi
25704+
2570025705

25701-
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
25702-
conftest$ac_exeext conftest.$ac_ext
2570325706

2570425707
else
2570525708
# On Darwin it's spelled -Wl,-dead_strip_dylibs, but don't try that elsewhere
2570625709
{ echo "$as_me:$LINENO: checking if $CC supports -Wl,-dead_strip_dylibs" >&5
2570725710
echo $ECHO_N "checking if $CC supports -Wl,-dead_strip_dylibs... $ECHO_C" >&6; }
2570825711
pgac_save_LDFLAGS=$LDFLAGS
2570925712
LDFLAGS="$pgac_save_LDFLAGS -Wl,-dead_strip_dylibs"
25710-
cat >conftest.$ac_ext <<_ACEOF
25713+
if test "$cross_compiling" = yes; then
25714+
LDFLAGS="$pgac_save_LDFLAGS"
25715+
{ echo "$as_me:$LINENO: result: assuming no" >&5
25716+
echo "${ECHO_T}assuming no" >&6; }
25717+
else
25718+
cat >conftest.$ac_ext <<_ACEOF
2571125719
/* confdefs.h. */
2571225720
_ACEOF
2571325721
cat confdefs.h >>conftest.$ac_ext
2571425722
cat >>conftest.$ac_ext <<_ACEOF
2571525723
/* end confdefs.h. */
25716-
25717-
/* Override any GCC internal prototype to avoid an error.
25718-
Use char because int might match the return type of a GCC
25719-
builtin and then its argument prototype would still apply. */
25720-
#ifdef __cplusplus
25721-
extern "C"
25722-
#endif
25723-
char $link_test_func ();
25724+
extern void $link_test_func (); void (*fptr) () = $link_test_func;
2572425725
int
2572525726
main ()
2572625727
{
25727-
return $link_test_func ();
25728+
2572825729
;
2572925730
return 0;
2573025731
}
2573125732
_ACEOF
25732-
rm -f conftest.$ac_objext conftest$ac_exeext
25733+
rm -f conftest$ac_exeext
2573325734
if { (ac_try="$ac_link"
2573425735
case "(($ac_try" in
2573525736
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
2573625737
*) ac_try_echo=$ac_try;;
2573725738
esac
2573825739
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
25739-
(eval "$ac_link") 2>conftest.er1
25740+
(eval "$ac_link") 2>&5
2574025741
ac_status=$?
25741-
grep -v '^ *+' conftest.er1 >conftest.err
25742-
rm -f conftest.er1
25743-
cat conftest.err >&5
2574425742
echo "$as_me:$LINENO: \$? = $ac_status" >&5
25745-
(exit $ac_status); } && {
25746-
test -z "$ac_c_werror_flag" ||
25747-
test ! -s conftest.err
25748-
} && test -s conftest$ac_exeext &&
25749-
$as_test_x conftest$ac_exeext; then
25743+
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
25744+
{ (case "(($ac_try" in
25745+
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
25746+
*) ac_try_echo=$ac_try;;
25747+
esac
25748+
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
25749+
(eval "$ac_try") 2>&5
25750+
ac_status=$?
25751+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
25752+
(exit $ac_status); }; }; then
2575025753
{ echo "$as_me:$LINENO: result: yes" >&5
2575125754
echo "${ECHO_T}yes" >&6; }
2575225755
else
25753-
echo "$as_me: failed program was:" >&5
25756+
echo "$as_me: program exited with status $ac_status" >&5
25757+
echo "$as_me: failed program was:" >&5
2575425758
sed 's/^/| /' conftest.$ac_ext >&5
2575525759

25756-
LDFLAGS="$pgac_save_LDFLAGS"
25757-
{ echo "$as_me:$LINENO: result: no" >&5
25760+
( exit $ac_status )
25761+
LDFLAGS="$pgac_save_LDFLAGS"
25762+
{ echo "$as_me:$LINENO: result: no" >&5
2575825763
echo "${ECHO_T}no" >&6; }
2575925764
fi
25765+
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
25766+
fi
25767+
2576025768

25761-
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
25762-
conftest$ac_exeext conftest.$ac_ext
2576325769

2576425770
fi
2576525771

‎configure.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dnl Process this file with autoconf to produce a configure script.
2-
dnl $PostgreSQL: pgsql/configure.in,v 1.562 2008/05/20 03:30:22 tgl Exp $
2+
dnl $PostgreSQL: pgsql/configure.in,v 1.563 2008/06/27 00:36:16 tgl Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -1699,7 +1699,7 @@ fi
16991699

17001700
# If compiler will take -Wl,--as-needed then add that to LDFLAGS.
17011701
# This is much easier than trying to filter LIBS to the minimum for each
1702-
# executable. (Note that sharedlibraries won't use this switch, though.)
1702+
# executable. (Note that sharedlibrary links won't use this switch, though.)
17031703
# On (at least) some Red-Hat-derived systems, this switch breaks linking to
17041704
# libreadline; therefore we postpone testing it until we know what library
17051705
# dependencies readline has. The test code will try to link with $LIBS.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp