This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #81774] [PATCH] Fix typos (spelling errors) in configure files.
[metaconfig.git] / U / modified / voidflags.U
CommitLineData
959f3c4c
JH
1?RCS: $Id: voidflags.U,v 3.0.1.2 1997/02/28 16:27:58 ram Exp $
2?RCS:
3?RCS: Copyright (c) 1991-1993, Raphael Manfredi
4c42341b 4?RCS:
959f3c4c
JH
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 3.0.
10?RCS:
11?RCS: $Log: voidflags.U,v $
12?RCS: Revision 3.0.1.2 1997/02/28 16:27:58 ram
13?RCS: patch61: don't prompt them if the void support is high enough for us
14?RCS:
15?RCS: Revision 3.0.1.1 1995/01/11 15:37:44 ram
16?RCS: patch45: cosmetic change to avoid spurious blank lines when using -s
17?RCS:
18?RCS: Revision 3.0 1993/08/18 12:10:01 ram
19?RCS: Baseline for dist 3.0 netwide release.
20?RCS:
2cb64bf6 21?MAKE:voidflags defvoidused: cat rm_try contains +cc +ccflags package \
3b148aa9 22 Oldconfig Myread i_stdlib
959f3c4c
JH
23?MAKE: -pick add $@ %<
24?S:voidflags:
25?S: This variable contains the eventual value of the VOIDFLAGS symbol,
26?S: which indicates how much support of the void type is given by this
27?S: compiler. See VOIDFLAGS for more info.
28?S:.
29?S:defvoidused:
30?S: This variable contains the default value of the VOIDUSED symbol (15).
31?S:.
32?X: Exceptionally, we have to explicitely alias the symbol name for
33?X: config_h.SH, otherwise the comment would not appear.
34?C:VOIDFLAGS ~ %<:
35?C: This symbol indicates how much support of the void type is given by this
36?C: compiler. What various bits mean:
37?C:
38?C: 1 = supports declaration of void
39?C: 2 = supports arrays of pointers to functions returning void
40?C: 4 = supports comparisons between pointers to void functions and
41?C: addresses of void functions
04c34a22 42?C: 8 = supports declaration of generic void pointers
959f3c4c
JH
43?C:
44?C: The package designer should define VOIDUSED to indicate the requirements
45?C: of the package. This can be done either by #defining VOIDUSED before
46?C: including config.h, or by defining defvoidused in Myinit.U. If the
47?C: latter approach is taken, only those flags will be tested. If the
48?C: level of void support necessary is not present, defines void to int.
49?C:.
50?H:?%<:#ifndef VOIDUSED
51?H:?%<:#define VOIDUSED $defvoidused
52?H:?%<:#endif
53?H:?%<:#define VOIDFLAGS $voidflags
54?H:?%<:#if (VOIDFLAGS & VOIDUSED) != VOIDUSED
55?H:?%<:#define void int /* is void to be avoided? */
56?H:?%<:#define M_VOID /* Xenix strikes again */
57?H:?%<:#endif
58?H:.
59?W:%<:void
bf7497fb
MB
60?INIT:: full support for void wanted by default
61?INIT:defvoidused=15
62?INIT:
959f3c4c
JH
63?LINT:known void M_VOID VOIDUSED
64: check for void type
65echo " "
66echo "Checking to see how well your C compiler groks the void type..." >&4
67case "$voidflags" in
68'')
38122f24 69 $cat >try.c <<EOCP
3b148aa9
JH
70#$i_stdlib I_STDLIB
71#ifdef I_STDLIB
72#include <stdlib.h>
73#endif
959f3c4c
JH
74#if TRY & 1
75void sub() {
76#else
77sub() {
78#endif
79 extern void moo(); /* function returning void */
80 void (*goo)(); /* ptr to func returning void */
81#if TRY & 8
82 void *hue; /* generic ptr */
83#endif
84#if TRY & 2
85 void (*foo[10])();
86#endif
87
88#if TRY & 4
89 if(goo == moo) {
90 exit(0);
91 }
92#endif
93 exit(0);
94}
95int main() { sub(); }
96EOCP
97?X: This unit used to use cc -S in those tests to try to speed up things, but
98?X: unfortunately, AIX 3.2 does not support this option.
99 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
100 voidflags=$defvoidused
101 echo "Good. It appears to support void to the level $package wants.">&4
102 if $contains warning .out >/dev/null 2>&1; then
103 echo "However, you might get some warnings that look like this:"
104 $cat .out
105 fi
106 else
107echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
108 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
109 echo "It supports 1..."
110 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
111 echo "It also supports 2..."
112 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
113 voidflags=7
114 echo "And it supports 4 but not 8 definitely."
115 else
116 echo "It doesn't support 4..."
117 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
118 voidflags=11
119 echo "But it supports 8."
120 else
121 voidflags=3
122 echo "Neither does it support 8."
123 fi
124 fi
125 else
126 echo "It does not support 2..."
127 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
128 voidflags=13
129 echo "But it supports 4 and 8."
130 else
131 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
132 voidflags=5
133 echo "And it supports 4 but has not heard about 8."
134 else
135 echo "However it supports 8 but not 4."
136 fi
137 fi
138 fi
139 else
140 echo "There is no support at all for void."
141 voidflags=0
142 fi
143 fi
144esac
145?X: Only prompt user if support does not match the level we want
146case "$voidflags" in
147"$defvoidused") ;;
148*) $cat >&4 <<'EOM'
149 Support flag bits are:
150 1: basic void declarations.
151 2: arrays of pointers to functions returning void.
152 4: operations between pointers to and addresses of void functions.
153 8: generic void pointers.
154EOM
155 dflt="$voidflags";
156 rp="Your void support flags add up to what?"
157 . ./myread
158 voidflags="$ans"
159 ;;
160esac
2cb64bf6 161$rm_try
959f3c4c 162