From 519b5f619baa43f000ad18c079017bea8e7fc06a Mon Sep 17 00:00:00 2001 From: Joel Brobecker Date: Tue, 16 Sep 2014 14:32:09 -0400 Subject: [PATCH] libiberty/mkstemps.c: Include if not available. Attempting to build libiberty on LynxOS-178 fails trying to compile mkstemps.c with the following error: mkstemps.c:84:18: error: storage size of 'tv' isn't known struct timeval tv; ^ This file would normally include to get the type's definition, but unfortunately LynxOS-178 does not want us to use , only . The configure script correctly finds this out and generates a config.h file where HAVE_SYS_TIME_H is undefined: /* Define to 1 if you have the header file. */ /* #undef HAVE_SYS_TIME_H */ This patch fixes the build issue by falling back on including if could not be included (and provided that HAVE_TIME_H is defined, of course). libiberty/ChangeLog: * mkstemps.c: #include if HAVE_TIME_H is defined but not HAVE_SYS_TIME_H. --- libiberty/ChangeLog | 5 +++++ libiberty/mkstemps.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 50098071d39..923613d8caf 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,8 @@ +2015-05-08 Joel Brobecker + + * mkstemps.c: #include if HAVE_TIME_H is defined + but not HAVE_SYS_TIME_H. + 2015-04-22 Eli Zaretskii * setenv.c : Declare only if not a macro. diff --git a/libiberty/mkstemps.c b/libiberty/mkstemps.c index a0e68a73b49..0e06fe17059 100644 --- a/libiberty/mkstemps.c +++ b/libiberty/mkstemps.c @@ -35,6 +35,8 @@ #endif #ifdef HAVE_SYS_TIME_H #include +#elif HAVE_TIME_H +#include #endif #include "ansidecl.h" -- 2.30.2