This is the mail archive of the gdb@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: A patch for gnu-regex


On Tue, Mar 07, 2000 at 02:42:02PM -0800, Stan Shebs wrote:
> "H . J . Lu" wrote:
> > 
> > I believe gnu-regex is maintained in glibc 2. I'd like to use the one
> > in glibc 2 instead of the one in gdb.
> 
> I don't know if there is any more elegant way to handle the linux.mh vs
> linuxlibc1.mh distinction (although we should try, instead of making
> still more file semi-clones), but you could simplify the source files by
> making a gdb_regex.h similar to the other gdb_*.h substitute files, and
> put the #if sequence in it.
> 

Here is a new patch.


-- 
H.J. Lu (hjl@gnu.org)
---
2000-03-07  H.J. Lu  <hjl@gnu.org>

	* gdb-regex.h: New. Include <regex.h> for glibc 2 and include
	"gnu-regex.h" otherwise.

        * irix5-nat.c: Include "gdb-regex.h" instead of "gnu-regex.h".
	* monitor.c: Likewise.
	* osfsolib.c: Likewise.
	* solib.c: Likewise.
	* source.c: Likewise.
	* symtab.c: Likewise.

	* Makefile.in (REGEX): Changed to @REGEX@.
	(REGEX1): Removed.
	(ADD_DEPS): Use $(REGEX) instead of $(REGEX1).

	* configure.in (REGEX): New. Subsstitue @REGEX@ in Makefile.in.
	* configure: Regenerated.

Index: Makefile.in
===================================================================
RCS file: /work/cvs/gnu/gdb/gdb/Makefile.in,v
retrieving revision 1.1.1.9
diff -u -p -r1.1.1.9 Makefile.in
--- Makefile.in	2000/03/07 18:42:08	1.1.1.9
+++ Makefile.in	2000/03/07 23:28:45
@@ -285,8 +290,7 @@ HLDENV = @HLDENV@
 
 # We are using our own version of REGEX now to be consistent across
 # machines.
-REGEX = gnu-regex.o
-REGEX1 = gnu-regex.o
+REGEX = @REGEX@
 
 # If your system is missing alloca(), or, more likely, it's there but
 # it doesn't work, then refer to libiberty.
@@ -308,7 +312,7 @@ CDEPS = $(XM_CDEPS) $(TM_CDEPS) $(NAT_CD
 	$(OPCODES) $(MMALLOC) $(INTL_DEPS) $(LIBIBERTY) $(CONFIG_DEPS)
 
 ADD_FILES = $(REGEX) $(XM_ADD_FILES) $(TM_ADD_FILES) $(NAT_ADD_FILES)
-ADD_DEPS = $(REGEX1) $(XM_ADD_FILES) $(TM_ADD_FILES) $(NAT_ADD_FILES)
+ADD_DEPS = $(REGEX) $(XM_ADD_FILES) $(TM_ADD_FILES) $(NAT_ADD_FILES)
 
 VERSION = 20000204
 DIST=gdb
Index: configure.in
===================================================================
RCS file: /work/cvs/gnu/gdb/gdb/configure.in,v
retrieving revision 1.1.1.6
diff -u -p -r1.1.1.6 configure.in
--- configure.in	2000/03/07 18:42:10	1.1.1.6
+++ configure.in	2000/03/07 23:47:24
@@ -101,6 +101,24 @@ AC_C_CONST
 AC_CHECK_FUNCS(setpgid sbrk sigaction isascii bzero bcopy btowc poll sigprocmask)
 AC_FUNC_ALLOCA
 
+dnl See if we have GNU regex in glibc 2.
+AC_MSG_CHECKING(for GNU regex in glibc 2)
+AC_CACHE_VAL(gdb_cv_have_glibc_2,
+[AC_TRY_COMPILE([#include <features.h>],
+[#if !defined __GLIBC__ || __GLIBC__ < 2
+#error It is not glibc 2.
+#endif
+],
+		[gdb_cv_have_glibc_2=yes],
+		[gdb_cv_have_glibc_2=no])])
+AC_MSG_RESULT($gdb_cv_have_glibc_2)
+if test $gdb_cv_have_glibc_2 = yes; then
+  REGEX=
+else
+  REGEX="gnu-regex.o"
+fi
+AC_SUBST(REGEX)
+
 dnl See if ptrace.h provides the PTRACE_GETREGS request.
 AC_MSG_CHECKING(for PTRACE_GETREGS)
 AC_CACHE_VAL(gdb_cv_have_ptrace_getregs,
--- /dev/null	Tue May  5 13:32:27 1998
+++ gdb-regex.h	Tue Mar  7 15:47:50 2000
@@ -0,0 +1,7 @@
+#ifndef _GDB_REGEX_H
+#if defined __GLIBC__ && __GLIBC__ >= 2
+#include <regex.h>
+#else
+#include "gnu-regex.h"
+#endif
+#endif /* _GDB_REGEX_H */
Index: irix5-nat.c
===================================================================
RCS file: /work/cvs/gnu/gdb/gdb/irix5-nat.c,v
retrieving revision 1.1.1.3
diff -u -p -r1.1.1.3 irix5-nat.c
--- irix5-nat.c	1999/11/19 23:38:46	1.1.1.3
+++ irix5-nat.c	2000/03/07 23:24:47
@@ -278,7 +278,7 @@ fetch_core_registers (core_reg_sect, cor
 #include "objfiles.h"
 #include "command.h"
 #include "frame.h"
-#include "gnu-regex.h"
+#include "gdb-regex.h"
 #include "inferior.h"
 #include "language.h"
 #include "gdbcmd.h"
Index: monitor.c
===================================================================
RCS file: /work/cvs/gnu/gdb/gdb/monitor.c,v
retrieving revision 1.1.1.5
diff -u -p -r1.1.1.5 monitor.c
--- monitor.c	2000/03/07 18:42:14	1.1.1.5
+++ monitor.c	2000/03/07 23:24:50
@@ -50,7 +50,7 @@
 #include "monitor.h"
 #include "gdbcmd.h"
 #include "inferior.h"
-#include "gnu-regex.h"
+#include "gdb-regex.h"
 #include "dcache.h"
 #include "srec.h"
 
Index: osfsolib.c
===================================================================
RCS file: /work/cvs/gnu/gdb/gdb/osfsolib.c,v
retrieving revision 1.1.1.3
diff -u -p -r1.1.1.3 osfsolib.c
--- osfsolib.c	1999/11/19 23:38:50	1.1.1.3
+++ osfsolib.c	2000/03/07 23:24:55
@@ -36,7 +36,7 @@
 #include "command.h"
 #include "target.h"
 #include "frame.h"
-#include "gnu-regex.h"
+#include "gdb-regex.h"
 #include "inferior.h"
 #include "language.h"
 #include "gdbcmd.h"
Index: solib.c
===================================================================
RCS file: /work/cvs/gnu/gdb/gdb/solib.c,v
retrieving revision 1.1.1.4
diff -u -p -r1.1.1.4 solib.c
--- solib.c	2000/03/07 18:42:17	1.1.1.4
+++ solib.c	2000/03/07 23:25:01
@@ -49,7 +49,7 @@
 #include "command.h"
 #include "target.h"
 #include "frame.h"
-#include "gnu-regex.h"
+#include "gdb-regex.h"
 #include "inferior.h"
 #include "environ.h"
 #include "language.h"
Index: source.c
===================================================================
RCS file: /work/cvs/gnu/gdb/gdb/source.c,v
retrieving revision 1.1.1.3
diff -u -p -r1.1.1.3 source.c
--- source.c	2000/02/04 20:21:58	1.1.1.3
+++ source.c	2000/03/07 23:25:07
@@ -33,7 +33,7 @@
 #include "gdb_stat.h"
 #include <fcntl.h>
 #include "gdbcore.h"
-#include "gnu-regex.h"
+#include "gdb-regex.h"
 #include "symfile.h"
 #include "objfiles.h"
 #include "annotate.h"
Index: symtab.c
===================================================================
RCS file: /work/cvs/gnu/gdb/gdb/symtab.c,v
retrieving revision 1.1.1.4
diff -u -p -r1.1.1.4 symtab.c
--- symtab.c	2000/03/07 18:42:17	1.1.1.4
+++ symtab.c	2000/03/07 23:25:15
@@ -30,7 +30,7 @@
 #include "objfiles.h"
 #include "gdbcmd.h"
 #include "call-cmds.h"
-#include "gnu-regex.h"
+#include "gdb-regex.h"
 #include "expression.h"
 #include "language.h"
 #include "demangle.h"

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]