Lines 368-405
AC_ARG_WITH(dlz_ldap,
Link Here
|
368 |
(Required to use LDAP with DLZ)]), |
368 |
(Required to use LDAP with DLZ)]), |
369 |
use_dlz_ldap="$withval", use_dlz_ldap="no") |
369 |
use_dlz_ldap="$withval", use_dlz_ldap="no") |
370 |
|
370 |
|
371 |
if test "$use_dlz_ldap" = "yes" |
|
|
372 |
then |
373 |
# User did not specify a path - guess it |
374 |
ldapdirs="/usr /usr/local /usr/pkg" |
375 |
for d in $ldapdirs |
376 |
do |
377 |
if test -f $d/include/ldap.h |
378 |
then |
379 |
use_dlz_ldap=$d |
380 |
break |
381 |
fi |
382 |
done |
383 |
fi |
384 |
|
385 |
if test "$use_dlz_ldap" = "yes" |
386 |
then |
387 |
AC_MSG_RESULT(not found) |
388 |
AC_MSG_ERROR( |
389 |
[LDAP headers were not found in any of $ldapdirs; use --with-dlz-ldap=/path]) |
390 |
fi |
391 |
|
392 |
case "$use_dlz_ldap" in |
371 |
case "$use_dlz_ldap" in |
393 |
no) |
372 |
no) |
394 |
AC_MSG_RESULT(no) |
373 |
AC_MSG_RESULT(no) |
395 |
;; |
374 |
;; |
396 |
*) |
375 |
*) |
397 |
DLZ_ADD_DRIVER(LDAP, dlz_ldap_driver, |
376 |
if test "yes" = "$use_dlz_ldap" |
398 |
[-I$use_dlz_ldap/include], |
377 |
then |
399 |
[-L$use_dlz_ldap/lib -lldap -llber]) |
378 |
# User did not specify a path - guess directories |
|
|
379 |
ldapdirs="/usr /usr/local /usr/pkg" |
380 |
elif test -d "$use_dlz_ldap" |
381 |
then |
382 |
# User specified directory and it exists |
383 |
ldapdirs="$use_dlz_ldap" |
384 |
else |
385 |
AC_MSG_RESULT(not found) |
386 |
AC_MSG_ERROR([path $use_dlz_ldap does not exist]) |
387 |
ldapdirs="" |
388 |
fi |
400 |
|
389 |
|
401 |
AC_MSG_RESULT( |
390 |
# Search for correct path. |
402 |
[using LDAP from $use_dlz_ldap/lib and $use_dlz_ldap/include]) |
391 |
# Set both to yes, so we can check them later |
|
|
392 |
dlz_ldap_inc="yes" |
393 |
dlz_ldap_libs="yes" |
394 |
|
395 |
# See if the compiler can find the library without any paths. |
396 |
AC_MSG_RESULT() |
397 |
AC_CHECK_LIB(ldap, ldap_initialize, dlz_ldap_libs="-lldap") |
398 |
|
399 |
for d in $ldapdirs |
400 |
do |
401 |
# Skip nonexistant directories |
402 |
if test ! -d "$dd" |
403 |
then |
404 |
continue |
405 |
fi |
406 |
|
407 |
if test -f $d/include/ldap.h |
408 |
then |
409 |
dlz_ldap_inc="-I$d/include" |
410 |
else |
411 |
# Do not search for a library if there is no include. |
412 |
continue |
413 |
fi |
414 |
|
415 |
# If a library has been found, search no more. |
416 |
if test "yes" != "$dlz_ldap_libs" |
417 |
then |
418 |
break |
419 |
fi |
420 |
|
421 |
# If a library exists, blindly use it. |
422 |
if test -f "$d/lib/libldap.so" |
423 |
then |
424 |
dlz_ldap_libs="-L$d/lib -lldap" |
425 |
break |
426 |
fi |
427 |
|
428 |
# Start over. |
429 |
dlz_ldap_inc="yes" |
430 |
dlz_ldap_libs="yes" |
431 |
done |
432 |
|
433 |
# Done searching. Check that everything was found. |
434 |
if test "yes" = "$dlz_ldap_inc" |
435 |
then |
436 |
AC_MSG_ERROR([could not find LDAP include directory]) |
437 |
fi |
438 |
|
439 |
if test "yes" = "$dlz_ldap_libs" |
440 |
then |
441 |
AC_MSG_ERROR([could not find LDAP library]) |
442 |
fi |
443 |
|
444 |
DLZ_ADD_DRIVER(LDAP, dlz_ldap_driver, [$dlz_ldap_inc], [$dlz_ldap_libs]) |
445 |
|
446 |
AC_MSG_RESULT([using LDAP: $dlz_ldap_inc $dlz_ldap_libs]) |
403 |
;; |
447 |
;; |
404 |
esac |
448 |
esac |
405 |
|
449 |
|