Committed, sim: make erc32 buildable without in-tree readline

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Committed, sim: make erc32 buildable without in-tree readline

Hans-Peter Nilsson
The "gdb" CVS module includes in-tree readline, but the "sim"
module does not.  The better change (than to add that CVS module
to sim) seemed to be to make the erc32 simulator buildable
without in-tree readline.  Having a dependency on
../../readline/libreadline.a can't help at this level in the
tree, so it wasn't useful other than perhaps to point out the
error.  Tested with and without in-tree readline (i686-linux),
and for sanity the error path on a system without readline at
all (sparc-sun-solaris2.7).

Committed.

sim/erc32:

        * configure.ac: Add test for readline, substitute READLINE.
        * Makefile.in (READLINE_LIB): New substituted-contents variable.
        (SIM_EXTRA_LIBDEPS): Don't set.
        (SIM_EXTRA_LIBS): Use $(READLINE_LIB) instead of
        ../../readline/libreadline.a.
        * configure: Regenerate.

Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/sim/erc32/Makefile.in,v
retrieving revision 1.3
diff -p -u -r1.3 Makefile.in
--- Makefile.in 8 Aug 2006 18:57:25 -0000 1.3
+++ Makefile.in 20 Dec 2006 16:47:27 -0000
@@ -20,10 +20,10 @@
 ## COMMON_PRE_CONFIG_FRAG
 
 TERMCAP_LIB = @TERMCAP@
+READLINE_LIB = @READLINE@
 
 SIM_OBJS = exec.o erc32.o func.o help.o float.o interf.o
-SIM_EXTRA_LIBS = ../../readline/libreadline.a  $(TERMCAP_LIB) -lm
-SIM_EXTRA_LIBDEPS = ../../readline/libreadline.a
+SIM_EXTRA_LIBS = $(READLINE_LIB) $(TERMCAP_LIB) -lm
 SIM_EXTRA_ALL = sis
 SIM_EXTRA_INSTALL = install-sis
 SIM_EXTRA_CLEAN = clean-sis
Index: configure.ac
===================================================================
RCS file: /cvs/src/src/sim/erc32/configure.ac,v
retrieving revision 1.3
diff -p -u -r1.3 configure.ac
--- configure.ac 14 Jan 2005 20:05:42 -0000 1.3
+++ configure.ac 20 Dec 2006 16:47:27 -0000
@@ -25,4 +25,13 @@ else
 fi
 AC_SUBST(TERMCAP)
 
+# We prefer the in-tree readline.  Top-level dependencies make sure
+# src/readline (if it's there) is configured before src/sim.
+if test -r ../../readline/Makefile; then
+  READLINE=../../readline/libreadline.a
+else
+  AC_CHECK_LIB(readline, readline, READLINE=-lreadline,
+       AC_ERROR([the required "readline" library is missing]), $TERMCAP)
+fi
+AC_SUBST(READLINE)
 SIM_AC_OUTPUT

brgds, H-P