Author: mturk Date: Wed Nov 23 15:34:01 2011 New Revision: 1205445 URL: http://svn.apache.org/viewvc?rev=1205445&view=rev Log: Axe guessing JDK and add unmanaged pool api
Modified: tomcat/native/trunk/native/BUILDING tomcat/native/trunk/native/build/tcnative.m4 tomcat/native/trunk/native/configure.in tomcat/native/trunk/native/src/pool.c Modified: tomcat/native/trunk/native/BUILDING URL: http://svn.apache.org/viewvc/tomcat/native/trunk/native/BUILDING?rev=1205445&r1=1205444&r2=1205445&view=diff ============================================================================== --- tomcat/native/trunk/native/BUILDING (original) +++ tomcat/native/trunk/native/BUILDING Wed Nov 23 15:34:01 2011 @@ -19,11 +19,13 @@ configure --with-apr=apr_install_location --with-ssl=openssl_install_location make - Building from the cvs tree: + Building from the svn tree: sh buildconf --with-apr=apr_source_location. configure --with-apr=apr_install_location --with-ssl=openssl_install_location make + Note that version 1.2.x requires at least apr-1.4.x + Testing the build: The make should produce a .so file named libtcnative-1.so. Build the jar containing the examples by Modified: tomcat/native/trunk/native/build/tcnative.m4 URL: http://svn.apache.org/viewvc/tomcat/native/trunk/native/build/tcnative.m4?rev=1205445&r1=1205444&r2=1205445&view=diff ============================================================================== --- tomcat/native/trunk/native/build/tcnative.m4 (original) +++ tomcat/native/trunk/native/build/tcnative.m4 Wed Nov 23 15:34:01 2011 @@ -21,7 +21,7 @@ dnl AC_DEFUN(TCN_FIND_APR,[ dnl use the find_apr.m4 script to locate APR. sets apr_found and apr_config - APR_FIND_APR(,,,[1]) + APR_FIND_APR(,,1,[1]) if test "$apr_found" = "no"; then AC_MSG_ERROR(APR could not be located. Please use the --with-apr option.) fi @@ -61,205 +61,77 @@ dnl Detection of JDK location and Java P dnl result goes in JAVA_HOME / JAVA_PLATFORM (2 -> 1.2 and higher) dnl dnl -------------------------------------------------------------------------- -AC_DEFUN( - [TCN_FIND_JDK], - [ - tempval="" - AC_MSG_CHECKING([for JDK location (please wait)]) - if test -n "${JAVA_HOME}" ; then - JAVA_HOME_ENV="${JAVA_HOME}" +AC_DEFUN([TCN_FIND_JAVA],[ + AC_ARG_WITH(java,[ --with-java-home=DIR Specify the location of your JDK installation],[ + AC_MSG_CHECKING([JAVA_HOME]) + if test -d "$withval" + then + JAVA_HOME="$withval" + AC_MSG_RESULT([$JAVA_HOME]) else - JAVA_HOME_ENV="" + AC_MSG_RESULT([failed]) + AC_MSG_ERROR([$withval is not a directory]) fi - - JAVA_HOME="" - JAVA_PLATFORM="" - - AC_ARG_WITH( - [java-home], - [ --with-java-home=DIR Location of JDK directory.], - [ - - # This stuff works if the command line parameter --with-java-home was - # specified, so it takes priority rightfully. - - tempval=${withval} - - if test ! -d "${tempval}" ; then - AC_MSG_ERROR(Not a directory: ${tempval}) - fi - - JAVA_HOME=${tempval} - AC_MSG_RESULT(${JAVA_HOME}) - ], - [ - # This works if the parameter was NOT specified, so it's a good time - # to see what the enviroment says. - # Since Sun uses JAVA_HOME a lot, we check it first and ignore the - # JAVA_HOME, otherwise just use whatever JAVA_HOME was specified. - - if test -n "${JAVA_HOME_ENV}" ; then - JAVA_HOME=${JAVA_HOME_ENV} - AC_MSG_RESULT(${JAVA_HOME_ENV} from environment) - fi - ]) - - if test -z "${JAVA_HOME}" ; then - - # Oh well, nobody set neither JAVA_HOME nor JAVA_HOME, have to guess - # The following code is based on the code submitted by Henner Zeller - # for ${srcdir}/src/scripts/package/rpm/ApacheJServ.spec - # Two variables will be set as a result: - # - # JAVA_HOME - # JAVA_PLATFORM - AC_MSG_CHECKING([Try to guess JDK location]) - - for JAVA_PREFIX in /usr/local /usr/local/lib /usr /usr/lib /opt /usr/java /System/Library/Frameworks/JavaVM.framework/Versions/ ; do - - for JAVA_PLATFORM in 6 5 4 3 2 ; do - - for subversion in .9 .8 .7 .6 .5 .4 .3 .2 .1 .0 "" ; do - - for VARIANT in IBMJava2- java java- jdk jdk- ""; do - GUESS="${JAVA_PREFIX}/${VARIANT}1.${JAVA_PLATFORM}${subversion}" -dnl AC_MSG_CHECKING([${GUESS}]) - if test -d "${GUESS}/bin" & test -d "${GUESS}/include" ; then - JAVA_HOME="${GUESS}" - AC_MSG_RESULT([${GUESS}]) - break - fi - if test -d "${GUESS}/Commands" & test -d "${GUESS}/Headers" ; then - JAVA_HOME="${GUESS}" - AC_MSG_RESULT([${GUESS}]) - break - fi - done - - if test -n "${JAVA_HOME}" ; then - break; - fi - - done - - if test -n "${JAVA_HOME}" ; then - break; - fi - - done - - if test -n "${JAVA_HOME}" ; then - break; - fi - - done - - if test ! -n "${JAVA_HOME}" ; then - AC_MSG_ERROR(can't locate a valid JDK location) + AC_SUBST(JAVA_HOME) + ]) + if test "x$JAVA_HOME" = x + then + AC_MSG_CHECKING([for JDK location]) + # Oh well, nobody set JAVA_HOME, have to guess + # Check if we have java in the PATH. + java_prog="`which java 2>/dev/null || true`" + if test "x$java_prog" != x + then + java_bin="`dirname $java_prog`" + java_top="`dirname $java_bin`" + if test -f "$java_top/include/jni.h" + then + JAVA_HOME="$java_top" + AC_MSG_RESULT([${java_top}]) fi - fi + fi + if test x"$JAVA_HOME" = x + then + AC_MSG_ERROR([Java Home not defined. Rerun with --with-java-home=[...] parameter]) + fi +]) - if test -n "${JAVA_PLATFORM}"; then - AC_MSG_RESULT(Java Platform detected - 1.${JAVA_PLATFORM}) - else - AC_MSG_CHECKING(Java platform) - fi - - AC_ARG_WITH(java-platform, - [ --with-java-platform[=2] Force the Java platform - (value is 1 for 1.1.x or 2 for 1.2.x or greater)], - [ - case "${withval}" in - "1"|"2") - JAVA_PLATFORM=${withval} - ;; - *) - AC_MSG_ERROR(invalid java platform provided) - ;; - esac - ], - [ - if test -n "${JAVA_PLATFORM}"; then - AC_MSG_RESULT(Java Platform detected - 1.${JAVA_PLATFORM}) - else - AC_MSG_CHECKING(Java platform) - fi - ]) - - AC_MSG_RESULT(${JAVA_PLATFORM}) - - unset tempval - ]) - - -AC_DEFUN( - [TCN_FIND_JDK_OS], - [ - tempval="" - JAVA_OS="" - AC_ARG_WITH(os-type, - [ --with-os-type[=SUBDIR] Location of JDK os-type subdirectory.], - [ - tempval=${withval} - - if test ! -d "${JAVA_HOME}/${tempval}" ; then - AC_MSG_ERROR(Not a directory: ${JAVA_HOME}/${tempval}) - fi - - JAVA_OS = ${tempval} - ], - [ - AC_MSG_CHECKING(os_type directory) - JAVA_OS=NONE - if test -f ${JAVA_HOME}/${JAVA_INC}/jni_md.h; then - JAVA_OS="" - else - for f in ${JAVA_HOME}/${JAVA_INC}/*/jni_md.h; do - if test -f $f; then - JAVA_OS=`dirname ${f}` - JAVA_OS=`basename ${JAVA_OS}` - echo " ${JAVA_OS}" - fi - done - if test "${JAVA_OS}" = "NONE"; then - AC_MSG_RESULT(Cannot find jni_md.h in ${JAVA_HOME}/${OS}) - AC_MSG_ERROR(You should retry --with-os-type=SUBDIR) - fi - fi - ]) - ]) - -dnl check for sableVM -dnl (copied from daemon/src/native/unix/support/apjava.m4) -AC_DEFUN( - [TCN_SABLEVM], +AC_DEFUN([TCN_FIND_JDK_OS],[ + tempval="" + JAVA_OS="" + AC_ARG_WITH(os-type,[ --with-os-type[=SUBDIR] Location of JDK os-type subdirectory.], [ - if test x"$JAVA_HOME" != x - then - AC_PATH_PROG(SABLEVM,sablevm,NONE,$JAVA_HOME/bin) - if test "$SABLEVM" != "NONE" + tempval=$withval + if test ! -d "$JAVA_HOME/$tempval" then - AC_MSG_RESULT([Using sableVM: $SABLEVM]) - CFLAGS="$CFLAGS -DHAVE_SABLEVM" - NEED_JNI_MD=no + AC_MSG_ERROR(Not a directory: ${JAVA_HOME}/${tempval}) fi - fi - ]) -dnl check for IBM J9VM -AC_DEFUN( - [TCN_J9VM], + JAVA_OS=$tempval + ], [ - if test x"$JAVA_HOME" != x - then - J9VM=`$JAVA_HOME/bin/java -version 2>&1 | grep J9VM` - if test x"$J9VM" != x + AC_MSG_CHECKING(for JDK os include directory) + JAVA_OS=NONE + if test -f $JAVA_HOME/$JAVA_INC/jni_md.h then - AC_MSG_RESULT([Using J9VM: $J9VM]) - NEED_JNI_MD=no + JAVA_OS="" + else + for f in $JAVA_HOME/$JAVA_INC/*/jni_md.h + do + if test -f $f; then + JAVA_OS=`dirname $f` + JAVA_OS=`basename $JAVA_OS` + echo " $JAVA_OS" + break + fi + done + if test "x$JAVA_OS" = "xNONE"; then + AC_MSG_RESULT(Cannot find jni_md.h in ${JAVA_HOME}/${OS}) + AC_MSG_ERROR(You should retry --with-os-type=SUBDIR) + fi fi - fi ]) +]) dnl TCN_HELP_STRING(LHS, RHS) dnl Autoconf 2.50 can not handle substr correctly. It does have Modified: tomcat/native/trunk/native/configure.in URL: http://svn.apache.org/viewvc/tomcat/native/trunk/native/configure.in?rev=1205445&r1=1205444&r2=1205445&view=diff ============================================================================== --- tomcat/native/trunk/native/configure.in (original) +++ tomcat/native/trunk/native/configure.in Wed Nov 23 15:34:01 2011 @@ -214,6 +214,7 @@ case $host in esac TCN_FIND_APR_FEATURE([apr_pool_pre_cleanup_register],[POOL_PRE_CLEANUP]) +TCN_FIND_APR_FEATURE([apr_pool_create_unmanaged_ex],[POOL_UNMANAGED]) TCN_FIND_APR_FEATURE([apr_pollset_wakeup],[POLLSET_WAKEUP]) AC_SUBST(TCNATIVE_EXPORT_LIBS) Modified: tomcat/native/trunk/native/src/pool.c URL: http://svn.apache.org/viewvc/tomcat/native/trunk/native/src/pool.c?rev=1205445&r1=1205444&r2=1205445&view=diff ============================================================================== --- tomcat/native/trunk/native/src/pool.c (original) +++ tomcat/native/trunk/native/src/pool.c Wed Nov 23 15:34:01 2011 @@ -56,6 +56,24 @@ cleanup: return P2J(n); } +#if defined(HAVE_POOL_UNMANAGED) +TCN_IMPLEMENT_CALL(jlong, Pool, unmanaged)(TCN_STDARGS) +{ + apr_pool_t *n; + + UNREFERENCED(o); + TCN_THROW_IF_ERR(apr_pool_create_unmanaged(&n), n); +cleanup: + return P2J(n); +} +#else +TCN_IMPLEMENT_CALL(jlong, Pool, unmanaged)(TCN_STDARGS) +{ + UNREFERENCED_STDARGS; + return 0; +} +#endif + TCN_IMPLEMENT_CALL(void, Pool, clear)(TCN_STDARGS, jlong pool) { apr_pool_t *p = J2P(pool, apr_pool_t *); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org