This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH] Cleanup configure.in (7/n)
- From: Mark Kettenis <kettenis at chello dot nl>
- To: gdb-patches at sources dot redhat dot com
- Date: Thu, 2 Jan 2003 19:30:20 +0100 (CET)
- Subject: [PATCH] Cleanup configure.in (7/n)
This revamps the way we check for termcap, curses, etc... This
parallels much more closely what Readline does. I also added some
error message when the needed functionality couldn't be found.
Checked in.
Mark
P.S. It's code like this that I want to convert into an Autoconf macro
of its own.
Index: ChangeLog
from 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.
Index: configure.in
===================================================================
RCS file: /cvs/src/src/gdb/configure.in,v
retrieving revision 1.103
diff -u -p -r1.103 configure.in
--- configure.in 2 Jan 2003 14:47:01 -0000 1.103
+++ configure.in 2 Jan 2003 16:53:02 -0000
@@ -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
@@ -972,30 +1011,6 @@ case ${host} in
*djgpp* ) SER_HARDWIRE=ser-go32.o ;;
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=
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.300
diff -u -p -r1.300 Makefile.in
--- Makefile.in 2 Jan 2003 14:27:25 -0000 1.300
+++ Makefile.in 2 Jan 2003 16:53:04 -0000
@@ -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: config/i386/go32.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/go32.mh,v
retrieving revision 1.6
diff -u -p -r1.6 go32.mh
--- config/i386/go32.mh 11 May 2002 17:22:27 -0000 1.6
+++ config/i386/go32.mh 2 Jan 2003 16:53:04 -0000
@@ -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