LibreOffice driver 1: Building libpq with Mozilla LDAP instead of OpenLDAP

Started by Lionel Elie Mamaneabout 14 years ago10 messages
#1Lionel Elie Mamane
lionel@mamane.lu

Hi,

I've revived the old moribund / bitrotten OpenOffice driver for
PostgreSQL (originally at
http://dba.openoffice.org/drivers/postgresql/index.html). As you may
already know, OpenOffice was forked into LibreOffice. Barring any
unforeseen disaster, LibreOffice 3.5 (to be released in early February
2011) will bundle that driver.

As part of this integration, I have a few questions / remarks.

LibreOffice can be configured at build-time to use Mozilla LDAP or
OpenLDAP. We patched postgresql's configure.in to build libpq with
Mozilla LDAP when requested to do so.

I wanted to check that this is not by any chance known to produce a
more-or-less subtly broken libpq.

I'd also be happy to extract from our patch the parts that are
relevant for integration in postgresql proper, and massage them into
the right modularity / form. Are you interested?

--
Lionel

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Lionel Elie Mamane (#1)
Re: LibreOffice driver 1: Building libpq with Mozilla LDAP instead of OpenLDAP

Lionel Elie Mamane <lionel@mamane.lu> writes:

I've revived the old moribund / bitrotten OpenOffice driver for
PostgreSQL (originally at
http://dba.openoffice.org/drivers/postgresql/index.html). As you may
already know, OpenOffice was forked into LibreOffice. Barring any
unforeseen disaster, LibreOffice 3.5 (to be released in early February
2011) will bundle that driver.

Cool ...

As part of this integration, I have a few questions / remarks.

LibreOffice can be configured at build-time to use Mozilla LDAP or
OpenLDAP. We patched postgresql's configure.in to build libpq with
Mozilla LDAP when requested to do so.

Um, if I interpret this correctly, you're intending to make OpenOffice
include a bundled copy of libpq.so. With my other hat on (the red
fedora) that sounds like a truly awful idea. Distros do not like
packages that include bundled copies of other packages' libraries,
because they're a nightmare for updates (cf recent discussions about
static libraries, which are the same thing). I strongly suggest you
find a way to not need to do this.

I wanted to check that this is not by any chance known to produce a
more-or-less subtly broken libpq.

No, we are not going to make any promises about that.

regards, tom lane

#3Lionel Elie Mamane
lionel@mamane.lu
In reply to: Tom Lane (#2)
Re: LibreOffice driver 1: Building libpq with Mozilla LDAP instead of OpenLDAP

On Tue, Dec 13, 2011 at 10:43:26AM -0500, Tom Lane wrote:

Lionel Elie Mamane <lionel@mamane.lu> writes:

LibreOffice can be configured at build-time to use Mozilla LDAP or
OpenLDAP. We patched postgresql's configure.in to build libpq with
Mozilla LDAP when requested to do so.

Um, if I interpret this correctly, you're intending to make
OpenOffice include a bundled copy of libpq.so. With my other hat on
(the red fedora) that sounds like a truly awful idea.

In the "traditional Unix" world (GNU/Linux, Free/Net/Open/MirBSD,
...), libpq.so.5 is in the dynamic linker's default search path, so we
can conceivably link against it and tell ours users "install package
libpq5 / postgresql-client-lib / ... if you want PostgreSQL support".

On MacOS X and Microsoft Windows, the world is far more messy. There
are several ways to install libpq (one-click installer, fink,
MacPorts, ...), and each of these ways allows the user to select an
install location (or a prefix thereof) freely. How we are supposed to
instruct the dynamic linker to find libpq on the user's system, you
tell me, I have no better idea than bundling it (or linking
statically); running
find / -name libpq.5.dylib
(or libpq.dll on Windows) and then dynamically running otool (the
MacOS X equivalent of chrpath/patchelf/...) on ourselves is *not*
practical, to say the least...

Distros do not like packages that include bundled copies of other
packages' libraries,

"Traditional Unix" distros are free to (and I expect typically will)
configure LibreOffice with --with-system-libs or
--with-system-postgresql (which will use pg_config in the PATH) or
--with-libpq-path=/foo/bar, all of which will just link against libpq
and not bundle it, and expect to find it at runtime at the same
location than at compile-time or in the dynamic linker's default
search path. Their RPM/DEB/... will declare a dependency on the
RPM/DEB/... that ships an ABI-compatible libpq.so.5, so it will be
there and all will be well.

With my Debian GNU/{Linux,kFreeBSD,Hurd,...} hat on, obviously I would
not have it any other way. With my LibreOffice hat on, I have to take
care of other platforms' needs, too.

because they're a nightmare for updates (cf recent discussions about
static libraries, which are the same thing). I strongly suggest you
find a way to not need to do this.

Personally, I don't have a beginning of a clue of a "way to not need
to do this" for MacOS X and Microsoft Windows. The MacOS X & Windows
guys within LibreOffice tell me bundling the lib (or linking
statically) is the least insane thing to do on these
platforms. <shrug>

--
Lionel

#4Greg Smith
greg@2ndQuadrant.com
In reply to: Lionel Elie Mamane (#3)
Re: LibreOffice driver 1: Building libpq with Mozilla LDAP instead of OpenLDAP

On 12/13/2011 11:07 AM, Lionel Elie Mamane wrote:

On MacOS X and Microsoft Windows, the world is far more messy. There
are several ways to install libpq (one-click installer, fink,
MacPorts, ...), and each of these ways allows the user to select an
install location (or a prefix thereof) freely.

This is less controversial. If you yell at Tom about something messy
that must be done only to support Windows and Mac OS X, he does
something completely different with his RedHat Fedora. It's kind of
like http://www.youtube.com/watch?v=kLbOMb7F40k , only more red.

--
Greg Smith 2ndQuadrant US greg@2ndQuadrant.com Baltimore, MD
PostgreSQL Training, Services, and 24x7 Support www.2ndQuadrant.us

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Greg Smith (#4)
Re: LibreOffice driver 1: Building libpq with Mozilla LDAP instead of OpenLDAP

Greg Smith <greg@2ndQuadrant.com> writes:

On 12/13/2011 11:07 AM, Lionel Elie Mamane wrote:

On MacOS X and Microsoft Windows, the world is far more messy. There
are several ways to install libpq (one-click installer, fink,
MacPorts, ...), and each of these ways allows the user to select an
install location (or a prefix thereof) freely.

This is less controversial.

Yeah, I'm aware that sane handling of library dependencies is
practically impossible under Windows, but I didn't see how that would
result in wanting to change the configure script. I wasn't thinking
about OSX though. (You're aware that Apple ships a perfectly fine
libpq.so in Lion, no?)

regards, tom lane

#6Lionel Elie Mamane
lionel@mamane.lu
In reply to: Tom Lane (#5)
Re: LibreOffice driver 1: Building libpq with Mozilla LDAP instead of OpenLDAP

On Tue, Dec 13, 2011 at 12:48:01PM -0500, Tom Lane wrote:

Greg Smith <greg@2ndQuadrant.com> writes:

On 12/13/2011 11:07 AM, Lionel Elie Mamane wrote:

On MacOS X and Microsoft Windows, the world is far more messy. There
are several ways to install libpq (one-click installer, fink,
MacPorts, ...), and each of these ways allows the user to select an
install location (or a prefix thereof) freely.

This is less controversial.

Yeah, I'm aware that sane handling of library dependencies is
practically impossible under Windows, (...). I wasn't thinking
about OSX though. (You're aware that Apple ships a perfectly fine
libpq.so in Lion, no?)

No, I was not aware of that. Thank you for that information. Is it
installed by default?

Anyway, LibreOffice wishes to be compatible back to MacOS X 10.4
(probably to have some sort of MacOSX/PowerPC support), so that's not
yet useful to us, but it is good news! As I use PQconnectdbParams, I
also need version 9.0 or later (but I'd be willing to work around that
if it were useful).

--
Lionel

#7Pavel Golub
pavel@microolap.com
In reply to: Tom Lane (#5)
Re: LibreOffice driver 1: Building libpq with Mozilla LDAP instead of OpenLDAP

Hello, Tom.

You wrote:

TL> Greg Smith <greg@2ndQuadrant.com> writes:

On 12/13/2011 11:07 AM, Lionel Elie Mamane wrote:

On MacOS X and Microsoft Windows, the world is far more messy. There
are several ways to install libpq (one-click installer, fink,
MacPorts, ...), and each of these ways allows the user to select an
install location (or a prefix thereof) freely.

This is less controversial.

TL> Yeah, I'm aware that sane handling of library dependencies is
TL> practically impossible under Windows, but I didn't see how that would
TL> result in wanting to change the configure script. I wasn't thinking
TL> about OSX though. (You're aware that Apple ships a perfectly fine
TL> libpq.so in Lion, no?)

Is it true? Really? Where can we read about it?

TL> regards, tom lane

--
With best wishes,
Pavel mailto:pavel@gf.microolap.com

#8Tom Lane
tgl@sss.pgh.pa.us
In reply to: Pavel Golub (#7)
Re: LibreOffice driver 1: Building libpq with Mozilla LDAP instead of OpenLDAP

Pavel Golub <pavel@microolap.com> writes:

You wrote:
TL> about OSX though. (You're aware that Apple ships a perfectly fine
TL> libpq.so in Lion, no?)

Is it true? Really? Where can we read about it?

/Library/WebServer/Documents/postgresql/html ...

I don't know where else Apple documents this, but there's a
complete-looking set of client-side libraries and command line tools
from Postgres 9.0.4 in base Lion. I understand that if you buy Lion
Server you get the postmaster too, but I haven't done that so I can't
verify it from personal experience. libpq.dylib is definitely right
there in /usr/lib though, and it apparently is well-configured, because
/usr/bin/pg_config says

CONFIGURE = '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--disable-dependency-tracking' '--prefix=/usr' '--sbindir=/usr/libexec' '--sysconfdir=/private/etc' '--localstatedir=/var/pgsql' '--htmldir=/Library/WebServer/Documents/postgresql' '--enable-thread-safety' '--enable-dtrace' '--with-tcl' '--with-perl' '--with-python' '--with-gssapi' '--with-krb5' '--with-pam' '--with-ldap' '--with-bonjour' '--with-openssl' '--with-libxml' '--with-libxslt' '--with-system-tzdata=/usr/share/zoneinfo' 'CFLAGS=-arch x86_64 -arch i386 -pipe -Os -g -Wall -Wno-deprecated-declarations' 'LDFLAGS=-arch x86_64 -arch i386 -pipe -Os -g -Wall -Wno-deprecated-declarations' 'LDFLAGS_EX=-mdynamic-no-pic'

I've not made an attempt to use it directly myself, but it sure looks
like it should do what the OP wants.

regards, tom lane

#9Lionel Elie Mamane
lionel@mamane.lu
In reply to: Lionel Elie Mamane (#1)
1 attachment(s)
Re: LibreOffice driver 1: Building libpq with Mozilla LDAP instead of OpenLDAP

On Tue, Dec 13, 2011 at 11:45:28AM +0100, Magnus Hagander wrote:

On Tue, Dec 13, 2011 at 11:15, Lionel Elie Mamane <lionel@mamane.lu> wrote:

LibreOffice can be configured at build-time to use Mozilla LDAP or
OpenLDAP. We patched postgresql's configure.in to build libpq with
Mozilla LDAP when requested to do so.

I'd also be happy to extract from our patch the parts that are
relevant for integration in postgresql proper, and massage them into
the right modularity / form. Are you interested?

Please do.

The patch is attached. I got everybody that touched the patch in the
LibreOffice git repo to agree to the PostgreSQL license for the patch.

The changes to tools/msvc are untested since I don't personally have a
Microsoft Windows build environment and LibreOffice uses
src/interfaces/lipq/win32.mak to build libpq.

The patch introduces a preprocessor macro USE_MICROSOFT_LDAP to enable
the Microsoft LDAP part to replace the previously used "#ifdef WIN32",
since one can also use Mozilla LDAP on MS Windows. I found that
cleaner than putting everywhere "#if defined(WIN32) && ! defined(USE_MOZLDAP)".

Except for that, the only change is to the config/build system proper,
to recognise and use the Mozilla LDAP library.

--
Lionel

Attachments:

postgresql-moz-ldap.patchtext/x-diff; charset=us-asciiDownload
diff --recursive -u misc/build/postgresql-9.1.1/configure.in misc/build/postgresql-9.1.1.patched/configure.in
--- misc/build/postgresql-9.1.1/configure.in	2011-09-22 23:57:57.000000000 +0200
+++ misc/build/postgresql-9.1.1.patched/configure.in	2011-12-14 13:10:11.000000000 +0100
@@ -662,6 +662,13 @@
 AC_MSG_RESULT([$with_ldap])
 AC_SUBST(with_ldap)
 
+AC_MSG_CHECKING([whether to use Mozilla C SDK for LDAP support])
+PGAC_ARG_BOOL(with, mozldap, no,
+              [build with Mozilla LDAP support],
+              [AC_DEFINE([USE_MOZLDAP], 1, [Define to 1 to use the Mozilla LDAP C SDK instead of platform default (OpenLDAP or Microsoft LDAP). (--with-mozldap)])])
+AC_MSG_RESULT([$with_mozldap])
+AC_SUBST(with_mozldap)
+
 
 #
 # Bonjour
@@ -1077,7 +1084,7 @@
 fi
 
 if test "$with_ldap" = yes ; then
-  if test "$PORTNAME" != "win32"; then
+  if test "$PORTNAME" != "win32" || test "$with_mozldap" = "yes"; then
      AC_CHECK_HEADERS(ldap.h, [],
                       [AC_MSG_ERROR([header file <ldap.h> is required for LDAP])])
   else
@@ -1086,6 +1093,7 @@
                       [AC_INCLUDES_DEFAULT
 #include <windows.h>
                       ])
+     AC_DEFINE([USE_MICROSOFT_LDAP], 1, [Defined when using Microsof LDAP])
   fi
 fi
 
@@ -1498,7 +1506,18 @@
 # We can test for libldap_r only after we know PTHREAD_LIBS
 if test "$with_ldap" = yes ; then
   _LIBS="$LIBS"
-  if test "$PORTNAME" != "win32"; then
+  if test "$with_mozldap" = "yes"; then
+    if test "$PORTNAME" != "win32"; then
+      mozlibname=ldap50
+    else
+      mozlibname=nsldap32v50
+    fi
+    AC_CHECK_LIB($mozlibname, ldap_bind, [],
+		 [AC_MSG_ERROR([library "$mozlibname" is required for Mozilla LDAP])],
+		 [$PTHREAD_CFLAGS $PTHREAD_LIBS $EXTRA_LDAP_LIBS])
+    LDAP_LIBS_FE="-l$mozlibname $EXTRA_LDAP_LIBS"
+    LDAP_LIBS_BE="-l$mozlibname $EXTRA_LDAP_LIBS"
+  elif test "$PORTNAME" != "win32"; then
     AC_CHECK_LIB(ldap, ldap_bind, [],
 		 [AC_MSG_ERROR([library 'ldap' is required for LDAP])],
 		 [$EXTRA_LDAP_LIBS])
diff --recursive -u misc/build/postgresql-9.1.1/src/backend/libpq/auth.c misc/build/postgresql-9.1.1.patched/src/backend/libpq/auth.c
--- misc/build/postgresql-9.1.1/src/backend/libpq/auth.c	2011-09-22 23:57:57.000000000 +0200
+++ misc/build/postgresql-9.1.1.patched/src/backend/libpq/auth.c	2011-12-14 13:10:11.000000000 +0100
@@ -93,11 +93,7 @@
  *----------------------------------------------------------------
  */
 #ifdef USE_LDAP
-#ifndef WIN32
-/* We use a deprecated function to keep the codepath the same as win32. */
-#define LDAP_DEPRECATED 1
-#include <ldap.h>
-#else
+#ifdef USE_MICROSOFT_LDAP
 #include <winldap.h>
 
 /* Correct header from the Platform SDK */
@@ -109,6 +105,10 @@
 										   IN PLDAPControlA * ServerControls,
 											IN PLDAPControlA * ClientControls
 );
+#else
+/* We use a deprecated function to keep the codepath the same as win32. */
+#define LDAP_DEPRECATED 1
+#include <ldap.h>
 #endif
 
 static int	CheckLDAPAuth(Port *port);
@@ -2043,7 +2043,7 @@
 	*ldap = ldap_init(port->hba->ldapserver, port->hba->ldapport);
 	if (!*ldap)
 	{
-#ifndef WIN32
+#ifndef USE_MICROSOFT_LDAP
 		ereport(LOG,
 				(errmsg("could not initialize LDAP: error code %d",
 						errno)));
@@ -2065,7 +2065,7 @@
 
 	if (port->hba->ldaptls)
 	{
-#ifndef WIN32
+#ifndef USE_MICROSOFT_LDAP
 		if ((r = ldap_start_tls_s(*ldap, NULL, NULL)) != LDAP_SUCCESS)
 #else
 		static __ldap_start_tls_sA _ldap_start_tls_sA = NULL;
diff --recursive -u misc/build/postgresql-9.1.1/src/interfaces/libpq/fe-connect.c misc/build/postgresql-9.1.1.patched/src/interfaces/libpq/fe-connect.c
--- misc/build/postgresql-9.1.1/src/interfaces/libpq/fe-connect.c	2011-09-22 23:57:57.000000000 +0200
+++ misc/build/postgresql-9.1.1.patched/src/interfaces/libpq/fe-connect.c	2011-12-14 13:10:11.000000000 +0100
@@ -60,7 +60,7 @@
 #endif
 
 #ifdef USE_LDAP
-#ifdef WIN32
+#ifdef USE_MICROSOFT_LDAP
 #include <winldap.h>
 #else
 /* OpenLDAP deprecates RFC 1823, but we want standard conformance */
diff --recursive -u misc/build/postgresql-9.1.1/src/interfaces/libpq/win32.mak misc/build/postgresql-9.1.1.patched/src/interfaces/libpq/win32.mak
--- misc/build/postgresql-9.1.1/src/interfaces/libpq/win32.mak	2011-09-22 23:57:57.000000000 +0200
+++ misc/build/postgresql-9.1.1.patched/src/interfaces/libpq/win32.mak	2011-12-14 13:11:25.000000000 +0100
@@ -4,6 +4,8 @@
 #        and a dynamic library libpq(d).dll with import library libpq(d)dll.lib
 # USE_SSL=1 will compile with OpenSSL
 # USE_KFW=1 will compile with kfw(kerberos for Windows)
+# USE_LDAP=1 will compile with LDAP support
+# USE_MOZLDAP=1 when LDAP is enabled, use Mozilla LDAP C SDK instead of Microsoft LDAP
 # DEBUG=1 compiles with debugging symbols
 # ENABLE_THREAD_SAFETY=1 compiles with threading enabled
 
@@ -58,6 +60,16 @@
 !MESSAGE Using default Kerberos Library directory: $(KFW_LIB_PATH)
 !ENDIF
 
+!IF "$(MOZLDAP_INC)" == ""
+MOZLDAP_INC=C:\ldapcsdk-6.0.7\include
+!MESSAGE Using default Mozilla LDAP Include directory: $(MOZLDAP_INC)
+!ENDIF
+
+!IF "$(MOZLDAP_LIB_PATH)" == ""
+MOZLDAP_PATH=C:\ldapcsdk-6.0.7\lib
+!MESSAGE Using default Mozilla LDAP Library directory: $(MOZLDAP_LIB_PATH)
+!ENDIF
+
 !IF "$(OS)" == "Windows_NT"
 NULL=
 !ELSE
@@ -178,7 +190,9 @@
 "$(OUTDIR)" :
     if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
 
-CPP_PROJ=/nologo /W3 /EHsc $(OPT) /I "..\..\include" /I "..\..\include\port\win32" /I "..\..\include\port\win32_msvc" /I "..\..\port" /I. /I "$(SSL_INC)" \
+CPP_PROJ=/nologo /W3 /EHsc $(OPT) \
+ /I "..\..\include" /I "..\..\include\port\win32" /I "..\..\include\port\win32_msvc" \
+ /I "..\..\port" /I. /I "$(SSL_INC)" /I "$(KFW_INC)" /I "$(MOZLDAP_INC)" \
  /D "FRONTEND" $(DEBUGDEF) \
  /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\libpq.pch" \
  /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c  \
@@ -189,6 +203,17 @@
 SSL_LIBS=ssleay32.lib libeay32.lib gdi32.lib
 !ENDIF
 
+!IFDEF USE_LDAP
+CPP_PROJ=$(CPP_PROJ) /D USE_LDAP
+!IFDEF USE_MOZLDAP
+CPP_PROJ=$(CPP_PROJ) /D USE_MOZLDAP
+LDAP_LIBS=nsldap32v50.lib
+!ELSE
+CPP_PROJ=$(CPP_PROJ) /D USE_MICROSOFT_LDAP
+LDAP_LIBS=wldap32.lib
+!ENDIF
+!ENDIF # DEFINED(USE_LDAP)
+
 !IFDEF USE_KFW
 CPP_PROJ=$(CPP_PROJ) /D KRB5
 KFW_LIBS=krb5_32.lib comerr32.lib gssapi32.lib
@@ -203,12 +228,12 @@
 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 wsock32.lib ws2_32.lib secur32.lib $(SSL_LIBS) $(LDAP_LIBS) $(KFW_LIBS) $(ADD_SECLIB) \
  /nologo /subsystem:windows /dll $(LOPT) /incremental:no \
  /pdb:"$(OUTDIR)\libpqdll.pdb" /machine:$(CPU) \
  /out:"$(OUTDIR)\$(OUTFILENAME).dll"\
  /implib:"$(OUTDIR)\$(OUTFILENAME)dll.lib"  \
- /libpath:"$(SSL_LIB_PATH)" /libpath:"$(KFW_LIB_PATH)" \
+ /libpath:"$(SSL_LIB_PATH)" /libpath:"$(KFW_LIB_PATH)" /libpath:"$(MOZLDAP_LIB_PATH)" \
  /def:$(OUTFILENAME)dll.def
 LINK32_OBJS= \
 	"$(OUTDIR)\$(OUTFILENAME).lib" \
diff --recursive -u misc/build/postgresql-9.1.1/src/tools/msvc/config_default.pl misc/build/postgresql-9.1.1.patched/src/tools/msvc/config_default.pl
--- misc/build/postgresql-9.1.1/src/tools/msvc/config_default.pl	2011-09-22 23:57:57.000000000 +0200
+++ misc/build/postgresql-9.1.1.patched/src/tools/msvc/config_default.pl	2011-12-14 13:10:11.000000000 +0100
@@ -11,6 +11,7 @@
     # wal_blocksize => 8,     # --with-wal-blocksize, 8kB by default
     # wal_segsize => 16,      # --with-wal-segsize, 16MB by default
     ldap=>1,				# --with-ldap
+    # mozldap=>1,			# --with-mozldap, off by default
     nls=>undef,				# --enable-nls=<path>
     tcl=>undef,				# --with-tls=<path>
     perl=>undef, 			# --with-perl
diff --recursive -u misc/build/postgresql-9.1.1/src/tools/msvc/Mkvcbuild.pm misc/build/postgresql-9.1.1.patched/src/tools/msvc/Mkvcbuild.pm
--- misc/build/postgresql-9.1.1/src/tools/msvc/Mkvcbuild.pm	2011-09-22 23:57:57.000000000 +0200
+++ misc/build/postgresql-9.1.1.patched/src/tools/msvc/Mkvcbuild.pm	2011-12-14 13:10:11.000000000 +0100
@@ -78,7 +78,8 @@
     $postgres->AddLibrary('wsock32.lib');
     $postgres->AddLibrary('ws2_32.lib');
     $postgres->AddLibrary('secur32.lib');
-    $postgres->AddLibrary('wldap32.lib') if ($solution->{options}->{ldap});
+    $postgres->AddLibrary('wldap32.lib') if ($solution->{options}->{ldap} && ! $solution->{options}->{mozldap});
+    $postgres->AddLibrary('nsldap32v50.lib') if ($solution->{options}->{ldap} && $solution->{options}->{mozldap});
     $postgres->FullExportDLL('postgres.lib');
 
     my $snowball = $solution->AddProject('dict_snowball','dll','','src\backend\snowball');
diff --recursive -u misc/build/postgresql-9.1.1/src/tools/msvc/Solution.pm misc/build/postgresql-9.1.1.patched/src/tools/msvc/Solution.pm
--- misc/build/postgresql-9.1.1/src/tools/msvc/Solution.pm	2011-09-22 23:57:57.000000000 +0200
+++ misc/build/postgresql-9.1.1.patched/src/tools/msvc/Solution.pm	2011-12-14 13:10:11.000000000 +0100
@@ -174,6 +174,8 @@
         print O "#define USE_ASSERT_CHECKING 1\n" if ($self->{options}->{asserts});
         print O "#define USE_INTEGER_DATETIMES 1\n" if ($self->{options}->{integer_datetimes});
         print O "#define USE_LDAP 1\n" if ($self->{options}->{ldap});
+        print O "#define USE_MICROSOFT_LDAP 1\n" if ( ! $self->{options}->{mozldap});
+        print O "#define USE_MOZLDAP 1\n" if ($self->{options}->{mozldap});
         print O "#define HAVE_LIBZ 1\n" if ($self->{options}->{zlib});
         print O "#define USE_SSL 1\n" if ($self->{options}->{openssl});
         print O "#define ENABLE_NLS 1\n" if ($self->{options}->{nls});
@@ -559,6 +561,7 @@
     $cfg .= ' --enable-integer-datetimes' if ($self->{options}->{integer_datetimes});
     $cfg .= ' --enable-nls' if ($self->{options}->{nls});
     $cfg .= ' --with-ldap' if ($self->{options}->{ldap});
+    $cfg .= ' --with-mozldap' if ($self->{options}->{mozldap});
     $cfg .= ' --without-zlib' unless ($self->{options}->{zlib});
     $cfg .= ' --with-openssl' if ($self->{options}->{ssl});
     $cfg .= ' --with-ossp-uuid' if ($self->{options}->{uuid});
#10Lionel Elie Mamane
lionel@mamane.lu
In reply to: Tom Lane (#8)
Re: LibreOffice driver 1: Building libpq with Mozilla LDAP instead of OpenLDAP

On Wed, Dec 14, 2011 at 10:05:26AM -0500, Tom Lane wrote:

Pavel Golub <pavel@microolap.com> writes:

You wrote:

TL> about OSX though. (You're aware that Apple ships a perfectly fine
TL> libpq.so in Lion, no?)

I've not made an attempt to use it directly myself, but it sure looks
like it should do what the OP wants.

Yes, it looks like that, except for being available on older MacOS X;
LibreOffice wished to stay compatible with 10.4.

--
Lionel