Skip to content

Commit 337da06

Browse files
committed
Assorted fixes for Cygwin:
Eliminate the mysterious games that the Cygwin build plays with the linker flag variables. DLLLIBS is gone, use SHLIB_LINK like everyone else. Detect cygipc in configure, after the linker flags are set up, otherwise configure might not work at all. Make sure everything is covered by make clean. Fix the build of the new conversion procedure modules. Add new DLLIMPORT markers where required. Finally, the compiler complains if we use an explicit -I/usr/local/include, so don't do that. Curiously, -L/usr/local/lib is still necessary.
1 parent a11ea5e commit 337da06

File tree

14 files changed

+45
-57
lines changed

14 files changed

+45
-57
lines changed

configure.in

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dnl Process this file with autoconf to produce a configure script.
2-
dnl $Header: /cvsroot/pgsql/configure.in,v 1.205 2002/09/04 22:54:18 petere Exp $
2+
dnl $Header: /cvsroot/pgsql/configure.in,v 1.206 2002/09/05 18:28:45 petere Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -614,6 +614,8 @@ AC_SEARCH_LIBS(crypt, crypt)
614614
AC_CHECK_LIB(bind, __inet_ntoa)
615615
# Solaris:
616616
AC_SEARCH_LIBS(fdatasync, [rt posix4])
617+
# Cygwin:
618+
AC_CHECK_LIB(cygipc, shmget)
617619

618620
if test "$with_readline" = yes; then
619621
PGAC_CHECK_READLINE

contrib/contrib-global.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Header: /cvsroot/pgsql/contrib/contrib-global.mk,v 1.2 2001/09/16 16:11:08 petere Exp $
1+
# $Header: /cvsroot/pgsql/contrib/contrib-global.mk,v 1.3 2002/09/05 18:28:45 petere Exp $
22

33
# This file contains generic rules to build many kinds of simple
44
# contrib modules. You only need to set a few variables and include
@@ -45,7 +45,7 @@ override CPPFLAGS := -I$(srcdir) $(CPPFLAGS)
4545

4646
ifdef MODULES
4747
override CFLAGS += $(CFLAGS_SL)
48-
override DLLLIBS := $(BE_DLLLIBS) $(DLLLIBS)
48+
SHLIB_LINK += $(BE_DLLLIBS)
4949
endif
5050

5151
ifdef PG_CPPFLAGS
@@ -61,7 +61,7 @@ SO_MAJOR_VERSION= 0
6161
SO_MINOR_VERSION= 0
6262
rpath =
6363

64-
override DLLLIBS := $(BE_DLLLIBS) $(DLLLIBS)
64+
SHLIB_LINK += $(BE_DLLLIBS)
6565

6666
include $(top_srcdir)/src/Makefile.shlib
6767

contrib/rserv/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ SCRIPTS = InitRservTest
1616

1717
override CPPFLAGS := -I$(srcdir) $(CPPFLAGS)
1818
override CFLAGS += $(CFLAGS_SL)
19-
override DLLLIBS := $(BE_DLLLIBS) $(DLLLIBS)
19+
SHLIB_LINK = $(BE_DLLLIBS)
2020

2121

2222
all: $(SQLS) $(TCLS) $(PERLS) $(SCRIPTS) $(SONAME)

src/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# Copyright (c) 1994, Regents of the University of California
66
#
7-
# $Header: /cvsroot/pgsql/src/Makefile,v 1.28 2002/09/04 15:45:50 tgl Exp $
7+
# $Header: /cvsroot/pgsql/src/Makefile,v 1.29 2002/09/05 18:28:45 petere Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -34,6 +34,7 @@ clean:
3434
$(MAKE) -C pl $@
3535
$(MAKE) -C test $@
3636
$(MAKE) -C tutorial $@
37+
$(MAKE) -C utils $@
3738

3839
distclean maintainer-clean:
3940
-$(MAKE) -C port $@
@@ -44,4 +45,5 @@ distclean maintainer-clean:
4445
-$(MAKE) -C pl $@
4546
-$(MAKE) -C test $@
4647
-$(MAKE) -C tutorial $@
48+
-$(MAKE) -C utils $@
4749
rm -f Makefile.port Makefile.global

src/Makefile.shlib

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Copyright (c) 1998, Regents of the University of California
77
#
88
# IDENTIFICATION
9-
# $Header: /cvsroot/pgsql/src/Makefile.shlib,v 1.63 2002/09/04 22:54:18 petere Exp $
9+
# $Header: /cvsroot/pgsql/src/Makefile.shlib,v 1.64 2002/09/05 18:28:46 petere Exp $
1010
#
1111
#-------------------------------------------------------------------------
1212

@@ -276,7 +276,7 @@ else # PORTNAME == win
276276
# WIN case
277277
$(shlib) lib$(NAME).a: $(OBJS) $(DLLINIT)
278278
$(DLLTOOL) --export-all --output-def $(NAME).def $(OBJS)
279-
$(DLLWRAP) -o $(shlib) --dllname $(shlib) --def $(NAME).def $(OBJS) $(DLLINIT) $(DLLLIBS) $(SHLIB_LINK)
279+
$(DLLWRAP) -o $(shlib) --dllname $(shlib) --def $(NAME).def $(OBJS) $(DLLINIT) $(SHLIB_LINK)
280280
$(DLLTOOL) --dllname $(shlib) --def $(NAME).def --output-lib lib$(NAME).a
281281

282282
$(DLLINIT): $(DLLINIT:%.o=%.c)
@@ -353,5 +353,5 @@ ifdef EXPSUFF
353353
endif
354354
endif
355355
ifeq ($(PORTNAME), win)
356-
rm -rf $(NAME).def
356+
rm -f $(NAME).dll $(NAME).def
357357
endif

src/backend/Makefile

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# Copyright (c) 1994, Regents of the University of California
66
#
7-
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.86 2002/09/04 15:45:50 tgl Exp $
7+
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.87 2002/09/05 18:28:46 petere Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -40,10 +40,16 @@ else # win
4040

4141
postgres: $(OBJS) $(DLLINIT) postgres.def libpostgres.a
4242
$(DLLTOOL) --dllname $@$(X) --output-exp $@.exp --def postgres.def
43-
$(CC) $(LDFLAGS) -o $@$(X) -Wl,--base-file,$@.base $@.exp $(OBJS) $(DLLLIBS)
43+
$(CC) $(CFLAGS) $(LDFLAGS) -o $@$(X) -Wl,--base-file,$@.base $@.exp $(OBJS) $(LIBS)
4444
$(DLLTOOL) --dllname $@$(X) --base-file $@.base --output-exp $@.exp --def postgres.def
45-
$(CC) $(LDFLAGS) -o $@$(X) $@.exp $(OBJS) $(DLLLIBS)
46-
rm $@.exp $@.base
45+
$(CC) $(CFLAGS) $(LDFLAGS) -o $@$(X) $@.exp $(OBJS) $(LIBS)
46+
rm -f $@.exp $@.base
47+
48+
postgres.def: $(OBJS)
49+
$(DLLTOOL) --export-all --output-def $@ $^
50+
51+
libpostgres.a: postgres.def
52+
$(DLLTOOL) --dllname postgres.exe --def postgres.def --output-lib $@
4753

4854
endif # win
4955

@@ -57,17 +63,6 @@ $(DIRS:%=%-recursive): $(top_builddir)/src/include/parser/parse.h $(top_builddir
5763
$(MAKE) -C $(subst -recursive,,$@) all
5864

5965

60-
ifeq ($(MAKE_DLL), true)
61-
62-
postgres.def: $(OBJS)
63-
$(DLLTOOL) --export-all --output-def $@ $(OBJS)
64-
65-
libpostgres.a: $(OBJS) $(DLLINIT) postgres.def
66-
$(DLLTOOL) --dllname postgres.exe --def postgres.def --output-lib $@
67-
68-
endif # MAKE_DLL
69-
70-
7166
$(DLLINIT): $(DLLINIT:%.o=%.c)
7267
$(MAKE) -C $(@D) $(@F)
7368

@@ -169,9 +164,7 @@ clean:
169164
$(top_srcdir)/src/include/parser/parse.h \
170165
$(top_builddir)/src/include/utils/fmgroids.h
171166
ifeq ($(PORTNAME), win)
172-
ifeq ($(MAKE_DLL), true)
173167
rm -f postgres.dll postgres.def libpostgres.a
174-
endif
175168
endif
176169
for i in $(DIRS); do $(MAKE) -C $$i clean || exit; done
177170

src/backend/utils/mb/conversion_procs/proc.mk

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
SRCS += $(NAME).c
22
OBJS += $(NAME).o
33

4-
PG_CPPFLAGS :=
54
SHLIB_LINK := $(BE_DLLLIBS)
65

76
SO_MAJOR_VERSION := 0
@@ -18,4 +17,4 @@ install: all
1817
uninstall: uninstall-lib
1918

2019
clean distclean maintainer-clean: clean-lib
21-
$(RM) $(OBJS)
20+
rm -f $(OBJS)

src/include/miscadmin.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
1313
* Portions Copyright (c) 1994, Regents of the University of California
1414
*
15-
* $Id: miscadmin.h,v 1.109 2002/09/04 20:31:36 momjian Exp $
15+
* $Id: miscadmin.h,v 1.110 2002/09/05 18:28:46 petere Exp $
1616
*
1717
* NOTES
1818
* some of the information in this file should be moved to
@@ -62,7 +62,7 @@
6262

6363
/* in globals.c */
6464
/* these are marked volatile because they are set by signal handlers: */
65-
extern volatile bool InterruptPending;
65+
extern DLLIMPORT volatile bool InterruptPending;
6666
extern volatile bool QueryCancelPending;
6767
extern volatile bool ProcDiePending;
6868

@@ -166,7 +166,7 @@ extern char DateFormat[];
166166

167167
extern bool enableFsync;
168168
extern bool allowSystemTableMods;
169-
extern int SortMem;
169+
extern DLLIMPORT int SortMem;
170170
extern int VacuumMem;
171171

172172
/*

src/makefiles/Makefile.win

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
# $Header: /cvsroot/pgsql/src/makefiles/Attic/Makefile.win,v 1.17 2002/07/27 20:10:05 petere Exp $
2-
LDFLAGS+= -g
1+
# $Header: /cvsroot/pgsql/src/makefiles/Attic/Makefile.win,v 1.18 2002/09/05 18:28:46 petere Exp $
32
DLLTOOL= dlltool
43
DLLWRAP= dllwrap
5-
DLLLIBS= -lcygipc -lcrypt
64
BE_DLLLIBS= -L$(top_builddir)/src/backend -lpostgres
75
DLLINIT = $(top_builddir)/src/utils/dllinit.o
8-
MK_NO_LORDER=true
9-
MAKE_DLL=true
10-
#MAKE_DLL=false
6+
117
# linking with -lm or -lc causes program to crash
128
# (see http://sources.redhat.com/cygwin/faq/faq.html#SEC110)
139
LIBS:=$(filter-out -lm -lc, $(LIBS))
@@ -18,22 +14,21 @@ CFLAGS_SL =
1814

1915
%.dll: %.o
2016
$(DLLTOOL) --export-all --output-def $*.def $<
21-
$(DLLWRAP) -o $@ --def $*.def $< $(DLLINIT) $(DLLLIBS)
17+
$(DLLWRAP) -o $@ --def $*.def $< $(DLLINIT) $(SHLIB_LINK)
2218
rm -f $*.def
2319

24-
ifeq ($(findstring backend,$(subdir)), backend)
25-
override CPPFLAGS+= -DBUILDING_DLL=1
20+
ifneq (,$(findstring backend,$(subdir)))
21+
ifeq (,$(findstring conversion_procs,$(subdir)))
22+
override CPPFLAGS+= -DBUILDING_DLL
2623
endif
27-
28-
ifeq ($(findstring ecpg/lib,$(subdir)), ecpg/lib)
29-
override CPPFLAGS+= -DBUILDING_DLL=1
3024
endif
3125

32-
ifeq ($(findstring interfaces/libpq++,$(subdir)), interfaces/libpq++)
33-
override CPPFLAGS+= -DBUILDING_DLL=1
26+
ifneq (,$(findstring ecpg/lib,$(subdir)))
27+
override CPPFLAGS+= -DBUILDING_DLL
3428
endif
3529

36-
ifeq ($(findstring src/pl/plpython,$(subdir)), src/pl/plpython)
30+
# required by Python headers
31+
ifneq (,$(findstring src/pl/plpython,$(subdir)))
3732
override CPPFLAGS+= -DUSE_DL_IMPORT
3833
endif
3934

src/pl/plpgsql/src/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# Makefile for the plpgsql shared object
44
#
5-
# $Header: /cvsroot/pgsql/src/pl/plpgsql/src/Makefile,v 1.21 2002/08/30 00:28:41 tgl Exp $
5+
# $Header: /cvsroot/pgsql/src/pl/plpgsql/src/Makefile,v 1.22 2002/09/05 18:28:46 petere Exp $
66
#
77
#-------------------------------------------------------------------------
88

@@ -20,7 +20,7 @@ SO_MAJOR_VERSION= 1
2020
SO_MINOR_VERSION= 0
2121

2222
override CPPFLAGS := -I$(srcdir) $(CPPFLAGS)
23-
override DLLLIBS := $(BE_DLLLIBS) $(DLLLIBS)
23+
SHLIB_LINK = $(BE_DLLLIBS)
2424
rpath :=
2525

2626
OBJS = pl_gram.o pl_scan.o pl_handler.o pl_comp.o pl_exec.o pl_funcs.o

src/pl/plpython/Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Header: /cvsroot/pgsql/src/pl/plpython/Makefile,v 1.10 2001/09/16 16:11:11 petere Exp $
1+
# $Header: /cvsroot/pgsql/src/pl/plpython/Makefile,v 1.11 2002/09/05 18:28:46 petere Exp $
22

33
subdir = src/pl/plpython
44
top_builddir = ../../..
@@ -17,15 +17,14 @@ endif
1717
ifneq (,$(findstring yes, $(shared_libpython)$(allow_nonpic_in_shlib)))
1818

1919
override CPPFLAGS := -I$(srcdir) $(python_includespec) $(CPPFLAGS)
20-
override DLLLIBS := $(BE_DLLLIBS) $(DLLLIBS)
2120
rpath :=
2221

2322
NAME = plpython
2423
SO_MAJOR_VERSION = 0
2524
SO_MINOR_VERSION = 0
2625
OBJS = plpython.o
2726

28-
SHLIB_LINK += $(python_libspec)
27+
SHLIB_LINK = $(BE_DLLLIBS) $(python_libspec)
2928

3029
include $(top_srcdir)/src/Makefile.shlib
3130

src/template/win

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
CFLAGS=-O2
2-
SRCH_INC=/usr/local/include
32
SRCH_LIB=/usr/local/lib
4-
LIBS=-lcygipc

src/test/regress/GNUmakefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
#
99
# IDENTIFICATION
10-
# $Header: /cvsroot/pgsql/src/test/regress/GNUmakefile,v 1.39 2002/09/03 21:45:44 petere Exp $
10+
# $Header: /cvsroot/pgsql/src/test/regress/GNUmakefile,v 1.40 2002/09/05 18:28:46 petere Exp $
1111
#
1212
#-------------------------------------------------------------------------
1313

@@ -20,7 +20,7 @@ contribdir := $(top_builddir)/contrib
2020
override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS)
2121
override CFLAGS += $(CFLAGS_SL)
2222

23-
override DLLLIBS := $(BE_DLLLIBS) $(DLLLIBS)
23+
SHLIB_LINK = $(BE_DLLLIBS)
2424

2525
# default encoding
2626
MULTIBYTE = SQL_ASCII

src/tutorial/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Makefile for tutorial
55
#
66
# IDENTIFICATION
7-
# $Header: /cvsroot/pgsql/src/tutorial/Makefile,v 1.15 2002/07/30 17:47:58 tgl Exp $
7+
# $Header: /cvsroot/pgsql/src/tutorial/Makefile,v 1.16 2002/09/05 18:28:46 petere Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -13,7 +13,7 @@ top_builddir = ../..
1313
include $(top_builddir)/src/Makefile.global
1414

1515
override CFLAGS+= $(CFLAGS_SL)
16-
override DLLLIBS := $(BE_DLLLIBS) $(DLLLIBS)
16+
SHLIB_LINK = $(BE_DLLLIBS)
1717

1818
#
1919
# DLOBJS are the dynamically-loaded object files. The "funcs" queries

0 commit comments

Comments
 (0)