From 684464d7ff6b31b8cfcc5b158fee71b211f3a9b3 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Jun 28 2011 15:32:11 +0000 Subject: look for separate openldap ldif library Newer versions of openldap have moved the ldif api into the main libldap At configure time we need to see if libldap has the api, or if we need to link with a separate libldif --- diff --git a/Makefile.am b/Makefile.am index a8347af..6618290 100644 --- a/Makefile.am +++ b/Makefile.am @@ -139,7 +139,7 @@ LIBCRUN=@LIBCRUN@ # Linker Flags #------------------------ if OPENLDAP -LDAPSDK_LINK = @openldap_lib@ -lldap@ol_libver@ -lldif@ol_libver@ +LDAPSDK_LINK = @openldap_lib@ -lldap@ol_libver@ @ldap_lib_ldif@ use_openldap = 1 ADMINUTIL_LINK = @adminutil_lib@ @nspr_lib@ @nss_lib@ @sasl_lib@ @openldap_lib@ @icu_lib@ -ladmsslutil@adminutil_ver@ -ladminutil@adminutil_ver@ else diff --git a/Makefile.in b/Makefile.in index 3e4f681..8e79f25 100644 --- a/Makefile.in +++ b/Makefile.in @@ -440,6 +440,7 @@ initdir = @initdir@ install_sh = @install_sh@ instancename = @instancename@ instconfigdir = @instconfigdir@ +ldap_lib_ldif = @ldap_lib_ldif@ ldapsdk_inc = @ldapsdk_inc@ ldapsdk_lib = @ldapsdk_lib@ ldapsdk_libdir = @ldapsdk_libdir@ @@ -576,7 +577,7 @@ admmod_LTLIBRARIES = mod_admserv.la mod_restartd.la #------------------------ # Linker Flags #------------------------ -@OPENLDAP_TRUE@LDAPSDK_LINK = @openldap_lib@ -lldap@ol_libver@ -lldif@ol_libver@ +@OPENLDAP_TRUE@LDAPSDK_LINK = @openldap_lib@ -lldap@ol_libver@ @ldap_lib_ldif@ @OPENLDAP_TRUE@use_openldap = 1 @OPENLDAP_FALSE@ADMINUTIL_LINK = @adminutil_lib@ @nspr_lib@ @nss_lib@ @sasl_lib@ @ldapsdk_lib@ @icu_lib@ -ladmsslutil@adminutil_ver@ -ladminutil@adminutil_ver@ @OPENLDAP_TRUE@ADMINUTIL_LINK = @adminutil_lib@ @nspr_lib@ @nss_lib@ @sasl_lib@ @openldap_lib@ @icu_lib@ -ladmsslutil@adminutil_ver@ -ladminutil@adminutil_ver@ diff --git a/configure b/configure index 2787123..f15ce44 100755 --- a/configure +++ b/configure @@ -865,6 +865,7 @@ with_selinux nsspcache GENRB ICU_CONFIG +ldap_lib_ldif PKG_CONFIG APR_CONFIG APXS @@ -5297,13 +5298,13 @@ if test "${lt_cv_nm_interface+set}" = set; then else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:5300: $ac_compile\"" >&5) + (eval echo "\"\$as_me:5301: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:5303: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:5304: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:5306: output\"" >&5) + (eval echo "\"\$as_me:5307: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -6509,7 +6510,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 6512 "configure"' > conftest.$ac_ext + echo '#line 6513 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -9074,11 +9075,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:9077: $lt_compile\"" >&5) + (eval echo "\"\$as_me:9078: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:9081: \$? = $ac_status" >&5 + echo "$as_me:9082: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -9413,11 +9414,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:9416: $lt_compile\"" >&5) + (eval echo "\"\$as_me:9417: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:9420: \$? = $ac_status" >&5 + echo "$as_me:9421: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -9518,11 +9519,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:9521: $lt_compile\"" >&5) + (eval echo "\"\$as_me:9522: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:9525: \$? = $ac_status" >&5 + echo "$as_me:9526: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -9573,11 +9574,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:9576: $lt_compile\"" >&5) + (eval echo "\"\$as_me:9577: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:9580: \$? = $ac_status" >&5 + echo "$as_me:9581: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12376,7 +12377,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12379 "configure" +#line 12380 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12472,7 +12473,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12475 "configure" +#line 12476 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -14492,11 +14493,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14495: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14496: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14499: \$? = $ac_status" >&5 + echo "$as_me:14500: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14591,11 +14592,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14594: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14595: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14598: \$? = $ac_status" >&5 + echo "$as_me:14599: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -14643,11 +14644,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14646: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14647: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14650: \$? = $ac_status" >&5 + echo "$as_me:14651: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -21901,6 +21902,85 @@ _ACEOF fi + ldap_lib_ldif="" + LDFLAGS="$LDFLAGS" + as_ac_Lib=`$as_echo "ac_cv_lib_ldap$ol_libver''_ldif_open" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for ldif_open in -lldap$ol_libver" >&5 +$as_echo_n "checking for ldif_open in -lldap$ol_libver... " >&6; } +if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lldap$ol_libver $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char ldif_open (); +int +main () +{ +return ldif_open (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + eval "$as_ac_Lib=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_Lib=no" +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +ac_res=`eval 'as_val=${'$as_ac_Lib'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +as_val=`eval 'as_val=${'$as_ac_Lib'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + ldap_lib_ldif= +else + ldap_lib_ldif=-lldif$ol_libver +fi + + LDFLAGS="$save_ldflags" CPPFLAGS="$save_cppflags" diff --git a/m4/openldap.m4 b/m4/openldap.m4 index a4e2e88..cce49e2 100644 --- a/m4/openldap.m4 +++ b/m4/openldap.m4 @@ -124,6 +124,13 @@ if test "$with_openldap" = yes ; then dnl look for ldap_url_parse_ext AC_CHECK_LIB([ldap$ol_libver], [ldap_url_parse_ext], [AC_DEFINE([HAVE_LDAP_URL_PARSE_EXT], [1], [have the function ldap_url_parse_ext])]) + dnl look for separate libldif - newer versions of openldap have moved the + dnl ldif functionality into libldap + ldap_lib_ldif="" + LDFLAGS="$LDFLAGS" + AC_CHECK_LIB([ldap$ol_libver], [ldif_open], [ldap_lib_ldif=], + [ldap_lib_ldif=-lldif$ol_libver]) + AC_SUBST([ldap_lib_ldif]) LDFLAGS="$save_ldflags" CPPFLAGS="$save_cppflags"