$NetBSD: patch-ag,v 1.6 2005/10/10 17:48:10 joerg Exp $

--- configure.orig	2004-11-26 21:04:30.000000000 +0100
+++ configure	2005-05-10 21:38:19.000000000 +0200
@@ -1051,6 +1051,7 @@
   --with-devel            add development options
   --with-efence           link with -lefence for malloc() debugging
   --with-csops            add CSOps standard options
+  --with-nbsdops          add NetBSD standard options
   --without-passwd        don't use passwd/shadow file for authentication
   --with-skey=DIR       enable S/Key support
   --with-opie=DIR       enable OPIE support
@@ -1622,7 +1623,6 @@
 test "$mandir" = '${prefix}/man' && mandir='$(prefix)/man'
 test "$bindir" = '${exec_prefix}/bin' && bindir='$(exec_prefix)/bin'
 test "$sbindir" = '${exec_prefix}/sbin' && sbindir='$(exec_prefix)/sbin'
-test "$sysconfdir" = '${prefix}/etc' -a X"$with_stow" != X"yes" && sysconfdir='/etc'
 
 
 
@@ -1820,6 +1820,22 @@
 fi;
 
 
+# Check whether --with-nbsdops or --without-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 or --without-passwd was given.
 if test "${with_passwd+set}" = set; then
   withval="$with_passwd"
@@ -5228,7 +5244,7 @@
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-freebsd*)
+freebsd*|dragonfly*)
   if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
     case $host_cpu in
     i*86 )
@@ -8440,7 +8456,7 @@
       ;;
 
     # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
-    freebsd*)
+    dragonfly*|freebsd*)
       archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
       hardcode_libdir_flag_spec='-R$libdir'
       hardcode_direct=yes
@@ -9071,11 +9087,11 @@
   dynamic_linker=no
   ;;
 
-freebsd*)
+dragonfly*|freebsd*)
   objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
   version_type=freebsd-$objformat
   case $version_type in
-    freebsd-elf*)
+    dragonfly*|freebsd-elf*)
       library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
       ;;
     freebsd-*)
@@ -11205,7 +11221,7 @@
   freebsd-elf*)
     archive_cmds_need_lc_CXX=no
     ;;
-  freebsd*)
+  dragonfly*|freebsd*)
     # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
     # conventions
     ld_shlibs_CXX=yes
@@ -12576,11 +12592,11 @@
   dynamic_linker=no
   ;;
 
-freebsd*)
+dragonfly*|freebsd*)
   objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
   version_type=freebsd-$objformat
   case $version_type in
-    freebsd-elf*)
+    dragonfly*|freebsd-elf*)
       library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
       ;;
     freebsd-*)
@@ -14890,7 +14906,7 @@
       ;;
 
     # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
-    freebsd*)
+    dragonfly*|freebsd*)
       archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
       hardcode_libdir_flag_spec_F77='-R$libdir'
       hardcode_direct_F77=yes
@@ -15521,11 +15537,11 @@
   dynamic_linker=no
   ;;
 
-freebsd*)
+dragonfly*|freebsd*)
   objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
   version_type=freebsd-$objformat
   case $version_type in
-    freebsd-elf*)
+    dragonfly*|freebsd-elf*)
       library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
       ;;
     freebsd-*)
@@ -17123,7 +17139,7 @@
       ;;
 
     # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
-    freebsd*)
+    dragonfly*|freebsd*)
       archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
       hardcode_libdir_flag_spec_GCJ='-R$libdir'
       hardcode_direct_GCJ=yes
@@ -17754,11 +17770,11 @@
   dynamic_linker=no
   ;;
 
-freebsd*)
+dragonfly*|freebsd*)
   objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
   version_type=freebsd-$objformat
   case $version_type in
-    freebsd-elf*)
+    dragonfly*|freebsd-elf*)
       library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
       ;;
     freebsd-*)
@@ -21737,7 +21753,7 @@
 		    esac
 		fi
 		;;
-    *-*-freebsd*)
+    *-*-freebsd*|*-*-dragonfly*)
 		# FreeBSD has a real setreuid(2) starting with 2.1 and
 		# backported to 2.0.5.  We just take 2.1 and above...
 		case "`echo $host_os | sed 's/^freebsd\([0-9\.]*\).*$/\1/'`" in
@@ -29049,6 +29065,58 @@
 _ACEOF
 
 	    SUDO_LIBS="${SUDO_LIBS} -lkrb5 -ldes -lcom_err -lasn1"
+	    echo "$as_me:$LINENO: checking for main in -lcrypto" >&5
+echo $ECHO_N "checking for main in -lcrypto... $ECHO_C" >&6
+if test "${ac_cv_lib_crypto_main+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lcrypto  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+
+int
+main ()
+{
+main ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_crypto_main=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_crypto_main=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_crypto_main" >&5
+echo "${ECHO_T}$ac_cv_lib_crypto_main" >&6
+if test $ac_cv_lib_crypto_main = yes; then
+  SUDO_LIBS="${SUDO_LIBS} -lcrypto"
+fi
+
 	    echo "$as_me:$LINENO: checking for main in -lroken" >&5
 echo $ECHO_N "checking for main in -lroken... $ECHO_C" >&6
 if test "${ac_cv_lib_roken_main+set}" = set; then
@@ -29101,7 +29169,6 @@
   SUDO_LIBS="${SUDO_LIBS} -lroken"
 fi
 
-
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
