diff options
author | Peter Eisentraut | 2002-09-05 18:28:46 +0000 |
---|---|---|
committer | Peter Eisentraut | 2002-09-05 18:28:46 +0000 |
commit | cf24a1cde973f02386dcec223eb4312025bb7962 (patch) | |
tree | b90ab3878839728fdd2816e3ff4235e03de76187 | |
parent | a70e3092a0d667106feb117a418b379152a0f1a2 (diff) |
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.
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | contrib/contrib-global.mk | 4 | ||||
-rw-r--r-- | contrib/rserv/Makefile | 2 | ||||
-rw-r--r-- | src/Makefile | 2 | ||||
-rw-r--r-- | src/Makefile.shlib | 4 | ||||
-rw-r--r-- | src/backend/Makefile | 25 | ||||
-rw-r--r-- | src/backend/utils/mb/conversion_procs/proc.mk | 3 | ||||
-rw-r--r-- | src/include/miscadmin.h | 4 | ||||
-rw-r--r-- | src/makefiles/Makefile.win | 23 | ||||
-rw-r--r-- | src/pl/plpgsql/src/Makefile | 2 | ||||
-rw-r--r-- | src/pl/plpython/Makefile | 3 | ||||
-rw-r--r-- | src/template/win | 2 | ||||
-rw-r--r-- | src/test/regress/GNUmakefile | 2 | ||||
-rw-r--r-- | src/tutorial/Makefile | 2 |
14 files changed, 34 insertions, 46 deletions
diff --git a/configure.in b/configure.in index 60630038d9..0b11ef6781 100644 --- a/configure.in +++ b/configure.in @@ -614,6 +614,8 @@ AC_SEARCH_LIBS(crypt, crypt) AC_CHECK_LIB(bind, __inet_ntoa) # Solaris: AC_SEARCH_LIBS(fdatasync, [rt posix4]) +# Cygwin: +AC_CHECK_LIB(cygipc, shmget) if test "$with_readline" = yes; then PGAC_CHECK_READLINE diff --git a/contrib/contrib-global.mk b/contrib/contrib-global.mk index 17f03ae2b8..8f96f8f527 100644 --- a/contrib/contrib-global.mk +++ b/contrib/contrib-global.mk @@ -45,7 +45,7 @@ override CPPFLAGS := -I$(srcdir) $(CPPFLAGS) ifdef MODULES override CFLAGS += $(CFLAGS_SL) -override DLLLIBS := $(BE_DLLLIBS) $(DLLLIBS) +SHLIB_LINK += $(BE_DLLLIBS) endif ifdef PG_CPPFLAGS @@ -61,7 +61,7 @@ SO_MAJOR_VERSION= 0 SO_MINOR_VERSION= 0 rpath = -override DLLLIBS := $(BE_DLLLIBS) $(DLLLIBS) +SHLIB_LINK += $(BE_DLLLIBS) include $(top_srcdir)/src/Makefile.shlib diff --git a/contrib/rserv/Makefile b/contrib/rserv/Makefile index 2725119746..984a839415 100644 --- a/contrib/rserv/Makefile +++ b/contrib/rserv/Makefile @@ -16,7 +16,7 @@ SCRIPTS = InitRservTest override CPPFLAGS := -I$(srcdir) $(CPPFLAGS) override CFLAGS += $(CFLAGS_SL) -override DLLLIBS := $(BE_DLLLIBS) $(DLLLIBS) +SHLIB_LINK = $(BE_DLLLIBS) all: $(SQLS) $(TCLS) $(PERLS) $(SCRIPTS) $(SONAME) diff --git a/src/Makefile b/src/Makefile index d05ddac0b3..6d14e9ec6a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -34,6 +34,7 @@ clean: $(MAKE) -C pl $@ $(MAKE) -C test $@ $(MAKE) -C tutorial $@ + $(MAKE) -C utils $@ distclean maintainer-clean: -$(MAKE) -C port $@ @@ -44,4 +45,5 @@ distclean maintainer-clean: -$(MAKE) -C pl $@ -$(MAKE) -C test $@ -$(MAKE) -C tutorial $@ + -$(MAKE) -C utils $@ rm -f Makefile.port Makefile.global diff --git a/src/Makefile.shlib b/src/Makefile.shlib index d203f7d490..c4f35ebe9e 100644 --- a/src/Makefile.shlib +++ b/src/Makefile.shlib @@ -276,7 +276,7 @@ else # PORTNAME == win # WIN case $(shlib) lib$(NAME).a: $(OBJS) $(DLLINIT) $(DLLTOOL) --export-all --output-def $(NAME).def $(OBJS) - $(DLLWRAP) -o $(shlib) --dllname $(shlib) --def $(NAME).def $(OBJS) $(DLLINIT) $(DLLLIBS) $(SHLIB_LINK) + $(DLLWRAP) -o $(shlib) --dllname $(shlib) --def $(NAME).def $(OBJS) $(DLLINIT) $(SHLIB_LINK) $(DLLTOOL) --dllname $(shlib) --def $(NAME).def --output-lib lib$(NAME).a $(DLLINIT): $(DLLINIT:%.o=%.c) @@ -353,5 +353,5 @@ ifdef EXPSUFF endif endif ifeq ($(PORTNAME), win) - rm -rf $(NAME).def + rm -f $(NAME).dll $(NAME).def endif diff --git a/src/backend/Makefile b/src/backend/Makefile index 5a09f0043f..2fca0fac1c 100644 --- a/src/backend/Makefile +++ b/src/backend/Makefile @@ -40,10 +40,16 @@ else # win postgres: $(OBJS) $(DLLINIT) postgres.def libpostgres.a $(DLLTOOL) --dllname $@$(X) --output-exp [email protected] --def postgres.def - $(CC) $(LDFLAGS) -o $@$(X) -Wl,--base-file,[email protected] [email protected] $(OBJS) $(DLLLIBS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@$(X) -Wl,--base-file,[email protected] [email protected] $(OBJS) $(LIBS) $(DLLTOOL) --dllname $@$(X) --base-file [email protected] --output-exp [email protected] --def postgres.def - $(CC) $(LDFLAGS) -o $@$(X) [email protected] $(OBJS) $(DLLLIBS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@$(X) [email protected] $(OBJS) $(LIBS) + rm -f [email protected] [email protected] + +postgres.def: $(OBJS) + $(DLLTOOL) --export-all --output-def $@ $^ + +libpostgres.a: postgres.def + $(DLLTOOL) --dllname postgres.exe --def postgres.def --output-lib $@ endif # win @@ -57,17 +63,6 @@ $(DIRS:%=%-recursive): $(top_builddir)/src/include/parser/parse.h $(top_builddir $(MAKE) -C $(subst -recursive,,$@) all -ifeq ($(MAKE_DLL), true) - -postgres.def: $(OBJS) - $(DLLTOOL) --export-all --output-def $@ $(OBJS) - -libpostgres.a: $(OBJS) $(DLLINIT) postgres.def - $(DLLTOOL) --dllname postgres.exe --def postgres.def --output-lib $@ - -endif # MAKE_DLL - - $(DLLINIT): $(DLLINIT:%.o=%.c) $(MAKE) -C $(@D) $(@F) @@ -169,10 +164,8 @@ clean: $(top_srcdir)/src/include/parser/parse.h \ $(top_builddir)/src/include/utils/fmgroids.h ifeq ($(PORTNAME), win) -ifeq ($(MAKE_DLL), true) rm -f postgres.dll postgres.def libpostgres.a endif -endif for i in $(DIRS); do $(MAKE) -C $$i clean || exit; done distclean: clean diff --git a/src/backend/utils/mb/conversion_procs/proc.mk b/src/backend/utils/mb/conversion_procs/proc.mk index 8c9279e9aa..76fb55688a 100644 --- a/src/backend/utils/mb/conversion_procs/proc.mk +++ b/src/backend/utils/mb/conversion_procs/proc.mk @@ -1,7 +1,6 @@ SRCS += $(NAME).c OBJS += $(NAME).o -PG_CPPFLAGS := SHLIB_LINK := $(BE_DLLLIBS) SO_MAJOR_VERSION := 0 @@ -18,4 +17,4 @@ install: all uninstall: uninstall-lib clean distclean maintainer-clean: clean-lib - $(RM) $(OBJS) + rm -f $(OBJS) diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h index ecdc3e4c0b..2a1b51985f 100644 --- a/src/include/miscadmin.h +++ b/src/include/miscadmin.h @@ -62,7 +62,7 @@ /* in globals.c */ /* these are marked volatile because they are set by signal handlers: */ -extern volatile bool InterruptPending; +extern DLLIMPORT volatile bool InterruptPending; extern volatile bool QueryCancelPending; extern volatile bool ProcDiePending; @@ -166,7 +166,7 @@ extern char DateFormat[]; extern bool enableFsync; extern bool allowSystemTableMods; -extern int SortMem; +extern DLLIMPORT int SortMem; extern int VacuumMem; /* diff --git a/src/makefiles/Makefile.win b/src/makefiles/Makefile.win index 5733a164db..6966393bc5 100644 --- a/src/makefiles/Makefile.win +++ b/src/makefiles/Makefile.win @@ -1,13 +1,9 @@ # $Header$ -LDFLAGS+= -g DLLTOOL= dlltool DLLWRAP= dllwrap -DLLLIBS= -lcygipc -lcrypt BE_DLLLIBS= -L$(top_builddir)/src/backend -lpostgres DLLINIT = $(top_builddir)/src/utils/dllinit.o -MK_NO_LORDER=true -MAKE_DLL=true -#MAKE_DLL=false + # linking with -lm or -lc causes program to crash # (see http://sources.redhat.com/cygwin/faq/faq.html#SEC110) LIBS:=$(filter-out -lm -lc, $(LIBS)) @@ -18,22 +14,21 @@ CFLAGS_SL = %.dll: %.o $(DLLTOOL) --export-all --output-def $*.def $< - $(DLLWRAP) -o $@ --def $*.def $< $(DLLINIT) $(DLLLIBS) + $(DLLWRAP) -o $@ --def $*.def $< $(DLLINIT) $(SHLIB_LINK) rm -f $*.def -ifeq ($(findstring backend,$(subdir)), backend) -override CPPFLAGS+= -DBUILDING_DLL=1 +ifneq (,$(findstring backend,$(subdir))) +ifeq (,$(findstring conversion_procs,$(subdir))) +override CPPFLAGS+= -DBUILDING_DLL endif - -ifeq ($(findstring ecpg/lib,$(subdir)), ecpg/lib) -override CPPFLAGS+= -DBUILDING_DLL=1 endif -ifeq ($(findstring interfaces/libpq++,$(subdir)), interfaces/libpq++) -override CPPFLAGS+= -DBUILDING_DLL=1 +ifneq (,$(findstring ecpg/lib,$(subdir))) +override CPPFLAGS+= -DBUILDING_DLL endif -ifeq ($(findstring src/pl/plpython,$(subdir)), src/pl/plpython) +# required by Python headers +ifneq (,$(findstring src/pl/plpython,$(subdir))) override CPPFLAGS+= -DUSE_DL_IMPORT endif diff --git a/src/pl/plpgsql/src/Makefile b/src/pl/plpgsql/src/Makefile index dcb77a9d03..dadefb0629 100644 --- a/src/pl/plpgsql/src/Makefile +++ b/src/pl/plpgsql/src/Makefile @@ -20,7 +20,7 @@ SO_MAJOR_VERSION= 1 SO_MINOR_VERSION= 0 override CPPFLAGS := -I$(srcdir) $(CPPFLAGS) -override DLLLIBS := $(BE_DLLLIBS) $(DLLLIBS) +SHLIB_LINK = $(BE_DLLLIBS) rpath := OBJS = pl_gram.o pl_scan.o pl_handler.o pl_comp.o pl_exec.o pl_funcs.o diff --git a/src/pl/plpython/Makefile b/src/pl/plpython/Makefile index 47b60a59cf..cf2c492935 100644 --- a/src/pl/plpython/Makefile +++ b/src/pl/plpython/Makefile @@ -17,7 +17,6 @@ endif ifneq (,$(findstring yes, $(shared_libpython)$(allow_nonpic_in_shlib))) override CPPFLAGS := -I$(srcdir) $(python_includespec) $(CPPFLAGS) -override DLLLIBS := $(BE_DLLLIBS) $(DLLLIBS) rpath := NAME = plpython @@ -25,7 +24,7 @@ SO_MAJOR_VERSION = 0 SO_MINOR_VERSION = 0 OBJS = plpython.o -SHLIB_LINK += $(python_libspec) +SHLIB_LINK = $(BE_DLLLIBS) $(python_libspec) include $(top_srcdir)/src/Makefile.shlib diff --git a/src/template/win b/src/template/win index fb2f10ea92..e6c4ac67e1 100644 --- a/src/template/win +++ b/src/template/win @@ -1,4 +1,2 @@ CFLAGS=-O2 -SRCH_INC=/usr/local/include SRCH_LIB=/usr/local/lib -LIBS=-lcygipc diff --git a/src/test/regress/GNUmakefile b/src/test/regress/GNUmakefile index 2fd9cc9d25..f21017f7a6 100644 --- a/src/test/regress/GNUmakefile +++ b/src/test/regress/GNUmakefile @@ -20,7 +20,7 @@ contribdir := $(top_builddir)/contrib override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS) override CFLAGS += $(CFLAGS_SL) -override DLLLIBS := $(BE_DLLLIBS) $(DLLLIBS) +SHLIB_LINK = $(BE_DLLLIBS) # default encoding MULTIBYTE = SQL_ASCII diff --git a/src/tutorial/Makefile b/src/tutorial/Makefile index e8f35a64ea..d3e9baf417 100644 --- a/src/tutorial/Makefile +++ b/src/tutorial/Makefile @@ -13,7 +13,7 @@ top_builddir = ../.. include $(top_builddir)/src/Makefile.global override CFLAGS+= $(CFLAGS_SL) -override DLLLIBS := $(BE_DLLLIBS) $(DLLLIBS) +SHLIB_LINK = $(BE_DLLLIBS) # # DLOBJS are the dynamically-loaded object files. The "funcs" queries |