Skip to content

Commit 6b02796

Browse files
committed
Only inject a custom clock_gettime if we need to.
Per #138 and homebrew/homebrew-x11#219, OSX 10.12 "macOS Sierra" now provides clock_gettime. Wohooo! <3
1 parent 4cfd230 commit 6b02796

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ LIBNAMEFLAG=$(shell sh platform.sh libnameflag $(MAJOR) $(INSTALLLIB))
2828
CFLAGS?=-pipe -O2 $(WARNFLAGS)
2929
CFLAGS+=-g # TODO(sissel): Comment before release
3030
CFLAGS+=$(CPPFLAGS)
31+
CFLAGS+=$(shell sh cflags.sh)
3132

3233
DEFAULT_LIBS=-L/usr/X11R6/lib -L/usr/local/lib -lX11 -lXtst -lXinerama -lxkbcommon
3334
DEFAULT_INC=-I/usr/X11R6/include -I/usr/local/include

cflags.sh

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
3+
osxver=`sw_vers -productVersion 2> /dev/null`
4+
if [ $? -eq 0 ] ; then
5+
minor=`echo "$osxver" | cut -d. -f2`
6+
if [ "$minor" -le 11 ] ; then
7+
# Versions of OSX before 10.12 (aka "macOS Sierra") did not have clock_gettime()
8+
echo "-DMISSING_CLOCK_GETTIME"
9+
fi
10+
fi

cmd_behave_screen_edge.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
#include <time.h> /* for clock_gettime */
55
#include <sys/time.h> /* for timeradd and friends */
66

7-
#if defined(__APPLE__) && defined(__MACH__)
7+
#if defined(MISSING_CLOCK_GETTIME)
88
/* http://code.google.com/p/semicomplete/issues/detail?id=37
9-
* OS X doesn't support clock_gettime (in at least OSX <= 10.6) */
10-
# include "osx_hacks.h"
9+
* OS X doesn't support clock_gettime (in at least OSX <= 10.11) */
10+
# include "patch_clock_gettime.h"
1111
#endif
1212

1313
/* TODO(sissel): Refactor the madness.

osx_hacks.h patch_clock_gettime.h

File renamed without changes.

0 commit comments

Comments
 (0)