Thread: unixware and --with-ldap

unixware and --with-ldap

From
ohp@pyrenet.fr
Date:
Hi all,

When I swithed to the newest version og pgbuildfarm, I noticed that
--with-ldap (now by defaut) didn't work on UnixWare.

This is because, on Unixware, ldap needs lber and resolv.

Not being a configure guru, I made the change bellow locally and that
works for me.
Surely, one of you hackers can come up with a better solution!

*** configure.orig    lun déc 11 14:58:55 2006
--- configure    lun déc 11 15:22:06 2006
***************
*** 17185,17191 ****   echo $ECHO_N "(cached) $ECHO_C" >&6 else   ac_check_lib_save_LIBS=$LIBS
! LIBS="-lldap  $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h.  */ _ACEOF
--- 17185,17191 ----   echo $ECHO_N "(cached) $ECHO_C" >&6 else   ac_check_lib_save_LIBS=$LIBS
! LIBS="-lldap  -llber -lresolv $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h.  */ _ACEOF
***************
*** 17248,17254 **** #define HAVE_LIBLDAP 1 _ACEOF

!   LIBS="-lldap $LIBS"
 else   { { echo "$as_me:$LINENO: error: library 'ldap' is required for LDAP" >&5
--- 17248,17254 ---- #define HAVE_LIBLDAP 1 _ACEOF

!   LIBS="-lldap -llber -lresolv $LIBS"
 else   { { echo "$as_me:$LINENO: error: library 'ldap' is required for LDAP" >&5
***************
*** 17256,17262 ****    { (exit 1); exit 1; }; } fi

!     LDAP_LIBS_BE="-lldap"     if test "$enable_thread_safety" = yes; then       # on some platforms ldap_r fails to
linkwithout PTHREAD_LIBS
 

--- 17256,17262 ----    { (exit 1); exit 1; }; } fi

!     LDAP_LIBS_BE="-lldap -llber -lresolv"     if test "$enable_thread_safety" = yes; then       # on some platforms
ldap_rfails to link without PTHREAD_LIBS
 

***************
*** 17339,17345 ****
       LDAP_LIBS_FE="-lldap_r"     else
!       LDAP_LIBS_FE="-lldap"     fi   else

--- 17339,17345 ----
       LDAP_LIBS_FE="-lldap_r"     else
!       LDAP_LIBS_FE="-lldap -llber -lresolv"     fi   else

When I have time, I intend to update the SCO FAQ  if someone can tell me
what should be in...

Many  thanks for the great release!!!
-- 
Olivier PRENANT                    Tel: +33-5-61-50-97-00 (Work)
15, Chemin des Monges                +33-5-61-50-97-01 (Fax)
31190 AUTERIVE                       +33-6-07-63-80-64 (GSM)
FRANCE                          Email: ohp@pyrenet.fr
------------------------------------------------------------------------------
Make your life a dream, make your dream a reality. (St Exupery)


Re: unixware and --with-ldap

From
Andrew Dunstan
Date:
ohp@pyrenet.fr wrote:
> Hi all,
>
> When I swithed to the newest version og pgbuildfarm, I noticed that
> --with-ldap (now by defaut) didn't work on UnixWare.
>
> This is because, on Unixware, ldap needs lber and resolv.
>
> Not being a configure guru, I made the change bellow locally and that
> works for me.
> Surely, one of you hackers can come up with a better solution!
>
>   


If you mangle the source tree buildfarm will usually refuse to run. In 
any case, we certainly can't hack the configure script - it is 
autogenerated.

The right way to do this I think is to put an entry adjusting LIBS in 
src/makefiles/Makefile.unixware, but first it looks like we need to 
propagate the with-ldap switch into src/Makefile.global

cheers

andrew


Re: unixware and --with-ldap

From
ohp@pyrenet.fr
Date:
Thanks for replying,

You are right but I have no knowedge  on howto popagate this to
Makefile.unixware.

On Mon, 11 Dec 2006, Andrew Dunstan wrote:

> Date: Mon, 11 Dec 2006 10:03:04 -0500
> From: Andrew Dunstan <andrew@dunslane.net>
> To: ohp@pyrenet.fr
> Cc: pgsql-hackers list <pgsql-hackers@postgresql.org>
> Subject: Re: [HACKERS] unixware and --with-ldap
>
> ohp@pyrenet.fr wrote:
> > Hi all,
> >
> > When I swithed to the newest version og pgbuildfarm, I noticed that
> > --with-ldap (now by defaut) didn't work on UnixWare.
> >
> > This is because, on Unixware, ldap needs lber and resolv.
> >
> > Not being a configure guru, I made the change bellow locally and that
> > works for me.
> > Surely, one of you hackers can come up with a better solution!
> >
> >
>
>
> If you mangle the source tree buildfarm will usually refuse to run. In
> any case, we certainly can't hack the configure script - it is
> autogenerated.
I did'nt touch any thing on buildfarm,  I worked on a fresh cvs update...
>
> The right way to do this I think is to put an entry adjusting LIBS in
> src/makefiles/Makefile.unixware, but first it looks like we need to
> propagate the with-ldap switch into src/Makefile.global
>
> cheers
>
> andrew
>

-- 
Olivier PRENANT                    Tel: +33-5-61-50-97-00 (Work)
15, Chemin des Monges                +33-5-61-50-97-01 (Fax)
31190 AUTERIVE                       +33-6-07-63-80-64 (GSM)
FRANCE                          Email: ohp@pyrenet.fr
------------------------------------------------------------------------------
Make your life a dream, make your dream a reality. (St Exupery)


Re: unixware and --with-ldap

From
Tom Lane
Date:
Andrew Dunstan <andrew@dunslane.net> writes:
> The right way to do this I think is to put an entry adjusting LIBS in 
> src/makefiles/Makefile.unixware, but first it looks like we need to 
> propagate the with-ldap switch into src/Makefile.global

The Makefile is far too late --- this has to be adjusted at configure
time, else configure will conclude that libldap isn't available.
(I assume that Unixware's linker is sane enough that the link test
will fail without the supporting libraries.)

I'd be inclined to do something like add
EXTRA_LDAP_LIBS="-llber -lresolv"

in src/template/unixware, and then in configure.in add this where
needed:

if test "$with_ldap" = yes ; then _LIBS="$LIBS" if test "$PORTNAME" != "win32"; then   AC_CHECK_LIB(ldap, ldap_bind,
[$EXTRA_LDAP_LIBS],[AC_MSG_ERROR([library 'ldap' is required for LDAP])])   LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"   if
test"$enable_thread_safety" = yes; then     # on some platforms ldap_r fails to link without PTHREAD_LIBS
AC_CHECK_LIB(ldap_r,ldap_simple_bind, [$EXTRA_LDAP_LIBS],       [AC_MSG_ERROR([library 'ldap_r' is required for
LDAP])],      [$PTHREAD_LIBS])     LDAP_LIBS_FE="-lldap_r $EXTRA_LDAP_LIBS"   else     LDAP_LIBS_FE="-lldap
$EXTRA_LDAP_LIBS"  fi else   AC_CHECK_LIB(wldap32, ldap_bind, [], [AC_MSG_ERROR([library 'wldap32' is required for
LDAP])])  LDAP_LIBS_FE="-lwldap32"   LDAP_LIBS_BE="-lwldap32" fi LIBS="$_LIBS"
 
fi

I'm not in a position to test that though ...
        regards, tom lane


Re: unixware and --with-ldap

From
ohp@pyrenet.fr
Date:
Hi Tom,

Thanks for your help,
I will try it ASAP and report maybe tonighgt CET.
Also, Makefile.port needs a little patch that I'll send to.
On Mon, 11 Dec 2006, Tom Lane wrote:

> Date: Mon, 11 Dec 2006 11:26:14 -0500
> From: Tom Lane <tgl@sss.pgh.pa.us>
> To: Andrew Dunstan <andrew@dunslane.net>
> Cc: ohp@pyrenet.fr, pgsql-hackers list <pgsql-hackers@postgresql.org>
> Subject: Re: [HACKERS] unixware and --with-ldap
>
> Andrew Dunstan <andrew@dunslane.net> writes:
> > The right way to do this I think is to put an entry adjusting LIBS in
> > src/makefiles/Makefile.unixware, but first it looks like we need to
> > propagate the with-ldap switch into src/Makefile.global
>
> The Makefile is far too late --- this has to be adjusted at configure
> time, else configure will conclude that libldap isn't available.
> (I assume that Unixware's linker is sane enough that the link test
> will fail without the supporting libraries.)
>
> I'd be inclined to do something like add
>
>     EXTRA_LDAP_LIBS="-llber -lresolv"
>
> in src/template/unixware, and then in configure.in add this where
> needed:
>
> if test "$with_ldap" = yes ; then
>   _LIBS="$LIBS"
>   if test "$PORTNAME" != "win32"; then
>     AC_CHECK_LIB(ldap, ldap_bind, [$EXTRA_LDAP_LIBS], [AC_MSG_ERROR([library 'ldap' is required for LDAP])])
>     LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
>     if test "$enable_thread_safety" = yes; then
>       # on some platforms ldap_r fails to link without PTHREAD_LIBS
>       AC_CHECK_LIB(ldap_r, ldap_simple_bind, [$EXTRA_LDAP_LIBS],
>            [AC_MSG_ERROR([library 'ldap_r' is required for LDAP])],
>            [$PTHREAD_LIBS])
>       LDAP_LIBS_FE="-lldap_r $EXTRA_LDAP_LIBS"
>     else
>       LDAP_LIBS_FE="-lldap $EXTRA_LDAP_LIBS"
>     fi
>   else
>     AC_CHECK_LIB(wldap32, ldap_bind, [], [AC_MSG_ERROR([library 'wldap32' is required for LDAP])])
>     LDAP_LIBS_FE="-lwldap32"
>     LDAP_LIBS_BE="-lwldap32"
>   fi
>   LIBS="$_LIBS"
> fi
>
> I'm not in a position to test that though ...
>
>             regards, tom lane
>

-- 
Olivier PRENANT                    Tel: +33-5-61-50-97-00 (Work)
15, Chemin des Monges                +33-5-61-50-97-01 (Fax)
31190 AUTERIVE                       +33-6-07-63-80-64 (GSM)
FRANCE                          Email: ohp@pyrenet.fr
------------------------------------------------------------------------------
Make your life a dream, make your dream a reality. (St Exupery)


Re: unixware and --with-ldap

From
"Albe Laurenz"
Date:
Olivier PRENANT wrote:

> When I swithed to the newest version og pgbuildfarm, I noticed that
> --with-ldap (now by defaut) didn't work on UnixWare.
>
> This is because, on Unixware, ldap needs lber and resolv.

Is libldap a static library on that system?

Or do shared libraries on Unixware generally 'not remember'
the libraries they were linked against (this would be strange).

Or was libldap not linked against liblber and libresolv?

Tom Lane suggested to change configure.in like this:

>       AC_CHECK_LIB(ldap_r, ldap_simple_bind, [$EXTRA_LDAP_LIBS],
>            [AC_MSG_ERROR([library 'ldap_r' is required for
LDAP])],
>            [$PTHREAD_LIBS])

Shouldn't that be
     AC_CHECK_LIB(ldap_r, ldap_simple_bind, [],       [AC_MSG_ERROR([library 'ldap_r' is required for
LDAP])],       [$PTHREAD_LIBS $EXTRA_LDAP_LIBS])

Yours,
Laurenz Albe


Re: unixware and --with-ldap

From
Tom Lane
Date:
"Albe Laurenz" <all@adv.magwien.gv.at> writes:
> Shouldn't that be
>       AC_CHECK_LIB(ldap_r, ldap_simple_bind, [],
>            [AC_MSG_ERROR([library 'ldap_r' is required for
> LDAP])],
>            [$PTHREAD_LIBS $EXTRA_LDAP_LIBS])

Ooops, of course.  Like I said, untested ;-)
        regards, tom lane


Re: unixware and --with-ldap

From
Martijn van Oosterhout
Date:
On Tue, Dec 12, 2006 at 04:42:50PM +0100, Albe Laurenz wrote:
> Or do shared libraries on Unixware generally 'not remember'
> the libraries they were linked against (this would be strange).

It could be that whoever compiled libldap there did not include the
dependancies at link time. It is legal to build a shared library
without resolving all the symbols.

libreadline was for a long time in the same position on many linux
distributions. The upstream makefile did not specify -lncurses or
-ltermcap so every user of readline had to specify that, rather than
getting it automatically.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Re: unixware and --with-ldap

From
ohp@pyrenet.fr
Date:
On Tue, 12 Dec 2006, Albe Laurenz wrote:

> Date: Tue, 12 Dec 2006 16:42:50 +0100
> From: Albe Laurenz <all@adv.magwien.gv.at>
> To: ohp@pyrenet.fr, pgsql-hackers list <pgsql-hackers@postgresql.org>,
>      tgl@sss.pgh.pa.us
> Subject: RE: [HACKERS] unixware and --with-ldap
>
> Olivier PRENANT wrote:
>
> > When I swithed to the newest version og pgbuildfarm, I noticed that
> > --with-ldap (now by defaut) didn't work on UnixWare.
> >
> > This is because, on Unixware, ldap needs lber and resolv.
>
> Is libldap a static library on that system?
No
>
> Or do shared libraries on Unixware generally 'not remember'
> the libraries they were linked against (this would be strange).
>
Hmm Somtimes
> Or was libldap not linked against liblber and libresolv?
>
Dunno!
Did'nt do it myself,  it comes with the system
> Tom Lane suggested to change configure.in like this:
>
> >       AC_CHECK_LIB(ldap_r, ldap_simple_bind, [$EXTRA_LDAP_LIBS],
> >            [AC_MSG_ERROR([library 'ldap_r' is required for
> LDAP])],
> >            [$PTHREAD_LIBS])
>
> Shouldn't that be
>
>       AC_CHECK_LIB(ldap_r, ldap_simple_bind, [],
>            [AC_MSG_ERROR([library 'ldap_r' is required for
> LDAP])],
>            [$PTHREAD_LIBS $EXTRA_LDAP_LIBS])
>
> Yours,
> Laurenz Albe
>

-- 
Olivier PRENANT                    Tel: +33-5-61-50-97-00 (Work)
15, Chemin des Monges                +33-5-61-50-97-01 (Fax)
31190 AUTERIVE                       +33-6-07-63-80-64 (GSM)
FRANCE                          Email: ohp@pyrenet.fr
------------------------------------------------------------------------------
Make your life a dream, make your dream a reality. (St Exupery)


Re: unixware and --with-ldap

From
ohp@pyrenet.fr
Date:
Hi Tom,

I was in the process of testing this. But I believe tweaking with
configure.in will not help me as I have no way to regenerate configure...

Please advise.

Best regards,
On Tue, 12 Dec 2006, Tom Lane wrote:

> Date: Tue, 12 Dec 2006 11:04:08 -0500
> From: Tom Lane <tgl@sss.pgh.pa.us>
> To: Albe Laurenz <all@adv.magwien.gv.at>
> Cc: ohp@pyrenet.fr, pgsql-hackers list <pgsql-hackers@postgresql.org>
> Subject: Re: [HACKERS] unixware and --with-ldap
>
> "Albe Laurenz" <all@adv.magwien.gv.at> writes:
> > Shouldn't that be
> >       AC_CHECK_LIB(ldap_r, ldap_simple_bind, [],
> >            [AC_MSG_ERROR([library 'ldap_r' is required for
> > LDAP])],
> >            [$PTHREAD_LIBS $EXTRA_LDAP_LIBS])
>
> Ooops, of course.  Like I said, untested ;-)
>
>             regards, tom lane
>

-- 
Olivier PRENANT                    Tel: +33-5-61-50-97-00 (Work)
15, Chemin des Monges                +33-5-61-50-97-01 (Fax)
31190 AUTERIVE                       +33-6-07-63-80-64 (GSM)
FRANCE                          Email: ohp@pyrenet.fr
------------------------------------------------------------------------------
Make your life a dream, make your dream a reality. (St Exupery)


Re: unixware and --with-ldap

From
Tom Lane
Date:
ohp@pyrenet.fr writes:
> I was in the process of testing this. But I believe tweaking with
> configure.in will not help me as I have no way to regenerate configure...

Install autoconf; it's no big deal.
        regards, tom lane


Re: unixware and --with-ldap

From
"Albe Laurenz"
Date:
Olivier PRENANT wrote:
>>> When I swithed to the newest version og pgbuildfarm, I noticed that
>>> --with-ldap (now by defaut) didn't work on UnixWare.
>>>
>>> This is because, on Unixware, ldap needs lber and resolv.
>>
>> Or was libldap not linked against liblber and libresolv?
>
> Dunno!
> Did'nt do it myself,  it comes with the system

What does 'ldd libldap.so' show?

Yours,
Laurenz Albe


Re: unixware and --with-ldap

From
ohp@pyrenet.fr
Date:
Dear Tom,

Thanks for you advice.

Here's the diff for configure.in that works for me.
Best regards

---
*** configure.in.orig    jeu déc 14 18:35:27 2006
--- configure.in    jeu déc 14 18:35:37 2006
***************
*** 1122,1137 **** if test "$with_ldap" = yes ; then   _LIBS="$LIBS"   if test "$PORTNAME" != "win32"; then
!     AC_CHECK_LIB(ldap, ldap_bind, [], [AC_MSG_ERROR([library 'ldap' is required for LDAP])])
!     LDAP_LIBS_BE="-lldap"     if test "$enable_thread_safety" = yes; then       # on some platforms ldap_r fails to
linkwithout PTHREAD_LIBS       AC_CHECK_LIB(ldap_r, ldap_simple_bind, [],            [AC_MSG_ERROR([library 'ldap_r' is
requiredfor LDAP])],
 
!            [$PTHREAD_LIBS])       LDAP_LIBS_FE="-lldap_r"     else
!       LDAP_LIBS_FE="-lldap"     fi   else     AC_CHECK_LIB(wldap32, ldap_bind, [], [AC_MSG_ERROR([library 'wldap32'
isrequired for LDAP])])
 
--- 1122,1139 ---- if test "$with_ldap" = yes ; then   _LIBS="$LIBS"   if test "$PORTNAME" != "win32"; then
!     AC_CHECK_LIB(ldap, ldap_bind, [],
!     [AC_MSG_ERROR([library 'ldap' is required for LDAP])],
!     [$EXTRA_LDAP_LIBS])
!     LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"     if test "$enable_thread_safety" = yes; then       # on some platforms
ldap_rfails to link without PTHREAD_LIBS       AC_CHECK_LIB(ldap_r, ldap_simple_bind, [],
[AC_MSG_ERROR([library'ldap_r' is required for LDAP])],
 
!            [$PTHREAD_LIBS $EXTRA_LDAP_LIBS])       LDAP_LIBS_FE="-lldap_r"     else
!       LDAP_LIBS_FE="-lldap $EXTRA_LDAP_LIBS"     fi   else     AC_CHECK_LIB(wldap32, ldap_bind, [],
[AC_MSG_ERROR([library'wldap32' is required for LDAP])])
 

On Mon, 11 Dec 2006, Tom Lane wrote:

> Date: Mon, 11 Dec 2006 11:26:14 -0500
> From: Tom Lane <tgl@sss.pgh.pa.us>
> To: Andrew Dunstan <andrew@dunslane.net>
> Cc: ohp@pyrenet.fr, pgsql-hackers list <pgsql-hackers@postgresql.org>
> Subject: Re: [HACKERS] unixware and --with-ldap
>
> Andrew Dunstan <andrew@dunslane.net> writes:
> > The right way to do this I think is to put an entry adjusting LIBS in
> > src/makefiles/Makefile.unixware, but first it looks like we need to
> > propagate the with-ldap switch into src/Makefile.global
>
> The Makefile is far too late --- this has to be adjusted at configure
> time, else configure will conclude that libldap isn't available.
> (I assume that Unixware's linker is sane enough that the link test
> will fail without the supporting libraries.)
>
> I'd be inclined to do something like add
>
>     EXTRA_LDAP_LIBS="-llber -lresolv"
>
> in src/template/unixware, and then in configure.in add this where
> needed:
>
> if test "$with_ldap" = yes ; then
>   _LIBS="$LIBS"
>   if test "$PORTNAME" != "win32"; then
>     AC_CHECK_LIB(ldap, ldap_bind, [$EXTRA_LDAP_LIBS], [AC_MSG_ERROR([library 'ldap' is required for LDAP])])
>     LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
>     if test "$enable_thread_safety" = yes; then
>       # on some platforms ldap_r fails to link without PTHREAD_LIBS
>       AC_CHECK_LIB(ldap_r, ldap_simple_bind, [$EXTRA_LDAP_LIBS],
>            [AC_MSG_ERROR([library 'ldap_r' is required for LDAP])],
>            [$PTHREAD_LIBS])
>       LDAP_LIBS_FE="-lldap_r $EXTRA_LDAP_LIBS"
>     else
>       LDAP_LIBS_FE="-lldap $EXTRA_LDAP_LIBS"
>     fi
>   else
>     AC_CHECK_LIB(wldap32, ldap_bind, [], [AC_MSG_ERROR([library 'wldap32' is required for LDAP])])
>     LDAP_LIBS_FE="-lwldap32"
>     LDAP_LIBS_BE="-lwldap32"
>   fi
>   LIBS="$_LIBS"
> fi
>
> I'm not in a position to test that though ...
>
>             regards, tom lane
>

-- 
Olivier PRENANT                    Tel: +33-5-61-50-97-00 (Work)
15, Chemin des Monges                +33-5-61-50-97-01 (Fax)
31190 AUTERIVE                       +33-6-07-63-80-64 (GSM)
FRANCE                          Email: ohp@pyrenet.fr
------------------------------------------------------------------------------
Make your life a dream, make your dream a reality. (St Exupery)


Re: unixware and --with-ldap

From
Tom Lane
Date:
ohp@pyrenet.fr writes:
> Here's the diff for configure.in that works for me.

Applied, thanks.
        regards, tom lane


Re: unixware and --with-ldap

From
"Albe Laurenz"
Date:
> Here's the diff for configure.in that works for me.

I have a concern about this patch:

>       if test "$enable_thread_safety" = yes; then
>         # on some platforms ldap_r fails to link without PTHREAD_LIBS
>         AC_CHECK_LIB(ldap_r, ldap_simple_bind, [],
>              [AC_MSG_ERROR([library 'ldap_r' is required for
LDAP])],
> !            [$PTHREAD_LIBS])
>         LDAP_LIBS_FE="-lldap_r"
>       else
> !       LDAP_LIBS_FE="-lldap"
>       fi
> --- 1122,1139 ----
>       if test "$enable_thread_safety" = yes; then
>         # on some platforms ldap_r fails to link without PTHREAD_LIBS
>         AC_CHECK_LIB(ldap_r, ldap_simple_bind, [],
>              [AC_MSG_ERROR([library 'ldap_r' is required for
LDAP])],
> !            [$PTHREAD_LIBS $EXTRA_LDAP_LIBS])
>         LDAP_LIBS_FE="-lldap_r"
>       else
> !       LDAP_LIBS_FE="-lldap $EXTRA_LDAP_LIBS"
>       fi

You left out the case where --enable_thread_safety is specified.
In that case, the frontend has to be linked with libldap_r.so
instead of libldap.so.

Does libldap_r.so _not_ require any extra libraries for linking?

If it does require extra libraries, are they the same as for the
thread-unsafe library (on Linux, that is the case)?

If libldap_r.so does require the same libs, please add $EXTRA_LDAP_LIBS
to the 'LDAP_LIBS_FE="-lldap_r"' line as well.

If libldap_r.so requires different additional libraries, a second
variable would be in place.

Could you test compiling with --enable_thread_safety ?

Yours,
Laurenz Albe


Re: unixware and --with-ldap

From
ohp@pyrenet.fr
Date:
Hi Albe,
Thanks for your remarks
On Fri, 15 Dec 2006, Albe Laurenz wrote:

> Date: Fri, 15 Dec 2006 09:54:13 +0100
> From: Albe Laurenz <all@adv.magwien.gv.at>
> To: ohp@pyrenet.fr, Tom Lane <tgl@sss.pgh.pa.us>
> Cc: pgsql-hackers list <pgsql-hackers@postgresql.org>
> Subject: RE: [HACKERS] unixware and --with-ldap
>
> > Here's the diff for configure.in that works for me.
>
> I have a concern about this patch:
>
I agree
> >       if test "$enable_thread_safety" = yes; then
> >         # on some platforms ldap_r fails to link without PTHREAD_LIBS
> >         AC_CHECK_LIB(ldap_r, ldap_simple_bind, [],
> >              [AC_MSG_ERROR([library 'ldap_r' is required for
> LDAP])],
> > !            [$PTHREAD_LIBS])
> >         LDAP_LIBS_FE="-lldap_r"
> >       else
> > !       LDAP_LIBS_FE="-lldap"
> >       fi
> > --- 1122,1139 ----
> >       if test "$enable_thread_safety" = yes; then
> >         # on some platforms ldap_r fails to link without PTHREAD_LIBS
> >         AC_CHECK_LIB(ldap_r, ldap_simple_bind, [],
> >              [AC_MSG_ERROR([library 'ldap_r' is required for
> LDAP])],
> > !            [$PTHREAD_LIBS $EXTRA_LDAP_LIBS])
> >         LDAP_LIBS_FE="-lldap_r"
> >       else
> > !       LDAP_LIBS_FE="-lldap $EXTRA_LDAP_LIBS"
> >       fi
>
> You left out the case where --enable_thread_safety is specified.
> In that case, the frontend has to be linked with libldap_r.so
> instead of libldap.so.
>
Yes, this was on purpose, my goal is to try to make a second patch when...
> Does libldap_r.so _not_ require any extra libraries for linking?
>
I don't know, hence the mid-patch
> If it does require extra libraries, are they the same as for the
> thread-unsafe library (on Linux, that is the case)?
>
Not sure what you mean
> If libldap_r.so does require the same libs, please add $EXTRA_LDAP_LIBS
> to the 'LDAP_LIBS_FE="-lldap_r"' line as well.
>
Will do
> If libldap_r.so requires different additional libraries, a second
> variable would be in place.
>
OF course
> Could you test compiling with --enable_thread_safety ?
>
Will do, but keep in mind that --enable_thread_safety doesn't work too
well for unixware (see template/Makefile.unixware)
However, if someone can help me, I'd love to fix the problem
> Yours,
> Laurenz Albe
>
Best regards
-- 
Olivier PRENANT                    Tel: +33-5-61-50-97-00 (Work)
15, Chemin des Monges                +33-5-61-50-97-01 (Fax)
31190 AUTERIVE                       +33-6-07-63-80-64 (GSM)
FRANCE                          Email: ohp@pyrenet.fr
------------------------------------------------------------------------------
Make your life a dream, make your dream a reality. (St Exupery)


Re: unixware and --with-ldap

From
"Albe Laurenz"
Date:
Olivier PRENANT wrote:

>> You left out the case where --enable_thread_safety is specified.
>> In that case, the frontend has to be linked with libldap_r.so
>> instead of libldap.so.
>
> Yes, this was on purpose, my goal is to try to make a second
> patch when...
>
>> Does libldap_r.so _not_ require any extra libraries for linking?
>
> I don't know, hence the mid-patch

I see.

>> If it does require extra libraries, are they the same as for the
>> thread-unsafe library (on Linux, that is the case)?
>
> Not sure what you mean

I mean, will-lldap_r -llber -lresolv
work, or do you need something else (liblber_r.so or whatever).

> > Could you test compiling with --enable_thread_safety ?
>
> Will do, but keep in mind that --enable_thread_safety doesn't work too
> well for unixware (see template/Makefile.unixware)

> However, if someone can help me, I'd love to fix the problem

I don't know anything about Unixware.
I don't suggest that anybody should use --enable_thread_safety
on Unixware, but I think it should at least compile cleanly if
possible.

I guess that adding $EXTRA_LDAP_LIBS to -lldap_r will be enough,
judging from the evidence on Linux.

Yours,
Laurenz Albe


Re: unixware and --with-ldap

From
Martijn van Oosterhout
Date:
On Fri, Dec 15, 2006 at 01:06:08PM +0100, Albe Laurenz wrote:
> I guess that adding $EXTRA_LDAP_LIBS to -lldap_r will be enough,
> judging from the evidence on Linux.

Linux doesn't need the extra libraries, it's linked properly.

Additionally, on Linux there is no difference between ldap and ldap_r,
they're the same file (at least here).

$ ls -l /usr/lib/libldap.so.2
lrwxrwxrwx 1 root root     14 2005-06-09 10:42 /usr/lib/libldap.so.2 -> libldap_r.so.2

Just make sure you don't add unnecessary dependancies for platforms
other than unixware.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Re: unixware and --with-ldap

From
"Albe Laurenz"
Date:
Martijn van Oosterhout wrote:
>> I guess that adding $EXTRA_LDAP_LIBS to -lldap_r will be enough,
>> judging from the evidence on Linux.
>
> Linux doesn't need the extra libraries, it's linked properly.

Yes - what I mean is, libldap_r.so references only NEEDED      libsasl.so.7 NEEDED      libssl.so.4 NEEDED
libcrypto.so.4NEEDED      liblber.so.2 NEEDED      libc.so.6 
on my RedHat ES 3 Linux system (use objdump),
so I _GUESS_ that linking with $EXTRA_LDAP_LIBS might be
sufficient in the Unixware case.

> Additionally, on Linux there is no difference between ldap and ldap_r,
> they're the same file (at least here).
>
> $ ls -l /usr/lib/libldap.so.2
> lrwxrwxrwx 1 root root    14 2005-06-09 10:42 /usr/lib/libldap.so.2 ->
libldap_r.so.2

Not here:

-rwxr-xr-x    1 root     root       183752 Mar  2  2006
/usr/lib/libldap_r.so.2.0.17
-rwxr-xr-x    1 root     root       172500 Mar  2  2006
/usr/lib/libldap.so.2.0.17

(from RPM openldap-2.0.27-22 on RHES 3 x86).

> Just make sure you don't add unnecessary dependancies for platforms
> other than unixware.

IIRC, there will only be additions to Makefile.unixware

Yours,
Laurenz Albe


Re: unixware and --with-ldap

From
Tom Lane
Date:
"Albe Laurenz" <all@adv.magwien.gv.at> writes:
> You left out the case where --enable_thread_safety is specified.
> ...
> If libldap_r.so does require the same libs, please add $EXTRA_LDAP_LIBS
> to the 'LDAP_LIBS_FE="-lldap_r"' line as well.

Actually, I did that in the patch-as-committed.  It seems to me that
it's probably harmless even if not needed.
        regards, tom lane


Re: unixware and --with-ldap

From
ohp@pyrenet.fr
Date:
On Fri, 15 Dec 2006, Tom Lane wrote:

> Date: Fri, 15 Dec 2006 10:20:44 -0500
> From: Tom Lane <tgl@sss.pgh.pa.us>
> To: Albe Laurenz <all@adv.magwien.gv.at>
> Cc: ohp@pyrenet.fr, pgsql-hackers list <pgsql-hackers@postgresql.org>
> Subject: Re: [HACKERS] unixware and --with-ldap
>
> "Albe Laurenz" <all@adv.magwien.gv.at> writes:
> > You left out the case where --enable_thread_safety is specified.
> > ...
> > If libldap_r.so does require the same libs, please add $EXTRA_LDAP_LIBS
> > to the 'LDAP_LIBS_FE="-lldap_r"' line as well.
>
> Actually, I did that in the patch-as-committed.  It seems to me that
> it's probably harmless even if not needed.
>
>             regards, tom lane
>
I have tried --with-thread-safety and configure fails on ldap check
because for some reason CTHREAD_FLAGS (-Kpthread for UW) is missing
on compile command, although present before that. I can't find why

Best regards
-- 
Olivier PRENANT                    Tel: +33-5-61-50-97-00 (Work)
15, Chemin des Monges                +33-5-61-50-97-01 (Fax)
31190 AUTERIVE                       +33-6-07-63-80-64 (GSM)
FRANCE                          Email: ohp@pyrenet.fr
------------------------------------------------------------------------------
Make your life a dream, make your dream a reality. (St Exupery)


Re: unixware and --with-ldap

From
"Albe Laurenz"
Date:
>>> If libldap_r.so does require the same libs, please add
$EXTRA_LDAP_LIBS
>>> to the 'LDAP_LIBS_FE="-lldap_r"' line as well.
>>
>> Actually, I did that in the patch-as-committed.  It seems to me that
>> it's probably harmless even if not needed.
>
> I have tried --with-thread-safety and configure fails on ldap check
> because for some reason CTHREAD_FLAGS (-Kpthread for UW) is missing
> on compile command, although present before that. I can't find why

You mean PTHREAD_FLAGS, right?

If it is present in line 1118, it should also be present in line 1133.

Can you verify that the part on configure.in between 1065 and 1118,
-Kpthread is correctly set on Unixware?

If not, thread support for Unixware is probebly broken.

If yes, something strange is going on.

Yours,
Laurenz Albe


Re: unixware and --with-ldap

From
ohp@pyrenet.fr
Date:
Hi Albe,
On Mon, 18 Dec 2006, Albe Laurenz wrote:

> Date: Mon, 18 Dec 2006 09:31:35 +0100
> From: Albe Laurenz <all@adv.magwien.gv.at>
> To: ohp@pyrenet.fr, Tom Lane <tgl@sss.pgh.pa.us>
> Cc: pgsql-hackers list <pgsql-hackers@postgresql.org>
> Subject: RE: [HACKERS] unixware and --with-ldap
>
> >>> If libldap_r.so does require the same libs, please add
> $EXTRA_LDAP_LIBS
> >>> to the 'LDAP_LIBS_FE="-lldap_r"' line as well.
> >>
> >> Actually, I did that in the patch-as-committed.  It seems to me that
> >> it's probably harmless even if not needed.
> >
> > I have tried --with-thread-safety and configure fails on ldap check
> > because for some reason CTHREAD_FLAGS (-Kpthread for UW) is missing
> > on compile command, although present before that. I can't find why
>
> You mean PTHREAD_FLAGS, right?
>
Nope,I mean PTHREAD_CFLAGS witch is defined in src/templates/unixware
> If it is present in line 1118, it should also be present in line 1133.
>
> Can you verify that the part on configure.in between 1065 and 1118,
> -Kpthread is correctly set on Unixware?
>
It is defined, my guts felling is that AC_SUBSTs lines 1470,1471 do
something weird.
> If not, thread support for Unixware is probebly broken.
>
It is, because when searching for ldap_r succeeds by forcing
PTHREAD_CFLAGS to be used, configure still fails when testing for thread
safety compiling src/test/thread/thread_test.c.

This fails because unixware's sigwait has only one arg although (according
to doc you can see at http://www.pyrenet.fr:8458) it's thread safe...

> If yes, something strange is going on.
>
indeed
> Yours,
> Laurenz Albe
>

Best regards
-- 
Olivier PRENANT                    Tel: +33-5-61-50-97-00 (Work)
15, Chemin des Monges                +33-5-61-50-97-01 (Fax)
31190 AUTERIVE                       +33-6-07-63-80-64 (GSM)
FRANCE                          Email: ohp@pyrenet.fr
------------------------------------------------------------------------------
Make your life a dream, make your dream a reality. (St Exupery)


Re: unixware and --with-ldap

From
"Albe Laurenz"
Date:
>>> I have tried --with-thread-safety and configure fails on ldap check
>>> because for some reason CTHREAD_FLAGS (-Kpthread for UW) is missing
>>> on compile command, although present before that. I can't find why
>>
>> You mean PTHREAD_FLAGS, right?
>>
> Nope,I mean PTHREAD_CFLAGS witch is defined in src/templates/unixware

PTHREAD_CFLAGS, of course :^)

Oops, this seems to be an oversight in (my) original code.

I'd say we should change the lines
 AC_CHECK_LIB(ldap_r, ldap_simple_bind, [],     [AC_MSG_ERROR([library 'ldap_r' is required for LDAP])],
[$PTHREAD_LIBS$EXTRA_LDAP_LIBS]) 

to
 AC_CHECK_LIB(ldap_r, ldap_simple_bind, [],     [AC_MSG_ERROR([library 'ldap_r' is required for LDAP])],
[$PTHREAD_CFLAGS$PTHREAD_LIBS $EXTRA_LDAP_LIBS]) 

I know that this is abuse of AC_CHECK_LIB, but it is only a test
and LIBS is discarded later.

Yours,
Laurenz Albe


Re: unixware and --with-ldap

From
Bruce Momjian
Date:
Clarification, this is the email used to make the patch that was
backpatched.

---------------------------------------------------------------------------

Albe Laurenz wrote:
> >>> I have tried --with-thread-safety and configure fails on ldap check
> >>> because for some reason CTHREAD_FLAGS (-Kpthread for UW) is missing
> >>> on compile command, although present before that. I can't find why
> >>
> >> You mean PTHREAD_FLAGS, right?
> >>
> > Nope,I mean PTHREAD_CFLAGS witch is defined in src/templates/unixware
> 
> PTHREAD_CFLAGS, of course :^)
> 
> Oops, this seems to be an oversight in (my) original code.
> 
> I'd say we should change the lines
> 
>   AC_CHECK_LIB(ldap_r, ldap_simple_bind, [],
>       [AC_MSG_ERROR([library 'ldap_r' is required for LDAP])],
>       [$PTHREAD_LIBS $EXTRA_LDAP_LIBS])
> 
> to
> 
>   AC_CHECK_LIB(ldap_r, ldap_simple_bind, [],
>       [AC_MSG_ERROR([library 'ldap_r' is required for LDAP])],
>       [$PTHREAD_CFLAGS $PTHREAD_LIBS $EXTRA_LDAP_LIBS])
> 
> I know that this is abuse of AC_CHECK_LIB, but it is only a test
> and LIBS is discarded later.
> 
> Yours,
> Laurenz Albe
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend

--  Bruce Momjian   bruce@momjian.us EnterpriseDB    http://www.enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +