$NetBSD: patch-ad,v 1.5 2015/01/10 10:14:20 rumko Exp $

--- include/global.h.orig	2013-07-08 12:31:36.000000000 +0000
+++ include/global.h
@@ -30,6 +30,13 @@
 
 /* for timeval and timespec */
 #include <time.h>
+#if defined(__FreeBSD__)
+#include <sys/timespec.h>
+#endif
+
+#ifdef __sun
+#include <alloca.h>
+#endif
 
 #ifdef __cplusplus
 extern "C" {
@@ -133,7 +140,7 @@ int snd_shm_area_destroy(struct snd_shm_
 
 int snd_user_file(const char *file, char **result);
 
-#if !defined(_POSIX_C_SOURCE) && !defined(_POSIX_SOURCE)
+#if !defined(_POSIX_C_SOURCE) && !defined(_POSIX_SOURCE) && !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(__DragonFly__) && !defined(__sun)
 struct timeval {
 	time_t		tv_sec;		/* seconds */
 	long		tv_usec;	/* microseconds */
