(ediff-setup-fine-diff-regions):
[bpt/emacs.git] / configure.in
index 3b2e6d2..17eb367 100644 (file)
@@ -1,14 +1,33 @@
-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
+dnl  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, 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:'\
-'${datadir}/emacs/${version}/site-lisp'
+locallisppath='${datadir}/emacs/${version}/site-lisp:'\
+'${datadir}/emacs/site-lisp'
 lisppath='${locallisppath}:${lispdir}'
 etcdir='${datadir}/emacs/${version}/etc'
 lockdir='${sharedstatedir}/emacs/lock'
@@ -170,8 +189,8 @@ case "${canonical}" in
     machine=alpha opsys=osf1
   ;;
 
-  alpha-*-linux* )
-    machine=alpha opsys=linux
+  alpha-*-linux* | alpha-*-lignux* )
+    machine=alpha opsys=lignux
   ;;
 
   ## Altos 3068
@@ -407,6 +426,9 @@ case "${canonical}" in
       *) machine=hp800 opsys=hpux ;;
     esac
   ;;
+  hppa-*-nextstep* )
+    machine=hp800 opsys=nextstep
+  ;;
 
   ## Orion machines
   orion-orion-bsd* )
@@ -708,6 +730,17 @@ case "${canonical}" in
                ;;
       *                          ) 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
@@ -798,7 +831,7 @@ case "${canonical}" in
       *-esix5* )               opsys=esix5r4; NON_GNU_CPP=/usr/lib/cpp ;;
       *-esix* )                        opsys=esix ;;
       *-xenix* )               opsys=xenix ;;
-      *-linux* )               opsys=linux ;;
+      *-linux* | *-lignux* )   opsys=lignux ;;
       *-sco3.2v4* )            opsys=sco4 ; NON_GNU_CPP=/lib/cpp  ;;
       *-bsd386* | *-bsdi1* )   opsys=bsd386 ;;
       *-bsdi2* )               opsys=bsdos2 ;;
@@ -809,9 +842,9 @@ case "${canonical}" in
     esac
   ;;
 
-  ## Linux/68k
-  m68k-*-linux* )
-    machine=m68k opsys=linux
+  ## Lignux/68k
+  m68k-*-linux* | m68k-*-lignux* )
+    machine=m68k opsys=lignux
   ;;
 
   * )
@@ -923,7 +956,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
@@ -964,7 +997,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
@@ -1021,7 +1055,10 @@ case "${window_system}" in
       athena | lucid ) USE_X_TOOLKIT=LUCID ;;
       motif ) USE_X_TOOLKIT=MOTIF ;;
 dnl      open-look ) USE_X_TOOLKIT=OPEN_LOOK ;;
-      * ) USE_X_TOOLKIT=none ;;
+      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 )
@@ -1030,7 +1067,6 @@ 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_MENUS=no
@@ -1064,7 +1100,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 Lignux needs them to be different because it treats -g
 ### as implying static linking.
 
 ### If the CFLAGS env var is specified, we use that value
@@ -1199,6 +1235,12 @@ AC_CHECK_LIB(Xbsd, main, LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -lXbsd")
 
 AC_CHECK_LIB(pthreads, cma_open)
 
+dnl If we can find a tparm in libcurses.a, it means we have ncurses.
+AC_CHECK_LIB(curses, tparm, HAVE_NCURSES=yes)
+if test x"${HAVE_NCURSES}" = "xyes" ; then
+  AC_DEFINE(HAVE_NCURSES)
+fi
+
 AC_MSG_CHECKING(for XFree86)
 if test -d /usr/X386/include; then
   HAVE_XFREE386=yes
@@ -1213,10 +1255,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}" = "lignux"; then
     AC_MSG_CHECKING(whether X on GNU/Linux needs -b to link)
     AC_TRY_LINK([],
      [XOpenDisplay ("foo");],
@@ -1253,29 +1305,56 @@ if test "${HAVE_X11}" = "yes"; then
 
   AC_CHECK_FUNCS(XrmSetDatabase XScreenResourceString \
 XScreenNumberOfScreen XSetWMProtocols)
-  AC_CHECK_LIB(Xmu, XmuConvertStandardSelection)
 fi
 
 if test "${window_system}" = "x11"; then
-  AC_MSG_CHECKING(X11 version)
+  AC_MSG_CHECKING(X11 version 6)
   AC_TRY_LINK([#include <X11/Xlib.h>],
 [#if XlibSpecificationRelease < 6
 fail;
 #endif
-], [AC_MSG_RESULT(6)
+], [AC_MSG_RESULT(6 or newer)
     AC_DEFINE(HAVE_X11R6)],
-   [AC_MSG_RESULT(not 6)])
+   [AC_MSG_RESULT(before 6)])
+fi
+
+if test x"${USE_X_TOOLKIT}" = xmaybe; 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; use toolkit by default)
+    USE_X_TOOLKIT=LUCID
+    AC_DEFINE(HAVE_X11R5)],
+   [AC_MSG_RESULT(before 5; do not use toolkit by default)
+    USE_X_TOOLKIT=none])
 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.
@@ -1290,28 +1369,44 @@ 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)
 
 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++;
+}
 main()
 {
   time_t now = time ((time_t *) 0);
-  int hour;
+  int hour_GMT0, hour_unset;
   if (putenv ("TZ=GMT0") != 0)
     exit (1);
-  hour = localtime (&now)->tm_hour;
+  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])