]> granicus.if.org Git - postgresql/commitdiff
enable examples to compile on Windows. patch from Hiroshi Saito.
authorAndrew Dunstan <andrew@dunslane.net>
Thu, 31 Dec 2009 00:16:47 +0000 (00:16 +0000)
committerAndrew Dunstan <andrew@dunslane.net>
Thu, 31 Dec 2009 00:16:47 +0000 (00:16 +0000)
src/test/examples/Makefile
src/test/examples/testlibpq2.c
src/test/examples/testlibpq3.c

index b55405d7372bf56767cb1d38512c85ca5f06a262..b009416b8ffee5f72854c3af385dd8194e32a6d9 100644 (file)
@@ -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)
 
index 37c94f45a400ecfc6827900b7ccb6a29c3331655..f6c3dbd49d7f192c975276b499c2f497260254ed 100644 (file)
@@ -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
  *
  *      INSERT INTO TBL1 VALUES (10);
  */
+
+#ifdef WIN32
+#include <windows.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
 #include <sys/time.h>
+#include <sys/types.h>
 #include "libpq-fe.h"
 
 static void
index ef573802a5d7672b1b2d28ab731725a5784cbeb3..ab035887f7b7ef6f35d5e8752825e34d9a06a60a 100644 (file)
@@ -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
  *     t = (8 bytes) 'ho there'
  *     b = (5 bytes) \004\003\002\001\000
  */
+
+#ifdef WIN32
+#include <windows.h>
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
+#include <stdint.h>
 #include <string.h>
 #include <sys/types.h>
 #include "libpq-fe.h"