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\(.*\)/'` ;;
22 # Add -Wall for the core modules iff gcc and not already -Wall
25 Intel*) ;; # The Intel C++ plays gcc on TV but is not really it.
28 *) warn="$warn -Wall" ;;
33 # The gcc -ansi -pedantic require their own dance, too.
36 Intel*) ;; # Is that you, Intel C++?
37 *) case "$gccansipedantic" in
40 [12]*) ;; # gcc versions 1 (gasp!) and 2 are not good for this.
42 # Add -ansi -pedantic only for known platforms.
43 aix|dec_osf|freebsd|hpux|irix|linux)
44 ansipedantic="-ansi -pedantic" ;;
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" ;;
53 for i in $ansipedantic
60 case "$warn$ccflags" in
61 *-pedantic*) warn="$warn -DPERL_GCC_PEDANTIC" ;;
70 # Further gcc warning options.
74 Intel*) ;; # Haven't we been through this already?
75 *) for opt in '' extra declaration-after-statement endif-labels
79 *) case "`echo >_cflags.c | $cc -W$opt -c _cflags.c -o _cflags.o 2>&1`" in
82 *) warn="$warn -W$opt" ;;
86 rm -f _cflags.c cflags.o
91 # If we have g++, we cannot have the -Wdeclaration-after-statement.
92 # Some g++s accept it but then whine about it with every file.
94 *g++*) warn="`echo $warn|sed 's/-Wdeclaration-after-statement/ /'`" ;;
97 # stdflags currently unused.
102 # Code to set any extra flags here.
104 echo "Extracting cflags (with variable substitutions)"
105 : This section of the file will have variable substitutions done on it.
106 : Move anything that needs config subs from !NO!SUBS! section to !GROK!THIS!.
107 : Protect any dollar signs and backticks that you do not want interpreted
108 : by putting a backslash in front. You may delete these comments.
110 $spitshell >cflags <<!GROK!THIS!
113 # Extra warnings, used e.g. for gcc.
115 # Extra standardness.
122 : In the following dollars and backticks do not need the extra backslash.
123 $spitshell >>cflags <<'!NO!SUBS!'
124 case $PERL_CONFIG_SH in
126 if test -f config.sh; then TOP=.;
127 elif test -f ../config.sh; then TOP=..;
128 elif test -f ../../config.sh; then TOP=../..;
129 elif test -f ../../../config.sh; then TOP=../../..;
130 elif test -f ../../../../config.sh; then TOP=../../../..;
132 echo "Can't find config.sh."; exit 1
138 : syntax: cflags [optimize=XXX] [file[.suffix]]
139 : displays the compiler command line for file
142 Xoptimize=*|X"optimize=*")
150 1) also='echo 1>&2 " CCCMD = "'
154 0) set *.c; echo "The current C flags are:" ;;
157 set `echo "$* " | sed -e 's/\.[oc] / /g' -e 's/\.obj / /g' -e "s/\\$obj_ext / /g"`
163 *) echo $n " $file.c $c" ;;
166 : allow variables like toke_cflags to be evaluated
168 if echo $file | grep -v / >/dev/null
170 eval 'eval ${'"${file}_cflags"'-""}'
228 *g++*) ccflags="`echo $ccflags|sed 's/-Wdeclaration-after-statement/ /'`" ;;
231 if test -f .patch; then
232 ccflags="-DPERL_PATCHNUM=`cat .patch` $ccflags"
235 : Can we perhaps use $ansi2knr here
236 echo "$cc -c -DPERL_CORE $ccflags $stdflags $optimize $warn $extra"
237 eval "$also "'"$cc -DPERL_CORE -c $ccflags $stdflags $optimize $warn $extra"'