From ad6bfe67bd234fec5f78ff274a830a9686645d30 Mon Sep 17 00:00:00 2001 From: "Marc G. Fournier" Date: Sun, 9 Feb 1997 03:23:52 +0000 Subject: [PATCH] Various fixes suggested by Gregor Hoffleit Add a check to configure for strdup Remove all the '-ltermcap' checks from psql/Makefile Have {psql,pg_dump}/Makefile modified if strdup doesn't exist on the system --- src/bin/pg_dump/{Makefile => Makefile.in} | 8 +-- src/bin/psql/Makefile | 87 ----------------------- src/bin/psql/Makefile.in | 50 +++++++++++++ src/configure | 78 ++++++++++++++++---- src/configure.in | 4 +- 5 files changed, 119 insertions(+), 108 deletions(-) rename src/bin/pg_dump/{Makefile => Makefile.in} (83%) delete mode 100644 src/bin/psql/Makefile create mode 100644 src/bin/psql/Makefile.in diff --git a/src/bin/pg_dump/Makefile b/src/bin/pg_dump/Makefile.in similarity index 83% rename from src/bin/pg_dump/Makefile rename to src/bin/pg_dump/Makefile.in index 26e1e9ca7f..2385a321b5 100644 --- a/src/bin/pg_dump/Makefile +++ b/src/bin/pg_dump/Makefile.in @@ -7,7 +7,7 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/pg_dump/Makefile,v 1.13 1997/02/06 02:31:05 momjian Exp $ +# $Header: /cvsroot/pgsql/src/bin/pg_dump/Attic/Makefile.in,v 1.1 1997/02/09 03:23:23 scrappy Exp $ # #------------------------------------------------------------------------- @@ -15,11 +15,7 @@ SRCDIR= ../.. include ../../Makefile.global include ../Makefile.global -OBJS= pg_dump.o common.o - -ifeq ($(PORTNAME), ultrix4) -OBJS+= ../../utils/strdup.o -endif +OBJS= pg_dump.o common.o @STRDUP@ all: submake pg_dump diff --git a/src/bin/psql/Makefile b/src/bin/psql/Makefile deleted file mode 100644 index c10b63925b..0000000000 --- a/src/bin/psql/Makefile +++ /dev/null @@ -1,87 +0,0 @@ -#------------------------------------------------------------------------- -# -# Makefile.inc-- -# Makefile for bin/psql -# -# Copyright (c) 1994, Regents of the University of California -# -# -# IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/psql/Makefile,v 1.19 1997/01/25 23:53:59 scrappy Exp $ -# -#------------------------------------------------------------------------- - -SRCDIR= ../.. -include ../../Makefile.global - -INCLUDE_OPT:= \ - -I$(LIBPQDIR) \ - -I../../include - -CFLAGS+= $(INCLUDE_OPT) - -#USE_READLINE is set in Makefile.global -# -ifeq ($(USE_READLINE), true) - CFLAGS+= $(READLINE_INC) - - LD_ADD+= $(READLINE_LIB) $(CURSES_LIB) - - ifeq ($(PORTNAME), ultrix4) - LD_ADD+= -ltermcap - else - 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 -endif - -OBJS= psql.o stringutils.o - -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/Makefile.in b/src/bin/psql/Makefile.in new file mode 100644 index 0000000000..8f8844c161 --- /dev/null +++ b/src/bin/psql/Makefile.in @@ -0,0 +1,50 @@ +#------------------------------------------------------------------------- +# +# 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.3 1997/02/09 03:23:52 scrappy Exp $ +# +#------------------------------------------------------------------------- + +SRCDIR= ../.. +include ../../Makefile.global + +INCLUDE_OPT:= -I$(LIBPQDIR) \ + -I../../include + +CFLAGS+= $(INCLUDE_OPT) + +OBJS= psql.o stringutils.o @STRDUP@ + +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/configure b/src/configure index 7dd3d644b5..639943dab2 100755 --- a/src/configure +++ b/src/configure @@ -3002,14 +3002,63 @@ else INET_ATON='inet_aton.o' fi +echo $ac_n "checking for strdup""... $ac_c" 1>&6 +echo "configure:3007: checking for strdup" >&5 +if eval "test \"`echo '$''{'ac_cv_func_strdup'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char strdup(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_strdup) || defined (__stub___strdup) +choke me +#else +strdup(); +#endif + +; return 0; } +EOF +if { (eval echo configure:3035: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_strdup=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_strdup=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'strdup`\" = yes"; then + echo "$ac_t""yes" 1>&6 + STRDUP='../../utils/strdup.o' +else + echo "$ac_t""no" 1>&6 +fi + + echo $ac_n "checking for cbrt""... $ac_c" 1>&6 -echo "configure:3008: checking for cbrt" >&5 +echo "configure:3057: checking for cbrt" >&5 if eval "test \"`echo '$''{'ac_cv_func_cbrt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3085: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_cbrt=yes" else @@ -3053,7 +3102,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for cbrt in -lm""... $ac_c" 1>&6 -echo "configure:3057: checking for cbrt in -lm" >&5 +echo "configure:3106: checking for cbrt in -lm" >&5 ac_lib_var=`echo m'_'cbrt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3061,7 +3110,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3125: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3098,12 +3147,12 @@ fi fi echo $ac_n "checking for rint""... $ac_c" 1>&6 -echo "configure:3102: checking for rint" >&5 +echo "configure:3151: checking for rint" >&5 if eval "test \"`echo '$''{'ac_cv_func_rint'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3179: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_rint=yes" else @@ -3147,7 +3196,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for rint in -lm""... $ac_c" 1>&6 -echo "configure:3151: checking for rint in -lm" >&5 +echo "configure:3200: checking for rint in -lm" >&5 ac_lib_var=`echo m'_'rint | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3155,7 +3204,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3219: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3292,7 +3341,7 @@ done ac_given_srcdir=$srcdir -trap 'rm -fr `echo "GNUmakefile Makefile.global backend/port/Makefile include/config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +trap 'rm -fr `echo "GNUmakefile Makefile.global backend/port/Makefile bin/psql/Makefile bin/pg_dump/Makefile include/config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then diff --git a/src/configure.in b/src/configure.in index 4d14bac442..8d69019a71 100644 --- a/src/configure.in +++ b/src/configure.in @@ -156,8 +156,10 @@ AC_TYPE_SIGNAL AC_FUNC_VPRINTF AC_CHECK_FUNCS(isinf tzset getrusage vfork memmove sigsetjmp kill sysconf) AC_CHECK_FUNC(inet_aton, AC_DEFINE(HAVE_INET_ATON), INET_ATON='inet_aton.o') +AC_CHECK_FUNC(strdup, STRDUP='../../utils/strdup.o') AC_SUBST(INET_ATON) +AC_SUBST(STRDUP) AC_CHECK_FUNC(cbrt, AC_DEFINE(HAVE_CBRT), AC_CHECK_LIB(m, cbrt, AC_DEFINE(HAVE_CBRT))) AC_CHECK_FUNC(rint, AC_DEFINE(HAVE_RINT), AC_CHECK_LIB(m, rint, AC_DEFINE(HAVE_RINT))) -AC_OUTPUT(GNUmakefile Makefile.global backend/port/Makefile) +AC_OUTPUT(GNUmakefile Makefile.global backend/port/Makefile bin/psql/Makefile bin/pg_dump/Makefile)