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

Commit1ac1bea

Browse files
committed
Adjust -Wl,--asneeded test to avoid using the switch if it breaks
libreadline. What we will do for compatibility :-(
1 parent9f19470 commit1ac1bea

File tree

3 files changed

+172
-136
lines changed

3 files changed

+172
-136
lines changed

‎config/c-compiler.m4

Lines changed: 4 additions & 2 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.17 2008/05/18 20:13:12 tgl Exp $
2+
# $PostgreSQL: pgsql/config/c-compiler.m4,v 1.18 2008/05/20 03:30:21 tgl Exp $
33

44

55
# PGAC_C_SIGNED
@@ -117,11 +117,13 @@ _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
117117
# ------------------------
118118
# Given a string, check if the compiler supports the string as a
119119
# command-line option. If it does, add the string to LDFLAGS.
120+
# For reasons you'd really rather not know about, this checks whether
121+
# you can link to a particular function, not just whether you can link.
120122
AC_DEFUN([PGAC_PROG_CC_LDFLAGS_OPT],
121123
[AC_MSG_CHECKING([if $CC supports$1])
122124
pgac_save_LDFLAGS=$LDFLAGS
123125
LDFLAGS="$pgac_save_LDFLAGS$1"
124-
AC_LINK_IFELSE([AC_LANG_PROGRAM()],
126+
AC_LINK_IFELSE([AC_LANG_CALL([],[$2])],
125127
AC_MSG_RESULT(yes),
126128
[LDFLAGS="$pgac_save_LDFLAGS"
127129
AC_MSG_RESULT(no)])

‎configure

Lines changed: 142 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -3977,9 +3977,6 @@ echo "$as_me: error: --enable-profiling is supported only when using GCC" >&2;}
39773977
fi
39783978
fi
39793979

3980-
{ echo "$as_me:$LINENO: using CFLAGS=$CFLAGS" >&5
3981-
echo "$as_me: using CFLAGS=$CFLAGS" >&6;}
3982-
39833980
# We already have this in Makefile.win32, but configure needs it too
39843981
if test "$PORTNAME" = "win32"; then
39853982
CPPFLAGS="$CPPFLAGS -I$srcdir/src/include/port/win32 -DEXEC_BACKEND"
@@ -4318,116 +4315,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
43184315

43194316

43204317

4321-
# If compiler will take -Wl,--as-needed then add that to LDFLAGS.
4322-
# This is much easier than trying to filter LIBS to the minimum for each
4323-
# executable. (Note that shared libraries won't use this switch, though.)
4324-
# On Darwin it's spelled -Wl,-dead_strip_dylibs, but don't try that elsewhere
4325-
if test "$PORTNAME" != "darwin"; then
4326-
{ echo "$as_me:$LINENO: checking if $CC supports -Wl,--as-needed" >&5
4327-
echo $ECHO_N "checking if $CC supports -Wl,--as-needed... $ECHO_C" >&6; }
4328-
pgac_save_LDFLAGS=$LDFLAGS
4329-
LDFLAGS="$pgac_save_LDFLAGS -Wl,--as-needed"
4330-
cat >conftest.$ac_ext <<_ACEOF
4331-
/* confdefs.h. */
4332-
_ACEOF
4333-
cat confdefs.h >>conftest.$ac_ext
4334-
cat >>conftest.$ac_ext <<_ACEOF
4335-
/* end confdefs.h. */
4336-
4337-
int
4338-
main ()
4339-
{
4340-
4341-
;
4342-
return 0;
4343-
}
4344-
_ACEOF
4345-
rm -f conftest.$ac_objext conftest$ac_exeext
4346-
if { (ac_try="$ac_link"
4347-
case "(($ac_try" in
4348-
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
4349-
*) ac_try_echo=$ac_try;;
4350-
esac
4351-
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
4352-
(eval "$ac_link") 2>conftest.er1
4353-
ac_status=$?
4354-
grep -v '^ *+' conftest.er1 >conftest.err
4355-
rm -f conftest.er1
4356-
cat conftest.err >&5
4357-
echo "$as_me:$LINENO: \$? = $ac_status" >&5
4358-
(exit $ac_status); } && {
4359-
test -z "$ac_c_werror_flag" ||
4360-
test ! -s conftest.err
4361-
} && test -s conftest$ac_exeext &&
4362-
$as_test_x conftest$ac_exeext; then
4363-
{ echo "$as_me:$LINENO: result: yes" >&5
4364-
echo "${ECHO_T}yes" >&6; }
4365-
else
4366-
echo "$as_me: failed program was:" >&5
4367-
sed 's/^/| /' conftest.$ac_ext >&5
4368-
4369-
LDFLAGS="$pgac_save_LDFLAGS"
4370-
{ echo "$as_me:$LINENO: result: no" >&5
4371-
echo "${ECHO_T}no" >&6; }
4372-
fi
4373-
4374-
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
4375-
conftest$ac_exeext conftest.$ac_ext
4376-
4377-
else
4378-
{ echo "$as_me:$LINENO: checking if $CC supports -Wl,-dead_strip_dylibs" >&5
4379-
echo $ECHO_N "checking if $CC supports -Wl,-dead_strip_dylibs... $ECHO_C" >&6; }
4380-
pgac_save_LDFLAGS=$LDFLAGS
4381-
LDFLAGS="$pgac_save_LDFLAGS -Wl,-dead_strip_dylibs"
4382-
cat >conftest.$ac_ext <<_ACEOF
4383-
/* confdefs.h. */
4384-
_ACEOF
4385-
cat confdefs.h >>conftest.$ac_ext
4386-
cat >>conftest.$ac_ext <<_ACEOF
4387-
/* end confdefs.h. */
4388-
4389-
int
4390-
main ()
4391-
{
4392-
4393-
;
4394-
return 0;
4395-
}
4396-
_ACEOF
4397-
rm -f conftest.$ac_objext conftest$ac_exeext
4398-
if { (ac_try="$ac_link"
4399-
case "(($ac_try" in
4400-
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
4401-
*) ac_try_echo=$ac_try;;
4402-
esac
4403-
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
4404-
(eval "$ac_link") 2>conftest.er1
4405-
ac_status=$?
4406-
grep -v '^ *+' conftest.er1 >conftest.err
4407-
rm -f conftest.er1
4408-
cat conftest.err >&5
4409-
echo "$as_me:$LINENO: \$? = $ac_status" >&5
4410-
(exit $ac_status); } && {
4411-
test -z "$ac_c_werror_flag" ||
4412-
test ! -s conftest.err
4413-
} && test -s conftest$ac_exeext &&
4414-
$as_test_x conftest$ac_exeext; then
4415-
{ echo "$as_me:$LINENO: result: yes" >&5
4416-
echo "${ECHO_T}yes" >&6; }
4417-
else
4418-
echo "$as_me: failed program was:" >&5
4419-
sed 's/^/| /' conftest.$ac_ext >&5
4420-
4421-
LDFLAGS="$pgac_save_LDFLAGS"
4422-
{ echo "$as_me:$LINENO: result: no" >&5
4423-
echo "${ECHO_T}no" >&6; }
4424-
fi
4425-
4426-
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
4427-
conftest$ac_exeext conftest.$ac_ext
4428-
4429-
fi
4430-
44314318
# Create compiler version string
44324319
if test x"$GCC" = x"yes" ; then
44334320
cc_string="GCC `${CC} --version | sed q`"
@@ -5596,11 +5483,6 @@ rm -f conftest*
55965483
CPPFLAGS="$CPPFLAGS $INCLUDES"
55975484
LDFLAGS="$LDFLAGS $LIBDIRS"
55985485

5599-
{ echo "$as_me:$LINENO: using CPPFLAGS=$CPPFLAGS" >&5
5600-
echo "$as_me: using CPPFLAGS=$CPPFLAGS" >&6;}
5601-
{ echo "$as_me:$LINENO: using LDFLAGS=$LDFLAGS" >&5
5602-
echo "$as_me: using LDFLAGS=$LDFLAGS" >&6;}
5603-
56045486

56055487

56065488

@@ -25749,6 +25631,148 @@ echo "$as_me: WARNING: *** skipping thread test on Win32" >&2;}
2574925631
fi
2575025632
fi
2575125633

25634+
# If compiler will take -Wl,--as-needed then add that to LDFLAGS.
25635+
# This is much easier than trying to filter LIBS to the minimum for each
25636+
# executable. (Note that shared libraries won't use this switch, though.)
25637+
# On (at least) some Red-Hat-derived systems, this switch breaks linking to
25638+
# libreadline; therefore we postpone testing it until we know what library
25639+
# dependencies readline has. The test code will try to link with $LIBS.
25640+
if test "$with_readline" = yes; then
25641+
link_test_func=readline
25642+
else
25643+
link_test_func=exit
25644+
fi
25645+
if test "$PORTNAME" != "darwin"; then
25646+
{ echo "$as_me:$LINENO: checking if $CC supports -Wl,--as-needed" >&5
25647+
echo $ECHO_N "checking if $CC supports -Wl,--as-needed... $ECHO_C" >&6; }
25648+
pgac_save_LDFLAGS=$LDFLAGS
25649+
LDFLAGS="$pgac_save_LDFLAGS -Wl,--as-needed"
25650+
cat >conftest.$ac_ext <<_ACEOF
25651+
/* confdefs.h. */
25652+
_ACEOF
25653+
cat confdefs.h >>conftest.$ac_ext
25654+
cat >>conftest.$ac_ext <<_ACEOF
25655+
/* 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 ();
25664+
int
25665+
main ()
25666+
{
25667+
return $link_test_func ();
25668+
;
25669+
return 0;
25670+
}
25671+
_ACEOF
25672+
rm -f conftest.$ac_objext conftest$ac_exeext
25673+
if { (ac_try="$ac_link"
25674+
case "(($ac_try" in
25675+
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
25676+
*) ac_try_echo=$ac_try;;
25677+
esac
25678+
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
25679+
(eval "$ac_link") 2>conftest.er1
25680+
ac_status=$?
25681+
grep -v '^ *+' conftest.er1 >conftest.err
25682+
rm -f conftest.er1
25683+
cat conftest.err >&5
25684+
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
25690+
{ echo "$as_me:$LINENO: result: yes" >&5
25691+
echo "${ECHO_T}yes" >&6; }
25692+
else
25693+
echo "$as_me: failed program was:" >&5
25694+
sed 's/^/| /' conftest.$ac_ext >&5
25695+
25696+
LDFLAGS="$pgac_save_LDFLAGS"
25697+
{ echo "$as_me:$LINENO: result: no" >&5
25698+
echo "${ECHO_T}no" >&6; }
25699+
fi
25700+
25701+
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
25702+
conftest$ac_exeext conftest.$ac_ext
25703+
25704+
else
25705+
# On Darwin it's spelled -Wl,-dead_strip_dylibs, but don't try that elsewhere
25706+
{ echo "$as_me:$LINENO: checking if $CC supports -Wl,-dead_strip_dylibs" >&5
25707+
echo $ECHO_N "checking if $CC supports -Wl,-dead_strip_dylibs... $ECHO_C" >&6; }
25708+
pgac_save_LDFLAGS=$LDFLAGS
25709+
LDFLAGS="$pgac_save_LDFLAGS -Wl,-dead_strip_dylibs"
25710+
cat >conftest.$ac_ext <<_ACEOF
25711+
/* confdefs.h. */
25712+
_ACEOF
25713+
cat confdefs.h >>conftest.$ac_ext
25714+
cat >>conftest.$ac_ext <<_ACEOF
25715+
/* 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+
int
25725+
main ()
25726+
{
25727+
return $link_test_func ();
25728+
;
25729+
return 0;
25730+
}
25731+
_ACEOF
25732+
rm -f conftest.$ac_objext conftest$ac_exeext
25733+
if { (ac_try="$ac_link"
25734+
case "(($ac_try" in
25735+
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
25736+
*) ac_try_echo=$ac_try;;
25737+
esac
25738+
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
25739+
(eval "$ac_link") 2>conftest.er1
25740+
ac_status=$?
25741+
grep -v '^ *+' conftest.er1 >conftest.err
25742+
rm -f conftest.er1
25743+
cat conftest.err >&5
25744+
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
25750+
{ echo "$as_me:$LINENO: result: yes" >&5
25751+
echo "${ECHO_T}yes" >&6; }
25752+
else
25753+
echo "$as_me: failed program was:" >&5
25754+
sed 's/^/| /' conftest.$ac_ext >&5
25755+
25756+
LDFLAGS="$pgac_save_LDFLAGS"
25757+
{ echo "$as_me:$LINENO: result: no" >&5
25758+
echo "${ECHO_T}no" >&6; }
25759+
fi
25760+
25761+
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
25762+
conftest$ac_exeext conftest.$ac_ext
25763+
25764+
fi
25765+
25766+
25767+
# Begin output steps
25768+
25769+
{ echo "$as_me:$LINENO: using CFLAGS=$CFLAGS" >&5
25770+
echo "$as_me: using CFLAGS=$CFLAGS" >&6;}
25771+
{ echo "$as_me:$LINENO: using CPPFLAGS=$CPPFLAGS" >&5
25772+
echo "$as_me: using CPPFLAGS=$CPPFLAGS" >&6;}
25773+
{ echo "$as_me:$LINENO: using LDFLAGS=$LDFLAGS" >&5
25774+
echo "$as_me: using LDFLAGS=$LDFLAGS" >&6;}
25775+
2575225776
# prepare build tree if outside source tree
2575325777
# Note 1: test -ef might not exist, but it's more reliable than `pwd`.
2575425778
# Note 2: /bin/pwd might be better than shell's built-in at getting

‎configure.in

Lines changed: 26 additions & 16 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.561 2008/05/18 20:13:12 tgl Exp $
2+
dnl $PostgreSQL: pgsql/configure.in,v 1.562 2008/05/20 03:30:22 tgl Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -426,8 +426,6 @@ if test "$enable_profiling" = yes && test "$ac_cv_prog_cc_g" = yes; then
426426
fi
427427
fi
428428

429-
AC_MSG_NOTICE([using CFLAGS=$CFLAGS])
430-
431429
# We already have this in Makefile.win32, but configure needs it too
432430
if test "$PORTNAME" = "win32"; then
433431
CPPFLAGS="$CPPFLAGS -I$srcdir/src/include/port/win32 -DEXEC_BACKEND"
@@ -450,16 +448,6 @@ fi
450448
AC_PROG_CPP
451449
AC_SUBST(GCC)
452450

453-
# If compiler will take -Wl,--as-needed then add that to LDFLAGS.
454-
# This is much easier than trying to filter LIBS to the minimum for each
455-
# executable. (Note that shared libraries won't use this switch, though.)
456-
# On Darwin it's spelled -Wl,-dead_strip_dylibs, but don't try that elsewhere
457-
if test "$PORTNAME" != "darwin"; then
458-
PGAC_PROG_CC_LDFLAGS_OPT([-Wl,--as-needed])
459-
else
460-
PGAC_PROG_CC_LDFLAGS_OPT([-Wl,-dead_strip_dylibs])
461-
fi
462-
463451
# Create compiler version string
464452
if test x"$GCC" = x"yes" ; then
465453
cc_string="GCC `${CC} --version | sed q`"
@@ -773,9 +761,6 @@ AC_SUBST(ELF_SYS)
773761
CPPFLAGS="$CPPFLAGS $INCLUDES"
774762
LDFLAGS="$LDFLAGS $LIBDIRS"
775763

776-
AC_MSG_NOTICE([using CPPFLAGS=$CPPFLAGS])
777-
AC_MSG_NOTICE([using LDFLAGS=$LDFLAGS])
778-
779764
AC_ARG_VAR(LDFLAGS_SL)
780765

781766
PGAC_PROG_LD
@@ -1712,6 +1697,31 @@ AC_MSG_WARN([*** skipping thread test on Win32])
17121697
fi
17131698
fi
17141699

1700+
# If compiler will take -Wl,--as-needed then add that to LDFLAGS.
1701+
# This is much easier than trying to filter LIBS to the minimum for each
1702+
# executable. (Note that shared libraries won't use this switch, though.)
1703+
# On (at least) some Red-Hat-derived systems, this switch breaks linking to
1704+
# libreadline; therefore we postpone testing it until we know what library
1705+
# dependencies readline has. The test code will try to link with $LIBS.
1706+
if test "$with_readline" = yes; then
1707+
link_test_func=readline
1708+
else
1709+
link_test_func=exit
1710+
fi
1711+
if test "$PORTNAME" != "darwin"; then
1712+
PGAC_PROG_CC_LDFLAGS_OPT([-Wl,--as-needed], $link_test_func)
1713+
else
1714+
# On Darwin it's spelled -Wl,-dead_strip_dylibs, but don't try that elsewhere
1715+
PGAC_PROG_CC_LDFLAGS_OPT([-Wl,-dead_strip_dylibs], $link_test_func)
1716+
fi
1717+
1718+
1719+
# Begin output steps
1720+
1721+
AC_MSG_NOTICE([using CFLAGS=$CFLAGS])
1722+
AC_MSG_NOTICE([using CPPFLAGS=$CPPFLAGS])
1723+
AC_MSG_NOTICE([using LDFLAGS=$LDFLAGS])
1724+
17151725
# prepare build tree if outside source tree
17161726
# Note 1: test -ef might not exist, but it's more reliable than `pwd`.
17171727
# Note 2: /bin/pwd might be better than shell's built-in at getting

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp