From 31cf893088cf643b553918b2a93164c95cf6a903 Mon Sep 17 00:00:00 2001 From: Andrew Dunstan Date: Thu, 31 Dec 2009 00:16:47 +0000 Subject: [PATCH] enable examples to compile on Windows. patch from Hiroshi Saito. --- src/test/examples/Makefile | 4 ++++ src/test/examples/testlibpq2.c | 7 ++++++- src/test/examples/testlibpq3.c | 8 +++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/test/examples/Makefile b/src/test/examples/Makefile index b55405d737..b009416b8f 100644 --- a/src/test/examples/Makefile +++ b/src/test/examples/Makefile @@ -6,6 +6,10 @@ subdir = src/test/examples top_builddir = ../../.. include $(top_builddir)/src/Makefile.global +ifeq ($(PORTNAME), win32) +LDLIBS += -lws2_32 +endif + override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS) override LDLIBS := $(libpq_pgport) $(LDLIBS) diff --git a/src/test/examples/testlibpq2.c b/src/test/examples/testlibpq2.c index 37c94f45a4..f6c3dbd49d 100644 --- a/src/test/examples/testlibpq2.c +++ b/src/test/examples/testlibpq2.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/test/examples/testlibpq2.c,v 1.15 2009/06/11 14:49:15 momjian Exp $ + * $PostgreSQL: pgsql/src/test/examples/testlibpq2.c,v 1.16 2009/12/31 00:16:47 adunstan Exp $ * * * testlibpq2.c @@ -24,11 +24,16 @@ * * INSERT INTO TBL1 VALUES (10); */ + +#ifdef WIN32 +#include +#endif #include #include #include #include #include +#include #include "libpq-fe.h" static void diff --git a/src/test/examples/testlibpq3.c b/src/test/examples/testlibpq3.c index ef573802a5..ab035887f7 100644 --- a/src/test/examples/testlibpq3.c +++ b/src/test/examples/testlibpq3.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/test/examples/testlibpq3.c,v 1.16 2009/06/11 14:49:15 momjian Exp $ + * $PostgreSQL: pgsql/src/test/examples/testlibpq3.c,v 1.17 2009/12/31 00:16:47 adunstan Exp $ * * * testlibpq3.c @@ -25,8 +25,14 @@ * t = (8 bytes) 'ho there' * b = (5 bytes) \004\003\002\001\000 */ + +#ifdef WIN32 +#include +#endif + #include #include +#include #include #include #include "libpq-fe.h"