Skip to content

Commit

Permalink
Add support for compiling on AIX
Browse files Browse the repository at this point in the history
Closes #1900
  • Loading branch information
siahh authored and antirez committed Aug 7, 2014
1 parent 4265531 commit 009cabf
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 3 deletions.
4 changes: 4 additions & 0 deletions deps/hiredis/fmacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down
2 changes: 1 addition & 1 deletion deps/hiredis/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

#include "hiredis.h"

#if defined(__sun)
#if defined(__sun) || defined(_AIX)
#define AF_LOCAL AF_UNIX
#endif

Expand Down
8 changes: 7 additions & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,19 @@ ifeq ($(uname_S),SunOS)
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

Expand Down
6 changes: 5 additions & 1 deletion src/anet.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions src/fmacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
#define _GNU_SOURCE
#endif

#if defined(_AIX)
#define _ALL_SOURCE
#endif

#if defined(__linux__) || defined(__OpenBSD__)
#define _XOPEN_SOURCE 700
/*
Expand Down
5 changes: 5 additions & 0 deletions src/redis.h
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,11 @@ typedef struct redisOpArray {

struct clusterState;

#ifdef _AIX
#undef hz
#endif


struct redisServer {
/* General */
pid_t pid; /* Main process pid. */
Expand Down

0 comments on commit 009cabf

Please sign in to comment.