[stunnel-users] Stunnel 4.20 with TCP Wrappers 7.6 problem in configure.ac

lists at d-ra.ath.cx lists at d-ra.ath.cx
Sun Mar 18 09:47:58 CET 2007

Hi Mike,

On Sat, Mar 17, 2007 at 10:23:28PM +0100, Michal Trojnara wrote:
> On Saturday 17 March 2007 21:35, lists at d-ra.ath.cx wrote:
> > Result: -lnsl was not added to $LIB. $LIB was empty here.
> >
> > Maybe it's a problem with gethostbyname. Isn't gethostbyname a part of
> > libc? What would happens if gethostbyname is resolved with libc?
> In Linux - yes.  In Solaris it's in libnls.  In fact I'm surprised that Linux 
> needs libnls.  What function does *your* system need from libnls?

OK, I see your problem with different platforms. So I have tuned the
patch a little bit. Now it doesn't hardcode -lnsl in the tcp wrapper
section, instead it uses AC_SEARCH_LIBS(yp_get_default_domain, nsl) to
conditionally add it to LIB if not already included. So in Solaris
libnsl will be added via AC_SEARCH_LIBS(gethostbyname, nsl) at line 93
in configure.ac, in Linux via AC_SEARCH_LIBS(yp_get_default_domain,
nsl) in line 311 (after apply patch), but only if tcp wrappers are

Why yp_get_default_domain? Because of this error message (see
config.log without patch):

gcc -o conftest -g -O2 -Wall -Wshadow -Wcast-align -Wpointer-arith
-I/usr/include   conftest.c -lz -ldl -lutil  -lpthread -L/usr/lib
-lssl -lcrypto -lwrap
/usr/lib/libwrap.a(hosts_access.o)(.text+0x64f): In function
: undefined reference to `yp_get_default_domain'
collect2: ld returned 1 exit status

Here the patch:

--- configure.ac.orig	2007-03-18 08:25:50.000000000 +0100
+++ configure.ac	2007-03-18 09:05:49.000000000 +0100
@@ -308,6 +308,7 @@
         AC_MSG_RESULT([no (autodetecting)])
+        AC_SEARCH_LIBS(yp_get_default_domain, nsl)
         AC_MSG_CHECKING([for hosts_access in -lwrap])
         LIBS="$saved_LIBS -lwrap"

Kind regards

More information about the stunnel-users mailing list