@@ -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
50465052else
5047- ac_func_search_save_LIBS =$LIBS
5048- ac_cv_search_setproctitle=no
5053+ ac_check_lib_save_LIBS =$LIBS
5054+ LIBS="-lm $LIBS"
50495055cat >conftest.$ac_ext <<_ACEOF
50505056/* confdefs.h. */
50515057_ACEOF
50525058cat confdefs.h >>conftest.$ac_ext
50535059cat >>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 ();
51185063int
51195064main ()
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
51505094else
51515095 echo "$as_me: failed program was:" >&5
51525096sed 's/^/| /' conftest.$ac_ext >&5
51535097
5098+ ac_cv_lib_m_main=no
51545099fi
51555100rm -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
51605103fi
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
51665113fi
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
51725119else
51735120 ac_func_search_save_LIBS=$LIBS
5174- ac_cv_search_pow =no
5121+ ac_cv_search_setproctitle =no
51755122cat >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 ();
51895136int
51905137main ()
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"
52205167else
52215168 echo "$as_me: failed program was:" >&5
52225169sed 's/^/| /' conftest.$ac_ext >&5
52235170
52245171fi
52255172rm -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 ();
52445191int
52455192main ()
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"
52755222break
52765223else
52775224 echo "$as_me: failed program was:" >&5
@@ -5284,10 +5231,10 @@ rm -f conftest.err conftest.$ac_objext \
52845231fi
52855232LIBS=$ac_func_search_save_LIBS
52865233fi
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
52925239fi
52935240