summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsiahl <slyimo@us.ibm.com>2014-07-29 16:39:37 -0500
committerantirez <antirez@gmail.com>2014-08-07 12:12:54 +0200
commit009cabf1031db42271a1e05980965a129cbbfe1d (patch)
tree224bdfe54f2fbcd933e3a1f4b2c1b9821934f637
parent426553164d6807e67999101cec95d2afb7aaa3d7 (diff)
downloadredis-009cabf1031db42271a1e05980965a129cbbfe1d.tar.gz
Add support for compiling on AIX
Closes #1900
-rw-r--r--deps/hiredis/fmacros.h4
-rw-r--r--deps/hiredis/net.h2
-rw-r--r--src/Makefile8
-rw-r--r--src/anet.h6
-rw-r--r--src/fmacros.h4
-rw-r--r--src/redis.h5
6 files changed, 26 insertions, 3 deletions
diff --git a/deps/hiredis/fmacros.h b/deps/hiredis/fmacros.h
index 9e5fec0ce..6a41aa176 100644
--- a/deps/hiredis/fmacros.h
+++ b/deps/hiredis/fmacros.h
@@ -5,6 +5,10 @@
#define _BSD_SOURCE
#endif
+#if defined(_AIX)
+#define _ALL_SOURCE
+#endif
+
#if defined(__sun__)
#define _POSIX_C_SOURCE 200112L
#elif defined(__linux__) || defined(__OpenBSD__) || defined(__NetBSD__)
diff --git a/deps/hiredis/net.h b/deps/hiredis/net.h
index 5e742f577..3763ab089 100644
--- a/deps/hiredis/net.h
+++ b/deps/hiredis/net.h
@@ -35,7 +35,7 @@
#include "hiredis.h"
-#if defined(__sun)
+#if defined(__sun) || defined(_AIX)
#define AF_LOCAL AF_UNIX
#endif
diff --git a/src/Makefile b/src/Makefile
index 4ccc6d367..901104b27 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -63,12 +63,18 @@ else
ifeq ($(uname_S),Darwin)
# Darwin (nothing to do)
else
+ifeq ($(uname_S),AIX)
+ # AIX
+ FINAL_LDFLAGS+= -Wl,-bexpall
+ FINAL_LIBS+= -pthread -lcrypt -lbsd
+
+else
# All the other OSes (notably Linux)
FINAL_LDFLAGS+= -rdynamic
FINAL_LIBS+= -pthread
endif
endif
-
+endif
# Include paths to dependencies
FINAL_CFLAGS+= -I../deps/hiredis -I../deps/linenoise -I../deps/lua/src
diff --git a/src/anet.h b/src/anet.h
index c4659cd35..5191c4b69 100644
--- a/src/anet.h
+++ b/src/anet.h
@@ -39,10 +39,14 @@
#define ANET_NONE 0
#define ANET_IP_ONLY (1<<0)
-#if defined(__sun)
+#if defined(__sun) || defined(_AIX)
#define AF_LOCAL AF_UNIX
#endif
+#ifdef _AIX
+#undef ip_len
+#endif
+
int anetTcpConnect(char *err, char *addr, int port);
int anetTcpNonBlockConnect(char *err, char *addr, int port);
int anetTcpNonBlockBindConnect(char *err, char *addr, int port, char *source_addr);
diff --git a/src/fmacros.h b/src/fmacros.h
index 44e378a68..e49735ce5 100644
--- a/src/fmacros.h
+++ b/src/fmacros.h
@@ -36,6 +36,10 @@
#define _GNU_SOURCE
#endif
+#if defined(_AIX)
+#define _ALL_SOURCE
+#endif
+
#if defined(__linux__) || defined(__OpenBSD__)
#define _XOPEN_SOURCE 700
/*
diff --git a/src/redis.h b/src/redis.h
index d2b00bff5..b049dbee8 100644
--- a/src/redis.h
+++ b/src/redis.h
@@ -626,6 +626,11 @@ typedef struct redisOpArray {
struct clusterState;
+#ifdef _AIX
+#undef hz
+#endif
+
+
struct redisServer {
/* General */
pid_t pid; /* Main process pid. */