This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl 4.0 patch 11: (combined patch)
[perl5.git] / cflags.SH
1 case $CONFIG in
2 '')
3     if test ! -f config.sh; then
4         ln ../config.sh . || \
5         ln ../../config.sh . || \
6         ln ../../../config.sh . || \
7         (echo "Can't find config.sh."; exit 1)
8     fi
9     . config.sh
10     ;;
11 esac
12 : This forces SH files to create target in same directory as SH file.
13 : This is so that make depend always knows where to find SH derivatives.
14 case "$0" in
15 */*) cd `expr X$0 : 'X\(.*\)/'` ;;
16 esac
17 echo "Extracting cflags (with variable substitutions)"
18 : This section of the file will have variable substitutions done on it.
19 : Move anything that needs config subs from !NO!SUBS! section to !GROK!THIS!.
20 : Protect any dollar signs and backticks that you do not want interpreted
21 : by putting a backslash in front.  You may delete these comments.
22 $spitshell >cflags <<!GROK!THIS!
23 !GROK!THIS!
24
25 : In the following dollars and backticks do not need the extra backslash.
26 $spitshell >>cflags <<'!NO!SUBS!'
27 case "$0" in
28 */*) cd `expr X$0 : 'X\(.*\)/'` ;;
29 esac
30 case $CONFIG in
31 '')
32     if test ! -f config.sh; then
33         ln ../config.sh . || \
34         ln ../../config.sh . || \
35         ln ../../../config.sh . || \
36         (echo "Can't find config.sh."; exit 1)
37     fi 2>/dev/null
38     . ./config.sh
39     ;;
40 esac
41
42 also=': '
43 case $# in
44 1) also='echo 1>&2 "      CCCMD = "'
45 esac
46
47 case $# in
48 0) set *.c; echo "The current C flags are:" ;;
49 esac
50
51 set `echo "$* " | sed 's/\.[oc] / /g'`
52
53 for file do
54
55     case "$#" in
56     1) ;;
57     *) echo $n "    $file.c     $c" ;;
58     esac
59
60     : allow variables like toke_cflags to be evaluated
61
62     eval 'eval ${'"${file}_cflags"'-""}'
63
64     : or customize here
65
66     case "$file" in
67     array) ;;
68     cmd) ;;
69     cons) ;;
70     consarg) ;;
71     doarg) ;;
72     doio) ;;
73     dolist) ;;
74     dump) ;;
75     eval) ;;
76     form) ;;
77     hash) ;;
78     malloc) ;;
79     perl) ;;
80     perly) ;;
81     regcomp) ;;
82     regexec) ;;
83     stab) ;;
84     str) ;;
85     toke) ;;
86     usersub) ;;
87     util) ;;
88     tarray) ;;
89     tcmd) ;;
90     tcons) ;;
91     tconsarg) ;;
92     tdoarg) ;;
93     tdoio) ;;
94     tdolist) ;;
95     tdump) ;;
96     teval) ;;
97     tform) ;;
98     thash) ;;
99     tmalloc) ;;
100     tperl) ;;
101     tperly) ;;
102     tregcomp) ;;
103     tregexec) ;;
104     tstab) ;;
105     tstr) ;;
106     ttoke) ;;
107     tusersub) ;;
108     tutil) ;;
109     *) ;;
110     esac
111
112     echo "$cc -c $ccflags $optimize $large $split"
113     eval "$also "'"$cc -c $ccflags $optimize $large $split"'
114
115     . ./config.sh
116
117 done
118 !NO!SUBS!
119 chmod +x cflags
120 $eunicefix cflags