(Fencode_time, Fset_time_zone_rule): Use UTC if the zone is t.
[bpt/emacs.git] / configure.in
index 12c364c..0f2d94c 100644 (file)
@@ -1,13 +1,34 @@
-dnl This is an autoconf script.
+dnl  Autoconf script for GNU Emacs
 dnl To rebuild the `configure' script from this, execute the command
 dnl    autoconf
 dnl in the directory containing this script.
-AC_PREREQ(2.4.1)dnl
+dnl
+dnl  Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
+dnl
+dnl  This file is part of GNU Emacs.
+dnl
+dnl  GNU Emacs is free software; you can redistribute it and/or modify
+dnl  it under the terms of the GNU General Public License as published by
+dnl  the Free Software Foundation; either version 2, or (at your option)
+dnl  any later version.
+dnl
+dnl  GNU Emacs is distributed in the hope that it will be useful,
+dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+dnl  GNU General Public License for more details.
+dnl
+dnl  You should have received a copy of the GNU General Public License
+dnl  along with GNU Emacs; see the file COPYING.  If not, write to the
+dnl  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+dnl  Boston, MA 02111-1307, USA.
+
+AC_PREREQ(2.8)dnl
 AC_INIT(src/lisp.h)
 AC_CONFIG_HEADER(src/config.h:src/config.in)
 
 lispdir='${datadir}/emacs/${version}/lisp'
-locallisppath='${datadir}/emacs/site-lisp'
+locallisppath='${datadir}/emacs/${version}/site-lisp:'\
+'${datadir}/emacs/site-lisp'
 lisppath='${locallisppath}:${lispdir}'
 etcdir='${datadir}/emacs/${version}/etc'
 lockdir='${sharedstatedir}/emacs/lock'
@@ -29,7 +50,7 @@ dnl This should be the last --with option, because --with-x is
 dnl added later on when we find the path of X, and it's best to
 dnl keep them together visually.
 AC_ARG_WITH(x-toolkit,
-[  --with-x-toolkit=KIT    use an X toolkit (KIT = yes/lucid/athena/motif)],
+[  --with-x-toolkit=KIT    use an X toolkit (KIT = yes/lucid/athena/motif/no)],
 [        case "${withval}" in
            y | ye | yes )      val=athena ;;
            n | no )            val=no  ;;
@@ -89,7 +110,8 @@ vpath %.h $(srcdir)\
 vpath %.y $(srcdir)\
 vpath %.l $(srcdir)\
 vpath %.s $(srcdir)\
-vpath %.in $(srcdir)'
+vpath %.in $(srcdir)\
+vpath %.texi $(srcdir)'
 fi
 
 #### Given the configuration name, set machfile and opsysfile to the
@@ -133,7 +155,7 @@ case "${canonical}" in
   *-*-netbsd* )
     opsys=netbsd
     case "${canonical}" in
-      i[345]86-*-netbsd*) machine=intel386 ;;
+      i[3456]86-*-netbsd*) machine=intel386 ;;
       m68k-*-netbsd*)
                        # This is somewhat bogus.
                        machine=hp9000s300 ;;
@@ -167,17 +189,20 @@ case "${canonical}" in
   ## Alpha (DEC) machines.
   alpha-dec-osf* )
     machine=alpha opsys=osf1
+    # This is needed to find X11R6.1 libraries for certain tests.
+    NON_GCC_LINK_TEST_OPTIONS=-Wl,-rpath,/usr/X11R6/lib
+    GCC_LINK_TEST_OPTIONS=-Wl,-rpath,/usr/X11R6/lib
   ;;
 
-  alpha-*-linux* )
-    machine=alpha opsys=linux
+  alpha-*-linux-gnu* )
+    machine=alpha opsys=gnu-linux
   ;;
 
   ## Altos 3068
   m68*-altos-sysv* )
     machine=altos opsys=usg5-2
   ;;
-    
+
   ## Amdahl UTS
   580-amdahl-sysv* )
     machine=amdahl opsys=usg5-2-2
@@ -235,12 +260,12 @@ case "${canonical}" in
   ## Convex
   *-convex-bsd* | *-convex-convexos* )
     machine=convex opsys=bsd4-3
-    ## Prevents suprious white space in makefiles - d.m.cooke@larc.nasa.gov
+    ## Prevents spurious white space in makefiles - d.m.cooke@larc.nasa.gov
     NON_GNU_CPP="cc -E -P"
   ;;
 
   ## Cubix QBx/386
-  i[345]86-cubix-sysv* )
+  i[3456]86-cubix-sysv* )
     machine=intel386 opsys=usg5-3
   ;;
 
@@ -285,7 +310,7 @@ case "${canonical}" in
       if test -s /etc/167config
       then CC="gnucc -m68040"
       else CC="gnucc -m68881"
-      fi 
+      fi
     else
       if test -z "`type gcc | grep 'not found'`"
       then CC=gcc
@@ -343,11 +368,17 @@ case "${canonical}" in
        [56].[0-9] ) machine=nh4000 opsys=cxux ;;
        [7].[0-9] ) machine=nh4000 opsys=cxux7 ;;
     esac
+    NON_GNU_CPP="/lib/cpp"
   ;;
   ## Harris ecx or gcx running CX/UX (Series 1200, Series 3000)
   m68k-harris-cxux* )
     machine=nh3000 opsys=cxux
   ;;
+  ## Harris power pc NightHawk running Power UNIX (Series 6000)
+  powerpc-harris-powerunix )
+    machine=nh6000 opsys=powerunix
+    NON_GNU_CPP="cc -Xo -E -P"
+  ;;
 
   ## Honeywell XPS100
   xps*-honeywell-sysv* )
@@ -400,6 +431,9 @@ case "${canonical}" in
       *) machine=hp800 opsys=hpux ;;
     esac
   ;;
+  hppa-*-nextstep* )
+    machine=hp800 opsys=nextstep
+  ;;
 
   ## Orion machines
   orion-orion-bsd* )
@@ -410,10 +444,10 @@ case "${canonical}" in
   ;;
 
   ## IBM machines
-  i[345]86-ibm-aix1.1* )
+  i[3456]86-ibm-aix1.1* )
     machine=ibmps2-aix opsys=usg5-2-2
   ;;
-  i[345]86-ibm-aix1.[23]* | i[345]86-ibm-aix* )
+  i[3456]86-ibm-aix1.[23]* | i[3456]86-ibm-aix* )
     machine=ibmps2-aix opsys=usg5-3
   ;;
   i370-ibm-aix*)
@@ -436,13 +470,13 @@ case "${canonical}" in
   ;;
   romp-ibm-bsd4.3* )
     machine=ibmrt opsys=bsd4-3
-  ;;   
+  ;;
   romp-ibm-bsd4.2* )
     machine=ibmrt opsys=bsd4-2
   ;;
   romp-ibm-aos4.3* )
     machine=ibmrt opsys=bsd4-3
-  ;;   
+  ;;
   romp-ibm-aos4.2* )
     machine=ibmrt opsys=bsd4-2
   ;;
@@ -465,30 +499,41 @@ case "${canonical}" in
   ;;
 
   ## Intel 386 machines where we do care about the manufacturer
-  i[345]86-intsys-sysv* )
+  i[3456]86-intsys-sysv* )
     machine=is386 opsys=usg5-2-2
   ;;
 
   ## Prime EXL
-  i[345]86-prime-sysv* )
+  i[3456]86-prime-sysv* )
     machine=i386 opsys=usg5-3
   ;;
 
   ## Sequent Symmetry running Dynix
-  i[345]86-sequent-bsd* )
+  i[3456]86-sequent-bsd* )
     machine=symmetry opsys=bsd4-3
   ;;
 
+  ## Sequent Symmetry running ptx 4, which is a modified SVR4.
+  i[3456]86-sequent-ptx4* | i[3456]86-sequent-sysv4* )
+    machine=sequent-ptx opsys=ptx4
+    NON_GNU_CPP=/lib/cpp
+  ;;
+
   ## Sequent Symmetry running DYNIX/ptx
   ## Use the old cpp rather than the newer ANSI one.
-  i[345]86-sequent-ptx* )
+  i[3456]86-sequent-ptx* )
     machine=sequent-ptx opsys=ptx
     NON_GNU_CPP="/lib/cpp"
   ;;
 
+  ## ncr machine running svr4.3.
+  i[3456]86-ncr-sysv4.3 )
+    machine=ncr386 opsys=usg5-4-3
+  ;;
+
   ## Unspecified sysv on an ncr machine defaults to svr4.2.
   ## (Plain usg5-4 doesn't turn on POSIX signals, which we need.)
-  i[345]86-ncr-sysv* )
+  i[3456]86-ncr-sysv* )
     machine=ncr386 opsys=usg5-4-2
   ;;
 
@@ -617,7 +662,9 @@ case "${canonical}" in
     machine=iris4d opsys=irix4-0
   ;;
   mips-sgi-irix6* )
-    machine=iris4d opsys=irix6-0  NON_GNU_CPP=/lib/cpp
+    machine=iris4d opsys=irix6-0
+    NON_GNU_CPP=/lib/cpp
+    NON_GCC_TEST_OPTIONS=-32
   ;;
   mips-sgi-irix5.[01]* )
     machine=iris4d opsys=irix5-0
@@ -649,28 +696,39 @@ case "${canonical}" in
   ;;
 
   ## Suns
+  sparc-*-linux-gnu* )
+    machine=sparc opsys=gnu-linux
+  ;;
+
   *-sun-sunos* | *-sun-bsd* | *-sun-solaris* \
-    | i[345]86-*-solaris2* | i[345]86-*-sunos5* | powerpc*-*-solaris2* \
+    | i[3456]86-*-solaris2* | i[3456]86-*-sunos5* | powerpc*-*-solaris2* \
     | rs6000-*-solaris2*)
     case "${canonical}" in
       m68*-sunos1* )   machine=sun1 ;;
       m68*-sunos2* )   machine=sun2 ;;
       m68* )           machine=sun3 ;;
-      i[345]86-sun-sunos[34]* )        machine=sun386 ;;
-      i[345]86-*-* )     machine=intel386 ;;
-      powerpc* | rs6000* )  machine=rs6000 ;;
+      i[3456]86-sun-sunos[34]* )       machine=sun386 ;;
+      i[3456]86-*-* )     machine=intel386 ;;
+      powerpc* | rs6000* )  machine=ibmrs6000 ;;
       sparc* )         machine=sparc ;;
       * )              unported=yes ;;
     esac
     case "${canonical}" in
       ## The Sun386 didn't get past 4.0.
-      i[345]86-*-sunos4          ) opsys=sunos4-0 ;;
+      i[3456]86-*-sunos4         ) opsys=sunos4-0 ;;
       *-sunos4.0*        ) opsys=sunos4-0 ;;
+      *-sunos4.1.[3-9]*noshare )
+               opsys=sunos4-1-3
+               NON_GNU_CPP=/usr/lib/cpp
+               NON_GCC_TEST_OPTIONS=-Bstatic
+               GCC_TEST_OPTIONS=-static
+               ;;
       *-sunos4.1.[3-9]* | *-sunos4shr*)
                opsys=sunos4shr
                NON_GNU_CPP=/usr/lib/cpp
                ;;
-      *-sunos4* | *-sunos ) opsys=sunos4-1
+      *-sunos4* | *-sunos )
+               opsys=sunos4-1
                NON_GCC_TEST_OPTIONS=-Bstatic
                GCC_TEST_OPTIONS=-static
                ;;
@@ -689,11 +747,22 @@ case "${canonical}" in
                RANLIB="ar -ts"
                ;;
       *-sunos5* | *-solaris* )
-               opsys=sol2
+               opsys=sol2-4
                NON_GNU_CPP=/usr/ccs/lib/cpp
                ;;
       *                          ) opsys=bsd4-2   ;;
     esac
+    ## Watch out for a compiler that we know will not work.
+    case "${canonical}" in
+     *-solaris* | *-sunos5* )
+               if [ "x$CC" = x/usr/ucb/cc ]; then
+                 ## /usr/ucb/cc doesn't work;
+                 ## we should find some other compiler that does work.
+                 unset CC
+               fi
+               ;;
+      *) ;;
+    esac
   ;;
   sparc-*-nextstep* )
     machine=sparc opsys=nextstep
@@ -737,7 +806,7 @@ case "${canonical}" in
   titan-titan-sysv* )
     machine=titan opsys=usg5-3
   ;;
-  
+
   ## Ustation E30 (SS5E)
   m68*-unisys-uniplus* )
     machine=ustation opsystem=unipl5-2
@@ -770,7 +839,7 @@ case "${canonical}" in
   ;;
 
   ## Intel 386 machines where we don't care about the manufacturer
-  i[345]86-*-* )
+  i[3456]86-*-* )
     machine=intel386
     case "${canonical}" in
       *-isc1.* | *-isc2.[01]* )        opsys=386-ix ;;
@@ -784,10 +853,17 @@ case "${canonical}" in
       *-esix5* )               opsys=esix5r4; NON_GNU_CPP=/usr/lib/cpp ;;
       *-esix* )                        opsys=esix ;;
       *-xenix* )               opsys=xenix ;;
-      *-linux* )               opsys=linux ;;
+      *-linux-gnu* )           opsys=gnu-linux ;;
       *-sco3.2v4* )            opsys=sco4 ; NON_GNU_CPP=/lib/cpp  ;;
+      *-sco3.2v5* )            opsys=sco5 
+                               NON_GNU_CPP=/lib/cpp
+                               # Prevent -belf from being passed to $CPP.
+                               # /lib/cpp does not accept it.
+                               OVERRIDE_CPPFLAGS=" "
+                               ;;
       *-bsd386* | *-bsdi1* )   opsys=bsd386 ;;
-      *-bsdi2* )               opsys=bsdos2 ;;
+      *-bsdi2.0* )             opsys=bsdos2 ;;
+      *-bsdi2* )               opsys=bsdos2-1 ;;
       *-386bsd* )              opsys=386bsd ;;
       *-freebsd* )             opsys=freebsd ;;
       *-nextstep* )             opsys=nextstep ;;
@@ -795,9 +871,9 @@ case "${canonical}" in
     esac
   ;;
 
-  ## Linux/68k
-  m68k-*-linux* )
-    machine=m68k opsys=linux
+  ## Linux/68k-based GNU system
+  m68k-*-linux-gnu* )
+    machine=m68k opsys=gnu-linux
   ;;
 
   * )
@@ -826,7 +902,11 @@ if test x"${opsys}" = x; then
        opsys=usg5-4 ;;
     *-sysv4.[2-9]* | *-sysvr4.[2-9]* )
        if [ x$NON_GNU_CPP = x ]; then
-         NON_GNU_CPP=/usr/ccs/lib/cpp
+         if [ -f /usr/ccs/lib/cpp ]; then
+           NON_GNU_CPP=/usr/ccs/lib/cpp
+         else
+           NON_GNU_CPP=/lib/cpp
+         fi
        fi
        opsys=usg5-4-2 ;;
     *-sysv4* | *-sysvr4* )             opsys=usg5-4 ;;
@@ -888,12 +968,22 @@ fi
 if test x$GCC = xyes && test "x$GCC_TEST_OPTIONS" != x
 then
   CC="$CC $GCC_TEST_OPTIONS"
-fi  
+fi
 
 if test x$GCC = x && test "x$NON_GCC_TEST_OPTIONS" != x
 then
   CC="$CC $NON_GCC_TEST_OPTIONS"
-fi  
+fi
+
+if test x$GCC = xyes && test "x$GCC_LINK_TEST_OPTIONS" != x
+then
+  ac_link="$ac_link $GCC_LINK_TEST_OPTIONS"
+fi
+
+if test x$GCC = x && test "x$NON_GCC_LINK_TEST_OPTIONS" != x
+then
+  ac_link="$ac_link $NON_GCC_LINK_TEST_OPTIONS"
+fi
 
 #### Some other nice autoconf tests.  If you add a test here which
 #### should make an entry in src/config.h, don't forget to add an
@@ -909,7 +999,7 @@ dnl checks for Unix variants
 AC_AIX
 
 dnl checks for header files
-AC_CHECK_HEADERS(sys/select.h sys/timeb.h sys/time.h unistd.h utime.h)
+AC_CHECK_HEADERS(sys/select.h sys/timeb.h sys/time.h unistd.h utime.h linux/version.h)
 AC_HEADER_STDC
 AC_HEADER_TIME
 AC_DECL_SYS_SIGLIST
@@ -950,7 +1040,8 @@ AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
   [AC_MSG_RESULT(yes)
    HAVE_TIMEVAL=yes
    AC_DEFINE(HAVE_TIMEVAL)],
-  AC_MSG_RESULT(no))
+  [AC_MSG_RESULT(no)
+   HAVE_TIMEVAL=no])
 
 dnl checks for structure members
 AC_STRUCT_TM
@@ -985,7 +1076,7 @@ fi
 if test x"${x_includes}" = x; then
   bitmapdir=/usr/include/X11/bitmaps
 else
-  # accumulate include directories that have X11 bitmap sudirectories
+  # accumulate include directories that have X11 bitmap subdirectories
   bmd_acc="dummyval"
   for bmd in `echo ${x_includes} | sed -e "s/:/ /g"`; do
     if test -d "${bmd}/X11/bitmaps"; then
@@ -1004,10 +1095,13 @@ case "${window_system}" in
     HAVE_X_WINDOWS=yes
     HAVE_X11=yes
     case "${with_x_toolkit}" in
-      athena | lucid ) USE_X_TOOLKIT=LUCID ;;  
-      motif ) USE_X_TOOLKIT=MOTIF ;;   
-dnl      open-look ) USE_X_TOOLKIT=OPEN_LOOK ;;        
-      * ) USE_X_TOOLKIT=none ;;
+      athena | lucid ) USE_X_TOOLKIT=LUCID ;;
+      motif ) USE_X_TOOLKIT=MOTIF ;;
+dnl      open-look ) USE_X_TOOLKIT=OPEN_LOOK ;;
+      no ) USE_X_TOOLKIT=none ;;
+dnl If user did not say whether to use a toolkit,
+dnl make this decision later: use the toolkit if we have X11R5 or newer.
+      * ) USE_X_TOOLKIT=maybe ;;
     esac
   ;;
   none )
@@ -1016,12 +1110,11 @@ dnl      open-look ) USE_X_TOOLKIT=OPEN_LOOK ;;
     USE_X_TOOLKIT=none
   ;;
 esac
-X_TOOLKIT_TYPE=$USE_X_TOOLKIT
 
 ### If we're using X11, we should use the X menu package.
-HAVE_X_MENU=no
+HAVE_MENUS=no
 case ${HAVE_X11} in
-  yes ) HAVE_X_MENU=yes ;;
+  yes ) HAVE_MENUS=yes ;;
 esac
 
 if test "${opsys}" = "hpux9"; then
@@ -1050,7 +1143,7 @@ AC_CHECKING([the machine- and system-dependent files to find out
 ### and REAL_CFLAGS (which we use for real compilation).
 ### The two are the same except on a few systems, where they are made
 ### different to work around various lossages.  For example,
-### GCC 2.5 on Linux needs them to be different because it treats -g
+### GCC 2.5 on GNU/Linux needs them to be different because it treats -g
 ### as implying static linking.
 
 ### If the CFLAGS env var is specified, we use that value
@@ -1170,7 +1263,12 @@ LISP_FLOAT_TYPE=yes
 
 #### Add the libraries to LIBS and check for some functions.
 
-CPPFLAGS="$c_switch_system $c_switch_machine $CPPFLAGS"
+if test x"${OVERRIDE_CPPFLAGS}" != x; then
+  CPPFLAGS="${OVERRIDE_CPPFLAGS}"
+else
+  CPPFLAGS="$c_switch_system $c_switch_machine $CPPFLAGS"
+fi
+
 LIBS="$libsrc_libs $LIBS"
 
 dnl If found, this defines HAVE_LIBDNET, which m/pmax.h checks,
@@ -1199,10 +1297,20 @@ AC_MSG_RESULT($HAVE_XFREE386)
 
 if test "${HAVE_X11}" = "yes"; then
   DEFS="$C_SWITCH_X_SITE $DEFS"
-  LIBS="$LD_SWITCH_X_SITE $LIBX $LIBS"
+  LDFLAGS="$LDFLAGS $LD_SWITCH_X_SITE"
+  LIBS="$LIBX $LIBS"
   CFLAGS="$C_SWITCH_X_SITE $CFLAGS"
 
-  if test "${opsys}" = "linux"; then
+  # On Solaris, arrange for LD_RUN_PATH to point to the X libraries for tests.
+  # This is handled by LD_SWITCH_X_SITE_AUX during the real build,
+  # but it's more convenient here to set LD_RUN_PATH
+  # since this also works on hosts that don't understand LD_SWITCH_X_SITE_AUX.
+  if test "${x_libraries}" != NONE && test -n "${x_libraries}"; then
+    LD_RUN_PATH=$x_libraries${LD_RUN_PATH+:}$LD_RUN_PATH
+    export LD_RUN_PATH
+  fi
+
+  if test "${opsys}" = "gnu-linux"; then
     AC_MSG_CHECKING(whether X on GNU/Linux needs -b to link)
     AC_TRY_LINK([],
      [XOpenDisplay ("foo");],
@@ -1241,15 +1349,73 @@ if test "${HAVE_X11}" = "yes"; then
 XScreenNumberOfScreen XSetWMProtocols)
 fi
 
+if test "${window_system}" = "x11"; then
+  AC_MSG_CHECKING(X11 version 6)
+  AC_TRY_LINK([#include <X11/Xlib.h>],
+[#if XlibSpecificationRelease < 6
+fail;
+#endif
+], [AC_MSG_RESULT(6 or newer)
+    AC_DEFINE(HAVE_X11R6)],
+   [AC_MSG_RESULT(before 6)])
+fi
+
+if test "${window_system}" = "x11"; then
+  AC_MSG_CHECKING(X11 version 5)
+  AC_TRY_LINK([#include <X11/Xlib.h>],
+[#if XlibSpecificationRelease < 5
+fail;
+#endif
+], [AC_MSG_RESULT(5 or newer)
+    HAVE_X11R5=yes
+    AC_DEFINE(HAVE_X11R5)],
+   [
+    HAVE_X11R5=no
+    AC_MSG_RESULT(before 5)])
+fi
+
+dnl Do not put whitespace before the #include statements below.
+dnl Older compilers (eg sunos4 cc) choke on it.
+if test x"${USE_X_TOOLKIT}" = xmaybe; then
+  if test x"${HAVE_X11R5}" = xyes; then
+    AC_MSG_CHECKING(X11 version 5 with Xaw)
+    AC_TRY_LINK([
+#include <X11/Intrinsic.h>
+#include <X11/Xaw/Simple.h>],
+      [],
+      [AC_MSG_RESULT(5 or newer, with Xaw; use toolkit by default)
+       USE_X_TOOLKIT=LUCID],
+      [AC_MSG_RESULT(before 5 or no Xaw; do not use toolkit by default)
+       USE_X_TOOLKIT=none])
+  else
+    USE_X_TOOLKIT=none
+  fi
+fi
+
+X_TOOLKIT_TYPE=$USE_X_TOOLKIT
+
 if test "${USE_X_TOOLKIT}" != "none"; then
   AC_MSG_CHECKING(X11 toolkit version)
   AC_TRY_LINK([#include <X11/Intrinsic.h>],
 [#if XtSpecificationRelease < 6
 fail;
 #endif
-], [AC_MSG_RESULT(6)
+], [AC_MSG_RESULT(6 or newer)
+    HAVE_X11XTR6=yes
     AC_DEFINE(HAVE_X11XTR6)],
-   [AC_MSG_RESULT(not 6)])
+   [AC_MSG_RESULT(before 6)
+    HAVE_X11XTR6=no])
+
+dnl If using toolkit, check whether libXmu.a exists.
+dnl tranle@intellicorp.com says libXmu.a can need XtMalloc in libXt.a to link.
+  OLDLIBS="$LIBS"
+  if test x$HAVE_X11XTR6 = xyes; then
+    LIBS="-lXt -lSM -lICE $LIBS"
+  else
+    LIBS="-lXt $LIBS"
+  fi
+  AC_CHECK_LIB(Xmu, XmuConvertStandardSelection)
+  LIBS="$OLDLIBS"
 fi
 
 # If netdb.h doesn't declare h_errno, we must declare it by hand.
@@ -1264,28 +1430,52 @@ AC_FUNC_ALLOCA
 
 # fmod, logb, and frexp are found in -lm on most systems.
 # On HPUX 9.01, -lm does not contain logb, so check for sqrt.
-AC_CHECK_LIB(m, sqrt(0.0) + t)
+AC_CHECK_LIB(m, sqrt)
+
 AC_CHECK_FUNCS(gettimeofday gethostname dup2 rename closedir mkdir rmdir \
 random lrand48 bcopy bcmp logb frexp fmod ftime res_init setsid \
-strerror fpathconf select mktime eaccess getpagesize tzset)
+strerror fpathconf select mktime euidaccess getpagesize tzset setlocale)
+
+# Check this now, so that we will NOT find the above functions in ncurses.
+# That is because we have not set up to link ncurses in lib-src.
+# It's better to believe a function is not available
+# than to expect to find it in ncurses.
+AC_CHECK_LIB(ncurses, tparm)
 
 AC_MSG_CHECKING(whether localtime caches TZ)
 AC_CACHE_VAL(emacs_cv_localtime_cache,
-[if test $ac_cv_func_tzset = yes; then
+[if test x$ac_cv_func_tzset = xyes; then
 AC_TRY_RUN([#include <time.h>
 #if STDC_HEADERS
 # include <stdlib.h>
 #endif
+extern char **environ;
+unset_TZ ()
+{
+  char **from, **to;
+  for (to = from = environ; (*to = *from); from++)
+    if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '='))
+      to++;
+}
+char TZ_GMT0[] = "TZ=GMT0";
+char TZ_PST8[] = "TZ=PST8";
 main()
 {
   time_t now = time ((time_t *) 0);
-  int hour;
-  if (putenv ("TZ=GMT0") != 0)
+  int hour_GMT0, hour_unset;
+  if (putenv (TZ_GMT0) != 0)
     exit (1);
-  hour = localtime (&now)->tm_hour;
-  if (putenv ("TZ=PST8") != 0)
+  hour_GMT0 = localtime (&now)->tm_hour;
+  unset_TZ ();
+  hour_unset = localtime (&now)->tm_hour;
+  if (putenv (TZ_PST8) != 0)
     exit (1);
-  exit (localtime (&now)->tm_hour == hour);
+  if (localtime (&now)->tm_hour == hour_GMT0)
+    exit (1);
+  unset_TZ ();
+  if (localtime (&now)->tm_hour != hour_unset)
+    exit (1);
+  exit (0);
 }], emacs_cv_localtime_cache=no, emacs_cv_localtime_cache=yes,
 [# If we have tzset, assume the worst when cross-compiling.
 emacs_cv_localtime_cache=yes])
@@ -1299,7 +1489,7 @@ if test $emacs_cv_localtime_cache = yes; then
   AC_DEFINE(LOCALTIME_CACHE)
 fi
 
-if test $HAVE_TIMEVAL = yes; then
+if test "x$HAVE_TIMEVAL" = xyes; then
 AC_MSG_CHECKING(whether gettimeofday can't accept two arguments)
 AC_TRY_LINK([
 #ifdef TIME_WITH_SYS_TIME
@@ -1405,8 +1595,8 @@ fi
 if test "${HAVE_XFREE386}" = "yes" ; then
   AC_DEFINE(HAVE_XFREE386)
 fi
-if test "${HAVE_X_MENU}" = "yes" ; then
-  AC_DEFINE(HAVE_X_MENU)
+if test "${HAVE_MENUS}" = "yes" ; then
+  AC_DEFINE(HAVE_MENUS)
 fi
 if test "${GNU_MALLOC}" = "yes" ; then
   AC_DEFINE(GNU_MALLOC)
@@ -1477,6 +1667,9 @@ sed -e 's/[^a-zA-Z0-9_]/ /g' -e 's/^/ /' -e 's/  *$//' \
 `"
 changequote([, ])dnl
 
+echo creating src/paths.h
+make paths-force
+
 echo creating lib-src/Makefile
 ( cd lib-src
   rm -f junk.c junk1.c junk2.c