On Tue, Jun 15, 2010 at 10:04:35AM +0200, Kern Sibbald wrote:
>On Tuesday 15 June 2010 09:00:24 Luca Berra wrote:
>> configure.in has code to detect if libwrap requires libnsl to link, but
>> it falis to add -lnsl to WRAPLIBS
>> note, line numbers matter in this patch, since there are two instances
>> of similar code. -lnsl should be added to second one
>>
>> --- bacula-5.0.2/autoconf/configure.in~      2010-06-14 08:19:21.449360410 
>> +0000
>> +++ bacula-5.0.2/autoconf/configure.in       2010-06-14 08:19:21.479289510 
>> +0000
>> @@ -1092,7 +1092,7 @@ AC_ARG_WITH(tcp-wrappers,
>>                    AC_DEFINE(HAVE_LIBWRAP, 1, [Set to enable libwraper 
>> support])
>>                    TCPW_MSG="yes"
>>                    LIBS="$saved_LIBS"
>> -                  WRAPLIBS="-lwrap"
>> +                  WRAPLIBS="-lwrap -lnsl"
>>                 ], [
>>                    AC_MSG_ERROR([*** libwrap missing])
>>                 ]
>
>Where are you having this problem?  We build Bacula on *many* systems without 
yes, it is an old system
>this change, and if libnsl is not available, this will cause the build to 
>fail.
it won't.

look at the configure.in code below:
the first block (1030-1045) tries to link only with "-lwrap", if it
succeeds (1046-1050) it sets WRAPLIBS to "-lwrap". if it fails,
linking with "-lwrap -lnsl" is tried (1052-1063), if the second one
succeeds it still sets WRAPLIBS to "-lwrap" only (1064-1068).
It is this second case that is wrong, if it fails with "-lwrap" only and
succeeds with "-lwrap -lnsl", it should set WRAPLIBS to "-lwrap -lnsl".
This is what my patch does, address the second case.


1023 dnl -----------------------------------------------------------
1024 dnl Check whether user wants TCP wrappers support (default off)
1025 dnl -----------------------------------------------------------
1026 TCPW_MSG="no" 
1027 WRAPLIBS=""
1028 AC_ARG_WITH(tcp-wrappers,
1029    AC_HELP_STRING([--with-tcp-wrappers@<:@=DIR@:>@], [enable
tcpwrappers support]),
1030    [
1031        if test "x$withval" != "xno" ; then
1032           saved_LIBS="$LIBS"
1033           LIBS="$saved_LIBS -lwrap"
1034           AC_SEARCH_LIBS(nanosleep, [rt])
1035           AC_MSG_CHECKING(for libwrap)
1036           AC_TRY_LINK(
1037              [ 
1038                #include <sys/types.h>
1039                #include <tcpd.h>
1040                int deny_severity = 0;
1041                int allow_severity = 0;
1042                struct request_info *req;
1043              ], [
1044                 hosts_access(req);
1045              ], [
1046                  AC_MSG_RESULT(yes)
1047                  AC_DEFINE(HAVE_LIBWRAP, 1, [Set to enable libwraper 
support])
1048                  TCPW_MSG="yes" 
1049                  LIBS="$saved_LIBS"
1050                  WRAPLIBS="-lwrap"
1051              ], [
1052                  LIBS="$saved_LIBS -lwrap -lnsl"
1053                  WRAPLIBS="$saved_LIBS -lwrap -lnsl"
1054                  AC_TRY_LINK(
1055                    [
1056                        #include <sys/types.h>
1057                        #include <tcpd.h>
1058                        int deny_severity = 0;
1059                        int allow_severity = 0;
1060                        struct request_info *req;
1061                    ], [
1062                        hosts_access(req);
1063                    ], [
1064                       AC_MSG_RESULT(yes)
1065                       AC_DEFINE(HAVE_LIBWRAP, 1, [Set to enable libwraper 
support])
1066                       TCPW_MSG="yes" 
1067                       LIBS="$saved_LIBS"
1068                       WRAPLIBS="-lwrap"
1069                    ], [
1070                       AC_MSG_ERROR([*** libwrap missing])
1071                    ]
1072                 )
1073              ]
1074           )
1075        fi
1076    ]
1077 )

-- 
Luca Berra -- [email protected]
          Communication Media & Services S.r.l.
   /"\
   \ /     ASCII RIBBON CAMPAIGN
    X        AGAINST HTML MAIL
   / \

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Bacula-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bacula-devel

Reply via email to