From: Marc G. Fournier Date: Sat, 25 Jan 1997 22:52:08 +0000 (+0000) Subject: Okay, this should pretty much clean up the psql/readline/history mess. X-Git-Tag: REL9_0_0~29326 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=aa46d53fa41a073e138acf906bb25d311c575b6b;p=pg-rex%2Fsyncrep.git Okay, this should pretty much clean up the psql/readline/history mess. Added a README.readline file until configure is integrated to *try* and explain the way things stand. Removed a stray configure .in file --- diff --git a/src/README.readline b/src/README.readline new file mode 100644 index 0000000000..9cacd37078 --- /dev/null +++ b/src/README.readline @@ -0,0 +1,38 @@ + +In preparation for using configure to compile PostgreSQL, various +define cleanups have been performed. + +The most confusing has been psql's use of -lreadline + +In order to turn on support for readline, your Makefile.custom file +*must* contain lines similar to: + +USE_READLINE= yes +READLINE_INC= +READLINE_LIB= + + +READLINE_INC can contain: + + -DHAVE_LIBREADLINE + not optional if USE_READLINE enabled + -DHAVE_READLINE_H + if , define this + -DHAVE_HISTORY + if you have either or + -DHAVE_LIBHISTORY + if you have a libhistory.a + +READLINE_LIB can contain: + + -lreadline + not optional if USE_READLINE enabled + -lhistory + if you have a libhistory.a + + +Once support for configure is integrated into the distribution, this will +all be hidden "behind the scenes" + +Marc G. Fournier +scrappy@hub.org diff --git a/src/bin/psql/Makefile b/src/bin/psql/Makefile index 8b13ae457d..c0fc92ed5b 100644 --- a/src/bin/psql/Makefile +++ b/src/bin/psql/Makefile @@ -7,7 +7,7 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/psql/Makefile,v 1.17 1996/12/30 23:19:48 bryanh Exp $ +# $Header: /cvsroot/pgsql/src/bin/psql/Makefile,v 1.18 1997/01/25 22:51:26 scrappy Exp $ # #------------------------------------------------------------------------- @@ -19,46 +19,40 @@ INCLUDE_OPT:= \ -I../../include CFLAGS+= $(INCLUDE_OPT) -# + #USE_READLINE is set in Makefile.global # - ifeq ($(USE_READLINE), true) - CFLAGS+= $(READLINE_INC) $(HISTORY_INC) + CFLAGS+= $(READLINE_INC) - LD_ADD+= $(READLINE_LIB) $(HISTORY_LIB) $(CURSES_LIB) + LD_ADD+= $(READLINE_LIB) $(CURSES_LIB) ifeq ($(PORTNAME), ultrix4) - LD_ADD+= -ltermcap - else - ifeq ($(PORTNAME), sparc) - LD_ADD+= -ltermcap + LD_ADD+= -ltermcap else - ifeq ($(PORTNAME), linux) - LD_ADD+= -ltermcap - else - ifeq ($(PORTNAME), next) - LD_ADD+= -ltermcap - else - ifeq ($(PORTNAME), bsdi) - LD_ADD+= -ltermcap - else - ifeq ($(PORTNAME), BSD44_derived) - LD_ADD+= -ltermcap - endif - endif - endif - endif - endif + ifeq ($(PORTNAME), sparc) + LD_ADD+= -ltermcap + else + ifeq ($(PORTNAME), linux) + LD_ADD+= -ltermcap + else + ifeq ($(PORTNAME), next) + LD_ADD+= -ltermcap + else + ifeq ($(PORTNAME), bsdi) + LD_ADD+= -ltermcap + else + ifeq ($(PORTNAME), BSD44_derived) + LD_ADD+= -ltermcap + endif + endif + endif + endif + endif endif + OBJS= psql.o stringutils.o else - CFLAGS+= -DNOREADLINE -endif - -OBJS= psql.o stringutils.o - -ifneq ($(USE_READLINE), true) -OBJS+= rlstubs.o + OBJS= psql.o stringutils.o rlstubs.o endif ifeq ($(PORTNAME), ultrix4) diff --git a/src/bin/psql/Makefile.in b/src/bin/psql/Makefile.in deleted file mode 100644 index 57f4b89252..0000000000 --- a/src/bin/psql/Makefile.in +++ /dev/null @@ -1,60 +0,0 @@ -#------------------------------------------------------------------------- -# -# Makefile.inc-- -# Makefile for bin/psql -# -# Copyright (c) 1994, Regents of the University of California -# -# -# IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/psql/Attic/Makefile.in,v 1.1 1997/01/24 02:35:27 scrappy Exp $ -# -#------------------------------------------------------------------------- - -SRCDIR= ../.. -include ../../Makefile.global - -INCLUDE_OPT:= -I$(LIBPQDIR) \ - -I../../include - -CFLAGS+= $(INCLUDE_OPT) - -LD_ADD+= @READLINE_LIB@ @HISTORY_LIB@ @CURSES_LIB@ @TERMCAP_LIB@ - -OBJS= psql.o stringutils.o - -ifneq ($(USE_READLINE), true) -OBJS+= rlstubs.o -endif - -ifeq ($(PORTNAME), ultrix4) -OBJS+= ../../utils/strdup.o -endif - -all: submake psql - -psql: $(OBJS) $(LIBPQDIR)/libpq.a - $(CC) $(LDFLAGS) -o psql -L$(LIBPQDIR) $(OBJS) -lpq $(LD_ADD) - -../../utils/strdup.o: - $(MAKE) -C ../../utils strdup.o - -.PHONY: submake -submake: - $(MAKE) -C $(LIBPQDIR) libpq.a - -install: psql - $(INSTALL) $(INSTL_EXE_OPTS) psql $(DESTDIR)$(BINDIR)/psql - -depend dep: - $(CC) -MM $(INCLUDE_OPT) *.c >depend - -clean: - rm -f psql $(OBJS) - -ifeq (depend,$(wildcard depend)) -include depend -endif - - - diff --git a/src/bin/psql/psql.c b/src/bin/psql/psql.c index 8df0998c3e..0c6e19e65b 100644 --- a/src/bin/psql/psql.c +++ b/src/bin/psql/psql.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.52 1997/01/25 22:16:36 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.53 1997/01/25 22:51:56 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -35,12 +35,12 @@ #else # ifdef HAVE_READLINE_H # include -# ifndef NO_HISTORY +# if defined(HAVE_HISTORY) || defined(HAVE_LIBHISTORY) # include # endif # else # include -# ifndef NO_HISTORY +# if defined(HAVE_HISTORY) || defined(HAVE_LIBHISTORY) # include # endif # endif diff --git a/src/bin/psql/rlstubs.c b/src/bin/psql/rlstubs.c index 788757cadb..64c11dbe7b 100644 --- a/src/bin/psql/rlstubs.c +++ b/src/bin/psql/rlstubs.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/bin/psql/Attic/rlstubs.c,v 1.5 1996/11/11 14:55:47 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/bin/psql/Attic/rlstubs.c,v 1.6 1997/01/25 22:52:08 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -15,11 +15,6 @@ #include "rlstubs.h" -extern char *readline(const char *); -extern int write_history(const char *); -extern int using_history(void); -extern int add_history(const char *); - char * readline(const char *prompt) { diff --git a/src/include/config.h b/src/include/config.h index f34189efec..4fbeb1f82a 100644 --- a/src/include/config.h +++ b/src/include/config.h @@ -9,7 +9,8 @@ #define BLCKSZ 8192 /* Define to enable readline/history support in psql */ -/* #undef HAVE_LIBREADLINE */ +/* #undef HAVE_LIBREADLINE */ +/* #undef HAVE_LIBHISTORY */ /* These two defines are not used until HAVE_LIBREADLINE * are also defined @@ -20,19 +21,8 @@ /* Define one for either or */ -/* #undef HAVE_HISTORY_H */ -/* #undef HAVE_READLINE_HISTORY_H */ +/* #undef HAVE_HISTORY */ -/* this is meant to handle the condition where the system has readline - * capabilities, but no history. Unfortunately, it isn't as simple as - * testing for the existance of -lhistory, since newer -lreadline seems to - * include the -lhistory library, but newer readline.h doesn't - */ -#if defined(HAVE_LIBREADLINE) -# if !defined(HAVE_HISTORY_H) || !defined(HAVE_READLINE_HISTORY_H) -# define NO_HISTORY_H -# endif -#endif #define HAVE_SYS_SELECT_H #define HAVE_TERMIOS_H