# configure.in file for Apache Jserv -*-sh-*-
# Copyright (c) 1997-1998 The Java Apache Project. All rights reserved.    
# Author:  Tommy Reilly <tpr@neog.com>
# $Id: configure.in,v 1.92 2000/06/17 19:00:39 jstoor Exp $

AC_REVISION($Id: configure.in,v 1.92 2000/06/17 19:00:39 jstoor Exp $)dnl

BOOTFILE=./configure-options

if test -f "${BOOTFILE}" && test -z "${IN_BOOT}" ; then
    echo "Reading options from ${BOOTFILE}"
    IN_BOOT=1 $0 `cat ${BOOTFILE}` $*
    exit $?
fi

# AC_INIT just needs a file in the dist to make sure its in
# the right place and to process command-line arguments
AC_INIT(src/c/mod_jserv.c)

# Use config subdir to keep toplevel dir clean
AC_CONFIG_AUX_DIR(src/scripts/build/unix)

# Use config.h to hold information needed by the c code
# Also tell it to use config.hin instead of default (config.h.in)
# This is in case anyone wants to do a win32 port using gnuwin32
#AM_CONFIG_HEADER(config.h:config.hin)

PACKAGE=ApacheJServ
VERSION=1.1.2

AC_SUBST(PACKAGE)
AC_SUBST(VERSION)

AC_MSG_RESULT([Configuring ${PACKAGE}/${VERSION}])

AM_INIT_AUTOMAKE(${PACKAGE}, ${VERSION})

# We don't need static libs
AM_DISABLE_STATIC
AM_PROG_LIBTOOL

AC_PREFIX_DEFAULT(/usr/local/jserv)

dnl Let's try to restrict the autoconf to at least 2.13
AC_PREREQ(2.13)dnl

dnl required if SUBDIRS is used
AC_PROG_MAKE_SET

AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_CC

# The things below might be a little bit overkill, but better that than
# failing with no obvious reason...

AC_PATH_PROG(ECHO,echo,echo,$PATH)dnl
AC_PATH_PROG(FIND,find,$PATH)dnl
AC_PATH_PROG(SED,sed,$PATH)dnl
AC_PATH_PROG(TEST,test,$PATH)dnl
AC_PATH_PROG(RM,rm,$PATH)dnl
AC_PATH_PROG(HEAD,head,$PATH)dnl
AC_PATH_PROG(TR,tr,$PATH)dnl
AC_PATH_PROG(GREP,grep,$PATH)dnl
AC_PATH_PROG(CUT,cut,$PATH)dnl
AC_PATH_PROG(TOUCH,touch,$PATH)dnl
AC_PATH_PROG(CAT,cat,$PATH)dnl
AC_PATH_PROG(CP,cp,$PATH)dnl
AC_PATH_PROG(MAKE,make,$PATH)dnl
AC_PATH_PROG(CHMOD,chmod,$PATH)dnl

# Check to make sure that we have GNU make
CHECK_GNU_MAKE()

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_MODE_T
AC_HEADER_TIME
AC_STRUCT_TM

# Checks for library functions.
AC_HEADER_STDC
AC_CHECK_FUNCS(gettimeofday)

# Since most people won't have JavaDeps to compute dependencies
# on the Java source files.
AC_ARG_ENABLE(maintainer-build,
[  --enable-maintainer-build    turn on java dependency computation],
[
case "${enableval}" in 
  y | yes) maintainer_debug=true ;;
  n | no)  maintainer_debug=false ;;
  *) AC_MSG_ERROR(bad value ${enableval} for --enable-maintainer-build) ;;
esac
],
[maintainer_debug=false])

AM_CONDITIONAL(MAINTAINER_BUILD, ${TEST} "${maintainer_debug}" = "true")

# allow use of compressed jar file
AC_ARG_ENABLE(compressed-jar,
[  --enable-compressed-jar allows generation of a zipped jar file [default=no]],
[
case "${enableval}" in 
    y | yes) compress_jar=true ;;
    n | no) compress_jar=false ;;
    *) AC_MSG_ERROR(bad value ${enableval} for --enable-compressed-jar) ;;
esac
],
[compress_jar=false])

# VT: FIXME: This is not handled properly yet

AM_CONDITIONAL(COMPRESS_JAR, ${TEST} "${compress_jar}" = "true")

# allow use of -g in java compilation
AC_ARG_ENABLE(debugging,
[  --enable-debugging      includes -g in java compilation],
[
    case "${enableval}" in 
        y | yes) debugging=true ;;
        n | no) debugging=false ;;
        *) AC_MSG_ERROR(bad value ${enableval} for --enable-debugging) ;;
    esac
],
[
    debugging=true
])

if ${TEST} "${debugging}" = "true" ; then
    JAVACX_OPT="-g -deprecation"
    TURBO='false'
else
    JAVACX_OPT="-O"
    TURBO='true'
fi

AC_SUBST(JAVACX_OPT)
AC_SUBST(TURBO)

AM_CONDITIONAL(DEBUGGING, ${TEST} "${debugging}" = "true")


# VT: A lot of stuff changed here. For some strange reason, the former
# implementation was looking for the same stuff in umpteen different places,
# and since I'm no guru, I had to make some assumptions.
#
# So, here are the assumptions:
#
# 1. If apxs is present, the Apache version is 1.3 and I don't care for
#    anything (because apxs can give it to me) except for the source
#    directory (static build). 
#
# 2. If apxs is not present, it can be unreachable (as on my box with Apache
#    installation directory permissions paranoidally set to (apache:apache,
#    700) or not exist at all. I assume my duty is to politely ask the user
#    if he can find apxs, and specify it then (but still go on in case this
#    is Apache 1.2 (see previous assumption)).
#
# 3. I prefer the information obtained from apxs to anything else.
#
# 4. These are the Apache things I want from apxs (or the user, for that
#    matter):
#
#    - Source directory (for static build)
#    - Installation directory (for shared build)
#    - Include directory (to compile the stuff)

# VT: Does --with-apache-src imply --enable-apache-conf? I guess yes, so I
# kill the --enable-apache-conf so far. There's a slight doubt that it can
# be used for just includes, but what's the point?
#
# VT: I take it as --with-apache-src means static build, otherwise shared.
# So you will have to explicitly specify --with-apache-src, otherwise it
# will try to build the shared version using apxs if found, otherwise bail
# out.

# get --with-apache-src arguments
AC_ARG_WITH(apache-src,
[  --with-apache-src=DIR   tells configure where to look for 
                          the Apache source distribution (1.2, 1.3 STATIC build)],
[
    AC_MSG_CHECKING([for Apache source directory (assume static build)])

    if ${TEST} -n "${withval}" && ${TEST} -d "${withval}" && ${TEST} -d "${withval}/src" ; then
        # handle the case where people use relative paths to 
        # the apache source directory by pre-pending the current
        # build directory to the path. there are probably 
        # errors with this if configure is run while in a 
        # different directory than what you are in at the time
        if ${TEST} -n "`${ECHO} ${withval}|${GREP} \"^\.\.\"`" ; then
            withval=`pwd`/${withval}
        fi

        apache_dir=${withval}
        apache_dir_is_src=true
        AC_MSG_RESULT(${apache_dir})
        
        AC_MSG_CHECKING(for Apache include directory)

        if ${TEST} -d "${withval}/src/include" ; then
            # read osdir from the existing apache.
            osdir=`${GREP} '^OSDIR=' ${withval}/src/Makefile.config | ${SED} -e 's:^OSDIR=.*/os:os:'`
            if ${TEST} -z "${osdir}" ; then
                osdir=os/unix
            fi
            apache_include="-I${withval}/src/include \
                -I${withval}/src/${osdir}"
            AC_MSG_RESULT([${apache_include}, version 1.3])
        else
            AC_MSG_ERROR([Sorry Apache 1.2.x is no longer supported.])
        fi
    else
        AC_MSG_ERROR([Directory $apache_dir is not a valid Apache source distribution])
    fi

# VT: Now, which one I'm supposed to use? Let's figure it out later

    configure_apache=true
    configure_src=true
    
],
[
    # User did not specify --with-apache-src so, we check for apxs
    AC_MSG_RESULT(WARNING: --with-apache-src is undefined: assuming shared object build)

    AC_MSG_CHECKING(for apxs)

    AC_ARG_WITH(apxs,
    [  --with-apxs=APXS-UTIL   tells configure where to look
                          for the Apache apxs utility (for 1.3 DSO build)],
    [
        # we test for it actually being valid below...
        APXS_CMD="${withval}"
    ],
    [
        dnl Too bad, will have to guess the location
        
        for APXS_GUESS in \
            /usr/local/apache/sbin \
            /usr/local/apache/bin \
            /usr/local/sbin \
            /usr/sbin \
            /usr/bin
        do
            if ${TEST} -x ${APXS_GUESS}/apxs ; then
                APXS_CMD=${APXS_GUESS}/apxs
                break
            fi
        done
    ])    

    if ${TEST} -n "${APXS_CMD}" ; then

        AC_MSG_RESULT([need to check for Perl first, apxs depends on it...])
        AC_PATH_PROG(PERL,perl,$PATH)dnl

        dnl Seems that we have it, but have to check if it is OK first
        
        if ${TEST} ! -x "${APXS_CMD}" ; then

            AC_MSG_ERROR(Invalid location for apxs: '${APXS_CMD}')
        fi
        
        $APXS_CMD -q PREFIX >/dev/null 2>/dev/null || apxs_support=false

        if ${TEST} "${apxs_support}" = "false" ; then
            AC_MSG_RESULT(could not find apxs)
            AC_MSG_ERROR(If you do not specify a valid --with-apache-src directory\n                  then you must specify a valid --with-apxs path)
        else
            APXS=$APXS_CMD
            AC_SUBST(APXS)
            AC_MSG_RESULT([${APXS}, assume Apache 1.3 with DSO support])
        fi
    else
        AC_MSG_ERROR(not found)
    fi

    configure_apache=false
    configure_src=false
    apache_dir_is_src=false
    
    # VT: At this point, I'm perfectly sure that I have ${APXS} properly
    # set, or not, so I can forget about trying to figure out where it is

    AC_MSG_CHECKING([for Apache installation directory (assume shared build)])
    apache_dir=`$APXS -q PREFIX`
    AC_MSG_RESULT(${apache_dir})

    AC_MSG_CHECKING(for Apache include directory)
    apache_include="`$APXS -q INCLUDEDIR`"
    AC_MSG_RESULT(${apache_include})
   
    AC_MSG_CHECKING(for Apache configuration directory)
    sysconfdir=`$APXS -q SYSCONFDIR`/jserv
    AC_MSG_RESULT(${sysconfdir})

    AC_MSG_CHECKING(for Apache library directory)
    libexecdir=`$APXS -q LIBEXECDIR`
    AC_MSG_RESULT(${libexecdir})

    # Add a test to check for a broken RH 6.1 RPM installation.
    # apxs incorrectly returns "modules" instead of the right path.
    if ${TEST} "${libexecdir}" = "modules" ; then
        AC_MSG_ERROR([You have a broken RedHat Apache RPM. Please 
        download the latest Apache source distribution from 
        www.apache.org and build using that.])
    fi

    AC_MSG_CHECKING(for Apache layout consistency)
   
    for testdir in ${apache_dir} ${apache_include} ${libexecdir} ${sysconfigdir} ; do
        if ${TEST} ! -d ${testdir} ; then
            AC_MSG_ERROR(${testdir} doesn't exist, not readable or not a directory)
        fi
    done
  
    # Now, I'm safe, all the directories exist (should I have
    # checked them for readability?)

    # preprocessor option for include
    apache_include="-I${apache_include}"

    AC_MSG_RESULT(verified)
])

AC_ARG_WITH(logdir,
[  --with-logdir=DIR       where to put the Apache JServ logs ],
[
    JSERV_LOG=${withval}
],
[
    if ${TEST} -n ${apache_dir} && ${TEST} "${apache_dir_is_src}" = "true" ; then
	JSERV_LOG="${prefix}/logs"
    else
	JSERV_LOG="${apache_dir}/logs"
    fi
])

AC_ARG_WITH(servlets,
[  --with-servlets=DIR     the directory your servlets reside ],
[
    JSERV_REPO=${withval}
],
[
    if ${TEST} -n ${apache_dir} && ${TEST} "${apache_dir_is_src}" = "true" ; then
	JSERV_REPO="${prefix}/servlets"
    else
	JSERV_REPO="${apache_dir}/servlets"
    fi
])


# VT: This is absolutely pointless, if I get it right. If we *were* able to
# find apxs, then it's already solved. If not, make the user specify the
# apxs location. If there's no apxs, we can't make the DSO build anyway,
# right?

AC_ARG_WITH(apache-install,
[  --with-apache-install=DIR   Obsolete.  This was used to specifiy
                          the Apache installation directory for 1.3 DSO build;
                          use --with-apxs now.],
[
    if ${TEST} "${configure_src}" = "true" ; then
    
        AC_MSG_ERROR(Ambiguous: can't do --with-apache-src and --with-apache-install at the same time)
    fi
    
    AC_MSG_ERROR([--with-apache-install=DIR is obsolete, use --with-apxs=<apxs-binary-location> instead])
])


# whether or not to test Apache configuration
AC_ARG_ENABLE(apache-config,
[  --enable-apache-config  whether or not to perform Apache\n                          configuration [default=yes]],
[
    case "${enableval}" in 
        y | yes | true) configure_apache=true ;;
        n | no | false) configure_apache=false ;;
        *) AC_MSG_ERROR(bad value ${enableval} for --enable-apache-config) ;;
    esac
],
[
    if ${TEST} "${apxs_support}" = "true" ; then
        configure_apache=false
    else
        configure_apache=true
    fi
])


AC_ARG_WITH(jsdk,
[  --with-jsdk=DIR/JAR     please use --with-JSDK instead],
[
    AC_MSG_ERROR(Please use --with-JSDK instead of --with-jsdk)
])

dnl Define the TARGET_CLASSPATH
TARGET_CLASSPATH="`cd ${srcdir} && pwd`/src/java"

AC_PROG_JAVATOOL(JAVA,java,[    Java runtime])
AC_PROG_JAVATOOL(JAVAC,javac,[   Java compiler])
AC_PROG_JAVATOOL(JAVADOC,javadoc,[ Java documentation compiler],
[You will not be able to create the Javadoc documentation])
AC_PROG_JAVATOOL(JAR,jar,[     Java Archiver])

AC_PATH_JAVACLASS(JSDK,JSDK2.0,javax.servlet.Servlet,[    Where to find the JSDK 2.0 classes])

# VT: Make all the alterations to the classpath here
AC_PATH_EXTRA(JSDK)

AC_ARG_ENABLE(overview,
[  --enable-overview       enables the overview option for javadoc, using the
                          package.html as an overview file.],
[
AC_MSG_CHECKING(overview)

case "${enableval}" in
    y | yes)
        if ${TEST} "${JAVA_PLATFORM}" != "2" ; then
            AC_MSG_RESULT(Overview enabled with non-1.2 JVM - expect problems making javadoc)
        else
            AC_MSG_RESULT(enabled)
            OVERVIEW="-overview package.html"
        fi
        ;;
    n | no)
        AC_MSG_RESULT(disabled) 
        OVERVIEW="" 
        ;;
esac
AC_SUBST(OVERVIEW)
],
[
AC_MSG_CHECKING(overview)

if ${TEST} "${JAVA_PLATFORM}" = "2" ; then
    AC_MSG_RESULT(enabled)
    OVERVIEW="-overview package.html"
else
    AC_MSG_RESULT(disabled)
    OVERVIEW=""
fi
AC_SUBST(OVERVIEW)
])

dnl Check if the JAR signature was requested, and the alias of the signer.

AC_ARG_WITH(signature,
[  --with-signature[=alias] sign the JAR archive with the given alias
                          (logged user is default).],
[

if ${TEST} "${JAVA_PLATFORM}" != "2" ; then 
    AC_MSG_ERROR(--with-signature is not supported with JDK other than 1.2)
fi

AC_PROG_JAVATOOL(JARSIGNER,jarsigner,[JAR file signer])
AC_MSG_CHECKING(signer identity)

case "$withval" in 

    YES | yes | TRUE | true )
        JAR_SIGNER=`whoami`
        AC_MSG_RESULT([${JAR_SIGNER} (default)])
        ;;
        
    *)
        JAR_SIGNER=$withval
        AC_MSG_RESULT($withval)
        ;;
esac

AC_SUBST(JAR_SIGNER)
])

# support for EAPI
AC_ARG_ENABLE(
EAPI,
[  --enable-EAPI           Enable EAPI support (mod_ssl)],
[
case "${enableval}" in
    y | Y | YES | yes | TRUE | true )
	CFLAGS="${CFLAGS} -DEAPI"
	AC_MSG_RESULT([...Enabling EAPI Support...])
        ;;
esac
])
AC_SUBST(CFLAGS)

# need this below to get back after configuring Apache
jserv_dir=`pwd`

if ${TEST} "${prefix}" = "NONE" ; then
    prefix="$ac_default_prefix"
fi
if ${TEST} "${exec_prefix}" = "NONE" ; then
    exec_prefix="${prefix}"
fi

# properly expand and resolve these variables
LIBEXECDIR=`eval echo "${libexecdir}"`
SYSCONFDIR=`eval echo "${sysconfdir}"`

APACHE_DIR=${apache_dir}
JSERV_CLASSES=${LIBEXECDIR}/${PACKAGE}.jar

JSERV_CONF="${SYSCONFDIR}"


JSERV_DIR=$jserv_dir
AC_SUBST(JSERV_DIR)
AC_SUBST(JSERV_CLASSES)
AC_SUBST(JSERV_CONF)
AC_SUBST(JSERV_LOG)
AC_SUBST(JSERV_REPO)
AC_SUBST(APACHE_DIR)
AC_SUBST(LIBEXECDIR)
AC_SUBST(SYSCONFDIR)

EXAMPLE_DIR=$jserv_dir/example
AC_SUBST(EXAMPLE_DIR)

CPPFLAGS="${CPPFLAGS} ${apache_include}"

AM_CONDITIONAL(MAKE_LIBJSERV, ${TEST} "${apache_dir_is_src}" = "false")

if ${TEST} -n ${apache_dir} ; then
# now that we have include dir check for these
AC_CHECK_HEADERS([httpd.h http_config.h http_core.h http_log.h http_main.h http_protocol.h util_script.h util_md5.h os-inline.c], 
[
# do nothing if they are all found
],
[
AC_MSG_ERROR([Could not locate one or more of the necessary Apache header files.
    Please check that you have passed the correct location for the Apache
    directory.  Note that you must run either Apache's 'Configure' or
    'configure' program at least once if you have never compiled Apache before;
    this generates certain necessary headers files based on your platform.])
])
fi

#
# configure sources.
#
if ${TEST} -n "${apache_dir}" && ${TEST} "${apache_dir_is_src}" = "true" ; then


    if ${TEST} ! -d "${apache_dir}/src/modules/jserv" ; then
        echo ""
        $ac_aux_dir/mkinstalldirs ${apache_dir}/src/modules/jserv
        echo ""
    fi
    
    if ${TEST} "${configure_apache}" = "true" ; then
        cd ${apache_dir}
        AC_MSG_CHECKING(running of Apache Configuration)
        echo ""
        
        if ${TEST} ! -x "${apache_dir}/config.status" ; then
            conf_cmd="./configure --activate-module=src/modules/jserv/libjserv.a"
        elif (cd $apache_dir && ${GREP} mod_jserv config.status) ; then
            conf_cmd="./config.status"
        else
            conf_cmd="./config.status --activate-module=src/modules/jserv/libjserv.a"
        fi

        echo ""
        echo $conf_cmd
        $conf_cmd || AC_MSG_ERROR(Apache configure failed)
        echo ""
        AC_MSG_RESULT(Apache configuration successful)
        echo ""
        cd ${jserv_dir}
    fi
fi

# see example/jserv.conf for what this does
if ${TEST} "${apache_dir_is_src}" = "true" ; then
    LOAD_OR_NOT="#"
else
    LOAD_OR_NOT=""
fi

AC_SUBST(LOAD_OR_NOT)
AC_SUBST(TARGET_CLASSPATH)

echo ""
echo "Creating Apache JServ configuration files..."
echo ""

AC_OUTPUT(
Makefile 
conf/Makefile
conf/jserv.conf
conf/jserv.properties
conf/zone.properties
conf/save-install.sh
docs/Makefile
docs/api/Makefile
example/Makefile
example/jserv.conf
example/example.properties
example/Hello.java
example/jserv.properties
src/Makefile 
src/java/Makefile
src/java/org/apache/java/io/Makefile
src/java/org/apache/java/lang/Makefile
src/java/org/apache/java/net/Makefile
src/java/org/apache/java/recycle/pool/Makefile
src/java/org/apache/java/recycle/Makefile
src/java/org/apache/java/security/Makefile
src/java/org/apache/java/util/Makefile
src/java/org/apache/java/Makefile
src/java/org/apache/jserv/Makefile
src/java/org/apache/Makefile
src/java/org/Makefile
src/c/Makefile
src/c/jserv.h
src/java/org/apache/jserv/JServDefs.java
src/scripts/package/tar.gz/snap.sh
)

${CHMOD} u+x conf/save-install.sh

# not needed for now
#src/java/org/apache/jserv/comm/http/Makefile
#src/java/org/apache/jserv/comm/standard/Makefile
#src/java/org/apache/jserv/comm/ajp12/Makefile
#src/java/org/apache/jserv/comm/Makefile
#src/java/org/apache/jserv/engine/servlet/Makefile
#src/java/org/apache/jserv/engine/standard/Makefile
#src/java/org/apache/jserv/engine/valve/Makefile
#src/java/org/apache/jserv/engine/Makefile
#src/java/org/apache/jserv/session/standard/Makefile
#src/java/org/apache/jserv/session/swapping/Makefile
#src/java/org/apache/jserv/session/Makefile
#src/java/org/apache/servlet/Makefile


echo ""
echo "Apache JServ configuration complete..."
echo ""

if ${TEST} -n ${apache_dir} ; then
    if ${TEST} "${apache_dir_is_src}" = "true" ; then
        echo "Apache Source Directory: ${apache_dir}"
        echo ""
        echo "Module Type: static (mod_jserv will be statically compiled into server)"
    else
        echo "Apache Installed Directory: ${apache_dir}"
        echo ""
        echo "Module Type: dynamic (DSO will be used to link mod_jserv into server dynamically)"
    fi
    echo ""
    echo "Apache include flags:"
    echo "  ${apache_include}"
    echo ""
    echo "Default configuration files will be installed in:"
    echo "  ${JSERV_CONF}"
    echo ""
    echo "Default log files will be created in:"
    echo "  ${JSERV_LOG}"
    echo ""
    echo "Default servlets will be installed in:"
    echo "  ${JSERV_REPO}"
    echo ""
    echo "ApacheJServ.jar file will be installed in:"
    echo "  ${JSERV_CLASSES}"
    echo ""
    echo "Documentation will be installed in:"
    echo "  ${prefix}/docs"
    echo ""
    echo "Build classpath is:"
    echo "  ${TARGET_CLASSPATH}"

    echo ""
    if ${TEST} ! -f ${BOOTFILE} ; then
        echo "You might consider putting frequently used options into "
        echo "${BOOTFILE}, one per line."
    else
        echo "The following options were specified in "
        echo "   ${BOOTFILE}"
        echo ""
        cat ${BOOTFILE}
    fi

    echo ""
    echo "+-STEP 1-------------------------------------------------------+"
    echo "|Run 'make; make install' to make a .jar file, compile the C   |" 
    echo "|code and copy the appropriate files to the appropriate        |"
    echo "|locations.                                                    |"
    echo "+--------------------------------------------------------------+"
    echo ""
    if ${TEST} "${apache_dir_is_src}" = "true" ; then
        echo "+-STEP 2-------------------------------------------------------+"
        if ${TEST} "${configure_apache}" = "true" ; then
            echo "|Then cd ${apache_dir} and run 'make; make install'.           |"
        else
            echo "|Then cd ${apache_dir} and run configure:"
            echo "|                                                              |"
            echo "|./config.status --activate-module=src/modules/jserv/libjserv.a|"
            echo "|                                                              |"
            echo "|Then run 'make; make install' in order to build the C portion |"
            echo "|of Apache JServ into your Apache server.                      |"
        fi
        echo "+--------------------------------------------------------------+"
        echo ""
        echo "+-STEP 3-------------------------------------------------------+"
    else
        echo "+-STEP 2-------------------------------------------------------+"
    fi
    echo "|Put this line somewhere in Apache's httpd.conf file:          |"
    echo "|Include ${JSERV_CONF}/jserv.conf"
    echo "|                                                              |"
    echo "|Then start Apache and try visiting the URL:                   |"
    echo "|http://`hostname`:SERVER_PORT/servlets/Hello"
    echo "|                                                              |"
    echo "|If that works then you have successfully setup Apache JServ.  |"
    echo "|                                                              |"
    echo "|If that does not work then you should read the                |"
    echo "|troubleshooting notes referenced below.                       |"
    echo "+--------------------------------------------------------------+"
fi

echo ""
echo "+-Troubleshooting----------------------------------------------+"
echo "|Html documentation is available in the docs directory.        |"
echo "|                                                              |"
echo "|Common Errors:                                                |"
echo "|    Make sure that the log files can be written to by the     |"
echo "|    user your httpd is running as (ie: nobody). If there are  |"
echo "|    errors in your configuration, they will be logged there.  |"
echo "|                                                              |"
echo "|Frequently asked questions are answered in the FAQ-O-Matic:   |"
echo "|                                                              |"
echo "|           http://java.apache.org/faq/                        |"
echo "+--------------------------------------------------------------+"
