Keep systems happy which do not have sys/resource.h
authorJohn Darrington <john@darrington.wattle.id.au>
Mon, 6 Jul 2020 19:44:57 +0000 (21:44 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Sun, 5 Jul 2020 19:44:57 +0000 (21:44 +0200)
configure.ac
src/ui/gui/main.c

index 50b7472f9db8b9b1012b5b6f63da59029b507c5d..24cb008fcbf81bd350c10b34764e2f87fbfffcbf 100644 (file)
@@ -56,6 +56,8 @@ if test "x$MSGFMT" = x; then
   PSPP_REQUIRED_PREREQ([msgfmt (is usually provided with gettext)])
 fi
 
+AC_CHECK_HEADERS([sys/resource.h])
+
 
 dnl Checks for libraries.
 AC_SYS_LARGEFILE
index ecb07f83ff378fb6c2c725220396642a68b551f5..9a7f8e1987a7d8a7def941e471df7f37bc500e79 100644 (file)
 #include <gtk/gtk.h>
 #include <stdlib.h>
 #include <sys/stat.h>
-#include <sys/resource.h>
 #if ENABLE_RELOCATABLE && defined(__APPLE__)
+#include <sys/resource.h>
 static const bool apple_relocatable = true;
 #else
 static const bool apple_relocatable = false;
+#if HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#else
+/* Dummy definitions to keep the compiler happy. */
+struct rlimit
+{
+  int rlim_cur;
+  int rlim_max;
+};
+#define RLIMIT_NOFILE 0
+#endif
 #endif
 
 #include "language/lexer/include-path.h"