From: Matthew Newton Date: Tue, 12 Apr 2016 20:42:39 +0000 (+0100) Subject: Only build mschap auth_wbclient when core/ntstatus.h is present X-Git-Tag: release_3_0_12~164 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2d09bfbfdc4c09ab5f93705443225eaa16de968f;p=thirdparty%2Ffreeradius-server.git Only build mschap auth_wbclient when core/ntstatus.h is present In addition, don't check for the library if the headers aren't there, otherwise we'll link against libwbclient unnecessarily. Closes #1489 --- diff --git a/src/modules/rlm_mschap/configure b/src/modules/rlm_mschap/configure index 9621843393e..83f302c7c1a 100755 --- a/src/modules/rlm_mschap/configure +++ b/src/modules/rlm_mschap/configure @@ -3286,7 +3286,247 @@ $as_echo "$as_me: WARNING: silently building without support for direct authenti fi - smart_try_dir="$winbind_lib_dir" + +ac_safe=`echo "core/ntstatus.h" | sed 'y%./+-%__pm%'` +old_CPPFLAGS="$CPPFLAGS" +smart_include= +smart_include_dir="/usr/local/include /opt/include" + +_smart_try_dir= +_smart_include_dir= + +for _prefix in $smart_prefix ""; do + for _dir in $smart_try_dir; do + _smart_try_dir="${_smart_try_dir} ${_dir}/${_prefix}" + done + + for _dir in $smart_include_dir; do + _smart_include_dir="${_smart_include_dir} ${_dir}/${_prefix}" + done +done + +if test "x$_smart_try_dir" != "x"; then + for try in $_smart_try_dir; do + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for core/ntstatus.h in $try" >&5 +$as_echo_n "checking for core/ntstatus.h in $try... " >&6; } + CPPFLAGS="-isystem $try $old_CPPFLAGS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + #include +int +main () +{ +int a = 1; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + smart_include="-isystem $try" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + break + +else + + smart_include= + { $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 + done + CPPFLAGS="$old_CPPFLAGS" +fi + +if test "x$smart_include" = "x"; then + for _prefix in $smart_prefix; do + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${_prefix}/core/ntstatus.h" >&5 +$as_echo_n "checking for ${_prefix}/core/ntstatus.h... " >&6; } + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + #include +int +main () +{ +int a = 1; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + smart_include="-isystem ${_prefix}/" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + break + +else + + smart_include= + { $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 + done +fi + +if test "x$smart_include" = "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for core/ntstatus.h" >&5 +$as_echo_n "checking for core/ntstatus.h... " >&6; } + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + #include +int +main () +{ +int a = 1; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + smart_include=" " + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + break + +else + + smart_include= + { $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 +fi + +if test "x$smart_include" = "x"; then + + for prefix in $smart_prefix; do + + +if test "x$LOCATE" != "x"; then + DIRS= + file="${_prefix}/${1}" + + for x in `${LOCATE} $file 2>/dev/null`; do + base=`echo $x | sed "s%/${file}%%"` + if test "x$x" = "x$base"; then + continue; + fi + + dir=`${DIRNAME} $x 2>/dev/null` + exclude=`echo ${dir} | ${GREP} /home` + if test "x$exclude" != "x"; then + continue + fi + + already=`echo \$_smart_include_dir ${DIRS} | ${GREP} ${dir}` + if test "x$already" = "x"; then + DIRS="$DIRS $dir" + fi + done +fi + +eval "_smart_include_dir=\"\$_smart_include_dir $DIRS\"" + + done + + +if test "x$LOCATE" != "x"; then + DIRS= + file=core/ntstatus.h + + for x in `${LOCATE} $file 2>/dev/null`; do + base=`echo $x | sed "s%/${file}%%"` + if test "x$x" = "x$base"; then + continue; + fi + + dir=`${DIRNAME} $x 2>/dev/null` + exclude=`echo ${dir} | ${GREP} /home` + if test "x$exclude" != "x"; then + continue + fi + + already=`echo \$_smart_include_dir ${DIRS} | ${GREP} ${dir}` + if test "x$already" = "x"; then + DIRS="$DIRS $dir" + fi + done +fi + +eval "_smart_include_dir=\"\$_smart_include_dir $DIRS\"" + + + for try in $_smart_include_dir; do + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for core/ntstatus.h in $try" >&5 +$as_echo_n "checking for core/ntstatus.h in $try... " >&6; } + CPPFLAGS="-isystem $try $old_CPPFLAGS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + #include +int +main () +{ +int a = 1; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + smart_include="-isystem $try" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + break + +else + + smart_include= + { $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 + done + CPPFLAGS="$old_CPPFLAGS" +fi + +if test "x$smart_include" != "x"; then + eval "ac_cv_header_$ac_safe=yes" + CPPFLAGS="$smart_include $old_CPPFLAGS" + SMART_CPPFLAGS="$smart_include $SMART_CPPFLAGS" +fi + +smart_prefix= + + if test "x$ac_cv_header_core_ntstatus_h" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: core/ntstatus.h not found. Use --with-winbind-include-dir=." >&5 +$as_echo "$as_me: WARNING: core/ntstatus.h not found. Use --with-winbind-include-dir=." >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: silently building without support for direct authentication via winbind. requires: libwbclient" >&5 +$as_echo "$as_me: WARNING: silently building without support for direct authentication via winbind. requires: libwbclient" >&2;} + fi + + + if test "x$ac_cv_header_wbclient_h" = "xyes" && \ + test "x$ac_cv_header_core_ntstatus_h" = "xyes"; then + + smart_try_dir="$winbind_lib_dir" sm_lib_safe=`echo "wbclient" | sed 'y%./+-%__p_%'` @@ -3461,16 +3701,17 @@ if test "x$smart_lib" != "x"; then SMART_LIBS="$smart_ldflags $smart_lib $SMART_LIBS" fi - if test "x$ac_cv_lib_wbclient_wbcCtxAuthenticateUserEx" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: winbind libraries not found. Use --with-winbind-lib-dir=." >&5 + if test "x$ac_cv_lib_wbclient_wbcCtxAuthenticateUserEx" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: winbind libraries not found. Use --with-winbind-lib-dir=." >&5 $as_echo "$as_me: WARNING: winbind libraries not found. Use --with-winbind-lib-dir=." >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Samba must be version 4.2.1 or higher to use this feature." >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Samba must be version 4.2.1 or higher to use this feature." >&5 $as_echo "$as_me: WARNING: Samba must be version 4.2.1 or higher to use this feature." >&2;} - elif test "x$ac_cv_header_wbclient_h" = "xyes"; then - mschap_sources="$mschap_sources auth_wbclient.c" + else + mschap_sources="$mschap_sources auth_wbclient.c" $as_echo "#define WITH_AUTH_WINBIND 1" >>confdefs.h + fi fi targetname=rlm_mschap diff --git a/src/modules/rlm_mschap/configure.ac b/src/modules/rlm_mschap/configure.ac index 929adb15aed..f4b40d72f47 100644 --- a/src/modules/rlm_mschap/configure.ac +++ b/src/modules/rlm_mschap/configure.ac @@ -80,18 +80,29 @@ if test x$with_[]modname != xno; then AC_MSG_WARN([silently building without support for direct authentication via winbind. requires: libwbclient]) fi + FR_SMART_CHECK_INCLUDE(core/ntstatus.h, [#include + #include ]) + if test "x$ac_cv_header_core_ntstatus_h" != "xyes"; then + AC_MSG_WARN([core/ntstatus.h not found. Use --with-winbind-include-dir=.]) + AC_MSG_WARN([silently building without support for direct authentication via winbind. requires: libwbclient]) + fi + dnl ############################################################ dnl # Check for libraries dnl ############################################################ - smart_try_dir="$winbind_lib_dir" - FR_SMART_CHECK_LIB(wbclient, wbcCtxAuthenticateUserEx) - if test "x$ac_cv_lib_wbclient_wbcCtxAuthenticateUserEx" != "xyes"; then - AC_MSG_WARN([winbind libraries not found. Use --with-winbind-lib-dir=.]) - AC_MSG_WARN([Samba must be version 4.2.1 or higher to use this feature.]) - elif test "x$ac_cv_header_wbclient_h" = "xyes"; then - mschap_sources="$mschap_sources auth_wbclient.c" - AC_DEFINE([WITH_AUTH_WINBIND],[1],[Build with direct winbind auth support]) + if test "x$ac_cv_header_wbclient_h" = "xyes" && \ + test "x$ac_cv_header_core_ntstatus_h" = "xyes"; then + + smart_try_dir="$winbind_lib_dir" + FR_SMART_CHECK_LIB(wbclient, wbcCtxAuthenticateUserEx) + if test "x$ac_cv_lib_wbclient_wbcCtxAuthenticateUserEx" != "xyes"; then + AC_MSG_WARN([winbind libraries not found. Use --with-winbind-lib-dir=.]) + AC_MSG_WARN([Samba must be version 4.2.1 or higher to use this feature.]) + else + mschap_sources="$mschap_sources auth_wbclient.c" + AC_DEFINE([WITH_AUTH_WINBIND],[1],[Build with direct winbind auth support]) + fi fi targetname=modname