From 2f2d05763d1c55c7998c0d7030659e3db6f60183 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Fri, 24 May 2002 18:10:17 +0000 Subject: [PATCH] Change PL/Tcl build to use configured compiler and Makefile.shlib system, not Tcl-provided one. Make sure export file, if any, is cleaned. Tcl configuration is now read directly in configure and recorded in Makefile.global. This eliminates some duplicate efforts and allows for easier hand-editing of the results, if necessary. --- config/tcl.m4 | 15 ++++++- configure | 21 +++++++++- configure.in | 12 ++++-- src/Makefile.global.in | 15 +++++-- src/Makefile.shlib | 7 +++- src/bin/pgtclsh/Makefile | 20 +--------- src/bin/pgtclsh/mkMakefile.tcldefs.sh | 23 ----------- src/bin/pgtclsh/mkMakefile.tkdefs.sh | 23 ----------- src/pl/tcl/Makefile | 73 +++++++++-------------------------- src/pl/tcl/mkMakefile.tcldefs.sh | 28 -------------- 10 files changed, 80 insertions(+), 157 deletions(-) delete mode 100644 src/bin/pgtclsh/mkMakefile.tcldefs.sh delete mode 100644 src/bin/pgtclsh/mkMakefile.tkdefs.sh delete mode 100644 src/pl/tcl/mkMakefile.tcldefs.sh diff --git a/config/tcl.m4 b/config/tcl.m4 index 1470b8122b..d3407c924f 100644 --- a/config/tcl.m4 +++ b/config/tcl.m4 @@ -1,4 +1,4 @@ -# $Header: /cvsroot/pgsql/config/tcl.m4,v 1.3 2002/03/29 17:32:54 petere Exp $ +# $Header: /cvsroot/pgsql/config/tcl.m4,v 1.4 2002/05/24 18:10:17 petere Exp $ # Autoconf macros to check for Tcl related things @@ -74,3 +74,16 @@ fi AC_SUBST([TK_CONFIG_SH]) ])# PGAC_PATH_TKCONFIGSH + + +# PGAC_EVAL_TCLCONFIGSH(FILE, WANTED-VARS) +# ---------------------------------------- +# Assigns variables listed in WANTED-VARS by reading FILE and +# evaluating it according to the quoting scheme of tclConfig.sh and +# tkConfig.sh. Calls AC_SUBST for each variable. + +AC_DEFUN([PGAC_EVAL_TCLCONFIGSH], +[. "$1" +m4_foreach([pgac_item], [$2], +[eval pgac_item=\"[$]pgac_item\" +AC_SUBST(pgac_item)])]) diff --git a/configure b/configure index 9389f7c8a5..28048bde4f 100755 --- a/configure +++ b/configure @@ -16405,7 +16405,13 @@ fi -fi + . "$TCL_CONFIG_SH" +eval TCL_LIB_FILE=\"$TCL_LIB_FILE\" +eval TCL_LIBS=\"$TCL_LIBS\" +eval TCL_LIB_SPEC=\"$TCL_LIB_SPEC\" +eval TCL_SHARED_BUILD=\"$TCL_SHARED_BUILD\" + + fi # Check for Tk configuration script tkConfig.sh if test "$with_tk" = yes; then @@ -16444,6 +16450,11 @@ fi + . "$TK_CONFIG_SH" +eval TK_LIBS=\"$TK_LIBS\" +eval TK_LIB_SPEC=\"$TK_LIB_SPEC\" +eval TK_XINCLUDES=\"$TK_XINCLUDES\" + fi @@ -17435,7 +17446,15 @@ s,@XGETTEXT@,$XGETTEXT,;t t s,@localedir@,$localedir,;t t s,@TCLSH@,$TCLSH,;t t s,@TCL_CONFIG_SH@,$TCL_CONFIG_SH,;t t +s,@TCL_LIB_FILE@,$TCL_LIB_FILE,;t t +s,@TCL_LIBS@,$TCL_LIBS,;t t +s,@TCL_LIB_SPEC@,$TCL_LIB_SPEC,;t t +s,@TCL_SHARED_BUILD@,$TCL_SHARED_BUILD,;t t +s,@TCL_SHLIB_LD_LIBS@,$TCL_SHLIB_LD_LIBS,;t t s,@TK_CONFIG_SH@,$TK_CONFIG_SH,;t t +s,@TK_LIBS@,$TK_LIBS,;t t +s,@TK_LIB_SPEC@,$TK_LIB_SPEC,;t t +s,@TK_XINCLUDES@,$TK_XINCLUDES,;t t s,@NSGMLS@,$NSGMLS,;t t s,@JADE@,$JADE,;t t s,@have_docbook@,$have_docbook,;t t diff --git a/configure.in b/configure.in index 342bf851e7..b07667db3f 100644 --- a/configure.in +++ b/configure.in @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. -dnl $Header: /cvsroot/pgsql/configure.in,v 1.184 2002/05/05 00:03:28 tgl Exp $ - +dnl $Header: /cvsroot/pgsql/configure.in,v 1.185 2002/05/24 18:10:17 petere Exp $ +dnl dnl Developers, please strive to achieve this order: dnl dnl 0. Initialization and options processing @@ -14,7 +14,9 @@ dnl 7. Functions, global variables dnl 8. System services dnl dnl Read the Autoconf manual for details. - +dnl +m4_pattern_forbid(^PGAC_)dnl to catch undefined macros +dnl dnl The GNU folks apparently haven't heard that some people don't use dnl Texinfo. Use this sorcery to use "docdir" instead of "infodir". m4_define([info], [doc]) @@ -1201,11 +1203,15 @@ fi # Check for Tcl configuration script tclConfig.sh if test "$with_tcl" = yes; then PGAC_PATH_TCLCONFIGSH([$with_tclconfig]) + PGAC_EVAL_TCLCONFIGSH([$TCL_CONFIG_SH], + [TCL_LIB_FILE,TCL_LIBS,TCL_LIB_SPEC,TCL_SHARED_BUILD]) + AC_SUBST(TCL_SHLIB_LD_LIBS)dnl don't want to double-evaluate that one fi # Check for Tk configuration script tkConfig.sh if test "$with_tk" = yes; then PGAC_PATH_TKCONFIGSH([$with_tkconfig $with_tclconfig]) + PGAC_EVAL_TCLCONFIGSH([$TK_CONFIG_SH], [TK_LIBS,TK_LIB_SPEC,TK_XINCLUDES]) fi diff --git a/src/Makefile.global.in b/src/Makefile.global.in index 0a713bfe99..b6bec695fd 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in @@ -1,5 +1,5 @@ # -*-makefile-*- -# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.146 2002/04/14 17:23:20 petere Exp $ +# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.147 2002/05/24 18:10:17 petere Exp $ #------------------------------------------------------------------------------ # All PostgreSQL makefiles include this file and use the variables it sets, @@ -147,9 +147,16 @@ python_configdir = @python_configdir@ krb_srvtab = @krb_srvtab@ -TCL_CONFIG_SH = @TCL_CONFIG_SH@ -TK_CONFIG_SH = @TK_CONFIG_SH@ -TCLSH = @TCLSH@ +TCLSH = @TCLSH@ +TCL_LIB_FILE = @TCL_LIB_FILE@ +TCL_LIBS = @TCL_LIBS@ +TCL_LIB_SPEC = @TCL_LIB_SPEC@ +TCL_SHARED_BUILD = @TCL_SHARED_BUILD@ +TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ + +TK_LIBS = @TK_LIBS@ +TK_LIB_SPEC = @TK_LIB_SPEC@ +TK_XINCLUDES = @TK_XINCLUDES@ have_docbook = @have_docbook@ DOCBOOKSTYLE = @DOCBOOKSTYLE@ diff --git a/src/Makefile.shlib b/src/Makefile.shlib index 9a4ee4b50e..06e0060df0 100644 --- a/src/Makefile.shlib +++ b/src/Makefile.shlib @@ -6,7 +6,7 @@ # Copyright (c) 1998, Regents of the University of California # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/Makefile.shlib,v 1.57 2002/04/10 16:45:25 petere Exp $ +# $Header: /cvsroot/pgsql/src/Makefile.shlib,v 1.58 2002/05/24 18:10:17 petere Exp $ # #------------------------------------------------------------------------- @@ -400,7 +400,10 @@ endif # enable_shared clean-lib: rm -f lib$(NAME).a ifeq ($(enable_shared), yes) - rm -f $(shlib) lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION) lib$(NAME)$(DLSUFFIX) + rm -f lib$(NAME)$(DLSUFFIX) lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION) lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION) +ifdef EXPSUFF + rm -f lib$(NAME)$(EXPSUFF) +endif endif ifeq ($(PORTNAME), win) rm -rf $(NAME).def diff --git a/src/bin/pgtclsh/Makefile b/src/bin/pgtclsh/Makefile index ea6dfb1ae2..6fbeed74ec 100644 --- a/src/bin/pgtclsh/Makefile +++ b/src/bin/pgtclsh/Makefile @@ -6,7 +6,7 @@ # Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group # Portions Copyright (c) 1994, Regents of the University of California # -# $Header: /cvsroot/pgsql/src/bin/pgtclsh/Attic/Makefile,v 1.37 2001/02/20 19:20:29 petere Exp $ +# $Header: /cvsroot/pgsql/src/bin/pgtclsh/Attic/Makefile,v 1.38 2002/05/24 18:10:17 petere Exp $ # #------------------------------------------------------------------------- @@ -14,13 +14,6 @@ subdir = src/bin/pgtclsh top_builddir = ../../.. include $(top_builddir)/src/Makefile.global -# -# Include definitions from the tclConfig.sh file -# --include Makefile.tcldefs -ifeq ($(with_tk), yes) --include Makefile.tkdefs -endif libpgtcl_srcdir = $(top_srcdir)/src/interfaces/libpgtcl libpgtcl_builddir = $(top_builddir)/src/interfaces/libpgtcl @@ -61,14 +54,5 @@ installdirs: uninstall: rm -f $(DESTDIR)$(bindir)/pgtclsh $(DESTDIR)$(bindir)/pgtksh -Makefile.tcldefs: mkMakefile.tcldefs.sh - $(SHELL) $< '$(TCL_CONFIG_SH)' '$@' - -Makefile.tkdefs: mkMakefile.tkdefs.sh - $(SHELL) $< '$(TK_CONFIG_SH)' '$@' - clean distclean maintainer-clean: - rm -f pgtclAppInit.o pgtkAppInit.o Makefile.tcldefs Makefile.tkdefs pgtclsh pgtksh - -dep depend: - $(CC) -MM $(CFLAGS) *.c > depend + rm -f pgtclAppInit.o pgtkAppInit.o pgtclsh pgtksh diff --git a/src/bin/pgtclsh/mkMakefile.tcldefs.sh b/src/bin/pgtclsh/mkMakefile.tcldefs.sh deleted file mode 100644 index f9faef2fdc..0000000000 --- a/src/bin/pgtclsh/mkMakefile.tcldefs.sh +++ /dev/null @@ -1,23 +0,0 @@ -#! /bin/sh - -# $1 = path to tclConfig.sh ; $2 = output file - -if test x"$1" = x ; then - echo "$0: No tclConfig.sh file specified. Did you use \`configure --with-tcl'?" 1>&2 - exit 1 -fi - -# Source the file to obtain the correctly expanded variable definitions -. "$1" - -# Read the file a second time as an easy way of getting the list of variable -# definitions to output. -cat "$1" | - egrep '^TCL_|^TK_' | - sed 's/^\([^=]*\)=.*$/\1/' | - while read var - do - eval echo "\"$var = \$$var\"" - done > "$2" - -exit 0 diff --git a/src/bin/pgtclsh/mkMakefile.tkdefs.sh b/src/bin/pgtclsh/mkMakefile.tkdefs.sh deleted file mode 100644 index c34f166a52..0000000000 --- a/src/bin/pgtclsh/mkMakefile.tkdefs.sh +++ /dev/null @@ -1,23 +0,0 @@ -#! /bin/sh - -# $1 = path to tkConfig.sh ; $2 = output file - -if test x"$1" = x; then - echo "$0: No tkConfig.sh file specified. Did you use \`configure --with-tcl --with-x'?" 1>&2 - exit 1 -fi - -# Source the file to obtain the correctly expanded variable definitions -. "$1" - -# Read the file a second time as an easy way of getting the list of variable -# definitions to output. -cat "$1" | - egrep '^TCL_|^TK_' | - sed 's/^\([^=]*\)=.*$/\1/' | - while read var - do - eval echo "\"$var = \$$var\"" - done > "$2" - -exit 0 diff --git a/src/pl/tcl/Makefile b/src/pl/tcl/Makefile index 5a9ae266d0..43f420c7e1 100644 --- a/src/pl/tcl/Makefile +++ b/src/pl/tcl/Makefile @@ -2,7 +2,7 @@ # # Makefile for the pltcl shared object # -# $Header: /cvsroot/pgsql/src/pl/tcl/Makefile,v 1.37 2002/01/23 18:45:41 tgl Exp $ +# $Header: /cvsroot/pgsql/src/pl/tcl/Makefile,v 1.38 2002/05/24 18:10:17 petere Exp $ # #------------------------------------------------------------------------- @@ -10,7 +10,6 @@ subdir = src/pl/tcl top_builddir = ../../.. include $(top_builddir)/src/Makefile.global --include Makefile.tcldefs # Find out whether Tcl was built as a shared library --- if not, we # can't link a shared library that depends on it, and have to forget @@ -27,71 +26,39 @@ endif endif -# Change following to how shared library that contains references to -# libtcl must get built on your system. Since these definitions come -# from the tclConfig.sh script, they should work if the shared build -# of tcl was successful on this system. However, tclConfig.sh lies to -# us a little bit (at least in versions 7.6 through 8.0.4) --- it -# doesn't mention -lc in TCL_LIBS, but you still need it on systems -# that want to hear about dependent libraries... +# The following attempts to figure out what libraries need to be +# linked with pltcl. The information comes from the tclConfig.sh +# file, but it's mostly bogus. This just might work. ifneq ($(TCL_SHLIB_LD_LIBS),) # link command for a shared lib must mention shared libs it uses -SHLIB_EXTRA_LIBS=$(TCL_LIBS) -lc +SHLIB_LINK = $(TCL_LIB_SPEC) $(TCL_LIBS) -lc else ifeq ($(PORTNAME), hpux) # link command for a shared lib must mention shared libs it uses, # even though Tcl doesn't think so... -SHLIB_EXTRA_LIBS=$(TCL_LIBS) -lc +SHLIB_LINK = $(TCL_LIB_SPEC) $(TCL_LIBS) -lc else # link command for a shared lib must NOT mention shared libs it uses -SHLIB_EXTRA_LIBS= +SHLIB_LINK = $(TCL_LIB_SPEC) endif endif -%$(TCL_SHLIB_SUFFIX): %.o - $(TCL_SHLIB_LD) -o $@ $< $(TCL_LIB_SPEC) $(SHLIB_EXTRA_LIBS) +NAME = pltcl +SO_MAJOR_VERSION = 2 +SO_MINOR_VERSION = 0 +OBJS = pltcl.o -CC = $(TCL_CC) - -# Since we are using Tcl's choice of C compiler, which might not be -# the same one selected for Postgres, do NOT use CFLAGS from -# Makefile.global. Instead use TCL's CFLAGS plus necessary -I -# directives. - -# Can choose either TCL_CFLAGS_OPTIMIZE or TCL_CFLAGS_DEBUG here, as -# needed -override CPPFLAGS += $(TCL_DEFS) -override CFLAGS = $(TCL_CFLAGS_OPTIMIZE) $(TCL_SHLIB_CFLAGS) - - -# -# DLOBJS is the dynamically-loaded object file. -# -DLOBJS= pltcl$(DLSUFFIX) - -INFILES= $(DLOBJS) - -# -# plus exports files -# -ifdef EXPSUFF -INFILES+= $(DLOBJS:.o=$(EXPSUFF)) -endif - - -# Provide dummy targets for the case where we can't build the shared library. +include $(top_srcdir)/src/Makefile.shlib ifeq ($(TCL_SHARED_BUILD), 1) -all: $(INFILES) +all: all-lib $(MAKE) -C modules $@ -pltcl$(DLSUFFIX): pltcl.o - install: all installdirs - $(INSTALL_SHLIB) $(DLOBJS) $(DESTDIR)$(pkglibdir)/$(DLOBJS) + $(INSTALL_SHLIB) $(shlib) $(DESTDIR)$(pkglibdir)/$(NAME)$(DLSUFFIX) $(MAKE) -C modules $@ installdirs: @@ -99,21 +66,19 @@ installdirs: $(MAKE) -C modules $@ uninstall: - rm -f $(DESTDIR)$(pkglibdir)/$(DLOBJS) + rm -f $(DESTDIR)$(pkglibdir)/$(NAME)$(DLSUFFIX) $(MAKE) -C modules $@ else # TCL_SHARED_BUILD = 0 -all install: +# Provide dummy targets for the case where we can't build the shared library. +all: @echo "*****"; \ echo "* Cannot build pltcl because Tcl is not a shared library; skipping it."; \ echo "*****" endif # TCL_SHARED_BUILD = 0 -Makefile.tcldefs: mkMakefile.tcldefs.sh - $(SHELL) $< '$(TCL_CONFIG_SH)' '$@' - -clean distclean maintainer-clean: - rm -f $(INFILES) pltcl.o Makefile.tcldefs +clean distclean maintainer-clean: clean-lib + rm -f $(OBJS) $(MAKE) -C modules $@ diff --git a/src/pl/tcl/mkMakefile.tcldefs.sh b/src/pl/tcl/mkMakefile.tcldefs.sh deleted file mode 100644 index 04d09b7290..0000000000 --- a/src/pl/tcl/mkMakefile.tcldefs.sh +++ /dev/null @@ -1,28 +0,0 @@ -#! /bin/sh - -# $1 = path to tclConfig.sh ; $2 = output file - -# $Header: /cvsroot/pgsql/src/pl/tcl/Attic/mkMakefile.tcldefs.sh,v 1.2 2002/01/23 18:45:41 tgl Exp $ - -if test x"$1" = x ; then - echo "$0: No tclConfig.sh file specified. Did you use \`configure --with-tcl'?" 1>&2 - exit 1 -fi - -# Source the file to obtain the correctly expanded variable definitions -. "$1" - -# Suppress bogus soname switch that RedHat RPMs put into tclConfig.sh -TCL_SHLIB_LD=`echo "$TCL_SHLIB_LD" | sed 's/-Wl,-soname[^ ]*//'` - -# Read the file a second time as an easy way of getting the list of variable -# definitions to output. -cat "$1" | - egrep '^TCL_|^TK_' | - sed 's/^\([^=]*\)=.*$/\1/' | - while read var - do - eval echo "\"$var = \$$var\"" - done > "$2" - -exit 0 -- 2.11.0