tor_cv_have_FUNCTION_macro=yes,
tor_cv_have_FUNCTION_macro=no))
+AC_CACHE_CHECK([whether we have extern char **environ already declared],
+ tor_cv_have_environ_declared,
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <stdlib.h>
+int main(int c, char **v) { char **t = environ; }])],
+ tor_cv_have_environ_declared=yes,
+ tor_cv_have_environ_declared=no))
+
if test "$tor_cv_have_func_macro" = "yes"; then
AC_DEFINE(HAVE_MACRO__func__, 1, [Defined if the compiler supports __func__])
fi
[Defined if the compiler supports __FUNCTION__])
fi
+if test "$tor_cv_have_environ_declared" = "yes"; then
+ AC_DEFINE(HAVE_EXTERN_ENVIRON_DECLARED, 1,
+ [Defined if we have extern char **environ already declared])
+fi
+
# $prefix stores the value of the --prefix command line option, or
# NONE if the option wasn't set. In the case that it wasn't set, make
# it be the default, so that we can use it to expand directories now.
#endif
}
+#ifndef HAVE__NSGETENVIRON
+#ifndef HAVE_EXTERN_ENVIRON_DECLARED
+/* Some platforms declare environ under some circumstances, others don't. */
+#ifndef RUNNING_DOXYGEN
+extern char **environ;
+#endif
+#endif
+#endif
+
/** Return the current environment. This is a portable replacement for
* 'environ'. */
char **