Back up a tiny bit from #3735.
[p5sagit/p5-mst-13.2.git] / cflags.SH
CommitLineData
2000072c 1case $CONFIGDOTSH 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
2b317908 19echo "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 24rm -f cflags
2b317908 25$spitshell >cflags <<!GROK!THIS!
ecfc5424 26$startsh
b233458b 27src=$src
2b317908 28!GROK!THIS!
29
30: In the following dollars and backticks do not need the extra backslash.
31$spitshell >>cflags <<'!NO!SUBS!'
2000072c 32case $CONFIGDOTSH in
2b317908 33'')
a0d0e21e 34 if 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 elif test -f ../../../../config.sh; then TOP=../../../..;
39 else
40 echo "Can't find config.sh."; exit 1
41 fi
42 . $TOP/config.sh
43 ;;
44esac
45
46perltype=''
47optdebug='' # ensure -g used if building a -DDEBUGGING libperl
48case $# in
492) case $1 in
50 *perl.*) perltype='';;
51 *perld.*) perltype='-DDEBUGGING'; optdebug='-g' ;;
52 *perle.*) perltype='-DEMBED';;
53 *perlde.*) perltype='-DDEBUGGING -DEMBED'; optdebug='-g' ;;
54 *perlm.*) perltype='-DEMBED -DMULTIPLICITY';;
55 *perldm.*) perltype='-DDEBUGGING -DEMBED -DMULTIPLICITY'; optdebug='-g' ;;
56 esac
57 shift ;;
2b317908 58esac
1c3d792e 59
60also=': '
61case $# in
2b317908 621) also='echo 1>&2 " CCCMD = "'
1c3d792e 63esac
64
65case $# in
660) set *.c; echo "The current C flags are:" ;;
1c3d792e 67esac
2b317908 68
578789a7 69set `echo "$* " | sed -e 's/\.[oc] / /g' -e 's/\.obj / /g' -e "s/\\$obj_ext / /g"`
2b317908 70
1c3d792e 71for file do
72
73 case "$#" in
74 1) ;;
2b317908 75 *) echo $n " $file.c $c" ;;
1c3d792e 76 esac
77
b233458b 78 : allow for out-of-source experience
79
80 if test "X$src" != X.; then
81 ccflags="$ccflags -I$src -I."
82 fi
83
2b317908 84 : allow variables like toke_cflags to be evaluated
85
8736538c 86 if echo $file | grep -v / >/dev/null
87 then
88 eval 'eval ${'"${file}_cflags"'-""}'
89 fi
2b317908 90
91 : or customize here
92
1c3d792e 93 case "$file" in
a0d0e21e 94 DB_File) ;;
95 GDBM_File) ;;
2304df62 96 NDBM_File) ;;
97 ODBM_File) ;;
98 POSIX) ;;
99 SDBM_File) ;;
100 av) ;;
4b6be2dd 101 byterun) ;;
2304df62 102 deb) ;;
103 dl) ;;
2b317908 104 doio) ;;
2304df62 105 doop) ;;
2b317908 106 dump) ;;
2304df62 107 gv) ;;
108 hv) ;;
109 main) ;;
2b317908 110 malloc) ;;
2304df62 111 mg) ;;
112 miniperlmain) ;;
113 op) ;;
2b317908 114 perl) ;;
2304df62 115 perlmain) ;;
2b317908 116 perly) ;;
2304df62 117 pp) ;;
a0d0e21e 118 pp_ctl) ;;
119 pp_hot) ;;
120 pp_sys) ;;
2b317908 121 regcomp) ;;
122 regexec) ;;
2304df62 123 run) ;;
124 scope) ;;
125 sv) ;;
126 taint) ;;
2b317908 127 toke) ;;
128 usersub) ;;
129 util) ;;
1c3d792e 130 *) ;;
131 esac
132
a0d0e21e 133 if test "X$optdebug" != "X"; then
134 optimize="$optdebug"
135 fi
136
c4f23d77 137 : Can we perhaps use $ansi2knr here
760ac839 138 echo "$cc -c -DPERL_CORE $ccflags $optimize $perltype $large $split"
139 eval "$also "'"$cc -DPERL_CORE -c $ccflags $optimize $perltype $large $split"'
2b317908 140
a0d0e21e 141 . $TOP/config.sh
2b317908 142
1c3d792e 143done
2b317908 144!NO!SUBS!
a0d0e21e 145chmod 755 cflags
2b317908 146$eunicefix cflags