# Macros to detect C compiler features
-# $Header: /cvsroot/pgsql/config/c-compiler.m4,v 1.9 2003/10/25 15:32:11 petere Exp $
+# $Header: /cvsroot/pgsql/config/c-compiler.m4,v 1.10 2003/11/01 20:48:51 petere Exp $
# PGAC_C_SIGNED
if test "$ac_env_CFLAGS_set" != set; then
CFLAGS="$CFLAGS $pgac_cv_prog_cc_no_strict_aliasing"
fi])# PGAC_PROG_CC_NO_STRICT_ALIASING
+
+
+# The below backpatches the following Autoconf change:
+#
+# 2002-03-28 Kevin Ryde <user42@zip.com.au>
+#
+# * lib/autoconf/c.m4 (AC_C_INLINE): Test with a typedef return value,
+# to avoid versions of HP C which don't allow that.
+#
+# When we upgrade to Autoconf >= 2.53a then we can drop this and rely
+# on the standard macro.
+
+# AC_C_INLINE
+# -----------
+# Do nothing if the compiler accepts the inline keyword.
+# Otherwise define inline to __inline__ or __inline if one of those work,
+# otherwise define inline to be empty.
+AC_DEFUN([AC_C_INLINE],
+[AC_REQUIRE([AC_PROG_CC_STDC])dnl
+AC_CACHE_CHECK([for inline], ac_cv_c_inline,
+[ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE(
+[#ifndef __cplusplus
+typedef int foo_t;
+static $ac_kw foo_t static_foo () {return 0; }
+$ac_kw int foo () {return 0; }
+#endif
+])],
+ [ac_cv_c_inline=$ac_kw; break])
+done
+])
+case $ac_cv_c_inline in
+ inline | yes) ;;
+ no) AC_DEFINE(inline,,
+ [Define as `__inline' if that's what the C compiler calls it,
+ or to nothing if it is not supported.]) ;;
+ *) AC_DEFINE_UNQUOTED(inline, $ac_cv_c_inline) ;;
+esac
+])# AC_C_INLINE
ac_compiler_gnu=$ac_cv_c_compiler_gnu
-pgac_CFLAGS_before_template=$CFLAGS
+unset CFLAGS
#
# Read the template
if test "$ac_env_CFLAGS_set" = set; then
CFLAGS=$ac_env_CFLAGS_value
-elif test "$pgac_CFLAGS_before_template" != "$CFLAGS"; then
+elif test "${CFLAGS+set}" = set; then
: # (keep what template set)
elif test "$GCC" = yes; then
CFLAGS="-O2"
else
- CFLAGS="-O"
+ # if the user selected debug mode, don't use -O
+ if test "$enable_debug" != yes; then
+ CFLAGS="-O"
+ fi
fi
# Need to specify -fno-strict-aliasing too in case it's gcc 3.3 or later.
fi
# supply -g if --enable-debug
-if test "$enable_debug" = yes -a "$ac_cv_prog_cc_g" = yes; then
+if test "$enable_debug" = yes && test "$ac_cv_prog_cc_g" = yes; then
CFLAGS="$CFLAGS -g"
fi
#line $LINENO "configure"
#include "confdefs.h"
#ifndef __cplusplus
-static $ac_kw int static_foo () {return 0; }
+typedef int foo_t;
+static $ac_kw foo_t static_foo () {return 0; }
$ac_kw int foo () {return 0; }
#endif
dnl Process this file with autoconf to produce a configure script.
-dnl $Header: /cvsroot/pgsql/configure.in,v 1.299 2003/10/28 20:26:45 tgl Exp $
+dnl $Header: /cvsroot/pgsql/configure.in,v 1.300 2003/11/01 20:48:51 petere Exp $
dnl
dnl Developers, please strive to achieve this order:
dnl
AC_PROG_CC([$pgac_cc_list])
-pgac_CFLAGS_before_template=$CFLAGS
+unset CFLAGS
#
# Read the template
if test "$ac_env_CFLAGS_set" = set; then
CFLAGS=$ac_env_CFLAGS_value
-elif test "$pgac_CFLAGS_before_template" != "$CFLAGS"; then
+elif test "${CFLAGS+set}" = set; then
: # (keep what template set)
elif test "$GCC" = yes; then
CFLAGS="-O2"
else
- CFLAGS="-O"
+ # if the user selected debug mode, don't use -O
+ if test "$enable_debug" != yes; then
+ CFLAGS="-O"
+ fi
fi
# Need to specify -fno-strict-aliasing too in case it's gcc 3.3 or later.
PGAC_PROG_CC_NO_STRICT_ALIASING
# supply -g if --enable-debug
-if test "$enable_debug" = yes -a "$ac_cv_prog_cc_g" = yes; then
+if test "$enable_debug" = yes && test "$ac_cv_prog_cc_g" = yes; then
CFLAGS="$CFLAGS -g"
fi