summaryrefslogtreecommitdiff
path: root/mcon/U/d_wifstat.U
diff options
context:
space:
mode:
Diffstat (limited to 'mcon/U/d_wifstat.U')
-rw-r--r--mcon/U/d_wifstat.U87
1 files changed, 87 insertions, 0 deletions
diff --git a/mcon/U/d_wifstat.U b/mcon/U/d_wifstat.U
new file mode 100644
index 0000000..40c0f57
--- /dev/null
+++ b/mcon/U/d_wifstat.U
@@ -0,0 +1,87 @@
+?RCS: $Id: d_wifstat.U,v 3.0.1.3 1997/02/28 15:47:43 ram Exp $
+?RCS:
+?RCS: Copyright (c) 1991-1993, Raphael Manfredi
+?RCS:
+?RCS: You may redistribute only under the terms of the Artistic Licence,
+?RCS: as specified in the README file that comes with the distribution.
+?RCS: You may reuse parts of this distribution only within the terms of
+?RCS: that same Artistic Licence; a copy of which may be found at the root
+?RCS: of the source tree for dist 3.0.
+?RCS:
+?RCS: $Log: d_wifstat.U,v $
+?RCS: Revision 3.0.1.3 1997/02/28 15:47:43 ram
+?RCS: patch61: added a ?F: metalint hint
+?RCS:
+?RCS: Revision 3.0.1.2 1995/07/25 14:09:10 ram
+?RCS: patch56: re-arranged compile line to include ldflags before objects
+?RCS:
+?RCS: Revision 3.0.1.1 1995/03/21 08:47:46 ram
+?RCS: patch52: created
+?RCS:
+?MAKE:d_wifstat: d_uwait +cc +ccflags +ldflags +libs Oldconfig cat rm
+?MAKE: -pick add $@ %<
+?S:d_wifstat:
+?S: This symbol conditionally defines USE_WIFSTAT if the C program can
+?S: safely use the WIFxxx macros with the kind of wait() parameter
+?S: declared in the program (see UNION_WAIT), or if it can't. Should
+?S: only matter on HP-UX, where the macros are incorrectly written and
+?S: therefore cause programs using them with an 'union wait' variable
+?S: to not compile properly.
+?S:.
+?C:USE_WIFSTAT:
+?C: This symbol, if defined, indicates to the C program that the argument
+?C: for the WIFxxx set of macros such as WIFSIGNALED or WIFEXITED can
+?C: be of the same kind as the one used to hold the wait() status. Should
+?C: only matter on HP-UX, where the macros are incorrectly written and
+?C: therefore cause programs using them with an 'union wait' variable
+?C: to not compile properly. See also UNION_WAIT.
+?C:.
+?H:#$d_wifstat USE_WIFSTAT /**/
+?H:.
+?T:type
+?F:!foo
+: see if we can use WIFxxx macros
+echo " "
+case "$d_wifstat" in
+"$define") echo "As before, you can safely use WIFEXITED and friends!" >&4;;
+"$undef") echo "You still can't use WIFEXITED and friends!" >&4;;
+*)
+ echo "Let's see whether you can use the WIFEXITED(status) macro and its"
+ case "$d_uwait" in
+ "$define") type='union wait';;
+ *) type='int';;
+ esac
+ echo "friends with status declared as '$type status'..."
+ $cat >foo.c <<EOCP
+#include <sys/types.h>
+#include <sys/wait.h>
+
+main()
+{
+ $type status;
+ int e = 0;
+
+#ifdef WIFEXITED
+ if (WIFEXITED(status))
+ printf("\n");
+ exit(0);
+#else
+ exit(2);
+#endif
+}
+EOCP
+ d_wifstat="$undef"
+ if $cc $ccflags $ldflags foo.c -o foo $libs >/dev/null 2>&1; then
+ if ./foo >/dev/null; then
+ echo "Great! Looks like we can use the WIFxxx macros." >&4
+ d_wifstat="$define"
+ else
+ echo "You don't seem to have WIFxxx macros, but that's ok." >&4
+ fi
+ else
+ echo "Apparently you can't use WIFxxx macros properly." >&4
+ fi
+ $rm -f foo.* foo core
+ ;;
+esac
+