$NetBSD: patch-configure,v 1.1 2018/08/14 13:18:38 adam Exp $

* Add "--with-nbsdops" option, NetBSD standard options.
* Link with util(3) in the case of DragonFly, too.
* When specified "--with-kerb5" option, test existence of several functions
  even if there is krb5-config.  krb5-config dosen't give all definitions for
  functions (HAVE_KRB5_*).
* Remove setting sysconfdir to "/etc".

--- configure.orig	2017-05-29 20:33:06.000000000 +0000
+++ configure
@@ -865,6 +865,7 @@ with_libpath
 with_libraries
 with_efence
 with_csops
+with_nbsdops
 with_passwd
 with_skey
 with_opie
@@ -1571,7 +1572,7 @@ Fine tuning of the installation director
   --bindir=DIR            user executables [EPREFIX/bin]
   --sbindir=DIR           system admin executables [EPREFIX/sbin]
   --libexecdir=DIR        program executables [EPREFIX/libexec]
-  --sysconfdir=DIR        read-only single-machine data [/etc]
+  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
   --libdir=DIR            object code libraries [EPREFIX/lib]
@@ -1674,6 +1675,7 @@ Optional Packages:
   --with-libraries        additional libraries to link with
   --with-efence           link with -lefence for malloc() debugging
   --with-csops            add CSOps standard options
+  --with-nbsdops          add NetBSD standard opt ions
   --without-passwd        don't use passwd/shadow file for authentication
   --with-skey[=DIR]       enable S/Key support
   --with-opie[=DIR]       enable OPIE support
@@ -4746,6 +4748,23 @@ fi
 
 
 
+# Check whether --with-nbsdops was given.
+if test "${with_nbsdops+set}" = set; then :
+  withval=$with_nbsdops; case $with_nbsdops in
+    yes)       echo 'Adding NetBSD standard options'
+               CHECKSIA=false
+               with_ignore_dot=yes
+               with_env_editor=yes
+               with_tty_tickets=yes
+               ;;
+    no)                ;;
+    *)         echo "Ignoring unknown argument to --with-nbsdops: $with_nbsdops"
+               ;;
+esac
+fi
+
+
+
 # Check whether --with-passwd was given.
 if test "${with_passwd+set}" = set; then :
   withval=$with_passwd; case $with_passwd in
@@ -15770,7 +15789,7 @@ fi
 		: ${mansectsu='1m'}
 		: ${mansectform='4'}
 		;;
-    *-*-linux*|*-*-k*bsd*-gnu)
+    *-*-linux*|*-*-k*bsd*-gnu|*-*-gnukfreebsd)
 		shadow_funcs="getspnam"
 		test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
 		# Check for SECCOMP_SET_MODE_FILTER in linux/seccomp.h
@@ -17995,7 +18014,7 @@ if test "x$ac_cv_header_login_cap_h" = x
 _ACEOF
  LOGINCAP_USAGE='[-c class] '; LCMAN=1
 	case "$OS" in
-	    freebsd|netbsd)
+	    dragonfly*|freebsd|netbsd)
 		SUDO_LIBS="${SUDO_LIBS} -lutil"
 		SUDOERS_LIBS="${SUDOERS_LIBS} -lutil"
 		;;
@@ -22483,10 +22502,9 @@ if test ${with_pam-"no"} != "no"; then
     # Check for pam_start() in libpam first, then for pam_appl.h.
     #
     found_pam_lib=no
-    as_ac_Lib=`$as_echo "ac_cv_lib_pam_pam_start$lt_cv_dlopen_libs" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pam_start in -lpam" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pam_start in -lpam" >&5
 $as_echo_n "checking for pam_start in -lpam... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+if ${ac_cv_lib_pam_pam_start+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -22510,18 +22528,17 @@ return pam_start ();
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_pam_pam_start=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_pam_pam_start=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-eval ac_res=\$$as_ac_Lib
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pam_pam_start" >&5
+$as_echo "$ac_cv_lib_pam_pam_start" >&6; }
+if test "x$ac_cv_lib_pam_pam_start" = xyes; then :
   found_pam_lib=yes
 fi
 
@@ -23256,6 +23273,8 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 	AUTH_OBJS="$AUTH_OBJS kerb5.lo"
     fi
+fi
+if test ${with_kerb5-'no'} != "no"; then
     _LIBS="$LIBS"
     LIBS="${LIBS} ${SUDOERS_LIBS}"
     for ac_func in krb5_verify_user krb5_init_secure_context
@@ -26426,7 +26445,6 @@ test "$datarootdir" = '${prefix}/share' 
 test "$docdir" = '${datarootdir}/doc/${PACKAGE_TARNAME}' && docdir='$(datarootdir)/doc/$(PACKAGE_TARNAME)'
 test "$localedir" = '${datarootdir}/locale' && localedir='$(datarootdir)/locale'
 test "$localstatedir" = '${prefix}/var' && localstatedir='$(prefix)/var'
-test "$sysconfdir" = '${prefix}/etc' && sysconfdir='/etc'
 
 if test X"$INIT_SCRIPT" != X""; then
     ac_config_files="$ac_config_files init.d/$INIT_SCRIPT"
