[gdk-pixbuf] build: Check for sys/time.h



commit dc85e7d27a7436fb7e3f3a806a74050613ded933
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Tue Aug 15 08:59:44 2017 +0800

    build: Check for sys/time.h
    
    sys/time.h is not a header that is provided by all compilers that we
    support, so we need to check for it and include it conditionally so that
    things will build normally, especially as Meson builds will build all
    the test programs as well.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=785767

 configure.ac                     |    2 +-
 meson.build                      |    3 ++-
 tests/pixbuf-randomly-modified.c |    4 ++++
 3 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 76c8adb..100a6e6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -358,7 +358,7 @@ LIBS="$LIBS $GLIB_LIBS"
 AC_CHECK_FUNCS(bind_textdomain_codeset)
 LIBS=$gtk_save_LIBS
 
-AC_CHECK_HEADERS(unistd.h sys/resource.h)
+AC_CHECK_HEADERS(unistd.h sys/resource.h sys/time.h)
 AC_CHECK_FUNCS(setrlimit)
 
 saved_cflags="$CFLAGS"
diff --git a/meson.build b/meson.build
index 5006d76..13ac26c 100644
--- a/meson.build
+++ b/meson.build
@@ -61,7 +61,8 @@ gdk_pixbuf_conf = configuration_data()
 
 check_headers = [
   'unistd.h',
-  'sys/resource.h'
+  'sys/resource.h',
+  'sys/time.h'
 ]
 
 foreach h: check_headers
diff --git a/tests/pixbuf-randomly-modified.c b/tests/pixbuf-randomly-modified.c
index 9f482e4..8b380a0 100644
--- a/tests/pixbuf-randomly-modified.c
+++ b/tests/pixbuf-randomly-modified.c
@@ -24,7 +24,11 @@
 #include <stdlib.h>
 #include <time.h>
 #include <string.h>
+
+#ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
+#endif
+
 #ifdef HAVE_SYS_RESOURCE_H
 #include <sys/resource.h>
 #endif


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