From 5c9e84c2d8208444772cae8130a23aa27407f32c Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 1 May 2021 18:05:49 -0400 Subject: sim: leverage gnulib We use getline, so leverage gnulib to provide fallback implementation. --- ChangeLog | 5 +++++ configure | 3 +++ configure.ac | 3 +++ sim/common/ChangeLog | 9 +++++++++ sim/common/Make-common.in | 9 +++++++-- sim/common/defs.h | 12 ++++++++++++ sim/ppc/ChangeLog | 4 ++++ sim/ppc/Makefile.in | 2 +- 8 files changed, 44 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 26eb827..53ec7cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2021-05-29 Mike Frysinger + + * configure.ac: Add gnulib to configdirs for sim. + * configure: Regenerate. + 2021-05-24 Maciej W. Rozycki * MAINTAINERS: Update path to readline config.{sub,guess} files. diff --git a/configure b/configure index 544a8d1..3dd2065 100755 --- a/configure +++ b/configure @@ -7504,6 +7504,9 @@ case " ${configdirs} " in *\ gdbserver\ *) configdirs="${configdirs} gnulib gdbsupport" ;; + *\ sim\ *) + configdirs="${configdirs} gnulib" + ;; esac # Strip out unwanted targets. diff --git a/configure.ac b/configure.ac index 59b4194..797a624 100644 --- a/configure.ac +++ b/configure.ac @@ -2812,6 +2812,9 @@ case " ${configdirs} " in *\ gdbserver\ *) configdirs="${configdirs} gnulib gdbsupport" ;; + *\ sim\ *) + configdirs="${configdirs} gnulib" + ;; esac # Strip out unwanted targets. diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 76bf134..f44e055 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,12 @@ +2021-05-29 Mike Frysinger + + * Make-common.in (GNULIB_BUILDDIR): Define. + Include $(GNULIB_BUILDDIR)/Makefile.gnulib.inc. + (CSEARCH): Add -I../... + (ALL_CFLAGS): Add $(INCGNU). + (EXTRA_LIBS): Add $(LIBGNU). + * defs.h: Include gnulib/config.h. Undefine PACKAGE* defines. + 2021-05-17 Mike Frysinger * sim-base.h (SIM_HAVE_COMMON_SIM_STATE): Delete. diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in index d38c849..8f52cf5 100644 --- a/sim/common/Make-common.in +++ b/sim/common/Make-common.in @@ -40,6 +40,10 @@ srccom = $(srcdir)/../common srcroot = $(srcdir)/../.. srcsim = $(srcdir)/.. +# Helper code from gnulib. +GNULIB_BUILDDIR = ../../gnulib +include $(GNULIB_BUILDDIR)/Makefile.gnulib.inc + prefix = @prefix@ exec_prefix = @exec_prefix@ @@ -232,8 +236,9 @@ CSEARCH = -I. -I$(srcdir) -I../common -I$(srccom) \ -I../../include -I$(srcroot)/include \ -I../../bfd -I$(srcroot)/bfd \ -I../../opcodes -I$(srcroot)/opcodes \ + -I../.. \ @INCINTL@ -ALL_CFLAGS = $(CONFIG_CFLAGS) $(CSEARCH) $(SIM_EXTRA_CFLAGS) $(CFLAGS) +ALL_CFLAGS = $(CONFIG_CFLAGS) $(CSEARCH) $(INCGNU) $(SIM_EXTRA_CFLAGS) $(CFLAGS) BUILD_CFLAGS = $(CFLAGS_FOR_BUILD) $(CSEARCH) COMMON_DEP_CFLAGS = $(CONFIG_CFLAGS) $(CSEARCH) $(SIM_EXTRA_CFLAGS) @@ -248,7 +253,7 @@ LIBINTL_DEP = @LIBINTL_DEP@ CONFIG_LIBS = @LIBS@ $(ZLIB) LIBDEPS = $(BFD_LIB) $(OPCODES_LIB) $(LIBINTL_DEP) $(LIBIBERTY_LIB) EXTRA_LIBS = $(BFD_LIB) $(OPCODES_LIB) $(LIBINTL) $(LIBIBERTY_LIB) \ - $(CONFIG_LIBS) $(SIM_EXTRA_LIBS) $(LIBDL) + $(CONFIG_LIBS) $(SIM_EXTRA_LIBS) $(LIBDL) $(LIBGNU) LIB_OBJS = callback.o modules.o syscall.o targ-map.o version.o \ $(SIM_OBJS) diff --git a/sim/common/defs.h b/sim/common/defs.h index 3a0737c..957e36d 100644 --- a/sim/common/defs.h +++ b/sim/common/defs.h @@ -22,6 +22,18 @@ #ifdef HAVE_CONFIG_H +/* Include gnulib's various configure tests. */ +#include "gnulib/config.h" + +/* Reset macros that our config.h will provide. */ +#undef PACKAGE +#undef PACKAGE_BUGREPORT +#undef PACKAGE_NAME +#undef PACKAGE_STRING +#undef PACKAGE_TARNAME +#undef PACKAGE_URL +#undef PACKAGE_VERSION + /* Include sim's various configure tests. */ #include "config.h" diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog index 0755fe2..15b50ef 100644 --- a/sim/ppc/ChangeLog +++ b/sim/ppc/ChangeLog @@ -1,3 +1,7 @@ +2021-05-29 Mike Frysinger + + * Makefile.in (INCLUDES): Add -I../.. + 2021-05-16 Mike Frysinger * Makefile.in (gentmap): Pass -DUSE_CONFIG_H. diff --git a/sim/ppc/Makefile.in b/sim/ppc/Makefile.in index 5ce511e..1996e13 100644 --- a/sim/ppc/Makefile.in +++ b/sim/ppc/Makefile.in @@ -147,7 +147,7 @@ LIB_INCLUDES = -I$(srcdir)/../../include BFD_INCLUDES = -I../../bfd -I$(srcdir)/../../bfd GDB_INCLUDES = -I../../gdb -I$(srcdir)/../../gdb -I$(srcdir)/../../gdb/config -INCLUDES = -I. -I$(srcdir) $(LIB_INCLUDES) $(BFD_INCLUDES) $(GDB_INCLUDES) +INCLUDES = -I. -I$(srcdir) $(LIB_INCLUDES) $(BFD_INCLUDES) $(GDB_INCLUDES) -I../.. LIBIBERTY_LIB = ../../libiberty/libiberty.a BFD_LIB = ../../bfd/libbfd.a -- cgit v1.1