Portability fixes.

diff --git a/configure b/configure
index 1bf05d5..8f7e74b 100755
--- a/configure
+++ b/configure
@@ -13196,6 +13196,7 @@
 
 
 
+
 for ac_func in \
 	_lwp_create \
 	_pclose \
@@ -13218,6 +13219,7 @@
 	getprotobynumber \
 	getpwuid \
 	getservbyport \
+	gettimeofday \
 	inet_network \
 	lseek64 \
 	lstat \
diff --git a/configure.ac b/configure.ac
index 506c3f5..98c767e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -950,6 +950,7 @@
 	getprotobynumber \
 	getpwuid \
 	getservbyport \
+	gettimeofday \
 	inet_network \
 	lseek64 \
 	lstat \
diff --git a/include/config.h.in b/include/config.h.in
index b7a0808..c60f018 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -149,6 +149,9 @@
 /* Define to 1 if you have the `getservbyport' function. */
 #undef HAVE_GETSERVBYPORT
 
+/* Define to 1 if you have the `gettimeofday' function. */
+#undef HAVE_GETTIMEOFDAY
+
 /* Define to 1 if you have the <gif_lib.h> header file. */
 #undef HAVE_GIF_LIB_H
 
diff --git a/libs/port/mkstemps.c b/libs/port/mkstemps.c
index 90620b8..f66743347 100644
--- a/libs/port/mkstemps.c
+++ b/libs/port/mkstemps.c
@@ -71,7 +71,9 @@
   static const char letters[]
     = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
   static gcc_uint64_t value;
+#ifdef HAVE_GETTIMEOFDAY
   struct timeval tv;
+#endif
   char *XXXXXX;
   size_t len;
   int count;
@@ -86,9 +88,13 @@
 
   XXXXXX = &template[len - 6 - suffix_len];
 
+#ifdef HAVE_GETTIMEOFDAY
   /* Get some more or less random data.  */
   gettimeofday (&tv, NULL);
   value += ((gcc_uint64_t) tv.tv_usec << 16) ^ tv.tv_sec ^ getpid ();
+#else
+  value += getpid ();
+#endif
 
   for (count = 0; count < TMP_MAX; ++count)
     {
diff --git a/libs/port/usleep.c b/libs/port/usleep.c
index 6357c94..b72a07e 100644
--- a/libs/port/usleep.c
+++ b/libs/port/usleep.c
@@ -21,6 +21,8 @@
 #include "config.h"
 #include "wine/port.h"
 
+#include <errno.h>
+
 #ifndef HAVE_USLEEP
 int usleep (unsigned int useconds)
 {
diff --git a/libs/unicode/Makefile.in b/libs/unicode/Makefile.in
index 4e1bc04..522cc66 100644
--- a/libs/unicode/Makefile.in
+++ b/libs/unicode/Makefile.in
@@ -81,7 +81,7 @@
 	wctype.c \
 	$(CODEPAGES:%=c_%.c)
 
-all: $(MODULE)
+all: $(MODULE) $(MODULE:.dll=.a)
 
 @MAKE_RULES@