Skip to content

Commit c0665da

Browse files
committed
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
1 parent 37ebd20 commit c0665da

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

jerry-core/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ project (JerryCore C ASM)
150150
# Jerry port
151151
if(NOT ("${PORT_DIR}" STREQUAL ""))
152152
file(GLOB SOURCE_PORT_FILES ${PORT_DIR}/*.c)
153+
if (NOT USE_JERRY_LIBC)
154+
set (DEFINES_JERRY ${DEFINES_JERRY} _BSD_SOURCE)
155+
endif()
153156
endif()
154157

155158
# All-in-one build

targets/default/jerry-port-default-date.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
#define _BSD_SOURCE
1817
#include <sys/time.h>
1918

2019
#include "jerry-port.h"

0 commit comments

Comments
 (0)