#!/bin/sh set +x help ( ) { echo "configure commands available:" echo "" echo "--help displays this page" echo "--prefix=PREFIX use PREFIX as install directory" echo "--srcdir=SRCPREFIX use SRCPREFIX as src directory" echo "--with-tcl=[DIR] the directory where tclConfig.sh is located" echo "--with-tclx=[DIR] the directory where tclxConfig.sh is located" echo "--with-neo=[DIR] the directory where neoConfig.sh is located" echo "--enable-shared=[yes] build with shared objects" echo "--enable-gd=[yes] enable building of GD Image support" echo "--enable-postgres=[no] enable building of Postgres support" echo "--enable-include=[no] allow for NWS code and mod_include code" echo " to be executed in the same document." echo " Replaces mod_neoscript with mod_neo_include" echo " as the primary code module." echo "--enable-module=[MODULE] build and load MODULE with NeoWebScript" echo "--enable-include=[no] To allow for NWS code and mod_include" echo " code to be executed in the same document." echo " REPLACES mod_neoscript with mod_neo_include" echo " as the primary code module." echo "MODULES:" echo " [auth_tcl] Tcl Authorization module" echo " [log_neo] NeoWebScript specific logging format" echo " [neo_userdir] Modification of mod_userdir" echo exit 0 } . ../.versions default_prefix="" src_prefix=../neotcl${NEOTCL_VERSION} TCLCONFIGDIR=$src_prefix/tcl${NWS_TCL_VERSION}/unix TCLXCONFIGDIR=$src_prefix/tclX${NWS_TCLX_VERSION}/tcl/unix NEOCONFIGDIR=$src_prefix/neo${NWS_NEO_VERSION}/generic shared=yes gd=yes pg=no for i in $@ do case $i in --help) help ;; --prefix=*) default_prefix=`echo $i | sed -e 's/^[^=]*=//g'` ;; --srcdir=*) src_prefix=`echo $i | sed -e 's/^[^=]*=//g'` ;; --enable-shared) shared=yes ;; --enable-shared=*) shared=`echo $i | sed -e 's/^[^=]*=//g'` ;; --enable-gd) gd=yes ;; --enable-gd=*) gd=`echo $i | sed -e 's/^[^=]*=//g'` ;; --enable-postgres) pg=yes ;; --enable-postgres=*) pg=`echo $i | sed -e 's/^[^=]*=//g'` ;; --enable-include) INCLUDE=yes ;; --enable-include=*) INCLUDE=`echo $i | sed -e 's/^[^=]*=//g'` ;; --with-tcl=*) TCLCONFIGDIR=`echo $i | sed -e 's/^[^=]*=//g'` ;; --with-tclx=*) TCLXCONFIGDIR=`echo $i | sed -e 's/^[^=]*=//g'` ;; --with-neo=*) NEOCONFIGDIR=`echo $i | sed -e 's/^[^=]*=//g'` ;; --enable-module=*) mod="`echo $i | sed -e 's/^[^=]*=//g'`" case $mod in neoscript) ;; auth_tcl) MODULES="${MODULES} $mod" ;; log_neo) MODULES="${MODULES} $mod" ;; neo_userdir) MODULES="${MODULES} $mod" ;; *) echo "Bad module name '$mod'" ; exit 1 ;; esac ;; *) echo "Invalid configure option $i" ; help ; exit 1 ;; esac done if [ "$INCLUDE" = "yes" -o "$INCLUDE" = "YES" ]; then MAINMOD=mod_neo_include else MAINMOD=mod_neoscript fi ALL="all: ${MAINMOD}" INSTALL="install: install-${MAINMOD}" for i in $MODULES do echo "Enabling ${i} module" ALL="${ALL} mod_${i}" INSTALL="${INSTALL} install-mod_${i}" done if [ "$gd" = "yes" -o "$gd" = "YES" ] then EXTRA_LIB_SPEC="$EXTRA_LIB_SPEC -DGDTCL -l gd1.2" fi if [ "$pg" = "yes" -o "$pg" = "YES" ] then EXTRA_LIB_SPEC="$EXTRA_LIB_SPEC -DPOSTGRESQL" fi if [ "$default_prefix" != "" ] then TCLCFGFILE=$TCLCONFIGDIR/tclConfig.sh TCLXCFGFILE=$TCLXCONFIGDIR/tclxConfig.sh NEOCFGFILE=$NEOCONFIGDIR/neoConfig.sh ap_base=$default_prefix apxs_loc=$ap_base/bin/apxs db_lib_spec=$default_prefix/lib/libdb.a if [ $shared = "yes" ] then db_lib_spec="-l db" fi if [ ! -f $TCLCFGFILE ] then echo "Could not find tclConfig.sh in $TCLCONFIGDIR." echo "Tcl was not configured properly." exit 1 fi . $TCLCFGFILE if [ ! -f $TCLXCFGFILE ] then echo "Could not find tclxConfig.sh in $TCLXCONFIGDIR." echo "TclX was not configured properly." exit 1 fi . $TCLXCFGFILE if [ ! -f $NEOCFGFILE ] then echo "Could not find neoConfig.sh in $NEOCONFIGDIR." echo "NeoTcl was not configured properly." exit 1 fi . $NEOCFGFILE tcl_lib_spec=`echo $TCL_LIB_SPEC | sed -e 's/-L/-L /g;s/-l/-l /g'` tcl_lib_spec=`eval echo $tcl_lib_spec` tclx_lib_spec=`echo $TCLX_LIB_SPEC | sed -e 's/-L //g'` tclx_lib_spec=`echo $tclx_lib_spec | sed -e 's/-L/-L /g;s/-l/-l /g'` tclx_lib_spec=`eval echo $tclx_lib_spec` tcl_libs=`echo $TCL_LIBS | sed -e 's/-L/-L /g;s/-l/-l /g'` tcl_libs=`eval echo $tcl_libs` tclx_libs=`echo $TCLX_LIBS | sed -e 's/-L/-L /g;s/-l/-l /g'` tclx_libs=`eval echo $tclx_libs` neo_libs=`echo $NEO_LIBS | sed -e 's/-L/-L /g;s/-l/-l /g'` neo_libs=`eval echo $neo_libs` neo_lib_spec=`echo $NEO_LIB_SPEC | sed -e 's/-L/-L /g;s/-l/-l /g'` neo_lib_spec=`eval echo $neo_lib_spec` if [ "$TCL_LIB_VERSIONS_OK" = "nodots" ] then gd_lib_spec=`echo $gd_lib_spec | tr -d .` fi sysconfdir=$ap_base/conf sbindir=$ap_base/bin targetdir=$ap_base #### ## Write this info into the final Makefile #### cat > Makefile << EOF ## ## Makefile ## Constructed with $0 $@ ## APXS=$apxs_loc APBASE=$ap_base TCLDIR=$TCLCONFIGDIR TCLCONFIGSH=\${TCLDIR}/tclConfig.sh TCLXDIR=$TCLXCONFIGDIR TCLXCONFIGSH=\${TCLXDIR}tclConfig.sh DB_LIB_SPEC=$db_lib_spec TCL_LIB_SPEC=$tcl_lib_spec $neo_lib_spec TCLX_LIB_SPEC=$tclx_lib_spec TCL_LIBS=$tcl_libs $neo_libs TCLX_LIBS=$tclx_libs TCL_SHLIB_SUFFIX=$TCL_SHLIB_SUFFIX EXTRA_LIB_SPEC=$EXTRA_LIB_SPEC SYSCONFDIR=$sysconfdir SBINDIR=$sbindir PREFIX=$targetdir MODULE=$MAINMOD BUILDMODULE=\${APXS} -c -I \${TCLDIR}/include -I \${TCLXDIR}/include ${gdtcl} \${TCL_LIB_SPEC} \${TCLX_LIB_SPEC} \${TCL_LIBS} \${TCLX_LIBS} \${DB_LIB_SPEC} \${EXTRA_LIB_SPEC} INSERTMODULE=\${APXS} -i -a ${ALL} ${INSTALL} EOF cat < Makefile.in >> Makefile LD_LIBRARY_PATH=$default_prefix/lib:$LD_LIBRARY_PATH exit 0 fi default_prefix=/usr/local/apache #### ## This script gets some directory locations to use in the Makefile #### # This script writes out a nwsConfig.sh file that sets some environment # variables that give the location of Tcl, Db, etc. echo "Configuring NeoWebScript-3.3 module." default_prefix=/usr/local ap_base="" # try to find Apache for dir in ${default_prefix}/apache* do if [ -d ${dir} ] then ap_base=${dir} cat << EOF I found a version of Apache running in $ap_base. EOF fi break done #ask the user to locate Apache cat << EOF Where is Apache running on your system? [$ap_base] EOF read ans if [ "X${ans}" = "X" ] then if [ "X${ap_base}" = "X" ] then echo "I am sorry, but I must insist that you let us know where Apache is." exit 1 fi else ap_base=${ans} fi if [ ! -d $ap_base ] then cat << EOF The directory $ap_base does not contain Apache. Please check your path. EOF exit 1 fi apxs_loc="" # Look for apxs binary, quit if we cannot find it for f in ${ap_base}/bin/apxs ${ap_base}/sbin/apxs do if [ -x $f ] then apxs_loc=${f} break else cat << EOF The directory $ap_base does not contain the Apache apxs script. Please check your path. EOF exit 1 fi done default_prefix=$ap_base ## We now find Tcl tcl_loc="" if [ -r $default_prefix/lib/tclConfig.sh ] then tcl_loc=$default_prefix cat << EOF I found a version of Tcl in $tcl_loc. EOF fi cat << EOF Where is Tcl installed on your system? [$tcl_loc] EOF read ans if [ "$ans" = "" ] then if [ "$tcl_loc" = "" ] then echo "I am sorry, but I must insist that you let us know where Tcl is installed." exit 1 fi else tcl_loc=$ans fi ## Did they give us a good directory? if [ ! -r $tcl_loc/lib/tclConfig.sh ] then cat << EOF The directory $tcl_loc/lib does not contain tclConfig.sh. Please check your path. EOF exit 1 fi tclConfig_loc="$tcl_loc/lib/tclConfig.sh" ## We look for TclX in the same place first, then ask them if needed tclx_loc="" if [ -r $tcl_loc/lib/tclxConfig.sh ] then tclx_loc=$tcl_loc else cat << EOF Where is TclX installed on your system? [$tclx_loc] EOF read ans if [ "$ans" = "" ] then if [ "$tclx_loc" = "" ] then echo "I am sorry, but I must insist that you let us know where TclX is installed." exit 1 fi else tclx_loc=$ans fi fi ## Did they give us a good directory? if [ ! -r $tclx_loc/lib/tclxConfig.sh ] then cat << EOF The directory $tclx_loc/lib does not contain tclxConfig.sh. Please check your path. EOF exit 1 fi tclxConfig_loc="$tclx_loc/lib/tclxConfig.sh" #### ## We need to find DB now #### db_file="" for f in \ $default_prefix/BerkeleyDB/lib/libdb.a \ $default_prefix/BerkeleyDB/lib/libdb.so \ $default_prefix/lib/libdb.a \ $default_prefix/lib/libdb.so do if [ -r $f ] then db_file=$f echo "I found a version of Berkeley DB in `dirname $f`." break fi done echo "Where is your libdb file for Berkeley DB (libdb.a or libdb.so)?" echo "[$db_file]" read ans if [ "$ans" = "" ] then if [ "$db_file" = "" ] then echo "I am sorry, but I must insist that you let us know where Berkeley DB is installed." exit 1 fi else db_file=$ans fi db_loc=`dirname $db_file` db_loc=`dirname $db_loc` case $db_file in *libdb.a) db_lib_spec=$db_file ;; *libdb.so) db_lib_spec="-L $db_loc -l db" ;; *) echo "$db_file is not a valid libdb file.\nPlease check your path.";exit 1 ;; esac ## Did they give us a good directory (so we can find the file)? if [ ! -r $db_file ] then echo "$db_file is not a valid libdb file.\nPlease check your path." exit 1 fi . $tclConfig_loc tcl_lib_spec=`echo $TCL_LIB_SPEC | sed -e 's/-L/-L /g;s/-l/-l /g'` tcl_lib_spec=`eval echo $tcl_lib_spec` tclx_lib_spec=`echo $TCLX_LIB_SPEC | sed -e 's/-L/-L /g;s/-l/-l /g'` tclx_lib_spec=`eval echo $tclx_lib_spec` tcl_libs=`echo $TCL_LIBS | sed -e 's/-L/-L /g;s/-l/-l /g'` tcl_libs=`eval echo $tcl_libs` tclx_libs=`echo $TCLX_LIBS | sed -e 's/-L/-L /g;s/-l/-l /g'` tclx_libs=`eval echo $tclx_libs` sysconfdir=`$apxs_loc -q SYSCONFDIR` sbindir=`$apxs_loc -q SBINDIR` targetdir=`$apxs_loc -q PREFIX` #### ## Write this info into the final Makefile #### cat > Makefile << EOF ## ## Makefile ## Constructed with $0 $@ ## APXS=$apxs_loc APBASE=$ap_base TCLDIR=$tcl_loc TCLCONFIGSH=$tclConfig_loc TCLXDIR=$tclx_loc TCLXCONFIGSH=$tclxConfig_loc DBDIR=$db_loc DB_LIB_SPEC=$db_lib_spec TCL_LIB_SPEC=$tcl_lib_spec TCLX_LIB_SPEC=$tclx_lib_spec TCL_LIBS=$tcl_libs TCLX_LIBS=$tclx_libs TCL_SHLIB_SUFFIX=$TCL_SHLIB_SUFFIX EXTRA_LIB_SPEC=$gd_lib_spec SYSCONFDIR=$sysconfdir SBINDIR=$sbindir PREFIX=$targetdir MODULE=$MAINMOD BUILDMODULE=\${APXS} -c -I \${TCLDIR}/include -I \${TCLXDIR}/include -I \${DBDIR}/include ${gdtcl} \${TCL_LIB_SPEC} \${TCLX_LIB_SPEC} \${TCL_LIBS} \${TCLX_LIBS} \${DB_LIB_SPEC} \${EXTRA_LIB_SPEC} INSERTMODULE=\${APXS} -i -a ${ALL} ${INSTALL} EOF cat < Makefile.in >> Makefile cat << EOF You may now do a "make" to build the module. Thank you! EOF LD_LIBRARY_PATH=$default_prefix/lib:$LD_LIBRARY_PATH