[syslog-ng]Error when compiling with tcp-wrappers

Balazs Scheidler bazsi@balabit.hu
Fri, 26 Apr 2002 09:51:04 +0200


On Thu, Apr 25, 2002 at 01:49:45PM -0400, Ed Ravin wrote:
> Balazs Scheidler writes:
> > 
> > On Wed, Apr 24, 2002 at 11:38:25PM -0400, Ed Ravin wrote:
> > >  ./configure  --prefix=/install/syslog-ng-1.5.16 --enable-tcp-wrapper --with-libol=/src/build/libol-0.3.2    
> [...]
> > >  checking for hosts_access in -lwrap... no
> > >  checking whether to enable TCP wrapper support... yes
> > > 
> > > So clearly something is broken in the configure process.
> > 
> > can you check config.log why it fails?
> 
> Here's the log:
> 
>  configure:2725: checking for tcpd.h
>  configure:2735: gcc -E  conftest.c >/dev/null 2>conftest.out
>  configure:2762: checking for hosts_access in -lwrap
>  configure:2781: gcc -o conftest -g -O2   conftest.c -lwrap   1>&5
>  /usr/lib/libwrap.so: undefined reference to `allow_severity'
>  /usr/lib/libwrap.so: undefined reference to `deny_severity'
>  collect2: ld returned 1 exit status
>  configure: failed program was:
>  #line 2770 "configure"
>  #include "confdefs.h"
>  /* Override any gcc2 internal prototype to avoid an error.  */
>  /* We use char because int might match the return type of a gcc2
>      builtin and then its argument prototype would still apply.  */
>  char hosts_access();
>  
>  int main() {
>  hosts_access()
>  ; return 0; }
>  configure:2811: checking whether to enable TCP wrapper support
>  
> I think the fix is that the test program should define "allow_severity"
> and "deny_severity", since those are required to be in the user program
> for it to compile successfully.

Can you check this configure.in patch if it does autodetect your -lwrap ?
(after patching you need to run autoconf)

diff -u -r1.46 configure.in
--- configure.in	2002/04/12 07:42:16	1.46
+++ configure.in	2002/04/26 07:50:11
@@ -83,6 +83,26 @@
 blb_cv_c_modern_utmp=yes,
 blb_cv_c_modern_utmp=no)])
 
+old_LDFLAGS=$LDFLAGS
+LDFLAGS=-lwrap
+AC_CACHE_CHECK(for hosts_access in -lwrap,
+		blb_cv_c_lwrap,
+[AC_TRY_LINK(,
+[
+int allow_severity;
+int deny_severity;
+extern int hosts_access(void);
+
+int foo(void)
+{
+	hosts_access();
+}
+],
+blb_cv_c_lwrap=yes,
+blb_cv_c_lwrap=no)])
+LDFLAGS=$old_LDFLAGS
+
+
 if test "x$blb_cv_c_modern_utmp" = "xyes"; then
 	AC_DEFINE(HAVE_MODERN_UTMP)
 fi
@@ -169,7 +189,10 @@
 
 if test "x$enable_tcp_wrapper" = "xyes"; then
 	AC_CHECK_HEADERS(tcpd.h)
-	AC_CHECK_LIB(wrap, hosts_access)
+	dnl AC_CHECK_LIB(wrap, hosts_access)
+	if test $blb_cv_c_lwrap = "xyes"; then
+		LIBS="$LIBS -lwrap"
+	fi
 fi
 
 AC_MSG_CHECKING(whether to enable TCP wrapper support)


-- 
Bazsi
PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1