[Date Prev][Date Next] [Chronological] [Thread] [Top]

res_search check wrong for bind 8.x (ITS#222)



Full_Name: Tim Mooney
Version: 1.2.3
OS: any
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (134.129.106.23)


configure.in for openldap 1.2.3 contains the following code:

dnl Check for resolver routines
AC_CHECK_FUNCS(res_search)
if test $ac_cv_func_res_search = "no" ; then
        AC_CHECK_LIB(bind, res_search)
        if test "$ac_cv_lib_bind_res_search" = "yes" ; then
                AC_DEFINE(HAVE_RES_SEARCH,1)
        else
                AC_CHECK_LIB(resolv, res_search)
                if test "$ac_cv_lib_resolv_res_search" = "yes" ; then
                        AC_DEFINE(HAVE_RES_SEARCH,1)
                fi
        fi
fi



The problem is that `-lbind' does *not* contain res_search, it contains
__res_search,
at least for bind 8.2 (and probably 8.1.2, as well, though I haven't looked).
If
you include `resolv.h', you get a #define res_search __res_search so all is
well.
The problem is that the configure check above isn't including resolv.h, so the
check for res_search in `-lbind' can't work.

You may be able to insert a 

#ifdef HAVE_RESOLV_H
# include <resolv.h>
#endif

in argument 2 of the AC_CHECK_LIB call for bind, but that's not really the way
AC_CHECK_LIB was meant to be used, so it may not work.

A more straightforward method (though not without its warts) would be to also
(or
perhaps "instead") do:

	AC_CHECK_LIB(bind, __res_search)

If that succeeds you know you have libbind.  From that point on, you just need
to
be sure to include resolv.h so that all the

	#define func_name	__func_name

are picked up.  I don't think that's a problem, since you need to include
resolv.h
any place you plan on using the resolver functions anyway.

Please let me know if I'm not making sense. :-)

Tim