On Wed, Jun 18, 2014 at 8:37 PM, MauMau <maumau...@gmail.com> wrote: > Doing "grep -lir wsock32 ." shows the following files. Could you modify and > test these files as well for code cleanup? > ./configure > ./configure.in > ./contrib/pgcrypto/Makefile > ./src/interfaces/libpq/Makefile > ./src/interfaces/libpq/win32.c > ./src/interfaces/libpq/win32.mak > ./src/test/thread/README > ./src/tools/msvc/Mkvcbuild.pm You are right, I only though about the MS scripts when working on this patch. Updated patch for a complete cleanup is attached (note I updated manually ./configure for test purposes and did not re-run autoconf). Regards, -- Michael
From f429372f402057591ede3239e69e4b70fb846751 Mon Sep 17 00:00:00 2001 From: Michael Paquier <mich...@otacoo.com> Date: Thu, 19 Jun 2014 16:26:38 +0900 Subject: [PATCH] Remove usage of wsock32 in Windows builds
MS scripts, as well as Windows port Makefile are cleaned up. wsock32.dll is an obsolete WinSock 1.1 library, while ws2_32.dll is a successor WinSock 2.0 library which is fully compatible with the old one. --- configure | 2 +- configure.in | 2 +- contrib/pgcrypto/Makefile | 2 +- src/interfaces/libpq/Makefile | 2 +- src/interfaces/libpq/win32.c | 3 --- src/interfaces/libpq/win32.mak | 2 +- src/test/thread/README | 2 +- src/tools/msvc/Mkvcbuild.pm | 13 +++++-------- 8 files changed, 11 insertions(+), 17 deletions(-) diff --git a/configure b/configure index da89c69..892f880 100755 --- a/configure +++ b/configure @@ -7661,7 +7661,7 @@ return socket (); return 0; } _ACEOF -for ac_lib in '' socket wsock32; do +for ac_lib in '' socket ws2_32; do if test -z "$ac_lib"; then ac_res="none required" else diff --git a/configure.in b/configure.in index 7dfbe9f..01bbe05 100644 --- a/configure.in +++ b/configure.in @@ -892,7 +892,7 @@ fi AC_CHECK_LIB(m, main) AC_SEARCH_LIBS(setproctitle, util) AC_SEARCH_LIBS(dlopen, dl) -AC_SEARCH_LIBS(socket, [socket wsock32]) +AC_SEARCH_LIBS(socket, [socket ws2_32]) AC_SEARCH_LIBS(shl_load, dld) # We only use libld in port/dynloader/aix.c case $host_os in diff --git a/contrib/pgcrypto/Makefile b/contrib/pgcrypto/Makefile index 1c85c98..4d91a06 100644 --- a/contrib/pgcrypto/Makefile +++ b/contrib/pgcrypto/Makefile @@ -54,7 +54,7 @@ SHLIB_LINK += $(filter -lcrypto -lz, $(LIBS)) ifeq ($(PORTNAME), win32) SHLIB_LINK += $(filter -leay32, $(LIBS)) # those must be at the end -SHLIB_LINK += -lwsock32 -lws2_32 +SHLIB_LINK += -lws2_32 endif rijndael.o: rijndael.tbl diff --git a/src/interfaces/libpq/Makefile b/src/interfaces/libpq/Makefile index 15ea648..718ecd6 100644 --- a/src/interfaces/libpq/Makefile +++ b/src/interfaces/libpq/Makefile @@ -70,7 +70,7 @@ else SHLIB_LINK += $(filter -lcrypt -ldes -lcom_err -lcrypto -lk5crypto -lkrb5 -lgssapi32 -lssl -lsocket -lnsl -lresolv -lintl $(PTHREAD_LIBS), $(LIBS)) $(LDAP_LIBS_FE) endif ifeq ($(PORTNAME), win32) -SHLIB_LINK += -lshfolder -lwsock32 -lws2_32 -lsecur32 $(filter -leay32 -lssleay32 -lcomerr32 -lkrb5_32, $(LIBS)) +SHLIB_LINK += -lshfolder -lws2_32 -lsecur32 $(filter -leay32 -lssleay32 -lcomerr32 -lkrb5_32, $(LIBS)) endif SHLIB_EXPORTS = exports.txt diff --git a/src/interfaces/libpq/win32.c b/src/interfaces/libpq/win32.c index 88d12d6..c0fe0fb 100644 --- a/src/interfaces/libpq/win32.c +++ b/src/interfaces/libpq/win32.c @@ -248,9 +248,6 @@ struct MessageDLL "winsock.dll", 0, 0 }, { - "wsock32.dll", 0, 0 - }, - { "ws2_32.dll", 0, 0 }, { diff --git a/src/interfaces/libpq/win32.mak b/src/interfaces/libpq/win32.mak index 23e09e9..99fef27 100644 --- a/src/interfaces/libpq/win32.mak +++ b/src/interfaces/libpq/win32.mak @@ -208,7 +208,7 @@ CPP_SBRS=. RSC_PROJ=/l 0x409 /fo"$(INTDIR)\libpq.res" LINK32=link.exe -LINK32_FLAGS=kernel32.lib user32.lib advapi32.lib shfolder.lib wsock32.lib ws2_32.lib secur32.lib $(SSL_LIBS) $(KFW_LIB) $(ADD_SECLIB) \ +LINK32_FLAGS=kernel32.lib user32.lib advapi32.lib shfolder.lib ws2_32.lib secur32.lib $(SSL_LIBS) $(KFW_LIB) $(ADD_SECLIB) \ /nologo /subsystem:windows /dll $(LOPT) /incremental:no \ /pdb:"$(OUTDIR)\libpqdll.pdb" /machine:$(CPU) \ /out:"$(OUTDIR)\$(OUTFILENAME).dll"\ diff --git a/src/test/thread/README b/src/test/thread/README index 00ec2ff..4da2344 100644 --- a/src/test/thread/README +++ b/src/test/thread/README @@ -40,7 +40,7 @@ to test your system however, you can do so as follows: -D_POSIX_PTHREAD_SEMANTICS \ -I../../../src/include/port/win32 \ thread_test.c \ - -lwsock32 \ + -lws2_32 \ -lpthreadgc2 3) Run thread_test.exe. You should see output like: diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm index 8002f23..0f63491 100644 --- a/src/tools/msvc/Mkvcbuild.pm +++ b/src/tools/msvc/Mkvcbuild.pm @@ -44,7 +44,7 @@ my @contrib_uselibpgcommon = ( 'pg_test_fsync', 'pg_test_timing', 'pg_upgrade', 'pg_xlogdump', 'vacuumlo'); -my $contrib_extralibs = { 'pgbench' => ['wsock32.lib'] }; +my $contrib_extralibs = { 'pgbench' => ['ws2_32.lib'] }; my $contrib_extraincludes = { 'tsearch2' => ['contrib/tsearch2'], 'dblink' => ['src/backend'] }; my $contrib_extrasource = { @@ -113,9 +113,8 @@ sub mkvcbuild $postgres->AddFiles('src\backend\replication', 'repl_scanner.l', 'repl_gram.y'); $postgres->AddDefine('BUILDING_DLL'); - $postgres->AddLibrary('wsock32.lib'); - $postgres->AddLibrary('ws2_32.lib'); $postgres->AddLibrary('secur32.lib'); + $postgres->AddLibrary('ws2_32.lib'); $postgres->AddLibrary('wldap32.lib') if ($solution->{options}->{ldap}); $postgres->FullExportDLL('postgres.lib'); @@ -270,7 +269,6 @@ sub mkvcbuild $libpq->AddDefine('FRONTEND'); $libpq->AddDefine('UNSAFE_STAT_OK'); $libpq->AddIncludeDir('src\port'); - $libpq->AddLibrary('wsock32.lib'); $libpq->AddLibrary('secur32.lib'); $libpq->AddLibrary('ws2_32.lib'); $libpq->AddLibrary('wldap32.lib') if ($solution->{options}->{ldap}); @@ -300,7 +298,7 @@ sub mkvcbuild $libecpg->AddIncludeDir('src\interfaces\libpq'); $libecpg->AddIncludeDir('src\port'); $libecpg->UseDef('src\interfaces\ecpg\ecpglib\ecpglib.def'); - $libecpg->AddLibrary('wsock32.lib'); + $libecpg->AddLibrary('ws2_32.lib'); $libecpg->AddReference($libpq, $pgtypes, $libpgport); my $libecpgcompat = $solution->AddProject( @@ -345,7 +343,7 @@ sub mkvcbuild $isolation_tester->AddIncludeDir('src\interfaces\libpq'); $isolation_tester->AddDefine('HOST_TUPLE="i686-pc-win32vc"'); $isolation_tester->AddDefine('FRONTEND'); - $isolation_tester->AddLibrary('wsock32.lib'); + $isolation_tester->AddLibrary('ws2_32.lib'); $isolation_tester->AddReference($libpq, $libpgcommon, $libpgport); my $pgregress_isolation = @@ -363,7 +361,6 @@ sub mkvcbuild $initdb->AddIncludeDir('src\interfaces\libpq'); $initdb->AddIncludeDir('src\timezone'); $initdb->AddDefine('FRONTEND'); - $initdb->AddLibrary('wsock32.lib'); $initdb->AddLibrary('ws2_32.lib'); my $pgbasebackup = AddSimpleFrontend('pg_basebackup', 1); @@ -505,7 +502,7 @@ sub mkvcbuild 'pgp-mpi-internal.c', 'imath.c'); } $pgcrypto->AddReference($postgres); - $pgcrypto->AddLibrary('wsock32.lib'); + $pgcrypto->AddLibrary('ws2_32.lib'); my $mf = Project::read_file('contrib/pgcrypto/Makefile'); GenerateContribSqlFiles('pgcrypto', $mf); -- 2.0.0
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers