Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -1855,17 +1855,11 @@ #if (!defined(TARGET_OS_IPHONE) || !TARGET_OS_IPHONE) && \ (!defined(TARGET_OS_SIMULATOR) || !TARGET_OS_SIMULATOR) egrep_cpp_yes #endif - ], [ - AC_MSG_RESULT(yes) - have_subprocesses="yes" - - AC_CHECK_FUNCS(posix_spawnp) - AC_CHECK_HEADERS(spawn.h) - ], [ + ], [], [ AC_MSG_RESULT(no) have_subprocesses="no" ]) ;; mingw*) @@ -1872,21 +1866,22 @@ have_subprocesses="yes" ;; msdosdjgpp*) have_subprocesses="no" ;; -*) +esac +AS_IF([test x"$have_subprocesses" = x""], [ AC_HEADER_SYS_WAIT AC_CHECK_FUNCS(kill) AC_CHECK_FUNCS(posix_spawnp, [ AS_IF([test x"$ac_cv_func_kill" = x"yes"], [ - have_subprocesses="yes" - - AC_CHECK_HEADERS(spawn.h) + AC_CHECK_HEADERS(spawn.h, [have_subprocesses="yes"]) ]) - ], [ + ]) + + AS_IF([test x"$have_subprocesses" = x""], [ AC_CHECK_FUNCS([vfork dup2 execvp _exit], [ AS_IF([test x"$ac_cv_func_vfork" = x"yes" \ -a x"$ac_cv_func_pipe" = x"yes" \ -a x"$ac_cv_func_dup2" = x"yes" \ -a x"$ac_cv_func_execvp" = x"yes" \ @@ -1896,12 +1891,11 @@ ]) ], [ break ]) ]) - ;; -esac +]) AS_IF([test x"$have_subprocesses" = x"yes"], [ AC_SUBST(OF_SUBPROCESS_M, "OFSubprocess.m") AC_DEFINE(OF_HAVE_SUBPROCESSES, 1, [Whether we have subprocesses]) ]) Index: src/platform/POSIX/OFSubprocess.m ================================================================== --- src/platform/POSIX/OFSubprocess.m +++ src/platform/POSIX/OFSubprocess.m @@ -39,11 +39,11 @@ #import "OFNotOpenException.h" #import "OFOutOfRangeException.h" #import "OFReadFailedException.h" #import "OFWriteFailedException.h" -#ifndef HAVE_POSIX_SPAWNP +#if !defined(HAVE_POSIX_SPAWNP) || !defined(HAVE_SPAWN_H) extern char **environ; #endif @interface OFSubprocess () - (void)of_getArgv: (char ***)argv @@ -141,11 +141,11 @@ forProgramName: programName andArguments: arguments]; @try { env = [self of_environmentForDictionary: environment]; -#ifdef HAVE_POSIX_SPAWNP +#if defined(HAVE_POSIX_SPAWNP) && defined(HAVE_SPAWN_H) posix_spawn_file_actions_t actions; posix_spawnattr_t attr; if (posix_spawn_file_actions_init(&actions) != 0) @throw [OFInitializationFailedException