From: Đoàn Trần Công Danh <congdanhqx@gmail.com>
---
 configure.in | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git configure.in configure.in
index 6570a07..0e4c9d1 100755
--- a/configure.in
+++ b/configure.in
@@ -486,6 +486,25 @@ AC_LANG_PROGRAM([[
 
 AC_MSG_CHECKING([if any value exists for WNOHANG])
 rm -rf wnohang
+AC_COMPILE_IFELSE([
+AC_LANG_PROGRAM([[
+#include <sys/wait.h>
+]],[[
+#ifdef WNOHANG
+	int wnohang_value = WNOHANG;
+#else
+	#error no value
+#endif
+]])],
+	AC_MSG_RESULT(yes)
+,
+	AC_MSG_RESULT(no)
+	expect_cv_wnohang_value=1
+)
+
+AC_CACHE_CHECK([value of WNOHANG], [expect_cv_wnohang_value],
+[
+rm -rf wnohang
 AC_TRY_RUN([
 #include <stdio.h>
 #include <sys/wait.h>
@@ -500,14 +519,15 @@ main() {
 #endif
 }],
 	AC_MSG_RESULT(yes)
-	AC_DEFINE_UNQUOTED(WNOHANG_BACKUP_VALUE, `cat wnohang`)
 	rm -f wnohang
 ,
 	AC_MSG_RESULT(no)
-	AC_DEFINE(WNOHANG_BACKUP_VALUE, 1)
 ,
 	AC_MSG_ERROR([Expect can't be cross compiled])
 )
+])
+
+AC_DEFINE_UNQUOTED(WNOHANG_BACKUP_VALUE, $expect_cv_wnohang_value)
 
 #
 # check how signals work
-- 
2.26.0.292.g33ef6b2f38

