1 |
#!/bin/sh |
2 |
# |
3 |
# configure.apxs --- build configuration script for creating mod_ftp |
4 |
# out of tree using the apxs utility and httpd build toolset |
5 |
# |
6 |
if test "$APXS" = ""; then |
7 |
APXS=`which apxs 2>/dev/null` |
8 |
fi; |
9 |
|
10 |
if test "$APXS" = ""; then |
11 |
echo $0 must be able to find apxs in your path, |
12 |
echo or the environment variable APXS must provide the full path of APXS, |
13 |
echo or you may specify it with: |
14 |
echo |
15 |
echo APXS=/path/to/apxs $0 |
16 |
echo |
17 |
echo configuration failed |
18 |
exit 1 |
19 |
fi |
20 |
|
21 |
echo Configuring mod_ftp for APXS in $APXS |
22 |
|
23 |
# top_builddir and top_srcdir are a misnomers, because build/*.mk |
24 |
# scripts expect them to be the parent of the build directory |
25 |
# they fail to use the $installbuilddir path. |
26 |
exp_installbuilddir=`$APXS -q exp_installbuilddir` |
27 |
top_installbuilddir=`cd $exp_installbuilddir/..; pwd` |
28 |
top_installbuilddir=`echo $exp_installbuilddir | sed -e "s#/[^/]*\\\$##;"` |
29 |
|
30 |
builddir=`pwd` |
31 |
srcdir=$builddir |
32 |
ftp_builddir=$builddir |
33 |
ftp_srcdir=$builddir |
34 |
|
35 |
# prefix is the default @@ServerRoot@@, where libexecdir/sysconfdir may |
36 |
# be relative (if it is not their prefix, the rel_ paths remain unchanged |
37 |
rel_fix_prefix=`$APXS -q prefix` |
38 |
rel_libexecdir=`$APXS -q exp_libexecdir | sed -e "s#^$rel_fix_prefix/##;"` |
39 |
rel_sysconfdir=`$APXS -q exp_sysconfdir | sed -e "s#^$rel_fix_prefix/##;"` |
40 |
rel_logfiledir=`$APXS -q exp_logfiledir | sed -e "s#^$rel_fix_prefix/##;"` |
41 |
httpd_conffile=`$APXS -q exp_sysconfdir`/`$APXS -q progname`.conf |
42 |
|
43 |
exp_ftpdocsdir=`$APXS -q exp_datadir`/ftpdocs |
44 |
FTPPORT=21 |
45 |
|
46 |
if test -z "$AWK"; then |
47 |
AWK=`$APXS -q AWK` |
48 |
fi |
49 |
|
50 |
for i in Makefile build/Makefile modules/ftp/Makefile modules/ftp/modules.mk; do |
51 |
l_r=`echo $i|sed -e "s#/*[^/]*\\\$##;s#^\(..*\)\\\$#/\1#"` |
52 |
sed -e "s#^\(exp_installbuilddir\)=.*#\1=$exp_installbuilddir#;" \ |
53 |
-e "s#^\(include\) \$(exp_installbuilddir)#\1 $exp_installbuilddir#;" \ |
54 |
-e "s#^\(top_builddir\)=.*#\1=$top_installbuilddir#;" \ |
55 |
-e "s#^\(top_srcdir\)=.*#\1=$top_installbuilddir#;" \ |
56 |
-e "s#^\(ftp_srcdir\)=.*#\1=$srcdir#;" \ |
57 |
-e "s#^\(ftp_builddir\)=.*#\1=$builddir#;" \ |
58 |
-e "s#^\(srcdir\)=.*#\1=$srcdir$l_r#;" \ |
59 |
-e "s#^\(builddir\)=.*#\1=$builddir$l_r#;" \ |
60 |
-e "s#^\(rel_libexecdir\)=.*#\1=$rel_libexecdir#;" \ |
61 |
-e "s#^\(rel_sysconfdir\)=.*#\1=$rel_sysconfdir#;" \ |
62 |
-e "s#^\(rel_logfiledir\)=.*#\1=$rel_logfiledir#;" \ |
63 |
-e "s#^\(httpd_conffile\)=.*#\1=$httpd_conffile#;" \ |
64 |
-e "s#^\(exp_ftpdocsdir\)=.*#\1=$exp_ftpdocsdir#;" \ |
65 |
-e "s#^\(FTPPORT\)=.*#\1=$FTPPORT#;" \ |
66 |
-e "s#^\(awk\)=.*#\1=$AWK#;" \ |
67 |
< $i.apxs > $i |
68 |
done |
69 |
|
70 |
touch .deps |
71 |
touch build/.deps |
72 |
touch modules/ftp/.deps |
73 |
|
74 |
cd build |
75 |
found_features="" |
76 |
echo "Detecting features" |
77 |
echo "Detecting features" > ../config.apxs.log |
78 |
|
79 |
if make local-clean conftest_fchmod >>../config.apxs.log 2>&1; then |
80 |
found_features="$found_features \ |
81 |
-e \"s/^#undef \(HAVE_FCHMOD\)[ \t]*/#define \1 1/;\"" |
82 |
fi |
83 |
|
84 |
if make local-clean conftest_arpa_ftp_h >>../config.apxs.log 2>&1; then |
85 |
found_features="$found_features \ |
86 |
-e \"s/^#undef \(HAVE_ARPA_FTP_H\)[ \t]*/#define \1 1/;\"" |
87 |
fi |
88 |
|
89 |
if make local-clean conftest_netinet_ip_h >>../config.apxs.log 2>&1; then |
90 |
found_features="$found_features \ |
91 |
-e \"s/^#undef \(HAVE_NETINET_IP_H\)[ \t]*/#define \1 1/;\"" |
92 |
|
93 |
if make local-clean conftest_SOL_IP >>../config.apxs.log 2>&1; then |
94 |
found_features="$found_features \ |
95 |
-e \"s/^#undef \(HAVE_SOL_IP\)[ \t]*/#define \1 1/;\"" |
96 |
fi |
97 |
fi |
98 |
|
99 |
if make local-clean conftest_sys_stat_h >>../config.apxs.log 2>&1; then |
100 |
found_features="$found_features \ |
101 |
-e \"s/^#undef \(HAVE_SYS_STAT_H\)[ \t]*/#define \1 1/;\"" |
102 |
fi |
103 |
|
104 |
if make conftest_struct_msghdr_msg_control >>../config.apxs.log 2>&1; then |
105 |
found_features="$found_features \ |
106 |
-e \"s/^#undef \(HAVE_STRUCT_MSGHDR_MSG_CONTROL\)[ \t]*/#define \1 1/;\"" |
107 |
fi |
108 |
|
109 |
if make conftest_struct_msghdr_msg_accrights >>../config.apxs.log 2>&1; then |
110 |
found_features="$found_features \ |
111 |
-e \"s/^#undef \(HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS\)[ \t]*/#define \1 1/;\"" |
112 |
fi |
113 |
|
114 |
make local-distclean >>../config.apxs.log 2>&1 |
115 |
cd .. |
116 |
|
117 |
if test "x$found_features" = "x"; then |
118 |
cp modules/ftp/ftp_config.h.in modules/ftp/ftp_config.h |
119 |
else |
120 |
eval sed "$found_features" < modules/ftp/ftp_config.h.in \ |
121 |
> modules/ftp/ftp_config.h |
122 |
fi |
123 |
|
124 |
echo "" |
125 |
echo "Finished, run 'make' to compile mod_ftp" |
126 |
echo "" |
127 |
echo "Run 'make FTPPORT=8021 install' to install mod_ftp" |
128 |
echo "(The default FTPPORT is $FTPPORT if not specified)" |
129 |
echo "" |
130 |
echo "The manual pages ftp/index.html and mod/mod_ftp.html" |
131 |
echo "will be installed to help get you started." |
132 |
echo |
133 |
echo "The conf/extra/ftpd.conf will be installed as an example" |
134 |
echo "for you to work from. In your configuration file," |
135 |
echo " `$APXS -q exp_sysconfdir`/`$APXS -q progname`.conf" |
136 |
echo "uncomment the line '#Include conf/extra/ftpd.conf'" |
137 |
echo "to activate this example mod_ftp configuration." |
138 |
|