dnl Process this file with autoconf to produce a configure script.
-dnl $PostgreSQL: pgsql/configure.in,v 1.319 2004/03/09 22:40:10 momjian Exp $
+dnl $PostgreSQL: pgsql/configure.in,v 1.360 2004/05/28 20:52:42 momjian Exp $
dnl
dnl Developers, please strive to achieve this order:
dnl
dgux*) template=dgux ;;
freebsd*) template=freebsd ;;
hpux*) template=hpux ;;
- irix*) template=irix5 ;;
+ irix*) template=irix ;;
linux*) template=linux ;;
mingw*) template=win32 ;;
netbsd*) template=netbsd ;;
AC_MSG_RESULT([$with_tcl])
AC_SUBST([with_tcl])
-# If Tcl is enabled (above) then Tk is also, unless the user disables it using --without-tk
-AC_MSG_CHECKING([whether to build with Tk])
-if test "$with_tcl" = yes; then
- PGAC_ARG_BOOL(with, tk, yes, [ --without-tk do not build Tk interfaces if Tcl is enabled])
-else
- with_tk=no
-fi
-AC_MSG_RESULT([$with_tk])
-AC_SUBST([with_tk])
-
-
# We see if the path to the Tcl/Tk configuration scripts is specified.
# This will override the use of tclsh to find the paths to search.
-PGAC_ARG_REQ(with, tclconfig, [ --with-tclconfig=DIR tclConfig.sh and tkConfig.sh are in DIR])
-
-# We see if the path to the Tk configuration scripts is specified.
-# This will override the use of tclsh to find the paths to search.
-
-PGAC_ARG_REQ(with, tkconfig, [ --with-tkconfig=DIR tkConfig.sh is in DIR])
+PGAC_ARG_REQ(with, tclconfig, [ --with-tclconfig=DIR tclConfig.sh is in DIR])
#
# Optionally build Perl modules (PL/Perl)
##
dnl sys/socket.h is required by AC_FUNC_ACCEPT_ARGTYPES
-AC_CHECK_HEADERS([crypt.h dld.h endian.h fp_class.h getopt.h ieeefp.h poll.h pwd.h sys/ipc.h sys/poll.h sys/pstat.h sys/select.h sys/sem.h sys/socket.h sys/shm.h sys/un.h termios.h utime.h kernel/OS.h kernel/image.h SupportDefs.h])
+AC_CHECK_HEADERS([crypt.h dld.h endian.h fp_class.h getopt.h ieeefp.h poll.h pwd.h sys/ipc.h sys/poll.h sys/pstat.h sys/select.h sys/sem.h sys/socket.h sys/shm.h sys/un.h termios.h utime.h wchar.h wctype.h kernel/OS.h kernel/image.h SupportDefs.h])
# At least on IRIX, cpp test for netinet/tcp.h will fail unless
# netinet/in.h is included first.
# SunOS doesn't handle negative byte comparisons properly with +/- return
AC_FUNC_MEMCMP
-AC_CHECK_FUNCS([cbrt dlopen fcvt fdatasync getpeereid memmove poll pstat setproctitle setsid sigprocmask symlink sysconf utime utimes waitpid])
+AC_CHECK_FUNCS([cbrt dlopen fcvt fdatasync getpeereid memmove poll pstat setproctitle setsid sigprocmask symlink sysconf towlower utime utimes waitpid wcstombs])
AC_CHECK_DECLS(fdatasync, [], [], [#include <unistd.h>])
AC_CHECK_FUNCS([fpclass fp_class fp_class_d class], [break])
fi
-AC_REPLACE_FUNCS([crypt fseeko getopt getrusage inet_aton random rint srandom strcasecmp strdup strerror strtol strtoul])
+AC_REPLACE_FUNCS([crypt fseeko getopt getrusage inet_aton random rint srandom strdup strerror strtol strtoul unsetenv])
# system's version of getaddrinfo(), if any, may be used only if we found
# a definition for struct addrinfo; see notes in src/include/getaddrinfo.h
case $host_os in mingw*)
AC_LIBOBJ(copydir)
AC_LIBOBJ(gettimeofday)
-AC_LIBOBJ(pipe)
+AC_LIBOBJ(kill)
+AC_LIBOBJ(open)
AC_LIBOBJ(rand) ;;
esac
-# Win32 can't to rename or unlink on an open file
+# Win32 can't do rename or unlink on an open file
case $host_os in mingw*|cygwin*)
AC_LIBOBJ(dirmod) ;;
esac
# See the comment at the top of src/port/thread.c for more information.
#
if test "$enable_thread_safety" = yes; then
-AC_CHECK_HEADER(pthread.h, [], [AC_MSG_ERROR([pthread.h not found, required for --enable-thread-safety])])
+ACX_PTHREAD # set thread flags
+
+# Some platforms use these, so just defineed them. They can't hurt if they
+# are not supported.
+PTHREAD_CFLAGS="$PTHREAD_CFLAGS -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS"
+
-if test "$THREAD_SUPPORT" != yes; then
+# At this point, we don't want to muck with the compiler name for threading.
+# Let's see who fails, perhaps AIX. 2004-04-23
+if test "$PTHREAD_CC" != "$CC"; then
AC_MSG_ERROR([
-Cannot enable threads on your platform.
-Please report your platform threading info to the PostgreSQL mailing lists
-so it can be added to the next release. Report all compile flags, link flags,
-functions, or libraries required for threading support.
-See the comment at the top of src/port/thread.c for more information.
+PostgreSQL does not support platforms that require a special
+compiler binary for thread-safety.
])
fi
-#
-# Check for re-entrant versions of certain functions
-#
-# Include special flags if threads are enabled _and_ if required for
-# threading on this platform. Some platforms have *_r functions but
-# their natively named funcs are thread-safe too.
-#
-# One trick here is that if we don't call AC_CHECK_FUNCS; the
-# functions are marked "not found", which is perfect.
-#
-if test "$enable_thread_safety" = yes -a "$STRERROR_THREADSAFE" = yes ; then
-AC_DEFINE(STRERROR_THREADSAFE, 1, [Define if strerror is not thread safe])
-fi
-if test "$enable_thread_safety" = yes -a "$GETPWUID_THREADSAFE" = yes ; then
-AC_DEFINE(GETPWUID_THREADSAFE, 1, [Define if getpwuid is not thread safe])
-fi
-if test "$enable_thread_safety" = yes -a "$GETHOSTBYNAME_THREADSAFE" = yes ; then
-AC_DEFINE(GETHOSTBYNAME_THREADSAFE, 1, [Define if gethostbyname is not thread safe])
+if test "$THREAD_SUPPORT" = no; then
+AC_MSG_ERROR([
+Cannot enable threads on your platform.
+Your platform is known to not support thread-safe programs.
+For details, compile and run src/bin/pg_thread_test.
+])
fi
+AC_CHECK_HEADER(pthread.h, [], [AC_MSG_ERROR([pthread.h not found, required for --enable-thread-safety])])
+
# Check for *_r functions
_CFLAGS="$CFLAGS"
_LIBS="$LIBS"
-CFLAGS="$CFLAGS $THREAD_CPPFLAGS"
-LIBS="$LIBS $THREAD_LIBS"
+CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+LIBS="$LIBS $PTHREAD_LIBS"
AC_CHECK_FUNCS([strerror_r getpwuid_r gethostbyname_r])
CFLAGS="$_CFLAGS"
LIBS="$_LIBS"
+PGAC_FUNC_GETPWUID_R_5ARG
+
else
# do not use values from template file
-THREAD_CPPFLAGS=
-THREAD_LIBS=
+PTHREAD_CFLAGS=
+PTHREAD_LIBS=
fi
-AC_SUBST(THREAD_SUPPORT)
-AC_SUBST(THREAD_CPPFLAGS)
-AC_SUBST(THREAD_LIBS)
+AC_SUBST(PTHREAD_CFLAGS)
+AC_SUBST(PTHREAD_LIBS)
# This test makes sure that run tests work at all. Sometimes a shared
AC_SUBST(TCL_SHLIB_LD_LIBS)dnl don't want to double-evaluate that one
fi
-# Check for Tk configuration script tkConfig.sh
-if test "$with_tk" = yes; then
- PGAC_PATH_TKCONFIGSH([$with_tkconfig $with_tclconfig])
- PGAC_EVAL_TCLCONFIGSH([$TK_CONFIG_SH], [TK_LIBS,TK_LIB_SPEC,TK_XINCLUDES])
-fi
-
-
#
# Check for DocBook and tools
#
PGAC_PATH_COLLATEINDEX
AC_CHECK_PROGS(SGMLSPL, sgmlspl)
+# Thread testing
+
+# We have to run the thread test near the end so we have all our symbols
+# defined. Cross compiling throws a warning.
+#
+if test "$enable_thread_safety" = yes; then
+AC_MSG_CHECKING([thread safety of required library functions])
+
+_CFLAGS="$CFLAGS"
+_LIBS="$LIBS"
+CFLAGS="$CFLAGS $PTHREAD_CFLAGS -DIN_CONFIGURE"
+LIBS="$LIBS $PTHREAD_LIBS"
+AC_TRY_RUN([#include "$srcdir/src/tools/thread/thread_test.c"],
+ [AC_MSG_RESULT(yes)],
+ [AC_MSG_RESULT(no)
+ AC_MSG_ERROR([
+*** Thread test program failed. Your platform is not thread-safe.
+*** Check the file 'config.log'for the exact reason.])],
+ [AC_MSG_RESULT(maybe)
+ AC_MSG_WARN([
+*** Skipping thread test program because of cross-compile build.
+*** Run the program in src/tools/thread on the target matchine.
+])])
+CFLAGS="$_CFLAGS"
+LIBS="$_LIBS"
+fi
# prepare build tree if outside source tree
# Note 1: test -ef might not exist, but it's more reliable than `pwd`.
src/Makefile.port:src/makefiles/Makefile.${template}
])
+case $host_os in mingw*)
+AC_CONFIG_COMMANDS([check_win32_symlinks],[
+# Links sometimes fail undetected on Mingw -
+# so here we detect it and warn the user
+for FILE in $CONFIG_LINKS
+ do
+ # test -e works for symlinks in the MinGW console
+ test -e `expr "$FILE" : '\(^:*\)'` || AC_MSG_WARN([*** link for $FILE - please fix by hand])
+ done
+])
+ ;;
+esac
+
AC_CONFIG_HEADERS([src/include/pg_config.h],
[
# Update timestamp for pg_config.h (see Makefile.global)
])
AC_OUTPUT
+