#!/bin/sh # # configure.apxs --- build configuration script for creating mod_ftp # out of tree using the apxs utility and httpd build toolset # if test "$APXS" = ""; then APXS=`which apxs 2>/dev/null` fi; if test "$APXS" = ""; then echo $0 must be able to find apxs in your path, echo or the environment variable APXS must provide the full path of APXS, echo or you may specify it with: echo echo APXS=/path/to/apxs $0 echo echo configuration failed exit 1 fi echo Configuring mod_ftp for APXS in $APXS # top_builddir and top_srcdir are a misnomers, because build/*.mk # scripts expect them to be the parent of the build directory # they fail to use the $installbuilddir path. exp_installbuilddir=`$APXS -q exp_installbuilddir` top_installbuilddir=`cd $exp_installbuilddir/..; pwd` top_installbuilddir=`echo $exp_installbuilddir | sed -e "s#/[^/]*\\\$##;"` builddir=`pwd` srcdir=$builddir ftp_builddir=$builddir ftp_srcdir=$builddir # prefix is the default @@ServerRoot@@, where libexecdir/sysconfdir may # be relative (if it is not their prefix, the rel_ paths remain unchanged rel_fix_prefix=`$APXS -q prefix` rel_libexecdir=`$APXS -q exp_libexecdir | sed -e "s#^$rel_fix_prefix/##;"` rel_sysconfdir=`$APXS -q exp_sysconfdir | sed -e "s#^$rel_fix_prefix/##;"` rel_logfiledir=`$APXS -q exp_logfiledir | sed -e "s#^$rel_fix_prefix/##;"` httpd_conffile=`$APXS -q exp_sysconfdir`/`$APXS -q progname`.conf exp_ftpdocsdir=`$APXS -q exp_datadir`/ftpdocs FTPPORT=21 if test -z "$AWK"; then AWK=`$APXS -q AWK` fi for i in Makefile build/Makefile modules/ftp/Makefile modules/ftp/modules.mk; do l_r=`echo $i|sed -e "s#/*[^/]*\\\$##;s#^\(..*\)\\\$#/\1#"` sed -e "s#^\(exp_installbuilddir\)=.*#\1=$exp_installbuilddir#;" \ -e "s#^\(include\) \$(exp_installbuilddir)#\1 $exp_installbuilddir#;" \ -e "s#^\(top_builddir\)=.*#\1=$top_installbuilddir#;" \ -e "s#^\(top_srcdir\)=.*#\1=$top_installbuilddir#;" \ -e "s#^\(ftp_srcdir\)=.*#\1=$srcdir#;" \ -e "s#^\(ftp_builddir\)=.*#\1=$builddir#;" \ -e "s#^\(srcdir\)=.*#\1=$srcdir$l_r#;" \ -e "s#^\(builddir\)=.*#\1=$builddir$l_r#;" \ -e "s#^\(rel_libexecdir\)=.*#\1=$rel_libexecdir#;" \ -e "s#^\(rel_sysconfdir\)=.*#\1=$rel_sysconfdir#;" \ -e "s#^\(rel_logfiledir\)=.*#\1=$rel_logfiledir#;" \ -e "s#^\(httpd_conffile\)=.*#\1=$httpd_conffile#;" \ -e "s#^\(exp_ftpdocsdir\)=.*#\1=$exp_ftpdocsdir#;" \ -e "s#^\(FTPPORT\)=.*#\1=$FTPPORT#;" \ -e "s#^\(awk\)=.*#\1=$AWK#;" \ < $i.apxs > $i done touch .deps touch build/.deps touch modules/ftp/.deps cd build found_features="" echo "Detecting features" echo "Detecting features" > ../config.apxs.log if make local-clean conftest_fchmod >>../config.apxs.log 2>&1; then found_features="$found_features \ -e \"s/^#undef \(HAVE_FCHMOD\)[ \t]*/#define \1 1/;\"" fi if make local-clean conftest_arpa_ftp_h >>../config.apxs.log 2>&1; then found_features="$found_features \ -e \"s/^#undef \(HAVE_ARPA_FTP_H\)[ \t]*/#define \1 1/;\"" fi if make local-clean conftest_netinet_ip_h >>../config.apxs.log 2>&1; then found_features="$found_features \ -e \"s/^#undef \(HAVE_NETINET_IP_H\)[ \t]*/#define \1 1/;\"" if make local-clean conftest_SOL_IP >>../config.apxs.log 2>&1; then found_features="$found_features \ -e \"s/^#undef \(HAVE_SOL_IP\)[ \t]*/#define \1 1/;\"" fi fi if make local-clean conftest_sys_stat_h >>../config.apxs.log 2>&1; then found_features="$found_features \ -e \"s/^#undef \(HAVE_SYS_STAT_H\)[ \t]*/#define \1 1/;\"" fi if make conftest_struct_msghdr_msg_control >>../config.apxs.log 2>&1; then found_features="$found_features \ -e \"s/^#undef \(HAVE_STRUCT_MSGHDR_MSG_CONTROL\)[ \t]*/#define \1 1/;\"" fi if make conftest_struct_msghdr_msg_accrights >>../config.apxs.log 2>&1; then found_features="$found_features \ -e \"s/^#undef \(HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS\)[ \t]*/#define \1 1/;\"" fi make local-distclean >>../config.apxs.log 2>&1 cd .. if test "x$found_features" = "x"; then cp modules/ftp/ftp_config.h.in modules/ftp/ftp_config.h else eval sed "$found_features" < modules/ftp/ftp_config.h.in \ > modules/ftp/ftp_config.h fi echo "" echo "Finished, run 'make' to compile mod_ftp" echo "" echo "Run 'make FTPPORT=8021 install' to install mod_ftp" echo "(The default FTPPORT is $FTPPORT if not specified)" echo "" echo "The manual pages ftp/index.html and mod/mod_ftp.html" echo "will be installed to help get you started." echo echo "The conf/extra/ftpd.conf will be installed as an example" echo "for you to work from. In your configuration file," echo " `$APXS -q exp_sysconfdir`/`$APXS -q progname`.conf" echo "uncomment the line '#Include conf/extra/ftpd.conf'" echo "to activate this example mod_ftp configuration."