This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: sh Configure?
[perl5.git] / x2p / cflags.SH
CommitLineData
2b317908
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 ;;
2b317908
LW
13esac
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.
16case "$0" in
17*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
18esac
a0d0e21e 19echo "Extracting x2p/cflags (with variable substitutions)"
2b317908
LW
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.
14ee6a0a 24rm -f cflags
2b317908
LW
25$spitshell >cflags <<!GROK!THIS!
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 ;;
2b317908
LW
42esac
43
44also=': '
45case $# in
461) also='echo 1>&2 " CCCMD = "'
47esac
48
49case $# in
500) set *.c; echo "The current C flags are:" ;;
51esac
52
4633a7c4 53set `echo "$* " | sed -e 's/\.[oc] / /g' -e 's/\.obj / /g'`
2b317908
LW
54
55for file do
56
57 case "$#" in
58 1) ;;
59 *) echo $n " $file.c $c" ;;
60 esac
61
62 : allow variables like str_cflags to be evaluated
63
64 eval 'eval ${'"${file}_cflags"'-""}'
65
66 : or customize here
67
68 case "$file" in
69 a2p) ;;
70 a2py) ;;
71 hash) ;;
72 str) ;;
73 util) ;;
74 walk) ;;
75 *) ;;
76 esac
77
760ac839 78 ccflags="`echo $ccflags | sed -e 's/-DMULTIPLICITY//'`"
a0d0e21e 79
2b317908
LW
80 echo "$cc -c $ccflags $optimize $large $split"
81 eval "$also "'"$cc -c $ccflags $optimize $large $split"'
82
a0d0e21e 83 . $TOP/config.sh
2b317908
LW
84
85done
86!NO!SUBS!
a0d0e21e 87chmod 755 cflags
2b317908 88$eunicefix cflags