changeset 2423:b7c69df6cb66 draft

Define a macro to include spawn.h or compat/spawn.h instead of forcing it in.
author Roy Marples <roy@marples.name>
date Wed, 23 Apr 2014 09:43:30 +0000
parents 531eb96614d9
children d864514aa424
files configure script.c
diffstat 2 files changed, 11 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/configure	Wed Apr 23 09:34:42 2014 +0000
+++ b/configure	Wed Apr 23 09:43:30 2014 +0000
@@ -526,7 +526,7 @@
 fi
 if [ "$STRLCPY" = no ]; then
 	echo "COMPAT_SRCS+=	compat/strlcpy.c" >>$CONFIG_MK
-	echo "#include \"compat/strlcpy.h\"" >>$CONFIG_H
+	echo "#include		\"compat/strlcpy.h\"" >>$CONFIG_H
 fi
 
 if [ -z "$TAILQ_FOREACH_SAFE" ]; then
@@ -594,9 +594,8 @@
 fi
 if [ "$POSIX_SPAWN" = no ]; then
 	echo "COMPAT_SRCS+=	compat/posix_spawn.c" >>$CONFIG_MK
-	echo "#include \"compat/posix_spawn.h\"" >>$CONFIG_H
 else
-	echo "#include <spawn.h>" >>$CONFIG_H
+	echo "#define HAVE_SPAWN_H" >>$CONFIG_H
 fi
 
 if [ -z "$POLLTS" ]; then
@@ -661,15 +660,15 @@
 yes)
 	;;
 ppoll)
-	echo "#define pollts ppoll" >>$CONFIG_H
+	echo "#define pollts	ppoll" >>$CONFIG_H
 	;;
 pselect)
 	echo "COMPAT_SRCS+=	compat/pselect.c" >>$CONFIG_MK
-	echo "#include \"compat/pollts.h\"" >>$CONFIG_H
+	echo "#include		\"compat/pollts.h\"" >>$CONFIG_H
 	;;
 *)
 	echo "COMPAT_SRCS+=	compat/pollts.c" >>$CONFIG_MK
-	echo "#include \"compat/pollts.h\"" >>$CONFIG_H
+	echo "#include		\"compat/pollts.h\"" >>$CONFIG_H
 	;;
 esac
 
--- a/script.c	Wed Apr 23 09:34:42 2014 +0000
+++ b/script.c	Wed Apr 23 09:43:30 2014 +0000
@@ -52,6 +52,12 @@
 #include "net.h"
 #include "script.h"
 
+#ifdef HAVE_SPAWN_H
+#include <spawn.h>
+#else
+#include "compat/posix_spawn.h"
+#endif
+
 #define DEFAULT_PATH	"PATH=/usr/bin:/usr/sbin:/bin:/sbin"
 
 static const char * const if_params[] = {