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