This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl 5.002_01: lib/File/Copy.pm
[perl5.git] / cflags.SH
1 case $CONFIG in
2 '')
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         ;;
13 esac
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.
16 case "$0" in
17 */*) cd `expr X$0 : 'X\(.*\)/'` ;;
18 esac
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.
24 $spitshell >cflags <<!GROK!THIS!
25 $startsh
26 !GROK!THIS!
27
28 : In the following dollars and backticks do not need the extra backslash.
29 $spitshell >>cflags <<'!NO!SUBS!'
30 case $CONFIG in
31 '')
32         if test -f config.sh; then TOP=.;
33         elif 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         else
38                 echo "Can't find config.sh."; exit 1
39         fi
40         . $TOP/config.sh
41         ;;
42 esac
43
44 perltype=''
45 optdebug=''     # ensure -g used if building a -DDEBUGGING libperl
46 case $# in
47 2) case $1 in
48     *perl.*)    perltype='';;
49     *perld.*)   perltype='-DDEBUGGING'; optdebug='-g' ;;
50     *perle.*)   perltype='-DEMBED';;
51     *perlde.*)  perltype='-DDEBUGGING -DEMBED'; optdebug='-g' ;;
52     *perlm.*)   perltype='-DEMBED -DMULTIPLICITY';;
53     *perldm.*)  perltype='-DDEBUGGING -DEMBED -DMULTIPLICITY'; optdebug='-g' ;;
54     esac
55     shift ;;
56 esac
57
58 also=': '
59 case $# in
60 1) also='echo 1>&2 "      CCCMD = "'
61 esac
62
63 case $# in
64 0) set *.c; echo "The current C flags are:" ;;
65 esac
66
67 set `echo "$* " | sed -e 's/\.[oc] / /g' -e 's/\.obj / /g'`
68
69 for file do
70
71     case "$#" in
72     1) ;;
73     *) echo $n "    $file.c     $c" ;;
74     esac
75
76     : allow variables like toke_cflags to be evaluated
77
78     eval 'eval ${'"${file}_cflags"'-""}'
79
80     : or customize here
81
82     case "$file" in
83     DB_File) ;;
84     GDBM_File) ;;
85     NDBM_File) ;;
86     ODBM_File) ;;
87     POSIX) ;;
88     SDBM_File) ;;
89     av) ;;
90     deb) ;;
91     dl) ;;
92     doio) ;;
93     doop) ;;
94     dump) ;;
95     gv) ;;
96     hv) ;;
97     main) ;;
98     malloc) ;;
99     mg) ;;
100     miniperlmain) ;;
101     op) ;;
102     perl) ;;
103     perlmain) ;;
104     perly) ;;
105     pp) ;;
106     pp_ctl) ;;
107     pp_hot) ;;
108     pp_sys) ;;
109     regcomp) ;;
110     regexec) ;;
111     run) ;;
112     scope) ;;
113     sv) ;;
114     taint) ;;
115     toke) ;;
116     usersub) ;;
117     util) ;;
118     *) ;;
119     esac
120
121         if test "X$optdebug" != "X"; then
122                 optimize="$optdebug"
123         fi
124
125     echo "$cc -c $ccflags $optimize $perltype $large $split"
126     eval "$also "'"$cc -c $ccflags $optimize $perltype $large $split"'
127
128     . $TOP/config.sh
129
130 done
131 !NO!SUBS!
132 chmod 755 cflags
133 $eunicefix cflags