]> granicus.if.org Git - postgresql/blobdiff - configure.in
Update location to download flex for building on Windows.
[postgresql] / configure.in
index f8f507cd0c31c0fd5486eabb4126274156831fc8..c713e543649e84da0262ce83722cddf2d1b494ce 100644 (file)
@@ -1,5 +1,5 @@
 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
@@ -17,19 +17,22 @@ dnl Read the Autoconf manual for details.
 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
 
@@ -85,7 +88,7 @@ PostgreSQL has apparently not been ported to your platform yet.
 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.
 *******************************************************************
@@ -399,7 +402,7 @@ unset CFLAGS
 # 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
@@ -418,7 +421,8 @@ fi
 
 # 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"
@@ -435,8 +439,8 @@ elif test "$ICC" = yes; then
   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
 
@@ -487,16 +491,6 @@ 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
@@ -800,7 +794,7 @@ AC_SUBST(ELF_SYS)
 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)
@@ -817,6 +811,12 @@ case $host_os in sysv5*)
 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
@@ -836,12 +836,16 @@ if test "$with_python" = yes; then
   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
@@ -867,6 +871,9 @@ AC_SEARCH_LIBS(getopt_long, [getopt gnugetopt])
 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)
 
@@ -906,7 +913,7 @@ fi
 
 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])])
@@ -1136,8 +1143,15 @@ PGAC_FUNC_GETTIMEOFDAY_1ARG
 
 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>])
@@ -1235,7 +1249,19 @@ fi
 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"
 
@@ -1251,23 +1277,24 @@ else
 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.])
@@ -1296,6 +1323,15 @@ AC_CHECK_FUNC(syslog,
               [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;],
@@ -1316,7 +1352,8 @@ AC_CHECK_FUNCS(atexit, [],
 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;;
        *)
@@ -1513,7 +1550,8 @@ fi
 # 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
@@ -1625,11 +1663,6 @@ fi
 # 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
@@ -1693,6 +1726,7 @@ PGAC_CHECK_DOCBOOK(4.2)
 PGAC_PATH_DOCBOOK_STYLESHEETS
 PGAC_PATH_COLLATEINDEX
 AC_CHECK_PROGS(SGMLSPL, sgmlspl)
+PGAC_PATH_DOCBOOK2MAN
 
 # Thread testing
 
@@ -1742,9 +1776,10 @@ AC_MSG_WARN([*** skipping thread test on Win32])
 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.
@@ -1753,11 +1788,13 @@ if test "$with_readline" = yes; then
 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
 
 
@@ -1767,6 +1804,27 @@ AC_MSG_NOTICE([using CFLAGS=$CFLAGS])
 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
@@ -1815,9 +1873,7 @@ AC_CONFIG_HEADERS([src/include/pg_config.h],
 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