Add Win32API::File to the core
[p5sagit/p5-mst-13.2.git] / cflags.SH
CommitLineData
a02608de 1case $PERL_CONFIG_SH in
1c3d792e 2'')
a0d0e21e 3 if test -f config.sh; then TOP=.;
4 elif test -f ../config.sh; then TOP=..;
5 elif test -f ../../config.sh; then TOP=../..;
6 elif test -f ../../../config.sh; then TOP=../../..;
7 elif test -f ../../../../config.sh; then TOP=../../../..;
8 else
9 echo "Can't find config.sh."; exit 1
10 fi
11 . $TOP/config.sh
12 ;;
1c3d792e 13esac
2b317908 14: This forces SH files to create target in same directory as SH file.
15: This is so that make depend always knows where to find SH derivatives.
1c3d792e 16case "$0" in
17*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
18esac
bc730b18 19
20warn=''
21
22# Add -Wall for the core modules iff gcc and not already -Wall
23case "$gccversion" in
24'') ;;
25Intel*) ;; # The Intel C++ plays gcc on TV but is not really it.
26*) case "$ccflags" in
27 *-Wall*) ;;
28 *) warn="$warn -Wall" ;;
29 esac
30 ;;
31esac
32
33# The gcc -ansi -pedantic require their own dance, too.
34case "$gccversion" in
35'') ;;
36Intel*) ;;
37*) case "$gccansipedantic" in
38 define)
39 case "$gccversion" in
40 [12]*) ;; # gcc versions 1 (gasp!) and 2 are not good for this.
41 *) case "$osname" in
42 # Add -ansi -pedantic only for known platforms.
43 aix|dec_osf|freebsd|hpux|irix|linux)
44 ansipedantic="-ansi -pedantic" ;;
45 solaris)
46# Can't add -ansi for Solaris.
47# Off_t/off_t is a struct in Solaris with largefiles, and with -ansi
48# that struct cannot be compared with a flat integer, such as a STRLEN.
49# The -ansi will also cause a lot of noise in Solaris because of:
50# /usr/include/sys/resource.h:148: warning: `struct rlimit64' declared inside parameter list
51 ansipedantic="-pedantic" ;;
52 esac
53 for i in $ansipedantic
54 do
55 case "$ccflags" in
56 *$i*) ;;
57 *) warn="$warn $i" ;;
58 esac
59 done
60 case "$warn$ccflags" in
61 *-pedantic*) warn="$warn -DPERL_GCC_PEDANTIC" ;;
62 esac
63 ;;
64 esac
65 ;;
66 esac
67 ;;
68esac
69
70# Further gcc warning options.
71case "$gccversion" in
72'') ;;
73Intel*) ;;
74*) for opt in '' extra declaration-after-statement endif-labels
75 do
76 case " $ccflags " in
77 *"-W$opt "*) ;;
78 *) case "`echo >_cflags.c | $cc -W$opt -c _cflags.c -o _cflags.o 2>&1`" in
79 *"unrecognized"*) ;;
80 *"Invalid"*) ;;
81 *) warn="$warn -W$opt" ;;
82 esac
83 ;;
84 esac
85 rm -f _cflags.c cflags.o
86 done
87 ;;
88esac
89
2b317908 90echo "Extracting cflags (with variable substitutions)"
91: This section of the file will have variable substitutions done on it.
92: Move anything that needs config subs from !NO!SUBS! section to !GROK!THIS!.
93: Protect any dollar signs and backticks that you do not want interpreted
94: by putting a backslash in front. You may delete these comments.
165b7424 95rm -f cflags
2b317908 96$spitshell >cflags <<!GROK!THIS!
ecfc5424 97$startsh
bc730b18 98
99# Used for gcc.
100warn="$warn"
101
2b317908 102!GROK!THIS!
103
104: In the following dollars and backticks do not need the extra backslash.
105$spitshell >>cflags <<'!NO!SUBS!'
a02608de 106case $PERL_CONFIG_SH in
2b317908 107'')
a0d0e21e 108 if test -f config.sh; then TOP=.;
109 elif test -f ../config.sh; then TOP=..;
110 elif test -f ../../config.sh; then TOP=../..;
111 elif test -f ../../../config.sh; then TOP=../../..;
112 elif test -f ../../../../config.sh; then TOP=../../../..;
113 else
114 echo "Can't find config.sh."; exit 1
115 fi
116 . $TOP/config.sh
117 ;;
118esac
119
75550b4e 120: syntax: cflags [optimize=XXX] [file[.suffix]]
121: displays the compiler command line for file
122
1167a30e 123case "X$1" in
26102cc7 124Xoptimize=*|X"optimize=*")
1167a30e 125 eval "$1"
126 shift
127 ;;
128esac
129
1c3d792e 130also=': '
131case $# in
2b317908 1321) also='echo 1>&2 " CCCMD = "'
1c3d792e 133esac
134
135case $# in
1360) set *.c; echo "The current C flags are:" ;;
1c3d792e 137esac
2b317908 138
578789a7 139set `echo "$* " | sed -e 's/\.[oc] / /g' -e 's/\.obj / /g' -e "s/\\$obj_ext / /g"`
2b317908 140
1c3d792e 141for file do
142
143 case "$#" in
144 1) ;;
2b317908 145 *) echo $n " $file.c $c" ;;
1c3d792e 146 esac
147
2b317908 148 : allow variables like toke_cflags to be evaluated
149
8736538c 150 if echo $file | grep -v / >/dev/null
151 then
152 eval 'eval ${'"${file}_cflags"'-""}'
153 fi
2b317908 154
155 : or customize here
156
1c3d792e 157 case "$file" in
a0d0e21e 158 DB_File) ;;
159 GDBM_File) ;;
2304df62 160 NDBM_File) ;;
161 ODBM_File) ;;
162 POSIX) ;;
163 SDBM_File) ;;
164 av) ;;
4b6be2dd 165 byterun) ;;
2304df62 166 deb) ;;
167 dl) ;;
2b317908 168 doio) ;;
2304df62 169 doop) ;;
2b317908 170 dump) ;;
2304df62 171 gv) ;;
172 hv) ;;
a6ec74c1 173 locale) ;;
2304df62 174 main) ;;
2b317908 175 malloc) ;;
2304df62 176 mg) ;;
177 miniperlmain) ;;
a6ec74c1 178 numeric) ;;
2304df62 179 op) ;;
2b317908 180 perl) ;;
6f4183fe 181 perlapi) ;;
2304df62 182 perlmain) ;;
2b317908 183 perly) ;;
2304df62 184 pp) ;;
a0d0e21e 185 pp_ctl) ;;
186 pp_hot) ;;
a6ec74c1 187 pp_pack) ;;
a0d0e21e 188 pp_sys) ;;
2b317908 189 regcomp) ;;
190 regexec) ;;
2304df62 191 run) ;;
192 scope) ;;
193 sv) ;;
194 taint) ;;
2b317908 195 toke) ;;
196 usersub) ;;
197 util) ;;
1c3d792e 198 *) ;;
199 esac
200
69c7f294 201if test -f .patch; then
202 ccflags="-DPERL_PATCHNUM=`cat .patch` $ccflags"
203fi
204
c4f23d77 205 : Can we perhaps use $ansi2knr here
75550b4e 206 echo "$cc -c -DPERL_CORE $ccflags $optimize $warn"
207 eval "$also "'"$cc -DPERL_CORE -c $ccflags $optimize $warn"'
2b317908 208
a0d0e21e 209 . $TOP/config.sh
2b317908 210
1c3d792e 211done
2b317908 212!NO!SUBS!
a0d0e21e 213chmod 755 cflags
2b317908 214$eunicefix cflags