This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
VMS-specific patch.
[perl5.git] / cflags.SH
CommitLineData
1c3d792e
LW
1case $CONFIG in
2'')
a0d0e21e
LW
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
LW
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
LW
16case "$0" in
17*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
18esac
2b317908
LW
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.
24$spitshell >cflags <<!GROK!THIS!
ecfc5424 25$startsh
2b317908
LW
26!GROK!THIS!
27
28: In the following dollars and backticks do not need the extra backslash.
29$spitshell >>cflags <<'!NO!SUBS!'
2b317908
LW
30case $CONFIG in
31'')
a0d0e21e
LW
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 ;;
42esac
43
44perltype=''
45optdebug='' # ensure -g used if building a -DDEBUGGING libperl
46case $# in
472) 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 ;;
2b317908 56esac
1c3d792e
LW
57
58also=': '
59case $# in
2b317908 601) also='echo 1>&2 " CCCMD = "'
1c3d792e
LW
61esac
62
63case $# in
640) set *.c; echo "The current C flags are:" ;;
1c3d792e 65esac
2b317908 66
4633a7c4 67set `echo "$* " | sed -e 's/\.[oc] / /g' -e 's/\.obj / /g'`
2b317908 68
1c3d792e
LW
69for file do
70
71 case "$#" in
72 1) ;;
2b317908 73 *) echo $n " $file.c $c" ;;
1c3d792e
LW
74 esac
75
2b317908
LW
76 : allow variables like toke_cflags to be evaluated
77
78 eval 'eval ${'"${file}_cflags"'-""}'
79
80 : or customize here
81
1c3d792e 82 case "$file" in
a0d0e21e
LW
83 DB_File) ;;
84 GDBM_File) ;;
2304df62
AD
85 NDBM_File) ;;
86 ODBM_File) ;;
87 POSIX) ;;
88 SDBM_File) ;;
89 av) ;;
90 deb) ;;
91 dl) ;;
2b317908 92 doio) ;;
2304df62 93 doop) ;;
2b317908 94 dump) ;;
2304df62
AD
95 gv) ;;
96 hv) ;;
97 main) ;;
2b317908 98 malloc) ;;
2304df62
AD
99 mg) ;;
100 miniperlmain) ;;
101 op) ;;
2b317908 102 perl) ;;
2304df62 103 perlmain) ;;
2b317908 104 perly) ;;
2304df62 105 pp) ;;
a0d0e21e
LW
106 pp_ctl) ;;
107 pp_hot) ;;
108 pp_sys) ;;
2b317908
LW
109 regcomp) ;;
110 regexec) ;;
2304df62
AD
111 run) ;;
112 scope) ;;
113 sv) ;;
114 taint) ;;
2b317908
LW
115 toke) ;;
116 usersub) ;;
117 util) ;;
1c3d792e
LW
118 *) ;;
119 esac
120
a0d0e21e
LW
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"'
2b317908 127
a0d0e21e 128 . $TOP/config.sh
2b317908 129
1c3d792e 130done
2b317908 131!NO!SUBS!
a0d0e21e 132chmod 755 cflags
2b317908 133$eunicefix cflags