1 case $PERL_CONFIG_SH in
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=../../../..;
9 echo "Can't find config.sh."; exit 1
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.
17 */*) cd `expr X$0 : 'X\(.*\)/'` ;;
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.
25 $spitshell >cflags <<!GROK!THIS!
29 : In the following dollars and backticks do not need the extra backslash.
30 $spitshell >>cflags <<'!NO!SUBS!'
31 case $PERL_CONFIG_SH in
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=../../../..;
39 echo "Can't find config.sh."; exit 1
45 : syntax: cflags [optimize=XXX] [file[.suffix]]
46 : displays the compiler command line for file
49 Xoptimize=*|X"optimize=*")
57 1) also='echo 1>&2 " CCCMD = "'
61 0) set *.c; echo "The current C flags are:" ;;
64 set `echo "$* " | sed -e 's/\.[oc] / /g' -e 's/\.obj / /g' -e "s/\\$obj_ext / /g"`
70 *) echo $n " $file.c $c" ;;
73 : allow variables like toke_cflags to be evaluated
75 if echo $file | grep -v / >/dev/null
77 eval 'eval ${'"${file}_cflags"'-""}'
128 # Add -Wall for the core modules iff gcc and not already -Wall
129 case "$gccversion" in
131 Intel*) ;; # The Intel C++ plays gcc on TV but is not really it.
132 *) case "$ccflags" in
134 *) warn="$warn -Wall" ;;
139 # The gcc -ansi -pedantic require their own dance, too.
140 case "$gccversion" in
143 *) case "$gccansipedantic" in
145 case "$gccversion" in
146 [12]*) ;; # gcc versions 1 (gasp!) and 2 are not good for this.
148 # Add -ansi -pedantic only for known platforms.
149 aix|dec_osf|freebsd|hpux|irix|linux)
150 ansipedantic="-ansi -pedantic" ;;
152 # Can't add -ansi for Solaris.
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
157 ansipedantic="-pedantic" ;;
159 for i in $ansipedantic
163 *) warn="$warn $i" ;;
166 case "$warn$ccflags" in
167 *-pedantic*) warn="$warn -DPERL_GCC_PEDANTIC" ;;
176 # Further gcc warning options.
177 case "$gccversion" in
180 *) for opt in '' extra declaration-after-statement endif-labels
184 *) case "`echo >_cflags.c | $cc -W$opt -c _cflags.c -o _cflags.o 2>&1`" in
187 *) warn="$warn -W$opt" ;;
191 rm -f _cflags.c cflags.o
196 if test -f .patch; then
197 ccflags="-DPERL_PATCHNUM=`cat .patch` $ccflags"
200 : Can we perhaps use $ansi2knr here
201 echo "$cc -c -DPERL_CORE $ccflags $optimize $warn"
202 eval "$also "'"$cc -DPERL_CORE -c $ccflags $optimize $warn"'