summaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorTodd C. Miller <Todd.Miller@sudo.ws>2023-01-19 13:22:31 -0700
committerTodd C. Miller <Todd.Miller@sudo.ws>2023-01-19 13:22:31 -0700
commitea2aa960c6e3fa2489007e16cf8e8cb44c940814 (patch)
treea6a143f8f4a30378db23b2bea5101b88b266d9fe /configure
parent14557145712d1a294aaeb61fe728bc5585d440c2 (diff)
downloadsudo-ea2aa960c6e3fa2489007e16cf8e8cb44c940814.tar.gz
Need to link sudo and sudoers with -lutil on Dragonfly BSD.
It is safer to just search for setusercontext() in libc and libutil instead of matching on the operating system.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure86
1 files changed, 79 insertions, 7 deletions
diff --git a/configure b/configure
index 72c3373da..1416a834f 100755
--- a/configure
+++ b/configure
@@ -20072,18 +20072,90 @@ do :
if test "x$ac_cv_header_login_cap_h" = xyes
then :
printf "%s\n" "#define HAVE_LOGIN_CAP_H 1" >>confdefs.h
- LOGINCAP_USAGE='[-c class] '; LCMAN=1
+
+ LOGINCAP_USAGE='[-c class] '
+ LCMAN=1
with_logincap=yes
- case "$OS" in
- freebsd*|netbsd*)
- SUDO_LIBS="${SUDO_LIBS} -lutil"
- SUDOERS_LIBS="${SUDOERS_LIBS} -lutil"
- ;;
- esac
fi
done
+ if test "${with_logincap}" = "yes"; then
+ # setusercontext() is in libutil on NetBSD, FreeBSD, Dragonfly BSD.
+ _LIBS="$LIBS"
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing setusercontext" >&5
+printf %s "checking for library containing setusercontext... " >&6; }
+if test ${ac_cv_search_setusercontext+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* 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.
+ The 'extern "C"' is for builds by C++ compilers;
+ although this is not generally supported in C code supporting it here
+ has little cost and some practical benefit (sr 110532). */
+#ifdef __cplusplus
+extern "C"
+#endif
+char setusercontext (void);
+int
+main (void)
+{
+return setusercontext ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' util
+do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"
+then :
+ ac_cv_search_setusercontext=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext
+ if test ${ac_cv_search_setusercontext+y}
+then :
+ break
+fi
+done
+if test ${ac_cv_search_setusercontext+y}
+then :
+
+else case e in #(
+ e) ac_cv_search_setusercontext=no ;;
+esac
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS ;;
+esac
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_setusercontext" >&5
+printf "%s\n" "$ac_cv_search_setusercontext" >&6; }
+ac_res=$ac_cv_search_setusercontext
+if test "$ac_res" != no
+then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+ LIBS="$_LIBS"
+ if test "${ac_cv_search_setusercontext}" != "none required"; then
+ SUDO_LIBS="${SUDO_LIBS} -lutil"
+ SUDOERS_LIBS="${SUDOERS_LIBS} -lutil"
+ fi
+ fi
fi
if test ${with_project-'no'} != "no"; then
ac_fn_c_check_header_compile "$LINENO" "project.h" "ac_cv_header_project_h" "$ac_includes_default"