From 167e7a1a3baef09afe1a88d4ccadf84a8d0592b6 Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Thu, 19 Sep 2024 16:32:43 +0200
Subject: [PATCH] spawn-pipe: Simplify.

* m4/spawn-pipe.m4 (gl_SPAWN_PIPE): Don't define HAVE_LIBCX_SPAWN2_H as
an AC_SUBSTed variable. Don't test for it on platforms other than OS/2.
---
 ChangeLog        |  6 ++++++
 m4/spawn-pipe.m4 | 13 ++++++-------
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0c4b6472d1..ac8e65ecb9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-09-19  Bruno Haible  <bruno@clisp.org>
+
+	spawn-pipe: Simplify.
+	* m4/spawn-pipe.m4 (gl_SPAWN_PIPE): Don't define HAVE_LIBCX_SPAWN2_H as
+	an AC_SUBSTed variable. Don't test for it on platforms other than OS/2.
+
 2024-09-19  KO Myung-Hun  <komh78@gmail.com>
 
 	spawn-pipe: Support a directory argument of create_pipe() on OS/2 kLIBC.
diff --git a/m4/spawn-pipe.m4 b/m4/spawn-pipe.m4
index 180b944317..596e288124 100644
--- a/m4/spawn-pipe.m4
+++ b/m4/spawn-pipe.m4
@@ -6,14 +6,13 @@ dnl with or without modifications, as long as this notice is preserved.
 
 AC_DEFUN([gl_SPAWN_PIPE],
 [
+  AC_REQUIRE([AC_CANONICAL_HOST])
+
   dnl Prerequisites of lib/spawn-pipe.c.
   AC_REQUIRE([AC_TYPE_MODE_T])
 
-  AC_CHECK_HEADERS_ONCE([libcx/spawn2.h])
-  if test $ac_cv_header_libcx_spawn2_h = yes; then
-    HAVE_LIBCX_SPAWN2_H=1
-  else
-    HAVE_LIBCX_SPAWN2_H=0
-  fi
-  AC_SUBST(HAVE_LIBCX_SPAWN2_H)
+  dnl Prerequisites of lib/os2-spawn.c.
+  case "$host_os" in
+    os2*) AC_CHECK_HEADERS_ONCE([libcx/spawn2.h]) ;;
+  esac
 ])
-- 
2.39.5