From 59861061f2ab1d3f4b28e83d2dcc3adf0f9acb04 Mon Sep 17 00:00:00 2001
From: Herbert Valerio Riedel <hvr@gnu.org>
Date: Sun, 7 Dec 2014 16:01:51 +0100
Subject: [PATCH] Tweak execvpe.h hack (see 256b19184bcb) some more

---
 cbits/execvpe.c   | 7 ++++---
 cbits/ghcrts.c    | 5 +++--
 include/execvpe.h | 5 +++--
 3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/cbits/execvpe.c b/cbits/execvpe.c
index 9599836..c27bca9 100644
--- a/cbits/execvpe.c
+++ b/cbits/execvpe.c
@@ -9,12 +9,10 @@
 
    -------------------------------------------------------------------------- */
 
-#include "execvpe.h"
+#include "HsUnixConfig.h"
 
 #if HAVE_EXECVPE
 # define _GNU_SOURCE
-#else
-# undef execvpe
 #endif
 
 #include <errno.h>
@@ -28,6 +26,9 @@
 #include <string.h>
 #include <errno.h>
 
+#define HSUNIX_EXECVPE_H_NO_COMPAT
+#include "execvpe.h"
+
 /*
  * We want the search semantics of execvp, but we want to provide our
  * own environment, like execve.  The following copyright applies to
diff --git a/cbits/ghcrts.c b/cbits/ghcrts.c
index 1e0dc1c..9003675 100644
--- a/cbits/ghcrts.c
+++ b/cbits/ghcrts.c
@@ -1,10 +1,11 @@
-#include "execvpe.h"
-
 #ifdef __GLASGOW_HASKELL__
 // for 'void StopTimer(void)' prototype
 # include "Rts.h"
 #endif
 
+#define HSUNIX_EXECVPE_H_NO_COMPAT
+#include "execvpe.h"
+
 /* Copied verbatim from ghc/lib/std/cbits/system.c. */
 void pPrPr_disableITimers (void)
 {
diff --git a/include/execvpe.h b/include/execvpe.h
index 7faa0df..1fd2fbb 100644
--- a/include/execvpe.h
+++ b/include/execvpe.h
@@ -7,12 +7,12 @@
 #ifndef HSUNIX_EXECVPE_H
 #define HSUNIX_EXECVPE_H
 
-#include "HsUnixConfig.h"
-
 extern int
 __hsunix_execvpe(const char *name, char *const argv[], char *const envp[]);
 
 // this hack is needed for `process`; to be removed in unix-2.8
+#ifndef HSUNIX_EXECVPE_H_NO_COMPAT
+#include "HsUnixConfig.h"
 #if HAVE_EXECVPE
 # define _GNU_SOURCE
 # include <unistd.h>
@@ -21,6 +21,7 @@ execvpe(const char *name, char *const argv[], char *const envp[]);
 #else
 # define execvpe(name,argv,envp) __hsunix_execvpe(name,argv,envp)
 #endif
+#endif
 
 // implemented in cbits/ghcrts.c
 extern void pPrPr_disableITimers (void);
-- 
GitLab