File: mod_perl.config.sh

package info (click to toggle)
apache-perl 1.3.9-14.1-1.21.20000309-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 5,524 kB
  • ctags: 1,743
  • sloc: ansic: 9,017; perl: 7,822; sh: 864; makefile: 695
file content (224 lines) | stat: -rwxr-xr-x 6,628 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
##
##  mod_perl.config.sh -- mod_perl configuration transformation script
##  Written by Ralf S. Engelschall <rse@apache.org>
##

DIFS=' 	
'

#   defaults
config_file='mod_perl.config'
build_type='OBJ'
display_prefix=''
tmpfile1=".tmp.$$.1"
tmpfile2=".tmp.$$.2"

#
#   parse argument line
#
prev=''
OIFS="$IFS" IFS="$DIFS"
for option
do
    if [ ".$prev" != . ]; then
        eval "$prev=\$option"
        prev=""
        continue
    fi
    case "$option" in
        -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
           *) optarg='' ;;
    esac
    case "$option" in
        --config-file=*)     config_file="$optarg"    ;;
        --config-override=*) config_override="$optarg" ;;
        --build-type=*)      build_type="$optarg"     ;;
        --display-prefix=*)  display_prefix="$optarg" ;;
        * ) echo "$0:Error: invalid option '$option'" 1>&2; exit 1 ;;
    esac
done
IFS="$OIFS"
if [ ".$prev" != . ]; then
    echo "$0:Error: missing argument to --`echo $prev | sed 's/_/-/g'`" 1>&2
    exit 1
fi


#
#   import parameters from config file into
#   own namespace to avoid conflicts with src/Configure
#
(cat $config_file; echo "$config_override" | sed -e 's:,[ 	]*:,:' | tr "," "\n") >$tmpfile1
vars="`egrep '^[A-Z0-9_]*[ 	]*=' $tmpfile1 | sed -e 's:^\([A-Z0-9_]*\).*:\1:'`"
OIFS="$IFS" IFS="$DIFS"
for var in $vars; do
    egrep "^${var}[ 	]*=" $tmpfile1 | tail -1 >$tmpfile2
    val="`sed -e 's:^[A-Z0-9_]*[ 	]*=[ 	]*::' <$tmpfile2`"
    eval "param_${var}=\"${val}\""
done
IFS="$OIFS"

#
#   verbose message
#
echo "$display_prefix id: mod_perl/$param_MOD_PERL_VERSION" 1>&2

#
#   determine Perl interpreter and version
#
libperl="$param_LIBPERL"
if [ ".$libperl" = .DEFAULT ]; then
    perl_libperl=""
else
    perl_libperl=" -- $libperl"
fi
perl_interp="$param_PERL"
if [ ".$perl_interp" = .DEFAULT ]; then
    if [ ".$PERL" != . ]; then
        perl_interp="$PERL"
    else 
        perl_interp=""
    fi
fi
if [ ".$perl_interp" = . ]; then
    OIFS=$IFS IFS=':'
    for my_dir in $PATH; do
        for my_exe in perl5 perl; do
            if test -f "$my_dir/$my_exe"; then
                if test -x "$my_dir/$my_exe"; then
                    perl_interp="$my_dir/$my_exe"
                    break 2
                fi
            fi
        done
    done
    IFS="$OIFS"
    perl_interp="`echo $perl_interp | sed -e 's://:/:'`"
fi
perl_version="`$perl_interp -e 'print $];'`"
os_version="`$perl_interp -e 'print $^O;'`"

#
#   verbose message
#
echo "$display_prefix id: Perl/$perl_version ($os_version) [$perl_interp]" 1>&2

#
#   determine build tools and flags  
#

#config_pm='-MApache::ExtUtils=%Config'
config_pm='-MConfig'
perl_cc="`$perl_interp $config_pm -e 'print $Config{cc}'`"
perl_ccflags="`$perl_interp $config_pm -e 'print $Config{ccflags}'`"
perl_optimize="`$perl_interp $config_pm -e 'print $Config{optimize}'`"
perl_cccdlflags="`$perl_interp $config_pm -e 'print $Config{cccdlflags}'`"
perl_ld="`$perl_interp $config_pm -e 'print $Config{ld}'`"
perl_ldflags="`$perl_interp $config_pm -e 'print $Config{ldflags}'`"
perl_lddlflags="`$perl_interp $config_pm -e 'print $Config{lddlflags}'`"

case "$os_version" in
    aix*)  perl_lddlflags="$perl_lddlflags -bI:\$(APACHELIBEXEC)/httpd.exp" ;;
    * )    ;;
esac

cat >$tmpfile2 <<'EOT'
use Config;
#my $embed_pm = '-MApache::ExtUtils=ldopts';
my $embed_pm = '-MExtUtils::Embed';
my $ldopts = `$^X $embed_pm -e ldopts -- -std @ARGV`;
# can't pass ccdlflags to ld, which is what happens in this context.  however
# we still need the libraries themselves.  I think this should be correct for
# other systems, but it bites us on BSD/OS 4.x
$ldopts =~ s@$Config{ccdlflags}@@ if ($^O eq 'bsdos');
$ldopts =~ s,(-bE:)(perl\.exp),$1$Config{archlibexp}/CORE/$2, if($^O eq "aix");
=pod
#replace -Wl args meant for gcc with args for ld
#hmm, this breaks USE_APACI=1, what to do for USE_APXS?
#should we use gcc instead of ld?
if($^O eq "hpux") {
    while ($ldopts =~ s/-Wl,(\S+)/$1/) {
	my $cp = $1;
	(my $repl = $cp) =~ s/,/ /g;
	$ldopts =~ s/$cp/$repl/;
    }
}
=cut
print $ldopts;
EOT
perl_libs="`$perl_interp $tmpfile2 $perl_libperl`"
perl_inc="`$perl_interp -MConfig -e 'print "$Config{archlibexp}/CORE"'`"
perl_privlibexp="`$perl_interp -MConfig -e 'print $Config{privlibexp}'`"
perl_archlibexp="`$perl_interp -MConfig -e 'print $Config{archlibexp}'`"
perl_xsinit="$perl_interp -MExtUtils::Embed -e xsinit"
perl_xsubpp="$perl_interp ${perl_privlibexp}/ExtUtils/xsubpp -typemap ${perl_privlibexp}/ExtUtils/typemap"
perl_ar="`$perl_interp -MConfig -e 'print $Config{ar}'`"
perl_ranlib=`$perl_interp -MConfig -e 'print $Config{ranlib}'`

#
#   determine static objects
#
perl_static_exts="$param_PERL_STATIC_EXTS"
perl_static_ar="$param_PERL_STATIC_AR"
perl_static_srcs="$param_PERL_STATIC_SRCS"
perl_static_objs="`echo $param_PERL_STATIC_SRCS | sed -e 's:\.c:.o:g'`"
perl_static_objs_pic="`echo $param_PERL_STATIC_SRCS | sed -e 's:\.c:.lo:g'`"

#
#   determine defines
#
perl_defs=''
perl_defs="$perl_defs -DMOD_PERL_VERSION=\\\"$param_MOD_PERL_VERSION\\\""
perl_defs="$perl_defs -DMOD_PERL_STRING_VERSION=\\\"mod_perl/$param_MOD_PERL_VERSION\\\""
perl_defs="$perl_defs"
OIFS="$IFS" IFS="$DIFS"
for hook in \
    DISPATCH CHILD_INIT CHILD_EXIT POST_READ_REQUEST TRANS HEADER_PARSER \
    ACCESS AUTHEN AUTHZ TYPE FIXUP HANDLER LOG INIT CLEANUP STACKED_HANDLERS \
    METHOD_HANDLERS DIRECTIVE_HANDLERS SECTIONS RESTART SSI TRACE THREADS; do
    eval "val=\$param_PERL_${hook}"
    case $hook in
        TRACE|THREADS ) 
            if [ ".$val" = .yes ]; then
                perl_defs="$perl_defs -DPERL_${hook}=1"
            fi
            ;;
        * )
            if [ ".$val" = .no ]; then
                perl_defs="$perl_defs -DNO_PERL_${hook}=1"
            fi
            ;;
    esac
done
IFS="$OIFS"

#
#   output information as Makefile parameters
#
echo "PERL=$perl_interp"
echo "PERL_CC=$perl_cc"
echo "PERL_OPTIMIZE=$perl_optimize"
echo "PERL_CCFLAGS=$perl_ccflags"
echo "PERL_CCCDLFLAGS=$perl_cccdlflags"
echo "PERL_DEFS=$perl_defs"
echo "PERL_INC=$perl_inc"
echo "PERL_LD=$perl_ld"
echo "PERL_LDFLAGS=$perl_ldflags"
echo "PERL_LDDLFLAGS=$perl_lddlflags"
echo "PERL_LIBS=$perl_libs $perl_static_ar"
echo "PERL_XSINIT=$perl_xsinit"
echo "PERL_XSUBPP=$perl_xsubpp"
echo "PERL_AR=$perl_ar"
echo "PERL_RANLIB=$perl_ranlib"
echo "PERL_STATIC_EXTS=$perl_static_exts"
echo "PERL_STATIC_AR=$perl_static_ar"
echo "PERL_STATIC_SRCS=$perl_static_srcs"
echo "PERL_STATIC_OBJS=$perl_static_objs"
echo "PERL_STATIC_OBJS_PIC=$perl_static_objs_pic"
echo "PERL_SSI=$param_PERL_SSI"

#
#  cleanup
#
rm -f $tmpfile1 $tmpfile2