This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix .gitignore: only ignore 'perl' in root of repo, not U/perl subdir
[metaconfig.git] / dist / U / d_voidsig.U
CommitLineData
c6667804 1?RCS: $Id$
d8875586
MBT
2?RCS:
3?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
cf39bd7e 4?RCS:
c6667804 5?RCS: You may redistribute only under the terms of the Artistic License,
d8875586
MBT
6?RCS: as specified in the README file that comes with the distribution.
7?RCS: You may reuse parts of this distribution only within the terms of
c6667804 8?RCS: that same Artistic License; a copy of which may be found at the root
d8875586
MBT
9?RCS: of the source tree for dist 4.0.
10?RCS:
11?RCS: $Log: d_voidsig.U,v $
12?RCS: Revision 3.0.1.3 1995/05/12 12:12:46 ram
13?RCS: patch54: made cppflags dependency optional
14?RCS:
15?RCS: Revision 3.0.1.2 1994/08/29 16:20:35 ram
16?RCS: patch32: now sets signal_t only once d_voidsig is known (WED)
17?RCS:
18?RCS: Revision 3.0.1.1 1994/06/20 06:59:54 ram
19?RCS: patch30: now properly sets signal_t when re-using previous value
20?RCS:
21?RCS: Revision 3.0 1993/08/18 12:07:56 ram
22?RCS: Baseline for dist 3.0 netwide release.
23?RCS:
24?MAKE:d_voidsig signal_t: rm contains cppstdin cppminus +cppflags test Myread \
25 Oldconfig Setvar Findhdr
26?MAKE: -pick add $@ %<
27?S:d_voidsig:
28?S: This variable conditionally defines VOIDSIG if this system
29?S: declares "void (*signal(...))()" in signal.h. The old way was to
30?S: declare it as "int (*signal(...))()".
31?S:.
32?S:signal_t:
33?S: This variable holds the type of the signal handler (void or int).
34?S:.
35?C:VOIDSIG:
36?C: This symbol is defined if this system declares "void (*signal(...))()" in
37?C: signal.h. The old way was to declare it as "int (*signal(...))()". It
38?C: is up to the package author to declare things correctly based on the
39?C: symbol.
40?C:.
41?C:Signal_t (SIGNAL_T):
42?C: This symbol's value is either "void" or "int", corresponding to the
43?C: appropriate return type of a signal handler. Thus, you can declare
44?C: a signal handler using "Signal_t (*handler)()", and define the
45?C: handler using "Signal_t handler(sig)".
46?C:.
47?H:#$d_voidsig VOIDSIG /**/
48?H:#define Signal_t $signal_t /* Signal handler's return type */
49?H:.
50?T:xxx
51?LINT:set d_voidsig
52: see if signal is declared as pointer to function returning int or void
53echo " "
54xxx=`./findhdr signal.h`
55$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
56if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
57 echo "You have int (*signal())() instead of void." >&4
58 val="$undef"
59elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
60 echo "You have void (*signal())() instead of int." >&4
61 val="$define"
62elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
63 echo "You have int (*signal())() instead of void." >&4
64 val="$undef"
65else
66 case "$d_voidsig" in
67 '')
68 echo "I can't determine whether signal handler returns void or int..." >&4
69 dflt=void
70 rp="What type does your signal handler return?"
71 . ./myread
72 case "$ans" in
73 v*) val="$define";;
74 *) val="$undef";;
75 esac;;
76 "$define")
77 echo "As you already told me, signal handler returns void." >&4;;
78 *)
79 echo "As you already told me, signal handler returns int." >&4;;
80 esac
81fi
82set d_voidsig
83eval $setvar
84case "$d_voidsig" in
85"$define") signal_t="void";;
86*) signal_t="int";;
87esac
88$rm -f $$.tmp
89