Browse Source

process: Use environ from unistd.h if available

pull/108/head
Daniel Scharrer 7 years ago
parent
commit
20b4585dbe
  1. 4
      CMakeLists.txt
  2. 1
      src/configure.hpp.in
  3. 6
      src/util/process.cpp

4
CMakeLists.txt

@ -263,7 +263,9 @@ if(NOT WIN32)
check_symbol_exists(utimes "sys/time.h" INNOEXTRACT_HAVE_UTIMES)
endif()
check_symbol_exists(posix_spawnp "spawn.h" INNOEXTRACT_HAVE_POSIX_SPAWNP)
if(NOT INNOEXTRACT_HAVE_POSIX_SPAWNP)
if(INNOEXTRACT_HAVE_POSIX_SPAWNP)
check_symbol_exists(environ "unistd.h" INNOEXTRACT_HAVE_UNISTD_ENVIRON)
else()
check_symbol_exists(fork "unistd.h" INNOEXTRACT_HAVE_FORK)
check_symbol_exists(execvp "unistd.h" INNOEXTRACT_HAVE_EXECVP)
endif()

1
src/configure.hpp.in

@ -41,6 +41,7 @@
// Process functions
#cmakedefine01 INNOEXTRACT_HAVE_POSIX_SPAWNP
#cmakedefine01 INNOEXTRACT_HAVE_UNISTD_ENVIRON
#cmakedefine01 INNOEXTRACT_HAVE_FORK
#cmakedefine01 INNOEXTRACT_HAVE_EXECVP
#cmakedefine01 INNOEXTRACT_HAVE_WAITPID

6
src/util/process.cpp

@ -37,6 +37,7 @@
#if INNOEXTRACT_HAVE_POSIX_SPAWNP
#include <spawn.h>
#if !INNOEXTRACT_HAVE_UNISTD_ENVIRON
extern "C" {
#if defined(__FreeBSD__) && defined(__GNUC__) && __GNUC__ >= 4
/*
@ -48,7 +49,10 @@ extern char ** environ __attribute__((visibility("default")));
extern char ** environ;
#endif
}
#else
#endif
#endif
#if INNOEXTRACT_HAVE_UNISTD_ENVIRON || (INNOEXTRACT_HAVE_FORK && INNOEXTRACT_HAVE_EXECVP)
#include <unistd.h>
#endif

Loading…
Cancel
Save