Re: [RFC] Add expat to the GDB sources

Daniel Jacobowitz
2006-07-31T20:24:28Z

On Mon, Jul 31, 2006 at 01:33:12PM -0400, Daniel Jacobowitz wrote:
> As for optional versus required, I don't think there's a relevant FSF
> position. However, I very much wanted to use the XML target
> descriptions in some cases to replace the C-coded ones. So obviously
> I prefer to require expat.

Which yields this patch.

If our final decision is to make all features which require expat
optional, I can rework this patch to only issue a warning message,
and update the documentation accordingly. It currently:
- Searches $prefix/lib and $prefix/include for expat, as well
as the standard system directories.
- Offers a documented option to find expat elsewhere.
- Defines HAVE_LIBEXPAT in config.h.

I think I've said everything useful that I can say on this subject;
I am not sure how to proceed. The options that I see are:

1. Refuse to use external libraries.
2. Make external libraries optional.
3. Require external libraries, with moderation and documentation.

Obviously I prefer 3, followed by 2.

Your thoughts welcome!

--
Daniel Jacobowitz
CodeSourcery

2006-07-31 Daniel Jacobowitz <dan@codesourcery.com>

* configure.ac: Check for expat.
* acinclude.m4: Include AC_LIB_HAVE_LINKFLAGS dependencies.
* Makefile.in (LIBEXPAT): New.
(CLIBS): Include $(LIBEXPAT).
* README: Mention expat.
* configure, config.in: Regenerated.

2006-07-31 Daniel Jacobowitz <dan@codesourcery.com>

* gdb.texinfo (Installing GDB): Update menu. Move text to...
(Running Configure): ...here.
(Requirements): New node. Mention expat.

Index: configure.ac
===================================================================
RCS file: /cvs/src/src/gdb/configure.ac,v
retrieving revision 1.33
diff -u -p -r1.33 configure.ac
--- configure.ac 31 May 2006 15:14:37 -0000 1.33
+++ configure.ac 31 Jul 2006 20:01:59 -0000
@@ -315,6 +315,21 @@ if test "$ac_cv_search_tgetent" = no; th
AC_MSG_ERROR([no termcap library found])
fi

+AC_LIB_HAVE_LINKFLAGS([expat], [], [#include "expat.h"],
+ [XML_Parser p = XML_ParserCreate (0);])
+if test "$HAVE_LIBEXPAT" != yes; then
+ missing_libraries=true
+ AC_MSG_NOTICE([expat appears to be missing.
+
+Expat is available from:
+ http://expat.sourceforge.net/
+])
+fi
+
+if test -n "$missing_libraries"; then
+ AC_MSG_ERROR([missing libraries])
+fi
+
# ------------------------- #
# Checks for header files. #
# ------------------------- #
Index: acinclude.m4
===================================================================
RCS file: /cvs/src/src/gdb/acinclude.m4,v
retrieving revision 1.15
diff -u -p -r1.15 acinclude.m4
--- acinclude.m4 31 May 2006 15:14:36 -0000 1.15
+++ acinclude.m4 31 Jul 2006 20:02:00 -0000
@@ -12,6 +12,11 @@ sinclude(../config/stdint.m4)

sinclude(../config/gettext-sister.m4)

+dnl For AC_LIB_HAVE_LINKFLAGS.
+sinclude(../config/lib-ld.m4)
+sinclude(../config/lib-prefix.m4)
+sinclude(../config/lib-link.m4)
+
dnl CYGNUS LOCAL: This gets the right posix flag for gcc
AC_DEFUN([CY_AC_TCL_LYNX_POSIX],
[AC_REQUIRE([AC_PROG_CC])AC_REQUIRE([AC_PROG_CPP])
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.833
diff -u -p -r1.833 Makefile.in
--- Makefile.in 19 Jul 2006 23:23:35 -0000 1.833
+++ Makefile.in 31 Jul 2006 20:02:00 -0000
@@ -128,6 +128,9 @@ READLINE = $(READLINE_DIR)/libreadline.a
READLINE_SRC = $(srcdir)/$(READLINE_DIR)
READLINE_CFLAGS = -I$(READLINE_SRC)/..

+# Where is expat?
+LIBEXPAT = @LIBEXPAT@
+
WARN_CFLAGS = @WARN_CFLAGS@
WERROR_CFLAGS = @WERROR_CFLAGS@
GDB_WARN_CFLAGS = $(WARN_CFLAGS)
@@ -376,7 +379,7 @@ INSTALLED_LIBS=-lbfd -lreadline -lopcode
-lintl -liberty
CLIBS = $(SIM) $(READLINE) $(OPCODES) $(BFD) $(INTL) $(LIBIBERTY) \
$(XM_CLIBS) $(TM_CLIBS) $(NAT_CLIBS) $(GDBTKLIBS) @LIBS@ \
- $(LIBICONV) \
+ $(LIBICONV) $(LIBEXPAT) \
$(LIBIBERTY) $(WIN32LIBS)
CDEPS = $(XM_CDEPS) $(TM_CDEPS) $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE) \
$(OPCODES) $(INTL_DEPS) $(LIBIBERTY) $(CONFIG_DEPS)
Index: doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.345
diff -u -p -r1.345 gdb.texinfo
--- doc/gdb.texinfo 21 Jul 2006 14:46:55 -0000 1.345
+++ doc/gdb.texinfo 31 Jul 2006 20:16:26 -0000
@@ -21904,10 +21904,41 @@ Then give @file{gdb.dvi} to your @sc{dvi

@node Installing GDB
@appendix Installing @value{GDBN}
-@cindex configuring @value{GDBN}
@cindex installation
-@cindex configuring @value{GDBN}, and source tree subdirectories

+@menu
+* Requirements:: Requirements for building @value{GDBN}
+* Running Configure:: Invoking the @value{GDBN} @code{configure} script
+* Separate Objdir:: Compiling @value{GDBN} in another directory
+* Config Names:: Specifying names for hosts and targets
+* Configure Options:: Summary of options for configure
+@end menu
+
+@node Requirements
+@section Requirements for building @value{GDBN}
+
+Building @value{GDBN} requires various tools and packages to be available.
+
+@heading Tools/packages necessary for building @value{GDBN}
+@table @asis
+@item ISO C90 compiler
+@value{GDBN} is written in ISO C90. It should be buildable with any
+working C90 compiler, e.g.@: GCC.
+
+@item Expat
+@value{GDBN} uses the Expat XML parsing library. This library may be
+included with your operating system distribution; if it is not, you
+can get the latest version from @url{http://expat.sourceforge.net}.
+The @code{configure} script will search for this library in several
+standard locations; if it is installed in an unusual path, you can
+use the @samp{--with-libexpat-prefix} option to specify its location.
+
+@end table
+
+@node Running Configure
+@section Invoking the @value{GDBN} @code{configure} script
+@cindex configuring @value{GDBN}
+@cindex configuring @value{GDBN}, and source tree subdirectories
@value{GDBN} comes with a @code{configure} script that automates the process
of preparing @value{GDBN} for installation; you can then use @code{make} to
build the @code{gdb} program.
@@ -22013,12 +22044,6 @@ the @samp{SHELL} environment variable) i
that @value{GDBN} uses the shell to start your program---some systems refuse to
let @value{GDBN} debug child processes whose programs are not readable.

-@menu
-* Separate Objdir:: Compiling @value{GDBN} in another directory
-* Config Names:: Specifying names for hosts and targets
-* Configure Options:: Summary of options for configure
-@end menu
-
@node Separate Objdir
@section Compiling @value{GDBN} in another directory

Index: README
===================================================================
RCS file: /cvs/src/src/gdb/README,v
retrieving revision 1.36
diff -u -p -r1.36 README
--- README 17 May 2006 14:40:39 -0000 1.36
+++ README 31 Jul 2006 20:18:12 -0000
@@ -89,6 +89,9 @@ C compiler for your system, you may be a
the GNU CC compiler. It is available via anonymous FTP from the
directory `ftp://ftp.gnu.org/pub/gnu/gcc'.

+ GDB also requires Expat, an XML parsing library. The latest version
+of Expat should be available from `http://expat.sourceforge.net'.
+
GDB can be used as a cross-debugger, running on a machine of one
type while debugging a program running on a machine of another type.
See below.