Skip to content

Commit f2ca34d

Browse files
committed
Add code to pltcl's Makefile to cope with the situation where
libtcl has been installed as a non-shared library. pltcl cannot be built in that situation; we want to do nothing and let the overall Postgres build complete, rather than failing.
1 parent 5f27ac6 commit f2ca34d

File tree

1 file changed

+46
-7
lines changed

1 file changed

+46
-7
lines changed

src/pl/tcl/Makefile

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Makefile for the pltcl shared object
55
#
66
# IDENTIFICATION
7-
# $Header: /cvsroot/pgsql/src/pl/tcl/Makefile,v 1.7 1998/10/13 16:30:49 momjian Exp $
7+
# $Header: /cvsroot/pgsql/src/pl/tcl/Makefile,v 1.8 1998/10/17 23:33:23 tgl Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -14,12 +14,30 @@
1414
SRCDIR= ../../../src
1515
include $(SRCDIR)/Makefile.global
1616

17-
1817
#
1918
# Include definitions from the tclConfig.sh file
19+
# NOTE: GNU make will make this file automatically if it doesn't exist,
20+
# using the make rule that appears below. Cute, eh?
2021
#
2122
include Makefile.tcldefs
2223

24+
#
25+
# Find out whether Tcl was built as a shared library --- if not,
26+
# we can't link a shared library that depends on it, and have to
27+
# forget about building pltcl.
28+
# In Tcl 8, tclConfig.sh sets TCL_SHARED_BUILD for us, but in
29+
# older Tcl releases it doesn't. In that case we guess based on
30+
# the name of the Tcl library.
31+
#
32+
ifndef TCL_SHARED_BUILD
33+
ifneq (,$(findstring $(DLSUFFIX),$(TCL_LIB_FILE)))
34+
TCL_SHARED_BUILD=1
35+
else
36+
TCL_SHARED_BUILD=0
37+
endif
38+
endif
39+
40+
2341
# Change following to how shared library that contain
2442
# correct references to libtcl must get built on your system.
2543
# Since these definitions come from the tclConfig.sh script,
@@ -62,22 +80,43 @@ ifdef EXPSUFF
6280
INFILES+= $(DLOBJS:.o=$(EXPSUFF))
6381
endif
6482

83+
84+
ifeq ($(TCL_SHARED_BUILD),1)
85+
6586
#
6687
# Build the shared lib
6788
#
6889
all: $(INFILES)
6990

70-
Makefile.tcldefs:
91+
install: all
92+
$(INSTALL) $(INSTL_LIB_OPTS) $(DLOBJS) $(LIBDIR)/$(DLOBJS)
93+
94+
else
95+
96+
#
97+
# Oops, can't build it
98+
#
99+
all:
100+
@echo "Cannot build pltcl because Tcl is not a shared library; skipping it."
101+
102+
install:
103+
@echo "Cannot build pltcl because Tcl is not a shared library; skipping it."
104+
105+
endif
106+
107+
#
108+
# Make targets that are still valid when we can't build pltcl
109+
# should be below here.
110+
#
111+
112+
Makefile.tcldefs: mkMakefile.tcldefs.sh
71113
/bin/sh mkMakefile.tcldefs.sh
72114

73115
#
74116
# Clean
75117
#
76118
clean:
77-
rm -f $(INFILES)
119+
rm -f $(INFILES) *.o
78120
rm -f Makefile.tcldefs
79121

80-
install: all
81-
$(INSTALL) $(INSTL_LIB_OPTS) $(DLOBJS) $(LIBDIR)/$(DLOBJS)
82-
83122
dep depend:

0 commit comments

Comments
 (0)