changeset 108310:17d73312ed65

Move TERMINFO, LIBS_TERMCAP from cpp to configure. * configure.in (HAVE_LIBNCURSES): New local variable. (TERMINFO, LIBS_TERMCAP, TERMCAP_OBJ): New output variables, replacing cpp in src/s/*.h and src/Makefile.in. * src/Makefile.in (LIBS_TERMCAP): Set with configure, not cpp. (TERMCAP_OBJ): New, set by configure, replacing termcapobj. (termcapobj): Replace with TERMCAP_OBJ. (otherobj): Use $TERMCAP_OBJ instead of $termcapobj. (LIBES): Use LIBS_TERMCAP as a variable. * src/s/freebsd.h (osreldate.h): No longer include, since this file does not use __FreeBSD_version any more. * srs/s/aix4-2.h (TERMINFO): * srs/s/cygwin.h (TERMINFO): * srs/s/darwin.h (TERMINFO, LIBS_TERMCAP) [HAVE_LIBNCURSES]: * srs/s/freebsd.h (TERMINFO, LIBS_TERMCAP): * srs/s/gnu-linux.h (TERMINFO, LIBS_TERMCAP) [HAVE_LIBNCURSES]: * srs/s/gnu.h (TERMINFO, LIBS_TERMCAP) [HAVE_LIBNCURSES]: * srs/s/hpux10-20.h (TERMINFO, LIBS_TERMCAP): * srs/s/irix6-5.h (TERMINFO): * srs/s/netbsd.h (LIBS_TERMCAP): * srs/s/openbsd.h (TERMINFO, LIBS_TERMCAP): * srs/s/sol2-6.h (LIBS_TERMCAP) [!TERMINFO]: * srs/s/usg5-4.h (TERMINFO): Move to configure. * msdos/sed1v2.inp (LIBS_TERMCAP): Edit to empty. (TERMCAP_OBJ): Edit to tparam.o. * admin/CPP-DEFINES (LIBS_TERMCAP, TERMINFO): Remove.
author Glenn Morris <rgm@gnu.org>
date Fri, 07 May 2010 19:05:24 -0700
parents 8e422499f0ff
children 3c3969cfa7a1
files ChangeLog configure.in msdos/ChangeLog msdos/sed1v2.inp src/ChangeLog src/Makefile.in src/s/aix4-2.h src/s/cygwin.h src/s/darwin.h src/s/freebsd.h src/s/gnu-linux.h src/s/gnu.h src/s/hpux10-20.h src/s/irix6-5.h src/s/netbsd.h src/s/openbsd.h src/s/sol2-6.h src/s/usg5-4.h
diffstat 18 files changed, 127 insertions(+), 98 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri May 07 20:20:30 2010 -0400
+++ b/ChangeLog	Fri May 07 19:05:24 2010 -0700
@@ -1,3 +1,9 @@
+2010-05-08  Glenn Morris  <rgm@gnu.org>
+
+	* configure.in (HAVE_LIBNCURSES): New local variable.
+	(TERMINFO, LIBS_TERMCAP, TERMCAP_OBJ): New output variables,
+	replacing cpp in src/s/*.h and src/Makefile.in.
+
 2010-05-07  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* configure.in: Add tests for `isnan' and `copysign'.
--- a/configure.in	Fri May 07 20:20:30 2010 -0400
+++ b/configure.in	Fri May 07 19:05:24 2010 -0700
@@ -1094,7 +1094,7 @@
 AC_SUBST(LIB_MATH)
 AC_SUBST(START_FILES)
 
-dnl This function defintion taken from Gnome 2.0
+dnl This function definition taken from Gnome 2.0
 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
 dnl also defines GSTUFF_PKG_ERRORS on error
@@ -2527,7 +2527,7 @@
 # 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.
-# Also we need tputs and frieds to be able to build at all.
+# Also we need tputs and friends to be able to build at all.
 have_tputs_et_al=true
 AC_SEARCH_LIBS(tputs, [ncurses terminfo termcap], , have_tputs_et_al=false)
 if test "$have_tputs_et_al" != true; then
@@ -2538,9 +2538,82 @@
 # Must define this when any termcap library is found.
 AC_DEFINE(HAVE_LIBNCURSES, 1,
           [Define to 1 if you have the `ncurses' library (-lncurses).])
+## FIXME This was the cpp logic, but I am not sure it is right.
+## The above test has not necessarily found libncurses.
+HAVE_LIBNCURSES=yes
+
+## Use terminfo instead of termcap?
+## Note only system files NOT using terminfo are:
+## bsd-common, freebsd < 40000, ms-w32, msdos, netbsd, and
+## darwin|gnu without ncurses.
+TERMINFO=no
+LIBS_TERMCAP=
+case "$opsys" in
+  ## cygwin: Fewer environment variables to go wrong, more terminal types.
+  ## hpux10-20: Use the system provided termcap(3) library.
+  ## openbsd: David Mazieres <dm@reeducation-labor.lcs.mit.edu> says this
+  ##  is necessary.  Otherwise Emacs dumps core when run -nw.
+  aix4-2|cygwin|hpux*|irix6-5|openbsd|usg5-4|sol2*|unixware) TERMINFO=yes ;;
+
+  ## darwin: Prevents crashes when running Emacs in Terminal.app under 10.2.
+  ##  The ncurses library has been moved out of the System framework in
+  ##  Mac OS X 10.2.  So if configure detects it, set the command-line
+  ##  option to use it.
+  darwin|gnu*)
+    ## (HAVE_LIBNCURSES was not always true, but is since 2010-03-18.)
+    if test "x$HAVE_LIBNCURSES" = "xyes"; then
+      TERMINFO=yes
+      LIBS_TERMCAP="-lncurses"
+    fi
+    ;;
+
+  freebsd)
+    AC_MSG_CHECKING([whether FreeBSD is new enough to use terminfo])
+    AC_CACHE_VAL(emacs_cv_freebsd_terminfo,
+    [AC_TRY_LINK([#include <osreldate.h>],
+[#if __FreeBSD_version < 400000
+fail;
+#endif
+], emacs_cv_freebsd_terminfo=yes, emacs_cv_freebsd_terminfo=no)])
+
+    AC_MSG_RESULT($emacs_cv_freebsd_terminfo)
+
+    if test $emacs_cv_freebsd_terminfo = yes; then
+      TERMINFO=yes
+      LIBS_TERMCAP="-lncurses"
+    else
+      LIBS_TERMCAP="-ltermcap"
+    fi
+    ;;
+
+esac
+
+case "$opsys" in
+  ## hpux: Make sure we get select from libc rather than from libcurses
+  ##  because libcurses on HPUX 10.10 has a broken version of select.
+  ##  We used to use -lc -lcurses, but this may be cleaner.
+  hpux*|netbsd) LIBS_TERMCAP="-ltermcap" ;;
+
+  openbsd) LIBS_TERMCAP="-lncurses" ;;
+
+  ## Must use system termcap, if we use any termcap.  It does special things.
+  sol2*) test "$TERMINFO" != yes && LIBS_TERMCAP="-ltermcap" ;;
+esac
+
+TERMCAP_OBJ=tparam.o
+if test $TERMINFO = yes; then
+  AC_DEFINE(TERMINFO, 1, [Define to 1 if you use terminfo instead of termcap.])
+
+  ## Default used to be -ltermcap.  Add a case above if need something else.
+  test "x$LIBS_TERMCAP" = "x" && LIBS_TERMCAP="-lcurses"
+
+  TERMCAP_OBJ=terminfo.o
+fi
+AC_SUBST(LIBS_TERMCAP)
+AC_SUBST(TERMCAP_OBJ)
+
 
 # Do we have res_init, for detecting changes in /etc/resolv.conf?
-
 resolv=no
 AC_TRY_LINK([#include <netinet/in.h>
 #include <arpa/nameser.h>
--- a/msdos/ChangeLog	Fri May 07 20:20:30 2010 -0400
+++ b/msdos/ChangeLog	Fri May 07 19:05:24 2010 -0700
@@ -1,3 +1,8 @@
+2010-05-08  Glenn Morris  <rgm@gnu.org>
+
+	* sed1v2.inp (LIBS_TERMCAP): Edit to empty.
+	(TERMCAP_OBJ): Edit to tparam.o.
+
 2010-05-07  Eli Zaretskii  <eliz@gnu.org>
 
 	Fix breakage due to autoconfiscation of Makefile.in files.
--- a/msdos/sed1v2.inp	Fri May 07 20:20:30 2010 -0400
+++ b/msdos/sed1v2.inp	Fri May 07 19:05:24 2010 -0700
@@ -62,6 +62,8 @@
 /^GCONF_CFLAGS *=/s/@GCONF_CFLAGS@//
 /^GCONF_LIBS *=/s/@GCONF_LIBS@//
 /^GTK_OBJ *=/s/@GTK_OBJ@//
+/^LIBS_TERMCAP *=/s/@LIBS_TERMCAP@//
+/^TERMCAP_OBJ *=/s/@TERMCAP_OBJ@/tparam.o/
 /^LIBXMU *=/s/@LIBXMU@//
 /^LIBXSM *=/s/@LIBXSM@//
 /^LIBXTR6 *=/s/@LIBXTR6@//
--- a/src/ChangeLog	Fri May 07 20:20:30 2010 -0400
+++ b/src/ChangeLog	Fri May 07 19:05:24 2010 -0700
@@ -1,3 +1,28 @@
+2010-05-08  Glenn Morris  <rgm@gnu.org>
+
+	* Makefile.in (LIBS_TERMCAP): Set with configure, not cpp.
+	(TERMCAP_OBJ): New, set by configure, replacing termcapobj.
+	(termcapobj): Replace with TERMCAP_OBJ.
+	(otherobj): Use $TERMCAP_OBJ instead of $termcapobj.
+	(LIBES): Use LIBS_TERMCAP as a variable.
+
+	* s/freebsd.h (osreldate.h): No longer include, since this file
+	does not use __FreeBSD_version any more.
+
+	* s/aix4-2.h (TERMINFO):
+	* s/cygwin.h (TERMINFO):
+	* s/darwin.h (TERMINFO, LIBS_TERMCAP) [HAVE_LIBNCURSES]:
+	* s/freebsd.h (TERMINFO, LIBS_TERMCAP):
+	* s/gnu-linux.h (TERMINFO, LIBS_TERMCAP) [HAVE_LIBNCURSES]:
+	* s/gnu.h (TERMINFO, LIBS_TERMCAP) [HAVE_LIBNCURSES]:
+	* s/hpux10-20.h (TERMINFO, LIBS_TERMCAP):
+	* s/irix6-5.h (TERMINFO):
+	* s/netbsd.h (LIBS_TERMCAP):
+	* s/openbsd.h (TERMINFO, LIBS_TERMCAP):
+	* s/sol2-6.h (LIBS_TERMCAP) [!TERMINFO]:
+	* s/usg5-4.h (TERMINFO):
+	Move to configure.
+
 2010-05-07  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* eval.c (unbind_to): Don't unbind a local binding into the global
--- a/src/Makefile.in	Fri May 07 20:20:30 2010 -0400
+++ b/src/Makefile.in	Fri May 07 19:05:24 2010 -0700
@@ -105,6 +105,11 @@
 
 GTK_OBJ=@GTK_OBJ@
 
+## -ltermcap, or -lncurses, or -lcurses, or "".
+LIBS_TERMCAP=@LIBS_TERMCAP@
+## terminfo.o if TERMINFO, else tparam.o.
+TERMCAP_OBJ=@TERMCAP_OBJ@
+
 LIBXMU=@LIBXMU@
 
 LIBXSM=@LIBXSM@
@@ -368,21 +373,6 @@
   w32.o w32console.o w32fns.o w32heap.o w32inevt.o \
   w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o $(FONT_DRIVERS)
 
-
-#ifdef TERMINFO
-/* Used to be -ltermcap here.  If your machine needs that,
-   define LIBS_TERMCAP in the m/MACHINE.h file.  */
-#ifndef LIBS_TERMCAP
-#define LIBS_TERMCAP -lcurses
-#endif /* LIBS_TERMCAP */
-termcapobj = terminfo.o
-#else /* ! defined (TERMINFO) */
-#ifndef LIBS_TERMCAP
-#define LIBS_TERMCAP
-#endif /* LIBS_TERMCAP */
-termcapobj = tparam.o
-#endif /* ! defined (TERMINFO) */
-
 gmallocobj =
 rallocobj =
 vmlimitobj =
@@ -404,7 +394,7 @@
 POST_ALLOC_OBJ=@POST_ALLOC_OBJ@
 
 /* List of object files that make-docfile should not be told about.  */
-otherobj= $(termcapobj) $(PRE_ALLOC_OBJ) $(gmallocobj) $(rallocobj) \
+otherobj= $(TERMCAP_OBJ) $(PRE_ALLOC_OBJ) $(gmallocobj) $(rallocobj) \
   $(POST_ALLOC_OBJ) $(WIDGET_OBJ) $(LIBOBJS)
 
 #ifdef HAVE_MOUSE
@@ -667,7 +657,7 @@
    with GCC, we might need gnulib again after them.  */
 
 LIBES = $(LOADLIBES) $(LIBS) $(LIBX_BASE) $(LIBX_OTHER) $(LIBSOUND) \
-   $(RSVG_LIBS) $(DBUS_LIBS) @LIBGPM@ @LIBRESOLV@ LIBS_SYSTEM LIBS_TERMCAP \
+   $(RSVG_LIBS) $(DBUS_LIBS) @LIBGPM@ @LIBRESOLV@ LIBS_SYSTEM $(LIBS_TERMCAP) \
    $(GETLOADAVG_LIBS) ${GCONF_LIBS} ${LIBSELINUX_LIBS} \
    @FREETYPE_LIBS@ @FONTCONFIG_LIBS@ @LIBOTF_LIBS@ @M17N_FLT_LIBS@ \
    $(GNULIB_VAR) @LIB_MATH@ @LIB_STANDARD@ $(GNULIB_VAR)
--- a/src/s/aix4-2.h	Fri May 07 20:20:30 2010 -0400
+++ b/src/s/aix4-2.h	Fri May 07 19:05:24 2010 -0700
@@ -96,11 +96,6 @@
 #define LIBS_SYSTEM -lrts -lIM -liconv
 #endif
 
-
-/* Use terminfo instead of termcap.  */
-
-#define TERMINFO
-
 /* The following definition seems to be needed in AIX version 3.1.6.8.
    It may not have been needed in certain earlier versions.  */
 #define HAVE_TCATTR
--- a/src/s/cygwin.h	Fri May 07 20:20:30 2010 -0400
+++ b/src/s/cygwin.h	Fri May 07 19:05:24 2010 -0700
@@ -106,10 +106,6 @@
 #define UNEXEC unexcw.o
 #define LINKER $(CC)
 
-/* Use terminfo instead of termcap.  Fewer environment variables to
-   go wrong, more terminal types. */
-#define TERMINFO
-
 #define HAVE_SOCKETS
 
 /* vfork() interacts badly with setsid(), causing ptys to fail to
--- a/src/s/darwin.h	Fri May 07 20:20:30 2010 -0400
+++ b/src/s/darwin.h	Fri May 07 19:05:24 2010 -0700
@@ -179,16 +179,6 @@
 #undef HAVE_POSIX_MEMALIGN
 #endif
 
-/* The ncurses library has been moved out of the System framework in
-   Mac OS X 10.2.  So if ./configure detects it, set the command-line
-   option to use it.  */
-#ifdef HAVE_LIBNCURSES
-#define LIBS_TERMCAP -lncurses
-/* This prevents crashes when running Emacs in Terminal.app under
-   10.2.  */
-#define TERMINFO
-#endif
-
 /* Link this program just by running cc.  */
 #define ORDINARY_LINK
 
--- a/src/s/freebsd.h	Fri May 07 20:20:30 2010 -0400
+++ b/src/s/freebsd.h	Fri May 07 19:05:24 2010 -0700
@@ -22,8 +22,6 @@
 You should have received a copy of the GNU General Public License
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include <osreldate.h>
-
 /* Get most of the stuff from bsd-common */
 #include "bsd-common.h"
 
@@ -33,12 +31,6 @@
 #define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)
 
 #define LIBS_SYSTEM -lutil
-#if __FreeBSD_version < 400000
-#define LIBS_TERMCAP -ltermcap
-#else
-#define TERMINFO
-#define LIBS_TERMCAP -lncurses
-#endif
 
 #undef LIB_GCC
 #define LIB_GCC
--- a/src/s/gnu-linux.h	Fri May 07 20:20:30 2010 -0400
+++ b/src/s/gnu-linux.h	Fri May 07 19:05:24 2010 -0700
@@ -180,11 +180,6 @@
 #undef LIB_GCC
 #define LIB_GCC
 
-#ifdef HAVE_LIBNCURSES
-#define TERMINFO
-#define LIBS_TERMCAP -lncurses
-#endif
-
 #define UNEXEC unexelf.o
 
 /* This is to work around mysterious gcc failures in some system versions.
--- a/src/s/gnu.h	Fri May 07 20:20:30 2010 -0400
+++ b/src/s/gnu.h	Fri May 07 19:05:24 2010 -0700
@@ -28,13 +28,6 @@
 
 #define SIGNALS_VIA_CHARACTERS
 
-/* Tell Emacs that we are a terminfo based system; disable the use
-   of local termcap.  (GNU uses ncurses.) */
-#ifdef HAVE_LIBNCURSES
-#define TERMINFO
-#define LIBS_TERMCAP -lncurses
-#endif
-
 /* Use mmap directly for allocating larger buffers.  */
 #ifdef DOUG_LEA_MALLOC
 #undef REL_ALLOC
--- a/src/s/hpux10-20.h	Fri May 07 20:20:30 2010 -0400
+++ b/src/s/hpux10-20.h	Fri May 07 19:05:24 2010 -0700
@@ -77,9 +77,6 @@
 
 /* Special hacks needed to make Emacs run on this system.  */
 
-/* Use the system provided termcap(3) library */
-#define TERMINFO
-
 /* In hpux, the symbol SIGIO is defined, but the feature
    doesn't work in the way Emacs needs it to.  */
 
@@ -140,16 +137,10 @@
 #define HAVE_XRMSETDATABASE
 #endif
 
-/* Make sure we get select from libc rather than from libcurses
-   because libcurses on HPUX 10.10 has a broken version of select.
-   We used to use -lc -lcurses, but this may be cleaner.  */
-#define LIBS_TERMCAP -ltermcap
-
 /* 2000-11-21: Temporarily disable Unix 98 large file support found by
    configure.  It fails on HPUX 11, at least, because it enables
    header sections which lose when `static' is defined away, as it is
    on HP-UX.  (You get duplicate symbol errors on linking). */
-
 #undef _FILE_OFFSET_BITS
 
 /* Define NO_REMAP if memory segmentation makes it not work well
--- a/src/s/irix6-5.h	Fri May 07 20:20:30 2010 -0400
+++ b/src/s/irix6-5.h	Fri May 07 19:05:24 2010 -0700
@@ -40,13 +40,8 @@
 /* Make process_send_signal work by "typing" a signal character on the pty.  */
 #define SIGNALS_VIA_CHARACTERS
 
-/* Use terminfo instead of termcap.  */
-
-#define TERMINFO
-
 /* Letter to use in finding device name of first pty,
   if system supports pty's.  'a' means it is /dev/ptya0  */
-
 #undef FIRST_PTY_LETTER
 #define FIRST_PTY_LETTER 'q'
 
--- a/src/s/netbsd.h	Fri May 07 20:20:30 2010 -0400
+++ b/src/s/netbsd.h	Fri May 07 19:05:24 2010 -0700
@@ -26,8 +26,6 @@
 
 #define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)
 
-#define LIBS_TERMCAP -ltermcap
-
 #undef LIB_GCC
 #define LIB_GCC
 
--- a/src/s/openbsd.h	Fri May 07 20:20:30 2010 -0400
+++ b/src/s/openbsd.h	Fri May 07 19:05:24 2010 -0700
@@ -1,13 +1,7 @@
 /* System file for openbsd.  */
 
-/* Mostly the same as NetBSD.  */
+/* The same as NetBSD.  Note there are differences in configure.  */
 #include "netbsd.h"
 
-/*  David Mazieres <dm@reeducation-labor.lcs.mit.edu> says this
-    is necessary.  Otherwise Emacs dumps core when run -nw.  */
-#define TERMINFO
-#undef LIBS_TERMCAP
-#define LIBS_TERMCAP -lncurses
-
 /* arch-tag: 7e3f65ca-3f48-4237-933f-2b208b21e8e2
    (do not change this comment) */
--- a/src/s/sol2-6.h	Fri May 07 20:20:30 2010 -0400
+++ b/src/s/sol2-6.h	Fri May 07 19:05:24 2010 -0700
@@ -1,7 +1,7 @@
 /* Definitions file for GNU Emacs running on Solaris 2.6.
 
-   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-                 2008, 2009, 2010  Free Software Foundation, Inc.
+Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+  2008, 2009, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -38,16 +38,8 @@
 
 /* inoue@ainet.or.jp says Solaris has a bug related to X11R6-style
    XIM support.  */
-
 #define INHIBIT_X11R6_XIM
 
-/* Must use the system's termcap, if we use any termcap.
-   It does special things.  */
-
-#ifndef TERMINFO
-#define LIBS_TERMCAP -ltermcap
-#endif
-
 /* This is the same definition as in usg5-4.h, but with sigblock/sigunblock
    rather than sighold/sigrelse, which appear to be BSD4.1 specific.
    It may also be appropriate for SVR4.x
--- a/src/s/usg5-4.h	Fri May 07 20:20:30 2010 -0400
+++ b/src/s/usg5-4.h	Fri May 07 19:05:24 2010 -0700
@@ -1,6 +1,7 @@
 /* Definitions file for GNU Emacs running on AT&T's System V Release 4
-   Copyright (C) 1987, 1990, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-                 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+
+Copyright (C) 1987, 1990, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+  2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -75,10 +76,6 @@
 #define rindex strrchr
 #endif /* ! defined (HAVE_RINDEX) */
 
-/* Use terminfo instead of termcap.  */
-
-#define TERMINFO
-
 
 /* The docs for system V/386 suggest v.3 has sigpause,
    so let's give it a try.  */