Move all (nano|u)sleep-related decisions to default port implementation (#2462)
... where they belong. JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
@@ -26,6 +26,16 @@ file(GLOB SOURCE_PORT_DEFAULT *.c)
|
||||
# (should only be necessary if we used compiler default libc but not checking that)
|
||||
set(DEFINES_PORT_DEFAULT _BSD_SOURCE _DEFAULT_SOURCE)
|
||||
|
||||
# Sleep function availability check
|
||||
INCLUDE (CheckIncludeFiles)
|
||||
CHECK_INCLUDE_FILES (time.h HAVE_TIME_H)
|
||||
CHECK_INCLUDE_FILES (unistd.h HAVE_UNISTD_H)
|
||||
if(HAVE_TIME_H)
|
||||
set(DEFINES_PORT_DEFAULT ${DEFINES_PORT_DEFAULT} HAVE_TIME_H)
|
||||
elseif(HAVE_UNISTD_H)
|
||||
set(DEFINES_PORT_DEFAULT ${DEFINES_PORT_DEFAULT} HAVE_UNISTD_H)
|
||||
endif()
|
||||
|
||||
# Default Jerry port implementation library variants:
|
||||
# - default
|
||||
# - default-minimal (no extra termination and log APIs)
|
||||
|
||||
@@ -13,6 +13,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#if !defined (_XOPEN_SOURCE) || _XOPEN_SOURCE < 500
|
||||
#undef _XOPEN_SOURCE
|
||||
/* Required macro for sleep functions (nanosleep or usleep) */
|
||||
#define _XOPEN_SOURCE 500
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TIME_H
|
||||
#include <time.h>
|
||||
#elif defined (HAVE_UNISTD_H)
|
||||
|
||||
Reference in New Issue
Block a user