diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2014-01-08 15:29:20 +0400 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2014-01-08 16:53:12 +0400 |
commit | aca3cb87a3ecec4986258cb04df6b20ab56af24a (patch) | |
tree | 91959c0c46f500c51ca6e012da60eda2243488b0 | |
parent | d4437ff28020eb9df19ba16f07eaa907a8e55163 (diff) | |
download | schroot-aca3cb87a3ecec4986258cb04df6b20ab56af24a.tar.gz |
Check if environ is declared
-rw-r--r-- | CMakeLists.txt | 6 | ||||
-rw-r--r-- | lib/sbuild/auth/auth.cc | 4 | ||||
-rw-r--r-- | test/sbuild/run-parts.cc | 4 |
3 files changed, 14 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b7d953d..f4b4b73f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,6 +100,7 @@ check_include_file_cxx ("tuple" HAVE_CXX_TUPLE) # System headers include (CheckIncludeFiles) include (CheckStructHasMember) +include (CheckSymbolExists) check_include_file_cxx ("mntent.h" HAVE_MNTENT_H) check_include_file_cxx ("sys/mnttab.h" HAVE_SYS_MNTTAB_H) @@ -118,6 +119,11 @@ if (HAVE_SYS_MNTTAB_H) endif() endif() +check_symbol_exists (environ "unistd.h" HAVE_ENVIRON_DECLARED) +if (HAVE_ENVIRON_DECLARED) + add_definitions (-D HAVE_ENVIRON_DECLARED=1) +endif() + # LIBRARY CHECKS include (CheckLibraryExists) include (CheckFunctionExists) diff --git a/lib/sbuild/auth/auth.cc b/lib/sbuild/auth/auth.cc index cb15aad2..9db3f13d 100644 --- a/lib/sbuild/auth/auth.cc +++ b/lib/sbuild/auth/auth.cc @@ -31,6 +31,10 @@ #include <syslog.h> #include <unistd.h> +#ifndef HAVE_ENVIRON_DECLARED +extern char **environ; +#endif + #include <boost/format.hpp> using std::cerr; diff --git a/test/sbuild/run-parts.cc b/test/sbuild/run-parts.cc index 5ebb2618..223001a8 100644 --- a/test/sbuild/run-parts.cc +++ b/test/sbuild/run-parts.cc @@ -29,6 +29,10 @@ #include <config.h> +#ifndef HAVE_ENVIRON_DECLARED +extern char** environ; +#endif + class RunParts : public ::testing::Test { public: |