$NetBSD: patch-ae,v 1.4 1999/07/13 00:56:13 jlam Exp $

--- Makefile.in.orig	Thu Feb 18 12:24:11 1999
+++ Makefile.in	Tue Jul  6 13:18:52 1999
@@ -67,11 +67,11 @@
 
 .c.o:
 	${RM} $@
-	$(CC) -c $(CCFLAGS) $<
+	${LIBTOOL} --mode=compile $(CC) -c $(CCFLAGS) $<
 
 # The name of the main library target.
-LIBRARY_NAME = libreadline.a
-STATIC_LIBS = libreadline.a libhistory.a
+LIBRARY_NAME = libreadline.la
+STATIC_LIBS = libreadline.la libhistory.la
 
 # The C code source files for this library.
 CSOURCES = $(srcdir)/readline.c $(srcdir)/funmap.c $(srcdir)/keymaps.c \
@@ -117,18 +117,16 @@
 
 static: $(STATIC_LIBS)
 
-libreadline.a: $(OBJECTS)
+libreadline.la: $(OBJECTS)
 	$(RM) $@
-	$(AR) $(ARFLAGS) $@ $(OBJECTS)
-	-test -n "$(RANLIB)" && $(RANLIB) $@
+	${LIBTOOL} --mode=link cc -o $@ ${OBJECTS:.o=.lo} -rpath ${PREFIX}/lib -version-info ${READLINE_MAJOR}:${READLINE_MINOR}
 
-libhistory.a: $(HISTOBJ) xmalloc.o
+libhistory.la: $(HISTOBJ) xmalloc.o
 	$(RM) $@
-	$(AR) $(ARFLAGS) $@ $(HISTOBJ) xmalloc.o
-	-test -n "$(RANLIB)" && $(RANLIB) $@
+	${LIBTOOL} --mode=link cc -o $@ ${HISTOBJ:.o=.lo} xmalloc.lo -rpath ${PREFIX}/lib -version-info ${READLINE_MAJOR}:${READLINE_MINOR}
 
-readline: $(OBJECTS) readline.h rldefs.h chardefs.h
-	$(CC) $(CCFLAGS) -o $@ ./examples/rl.c ./libreadline.a -ltermcap
+readline: libreadline.la readline.h rldefs.h chardefs.h
+	${LIBTOOL} --mode=link $(CC) $(CCFLAGS) ${LDFLAGS} -o $@ ./examples/rl.c libreadline.la -ltermcap
 
 Makefile makefile: config.status $(srcdir)/Makefile.in
 	CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
@@ -169,12 +167,8 @@
 	for f in ${INSTALLED_HEADERS}; do \
 		$(INSTALL_DATA) $(srcdir)/$$f $(includedir)/readline ; \
 	done
-	-$(MV) $(libdir)/libreadline.a $(libdir)/libreadline.old
-	$(INSTALL_DATA) libreadline.a $(libdir)/libreadline.a
-	-test -n "$(RANLIB)" && $(RANLIB) -t $(libdir)/libreadline.a
-	-$(MV) $(libdir)/libhistory.a $(libdir)/libhistory.old
-	$(INSTALL_DATA) libhistory.a $(libdir)/libhistory.a
-	-test -n "$(RANLIB)" && $(RANLIB) -t $(libdir)/libhistory.a
+	${LIBTOOL} --mode=install ${INSTALL_DATA} libreadline.la ${libdir}
+	${LIBTOOL} --mode=install ${INSTALL_DATA} libhistory.la ${libdir}
 	-( if test -d doc ; then \
 		cd doc && \
 		${MAKE} ${MFLAGS} infodir=$(infodir) $@; \
