* configure.in: Move code that provides the --enable-tui option
authorMark Kettenis <kettenis@gnu.org>
Thu, 2 Jan 2003 16:54:56 +0000 (16:54 +0000)
committerMark Kettenis <kettenis@gnu.org>
Thu, 2 Jan 2003 16:54:56 +0000 (16:54 +0000)
before the "Checks for libraries" section.  Polish the code
somewhat and set need_curses to yes if we build the TUI.  Rewrite
code that looks for a library providing termcap functionality to
match more closely what's done in the Readline library, and move
it into to the "Checks for libraries" section.
* configure: Regenerated.
* Makefile.in (TERMCAP): Remove variable.
* config/i386/go32.mh (TERMCAP): Remove variable.

gdb/ChangeLog
gdb/Makefile.in
gdb/config/i386/go32.mh
gdb/configure.in

index 6affbc2..3952ef4 100644 (file)
@@ -1,3 +1,15 @@
+2003-01-02  Mark Kettenis  <kettenis@gnu.org>
+
+       * configure.in: Move code that provides the --enable-tui option
+       before the "Checks for libraries" section.  Polish the code
+       somewhat and set need_curses to yes if we build the TUI.  Rewrite
+       code that looks for a library providing termcap functionality to
+       match more closely what's done in the Readline library, and move
+       it into to the "Checks for libraries" section.
+       * configure: Regenerated.
+       * Makefile.in (TERMCAP): Remove variable.
+       * config/i386/go32.mh (TERMCAP): Remove variable.
+
 2003-01-02  Andrew Cagney  <ac131313@redhat.com>
 
        * MAINTAINERS: Mention gdb_mbuild.sh.
index 8e6ef9c..7e65cf4 100644 (file)
@@ -64,10 +64,6 @@ DLLTOOL = @DLLTOOL@
 WINDRES = @WINDRES@
 MIG = @MIG@
 
-# Flags that describe where you can find the termcap library.
-# This can be overridden in the host Makefile fragment file.
-TERMCAP = @TERM_LIB@
-
 # If you are compiling with GCC, make sure that either 1) You have the
 # fixed include files where GCC can reach them, or 2) You use the
 # -traditional flag.  Otherwise the ioctl calls in inflow.c
@@ -360,16 +356,15 @@ HLDENV = @HLDENV@
 
 # Libraries and corresponding dependencies for compiling gdb.
 # {X,T}M_CLIBS, defined in *config files, have host- and target-dependent libs.
-# TERMCAP comes after readline, since readline depends on it.
 # MMALLOC comes after anything else that might want an allocation function.
 # LIBIBERTY appears twice on purpose.
 # If you have the Cygnus libraries installed,
 # you can use 'CLIBS=$(INSTALLED_LIBS)' 'CDEPS='
 INSTALLED_LIBS=-lbfd -lreadline -lopcodes -liberty \
-       $(TERMCAP) $(XM_CLIBS) $(TM_CLIBS) $(NAT_CLIBS) $(GDBTKLIBS) @LIBS@ \
+       $(XM_CLIBS) $(TM_CLIBS) $(NAT_CLIBS) $(GDBTKLIBS) @LIBS@ \
        -lmmalloc -lintl -liberty
 CLIBS = $(SIM) $(BFD) $(READLINE) $(OPCODES) $(INTL) $(LIBIBERTY) \
-       $(TERMCAP) $(XM_CLIBS) $(TM_CLIBS) $(NAT_CLIBS) $(GDBTKLIBS) @LIBS@ \
+       $(XM_CLIBS) $(TM_CLIBS) $(NAT_CLIBS) $(GDBTKLIBS) @LIBS@ \
        $(LIBICONV) \
        $(MMALLOC) $(LIBIBERTY) $(WIN32LIBS)
 CDEPS = $(XM_CDEPS) $(TM_CDEPS) $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE) \
index 94a7a9d..846896b 100644 (file)
@@ -9,7 +9,6 @@ XM_FILE= xm-go32.h
 NAT_FILE= nm-go32.h
 NATDEPFILES= go32-nat.o i386-nat.o
 
-TERMCAP=
 HOST_IPC=
 CC= gcc
 XM_CLIBS= -ldbg
index 2bddde3..3f5fe37 100644 (file)
@@ -105,6 +105,30 @@ fi
 
 AC_ARG_PROGRAM
 
+# Enable TUI.
+AC_ARG_ENABLE(tui,
+[  --enable-tui            enable full-screen terminal user interface (TUI)],
+  [case $enableval in
+    yes | no)
+      ;;
+    *)
+      AC_MSG_ERROR([bad value $enableval for --enable-tui]) ;;
+  esac])
+if test x"$enable_tui" = xyes; then
+  if test -d $srcdir/tui; then
+    CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_TUI_OBS)"
+    CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_TUI_DEPS)"
+    CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_TUI_SRCS)"
+    CONFIG_INITS="$CONFIG_INITS \$(SUBDIR_TUI_INITS)"
+    ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_TUI_CFLAGS)"
+    CONFIG_ALL="$CONFIG_ALL \$(SUBDIR_TUI_ALL)"
+    CONFIG_CLEAN="$CONFIG_CLEAN \$(SUBDIR_TUI_CLEAN)"
+    CONFIG_INSTALL="$CONFIG_INSTALL \$(SUBDIR_TUI_INSTALL)"
+    CONFIG_UNINSTALL="$CONFIG_UNINSTALL \$(SUBDIR_TUI_UNINSTALL)"
+    need_curses=yes
+  fi
+fi
+
 # --------------------- #
 # Checks for programs.  #
 # --------------------- #
@@ -139,6 +163,48 @@ AC_CHECK_FUNC(wctype, [],
 # Some systems (e.g. Solaris) have `socketpair' in libsocket.
 AC_SEARCH_LIBS(socketpair, socket)
 
+# Since GDB uses Readline, we need termcap functionality, so we need
+# to find a library that provides that.  When GDB is configured with
+# --enable-tui, we need full curses functionality.
+#
+# FIXME: kettenis/20030102: We seem to prefer HP curses (Hcurses) over
+# Xcurses on HP-UX; see the `-D__HP_CURSES' in the relevant host
+# Makefile fragments.  That's why we need to have `Hcurses' before
+# `curses'.  I don't see why we should use HP curses if a more
+# standard curses is available, except that according to HP's
+# documentation one needs to compile `-D_XOPEN_SOURCE_EXTENDED' on
+# HP-UX 10.10 and 10.20.
+
+if test "$need_curses" = yes; then
+  AC_SEARCH_LIBS(initscr, [ncurses Hcurses curses], [],
+    [AC_MSG_ERROR([no curses library found])])
+fi
+
+case $host_os in
+  cygwin*)
+    if test -d $srcdir/libtermcap; then
+      LIBS="../libtermcap/libtermcap.a $LIBS"
+      ac_cv_search_tgetent="../libtermcap/libtermcap.a"
+    fi ;;
+  go32*)
+    # ??? Is this really true?
+    ac_cv_search_tgetent="none required"
+    ;;
+  aix*)
+    # Readline prefers curses over termcap on AIX.
+    # ??? Why?
+    AC_SEARCH_LIBS(tgetent, [tinfo ncurses curses termcap])
+    ;;
+esac
+
+# Note: We used to check for libtermlib and libterminfo too, but
+# Readline doesn't, so I think we're safe with leaving them out.
+AC_SEARCH_LIBS(tgetent, [termcap tinfo ncurses Hcurses curses])
+
+if test "$ac_cv_search_tgetent" = no; then
+  AC_MSG_ERROR([no termcap library found])
+fi
+
 # ------------------------- #
 # Checks for header files.  #
 # ------------------------- #
@@ -802,33 +868,6 @@ if test $want_uiout = true; then
    UIOUT_CFLAGS="-DUI_OUT=1"
 fi
 
-AC_ARG_ENABLE(tui,
-[  --enable-tui            Enable full-screen terminal user interface],
-[
-  case "${enable_tui}" in
-    yes | no) ;;
-    "")  enable_tui=yes ;;
-    *)
-      AC_MSG_ERROR(Bad value for --enable-tui: ${enableval})
-    ;;
-  esac
-])
-case ${enable_tui} in
-  "yes" )
-    if test -d "${srcdir}/tui" ; then
-      CONFIG_OBS="${CONFIG_OBS} \$(SUBDIR_TUI_OBS)"
-      CONFIG_DEPS="${CONFIG_DEPS} \$(SUBDIR_TUI_DEPS)"
-      CONFIG_SRCS="${CONFIG_SRCS} \$(SUBDIR_TUI_SRCS)"
-      CONFIG_INITS="${CONFIG_INITS} \$(SUBDIR_TUI_INITS)"
-      ENABLE_CFLAGS="${ENABLE_CFLAGS} \$(SUBDIR_TUI_CFLAGS)"
-      CONFIG_ALL="${CONFIG_ALL} \$(SUBDIR_TUI_ALL)"
-      CONFIG_CLEAN="${CONFIG_CLEAN} \$(SUBDIR_TUI_CLEAN)"
-      CONFIG_INSTALL="${CONFIG_INSTALL} \$(SUBDIR_TUI_INSTALL)"
-      CONFIG_UNINSTALL="${CONFIG_UNINSTALL} \$(SUBDIR_TUI_UNINSTALL)"
-    fi
-    ;;
-esac
-
 AC_ARG_ENABLE(netrom,
 [  --enable-netrom         Enable NetROM support],
 [case "${enableval}" in
@@ -973,30 +1012,6 @@ case ${host} in
 esac
 AC_SUBST(SER_HARDWIRE)
 
-
-dnl Figure out which term library to use.
-if test x$gdb_host = xgo32; then
-  TERM_LIB=
-else
-if test x$gdb_cv_os_cygwin = xyes; then
-  TERM_LIB='`if test -r ../libtermcap/libtermcap.a; then echo ../libtermcap/libtermcap.a; else echo -ltermcap; fi`'
-else
-  TERM_LIB=
-  AC_CHECK_LIB(ncurses, tgetent, TERM_LIB=-lncurses,
-    AC_CHECK_LIB(Hcurses, tgetent, TERM_LIB=-lHcurses,
-      AC_CHECK_LIB(termlib, tgetent, TERM_LIB=-ltermlib,
-        AC_CHECK_LIB(termcap, tgetent, TERM_LIB=-ltermcap,
-         AC_CHECK_LIB(curses, tgetent, TERM_LIB=-lcurses,
-           AC_CHECK_LIB(terminfo, tgetent, TERM_LIB=-lterminfo))))))
-
-  if test "x$TERM_LIB" = x
-  then
-    AC_MSG_ERROR(Could not find a term library, e.g. termcap or termlib!)
-  fi
-fi
-fi
-AC_SUBST(TERM_LIB)
-
 # libreadline needs libuser32.a in a cygwin environment
 WIN32LIBS=
 if test x$gdb_cv_os_cygwin = xyes; then