Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 1a7f4ed

Browse files
committed
Make "win" a separate port from "cygwin". This means you can now
configure under native Windows (MinGW that is), but you won't get very far compiling yet. The dynaloader files are from Jan Wieck's patch set.
1 parent 93331d8 commit 1a7f4ed

File tree

16 files changed

+166
-107
lines changed

16 files changed

+166
-107
lines changed

configure

+2-1
Original file line numberDiff line numberDiff line change
@@ -1387,13 +1387,14 @@ case $host_os in
13871387
aix*) template=aix ;;
13881388
beos*) template=beos ;;
13891389
bsdi*) template=bsdi ;;
1390-
cygwin*) template=win ;;
1390+
cygwin*) template=cygwin ;;
13911391
darwin*) template=darwin ;;
13921392
dgux*) template=dgux ;;
13931393
freebsd*) template=freebsd ;;
13941394
hpux*) template=hpux ;;
13951395
irix*) template=irix5 ;;
13961396
linux*) template=linux ;;
1397+
mingw*) template=win ;;
13971398
netbsd*) template=netbsd ;;
13981399
nextstep*) template=nextstep ;;
13991400
openbsd*) template=openbsd ;;

configure.in

+3-2
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.238 2003/03/06 03:16:55 tgl Exp $
2+
dnl $Header: /cvsroot/pgsql/configure.in,v 1.239 2003/03/21 17:18:34 petere Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -58,13 +58,14 @@ case $host_os in
5858
aix*) template=aix ;;
5959
beos*) template=beos ;;
6060
bsdi*) template=bsdi ;;
61-
cygwin*) template=win ;;
61+
cygwin*) template=cygwin ;;
6262
darwin*) template=darwin ;;
6363
dgux*) template=dgux ;;
6464
freebsd*) template=freebsd ;;
6565
hpux*) template=hpux ;;
6666
irix*) template=irix5 ;;
6767
linux*) template=linux ;;
68+
mingw*) template=win ;;
6869
netbsd*) template=netbsd ;;
6970
nextstep*) template=nextstep ;;
7071
openbsd*) template=openbsd ;;

src/Makefile.shlib

+11-11
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.66 2003/01/11 17:22:19 tgl Exp $
9+
# $Header: /cvsroot/pgsql/src/Makefile.shlib,v 1.67 2003/03/21 17:18:34 petere Exp $
1010
#
1111
#-------------------------------------------------------------------------
1212

@@ -194,7 +194,7 @@ ifeq ($(PORTNAME), unixware)
194194
LINK.shared += -Wl,-z,text -Wl,-h,$(soname)
195195
endif
196196

197-
ifeq ($(PORTNAME), win)
197+
ifeq ($(PORTNAME), cygwin)
198198
shlib := $(NAME)$(DLSUFFIX)
199199
endif
200200

@@ -225,7 +225,7 @@ all-static-lib: lib$(NAME).a
225225

226226
all-shared-lib: $(shlib)
227227

228-
ifneq ($(PORTNAME), win)
228+
ifneq ($(PORTNAME), cygwin)
229229

230230
ifndef LORDER
231231
MK_NO_LORDER := true
@@ -239,12 +239,12 @@ else
239239
endif
240240
$(RANLIB) $@
241241

242-
endif # not win
242+
endif # not cygwin
243243

244244
ifeq ($(enable_shared), yes)
245245

246246
ifneq ($(PORTNAME), beos)
247-
ifneq ($(PORTNAME), win)
247+
ifneq ($(PORTNAME), cygwin)
248248
ifneq ($(PORTNAME), aix)
249249

250250
# Normal case
@@ -270,9 +270,9 @@ $(shlib): lib$(NAME).a
270270

271271
endif # PORTNAME == aix
272272

273-
else # PORTNAME == win
273+
else # PORTNAME == cygwin
274274

275-
# WIN case
275+
# Cygwin case
276276
$(shlib) lib$(NAME).a: $(OBJS) $(DLLINIT)
277277
$(DLLTOOL) --export-all --output-def $(NAME).def $(OBJS)
278278
$(DLLWRAP) -o $(shlib) --dllname $(shlib) --def $(NAME).def $(OBJS) $(DLLINIT) $(SHLIB_LINK)
@@ -281,7 +281,7 @@ $(shlib) lib$(NAME).a: $(OBJS) $(DLLINIT)
281281
$(DLLINIT): $(DLLINIT:%.o=%.c)
282282
$(MAKE) -C $(@D) $(@F)
283283

284-
endif # PORTNAME == win
284+
endif # PORTNAME == cygwin
285285

286286
else # PORTNAME == beos
287287

@@ -308,7 +308,7 @@ install-lib-static: lib$(NAME).a
308308
ifeq ($(enable_shared), yes)
309309
install-lib-shared: $(shlib)
310310
$(INSTALL_SHLIB) $< $(DESTDIR)$(libdir)/$(shlib)
311-
ifneq ($(PORTNAME), win)
311+
ifneq ($(PORTNAME), cygwin)
312312
ifneq ($(shlib), lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION))
313313
cd $(DESTDIR)$(libdir) && \
314314
rm -f lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION) && \
@@ -320,7 +320,7 @@ ifneq ($(shlib), lib$(NAME)$(DLSUFFIX))
320320
$(LN_S) $(shlib) lib$(NAME)$(DLSUFFIX)
321321
endif
322322

323-
endif # not win
323+
endif # not cygwin
324324
endif # enable_shared
325325

326326

@@ -351,6 +351,6 @@ ifdef EXPSUFF
351351
rm -f lib$(NAME)$(EXPSUFF)
352352
endif
353353
endif
354-
ifeq ($(PORTNAME), win)
354+
ifeq ($(PORTNAME), cygwin)
355355
rm -f $(NAME).dll $(NAME).def
356356
endif

src/backend/Makefile

+8-8
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.94 2003/02/03 14:24:07 momjian Exp $
7+
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.95 2003/03/21 17:18:34 petere Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -31,12 +31,12 @@ endif
3131

3232
all: submake-libpgport postgres $(POSTGRES_IMP)
3333

34-
ifneq ($(PORTNAME), win)
34+
ifneq ($(PORTNAME), cygwin)
3535

3636
postgres: $(OBJS)
3737
$(CC) $(CFLAGS) $(LDFLAGS) $(export_dynamic) $^ $(LIBS) -o $@
3838

39-
else # win
39+
else # cygwin
4040

4141
postgres: $(OBJS) $(DLLINIT) postgres.def libpostgres.a
4242
$(DLLTOOL) --dllname $@$(X) --output-exp $@.exp --def postgres.def
@@ -51,7 +51,7 @@ postgres.def: $(OBJS)
5151
libpostgres.a: postgres.def
5252
$(DLLTOOL) --dllname postgres.exe --def postgres.def --output-lib $@
5353

54-
endif # win
54+
endif # cygwin
5555

5656
ifeq ($(PORTNAME), aix)
5757

@@ -126,7 +126,7 @@ distprep:
126126
##########################################################################
127127

128128
install: all installdirs install-bin
129-
ifeq ($(PORTNAME), win)
129+
ifeq ($(PORTNAME), cygwin)
130130
ifeq ($(MAKE_DLL), true)
131131
$(INSTALL_DATA) libpostgres.a $(DESTDIR)$(libdir)/libpostgres.a
132132
endif
@@ -148,7 +148,7 @@ endif
148148

149149
installdirs:
150150
$(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(datadir)
151-
ifeq ($(PORTNAME), win)
151+
ifeq ($(PORTNAME), cygwin)
152152
ifeq ($(MAKE_DLL), true)
153153
$(mkinstalldirs) $(DESTDIR)$(libdir)
154154
endif
@@ -165,7 +165,7 @@ uninstall:
165165
ifeq ($(MAKE_EXPORTS), true)
166166
rm -f $(DESTDIR)$(pkglibdir)/$(POSTGRES_IMP)
167167
endif
168-
ifeq ($(PORTNAME), win)
168+
ifeq ($(PORTNAME), cygwin)
169169
ifeq ($(MAKE_DLL), true)
170170
rm -f $(DESTDIR)$(libdir)/libpostgres.a
171171
endif
@@ -183,7 +183,7 @@ clean:
183183
rm -f postgres$(X) $(POSTGRES_IMP) \
184184
$(top_srcdir)/src/include/parser/parse.h \
185185
$(top_builddir)/src/include/utils/fmgroids.h
186-
ifeq ($(PORTNAME), win)
186+
ifeq ($(PORTNAME), cygwin)
187187
rm -f postgres.dll postgres.def libpostgres.a
188188
endif
189189
for i in $(DIRS); do $(MAKE) -C $$i clean || exit; done

src/backend/port/dynloader/cygwin.c

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* Dummy file used for nothing at this point; see cygwin.h */

src/backend/port/dynloader/cygwin.h

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* Dynamic loader declarations for Cygwin
4+
*
5+
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
6+
* Portions Copyright (c) 1994, Regents of the University of California
7+
*
8+
* $Header: /cvsroot/pgsql/src/backend/port/dynloader/cygwin.h,v 1.1 2003/03/21 17:18:34 petere Exp $
9+
*
10+
*-------------------------------------------------------------------------
11+
*/
12+
#ifndef PORT_PROTOS_H
13+
#define PORT_PROTOS_H
14+
15+
#include <dlfcn.h>
16+
#include "utils/dynamic_loader.h"
17+
18+
/*
19+
* In some older systems, the RTLD_NOW flag isn't defined and the mode
20+
* argument to dlopen must always be 1. The RTLD_GLOBAL flag is wanted
21+
* if available, but it doesn't exist everywhere.
22+
* If it doesn't exist, set it to 0 so it has no effect.
23+
*/
24+
#ifndef RTLD_NOW
25+
#define RTLD_NOW 1
26+
#endif
27+
#ifndef RTLD_GLOBAL
28+
#define RTLD_GLOBAL 0
29+
#endif
30+
31+
#define pg_dlopen(f) dlopen((f), RTLD_NOW | RTLD_GLOBAL)
32+
#define pg_dlsym dlsym
33+
#define pg_dlclose dlclose
34+
#define pg_dlerror dlerror
35+
36+
#endif /* PORT_PROTOS_H */

src/backend/port/dynloader/win.c

+27-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,27 @@
1-
/* Dummy file used for nothing at this point
2-
*
3-
* see win.h
4-
*/
1+
/* $Header: /cvsroot/pgsql/src/backend/port/dynloader/Attic/win.c,v 1.2 2003/03/21 17:18:34 petere Exp $ */
2+
3+
#include <windows.h>
4+
5+
char *
6+
dlerror(void)
7+
{
8+
return "error";
9+
}
10+
11+
int
12+
dlclose(void *handle)
13+
{
14+
return FreeLibrary((HMODULE)handle) ? 0 : 1;
15+
}
16+
17+
void *
18+
dlsym(void *handle, const char *symbol)
19+
{
20+
return (void *)GetProcAddress((HMODULE)handle, symbol);
21+
}
22+
23+
void *
24+
dlopen(const char *path, int mode)
25+
{
26+
return (void *)LoadLibrary(path);
27+
}

src/backend/port/dynloader/win.h

+1-36
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,9 @@
1-
/*-------------------------------------------------------------------------
2-
*
3-
* win.h
4-
* port-specific prototypes for Intel x86/Window NT
5-
*
6-
*
7-
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
8-
* Portions Copyright (c) 1994, Regents of the University of California
9-
*
10-
* win.h,v 1.2 1995/03/17 06:40:18 andrew Exp
11-
*
12-
*-------------------------------------------------------------------------
13-
*/
141
#ifndef PORT_PROTOS_H
152
#define PORT_PROTOS_H
163

17-
#include <dlfcn.h>
184
#include "utils/dynamic_loader.h"
195

20-
/*
21-
* Dynamic Loader on Intel x86/Windows NT
22-
*
23-
* this dynamic loader uses the system dynamic loading interface for shared
24-
* libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared
25-
* library as the file to be dynamically loaded.
26-
*/
27-
28-
/*
29-
* In some older systems, the RTLD_NOW flag isn't defined and the mode
30-
* argument to dlopen must always be 1. The RTLD_GLOBAL flag is wanted
31-
* if available, but it doesn't exist everywhere.
32-
* If it doesn't exist, set it to 0 so it has no effect.
33-
*/
34-
#ifndef RTLD_NOW
35-
#define RTLD_NOW 1
36-
#endif
37-
#ifndef RTLD_GLOBAL
38-
#define RTLD_GLOBAL 0
39-
#endif
40-
41-
#define pg_dlopen(f) dlopen((f), RTLD_NOW | RTLD_GLOBAL)
6+
#define pg_dlopen(f) dlopen((f), 1)
427
#define pg_dlsym dlsym
438
#define pg_dlclose dlclose
449
#define pg_dlerror dlerror

src/include/port/cygwin.h

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/* $Header: /cvsroot/pgsql/src/include/port/cygwin.h,v 1.1 2003/03/21 17:18:34 petere Exp $ */
2+
3+
#define HAS_TEST_AND_SET
4+
typedef unsigned char slock_t;
5+
6+
#define tzname _tzname /* should be in time.h? */
7+
#define HAVE_INT_TIMEZONE /* has int _timezone */
8+
9+
#include <cygwin/version.h>
10+
11+
/*
12+
* Check for b20.1 and disable AF_UNIX family socket support.
13+
*/
14+
#if CYGWIN_VERSION_DLL_MAJOR < 1001
15+
#undef HAVE_UNIX_SOCKETS
16+
#endif
17+
18+
#if __GNUC__ && ! defined (__declspec)
19+
#error You need egcs 1.1 or newer for compiling!
20+
#endif
21+
22+
#ifdef BUILDING_DLL
23+
#define DLLIMPORT __declspec (dllexport)
24+
#else
25+
#define DLLIMPORT __declspec (dllimport)
26+
#endif

src/include/port/win.h

+4-30
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,15 @@
1-
#define HAS_TEST_AND_SET
2-
typedef unsigned char slock_t;
3-
4-
#define tzname _tzname /* should be in time.h? */
5-
#define HAVE_INT_TIMEZONE /* has int _timezone */
1+
/* $Header: /cvsroot/pgsql/src/include/port/Attic/win.h,v 1.15 2003/03/21 17:18:34 petere Exp $ */
62

7-
#include <cygwin/version.h>
8-
9-
/*
10-
* Check for b20.1 and disable AF_UNIX family socket support.
11-
*/
12-
#if CYGWIN_VERSION_DLL_MAJOR < 1001
13-
#undef HAVE_UNIX_SOCKETS
14-
#endif
15-
16-
/* defines for dynamic linking on Win32 platform */
17-
#ifdef __CYGWIN__
18-
19-
#if __GNUC__ && ! defined (__declspec)
20-
#error You need egcs 1.1 or newer for compiling!
21-
#endif
3+
#define HAS_TEST_AND_SET
224

235
#ifdef BUILDING_DLL
246
#define DLLIMPORT __declspec (dllexport)
25-
#else /* not BUILDING_DLL */
7+
#else
268
#define DLLIMPORT __declspec (dllimport)
279
#endif
2810

29-
#elif defined(WIN32) && defined(_MSC_VER) /* not CYGWIN */
30-
3111
#if defined(_DLL)
3212
#define DLLIMPORT __declspec (dllexport)
33-
#else /* not _DLL */
13+
#else
3414
#define DLLIMPORT __declspec (dllimport)
3515
#endif
36-
37-
#else /* not CYGWIN, not MSVC */
38-
39-
#define DLLIMPORT
40-
41-
#endif

0 commit comments

Comments
 (0)