Issue 222 - res_search check wrong for bind 8.x
Summary: res_search check wrong for bind 8.x
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: build (show other issues)
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 1999-07-09 05:23 UTC by tim.mooney@ndsu.edu
Modified: 2014-08-01 21:05 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description tim.mooney@ndsu.edu 1999-07-09 05:23:38 UTC
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
Comment 1 Kurt Zeilenga 1999-07-09 16:01:15 UTC
This sort of problem (using macros to rename symbols before
linking) is becoming quite common.  We really need a new
AC_ macro which allows specfication of headers to include
during the test.  I'll look into this for -devel.

For OpenLDAP 1.2 users facing this problem, I recommend
using environmental variable to force the test to true:
	env ac_cv_lib_bind_res_search=yes ./configure

Kurt

At 05:23 AM 7/9/99 GMT, mooney@dogbert.cc.ndsu.nodak.edu wrote:
>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
>
>
>
Comment 2 Kurt Zeilenga 1999-07-09 18:57:17 UTC
changed notes
changed state Open to Suspended
moved from Incoming to Build
Comment 3 Kurt Zeilenga 1999-08-07 03:17:05 UTC
changed notes
Comment 4 Kurt Zeilenga 2000-06-08 16:46:11 UTC
changed notes
changed state Suspended to Closed
Comment 5 OpenLDAP project 2014-08-01 21:05:08 UTC
Need better AC_CHECK_LIB macro.
Quick fix in -devel.
released with 1.2.11