$NetBSD: patch-aa,v 1.8 2006/09/01 06:54:29 joerg Exp $

--- configure.orig	2006-07-27 18:43:37.000000000 +0000
+++ configure
@@ -20112,17 +20112,17 @@ echo $ECHO_N "checking for libgtop sysde
 	  libgtop_have_sysinfo=yes
 	  libgtop_need_server=no
 	  ;;
-	freebsd*|netbsd*|openbsd*|bsdi*)
+	freebsd*|netbsd*|openbsd*|bsdi*|dragonfly*)
 	  libgtop_sysdeps_dir=freebsd
 	  libgtop_use_machine_h=yes
 	  libgtop_need_server=yes
-	  libgtop_postinstall='chgrp kmem $(bindir)/libgtop_server && chmod 2755 $(bindir)/libgtop_server'
+	  libgtop_postinstall='chgrp kmem $(bindir)/libgtop_server2 && chmod 2755 $(bindir)/libgtop_server'
 	  ;;
 	solaris*)
 	  libgtop_sysdeps_dir=solaris
 	  libgtop_use_machine_h=yes
 	  libgtop_need_server=yes
-	  libgtop_postinstall='chgrp sys $(bindir)/libgtop_server && chmod 2755 $(bindir)/libgtop_server'
+	  libgtop_postinstall='chgrp sys $(bindir)/libgtop_server2 && chmod 2755 $(bindir)/libgtop_server'
 	  ;;
 	aix*)
 	  libgtop_sysdeps_dir=aix
@@ -20170,7 +20170,7 @@ echo "${ECHO_T}$libgtop_sysdeps_dir" >&6
 
 
 	case "$host_os" in
-	*bsd*)
+	*bsd* | *dragonfly*)
 	  echo "$as_me:$LINENO: checking for kvm_open in -lkvm" >&5
 echo $ECHO_N "checking for kvm_open in -lkvm... $ECHO_C" >&6
 if test "${ac_cv_lib_kvm_kvm_open+set}" = set; then
@@ -20413,7 +20413,9 @@ cat >>conftest.$ac_ext <<_ACEOF
 #include <net/netisr.h>
 #include <net/route.h>
 
-#if defined(__FreeBSD__) || defined(__NetBSD__)
+#if defined(__DragonFly__)
+#include <net/sppp/if_sppp.h>
+#elif defined(__FreeBSD__) || defined(__NetBSD__)
 #include <net/if_sppp.h>
 #else
 #include <i4b/sppp/if_sppp.h>
@@ -20488,7 +20490,9 @@ cat >>conftest.$ac_ext <<_ACEOF
 #include <net/netisr.h>
 #include <net/route.h>
 
-#if defined(__FreeBSD__) || defined(__NetBSD__)
+#if defined(__DragonFly__)
+#include <net/sppp/if_sppp.h>
+#elif defined(__FreeBSD__) || defined(__NetBSD__)
 #include <net/if_sppp.h>
 #else
 #include <i4b/sppp/if_sppp.h>
@@ -20561,9 +20565,10 @@ echo $ECHO_N "checking what we need to d
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   msginfo_needs=
-	    for def in nothing KERNEL _KERNEL; do
+	    for def in nothing KERNEL _KERNEL_STRUCTURES _KERNEL; do
 	      cat >conftest.$ac_ext <<_ACEOF
 #define $def
+#include <sys/types.h>
 #include <sys/ipc.h>
 #include <sys/msg.h>
 #include <stdio.h>
@@ -23925,6 +23930,146 @@ fi
 esac
 
 
+echo "$as_me:$LINENO: checking for kvm_open in -lkvm" >&5
+echo $ECHO_N "checking for kvm_open in -lkvm... $ECHO_C" >&6
+if test "${ac_cv_lib_mach_kvm_open+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lkvm  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char kvm_open ();
+int
+main ()
+{
+kvm_open ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (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); }; } &&
+	 { 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_mach_kvm_open=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_mach_kvm_open=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_mach_kvm_open" >&5
+echo "${ECHO_T}$ac_cv_lib_mach_kvm_open" >&6
+if test $ac_cv_lib_mach_kvm_open = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBMACH 1
+_ACEOF
+
+  KVM_LIBS="-lkvm $KVM_LIBS"
+
+fi
+
+echo "$as_me:$LINENO: checking for kinfo_get_sched_hz in -lkinfo" >&5
+echo $ECHO_N "checking for kinfo_get_sched_hz in -lkinfo... $ECHO_C" >&6
+if test "${ac_cv_lib_kinfo_kinfo_get_sched_gz+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lkinfo  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char kinfo_get_sched_hz ();
+int
+main ()
+{
+kinfo_get_sched_hz ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (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); }; } &&
+	 { 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_kinfo_kinfo_get_sched_hz=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_kinfo_kinfo_get_sched_hz=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_kinfo_kinfo_get_sched_hz" >&5
+echo "${ECHO_T}$ac_cv_lib_kinfo_kinfo_get_sched_hz" >&6
+if test $ac_cv_lib_kinfo_kinfo_get_sched_hz = yes; then
+
+  LIBS="-lkinfo $LIBS" # we need kvm as well
+fi
+
 echo "$as_me:$LINENO: checking for vm_statistics in -lmach" >&5
 echo $ECHO_N "checking for vm_statistics in -lmach... $ECHO_C" >&6
 if test "${ac_cv_lib_mach_vm_statistics+set}" = set; then
@@ -29952,7 +30097,7 @@ if test x$cross_compiling = xyes ; then
         sunos*)
           fu_cv_sys_stat_statfs4=yes
           ;;
-        freebsd*)
+        freebsd* | dragonfly*)
           fu_cv_sys_stat_statfs2_bsize=yes
           ;;
         osf*)
@@ -30603,7 +30748,7 @@ cat >>conftest.$ac_ext <<_ACEOF
 
 _ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "f_type;" >/dev/null 2>&1; then
+  $EGREP "f_type;|struct statvfs" >/dev/null 2>&1; then
   ok=yes
 fi
 rm -f conftest*
@@ -32141,6 +32290,7 @@ s,@ECHO_C@,$ECHO_C,;t t
 s,@ECHO_N@,$ECHO_N,;t t
 s,@ECHO_T@,$ECHO_T,;t t
 s,@LIBS@,$LIBS,;t t
+s,@KVM_LIBS@,$KVM_LIBS,;t t
 s,@build@,$build,;t t
 s,@build_cpu@,$build_cpu,;t t
 s,@build_vendor@,$build_vendor,;t t
