Index: acconfig.h
===================================================================
RCS file: /cvsroot/openvpn/openvpn/acconfig.h,v
retrieving revision 1.2
diff -u -r1.2 acconfig.h
--- acconfig.h	2 May 2002 07:18:08 -0000	1.2
+++ acconfig.h	6 May 2002 08:17:31 -0000
@@ -48,6 +48,9 @@
 /* early versions of glibc don't define in_addr_t */
 #undef in_addr_t
 
+/* some outdated systems don't have socklen_t */
+#undef socklen_t
+
 /* what system are we running on? */
 #undef TARGET_ALIAS
 
@@ -59,3 +62,6 @@
 
 /* are we running on BSD? */
 #undef TARGET_BSD
+
+/* are we running on Mac OS X / Darwin? */
+#undef TARGET_DARWIN
Index: configure.in
===================================================================
RCS file: /cvsroot/openvpn/openvpn/configure.in,v
retrieving revision 1.8
diff -u -r1.8 configure.in
--- configure.in	2 May 2002 07:18:08 -0000	1.8
+++ configure.in	6 May 2002 08:17:32 -0000
@@ -58,6 +58,48 @@
   LIBS="$LIB_PREFIX $LIB_SUFFIX"
 ])
 
+dnl -- The following is take from curl's acinclude.m4 --
+dnl Check for socklen_t: historically on BSD it is an int, and in
+dnl POSIX 1g it is a type of its own, but some platforms use different
+dnl types for the argument to getsockopt, getpeername, etc.  So we
+dnl have to test to find something that will work.
+AC_DEFUN([TYPE_SOCKLEN_T],
+[
+   AC_CHECK_TYPE([socklen_t], ,[
+      AC_MSG_CHECKING([for socklen_t equivalent])
+      AC_CACHE_VAL([curl_cv_socklen_t_equiv],
+      [
+         # Systems have either "struct sockaddr *" or
+         # "void *" as the second argument to getpeername
+         curl_cv_socklen_t_equiv=
+         for arg2 in "struct sockaddr" void; do
+            for t in int size_t unsigned long "unsigned long"; do
+               AC_TRY_COMPILE([
+                  #include <sys/types.h>
+                  #include <sys/socket.h>
+
+                  int getpeername (int, $arg2 *, $t *);
+               ],[
+                  $t len;
+                  getpeername(0,0,&len);
+               ],[
+                  curl_cv_socklen_t_equiv="$t"
+                  break
+               ])
+            done
+         done
+
+         if test "x$curl_cv_socklen_t_equiv" = x; then
+            AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
+         fi
+      ])
+      AC_MSG_RESULT($curl_cv_socklen_t_equiv)
+      AC_DEFINE_UNQUOTED(socklen_t, $curl_cv_socklen_t_equiv,
+			[type to use in place of socklen_t if not defined])],
+      [#include <sys/types.h>
+#include <sys/socket.h>])
+])
+
 AC_INIT(openvpn.c)
 
 AM_CONFIG_HEADER(config.h)
@@ -145,6 +187,7 @@
 
 dnl check that in_addr_t is defined
 OPENVPN_CHECK_TYPE(in_addr_t, uint32_t)
+TYPE_SOCKLEN_T
 
 AC_DEFINE_UNQUOTED(TARGET_ALIAS, "$target_alias")
 
@@ -152,6 +195,14 @@
 OPENVPN_CHECK_TARGET(linux, TARGET_LINUX)
 OPENVPN_CHECK_TARGET(solaris, TARGET_SOLARIS)
 OPENVPN_CHECK_TARGET(bsd, TARGET_BSD)
+OPENVPN_CHECK_TARGET(darwin, TARGET_DARWIN)
+
+dnl some Mac OS X tendering (we use vararg macros...)
+case "$host" in
+*-*-darwin*)
+	CPPFLAGS="$CPPFLAGS -no-cpp-precomp"
+	;;
+esac
 
 AC_CHECKING( for TUN/TAP driver version ... )
 AC_CHECK_HEADER(linux/if_tun.h,
Index: syshead.h
===================================================================
RCS file: /cvsroot/openvpn/openvpn/syshead.h,v
retrieving revision 1.2
diff -u -r1.2 syshead.h
--- syshead.h	2 May 2002 07:18:08 -0000	1.2
+++ syshead.h	6 May 2002 08:17:32 -0000
@@ -34,6 +34,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <stdlib.h>
+#include <stdint.h>
 #include <stdarg.h>
 #include <unistd.h>
 #include <signal.h>
