📄 configure.in
字号:
dnl
dnl Process this file with autoconf to produce a configure script
dnl
AC_REVISION($Id: configure.in 391649 2006-04-05 15:49:41Z mturk $)dnl
AC_PREREQ(2.13)
AC_INIT(common/jk_worker.h)
AC_CONFIG_HEADER(common/portable.h)
AC_CONFIG_AUX_DIR(scripts/build/unix)
AC_CANONICAL_SYSTEM
dnl package and version. (synchronization with common/jk_version.h ?)
PACKAGE=mod_jk
VERSION=1.2.16
AM_INIT_AUTOMAKE(${PACKAGE}, ${VERSION})
AC_PROG_CC
AC_PROG_LD
dnl Not sure what it does, but the libtool manual seems to require this
dnl It should use the native platform dlopen ( if available )
AC_LIBTOOL_DLOPEN
dnl AM_PROG_LIBTOOL often causes problems.
dnl I have solved them once using aclocal --acdir=/usr/local/share/aclocal/
AM_PROG_LIBTOOL
AC_PATH_PROG(TEST,test,$PATH)dnl
AC_SUBST(TEST)
AC_PATH_PROG(RM,rm,$PATH)dnl
AC_SUBST(RM)
AC_PATH_PROG(GREP,grep,$PATH)dnl
AC_SUBST(GREP)
AC_PATH_PROG(ECHO,echo,echo,$PATH)dnl
AC_SUBST(ECHO)
AC_PATH_PROG(SED,sed,$PATH)dnl
AC_SUBST(SED)
AC_PATH_PROG(CP,cp,$PATH)dnl
AC_SUBST(CP)
AC_PATH_PROG(MKDIR,mkdir,$PATH)dnl
AC_SUBST(MKDIR)
dnl AC_PATH_PROG(LIBTOOL,libtool,$PATH)dnl
AC_SUBST(LIBTOOL)
AC_CHECK_SIZEOF(uint32_t)
AC_CHECK_SIZEOF(u_int32_t)
AC_CHECK_SIZEOF(unsigned long)
if test "$ac_cv_sizeof_uint32_t" = "4"; then
AC_DEFINE(HAVE_UINT32_T, [], [Use uint32_t for JK_UINT4])
elif test "$ac_cv_sizeof_u_int32_t" = "4"; then
AC_DEFINE(HAVE_U_INT32_T, [], [Use u_int32_t for JK_UINT4])
elif test "$ac_cv_sizeof_unsigned_long" = "4"; then
AC_DEFINE(HAVE_LONG, [], [Use unsigned long for JK_UINT4])
else
AC_ERROR([could not detect a 32-bit integer type])
fi
AC_CHECK_SIZEOF(unsigned int)
AC_CHECK_SIZEOF(unsigned long long)
AC_CHECK_SIZEOF(unsigned longlong)
if test "$ac_cv_sizeof_unsigned_int" = "8"; then
AC_DEFINE(HAVE_INT64, [], [Use int for JK_UINT8])
elif test "$ac_cv_sizeof_unsigned_long" = "8"; then
AC_DEFINE(HAVE_LONG64, [], [Use long for JK_UINT8])
elif test "$ac_cv_sizeof_unsigned_long_long" = "8"; then
AC_DEFINE(HAVE_LONG_LONG64, [], [Use long long for JK_UINT8])
elif test "$ac_cv_sizeof_unsigned_longlong" = "8"; then
AC_DEFINE(HAVE_LONGLONG64, [], [Use longlong for JK_UINT8])
else
AC_ERROR([could not detect a 64-bit integer type])
fi
dnl check for snprintf and vsnprintf.
AC_CHECK_FUNC(snprintf, AC_DEFINE(HAVE_SNPRINTF,1,[Have snprintf()]))
AC_CHECK_FUNC(vsnprintf, AC_DEFINE(HAVE_VSNPRINTF,1,[Have vsnprintf()]))
dnl check for flock function.
AC_CHECK_FUNC(flock, AC_DEFINE(HAVE_FLOCK,1,[Have flock()]))
dnl check for -lsocket library
AC_CHECK_LIB(socket, setsockopt, [LIBS="$LIBS -lsocket"])
AC_DEFUN([JK_CHECK_SETSOCKOPT], [
AC_MSG_CHECKING(whether to use $1 with setsockopt())
AC_TRY_RUN([
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
int main(void)
{
int s;
struct timeval tv;
tv.tv_sec = 3;
tv.tv_usec = 0;
#ifndef $1
exit(3);
#else
if ((s = socket(AF_INET, SOCK_STREAM, 0)) == -1)
exit(2);
/* fails on Solaris 2.6,8,9,10 and some Linuxes because
SO_RCVTIMEO|SO_SNDTIMEO are defined but not implemented */
if (setsockopt(s, SOL_SOCKET, $1, (const void *)&tv, sizeof(tv)) == -1)
exit(1);
exit(0);
#endif
}
]
, [ AC_MSG_RESULT([yes]) AC_DEFINE(USE_$1, 1, [Define to use $1 with setsockopt()]) ]
, [ AC_MSG_RESULT([no]) ]
)
])dnl
dnl check for SO_RCVTIMEO and SO_SNDTIMEO
JK_CHECK_SETSOCKOPT(SO_RCVTIMEO)
JK_CHECK_SETSOCKOPT(SO_SNDTIMEO)
APACHE_CONFIG_VARS=`pwd`/scripts/build/config_vars.mk
WEBSERVER=""
apache_dir=""
apache_include=""
APXS="apxs"
AC_ARG_WITH(apxs,
[ --with-apxs[=FILE] Build shared Apache module. FILE is the optional
pathname to the apxs tool; defaults to finding
apxs in your PATH.],
[
case "${withval}" in
y | yes | true) find_apxs=true ;;
n | no | false) find_apxs=false ;;
*) find_apxs=false ;;
esac
if ${TEST} ${find_apxs} ; then
AC_MSG_RESULT([need to check for Perl first, apxs depends on it...])
AC_PATH_PROG(PERL,perl,$PATH)dnl
if ${TEST} ${find_apxs} ; then
APXS=${withval}
else
AC_PATH_PROG(APXS,apxs,$PATH)dnl
fi
if ${TEST} -n "${APXS}" ; then
dnl Seems that we have it, but have to check if it is OK first
if ${TEST} ! -x "${APXS}" ; then
AC_MSG_ERROR(Invalid location for apxs: '${APXS}')
fi
${APXS} -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(You must specify a valid --with-apxs path)
fi
dnl apache_dir and apache_include are also needed.
apache_dir=`$APXS -q PREFIX`
apache_include="-I`$APXS -q INCLUDEDIR`"
dnl test apache version
APA=`${GREP} STANDARD20 ${APXS}`
if ${TEST} -z "$APA" ; then
WEBSERVER="apache-1.3"
APXSCFLAGS="`$APXS -q CFLAGS` -DJK_PREFORK"
APXS_CPPFLAGS=""
else
WEBSERVER="apache-2.0"
APRINCLUDEDIR=""
INCTEMP="`$APXS -q APR_INCLUDEDIR` `$APXS -q APU_INCLUDEDIR`"
for INC in ${INCTEMP}; do
APRINCLUDEDIR="${APRINCLUDEDIR} -I${INC}"
done
AC_MSG_RESULT([APRINCLUDEDIR is $APRINCLUDEDIR])
APXSCFLAGS="`${APXS} -q CFLAGS` `${APXS} -q EXTRA_CFLAGS` -DHAVE_APR ${APRINCLUDEDIR}"
APXSCPPFLAGS="`${APXS} -q EXTRA_CPPFLAGS`"
APACHE_CONFIG_VARS="`${APXS} -q exp_installbuilddir`/config_vars.mk"
LIBTOOL=`$APXS -q LIBTOOL`
fi
AC_MSG_RESULT([building connector for \"$WEBSERVER\"])
AC_SUBST(APXS)
fi
fi
],
[
AC_MSG_RESULT(no apxs given)
])
AC_SUBST(APACHE_CONFIG_VARS)
dnl Apache-2.0 needs the os subdirectory to include os.h
dnl this include is copy from os/config.m4
sinclude(../support/os_apache.m4)
dnl it is copied from the configure of JServ ;=)
dnl and adapted.
apache_dir_is_src="false"
AC_ARG_WITH(apache,
[ --with-apache=DIR Build static Apache module. DIR is the pathname
to the Apache source directory.],
[
if ${TEST} ! -z "$WEBSERVER" ; then
AC_MSG_ERROR([Sorry cannot use --with-apxs=${APXS} and --with-apache=${withval} togother, please choose one of both])
fi
AC_MSG_CHECKING([for Apache source directory (assume static build)])
if ${TEST} -n "${withval}" && ${TEST} -d "${withval}" ; then
if ${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}"
WEBSERVER="apache-1.3"
LIB_JK_TYPE=mod_jk.a
CFLAGS="${CFLAGS} -DJK_PREFORK"
AC_MSG_RESULT([${apache_include}, version 1.3])
else
AC_MSG_ERROR([Sorry Apache 1.2.x is no longer supported.])
fi
else
if ${TEST} -d "${withval}/include" ; then
# osdir for Apache20.
WEBSERVER="apache-2.0"
apache_dir=${withval}
apache_dir_is_src="true"
LIB_JK_TYPE=lib_jk.la
apache_include="-I${withval}/include -I${withval}/srclib/apr/include -I${withval}/os/${OS_APACHE_DIR} -I${withval}/srclib/apr-util/include"
AC_MSG_RESULT(${apache_dir})
fi
fi
fi
dnl Make sure we have a result.
if ${TEST} -z "$WEBSERVER" ; then
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
AC_MSG_RESULT([building connector for \"$WEBSERVER\"])
],
[
AC_MSG_RESULT(no apache given)
])
AC_SUBST(apache_include)
APACHE_DIR=${apache_dir}
AC_SUBST(APACHE_DIR)
dnl Check for enable-jni
JK_JNI_WORKER=""
AC_ARG_ENABLE(jni,
[ --enable-jni Build jni_connect.so and enable jni_worker.],
[
AC_MSG_RESULT(jni enable (need JDK))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -