Skip to content

Commit 3819107

Browse files
Fix compilation on Solaris with Sun/Solaris Studio
* Update our Makefile conditional to check for 'sun' and 'studio' individually, as vanilla solaris doesn't have `grep -E` * Add `__sun` to our `PTHREAD_ONCE` detection. Signed-off-by: michael-grunder <michael.grunder@gmail.com>
1 parent ef5de03 commit 3819107

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,15 @@ else ifeq ($(uname_S),FreeBSD)
199199
PTHREAD_FLAGS += -pthread
200200
endif
201201
else ifeq ($(uname_S),SunOS)
202-
ifeq ($(shell $(CC) -V 2>&1 grep -iq 'sun\|studio' && echo true),true)
202+
# Solaris' default grep doesn't have -E so we need two checks
203+
CC_VERSION := $(shell $(CC) -V 2>&1 || echo unknown)
204+
ifneq (,$(findstring Sun C,$(CC_VERSION)))
205+
HAVE_SUN_CC := 1
206+
else ifneq (,$(findstring Studio,$(CC_VERSION)))
207+
HAVE_SUN_CC := 1
208+
endif
209+
210+
ifeq ($(HAVE_SUN_CC),1)
203211
SUN_SHARED_FLAG = -G
204212
REAL_CFLAGS += -mt
205213
ifeq ($(USE_THREADS),1)

src/conn.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
#ifdef VALKEY_USE_THREADS
3636

37-
#if defined(__unix__) || defined(__APPLE__)
37+
#if defined(__unix__) || defined(__APPLE__) || defined(__sun)
3838
#define VALKEY_PTHREADS_ONCE 1
3939
#elif defined(_WIN32)
4040
#define VALKEY_WINDOWS_ONCE 1

0 commit comments

Comments
 (0)