dnl Process this file with autoconf to produce a configure script.
-dnl $PostgreSQL: pgsql/configure.in,v 1.335 2004/04/26 13:14:48 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 ;;
##
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(kill)
AC_LIBOBJ(open)
-AC_LIBOBJ(pipe)
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
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
-# Check for gmake.
-AC_CHECK_PROGS(MAKE, gmake make)
-if ! $MAKE -v | grep 'GNU Make' >/dev/null
-then rm -f $srcdir/src/Makefile.global
- AC_MSG_CHECKING([Can not find GNU Make. It is required.])
-fi
-
-# Thread testing
-
-# We have to run the thread test here because it is an external program
-# that has to be runable separately for cross-compiling.
-#
-if test "$enable_thread_safety" = yes; then
-if test cross_compiling != yes; then
-#
-# Clean, compile, run, and clean thread test directory.
-# If test fails for any reason, remove Makefile.global so the user can't
-# compile (to simulate a configure failure).
-#
-AC_MSG_CHECKING([thread safety of required library functions])
-if ! $MAKE -C $srcdir/src/tools/thread clean >&5
-then rm -f $srcdir/src/Makefile.global
- AC_MSG_ERROR([Can not clean thread test directory.])
-fi
-if ! $MAKE -C $srcdir/src/tools/thread >&5
-then rm -f $srcdir/src/Makefile.global
- AC_MSG_ERROR([Can not build thread test proram.])
-fi
-if ! $srcdir/src/tools/thread/thread_test >&5
-then rm -f $srcdir/src/Makefile.global
- echo "no"
- echo
- $srcdir/src/tools/thread/thread_test
- echo
- AC_MSG_ERROR([Thread test program failed. Your platform is not thread-safe.])
-fi
-if ! $MAKE -C $srcdir/src/tools/thread clean >&5
-then rm -f $srcdir/src/Makefile.global
- AC_MSG_ERROR([Can not clean thread test directory.])
-fi
-echo "yes"
-else
-AC_MSG_WARN([
-*** Skipping thread test program because of cross-compile build.
-*** Run the program in $srcdir/src/tools/thread on the target matchine.
-])
-fi
-fi