$NetBSD: patch-at,v 1.12 2009/03/21 18:25:34 tron Exp $

--- configure.orig	2009-01-19 11:00:12.000000000 +0000
+++ configure	2009-03-21 14:45:27.000000000 +0000
@@ -667,6 +667,7 @@
 target_os
 configdir
 lockdir
+statedir
 piddir
 logfilebase
 privatedir
@@ -1399,6 +1400,7 @@
   --with-privatedir=DIR   Where to put smbpasswd ($ac_default_prefix/private)
   --with-rootsbindir=DIR  Which directory to use for root sbin ($ac_default_prefix/sbin)
   --with-lockdir=DIR      Where to put lock files ($ac_default_prefix/var/locks)
+  --with-statedir=DIR     Where to put state files ($ac_default_prefix/var/locks)
   --with-piddir=DIR       Where to put pid files ($ac_default_prefix/var/locks)
   --with-swatdir=DIR      Where to put SWAT files ($ac_default_prefix/swat)
   --with-configdir=DIR    Where to put configuration files ($libdir)
@@ -2141,6 +2143,7 @@
 
 rootsbindir="\${SBINDIR}"
 lockdir="\${VARDIR}/locks"
+statedir="\${VARDIR}/locks"
 piddir="\${VARDIR}/locks"
 test "${mandir}" || mandir="\${prefix}/man"
 logfilebase="\${VARDIR}"
@@ -2155,7 +2158,8 @@
 if test "${with_fhs+set}" = set; then
   withval=$with_fhs;  case "$withval" in
   yes)
-    lockdir="\${VARDIR}/lib/samba"
+    lockdir="\${VARDIR}/run/samba"
+    statedir="\${VARDIR}/lib/samba"
     piddir="\${VARDIR}/run"
     mandir="\${prefix}/share/man"
     logfilebase="\${VARDIR}/log/samba"
@@ -2229,6 +2233,26 @@
 
 
 #################################################
+# set state directory location
+
+# Check whether --with-statedir was given.
+if test "${with_statedir+set}" = set; then
+  withval=$with_statedir;  case "$withval" in
+  yes|no)
+  #
+  # Just in case anybody calls it without argument
+  #
+    { echo "$as_me:$LINENO: WARNING: --with-statedir called without argument - will use default" >&5
+echo "$as_me: WARNING: --with-statedir called without argument - will use default" >&2;}
+  ;;
+  * )
+    statedir="$withval"
+    ;;
+  esac
+fi
+
+
+#################################################
 # set pid directory location
 
 # Check whether --with-piddir was given.
@@ -2469,6 +2493,7 @@
 
 
 
+
 ## check for --enable-debug first before checking CFLAGS before
 ## so that we don't mix -O and -g
 # Check whether --enable-debug was given.
@@ -31354,7 +31379,8 @@
 
 
 
-for ac_func in getdents getdents64
+
+for ac_func in getdents getdents64 getpwent_r
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
 { echo "$as_me:$LINENO: checking for $ac_func" >&5
@@ -46820,6 +46846,74 @@
 ##################
 # look for a method of finding the list of network interfaces
 iface=no;
+{ echo "$as_me:$LINENO: checking for iface ifaddrs" >&5
+echo $ECHO_N "checking for iface ifaddrs... $ECHO_C" >&6; }
+if test "${samba_cv_HAVE_IFACE_IFADDRS+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+SAVE_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS ${SAMBA_CONFIGURE_CPPFLAGS}"
+if test "$cross_compiling" = yes; then
+  samba_cv_HAVE_IFACE_IFADDRS=cross
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#define HAVE_IFACE_IFADDRS 1
+#define AUTOCONF_TEST 1
+#include "${srcdir-.}/lib/interfaces.c"
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  samba_cv_HAVE_IFACE_IFADDRS=yes
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+samba_cv_HAVE_IFACE_IFADDRS=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+{ echo "$as_me:$LINENO: result: $samba_cv_HAVE_IFACE_IFADDRS" >&5
+echo "${ECHO_T}$samba_cv_HAVE_IFACE_IFADDRS" >&6; }
+CPPFLAGS="$SAVE_CPPFLAGS"
+if test x"$samba_cv_HAVE_IFACE_IFADDRS" = x"yes"; then
+	iface=yes;
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_IFACE_IFADDRS 1
+_ACEOF
+
+fi
+
+if test $iface = no; then
 { echo "$as_me:$LINENO: checking for iface AIX" >&5
 echo $ECHO_N "checking for iface AIX... $ECHO_C" >&6; }
 if test "${samba_cv_HAVE_IFACE_AIX+set}" = set; then
@@ -46887,6 +46981,7 @@
 _ACEOF
 
 fi
+fi
 
 if test $iface = no; then
 { echo "$as_me:$LINENO: checking for iface ifconf" >&5
@@ -50266,9 +50361,9 @@
 
 
 
-        { echo "$as_me:$LINENO: checking for des_set_key in -lcrypto" >&5
-echo $ECHO_N "checking for des_set_key in -lcrypto... $ECHO_C" >&6; }
-if test "${ac_cv_lib_ext_crypto_des_set_key+set}" = set; then
+        { echo "$as_me:$LINENO: checking for EVP_des_cbc in -lcrypto" >&5
+echo $ECHO_N "checking for EVP_des_cbc in -lcrypto... $ECHO_C" >&6; }
+if test "${ac_cv_lib_ext_crypto_EVP_des_cbc+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -50284,11 +50379,11 @@
 #ifdef __cplusplus
 extern "C"
 #endif
-char des_set_key ();
+char EVP_des_cbc ();
 int
 main ()
 {
-return des_set_key ();
+return EVP_des_cbc ();
   ;
   return 0;
 }
@@ -50311,13 +50406,13 @@
 	 test ! -s conftest.err
        } && test -s conftest$ac_exeext &&
        $as_test_x conftest$ac_exeext; then
-  ac_cv_lib_ext_crypto_des_set_key=yes;
+  ac_cv_lib_ext_crypto_EVP_des_cbc=yes;
 		  ac_cv_lib_ext_crypto=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_ext_crypto_des_set_key=no;
+	ac_cv_lib_ext_crypto_EVP_des_cbc=no;
 		  ac_cv_lib_ext_crypto=no
 fi
 
@@ -50325,11 +50420,11 @@
       conftest$ac_exeext conftest.$ac_ext
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_ext_crypto_des_set_key" >&5
-echo "${ECHO_T}$ac_cv_lib_ext_crypto_des_set_key" >&6; }
-    if test $ac_cv_lib_ext_crypto_des_set_key = yes; then
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_ext_crypto_EVP_des_cbc" >&5
+echo "${ECHO_T}$ac_cv_lib_ext_crypto_EVP_des_cbc" >&6; }
+    if test $ac_cv_lib_ext_crypto_EVP_des_cbc = yes; then
   cat >>confdefs.h <<_ACEOF
-#define HAVE_DES_SET_KEY 1
+#define HAVE_EVP_DES_CBC 1
 _ACEOF
 
 fi
@@ -63573,31 +63668,39 @@
 		NSSSONAMEVERSIONSUFFIX=".2"
 		WINBIND_NSS_EXTRA_OBJS="nsswitch/winbind_nss_linux.o"
 		;;
-	*freebsd[5-9]*)
-		# FreeBSD winbind client is implemented as a wrapper around
-		# the Linux version.
-		NSSSONAMEVERSIONSUFFIX=".1"
-		WINBIND_NSS_EXTRA_OBJS="nsswitch/winbind_nss_freebsd.o \
-		    nsswitch/winbind_nss_linux.o"
-		WINBIND_NSS="nsswitch/nss_winbind.$SHLIBEXT"
-		WINBIND_WINS_NSS="nsswitch/nss_wins.$SHLIBEXT"
-		;;
-
-	*netbsd*[3-9]*)
-		# NetBSD winbind client is implemented as a wrapper
-		# around the Linux version. It needs getpwent_r() to
-		# indicate libc's use of the correct nsdispatch API.
-		#
-		if test x"$ac_cv_func_getpwent_r" = x"yes"; then
-			WINBIND_NSS_EXTRA_OBJS="\
-			    nsswitch/winbind_nss_netbsd.o \
+	*freebsd*)
+		case "$UNAME_R" in
+		[5-9]*)
+			# FreeBSD winbind client is implemented as a wrapper
+			# around the Linux version.
+			NSSSONAMEVERSIONSUFFIX=".1"
+			WINBIND_NSS_EXTRA_OBJS="nsswitch/winbind_nss_freebsd.o \
 			    nsswitch/winbind_nss_linux.o"
 			WINBIND_NSS="nsswitch/nss_winbind.$SHLIBEXT"
 			WINBIND_WINS_NSS="nsswitch/nss_wins.$SHLIBEXT"
-		else
-			HAVE_WINBIND=no
-			winbind_no_reason=", getpwent_r is missing on $host_os so winbind is unsupported"
-		fi
+			;;
+		esac
+		;;
+
+	*netbsd*)
+		case "$UNAME_R" in
+		[3-9]*)
+			# NetBSD winbind client is implemented as a wrapper
+			# around the Linux version. It needs getpwent_r() to
+			# indicate libc's use of the correct nsdispatch API.
+			#
+			if test x"$ac_cv_func_getpwent_r" = x"yes"; then
+				WINBIND_NSS_EXTRA_OBJS="\
+				    nsswitch/winbind_nss_netbsd.o \
+				    nsswitch/winbind_nss_linux.o"
+				WINBIND_NSS="nsswitch/nss_winbind.$SHLIBEXT"
+				WINBIND_WINS_NSS="nsswitch/nss_wins.$SHLIBEXT"
+			else
+				HAVE_WINBIND=no
+				winbind_no_reason=", getpwent_r is missing on $host_os so winbind is unsupported"
+			fi
+			;;
+		esac
 		;;
 	*irix*)
 		# IRIX has differently named shared libraries
@@ -68126,6 +68229,7 @@
 target_os!$target_os$ac_delim
 configdir!$configdir$ac_delim
 lockdir!$lockdir$ac_delim
+statedir!$statedir$ac_delim
 piddir!$piddir$ac_delim
 logfilebase!$logfilebase$ac_delim
 privatedir!$privatedir$ac_delim
@@ -68169,7 +68273,6 @@
 KRB5_LIBS!$KRB5_LIBS$ac_delim
 UUID_LIBS!$UUID_LIBS$ac_delim
 LDAP_LIBS!$LDAP_LIBS$ac_delim
-PAM_MODULES!$PAM_MODULES$ac_delim
 _ACEOF
 
   if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@@ -68211,6 +68314,7 @@
 ac_delim='%!_!# '
 for ac_last_try in false false false false false :; do
   cat >conf$$subs.sed <<_ACEOF
+PAM_MODULES!$PAM_MODULES$ac_delim
 INSTALL_PAM_MODULES!$INSTALL_PAM_MODULES$ac_delim
 UNINSTALL_PAM_MODULES!$UNINSTALL_PAM_MODULES$ac_delim
 NSS_MODULES!$NSS_MODULES$ac_delim
@@ -68298,7 +68402,7 @@
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 85; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 86; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
