[gdk-pixbuf] Add more configure checks



commit ab0c8627d4b794c9816909566b38d935bba51828
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Oct 23 08:40:43 2013 -0400

    Add more configure checks
    
    Oh portability / how I hate thee.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=710690

 configure.ac                     |    5 ++---
 tests/pixbuf-randomly-modified.c |    7 ++++++-
 2 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 99b29e6..2f518e1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -424,9 +424,8 @@ LIBS="$LIBS $GLIB_LIBS"
 AC_CHECK_FUNCS(bind_textdomain_codeset)
 LIBS=$gtk_save_LIBS
 
-AC_CHECK_HEADERS(unistd.h,
-                 AC_DEFINE(HAVE_UNISTD_H, 1,
-                           [Define to 1 if unistd.h is available]))
+AC_CHECK_HEADERS(unistd.h sys/resource.h)
+AC_CHECK_FUNCS(setrlimit)
 
 saved_cflags="$CFLAGS"
 saved_ldflags="$LDFLAGS"
diff --git a/tests/pixbuf-randomly-modified.c b/tests/pixbuf-randomly-modified.c
index f03fb38..2245241 100644
--- a/tests/pixbuf-randomly-modified.c
+++ b/tests/pixbuf-randomly-modified.c
@@ -26,7 +26,9 @@
 #include <time.h>
 #include <string.h>
 #include <sys/time.h>
+#ifdef HAVE_SYS_RESOURCE_H
 #include <sys/resource.h>
+#endif
 
 static void
 disaster (const char *what)
@@ -104,14 +106,17 @@ main (int argc, char **argv)
   gboolean got_seed = FALSE;
   GPtrArray *files = g_ptr_array_new ();
   int l, iterations;
+
+#ifdef HAVE_SETRLIMIT
   struct rlimit max_mem_size;
 
   max_mem_size.rlim_cur = 100 * 1024 * 1024; /* 100M */
   max_mem_size.rlim_max = max_mem_size.rlim_cur;
   setrlimit (RLIMIT_DATA, &max_mem_size);
-#if defined (RLIMIT_AS)
+#ifdef RLIMIT_AS
   setrlimit (RLIMIT_AS, &max_mem_size);
 #endif
+#endif
 
   g_test_init (&argc, &argv, NULL);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]