This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add the files from dist/meta to perl's repo
[metaconfig.git] / dist / U / d_voidsig.U
1 ?RCS: $Id: d_voidsig.U 1 2006-08-24 12:32:52Z rmanfredi $
2 ?RCS:
3 ?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
4 ?RCS: 
5 ?RCS: You may redistribute only under the terms of the Artistic Licence,
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
8 ?RCS: that same Artistic Licence; a copy of which may be found at the root
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
53 echo " "
54 xxx=`./findhdr signal.h`
55 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
56 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
57         echo "You have int (*signal())() instead of void." >&4
58         val="$undef"
59 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
60         echo "You have void (*signal())() instead of int." >&4
61         val="$define"
62 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
63         echo "You have int (*signal())() instead of void." >&4
64         val="$undef"
65 else
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
81 fi
82 set d_voidsig
83 eval $setvar
84 case "$d_voidsig" in
85 "$define") signal_t="void";;
86 *) signal_t="int";;
87 esac
88 $rm -f $$.tmp
89