[tor-commits] [tor/master] Stop checking whether environ is declared.

nickm at torproject.org nickm at torproject.org
Fri Dec 16 15:27:37 UTC 2016


commit 954eeda619a59dae76144ad69967f0ed7341b564
Author: Nick Mathewson <nickm at torproject.org>
Date:   Mon Dec 12 10:55:10 2016 -0500

    Stop checking whether environ is declared.
    
    There seems to be pretty good evidence that it's always declared,
    and that checking for it is pointless.
    
    Closes ticket 19142.
---
 changes/19142       |  3 +++
 configure.ac        | 16 ----------------
 src/common/compat.c |  9 ---------
 3 files changed, 3 insertions(+), 25 deletions(-)

diff --git a/changes/19142 b/changes/19142
new file mode 100644
index 0000000..685bbbc
--- /dev/null
+++ b/changes/19142
@@ -0,0 +1,3 @@
+  o Removed features:
+    - We no longer attempt to build on systems where 'environ' is not
+      declared in the C headers. Closes ticket 19142.
diff --git a/configure.ac b/configure.ac
index bf721a9..afe40a4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1533,17 +1533,6 @@ int main(int c, char **v) { puts(__FUNCTION__); }])],
   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
@@ -1557,11 +1546,6 @@ if test "$tor_cv_have_FUNCTION_macro" = "yes"; then
            [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.
diff --git a/src/common/compat.c b/src/common/compat.c
index ebf05f5..97d1faf 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -2390,15 +2390,6 @@ make_path_absolute(char *fname)
 #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 **





More information about the tor-commits mailing list