aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatarLibravatar William Ahern (william@25thandclement.com) <wahern@aix7.polarhome.com> 2014-07-18 02:21:21 +0200
committerLibravatarLibravatar William Ahern (william@25thandclement.com) <wahern@aix7.polarhome.com> 2014-07-18 02:21:21 +0200
commit9157308b90ea7df405ed9b22f1801f3f70f2e30b (patch)
treeaf5ade3770609332d9561a3ca39fb0e12a64f4da /src
parentf026c11953f5a3b3e7285a08829f5777cfe31331 (diff)
downloadluaossl-9157308b90ea7df405ed9b22f1801f3f70f2e30b.tar.gz
luaossl-9157308b90ea7df405ed9b22f1801f3f70f2e30b.tar.bz2
luaossl-9157308b90ea7df405ed9b22f1801f3f70f2e30b.zip
patches to build on AIX
Diffstat (limited to 'src')
-rw-r--r--src/GNUmakefile6
-rw-r--r--src/openssl.c10
2 files changed, 11 insertions, 5 deletions
diff --git a/src/GNUmakefile b/src/GNUmakefile
index f988855..ee263b0 100644
--- a/src/GNUmakefile
+++ b/src/GNUmakefile
@@ -17,7 +17,7 @@ include $(d)/../GNUmakefile
# C O M P I L A T I O N F L A G S
#
OS_$(d) = $(shell $(d)/../mk/vendor.os)
-CC_$(d) = $(shell $(d)/../mk/vendor.cc)
+CC_$(d) = $(shell env CC="$(CC) "$(d)/../mk/vendor.cc)
LUAPATH_$(d) = $(shell env CC="$(CC)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" $(<D)/../mk/lua.path -krxm3 -I$(DESTDIR)$(includedir) -I/usr/include -I/usr/local/include -P$(DESTDIR)$(bindir) -P$(bindir) -L$(DESTDIR)$(libdir) -L$(libdir) -v$(1) $(2))
CPPFLAGS_$(d) = $(CPPFLAGS_$(abspath $(@D)/../..))
@@ -29,7 +29,7 @@ ifeq ($(CC_$(d)), sunpro)
CPPFLAGS_$(d) += -DOPENSSL_NO_EC
endif
-LDFLAGS_$(d) += -lssl -lcrypto -lpthread
+LDFLAGS_$(d) += -lssl -lcrypto -lpthread -lm
# NetBSD, FreeBSD, OpenBSD (and presumably descendants) lack any libdl;
# dlopen, et al are part of libc.
@@ -109,7 +109,7 @@ MODS$(1)_$(d) = \
$$(DESTDIR)$(2)/_openssl.so: $$(d)/$(1)/openssl.so
$$(MKDIR) -p $$(@D)
- $$(CP) -p $$< $$@
+ $$(CP) -fp $$< $$@
$$(DESTDIR)$(3)/openssl/%.lua: $$(d)/openssl.%.lua
$$(LUAC$(1)_$(d)) -p $$<
diff --git a/src/openssl.c b/src/openssl.c
index 76a409e..7985b1f 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -36,7 +36,7 @@
#include <errno.h> /* errno */
#include <sys/types.h> /* ssize_t pid_t */
-#if !defined __sun
+#if !defined __sun && !defined _AIX
#include <sys/sysctl.h> /* CTL_KERN KERN_RANDOM RANDOM_UUID KERN_URND KERN_ARND sysctl(2) */
#endif
#include <sys/time.h> /* struct timeval gettimeofday(2) */
@@ -4646,7 +4646,7 @@ static int randL_stir(struct randL_state *st, unsigned rqstd) {
#endif
if (count < rqstd) {
-#if defined O_CLOEXEC
+#if defined O_CLOEXEC && (!defined _AIX /* O_CLOEXEC overflows int */)
int fd = open("/dev/urandom", O_RDONLY|O_CLOEXEC);
#else
int fd = open("/dev/urandom", O_RDONLY);
@@ -4938,6 +4938,10 @@ int luaopen__openssl_rand(lua_State *L) {
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#ifndef HAVE_DLADDR
+#define HAVE_DLADDR (!defined _AIX)
+#endif
+
static struct {
pthread_mutex_t *lock;
int nlock;
@@ -5022,6 +5026,7 @@ static int mt_init(void) {
* Prevent loader from unlinking us if we've registered a callback
* with OpenSSL by taking another reference to ourselves.
*/
+#if HAVE_DLADDR
if (bound && !mt_state.dlref) {
Dl_info info;
@@ -5035,6 +5040,7 @@ static int mt_init(void) {
goto leave;
}
}
+#endif
leave:
pthread_mutex_unlock(&mutex);