summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog11
-rwxr-xr-xconfigure21
-rw-r--r--stream.c6
3 files changed, 37 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index c46b2fa7..05883385 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2011-10-16 Kaz Kylheku <kaz@kylheku.com>
+ Quick and dirty port to MinGW.
+
+ * configure: Test for presence of <sys/wait.h> added.
+ Conditionally generates HAVE_SYS_WAIT variable in config.h.
+
+ * stream.c: Include <sys/wait.h> conditionally.
+ (pipe_close): Do not test ermination status with WIFEXITED, etc.
+ if there is no <sys/wait.h> header.
+
+2011-10-16 Kaz Kylheku <kaz@kylheku.com>
+
* configure: reduced post-configure advice to just point
to the INSTALL guide.
diff --git a/configure b/configure
index ed45dc8d..f833ef10 100755
--- a/configure
+++ b/configure
@@ -838,6 +838,27 @@ else
fi
#
+# sys/wait.h
+#
+
+printf "Checking whether we have <sys/wait.h> ... "
+
+cat > conftest.c <<!
+#include <sys/wait.h>
+
+int main(void)
+{
+ return 0;
+}
+!
+if ! make conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then
+ printf "no\n"
+else
+ printf "yes\n"
+ printf "#define HAVE_SYS_WAIT 1\n" >> config.h
+fi
+
+#
# Clean up
#
diff --git a/stream.c b/stream.c
index d9885971..4e728d86 100644
--- a/stream.c
+++ b/stream.c
@@ -34,8 +34,10 @@
#include <errno.h>
#include <wchar.h>
#include <unistd.h>
-#include <sys/wait.h>
#include "config.h"
+#if HAVE_SYS_WAIT
+#include <sys/wait.h>
+#endif
#include "lib.h"
#include "gc.h"
#include "unwind.h"
@@ -247,6 +249,7 @@ static val pipe_close(val stream, val throw_on_error)
uw_throwf(process_error_s,
lit("unable to obtain status of command ~a: ~a/~s"),
stream, num(errno), string_utf8(strerror(errno)), nao);
+#ifdef HAVE_SYS_WAIT
} else if (WIFEXITED(status)) {
int exitstatus = WEXITSTATUS(status);
uw_throwf(process_error_s, lit("pipe ~a terminated with status ~a"),
@@ -263,6 +266,7 @@ static val pipe_close(val stream, val throw_on_error)
} else {
uw_throwf(file_error_s, lit("strange status in when closing pipe ~a"),
stream, nao);
+#endif
}
}