changed MISSING_{NANOSLEEP,GETTIME} to use -D to fix compilation on OS X

This commit is contained in:
Jon Williams 2016-03-31 13:38:34 -04:00
parent 94706763e5
commit e0c15ea7e8
3 changed files with 7 additions and 14 deletions

View file

@ -27,11 +27,12 @@ LIBS+=-lrt
endif endif
ifeq ($(UNAME), Darwin) ifeq ($(UNAME), Darwin)
# TODO: Putting GCC in C11 mode breaks things. # TODO: Putting GCC in C11 mode breaks things.
CFLAGS+=-std=c11 CFLAGS+=-std=c11 -DMISSING_GETTIME -DMISSING_NANOSLEEP
COMPAT+=compat/clock_gettime/clock_gettime.o compat/clock_nanosleep/clock_nanosleep.o COMPAT+=compat/clock_gettime/clock_gettime.o compat/clock_nanosleep/clock_nanosleep.o
endif endif
ifeq ($(UNAME), OpenBSD) ifeq ($(UNAME), OpenBSD)
CFLAGS+= -DMISSING_NANOSLEEP
COMPAT+= compat/clock_nanosleep/clock_nanosleep.o COMPAT+= compat/clock_nanosleep/clock_nanosleep.o
endif endif

View file

@ -1,8 +1,8 @@
#ifndef CLOCK_NANOSLEEP_H #ifndef CLOCK_NANOSLEEP_H
#define CLOCK_NANOSLEEP_H #define CLOCK_NANOSLEEP_H
#ifndef _CLOCK_T_DEFINED_ #ifndef CLOCKID_T
#define _CLOCK_T_DEFINED_ #define CLOCKID_T
typedef enum typedef enum
{ {
CLOCK_REALTIME, CLOCK_REALTIME,
@ -10,7 +10,8 @@ typedef enum
CLOCK_PROCESS_CPUTIME_ID, CLOCK_PROCESS_CPUTIME_ID,
CLOCK_THREAD_CPUTIME_ID CLOCK_THREAD_CPUTIME_ID
} clockid_t; } clockid_t;
#endif // _CLOCK_T_DEFINED_ #endif // ifndef CLOCKID_T
#ifndef TIMER_ABSTIME #ifndef TIMER_ABSTIME
#define TIMER_ABSTIME 1 #define TIMER_ABSTIME 1

View file

@ -7,11 +7,6 @@
#if defined(__APPLE__) #if defined(__APPLE__)
/* implementations of clock_gettime, clock_nanosleep */
#define MISSING_NANOSLEEP
#define MISSING_GETTIME
/* /*
* Mach endian conversion * Mach endian conversion
*/ */
@ -29,16 +24,12 @@
#endif #endif
#if defined(__OpenBSD__)
#define MISSING_NANOSLEEP
#endif
#ifdef MISSING_NANOSLEEP #ifdef MISSING_NANOSLEEP
#include "clock_nanosleep/clock_nanosleep.h" #include "clock_nanosleep/clock_nanosleep.h"
#endif #endif
#ifdef MISSING_GETTIME #ifdef MISSING_GETTIME
#include "clock_nanosleep/clock_gettime.h" #include "clock_gettime/clock_gettime.h"
#endif #endif
#endif //COMPAT_UTIL_H #endif //COMPAT_UTIL_H