summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconfigure131
-rw-r--r--configure.in9
-rw-r--r--src/include/pg_config.h.in3
3 files changed, 49 insertions, 94 deletions
diff --git a/configure b/configure
index f09500f6199..2c113768979 100755
--- a/configure
+++ b/configure
@@ -5038,14 +5038,20 @@ _ACEOF
##
## Libraries
##
+## Most libraries are included only if they demonstrably provide a function
+## we need, but libm is an exception: always include it, because there are
+## too many compilers that play cute optimization games that will break
+## probes for standard functions such as pow().
+##
-echo "$as_me:$LINENO: checking for library containing setproctitle" >&5
-echo $ECHO_N "checking for library containing setproctitle... $ECHO_C" >&6
-if test "${ac_cv_search_setproctitle+set}" = set; then
+
+echo "$as_me:$LINENO: checking for main in -lm" >&5
+echo $ECHO_N "checking for main in -lm... $ECHO_C" >&6
+if test "${ac_cv_lib_m_main+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_func_search_save_LIBS=$LIBS
-ac_cv_search_setproctitle=no
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -5053,72 +5059,11 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char setproctitle ();
-int
-main ()
-{
-setproctitle ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_search_setproctitle="none required"
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-if test "$ac_cv_search_setproctitle" = no; then
- for ac_lib in util; do
- LIBS="-l$ac_lib $ac_func_search_save_LIBS"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char setproctitle ();
int
main ()
{
-setproctitle ();
+main ();
;
return 0;
}
@@ -5145,33 +5090,35 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- ac_cv_search_setproctitle="-l$ac_lib"
-break
+ ac_cv_lib_m_main=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
+ac_cv_lib_m_main=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
- done
-fi
-LIBS=$ac_func_search_save_LIBS
+LIBS=$ac_check_lib_save_LIBS
fi
-echo "$as_me:$LINENO: result: $ac_cv_search_setproctitle" >&5
-echo "${ECHO_T}$ac_cv_search_setproctitle" >&6
-if test "$ac_cv_search_setproctitle" != no; then
- test "$ac_cv_search_setproctitle" = "none required" || LIBS="$ac_cv_search_setproctitle $LIBS"
+echo "$as_me:$LINENO: result: $ac_cv_lib_m_main" >&5
+echo "${ECHO_T}$ac_cv_lib_m_main" >&6
+if test $ac_cv_lib_m_main = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
+
+ LIBS="-lm $LIBS"
fi
-echo "$as_me:$LINENO: checking for library containing pow" >&5
-echo $ECHO_N "checking for library containing pow... $ECHO_C" >&6
-if test "${ac_cv_search_pow+set}" = set; then
+echo "$as_me:$LINENO: checking for library containing setproctitle" >&5
+echo $ECHO_N "checking for library containing setproctitle... $ECHO_C" >&6
+if test "${ac_cv_search_setproctitle+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_func_search_save_LIBS=$LIBS
-ac_cv_search_pow=no
+ac_cv_search_setproctitle=no
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -5185,11 +5132,11 @@ extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
-char pow ();
+char setproctitle ();
int
main ()
{
-pow ();
+setproctitle ();
;
return 0;
}
@@ -5216,7 +5163,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- ac_cv_search_pow="none required"
+ ac_cv_search_setproctitle="none required"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
@@ -5224,8 +5171,8 @@ sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
-if test "$ac_cv_search_pow" = no; then
- for ac_lib in m; do
+if test "$ac_cv_search_setproctitle" = no; then
+ for ac_lib in util; do
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
@@ -5240,11 +5187,11 @@ extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
-char pow ();
+char setproctitle ();
int
main ()
{
-pow ();
+setproctitle ();
;
return 0;
}
@@ -5271,7 +5218,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- ac_cv_search_pow="-l$ac_lib"
+ ac_cv_search_setproctitle="-l$ac_lib"
break
else
echo "$as_me: failed program was:" >&5
@@ -5284,10 +5231,10 @@ rm -f conftest.err conftest.$ac_objext \
fi
LIBS=$ac_func_search_save_LIBS
fi
-echo "$as_me:$LINENO: result: $ac_cv_search_pow" >&5
-echo "${ECHO_T}$ac_cv_search_pow" >&6
-if test "$ac_cv_search_pow" != no; then
- test "$ac_cv_search_pow" = "none required" || LIBS="$ac_cv_search_pow $LIBS"
+echo "$as_me:$LINENO: result: $ac_cv_search_setproctitle" >&5
+echo "${ECHO_T}$ac_cv_search_setproctitle" >&6
+if test "$ac_cv_search_setproctitle" != no; then
+ test "$ac_cv_search_setproctitle" = "none required" || LIBS="$ac_cv_search_setproctitle $LIBS"
fi
diff --git a/configure.in b/configure.in
index 471e9b9ba67..514329473a4 100644
--- a/configure.in
+++ b/configure.in
@@ -1,5 +1,5 @@
dnl Process this file with autoconf to produce a configure script.
-dnl $PostgreSQL: pgsql/configure.in,v 1.485 2006/10/30 22:15:04 petere Exp $
+dnl $PostgreSQL: pgsql/configure.in,v 1.486 2006/11/06 03:44:37 tgl Exp $
dnl
dnl Developers, please strive to achieve this order:
dnl
@@ -640,9 +640,14 @@ AC_DEFINE_UNQUOTED(PG_VERSION_NUM, $PG_VERSION_NUM, [PostgreSQL version as a num
##
## Libraries
##
+## Most libraries are included only if they demonstrably provide a function
+## we need, but libm is an exception: always include it, because there are
+## too many compilers that play cute optimization games that will break
+## probes for standard functions such as pow().
+##
+AC_CHECK_LIB(m, main)
AC_SEARCH_LIBS(setproctitle, util)
-AC_SEARCH_LIBS(pow, m)
AC_SEARCH_LIBS(dlopen, dl)
AC_SEARCH_LIBS(socket, [socket wsock32])
AC_SEARCH_LIBS(shl_load, dld)
diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in
index 0043e9afaf2..7c1ac6b69bf 100644
--- a/src/include/pg_config.h.in
+++ b/src/include/pg_config.h.in
@@ -233,6 +233,9 @@
/* Define to 1 if you have the `ldap_r' library (-lldap_r). */
#undef HAVE_LIBLDAP_R
+/* Define to 1 if you have the `m' library (-lm). */
+#undef HAVE_LIBM
+
/* Define to 1 if you have the `pam' library (-lpam). */
#undef HAVE_LIBPAM