XEmacs 21.2.32 "Kastor & Polydeukes".
[chise/xemacs-chise.git.1] / configure.in
index 97863cc..28bc58a 100644 (file)
@@ -14,7 +14,7 @@ define([AC_INIT_NOTICE],
 ### from the file `./configure.in'.
 ### To rebuild it, execute the command
 ###    autoconf
-### in the this directory.  You must have autoconf version 2.12 or later.
+### in the this directory.  You must have autoconf version 2.13 or later.
 
 ### This file is part of XEmacs.
 
@@ -50,7 +50,7 @@ dnl configuration code and autoconf macros.
 dnl We use the m4 quoting characters [ ] (as established by the
 dnl autoconf system), so quote them like this: [[foo]]
 
-AC_PREREQ(2.12)dnl
+AC_PREREQ(2.13)dnl
 dnl Redefine some standard autoconf macros
 dnl here is how XEmacs is different:
 dnl - no cache file
@@ -307,6 +307,7 @@ mandir='${prefix}/man'
 dnl Initialize some other variables.
 subdirs=
 MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
 dnl Maximum number of lines to put in a shell here document.
 ac_max_here_lines=12
 ])dnl AC_INIT_PARSE_ARGS
@@ -368,9 +369,6 @@ with_scrollbars=''
 with_widgets=''
 with_dialogs=''
 with_file_coding=''
-dnl const_is_losing is removed - we rely on AC_C_CONST instead.
-dnl We accept (and ignore) the --const-is-losing option for compatibility.
-dnl const_is_losing='yes'
 cpp='' cppflags='' libs='' ldflags=''
 dynamic=''
 with_x11=''
@@ -508,6 +506,7 @@ while test $# != 0; do
        with_sparcworks | \
        with_tooltalk   | \
        with_ldap       | \
+       with_postgresql | \
        with_pop        | \
        with_kerberos   | \
        with_hesiod     | \
@@ -516,7 +515,6 @@ while test $# != 0; do
        external_widget | \
        verbose         | \
        extra_verbose   | \
-       const_is_losing | \
        usage_tracking  | \
        use_union_type  | \
        pdump           | \
@@ -804,6 +802,7 @@ The default is to autodetect all sound support."])
        "use_minimal_tagbits" | \
        "use_indexed_lrecord_implementation" | \
        "run_in_place"  | \
+       "const_is_losing" | \
        "with_gnu_make" )
          AC_MSG_WARN([Obsolete option \`--$optname' ignored.])
        ;;
@@ -1004,6 +1003,8 @@ else
   PROGNAME=xemacs
 fi
 
+AC_DEFINE_UNQUOTED(EMACS_PROGNAME, "$PROGNAME")
+
 dnl ----------------------------------
 dnl Error checking and debugging flags
 dnl ----------------------------------
@@ -1086,8 +1087,7 @@ case "$canonical" in
   m68*-sony-*      ) machine=news ;;
   mips-sony-*      ) machine=news-risc ;;
   clipper-*        ) machine=clipper ;;
-  arm-*            ) machine=arm ;;
-  armv[34][lb]-*   ) machine=arm ;;
+  arm*             ) machine=arm ;;
   ns32k-*          ) machine=ns32000 ;;
 esac
 
@@ -1644,7 +1644,14 @@ test -n "$NON_GNU_CPP" -a "$GCC" != "yes" -a -z "$CPP" && CPP="$NON_GNU_CPP"
 
 AC_PROG_CPP
 
-AC_AIX
+dnl --------------------------------------------------------------------
+dnl Compiler feature macros
+dnl --------------------------------------------------------------------
+
+dnl We want feature macros defined here and in config.h.in, so that
+dnl the compilation environment at configure time and compile time agree.
+
+AC_AIX dnl Defines _ALL_SOURCE on AIX.
 
 AC_MSG_CHECKING(for GNU libc)
 AC_TRY_COMPILE([#include <features.h>],[
@@ -1658,6 +1665,23 @@ dnl I'm tired of pop being broken with GLIBC -slb
 dnl Well. then why not fix fucking pop?
 test "$have_glibc" = "yes" && AC_DEFINE(_GNU_SOURCE)
 
+dnl We'd like to use vendor extensions, where available.
+dnl We'd like to use functions from the latest Unix98 standards.
+dnl See http://www.opengroup.org/onlinepubs/007908799/xsh/compilation.html
+case "$opsys" in
+  sol2) 
+   AC_DEFINE(__EXTENSIONS__)
+   dnl Solaris 2 before 2.5 had some bugs with feature test macro interaction.
+   if test "$os_release" -ge 55; then
+     AC_DEFINE(_XOPEN_SOURCE,500)
+     AC_DEFINE(_XOPEN_SOURCE_EXTENDED)
+   fi ;;
+  linux)
+    AC_DEFINE(_POSIX_C_SOURCE,199506L)
+    AC_DEFINE(_XOPEN_SOURCE,500)
+    AC_DEFINE(_XOPEN_SOURCE_EXTENDED)
+    ;;
+esac
 
 dnl Identify compilers to enable compiler-specific hacks.
 dnl Add support for other compilers HERE!
@@ -1840,6 +1864,70 @@ if test "$cflags_specified" = "no"; then
   fi
 fi
 
+dnl Search for GCC specific build problems we know about
+if test "$GCC" = "yes"; then
+AC_MSG_CHECKING(for buggy gcc versions)
+GCC_VERSION=`$CC --version`
+case `uname -s`:`uname -m`:$GCC_VERSION in
+       dnl egcs 2.90.21 (egcs-1.00 release)
+       dnl egcs 2.90.29 (egcs-1.0.3 release)
+    *:sun4*:2.8.1|*:sun4*:egcs-2.90.*)
+        dnl Don't use -O2 with gcc 2.8.1 and egcs 1.0 under SPARC architectures
+        dnl without also using `-fno-schedule-insns'.
+        case "$CFLAGS" in
+            *-O2*|*-O3*)
+                case "$CFLAGS" in
+                    *-fno-schedule-insns*) ;;
+                    *)
+                        AC_MSG_RESULT(Yes)
+                        AC_MSG_WARN(Don't use -O2 with gcc 2.8.1 and egcs 1.0 under SPARC architectures)
+                        AC_MSG_WARN(without also using -fno-schedule-insns.)
+                        AC_MSG_ERROR(Aborting due to known problem)
+                        ;;
+                esac
+                ;;
+        esac
+        ;;
+       dnl egcs-2.91.57 (egcs-1.1 release)
+       dnl egcs-2.91.66 (egcs-1.1.2 release)
+    Linux:alpha:egcs-2.91.*)
+        AC_MSG_RESULT(Yes)
+        AC_MSG_WARN(There have been reports of egcs-1.1 not compiling XEmacs correctly on)
+        AC_MSG_WARN(Alpha Linux.  There have also been reports that egcs-1.0.3a is O.K.)
+        AC_MSG_ERROR(Aborting due to known problem)
+        ;;
+    *:i*86*:2.7.2*)
+       case "$GCC_VERSION" in
+           2.7.2)
+               case "$CFLAGS" in
+                   *-O2*|*-O3*)
+                       case "$CFLAGS" in
+                           *-fno-strength-reduce*) ;;
+                           *)
+                                AC_MSG_RESULT(Yes)
+                               AC_MSG_WARN(Don't use -O2 with gcc 2.7.2 under Intel/XXX without also using)
+                               AC_MSG_WARN(-fno-strength-reduce.)
+                               AC_MSG_ERROR(Aborting due to known problem)
+                               ;;
+                       esac
+                       ;;
+               esac
+               ;;
+       esac
+        case "$CFLAGS" in
+        *-fno-caller-saves*) ;;
+        *)
+            AC_MSG_RESULT(Yes)
+           AC_MSG_WARN(Don't use -O2 with gcc 2.7.2 under Intel/XXX without also using)
+           AC_MSG_WARN(-fno-caller-saves.)
+            AC_MSG_ERROR(Aborting due to known problem)
+           ;;
+        esac
+       ;;
+esac
+fi
+AC_MSG_RESULT(No)
+
 dnl Inform compiler that certain flags are meant for the linker
 dnl XE_PROTECT_LINKER_FLAGS(shell_var)
 define([XE_PROTECT_LINKER_FLAGS], [
@@ -1863,7 +1951,8 @@ XE_PROTECT_LINKER_FLAGS(ld_call_shared)
 dnl Add s&m-determined objects (including unexec) to link line
 test -n "$objects_machine" && XE_ADD_OBJS($objects_machine)
 test -n "$objects_system"  && XE_ADD_OBJS($objects_system)
-test -n "$unexec"          && XE_ADD_OBJS($unexec)
+test -n "$unexec"          && test ! "$pdump" = "yes" && XE_ADD_OBJS($unexec)
+test "$pdump" = "yes" && XE_ADD_OBJS(dumper.o)
 
 dnl Dynodump (Solaris 2.x, x<6)
 AC_MSG_CHECKING(for dynodump)
@@ -2196,9 +2285,25 @@ AC_PROG_INSTALL
 AC_PROG_YACC
 
 dnl checks for header files
-AC_CHECK_HEADERS(mach/mach.h sys/stropts.h sys/timeb.h sys/time.h unistd.h)
-AC_CHECK_HEADERS(utime.h locale.h libgen.h fcntl.h ulimit.h cygwin/version.h)
-AC_CHECK_HEADERS(kstat.h sys/pstat.h inttypes.h sys/un.h a.out.h)
+AC_CHECK_HEADERS(dnl
+  a.out.h dnl
+  cygwin/version.h dnl
+  fcntl.h dnl
+  inttypes.h dnl
+  libgen.h dnl
+  locale.h dnl
+  mach/mach.h dnl
+  sys/param.h dnl
+  sys/pstat.h dnl
+  sys/stropts.h dnl
+  sys/time.h dnl
+  sys/timeb.h dnl
+  sys/un.h dnl
+  kstat.h dnl
+  ulimit.h dnl
+  unistd.h dnl
+  utime.h dnl
+)
 AC_HEADER_SYS_WAIT
 AC_HEADER_STDC
 AC_HEADER_TIME
@@ -2323,13 +2428,15 @@ if   ${CC-cc} '-###' -xildon  no_such_file.c 2>&1 | grep '^[^ ]*/ild ' > /dev/nu
 fi
 
 dnl Link with "-z ignore" on Solaris if supported
-if test "$opsys" = "sol2" && test "$OS_RELEASE" -ge 56; then
-  AC_MSG_CHECKING(for \"-z ignore\" linker flag)
-  case "`ld -h 2>&1`" in
-    *-z\ ignore\|record* ) AC_MSG_RESULT(yes)
-      XE_PREPEND(-z ignore, ld_switch_site) ;;
-    *) AC_MSG_RESULT(no) ;;
-  esac
+if test "$opsys" = "sol2"; then
+  if test "$os_release" -ge 56; then
+    AC_MSG_CHECKING(for \"-z ignore\" linker flag)
+    case "`ld -h 2>&1`" in
+      *-z\ ignore\|record* ) AC_MSG_RESULT(yes)
+        XE_PREPEND(-z ignore, ld_switch_site) ;;
+      *) AC_MSG_RESULT(no) ;;
+    esac
+  fi
 fi
 
 dnl ----------------------
@@ -2511,6 +2618,8 @@ EOF
   AC_MSG_RESULT(R${x11_release})
   AC_DEFINE_UNQUOTED(THIS_IS_X11R${x11_release})
 
+  AC_CHECK_FUNCS(XConvertCase)
+
   AC_CHECK_HEADERS(X11/Xlocale.h)
 
   dnl remove this - we should avoid checking for specific OS
@@ -2585,7 +2694,6 @@ if test "$with_msw" != "no"; then
     AC_TRY_RUN([#include <fcntl.h>
     int main() { return (open("/dev/windows", O_RDONLY, 0) > 0)? 0 : 1; }],
     [AC_DEFINE(HAVE_MSG_SELECT)])
-    const_is_losing=no
     with_file_coding=yes
     XE_ADD_OBJS(console-msw.o device-msw.o event-msw.o frame-msw.o objects-msw.o select-msw.o redisplay-msw.o glyphs-msw.o gui-msw.o)
   fi
@@ -2795,6 +2903,55 @@ if test "$with_ldap" = "yes"; then
   AC_CHECK_FUNCS(ldap_set_option ldap_get_lderrno ldap_result2error ldap_parse_result)
 fi
 
+dnl Autodetect PostgreSQL
+dnl The default installation location (non-Linux) is /usr/local/pgsql;
+dnl  a different prefix can be selected at build/install time.  If PostgreSQL
+dnl  is installed into a different prefix, that prefix must be specified in
+dnl  in the --site-prefixes flag.
+dnl The default RPM-based Linux installation location is /usr.
+AC_CHECKING(for PostgreSQL)
+postgres_includes_found=no
+save_c_switch_site="$c_switch_site"
+dnl First check site prefixes
+if test "$with_postgresql" != "no"; then
+       AC_CHECK_HEADER(libpq-fe.h,postgres_includes_found=yes)
+fi
+dnl test for Linux-style installation in /usr
+if test "$postgres_includes_found" = "no" -a "$with_postgresql" != "no" -a \
+       -d "/usr/include/pgsql"; then
+       c_switch_site="$c_switch_site -I/usr/include/pgsql"
+       AC_CHECK_HEADER(libpq-fe.h,postgres_includes_found=yes)
+       if test "$postgres_includes_found" != "yes"; then
+               c_switch_site="$save_c_switch_site"
+       fi
+fi
+if test "$postgres_includes_found" = "no" -a "$with_postgresql" != "no" -a \
+       -d "/usr/local/pgsql/include"; then
+       c_switch_site="$c_switch_site -I/usr/local/pgsql/include"
+       AC_CHECK_HEADER(libpq-fe.h,postgres_includes_found=yes)
+       if test "$postgres_includes_found" != "yes"; then
+               c_switch_site="$save_c_switch_site"
+       fi
+fi
+
+dnl last check -- can we link against libpq?
+if test "$postgres_includes_found" = "yes"; then
+       AC_CHECK_LIB(pq,PQconnectdb,with_postgresql=yes,with_postgresql=no)
+fi
+if test "$with_postgresql" = "yes"; then
+       AC_CHECK_LIB(pq,PQconnectStart,with_postgresqlv7=yes,with_postgresqlv7=no)
+fi
+if test "$with_postgresql" = "yes"; then
+       AC_DEFINE(HAVE_POSTGRESQL)
+       if test "$with_postgresqlv7" = "yes"; then
+               AC_DEFINE(HAVE_POSTGRESQLV7)
+       fi
+       XE_PREPEND(-lpq, LIBS)
+       XE_ADD_OBJS(postgresql.o)
+else
+       c_switch_site=$save_c_switch_site
+fi
+
 dnl ----------------------
 dnl Graphics libraries
 dnl ----------------------
@@ -2807,7 +2964,8 @@ if test "$window_system" != "none"; then
   if test -z "$with_xpm"; then
     AC_MSG_CHECKING(for Xpm - no older than 3.4f)
     xe_check_libs=-lXpm
-    AC_TRY_RUN([#include <X11/xpm.h>
+    AC_TRY_RUN([#define XPM_NUMBERS
+#include <X11/xpm.h>
     int main(int c, char **v) {
     return c == 1 ? 0 :
       XpmIncludeVersion != XpmLibraryVersion() ? 1 :
@@ -3402,8 +3560,7 @@ AC_TRY_LINK([
   ],
   [
   struct timeval time;
-  struct timezone dummy;
-  gettimeofday (&time, &dummy);
+  gettimeofday (&time, 0);
 ],
   [AC_MSG_RESULT(two)],
   [AC_MSG_RESULT(one)
@@ -3412,10 +3569,7 @@ fi
 
 
 AC_C_INLINE
-if test "$ac_cv_c_inline" != "no"; then
-  AC_DEFINE(HAVE_INLINE)
-  test "$GCC" = "yes" && XE_ADD_OBJS(inline.o)
-fi
+test "$ac_cv_c_inline" != "no" -a "$GCC" = "yes" && XE_ADD_OBJS(inline.o)
 
 dnl HP-UX has a working alloca in libPW.
 dnl case "${GCC}${opsys}" in hpux* )
@@ -3480,8 +3634,21 @@ test "$have_mmap" = "yes" && AC_DEFINE(HAVE_MMAP)
 
 dnl rel_alloc requires either GNU malloc or system malloc with mmap
 dnl We only turn rel_alloc on by default if mmap is available.
-test "$GNU_MALLOC" != "yes"   -a "$have_mmap" != "yes" && rel_alloc=no
-test "$rel_alloc" = "default" -a "$have_mmap"  = "yes" && rel_alloc=yes
+test "$GNU_MALLOC" != "yes" -a "$have_mmap" != "yes" && rel_alloc=no
+if test "$rel_alloc $have_mmap" = "default yes"; then
+  if test "$doug_lea_malloc" = "yes"; then
+    dnl Check if malloc() calls mmap(), making rel_alloc pointless.
+    AC_MSG_CHECKING(for M_MMAP_THRESHOLD)
+    AC_TRY_COMPILE([#include <malloc.h>],[
+#ifndef M_MMAP_THRESHOLD
+#error No M_MMAP_THRESHOLD :-(
+!@+$%^&*_)(_ - unlikely to compile...
+#endif
+], [rel_alloc=no; AC_MSG_RESULT(yes);], [rel_alloc=yes; AC_MSG_RESULT(no);])
+  else
+    rel_alloc=yes
+  fi
+fi
 test "$rel_alloc" = "yes" && AC_DEFINE(REL_ALLOC)
 
 dnl Check for terminal I/O variants
@@ -3780,7 +3947,10 @@ dnl Check for Berkeley DB.
 if test "$with_database_berkdb" != "no"; then
   AC_MSG_CHECKING(for Berkeley db.h)
   for path in "db/db.h" "db.h"; do
-    AC_TRY_COMPILE([#ifdef HAVE_INTTYPES_H
+    AC_TRY_COMPILE([
+#include <stdlib.h>
+#if !(defined __GLIBC__ && __GLIBC_MINOR__ >= 1)
+#ifdef HAVE_INTTYPES_H
 #define __BIT_TYPES_DEFINED__
 #include <inttypes.h>
 typedef uint8_t  u_int8_t;
@@ -3790,6 +3960,7 @@ typedef uint32_t u_int32_t;
 typedef uint64_t u_int64_t;
 #endif
 #endif
+#endif
 #include <$path>
 ],[], db_h_path="$path"; break)
   done
@@ -4241,7 +4412,6 @@ test "$with_i18n3"         = "yes" && AC_DEFINE(I18N3)
 test "$GCC"                = "yes" && AC_DEFINE(USE_GCC)
 test "$external_widget"    = "yes" && AC_DEFINE(EXTERNAL_WIDGET)
 test "$no_doc_file"        = "yes" && AC_DEFINE(NO_DOC_FILE)
-dnl test "$const_is_losing"    = "yes" && AC_DEFINE(CONST_IS_LOSING)
 test "$with_purify"        = "yes" && AC_DEFINE(PURIFY)
 test "$with_quantify"      = "yes" && AC_DEFINE(QUANTIFY)
 test "$with_pop"           = "yes" && AC_DEFINE(MAIL_USE_POP)
@@ -4358,6 +4528,12 @@ test "$with_database_gdbm"   = yes && echo "  Compiling in support for GNU DBM."
 
 test "$with_ldap"           = yes && echo "  Compiling in support for LDAP."
 
+if test "$with_postgresql" = yes; then
+       echo "  Compiling in support for PostgreSQL."
+       if test "$with_postgresqlv7" = yes; then
+               echo "    Using PostgreSQL V7 bindings."
+       fi
+fi
 test "$with_ncurses"  = yes && echo "  Compiling in support for ncurses."
 test "$with_gpm"      = yes && echo "  Compiling in support for GPM (General Purpose Mouse)."
 
@@ -4420,7 +4596,7 @@ test "$with_pop"  = yes && echo "  Using POP for mail access."
 test "$with_kerberos"  = yes && echo "  Using Kerberos for POP authentication."
 test "$with_hesiod"    = yes && echo "  Using Hesiod to get POP server host."
 test "$use_union_type"  = yes && echo "  Using the union type for Lisp_Objects."
-test "$pdump"           = yes && echo "  Using the new portable dumper (wishful thinking)."
+test "$pdump"           = yes && echo "  Using the new portable dumper."
 test "$debug"           = yes && echo "  Compiling in extra code for debugging."
 test "$usage_tracking"  = yes && echo "  Compiling with usage tracking active (Sun internal)."
 if test "$error_check_extents $error_check_typecheck $error_check_bufpos $error_check_gc $error_check_malloc" \