dnl Process this file with autoconf to produce a configure script.
-dnl $PostgreSQL: pgsql/configure.in,v 1.573 2008/11/24 09:15:15 mha Exp $
+dnl $PostgreSQL: pgsql/configure.in,v 1.605 2009/07/16 17:43:52 tgl Exp $
dnl
dnl Developers, please strive to achieve this order:
dnl
dnl
m4_pattern_forbid(^PGAC_)dnl to catch undefined macros
-AC_INIT([PostgreSQL], [8.4devel], [pgsql-bugs@postgresql.org])
+AC_INIT([PostgreSQL], [8.5devel], [pgsql-bugs@postgresql.org])
-m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.61], [], [m4_fatal([Autoconf version 2.61 is required.
+m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.63], [], [m4_fatal([Autoconf version 2.63 is required.
Untested combinations of 'autoconf' and PostgreSQL versions are not
recommended. You can remove the check from 'configure.in' but it is then
your responsibility whether the result works or not.])])
-AC_COPYRIGHT([Copyright (c) 1996-2008, PostgreSQL Global Development Group])
+AC_COPYRIGHT([Copyright (c) 1996-2009, PostgreSQL Global Development Group])
AC_CONFIG_SRCDIR([src/backend/access/common/heaptuple.c])
AC_CONFIG_AUX_DIR(config)
AC_PREFIX_DEFAULT(/usr/local/pgsql)
AC_SUBST(configure_args, [$ac_configure_args])
AC_DEFINE_UNQUOTED(PG_VERSION, "$PACKAGE_VERSION", [PostgreSQL version as a string])
+[PG_MAJORVERSION=`expr "$PACKAGE_VERSION" : '\([0-9][0-9]*\.[0-9][0-9]*\)'`]
+AC_SUBST(PG_MAJORVERSION)
+AC_DEFINE_UNQUOTED(PG_MAJORVERSION, "$PG_MAJORVERSION", [PostgreSQL major version as a string])
AC_CANONICAL_HOST
To try a manual configuration, look into the src/template directory
for a similar platform and use the '--with-template=' option.
-Please also contact <pgsql-ports@postgresql.org> to see about
+Please also contact <pgsql-bugs@postgresql.org> to see about
rectifying this. Include the above 'checking host system type...'
line.
*******************************************************************
# else: If the template file set something, that is used.
# else: If coverage was enabled, don't set anything.
# else: If the compiler is GCC, then we use -O2.
-# else: If the compiler is something else, then we use -O.
+# else: If the compiler is something else, then we use -O, unless debugging.
if test "$ac_env_CFLAGS_set" = set; then
CFLAGS=$ac_env_CFLAGS_value
# Some versions of GCC support some additional useful warning flags.
# Check whether they are supported, and add them to CFLAGS if so.
-# ICC pretends to be GCC but it's lying; it doesn't support these options.
+# ICC pretends to be GCC but it's lying; it doesn't support these flags,
+# but has its own. Also check other compiler-specific flags here.
if test "$GCC" = yes -a "$ICC" = no; then
CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wpointer-arith"
PGAC_PROG_CC_CFLAGS_OPT([-mp1])
# Make sure strict aliasing is off (though this is said to be the default)
PGAC_PROG_CC_CFLAGS_OPT([-fno-strict-aliasing])
-elif test x"${CC}" = x"xlc"; then
- # AIX xlc has to have strict aliasing turned off too
+elif test "$PORTNAME" = "aix"; then
+ # AIX's xlc has to have strict aliasing turned off too
PGAC_PROG_CC_CFLAGS_OPT([-qnoansialias])
fi
AC_PROG_CPP
AC_SUBST(GCC)
-# Create compiler version string
-if test x"$GCC" = x"yes" ; then
- cc_string="GCC `${CC} --version | sed q`"
-else
- cc_string=$CC
-fi
-AC_DEFINE_UNQUOTED(PG_VERSION_STR,
- ["PostgreSQL $PACKAGE_VERSION on $host, compiled by $cc_string"],
- [A string containing the version number, platform, and C compiler])
-
#
# Set up TAS assembly code if needed; the template file has now had its
CPPFLAGS="$CPPFLAGS $INCLUDES"
LDFLAGS="$LDFLAGS $LIBDIRS"
-AC_ARG_VAR(LDFLAGS_SL)
+AC_ARG_VAR(LDFLAGS_SL, [linker flags for shared library linking])
PGAC_PROG_LD
AC_SUBST(LD)
esac
AC_PROG_RANLIB
PGAC_CHECK_STRIP
+AC_CHECK_TOOL(AR, ar, ar)
+if test "$PORTNAME" = "win32"; then
+ AC_CHECK_TOOL(DLLTOOL, dlltool, dlltool)
+ AC_CHECK_TOOL(DLLWRAP, dllwrap, dllwrap)
+ AC_CHECK_TOOL(WINDRES, windres, windres)
+fi
AC_PATH_PROG(TAR, tar)
AC_PROG_LN_S
PGAC_CHECK_PYTHON_EMBED_SETUP
fi
-# Supply a numeric version string for use by 3rd party add-ons
-# awk -F is a regex on some platforms, and not on others, so make "." a tab
-[PG_VERSION_NUM="`echo "$PACKAGE_VERSION" | sed 's/[A-Za-z].*$//' |
-tr '.' ' ' |
-$AWK '{printf "%d%02d%02d", $1, $2, (NF >= 3) ? $3 : 0}'`"]
-AC_DEFINE_UNQUOTED(PG_VERSION_NUM, $PG_VERSION_NUM, [PostgreSQL version as a number])
+if test "$cross_compiling" = yes && test -z "$with_system_tzdata"; then
+ AC_PATH_PROG(ZIC, zic)
+ if test -z "$ZIC"; then
+ AC_MSG_ERROR([
+When cross-compiling, either use the option --with-system-tzdata to use
+existing time-zone data, or set the environment variable ZIC to a zic
+program to use during the build.])
+ fi
+fi
+
##
## Libraries
AC_SEARCH_LIBS(crypt, crypt)
# Solaris:
AC_SEARCH_LIBS(fdatasync, [rt posix4])
+# Required for thread_test.c on Solaris 2.5:
+# Other ports use it too (HP-UX) so test unconditionally
+AC_SEARCH_LIBS(gethostbyname_r, nsl)
# Cygwin:
AC_SEARCH_LIBS(shmget, cygipc)
if test "$with_krb5" = yes ; then
if test "$PORTNAME" != "win32"; then
- AC_SEARCH_LIBS(com_err, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken' com_err], [],
+ AC_SEARCH_LIBS(com_err, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken' com_err 'com_err -lssl -lcrypto'], [],
[AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
[AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
AC_CHECK_FUNCS([cbrt dlopen fcvt fdatasync getpeereid getpeerucred getrlimit memmove poll pstat readlink setproctitle setsid sigprocmask symlink sysconf towlower utime utimes waitpid wcstombs])
-AC_CHECK_DECLS(fdatasync, [], [], [#include <unistd.h>])
+# posix_fadvise() is a no-op on Solaris, so don't incur function overhead
+# by calling it, 2009-04-02
+# http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libc/port/gen/posix_fadvise.c
+if test "$PORTNAME" != "solaris"; then
+AC_CHECK_FUNCS(posix_fadvise)
AC_CHECK_DECLS(posix_fadvise, [], [], [#include <fcntl.h>])
+fi
+
+AC_CHECK_DECLS(fdatasync, [], [], [#include <unistd.h>])
AC_CHECK_DECLS([strlcat, strlcpy])
# This is probably only present on Darwin, but may as well check always
AC_CHECK_DECLS(F_FULLFSYNC, [], [], [#include <fcntl.h>])
pgac_save_LIBS="$LIBS"
LIBS=`echo "$LIBS" | sed -e 's/-ledit//g' -e 's/-lreadline//g'`
-AC_REPLACE_FUNCS([crypt getopt getrusage inet_aton random rint srandom strdup strerror strlcat strlcpy strtol strtoul unsetenv])
+AC_REPLACE_FUNCS([crypt erand48 getopt getrusage inet_aton random rint srandom strdup strerror strlcat strlcpy strtol strtoul])
+
+case $host_os in
+
+ # Windows uses a specialised env handler
+ mingw*)
+ AC_DEFINE(HAVE_UNSETENV, 1, [Define to 1 because replacement version used.])
+ ac_cv_func_unsetenv=yes;;
+ *)
+ AC_REPLACE_FUNCS([unsetenv])
+ ;;
+esac
+
LIBS="$pgac_save_LIBS"
fi
# Similarly, use system's getopt_long() only if system provides struct option.
-# Solaris' getopt() doesn't do what we want for long options, so always use
-# our versions on that platform.
-if test "$PORTNAME" = "solaris"; then
- AC_LIBOBJ(getopt)
- AC_LIBOBJ(getopt_long)
-elif test x"$ac_cv_type_struct_option" = xyes ; then
+if test x"$ac_cv_type_struct_option" = xyes ; then
AC_REPLACE_FUNCS([getopt_long])
else
AC_LIBOBJ(getopt_long)
fi
+# Solaris' getopt() doesn't do what we want for long options, so always use
+# our version on that platform.
+if test "$PORTNAME" = "solaris"; then
+ AC_LIBOBJ(getopt)
+fi
+
# Win32 support
if test "$PORTNAME" = "win32"; then
AC_REPLACE_FUNCS(gettimeofday)
AC_LIBOBJ(kill)
AC_LIBOBJ(open)
-AC_LIBOBJ(rand)
+AC_LIBOBJ(win32env)
AC_LIBOBJ(win32error)
AC_DEFINE([HAVE_SYMLINK], 1,
[Define to 1 if you have the `symlink' function.])
[AC_CHECK_HEADER(syslog.h,
[AC_DEFINE(HAVE_SYSLOG, 1, [Define to 1 if you have the syslog interface.])])])
+AC_CACHE_CHECK([for opterr], pgac_cv_var_int_opterr,
+[AC_TRY_LINK([#include <unistd.h>],
+ [extern int opterr; opterr = 1;],
+ [pgac_cv_var_int_opterr=yes],
+ [pgac_cv_var_int_opterr=no])])
+if test x"$pgac_cv_var_int_opterr" = x"yes"; then
+ AC_DEFINE(HAVE_INT_OPTERR, 1, [Define to 1 if you have the global variable 'int opterr'.])
+fi
+
AC_CACHE_CHECK([for optreset], pgac_cv_var_int_optreset,
[AC_TRY_LINK([#include <unistd.h>],
[extern int optreset; optreset = 1;],
AC_REPLACE_FUNCS(fseeko)
case $host_os in
# BSD/OS & NetBSD use a custom fseeko/ftello built on fsetpos/fgetpos
- bsdi*|netbsd*)
+ # Mingw uses macros to access Win32 API calls
+ bsdi*|netbsd*|mingw*)
AC_DEFINE(HAVE_FSEEKO, 1, [Define to 1 because replacement version used.])
ac_cv_func_fseeko=yes;;
*)
# Need a #define for the size of Datum (unsigned long)
AC_CHECK_SIZEOF([unsigned long])
-# And one for the size of size_t (enables tweaks for > 32bit address space)
+# And check size of void *, size_t (enables tweaks for > 32bit address space)
+AC_CHECK_SIZEOF([void *])
AC_CHECK_SIZEOF([size_t])
# Decide whether float4 is passed by value: user-selectable, enabled by default
# SunOS doesn't handle negative byte comparisons properly with +/- return
AC_FUNC_MEMCMP
-# Check for fnmatch()
-AC_FUNC_FNMATCH
-if test x"$ac_cv_func_fnmatch_works" != x"yes"; then
- AC_LIBOBJ(fnmatch)
-fi
# Select semaphore implementation type.
if test "$PORTNAME" != "win32"; then
PGAC_PATH_DOCBOOK_STYLESHEETS
PGAC_PATH_COLLATEINDEX
AC_CHECK_PROGS(SGMLSPL, sgmlspl)
+PGAC_PATH_DOCBOOK2MAN
# Thread testing
fi
fi
-# If compiler will take -Wl,--as-needed then add that to LDFLAGS.
-# This is much easier than trying to filter LIBS to the minimum for each
-# executable. (Note that shared library links won't use this switch, though.)
+# If compiler will take -Wl,--as-needed (or various platform-specific
+# spellings thereof) then add that to LDFLAGS. This is much easier than
+# trying to filter LIBS to the minimum for each executable.
+# (Note that shared library links won't use this switch, though.)
# On (at least) some Red-Hat-derived systems, this switch breaks linking to
# libreadline; therefore we postpone testing it until we know what library
# dependencies readline has. The test code will try to link with $LIBS.
else
link_test_func=exit
fi
-if test "$PORTNAME" != "darwin"; then
- PGAC_PROG_CC_LDFLAGS_OPT([-Wl,--as-needed], $link_test_func)
-else
- # On Darwin it's spelled -Wl,-dead_strip_dylibs, but don't try that elsewhere
+
+if test "$PORTNAME" = "darwin"; then
PGAC_PROG_CC_LDFLAGS_OPT([-Wl,-dead_strip_dylibs], $link_test_func)
+elif test "$PORTNAME" = "openbsd"; then
+ PGAC_PROG_CC_LDFLAGS_OPT([-Wl,-Bdynamic], $link_test_func)
+else
+ PGAC_PROG_CC_LDFLAGS_OPT([-Wl,--as-needed], $link_test_func)
fi
AC_MSG_NOTICE([using CPPFLAGS=$CPPFLAGS])
AC_MSG_NOTICE([using LDFLAGS=$LDFLAGS])
+# Create compiler version string
+if test x"$GCC" = x"yes" ; then
+ cc_string="GCC `${CC} --version | sed q`"
+elif test x"$SUN_STUDIO_CC" = x"yes" ; then
+ cc_string=`${CC} -V 2>&1 | sed q`
+else
+ cc_string=$CC
+fi
+
+AC_DEFINE_UNQUOTED(PG_VERSION_STR,
+ ["PostgreSQL $PACKAGE_VERSION on $host, compiled by $cc_string, `expr $ac_cv_sizeof_void_p \* 8`-bit"],
+ [A string containing the version number, platform, and C compiler])
+
+# Supply a numeric version string for use by 3rd party add-ons
+# awk -F is a regex on some platforms, and not on others, so make "." a tab
+[PG_VERSION_NUM="`echo "$PACKAGE_VERSION" | sed 's/[A-Za-z].*$//' |
+tr '.' ' ' |
+$AWK '{printf "%d%02d%02d", $1, $2, (NF >= 3) ? $3 : 0}'`"]
+AC_DEFINE_UNQUOTED(PG_VERSION_NUM, $PG_VERSION_NUM, [PostgreSQL version as a number])
+
+
# prepare build tree if outside source tree
# Note 1: test -ef might not exist, but it's more reliable than `pwd`.
# Note 2: /bin/pwd might be better than shell's built-in at getting
echo >src/include/stamp-h
])
-AC_CONFIG_HEADERS([src/interfaces/ecpg/include/ecpg_config.h])
+AC_CONFIG_HEADERS([src/interfaces/ecpg/include/ecpg_config.h],
+ [echo >src/interfaces/ecpg/include/stamp-h])
AC_OUTPUT
-
-# Warn about unknown options
-PGAC_ARG_CHECK