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

Commit02f37bd

Browse files
committed
Revert to the pre-8.2 method of probing for libm, that is, always
include it if it links properly. It seems too risky to assume thatstandard functions like pow() are not special-cased by the compiler.Per report from Andreas Lange that build fails on Solaris cc compilerwith -fast. Even though we don't consider that a supported option,I'm worried that similar issues will arise with other compilers.
1 parent74686b6 commit02f37bd

File tree

3 files changed

+49
-94
lines changed

3 files changed

+49
-94
lines changed

‎configure

Lines changed: 39 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -5038,87 +5038,32 @@ _ACEOF
50385038
##
50395039
## Libraries
50405040
##
5041+
## Most libraries are included only if they demonstrably provide a function
5042+
## we need, but libm is an exception: always include it, because there are
5043+
## too many compilers that play cute optimization games that will break
5044+
## probes for standard functions such as pow().
5045+
##
50415046

5042-
echo "$as_me:$LINENO: checking for library containing setproctitle" >&5
5043-
echo $ECHO_N "checking for library containing setproctitle... $ECHO_C" >&6
5044-
if test "${ac_cv_search_setproctitle+set}" = set; then
5047+
5048+
echo "$as_me:$LINENO: checking for main in -lm" >&5
5049+
echo $ECHO_N "checking for main in -lm... $ECHO_C" >&6
5050+
if test "${ac_cv_lib_m_main+set}" = set; then
50455051
echo $ECHO_N "(cached) $ECHO_C" >&6
50465052
else
5047-
ac_func_search_save_LIBS=$LIBS
5048-
ac_cv_search_setproctitle=no
5053+
ac_check_lib_save_LIBS=$LIBS
5054+
LIBS="-lm $LIBS"
50495055
cat >conftest.$ac_ext <<_ACEOF
50505056
/* confdefs.h. */
50515057
_ACEOF
50525058
cat confdefs.h >>conftest.$ac_ext
50535059
cat >>conftest.$ac_ext <<_ACEOF
50545060
/* end confdefs.h. */
50555061

5056-
/* Override any gcc2 internal prototype to avoid an error. */
5057-
#ifdef __cplusplus
5058-
extern "C"
5059-
#endif
5060-
/* We use char because int might match the return type of a gcc2
5061-
builtin and then its argument prototype would still apply. */
5062-
char setproctitle ();
5063-
int
5064-
main ()
5065-
{
5066-
setproctitle ();
5067-
;
5068-
return 0;
5069-
}
5070-
_ACEOF
5071-
rm -f conftest.$ac_objext conftest$ac_exeext
5072-
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
5073-
(eval $ac_link) 2>conftest.er1
5074-
ac_status=$?
5075-
grep -v '^ *+' conftest.er1 >conftest.err
5076-
rm -f conftest.er1
5077-
cat conftest.err >&5
5078-
echo "$as_me:$LINENO: \$? = $ac_status" >&5
5079-
(exit $ac_status); } &&
5080-
{ ac_try='test -z "$ac_c_werror_flag"
5081-
|| test ! -s conftest.err'
5082-
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
5083-
(eval $ac_try) 2>&5
5084-
ac_status=$?
5085-
echo "$as_me:$LINENO: \$? = $ac_status" >&5
5086-
(exit $ac_status); }; } &&
5087-
{ ac_try='test -s conftest$ac_exeext'
5088-
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
5089-
(eval $ac_try) 2>&5
5090-
ac_status=$?
5091-
echo "$as_me:$LINENO: \$? = $ac_status" >&5
5092-
(exit $ac_status); }; }; then
5093-
ac_cv_search_setproctitle="none required"
5094-
else
5095-
echo "$as_me: failed program was:" >&5
5096-
sed 's/^/| /' conftest.$ac_ext >&5
50975062

5098-
fi
5099-
rm -f conftest.err conftest.$ac_objext \
5100-
conftest$ac_exeext conftest.$ac_ext
5101-
if test "$ac_cv_search_setproctitle" = no; then
5102-
for ac_lib in util; do
5103-
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
5104-
cat >conftest.$ac_ext <<_ACEOF
5105-
/* confdefs.h. */
5106-
_ACEOF
5107-
cat confdefs.h >>conftest.$ac_ext
5108-
cat >>conftest.$ac_ext <<_ACEOF
5109-
/* end confdefs.h. */
5110-
5111-
/* Override any gcc2 internal prototype to avoid an error. */
5112-
#ifdef __cplusplus
5113-
extern "C"
5114-
#endif
5115-
/* We use char because int might match the return type of a gcc2
5116-
builtin and then its argument prototype would still apply. */
5117-
char setproctitle ();
51185063
int
51195064
main ()
51205065
{
5121-
setproctitle ();
5066+
main ();
51225067
;
51235068
return 0;
51245069
}
@@ -5145,33 +5090,35 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
51455090
ac_status=$?
51465091
echo "$as_me:$LINENO: \$? = $ac_status" >&5
51475092
(exit $ac_status); }; }; then
5148-
ac_cv_search_setproctitle="-l$ac_lib"
5149-
break
5093+
ac_cv_lib_m_main=yes
51505094
else
51515095
echo "$as_me: failed program was:" >&5
51525096
sed 's/^/| /' conftest.$ac_ext >&5
51535097

5098+
ac_cv_lib_m_main=no
51545099
fi
51555100
rm -f conftest.err conftest.$ac_objext \
51565101
conftest$ac_exeext conftest.$ac_ext
5157-
done
5158-
fi
5159-
LIBS=$ac_func_search_save_LIBS
5102+
LIBS=$ac_check_lib_save_LIBS
51605103
fi
5161-
echo "$as_me:$LINENO: result: $ac_cv_search_setproctitle" >&5
5162-
echo "${ECHO_T}$ac_cv_search_setproctitle" >&6
5163-
if test "$ac_cv_search_setproctitle" != no; then
5164-
test "$ac_cv_search_setproctitle" = "none required" || LIBS="$ac_cv_search_setproctitle $LIBS"
5104+
echo "$as_me:$LINENO: result: $ac_cv_lib_m_main" >&5
5105+
echo "${ECHO_T}$ac_cv_lib_m_main" >&6
5106+
if test $ac_cv_lib_m_main = yes; then
5107+
cat >>confdefs.h <<_ACEOF
5108+
#define HAVE_LIBM 1
5109+
_ACEOF
5110+
5111+
LIBS="-lm $LIBS"
51655112

51665113
fi
51675114

5168-
echo "$as_me:$LINENO: checking for library containingpow" >&5
5169-
echo $ECHO_N "checking for library containingpow... $ECHO_C" >&6
5170-
if test "${ac_cv_search_pow+set}" = set; then
5115+
echo "$as_me:$LINENO: checking for library containingsetproctitle" >&5
5116+
echo $ECHO_N "checking for library containingsetproctitle... $ECHO_C" >&6
5117+
if test "${ac_cv_search_setproctitle+set}" = set; then
51715118
echo $ECHO_N "(cached) $ECHO_C" >&6
51725119
else
51735120
ac_func_search_save_LIBS=$LIBS
5174-
ac_cv_search_pow=no
5121+
ac_cv_search_setproctitle=no
51755122
cat >conftest.$ac_ext <<_ACEOF
51765123
/* confdefs.h. */
51775124
_ACEOF
@@ -5185,11 +5132,11 @@ extern "C"
51855132
#endif
51865133
/* We use char because int might match the return type of a gcc2
51875134
builtin and then its argument prototype would still apply. */
5188-
charpow ();
5135+
charsetproctitle ();
51895136
int
51905137
main ()
51915138
{
5192-
pow ();
5139+
setproctitle ();
51935140
;
51945141
return 0;
51955142
}
@@ -5216,16 +5163,16 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
52165163
ac_status=$?
52175164
echo "$as_me:$LINENO: \$? = $ac_status" >&5
52185165
(exit $ac_status); }; }; then
5219-
ac_cv_search_pow="none required"
5166+
ac_cv_search_setproctitle="none required"
52205167
else
52215168
echo "$as_me: failed program was:" >&5
52225169
sed 's/^/| /' conftest.$ac_ext >&5
52235170

52245171
fi
52255172
rm -f conftest.err conftest.$ac_objext \
52265173
conftest$ac_exeext conftest.$ac_ext
5227-
if test "$ac_cv_search_pow" = no; then
5228-
for ac_lib inm; do
5174+
if test "$ac_cv_search_setproctitle" = no; then
5175+
for ac_lib inutil; do
52295176
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
52305177
cat >conftest.$ac_ext <<_ACEOF
52315178
/* confdefs.h. */
@@ -5240,11 +5187,11 @@ extern "C"
52405187
#endif
52415188
/* We use char because int might match the return type of a gcc2
52425189
builtin and then its argument prototype would still apply. */
5243-
charpow ();
5190+
charsetproctitle ();
52445191
int
52455192
main ()
52465193
{
5247-
pow ();
5194+
setproctitle ();
52485195
;
52495196
return 0;
52505197
}
@@ -5271,7 +5218,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
52715218
ac_status=$?
52725219
echo "$as_me:$LINENO: \$? = $ac_status" >&5
52735220
(exit $ac_status); }; }; then
5274-
ac_cv_search_pow="-l$ac_lib"
5221+
ac_cv_search_setproctitle="-l$ac_lib"
52755222
break
52765223
else
52775224
echo "$as_me: failed program was:" >&5
@@ -5284,10 +5231,10 @@ rm -f conftest.err conftest.$ac_objext \
52845231
fi
52855232
LIBS=$ac_func_search_save_LIBS
52865233
fi
5287-
echo "$as_me:$LINENO: result: $ac_cv_search_pow" >&5
5288-
echo "${ECHO_T}$ac_cv_search_pow" >&6
5289-
if test "$ac_cv_search_pow" != no; then
5290-
test "$ac_cv_search_pow" = "none required" || LIBS="$ac_cv_search_pow $LIBS"
5234+
echo "$as_me:$LINENO: result: $ac_cv_search_setproctitle" >&5
5235+
echo "${ECHO_T}$ac_cv_search_setproctitle" >&6
5236+
if test "$ac_cv_search_setproctitle" != no; then
5237+
test "$ac_cv_search_setproctitle" = "none required" || LIBS="$ac_cv_search_setproctitle $LIBS"
52915238

52925239
fi
52935240

‎configure.in

Lines changed: 7 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.485 2006/10/30 22:15:04 petere Exp $
2+
dnl $PostgreSQL: pgsql/configure.in,v 1.486 2006/11/06 03:44:37 tgl Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -640,9 +640,14 @@ AC_DEFINE_UNQUOTED(PG_VERSION_NUM, $PG_VERSION_NUM, [PostgreSQL version as a num
640640
##
641641
## Libraries
642642
##
643+
## Most libraries are included only if they demonstrably provide a function
644+
## we need, but libm is an exception: always include it, because there are
645+
## too many compilers that play cute optimization games that will break
646+
## probes for standard functions such as pow().
647+
##
643648

649+
AC_CHECK_LIB(m, main)
644650
AC_SEARCH_LIBS(setproctitle, util)
645-
AC_SEARCH_LIBS(pow, m)
646651
AC_SEARCH_LIBS(dlopen, dl)
647652
AC_SEARCH_LIBS(socket, [socket wsock32])
648653
AC_SEARCH_LIBS(shl_load, dld)

‎src/include/pg_config.h.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,9 @@
233233
/* Define to 1 if you have the `ldap_r' library (-lldap_r). */
234234
#undef HAVE_LIBLDAP_R
235235

236+
/* Define to 1 if you have the `m' library (-lm). */
237+
#undef HAVE_LIBM
238+
236239
/* Define to 1 if you have the `pam' library (-lpam). */
237240
#undef HAVE_LIBPAM
238241

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp