summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/replace/libreplace.m41
-rw-r--r--lib/replace/replace.h9
-rw-r--r--source3/configure.in3
3 files changed, 12 insertions, 1 deletions
diff --git a/lib/replace/libreplace.m4 b/lib/replace/libreplace.m4
index 5e13d4a47e..6f1543863a 100644
--- a/lib/replace/libreplace.m4
+++ b/lib/replace/libreplace.m4
@@ -222,6 +222,7 @@ AC_CHECK_TYPE(comparison_fn_t,
AC_HAVE_DECL(setenv, [#include <stdlib.h>])
AC_CHECK_FUNCS(setenv unsetenv)
+AC_HAVE_DECL(environ, [#include <unistd.h>])
AC_CHECK_FUNCS(strnlen)
AC_CHECK_FUNCS(strtoull __strtoull strtouq strtoll __strtoll strtoq)
diff --git a/lib/replace/replace.h b/lib/replace/replace.h
index af1208a8fc..a8164b642b 100644
--- a/lib/replace/replace.h
+++ b/lib/replace/replace.h
@@ -182,6 +182,15 @@ char *rep_strndup(const char *s, size_t n);
size_t rep_strnlen(const char *s, size_t n);
#endif
+#if !HAVE_DECL_ENVIRON
+#ifdef __APPLE__
+#include <crt_externs.h>
+#define environ (*_NSGetEnviron())
+#else
+extern char **environ;
+#endif
+#endif
+
#ifndef HAVE_SETENV
#define setenv rep_setenv
int rep_setenv(const char *name, const char *value, int overwrite);
diff --git a/source3/configure.in b/source3/configure.in
index 292ae070d6..a37e97c9da 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -6210,6 +6210,8 @@ AC_ARG_ENABLE(merged-build,
[AS_HELP_STRING([--enable-merged-build], [Build Samba 4 as well])],
[ enable_merged_build=$enableval ], [ enable_merged_build=auto ])
+m4_include(../lib/zlib/zlib.m4)
+
if test x$enable_merged_build = xauto; then
merged_build_possible=yes
@@ -6239,7 +6241,6 @@ if test x$enable_merged_build = xyes; then
m4_include(samba4.m4)
fi
-m4_include(../lib/zlib/zlib.m4)
AC_SUBST(ZLIB_LIBS)
AC_SUBST(ZLIB_OBJS)
AC_ZLIB([ZLIB_OBJS=""], [