From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= on
I've run across a couple of stumbling blocks when building on Win32
(specifically, XP + MinGW):

1. PostgreSQL's private versions of inet_aton etc. can conflict with
similar functions in other libraries (in my case, PostgreSQL's
inet_aton conflicts with libavformat's).

2. On Win32, PostgreSQL uses the SSPI authentication interface. This
interface is implemented in secur32.dll, which needs to be added to
the linker command line. This is apparently only an issue when
building a static libpq.

3. src/template/win32 sets LDFLAGS unconditionally, overriding anything
the user may have specified in the environment or on the command
line (such as -L/path/to/my/lib/dir).

The attached patch addresses these issues by:

1. #defining the function names as appropriate

2. adding -lsecur32 to LIBS in src/Makefile.global.in when PORTNAME is
win32.

3. adding ${LDFLAGS} at the front of the LDFLAGS redefinition in
src/template/win32.

The patch was developed and tested on 8.3.9, because that's what my
customer uses. I have verified that it applies cleanly (albeit with
offsets) to 8.4.2.

BTW, IWBNI there were a quick and easy way to build and install only
libpq. I use this sequence of commands (after configure):

$ make -C src/port all
$ make -C src/backend utils/fmgroids.h
$ make -C src/backend ../../src/include/utils/fmgroids.h
$ make -C src/include all install
$ make -C src/interfaces/libpq all install
$ make -C src/bin/pg_config all install

DES
--
Dag-Erling Smørgrav - des(a)des.no