From c0665da2990daf45227723cf17edc67b5e581519 Mon Sep 17 00:00:00 2001 From: Robert Sipka Date: Fri, 17 Jun 2016 13:50:21 +0200 Subject: [PATCH] Build fix for ALL_IN_ONE and COMPILER_DEFAULT_LIBC The build fails with enabled ALL_ON_ONE and enabled COMPILER_DEFAULT_LIBC options, because the _BSD_SOURCE doesn't defined before including the sys/time.h. In case of glibc, the 'timezone' is not part of C99 but part of POSIX, so we need to define the _BSD_SOURCE feature test macro before including sys/time.h to get the prototype for this struct. JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com --- jerry-core/CMakeLists.txt | 3 +++ targets/default/jerry-port-default-date.c | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/jerry-core/CMakeLists.txt b/jerry-core/CMakeLists.txt index eeb67f55a..52fd9cf1f 100644 --- a/jerry-core/CMakeLists.txt +++ b/jerry-core/CMakeLists.txt @@ -150,6 +150,9 @@ project (JerryCore C ASM) # Jerry port if(NOT ("${PORT_DIR}" STREQUAL "")) file(GLOB SOURCE_PORT_FILES ${PORT_DIR}/*.c) + if (NOT USE_JERRY_LIBC) + set (DEFINES_JERRY ${DEFINES_JERRY} _BSD_SOURCE) + endif() endif() # All-in-one build diff --git a/targets/default/jerry-port-default-date.c b/targets/default/jerry-port-default-date.c index 8975b9e98..d09e48990 100644 --- a/targets/default/jerry-port-default-date.c +++ b/targets/default/jerry-port-default-date.c @@ -14,7 +14,6 @@ * limitations under the License. */ -#define _BSD_SOURCE #include #include "jerry-port.h"