2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-22 01:49:11 +00:00

Try -libmldap before -lldap in case there is no link from libibmldap.so

to libldap.so.  Since IBM ldap is installed under /opt we should only
be able to reach it if --with-ldap was given an explicit path.

Only check for ber_set_option() if LBER_OPT_DEBUG_LEVEL is defined.
This commit is contained in:
Todd C. Miller 2014-02-28 11:05:13 -07:00
parent d75e5f6fef
commit 9c17914bf9
2 changed files with 54 additions and 21 deletions

46
configure vendored
View File

@ -20893,7 +20893,7 @@ return ldap_init ();
return 0;
}
_ACEOF
for ac_lib in '' "ldap" "ldap -llber" "ldap -llber -lssl -lcrypto" "ibmldap${IBMLDAP_EXTRA}" "ibmldap -lidsldif${IBMLDAP_EXTRA}"; do
for ac_lib in '' "ibmldap${IBMLDAP_EXTRA}" "ibmldap -lidsldif${IBMLDAP_EXTRA}" "ldap" "ldap -llber" "ldap -llber -lssl -lcrypto" "ibmldap${IBMLDAP_EXTRA}"; do
if test -z "$ac_lib"; then
ac_res="none required"
else
@ -20934,7 +20934,25 @@ fi
fi
LIBS="${_LIBS} ${LDAP_LIBS}"
OLIBS="$LIBS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing ber_set_option" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lber.h defines LBER_OPT_DEBUG_LEVEL" >&5
$as_echo_n "checking whether lber.h defines LBER_OPT_DEBUG_LEVEL... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h>
# include <lber.h>
int
main ()
{
int opt=LBER_OPT_DEBUG_LEVEL;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing ber_set_option" >&5
$as_echo_n "checking for library containing ber_set_option... " >&6; }
if ${ac_cv_search_ber_set_option+:} false; then :
$as_echo_n "(cached) " >&6
@ -20992,15 +21010,15 @@ else
found=no
fi
if test X"$found" = X"yes" -a X"$LIBS" != X"$OLIBS"; then
LDAP_LIBS="$LDAP_LIBS -llber"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lber.h is needed" >&5
if test X"$found" = X"yes" -a X"$LIBS" != X"$OLIBS"; then
LDAP_LIBS="$LDAP_LIBS -llber"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lber.h is needed" >&5
$as_echo_n "checking whether lber.h is needed... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h>
# include <ldap.h>
# include <ldap.h>
int
main ()
{
@ -21014,14 +21032,22 @@ if ac_fn_c_try_link "$LINENO"; then :
$as_echo "no" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
$as_echo "#define HAVE_LBER_H 1" >>confdefs.h
$as_echo "#define HAVE_LBER_H 1" >>confdefs.h
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
for ac_header in sasl/sasl.h sasl.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`

View File

@ -3313,7 +3313,7 @@ if test ${with_ldap-'no'} != "no"; then
case "$host_os" in
hpux*) AC_CHECK_LIB(Csup, main, [IBMLDAP_EXTRA=" -lCsup"]);;
esac
AC_SEARCH_LIBS(ldap_init, "ldap" "ldap -llber" "ldap -llber -lssl -lcrypto" "ibmldap${IBMLDAP_EXTRA}" "ibmldap -lidsldif${IBMLDAP_EXTRA}", [
AC_SEARCH_LIBS(ldap_init, "ibmldap${IBMLDAP_EXTRA}" "ibmldap -lidsldif${IBMLDAP_EXTRA}" "ldap" "ldap -llber" "ldap -llber -lssl -lcrypto" "ibmldap${IBMLDAP_EXTRA}", [
test "$ac_res" != "none required" && LDAP_LIBS="$ac_res"
found=yes
])
@ -3324,16 +3324,23 @@ if test ${with_ldap-'no'} != "no"; then
LIBS="${_LIBS} ${LDAP_LIBS}"
dnl check if we need to link with -llber for ber_set_option
OLIBS="$LIBS"
AC_SEARCH_LIBS([ber_set_option], [lber], [found=yes], [found=no])
if test X"$found" = X"yes" -a X"$LIBS" != X"$OLIBS"; then
LDAP_LIBS="$LDAP_LIBS -llber"
fi
dnl check if ldap.h includes lber.h for us
AC_MSG_CHECKING([whether lber.h is needed])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
# include <ldap.h>]], [[(void)ldap_init(0, 0)]])], [AC_MSG_RESULT([no])], [
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_LBER_H)])
AC_MSG_CHECKING([whether lber.h defines LBER_OPT_DEBUG_LEVEL])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
# include <lber.h>]], [[int opt=LBER_OPT_DEBUG_LEVEL;]])], [
AC_MSG_RESULT([yes])
AC_SEARCH_LIBS([ber_set_option], [lber], [found=yes], [found=no])
if test X"$found" = X"yes" -a X"$LIBS" != X"$OLIBS"; then
LDAP_LIBS="$LDAP_LIBS -llber"
fi
dnl check if ldap.h includes lber.h for us
AC_MSG_CHECKING([whether lber.h is needed])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
# include <ldap.h>]], [[(void)ldap_init(0, 0)]])], [AC_MSG_RESULT([no])], [
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_LBER_H)])
], [
AC_MSG_RESULT([no])
])
AC_CHECK_HEADERS([sasl/sasl.h] [sasl.h], [
AC_CHECK_FUNCS(ldap_sasl_interactive_bind_s)