[commons-daemon] 37/52: Imported Upstream version 1.0.8

Tony Mancill tmancill at moszumanska.debian.org
Wed Nov 12 05:31:32 UTC 2014


This is an automated email from the git hooks/post-receive script.

tmancill pushed a commit to branch master
in repository commons-daemon.

commit 2f8fa3f45c5d50ada4f31e284dd6effd754fc8a2
Author: tony mancill <tmancill at debian.org>
Date:   Fri Nov 7 07:59:36 2014 -0800

    Imported Upstream version 1.0.8
---
 README                                             |  11 +
 RELEASE-NOTES.txt                                  |  11 +-
 build.xml                                          |  16 +-
 pom.xml                                            |  12 +-
 src/{ => main}/assembly/bin.xml                    |   0
 src/{ => main}/assembly/native-src.xml             |  10 -
 src/{ => main}/assembly/src.xml                    |   0
 .../java/org/apache/commons/daemon/Daemon.java     |   0
 .../org/apache/commons/daemon/DaemonContext.java   |   0
 .../apache/commons/daemon/DaemonController.java    |   0
 .../apache/commons/daemon/DaemonInitException.java |   0
 .../org/apache/commons/daemon/DaemonListener.java  |   0
 .../apache/commons/daemon/DaemonPermission.java    |   0
 .../apache/commons/daemon/DaemonUserSignal.java    |   0
 .../daemon/support/DaemonConfiguration.java        |   0
 .../commons/daemon/support/DaemonLoader.java       |   0
 .../commons/daemon/support/DaemonWrapper.java      |   0
 src/native/unix/CHANGES.txt                        |   8 +-
 src/native/unix/INSTALL.txt                        |  16 +-
 src/native/unix/Makedefs.in                        |   8 +-
 src/native/unix/configure                          | 510 +++-------------
 src/native/unix/configure.in                       |  21 +-
 src/native/unix/man/jsvc.1.xml                     |   8 +
 src/native/unix/native/arguments.c                 |  30 +-
 src/native/unix/native/arguments.h                 |   6 +-
 src/native/unix/native/debug.c                     |  19 +-
 src/native/unix/native/help.c                      |   4 +-
 src/native/unix/native/java.c                      |  23 +-
 src/native/unix/native/jsvc-unix.c                 |  33 +-
 src/native/unix/native/location.c                  |  24 +-
 src/native/unix/native/version.h                   |   2 +-
 src/native/unix/support/apjava.m4                  | 150 ++---
 src/native/unix/support/apsupport.m4               |  40 +-
 src/native/unix/support/config.sub                 | 678 ++++++++++++++++-----
 src/native/windows/apps/prunmgr/prunmgr.c          |  11 +-
 src/native/windows/apps/prunmgr/prunmgr.h          |   2 +-
 src/native/windows/apps/prunmgr/prunmgr.rc         |   6 +-
 src/native/windows/apps/prunsrv/prunsrv.c          | 349 +++++++----
 src/native/windows/apps/prunsrv/prunsrv.h          |   2 +-
 src/native/windows/apps/prunsrv/prunsrv.rc         |   4 +-
 src/native/windows/include/apxwin.h                |   6 +-
 src/native/windows/include/cmdline.h               |   4 +-
 src/native/windows/include/log.h                   |  10 +-
 src/native/windows/src/cmdline.c                   | 119 ++--
 src/native/windows/src/javajni.c                   |  59 +-
 src/native/windows/src/log.c                       | 117 +++-
 src/native/windows/src/private.h                   |   2 -
 src/native/windows/src/registry.c                  |  26 -
 src/native/windows/src/service.c                   |  31 +-
 src/native/windows/src/utils.c                     |  43 +-
 src/samples/Tomcat5.sh                             |  89 ---
 src/samples/Tomcat7.sh                             | 235 -------
 .../org/apache/commons/daemon/SimpleDaemon.java    |   0
 53 files changed, 1344 insertions(+), 1411 deletions(-)

diff --git a/README b/README
index 5c4de0a..222e5be 100644
--- a/README
+++ b/README
@@ -28,3 +28,14 @@ mvn site:generate
 
 To deploy the documentation to the apache site:
 mvn -Dmaven.username=${user.name} site:deploy
+
+To deploy the Java jars to the Nexus staging repo:
+
+mvn clean
+mvn deploy -Prelease [-Ptest-deploy]
+
+The test-deploy profile will deploy to target/deploy; omit for the live deploy
+
+Note: do not use clean in the same invocation.
+Not sure why, but with Commons-Parent v21 this results deploying the non-Maven archives (zip and tar.gz) as well.
+They can be deleted before closing the repo, but it is easier not to create them. 
\ No newline at end of file
diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index 76f8a53..4910ae0 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -1,7 +1,7 @@
-$Id: RELEASE-NOTES.txt 1153024 2011-08-02 04:27:12Z mturk $
+$Id: RELEASE-NOTES.txt 1202656 2011-11-16 12:17:56Z mturk $
 
             Commons Daemon Package
-               Version 1.0.7
+               Version 1.0.8
                 Release Notes
 
 
@@ -31,6 +31,8 @@ Commons DAEMON 1.0.3 requires a minimum of JDK 1.3
 
 NEW FEATURES:
 
+* DAEMON-221: Add -umask to jsvc so that users don't have to
+              recompile the jsvc if different umask is desired (1.0.8)
 * DAEMON-209: Add --LibraryPath to procrun for setting the
               LoadLibrary search paths (1.0.6)
 * DAEMON-208: Add -server and -client -jvm <name> synonyms (1.0.6)
@@ -78,7 +80,10 @@ NEW FEATURES:
 
 BUG FIXES:
 
-1.0.7: DAEMON-211
+1.0.8: DAEMON-195, DAEMON-215, DAEMON-216, DAEMON-218, DAEMON-219, DAEMON-220,
+       DAEMON-222, DAEMON-223, DAEMON-224, DAEMON-227, DAEMON-228
+
+1.0.7: DAEMON-211, DAEMON-214
 
 1.0.6: DAEMON-186, DAEMON-193, DAEMON-194, DAEMON-206, DAEMON-185, DAEMON-200
        DAEMON-192
diff --git a/build.xml b/build.xml
index f87802b..f1e5cde 100644
--- a/build.xml
+++ b/build.xml
@@ -19,7 +19,7 @@
 
 <!--
         "Daemon" component of the Apache Commons Subproject
-        $Id: build.xml 1152906 2011-08-01 19:38:09Z mturk $
+        $Id: build.xml 1202070 2011-11-15 07:01:42Z mturk $
 -->
 
 
@@ -59,7 +59,7 @@
   <property name="component.title"         value="Java Daemons"/>
 
   <!-- The current version number of this component -->
-  <property name="component.version"       value="1.0.7"/>
+  <property name="component.version"       value="1.0.8"/>
 
   <!-- The base directory for compilation targets -->
   <property name="build.home"              value="target"/>
@@ -71,10 +71,10 @@
   <property name="dist.home"               value="dist"/>
 
   <!-- The base directory for component sources -->
-  <property name="source.home"             value="src/java"/>
+  <property name="source.home"             value="src/main/java"/>
 
   <!-- The base directory for unit test sources -->
-  <property name="test.home"               value="src/test"/>
+  <property name="test.home"               value="src/test/java"/>
 
   <!-- The ant dir (usefull for non standard layout)  -->
   <property name="ant.lib"                 value="${ant.home}/lib"/>
@@ -239,10 +239,6 @@
         -->
       <fileset dir="src/native/unix" />
     </copy>
-    <copy file="src/samples/Tomcat5.sh"
-          todir="${native.path}/unix/samples"/>
-    <copy file="src/samples/Tomcat7.sh"
-          todir="${native.path}/unix/samples"/>
     <copy todir="${native.path}/windows">
       <fileset dir="src/native/windows" />
     </copy>
@@ -258,12 +254,10 @@
         <include name="${native.name}/**" />
         <exclude name="${native.name}/unix/configure" />
         <exclude name="${native.name}/unix/support/*.sh" />
-        <exclude name="${native.name}/unix/samples/*.sh" />
       </tarfileset>
       <tarfileset dir="${dist.home}/bin/native" mode="755">
         <include name="${native.name}/unix/configure" />
         <include name="${native.name}/unix/support/*.sh" />
-        <include name="${native.name}/unix/samples/*.sh" />
       </tarfileset>
     </tar>
     <zip zipfile="${dist.home}/bin/${native.name}.zip">
@@ -271,12 +265,10 @@
         <include name="${native.name}/**" />
         <exclude name="${native.name}/unix/configure" />
         <exclude name="${native.name}/unix/support/*.sh" />
-        <exclude name="${native.name}/unix/samples/*.sh" />
       </zipfileset>
       <zipfileset dir="${dist.home}/bin/native" filemode="755">
         <include name="${native.name}/unix/configure" />
         <include name="${native.name}/unix/support/*.sh" />
-        <include name="${native.name}/unix/samples/*.sh" />
       </zipfileset>
     </zip>
 
diff --git a/pom.xml b/pom.xml
index 1086b9d..8ee9c1b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,7 +27,7 @@
   <modelVersion>4.0.0</modelVersion>
   <groupId>commons-daemon</groupId>
   <artifactId>commons-daemon</artifactId>
-  <version>1.0.7</version>
+  <version>1.0.8</version>
   <name>Commons Daemon</name>
   <!-- Daemon started in Commons in 2002 with an import of code from Tomcat,
        which is why the NOTICE file has an earlier date than the inceptionYear -->
@@ -92,14 +92,12 @@
     <maven.compile.source>1.3</maven.compile.source>
     <maven.compile.target>1.3</maven.compile.target>
     <commons.componentid>daemon</commons.componentid>
-    <commons.release.version>1.0.7</commons.release.version>
+    <commons.release.version>1.0.8</commons.release.version>
     <commons.jira.id>DAEMON</commons.jira.id>
     <commons.jira.pid>12310468</commons.jira.pid>
   </properties>
 
   <build>
-    <sourceDirectory>src/java</sourceDirectory>
-    <testSourceDirectory>src/test</testSourceDirectory>
     <plugins>
 <!--
       <plugin>
@@ -119,9 +117,9 @@
         <artifactId>maven-assembly-plugin</artifactId>
         <configuration>
           <descriptors>
-            <descriptor>src/assembly/native-src.xml</descriptor>
-            <descriptor>src/assembly/bin.xml</descriptor>
-            <descriptor>src/assembly/src.xml</descriptor>
+            <descriptor>src/main/assembly/native-src.xml</descriptor>
+            <descriptor>src/main/assembly/bin.xml</descriptor>
+            <descriptor>src/main/assembly/src.xml</descriptor>
           </descriptors>
           <tarLongFileMode>gnu</tarLongFileMode>
         </configuration>
diff --git a/src/assembly/bin.xml b/src/main/assembly/bin.xml
similarity index 100%
rename from src/assembly/bin.xml
rename to src/main/assembly/bin.xml
diff --git a/src/assembly/native-src.xml b/src/main/assembly/native-src.xml
similarity index 89%
rename from src/assembly/native-src.xml
rename to src/main/assembly/native-src.xml
index 2f675cb..133e0b2 100644
--- a/src/assembly/native-src.xml
+++ b/src/main/assembly/native-src.xml
@@ -54,16 +54,6 @@
             </includes>
         </fileSet>
         <fileSet>
-            <directory>src/samples</directory>
-            <outputDirectory>unix/samples</outputDirectory>
-            <lineEnding>lf</lineEnding>
-            <fileMode>775</fileMode>
-            <includes>
-                <include>Tomcat5.sh</include>
-                <include>Tomcat7.sh</include>
-            </includes>
-        </fileSet>
-        <fileSet>
             <directory>src/native/windows</directory>
             <outputDirectory>windows</outputDirectory>
             <lineEnding>crlf</lineEnding>
diff --git a/src/assembly/src.xml b/src/main/assembly/src.xml
similarity index 100%
rename from src/assembly/src.xml
rename to src/main/assembly/src.xml
diff --git a/src/java/org/apache/commons/daemon/Daemon.java b/src/main/java/org/apache/commons/daemon/Daemon.java
similarity index 100%
rename from src/java/org/apache/commons/daemon/Daemon.java
rename to src/main/java/org/apache/commons/daemon/Daemon.java
diff --git a/src/java/org/apache/commons/daemon/DaemonContext.java b/src/main/java/org/apache/commons/daemon/DaemonContext.java
similarity index 100%
rename from src/java/org/apache/commons/daemon/DaemonContext.java
rename to src/main/java/org/apache/commons/daemon/DaemonContext.java
diff --git a/src/java/org/apache/commons/daemon/DaemonController.java b/src/main/java/org/apache/commons/daemon/DaemonController.java
similarity index 100%
rename from src/java/org/apache/commons/daemon/DaemonController.java
rename to src/main/java/org/apache/commons/daemon/DaemonController.java
diff --git a/src/java/org/apache/commons/daemon/DaemonInitException.java b/src/main/java/org/apache/commons/daemon/DaemonInitException.java
similarity index 100%
rename from src/java/org/apache/commons/daemon/DaemonInitException.java
rename to src/main/java/org/apache/commons/daemon/DaemonInitException.java
diff --git a/src/java/org/apache/commons/daemon/DaemonListener.java b/src/main/java/org/apache/commons/daemon/DaemonListener.java
similarity index 100%
rename from src/java/org/apache/commons/daemon/DaemonListener.java
rename to src/main/java/org/apache/commons/daemon/DaemonListener.java
diff --git a/src/java/org/apache/commons/daemon/DaemonPermission.java b/src/main/java/org/apache/commons/daemon/DaemonPermission.java
similarity index 100%
rename from src/java/org/apache/commons/daemon/DaemonPermission.java
rename to src/main/java/org/apache/commons/daemon/DaemonPermission.java
diff --git a/src/java/org/apache/commons/daemon/DaemonUserSignal.java b/src/main/java/org/apache/commons/daemon/DaemonUserSignal.java
similarity index 100%
rename from src/java/org/apache/commons/daemon/DaemonUserSignal.java
rename to src/main/java/org/apache/commons/daemon/DaemonUserSignal.java
diff --git a/src/java/org/apache/commons/daemon/support/DaemonConfiguration.java b/src/main/java/org/apache/commons/daemon/support/DaemonConfiguration.java
similarity index 100%
rename from src/java/org/apache/commons/daemon/support/DaemonConfiguration.java
rename to src/main/java/org/apache/commons/daemon/support/DaemonConfiguration.java
diff --git a/src/java/org/apache/commons/daemon/support/DaemonLoader.java b/src/main/java/org/apache/commons/daemon/support/DaemonLoader.java
similarity index 100%
rename from src/java/org/apache/commons/daemon/support/DaemonLoader.java
rename to src/main/java/org/apache/commons/daemon/support/DaemonLoader.java
diff --git a/src/java/org/apache/commons/daemon/support/DaemonWrapper.java b/src/main/java/org/apache/commons/daemon/support/DaemonWrapper.java
similarity index 100%
rename from src/java/org/apache/commons/daemon/support/DaemonWrapper.java
rename to src/main/java/org/apache/commons/daemon/support/DaemonWrapper.java
diff --git a/src/native/unix/CHANGES.txt b/src/native/unix/CHANGES.txt
index 8076770..bda92f6 100644
--- a/src/native/unix/CHANGES.txt
+++ b/src/native/unix/CHANGES.txt
@@ -1,5 +1,11 @@
 APACHE COMMONS DAEMON (UNIX) CHANGELOG:
-Last modified at [$Date: 2011-08-01 21:38:09 +0200 (Mon, 01 Aug 2011) $]
+Last modified at [$Date: 2011-11-01 21:43:52 +0100 (Tue, 01 Nov 2011) $]
+
+Changes with 1.0.8
+  * Better detection of JDK (DAEMON-220)
+  * Use CPPFLAGS in makefile (DAEMON-223)
+  * Add -umask parameter (DAEMON-221)
+  * Add /etc/alternatives to the location search (DAEMON-224)
 
 Changes with 1.0.7
 
diff --git a/src/native/unix/INSTALL.txt b/src/native/unix/INSTALL.txt
index 16225bc..632f549 100644
--- a/src/native/unix/INSTALL.txt
+++ b/src/native/unix/INSTALL.txt
@@ -22,17 +22,19 @@ or
   export JAVA_HOME
   ./configure
 
-or (when using gcj (use fastjar for jar))
-  JAVAC=gcj; export JAVAC
-  JAVACFLAGS=-c; export JAVACFLAGS
-  ./configure
-
 Note: On Mac OS X <dir> is /System/Library/Frameworks/JavaVM.framework/Home.
 
+Depending on your JDK layout, configure might fail to find the JNI
+machine dependant include file (jni_md.h). If that's the case use the
+--with-os-type=<subdir> parameter where subdir points to the directory
+within JDK include directory containing jni_md.h file.
+
+
 If your operating system is supported, configure will go thru cleanly,
 otherwise it will report an error (please send us the details of your
-OS/JDK, or a patch against the sources). To build the binaries and
-libraries simply do:
+OS/JDK, or a patch against the sources).
+
+To build the binaries and libraries simply do:
 
   make
 
diff --git a/src/native/unix/Makedefs.in b/src/native/unix/Makedefs.in
index 68bc498..9c09862 100644
--- a/src/native/unix/Makedefs.in
+++ b/src/native/unix/Makedefs.in
@@ -16,19 +16,17 @@
 #
 
 # @author  Pier Fumagalli <mailto:pier.fumagalli at eng.sun.com>
-# @version $Id: Makedefs.in 1023247 2010-10-16 11:21:22Z mturk $
+# @version $Id: Makedefs.in 1194902 2011-10-29 15:19:18Z mturk $
 
 CC = @CC@
-JAVAC = @JAVAC@
-JAR = @JAR@
 CFLAGS = @CFLAGS@
+CPPFLAGS = @CPPFLAGS@
 INCLUDES = @INCLUDES@
 LDFLAGS = @LDFLAGS@
 LIBS = @LIBS@
-JAVACFLAGS = @JAVACFLAGS@
 RANLIB = @RANLIB@
 LDCMD = @LDCMD@
 STRIP = @STRIP@
 
 .c.o:
-	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDES) -c $< -o $@
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(EXTRA_CFLAGS) $(INCLUDES) -c $< -o $@
diff --git a/src/native/unix/configure b/src/native/unix/configure
index 64d88bf..a1f55fd 100755
--- a/src/native/unix/configure
+++ b/src/native/unix/configure
@@ -272,7 +272,7 @@ PACKAGE_STRING=
 PACKAGE_BUGREPORT=
 
 ac_unique_file="configure.in"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT RANLIB ac_ct_RANLIB STRIP  [...]
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT RANLIB ac_ct_RANLIB STRIP  [...]
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -804,6 +804,7 @@ Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
   --with-java=DIR         Specify the location of your JDK installation
+  --with-os-type=SUBDIR   Location of JDK os-type subdirectory.
 
 Some influential environment variables:
   CC          C compiler command
@@ -2545,10 +2546,11 @@ echo $ECHO_N "checking C flags dependant on host system type... $ECHO_C" >&6
     CFLAGS="$CFLAGS -pthread -DOS_TRU64 -DDSO_DLFCN -D_XOPEN_SOURCE_EXTENDED"
     LDFLAGS="$LDFLAGS -pthread"
     ;;
-  hpux11*)
+  hpux*)
     CFLAGS="$CFLAGS -pthread -DOS_HPUX -DDSO_DLFCN"
     LDFLAGS="$LDFLAGS -pthread"
     LIBS="$LIBS -lpthread"
+    supported_os="hp-ux"
     ;;
   aix5*)
     CFLAGS="$CFLAGS -DOS_AIX -DDSO_DLFCN"
@@ -2569,7 +2571,7 @@ echo "$as_me: error: Unsupported operating system \"$host_os\"" >&2;}
   sparc*)
     CFLAGS="$CFLAGS -DCPU=\\\"$host_cpu\\\""
     HOST_CPU=$host_cpu;;
-  i?86)
+  i?86|x86)
     CFLAGS="$CFLAGS -DCPU=\\\"i386\\\""
     HOST_CPU=i386;;
   x86_64 | amd64)
@@ -2590,22 +2592,39 @@ echo "$as_me: error: Unsupported operating system \"$host_os\"" >&2;}
     CFLAGS="$CFLAGS -DCPU=\\\"alpha\\\""
     supported_os="alpha"
     HOST_CPU=alpha;;
-  hppa2.0w)
-    CFLAGS="$CFLAGS -DCPU=\\\"PA_RISC2.0W\\\""
-    supported_os="hp-ux"
+  hppa2.0w|hppa64)
+    CFLAGS="$CFLAGS -DCPU=\\\"PA_RISC2.0W\\\" -DSO_EXT=\\\"sl\\\""
     HOST_CPU=PA_RISC2.0W;;
+  hppa2.0n)
+    CFLAGS="$CFLAGS -DCPU=\\\"PA_RISC2.0N\\\" -DSO_EXT=\\\"sl\\\""
+    HOST_CPU=PA_RISC2.0N;;
   hppa2.0)
-    CFLAGS="$CFLAGS -DCPU=\\\"PA_RISC2.0\\\""
-    supported_os="hp-ux"
+    CFLAGS="$CFLAGS -DCPU=\\\"PA_RISC2.0\\\" -DSO_EXT=\\\"sl\\\""
     HOST_CPU=PA_RISC2.0;;
   mipsel)
     CFLAGS="$CFLAGS -DCPU=\\\"mipsel\\\""
     supported_os="mipsel"
     HOST_CPU=mipsel;;
-  ia64)
-    CFLAGS="$CFLAGS -DCPU=\\\"ia64\\\""
-    supported_os="ia64"
+  ia64w)
+    if test "$supported_os" = "hp-ux"
+    then
+        CFLAGS="$CFLAGS -mlp64 -DCPU=\\\"IA64W\\\" -DSO_EXT=\\\"so\\\""
+        LDFLAGS="$LDFLAGS -mlp64"
+    else
+        CFLAGS="$CFLAGS -DCPU=\\\"ia64\\\""
+    fi
     HOST_CPU=ia64;;
+  ia64|ia64n)
+    if test "$supported_os" = "hp-ux"
+    then
+        CFLAGS="$CFLAGS -milp32 -DCPU=\\\"IA64N\\\" -DSO_EXT=\\\"so\\\""
+        LDFLAGS="$LDFLAGS -milp32"
+        HOST_CPU=IA64N
+    else
+        CFLAGS="$CFLAGS -DCPU=\\\"ia64\\\""
+        HOST_CPU=ia64
+    fi
+    ;;
   s390)
     CFLAGS="$CFLAGS -DCPU=\\\"s390\\\""
     supported_os="s390"
@@ -2673,434 +2692,90 @@ echo "$as_me: error: $withval is not a directory" >&2;}
 
 
 fi;
-  if test x"$JAVA_HOME" = x
-  then
-    { { echo "$as_me:$LINENO: error: Java Home not defined. Rerun with --with-java=... parameter" >&5
-echo "$as_me: error: Java Home not defined. Rerun with --with-java=... parameter" >&2;}
-   { (exit 1); exit 1; }; }
-  fi
-
-
-  if test x"$JAVA_HOME" != x
+  if test "x$JAVA_HOME" = x
   then
-    # Extract the first word of "sablevm", so it can be a program name with args.
-set dummy sablevm; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_path_SABLEVM+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  case $SABLEVM in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_SABLEVM="$SABLEVM" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $JAVA_HOME/bin
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_SABLEVM="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-
-  test -z "$ac_cv_path_SABLEVM" && ac_cv_path_SABLEVM="NONE"
-  ;;
-esac
-fi
-SABLEVM=$ac_cv_path_SABLEVM
-
-if test -n "$SABLEVM"; then
-  echo "$as_me:$LINENO: result: $SABLEVM" >&5
-echo "${ECHO_T}$SABLEVM" >&6
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-    if test "$SABLEVM" = "NONE"
+    echo "$as_me:$LINENO: checking for JDK location" >&5
+echo $ECHO_N "checking for JDK location... $ECHO_C" >&6
+    # 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
-            if $JAVA_HOME/bin/java -version 2> /dev/null | grep SableVM > /dev/null
+      java_bin="`dirname $java_prog`"
+      java_top="`dirname $java_bin`"
+      if test -f "$java_top/include/jni.h"
       then
-        SABLEVM=$JAVA_HOME/bin/java
+        JAVA_HOME="$java_top"
+        echo "$as_me:$LINENO: result: ${java_top}" >&5
+echo "${ECHO_T}${java_top}" >&6
       fi
     fi
-    if test "$SABLEVM" != "NONE"
-    then
-      echo "$as_me:$LINENO: result: Using sableVM: $SABLEVM" >&5
-echo "${ECHO_T}Using sableVM: $SABLEVM" >&6
-      CFLAGS="$CFLAGS -DHAVE_SABLEVM"
-    fi
-  fi
-
-
-  if test x"$JAVA_HOME" != x
-  then
-    # Extract the first word of "kaffe", so it can be a program name with args.
-set dummy kaffe; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_path_KAFFEVM+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  case $KAFFEVM in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_KAFFEVM="$KAFFEVM" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $JAVA_HOME/bin
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_KAFFEVM="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-
-  test -z "$ac_cv_path_KAFFEVM" && ac_cv_path_KAFFEVM="NONE"
-  ;;
-esac
-fi
-KAFFEVM=$ac_cv_path_KAFFEVM
-
-if test -n "$KAFFEVM"; then
-  echo "$as_me:$LINENO: result: $KAFFEVM" >&5
-echo "${ECHO_T}$KAFFEVM" >&6
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-    if test "$KAFFEVM" != "NONE"
-    then
-      echo "$as_me:$LINENO: result: Using kaffe: $KAFFEVM" >&5
-echo "${ECHO_T}Using kaffe: $KAFFEVM" >&6
-      CFLAGS="$CFLAGS -DHAVE_KAFFEVM"
-      LDFLAGS="$LDFLAGS -Wl,-rpath $JAVA_HOME/jre/lib/$HOST_CPU -L $JAVA_HOME/jre/lib/$HOST_CPU -lkaffevm"
-    fi
   fi
-
-
-  if test "$SABLEVM" != "NONE"
+  if test x"$JAVA_HOME" = x
   then
-    # Extract the first word of "javac-sablevm", so it can be a program name with args.
-set dummy javac-sablevm; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_path_JAVACSABLE+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  case $JAVACSABLE in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_JAVACSABLE="$JAVACSABLE" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $JAVA_HOME/bin
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_JAVACSABLE="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
+    { { echo "$as_me:$LINENO: error: Java Home not defined. Rerun with --with-java=... parameter" >&5
+echo "$as_me: error: Java Home not defined. Rerun with --with-java=... parameter" >&2;}
+   { (exit 1); exit 1; }; }
   fi
-done
-done
 
-  test -z "$ac_cv_path_JAVACSABLE" && ac_cv_path_JAVACSABLE="NONE"
-  ;;
-esac
-fi
-JAVACSABLE=$ac_cv_path_JAVACSABLE
-
-if test -n "$JAVACSABLE"; then
-  echo "$as_me:$LINENO: result: $JAVACSABLE" >&5
-echo "${ECHO_T}$JAVACSABLE" >&6
+if test -d $JAVA_HOME/Headers
+then
+  JAVA_INC=Headers
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  JAVA_INC=include
 fi
 
-  else
-    JAVACSABLE="NONE"
-  fi
-  if test "$JAVACSABLE" = "NONE"
-  then
-    XPATH="$JAVA_HOME/bin:$JAVA_HOME/Commands:$PATH"
-    # Extract the first word of "javac", so it can be a program name with args.
-set dummy javac; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_path_JAVAC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  case $JAVAC in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_JAVAC="$JAVAC" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $XPATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_JAVAC="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
+  tempval=""
+  JAVA_OS=""
 
-  test -z "$ac_cv_path_JAVAC" && ac_cv_path_JAVAC="NONE"
-  ;;
-esac
-fi
-JAVAC=$ac_cv_path_JAVAC
+# Check whether --with-os-type or --without-os-type was given.
+if test "${with_os_type+set}" = set; then
+  withval="$with_os_type"
 
-if test -n "$JAVAC"; then
-  echo "$as_me:$LINENO: result: $JAVAC" >&5
-echo "${ECHO_T}$JAVAC" >&6
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-  else
-    # Extract the first word of "javac-sablevm", so it can be a program name with args.
-set dummy javac-sablevm; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_path_JAVAC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  case $JAVAC in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_JAVAC="$JAVAC" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $JAVA_HOME/bin
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_JAVAC="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-
-  test -z "$ac_cv_path_JAVAC" && ac_cv_path_JAVAC="NONE"
-  ;;
-esac
-fi
-JAVAC=$ac_cv_path_JAVAC
-
-if test -n "$JAVAC"; then
-  echo "$as_me:$LINENO: result: $JAVAC" >&5
-echo "${ECHO_T}$JAVAC" >&6
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-  fi
-  echo "$as_me:$LINENO: result: $JAVAC" >&5
-echo "${ECHO_T}$JAVAC" >&6
-  if test "$JAVAC" = "NONE"
-  then
-    { { echo "$as_me:$LINENO: error: javac not found" >&5
-echo "$as_me: error: javac not found" >&2;}
+    tempval=$withval
+    if test ! -d "$JAVA_HOME/$tempval"
+    then
+      { { echo "$as_me:$LINENO: error: Not a directory: ${JAVA_HOME}/${tempval}" >&5
+echo "$as_me: error: Not a directory: ${JAVA_HOME}/${tempval}" >&2;}
    { (exit 1); exit 1; }; }
-  fi
+    fi
+    JAVA_OS=$tempval
 
-  echo "$as_me:$LINENO: checking wether the Java compiler ($JAVAC) works" >&5
-echo $ECHO_N "checking wether the Java compiler ($JAVAC) works... $ECHO_C" >&6
-if test "${ap_cv_prog_javac_works+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
-    echo "public class Test {}" > Test.java
-    $JAVAC $JAVACFLAGS Test.java > /dev/null 2>&1
-    if test $? -eq 0
+    echo "$as_me:$LINENO: checking for JDK os include directory" >&5
+echo $ECHO_N "checking for JDK os include directory... $ECHO_C" >&6
+    JAVA_OS=NONE
+    if test -f $JAVA_HOME/$JAVA_INC/jni_md.h
     then
-      rm -f Test.java Test.class
-      ap_cv_prog_javac_works=yes
+      JAVA_OS=""
     else
-      rm -f Test.java Test.class
-      echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-      { { echo "$as_me:$LINENO: error: installation or configuration problem: javac cannot compile" >&5
-echo "$as_me: error: installation or configuration problem: javac cannot compile" >&2;}
+      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
+        echo "$as_me:$LINENO: result: Cannot find jni_md.h in ${JAVA_HOME}/${OS}" >&5
+echo "${ECHO_T}Cannot find jni_md.h in ${JAVA_HOME}/${OS}" >&6
+        { { echo "$as_me:$LINENO: error: You should retry --with-os-type=SUBDIR" >&5
+echo "$as_me: error: You should retry --with-os-type=SUBDIR" >&2;}
    { (exit 1); exit 1; }; }
+      fi
     fi
 
-fi
-echo "$as_me:$LINENO: result: $ap_cv_prog_javac_works" >&5
-echo "${ECHO_T}$ap_cv_prog_javac_works" >&6
-
-
-
-
-
-
-  if test "$SABLEVM" != "NONE"
-  then
-    # Extract the first word of "jar-sablevm", so it can be a program name with args.
-set dummy jar-sablevm; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_path_JARSABLE+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  case $JARSABLE in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_JARSABLE="$JARSABLE" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $JAVA_HOME/bin
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_JARSABLE="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-
-  test -z "$ac_cv_path_JARSABLE" && ac_cv_path_JARSABLE="NONE"
-  ;;
-esac
-fi
-JARSABLE=$ac_cv_path_JARSABLE
-
-if test -n "$JARSABLE"; then
-  echo "$as_me:$LINENO: result: $JARSABLE" >&5
-echo "${ECHO_T}$JARSABLE" >&6
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-  else
-    JARSABLE="NONE"
-  fi
-  if test "$JARSABLE" = "NONE"
-  then
-    XPATH="$JAVA_HOME/bin:$JAVA_HOME/Commands:$PATH"
-    # Extract the first word of "jar", so it can be a program name with args.
-set dummy jar; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_path_JAR+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  case $JAR in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_JAR="$JAR" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $XPATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_JAR="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-
-  test -z "$ac_cv_path_JAR" && ac_cv_path_JAR="NONE"
-  ;;
-esac
-fi
-JAR=$ac_cv_path_JAR
-
-if test -n "$JAR"; then
-  echo "$as_me:$LINENO: result: $JAR" >&5
-echo "${ECHO_T}$JAR" >&6
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-  else
-    # Extract the first word of "jar-sablevm", so it can be a program name with args.
-set dummy jar-sablevm; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_path_JAR+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  case $JAR in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_JAR="$JAR" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $JAVA_HOME/bin
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_JAR="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-
-  test -z "$ac_cv_path_JAR" && ac_cv_path_JAR="NONE"
-  ;;
-esac
-fi
-JAR=$ac_cv_path_JAR
-
-if test -n "$JAR"; then
-  echo "$as_me:$LINENO: result: $JAR" >&5
-echo "${ECHO_T}$JAR" >&6
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-  fi
-  if test "$JAR" = "NONE"
-  then
-    { { echo "$as_me:$LINENO: error: jar not found" >&5
-echo "$as_me: error: jar not found" >&2;}
-   { (exit 1); exit 1; }; }
-  fi
-
-
+fi;
 
-if test "$supported_os" != "darwin"
+if test -z "${JAVA_OS}"
 then
+  echo "$as_me:$LINENO: result: jni_md.h found in $JAVA_HOME/$JAVA_INC" >&5
+echo "${ECHO_T}jni_md.h found in $JAVA_HOME/$JAVA_INC" >&6
+  INCLUDES="$INCLUDES -I$JAVA_HOME/include -I$JAVA_HOME/$JAVA_INC"
+else
   INCLUDES="$INCLUDES -I$JAVA_HOME/include -I$JAVA_HOME/include/$supported_os"
 fi
 
@@ -3857,13 +3532,6 @@ s, at ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
 s, at STRIP@,$STRIP,;t t
 s, at ac_ct_STRIP@,$ac_ct_STRIP,;t t
 s, at JAVA_HOME@,$JAVA_HOME,;t t
-s, at SABLEVM@,$SABLEVM,;t t
-s, at KAFFEVM@,$KAFFEVM,;t t
-s, at JAVACSABLE@,$JAVACSABLE,;t t
-s, at JAVAC@,$JAVAC,;t t
-s, at JAVACFLAGS@,$JAVACFLAGS,;t t
-s, at JARSABLE@,$JARSABLE,;t t
-s, at JAR@,$JAR,;t t
 s, at LDCMD@,$LDCMD,;t t
 s, at INCLUDES@,$INCLUDES,;t t
 s, at LIBOBJS@,$LIBOBJS,;t t
diff --git a/src/native/unix/configure.in b/src/native/unix/configure.in
index 1b6aecd..831af80 100644
--- a/src/native/unix/configure.in
+++ b/src/native/unix/configure.in
@@ -17,7 +17,7 @@ dnl
 
 dnl -------------------------------------------------------------------------
 dnl Author  Pier Fumagalli <mailto:pier.fumagalli at eng.sun.com>
-dnl Version $Id: configure.in 1003756 2010-10-02 08:59:48Z mturk $
+dnl Version $Id: configure.in 1194902 2011-10-29 15:19:18Z mturk $
 dnl -------------------------------------------------------------------------
 
 dnl -------------------------------------------------------------------------
@@ -80,13 +80,20 @@ dnl -------------------------------------------------------------------------
 dnl Check JAVA environment
 dnl -------------------------------------------------------------------------
 AP_MSG_HEADER([Java compilation tools])
-AP_JAVA()
-AP_SABLEVM()
-AP_KAFFE()
-AP_PROG_JAVAC()
-AP_PROG_JAR()
-if test "$supported_os" != "darwin"
+AP_FIND_JAVA()
+dnl MAC OS X does not used include but Headers
+if test -d $JAVA_HOME/Headers
 then
+  JAVA_INC=Headers
+else
+  JAVA_INC=include
+fi
+AP_FIND_JAVA_OS()
+if test -z "${JAVA_OS}"
+then
+  AC_MSG_RESULT([jni_md.h found in $JAVA_HOME/$JAVA_INC])
+  INCLUDES="$INCLUDES -I$JAVA_HOME/include -I$JAVA_HOME/$JAVA_INC"
+else
   INCLUDES="$INCLUDES -I$JAVA_HOME/include -I$JAVA_HOME/include/$supported_os"
 fi
 
diff --git a/src/native/unix/man/jsvc.1.xml b/src/native/unix/man/jsvc.1.xml
index 392bcc6..d8dc321 100644
--- a/src/native/unix/man/jsvc.1.xml
+++ b/src/native/unix/man/jsvc.1.xml
@@ -47,6 +47,7 @@
       <arg choice='opt'>-check</arg>
       <arg choice='opt'>-user <replaceable>user</replaceable></arg>
       <arg choice='opt'>-wait <replaceable>waittime</replaceable></arg>
+      <arg choice='opt'>-umask <replaceable>mask</replaceable></arg>
       <arg choice='opt'>-stop</arg>
       <arg choice='opt'>-verbose<replaceable>:class|gc|jni</replaceable></arg>
       <arg choice='opt'>-outfile <replaceable>/full/path/to/file</replaceable></arg>
@@ -146,6 +147,13 @@
         </listitem>
       </varlistentry>
       <varlistentry>
+        <term><option>-umask</option> mask</term>
+        <listitem>
+          <para>sets the file mode creation mask
+          </para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
         <term><option>-user</option> user</term>
         <listitem>
           <para>user used to run the daemon (defaults to current user)</para>
diff --git a/src/native/unix/native/arguments.c b/src/native/unix/native/arguments.c
index 16fc117..35c5afe 100644
--- a/src/native/unix/native/arguments.c
+++ b/src/native/unix/native/arguments.c
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-/* @version $Id: arguments.c 1133502 2011-06-08 18:31:29Z mturk $ */
+/* @version $Id: arguments.c 1196468 2011-11-02 06:24:11Z mturk $ */
 #include "jsvc.h"
 #include <limits.h>
 #include <glob.h>
@@ -171,6 +171,11 @@ static arg_data *parse(int argc, char *argv[])
     args->errfile = "/dev/null";   /* Swallow by default */
     args->redirectstdin = true;    /* Redirect stdin to /dev/null by default */
     args->procname = "jsvc.exec";
+#ifndef JSVC_UMASK
+    args->umask   = 0077;
+#else
+    args->umask   = JSVC_UMASK;
+#endif
 
     if (!(args->args = (char **)malloc(argc * sizeof(char *))))
         return NULL;
@@ -262,6 +267,18 @@ static arg_data *parse(int argc, char *argv[])
                 return NULL;
             }
         }
+        else if (!strcmp(argv[x], "-umask")) {
+            temp = optional(argc, argv, x++);
+            if (temp == NULL) {
+                log_error("Invalid umask specified");
+                return NULL;
+            }
+            args->umask = atoi(temp);
+            if (args->umask < 02) {
+                log_error("Invalid umask specified (min=02)");
+                return NULL;
+            }
+        }
         else if (!strcmp(argv[x], "-stop")) {
             args->stop = true;
         }
@@ -308,17 +325,6 @@ static arg_data *parse(int argc, char *argv[])
         else if (!strncmp(argv[x], "-verbose", 8)) {
             args->opts[args->onum++] = strdup(argv[x]);
         }
-#ifdef HAVE_KAFFEVM
-        else if (!strncmp(argv[x], "-vmdebug", 8)) {
-            args->opts[args->onum++] = strdup(argv[x]);
-            temp = optional(argc,argv,x++);
-            if (temp == NULL) {
-                log_error("vmdebug option requires a debug flag.");
-                return NULL;
-            }
-            args->opts[args->onum++] = strdup(temp);
-        }
-#endif
         else if (!strcmp(argv[x], "-D")) {
             log_error("Parameter -D must be followed by <name>=<value>");
             return NULL;
diff --git a/src/native/unix/native/arguments.h b/src/native/unix/native/arguments.h
index 0f2a8a4..fc6ea56 100644
--- a/src/native/unix/native/arguments.h
+++ b/src/native/unix/native/arguments.h
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-/* @version $Id: arguments.h 923078 2010-03-15 06:35:01Z mturk $ */
+/* @version $Id: arguments.h 1196265 2011-11-01 20:43:52Z mturk $ */
 #ifndef __JSVC_ARGUMENTS_H__
 #define __JSVC_ARGUMENTS_H__
 
@@ -69,10 +69,12 @@ typedef struct {
     char *outfile;
     /** Destination for stderr */
     char *errfile;
-    /** Program name for Linux **/
+    /** Program name **/
     char *procname;
     /** Whether to redirect stdin to /dev/null or not. Defaults to true **/
     bool redirectstdin;
+    /** What umask to use **/
+    int umask;
 } arg_data;
 
 /**
diff --git a/src/native/unix/native/debug.c b/src/native/unix/native/debug.c
index aab484e..d23e7db 100644
--- a/src/native/unix/native/debug.c
+++ b/src/native/unix/native/debug.c
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-/* @version $Id: debug.c 982549 2010-08-05 11:43:42Z mturk $ */
+/* @version $Id: debug.c 1198399 2011-11-06 16:20:44Z mturk $ */
 #include "jsvc.h"
 #include <sys/types.h>
 #include <unistd.h>
@@ -32,7 +32,7 @@ bool log_stdout_syslog_flag = false;
 /* The name of the jsvc binary. */
 char *log_prog = "jsvc";
 
-/* Dump a debug message to stderr */
+/* Dump a debug trace message to stderr */
 void log_debug(const char *fmt, ...)
 {
     va_list ap;
@@ -45,13 +45,16 @@ void log_debug(const char *fmt, ...)
     if (fmt == NULL)
         return;
 
+    now   = time(NULL);
+    nowtm = localtime(&now);
+    strftime(buff, sizeof(buff), "%Y-%m-%d %T", nowtm);
     va_start(ap, fmt);
-    if (log_stderr_syslog_flag) {
-        now   = time(NULL);
-        nowtm = localtime(&now);
-        strftime(buff, sizeof(buff), "%d/%m/%Y %T", nowtm);
+    if (log_stderr_syslog_flag)
         fprintf(stderr, "%s %d %s debug: ", buff, getpid(), log_prog);
-    }
+#if defined(DEBUG) || defined(_DEBUG)
+    else
+        fprintf(stderr, "[debug] %s %d ", buff, getpid());
+#endif
     vfprintf(stderr, fmt, ap);
     fprintf(stderr, "\n");
     fflush(stderr);
@@ -73,7 +76,7 @@ void log_error(const char *fmt, ...)
     if (log_stderr_syslog_flag) {
         now   = time(NULL);
         nowtm = localtime(&now);
-        strftime(buff, sizeof(buff), "%d/%m/%Y %T", nowtm);
+        strftime(buff, sizeof(buff), "%Y-%m-%d %T", nowtm);
         fprintf(stderr, "%s %d %s error: ", buff, getpid(), log_prog);
     }
     vfprintf(stderr, fmt, ap);
diff --git a/src/native/unix/native/help.c b/src/native/unix/native/help.c
index a5cba23..0e7021c 100644
--- a/src/native/unix/native/help.c
+++ b/src/native/unix/native/help.c
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-/* @version $Id: help.c 1133502 2011-06-08 18:31:29Z mturk $ */
+/* @version $Id: help.c 1196265 2011-11-01 20:43:52Z mturk $ */
 #include "jsvc.h"
 
 void help(home_data *data)
@@ -90,7 +90,7 @@ void help(home_data *data)
     printf("    -javaagent:<jarpath>[=<options>]\n");
     printf("        load Java programming language agent, see java.lang.instrument\n");
     printf("    -procname <procname>\n");
-    printf("        use the specified process name (works only for Linux)\n");
+    printf("        use the specified process name\n");
     printf("    -wait <waittime>\n");
     printf("        wait waittime seconds for the service to start\n");
     printf("        waittime should multiple of 10 (min=10)\n");
diff --git a/src/native/unix/native/java.c b/src/native/unix/native/java.c
index 2d22fdb..62aec13 100644
--- a/src/native/unix/native/java.c
+++ b/src/native/unix/native/java.c
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-/* @version $Id: java.c 1130635 2011-06-02 16:29:44Z mturk $ */
+/* @version $Id: java.c 1196468 2011-11-02 06:24:11Z mturk $ */
 #include "jsvc.h"
 
 #ifdef OS_CYGWIN
@@ -166,8 +166,7 @@ bool java_init(arg_data *args, home_data *data)
     }
 
     /* Load the JVM library */
-#if defined(OSD_POSIX) || defined(HAVE_KAFFEVM)
-#else
+#if !defined(OSD_POSIX)
     libh = dso_link(libf);
     if (libh == NULL) {
         log_error("Cannot dynamically link to %s", libf);
@@ -211,8 +210,8 @@ bool java_init(arg_data *args, home_data *data)
     }
     log_debug("Shell library %s loaded", appf);
 #endif /* ifdef OS_DARWIN */
-#if defined(OSD_POSIX) || defined(HAVE_KAFFEVM)
-    /* BS2000 and kaffe does not allow to call JNI_CreateJavaVM indirectly */
+#if defined(OSD_POSIX)
+    /* BS2000 does not allow to call JNI_CreateJavaVM indirectly */
 #else
     symb = (jvm_create_t)dso_symbol(libh, "JNI_CreateJavaVM");
     if (symb == NULL) {
@@ -240,13 +239,7 @@ bool java_init(arg_data *args, home_data *data)
 #else
     arg.version = JNI_VERSION_1_2;
 #endif
-#if defined(OSD_POSIX) || defined(HAVE_KAFFEVM)
-
-#if defined(HAVE_KAFFEVM)
-    memset(&arg, 0, sizeof(arg));
-    arg.version = JNI_VERSION_1_4;
-#endif
-
+#if defined(OSD_POSIX)
     if (JNI_GetDefaultJavaVMInitArgs(&arg) < 0) {
         log_error("Cannot init default JVM default args");
         return false;
@@ -308,7 +301,7 @@ bool java_init(arg_data *args, home_data *data)
     }
 
     /* And finally create the Java VM */
-#if defined(OSD_POSIX) || defined(HAVE_KAFFEVM)
+#if defined(OSD_POSIX)
     ret = JNI_CreateJavaVM(&jvm, &env, &arg);
 #else
     ret = (*symb) (&jvm, &env, &arg);
@@ -328,9 +321,6 @@ bool java_init(arg_data *args, home_data *data)
     }
     log_debug("Class %s found", loaderclass);
 
-#if defined(HAVE_SABLEVM)
-    log_debug("sableVM doesn't support RegisterNatives");
-#else
     jsvc_xlate_to_ascii(shutdownmethod);
     nativemethods[0].name = shutdownmethod;
     jsvc_xlate_to_ascii(shutdownparams);
@@ -347,7 +337,6 @@ bool java_init(arg_data *args, home_data *data)
         return false;
     }
     log_debug("Native methods registered");
-#endif
 
     return true;
 }
diff --git a/src/native/unix/native/jsvc-unix.c b/src/native/unix/native/jsvc-unix.c
index eff5dd2..83ce771 100644
--- a/src/native/unix/native/jsvc-unix.c
+++ b/src/native/unix/native/jsvc-unix.c
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-/* @version $Id: jsvc-unix.c 1152701 2011-08-01 08:03:41Z mturk $ */
+/* @version $Id: jsvc-unix.c 1198399 2011-11-06 16:20:44Z mturk $ */
 #include "jsvc.h"
 
 #include <signal.h>
@@ -45,9 +45,6 @@
 #define F_ULOCK 0               /* Unlock a previously locked region */
 #define F_LOCK  1               /* Lock a region for exclusive use */
 #endif
-#ifndef JSVC_UMASK
-#define JSVC_UMASK 0077
-#endif
 extern char **environ;
 
 static mode_t envmask;          /* mask to create the files */
@@ -470,14 +467,15 @@ static int check_pid(arg_data *args)
 /*
  * read the pid from the pidfile
  */
-static int get_pidf(arg_data *args)
+static int get_pidf(arg_data *args, bool quiet)
 {
     int fd;
     int i;
     char buff[80];
 
     fd = open(args->pidf, O_RDONLY, 0);
-    log_debug("get_pidf: %d in %s", fd, args->pidf);
+    if (!quiet)
+        log_debug("get_pidf: %d in %s", fd, args->pidf);
     if (fd < 0) {
         /* something has gone wrong the JVM has stopped */
         return -1;
@@ -489,7 +487,8 @@ static int get_pidf(arg_data *args)
     if (i > 0) {
         buff[i] = '\0';
         i = atoi(buff);
-        log_debug("get_pidf: pid %d", i);
+        if (!quiet)
+            log_debug("get_pidf: pid %d", i);
         if (kill(i, 0) == 0)
             return i;
     }
@@ -510,7 +509,7 @@ static int check_tmp_file(arg_data *args)
     char buff[80];
     int fd;
 
-    pid = get_pidf(args);
+    pid = get_pidf(args, false);
     if (pid < 0)
         return -1;
     sprintf(buff, "/tmp/%d.jsvc_up", pid);
@@ -613,8 +612,8 @@ static int wait_child(arg_data *args, int pid)
  */
 static int stop_child(arg_data *args)
 {
-    int pid = get_pidf(args);
-    int count = 10;
+    int pid = get_pidf(args, false);
+    int count = 60;
 
     if (pid > 0) {
         /* kill the process and wait until the pidfile has been
@@ -622,8 +621,8 @@ static int stop_child(arg_data *args)
          */
         kill(pid, SIGTERM);
         while (count > 0) {
-            sleep(6);
-            pid = get_pidf(args);
+            sleep(1);
+            pid = get_pidf(args, true);
             if (pid <= 0) {
                 /* JVM has stopped */
                 return 0;
@@ -735,7 +734,7 @@ static int child(arg_data *args, home_data *data, uid_t uid, gid_t gid)
     log_debug("Waiting for a signal to be delivered");
     create_tmp_file(args);
     while (!stopping) {
-#if defined(OSD_POSIX) || defined(HAVE_KAFFEVM)
+#if defined(OSD_POSIX)
         java_sleep(60);
         /* pause(); */
 #else
@@ -1092,13 +1091,13 @@ int main(int argc, char *argv[])
     /*
      * umask() uses inverse logic; bits are CLEAR for allowed access.
      */
-    if ((~JSVC_UMASK) & 0022) {
+    if (~args->umask & 0022) {
         log_error("NOTICE: jsvc umask of %03o allows "
-                  "write permission to group and/or other", JSVC_UMASK);
+                  "write permission to group and/or other", args->umask);
     }
-    envmask = umask(JSVC_UMASK);
+    envmask = umask(args->umask);
     set_output(args->outfile, args->errfile, args->redirectstdin, args->procname);
-    log_debug("Switching umask back to %03o from %03o", envmask, JSVC_UMASK);
+    log_debug("Switching umask back to %03o from %03o", envmask, args->umask);
     res = run_controller(args, data, uid, gid);
     if (logger_pid != 0) {
         kill(logger_pid, SIGTERM);
diff --git a/src/native/unix/native/location.c b/src/native/unix/native/location.c
index e234daa..67784f2 100644
--- a/src/native/unix/native/location.c
+++ b/src/native/unix/native/location.c
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-/* @version $Id: location.c 1023267 2010-10-16 12:16:26Z mturk $ */
+/* @version $Id: location.c 1199195 2011-11-08 11:30:20Z mturk $ */
 #include "jsvc.h"
 
 /* Locations of various JVM files. We have to deal with all this madness since
@@ -35,6 +35,8 @@ char *location_home[] = {
 #elif defined(OS_LINUX) || defined(OS_SOLARIS) || defined(OS_BSD)
     "/usr/java",
     "/usr/local/java",
+    "/etc/alternatives/java_sdk",
+    "/etc/alternatives/jre",
 #elif defined(OS_CYGWIN)
     "/cygdrive/c/WINNT/system32/java",
 #elif defined(OS_SYSV)
@@ -44,6 +46,8 @@ char *location_home[] = {
     "/usr/opt/java142",
     "/usr/opt/java13",
 #elif defined(OS_HPUX)
+    "/opt/java6",
+    "/opt/java1.5",
     "/opt/java1.4",
     "/opt/java1.3",
 #endif
@@ -74,12 +78,6 @@ char *location_jvm_default[] = {
     "$JAVA_HOME/jre/bin/classic/jvm.dll",               /* Sun JDK 1.3 */
     "$JAVA_HOME/jre/bin/client/jvm.dll",                /* Sun JDK 1.4 */
 #elif defined(OS_LINUX) || defined(OS_SOLARIS) || defined(OS_BSD) || defined(OS_SYSV) || defined(OS_FREEBSD) || defined(OS_TRU64)
-#if defined(HAVE_SABLEVM)
-    "$JAVA_HOME/lib/libsablevm.so",                     /* sableVM */
-#endif
-#if defined(HAVE_KAFFEVM)
-    "$JAVA_HOME/jre/lib/" CPU "/libkaffevm.so",         /* kaffe */
-#endif
     "$JAVA_HOME/jre/lib/" CPU "/classic/libjvm.so",     /* Sun JDK 1.2 */
     "$JAVA_HOME/jre/lib/" CPU "/server/libjvm.so",      /* Sun JDK 1.4 */
     "$JAVA_HOME/jre/lib/" CPU "/client/libjvm.so",      /* Sun JDK 1.3 */
@@ -117,10 +115,10 @@ char *location_jvm_default[] = {
     "$JAVA_HOME/lib/" CPU "/fast64/libjvm.so",
     "$JAVA_HOME/lib/" CPU "/fast32/libjvm.so",
 #elif defined(OS_HPUX)
-    "$JAVA_HOME/jre/lib/" CPU "/server/libjvm.sl",
-    "$JAVA_HOME/jre/lib/" CPU "/client/libjvm.sl",
-    "$JAVA_HOME/jre/lib/" CPU "/hotspot/libjvm.sl",
-    "$JAVA_HOME/jre/lib/" CPU "/classic/libjvm.sl",
+    "$JAVA_HOME/jre/lib/" CPU "/server/libjvm." SO_EXT,
+    "$JAVA_HOME/jre/lib/" CPU "/client/libjvm." SO_EXT,
+    "$JAVA_HOME/jre/lib/" CPU "/hotspot/libjvm." SO_EXT,
+    "$JAVA_HOME/jre/lib/" CPU "/classic/libjvm." SO_EXT,
 #endif
     "/usr/lib/libgcj.so.7",     /* gcc java libraries */
     "/usr/lib/libgcj.so.6",
@@ -140,8 +138,8 @@ char *location_jvm_configured[] = {
     "$JAVA_HOME/jre/lib/" CPU "/$VM_NAME/libjvm.so",    /* Sun JDK 1.3 */
     "$JAVA_HOME/lib/" CPU "/$VM_NAME/libjvm.so",        /* Sun JRE 1.3 */
 #elif defined(OS_HPUX)
-    "$JAVA_HOME/jre/lib/" CPU "/$VM_NAME/libjvm.sl",
-    "$JAVA_HOME/lib/" CPU "/$VM_NAME/libjvm.sl",
+    "$JAVA_HOME/jre/lib/" CPU "/$VM_NAME/libjvm." SO_EXT,
+    "$JAVA_HOME/lib/" CPU "/$VM_NAME/libjvm." SO_EXT,
 #elif defined(OS_SYSV)
     "$JAVA_HOME/jre/lib/" CPU "/$VM_NAME/dce_threads/libjvm.so",
     "$JAVA_HOME/jre/lib/" CPU "/$VM_NAME/green_threads/libjvm.so",
diff --git a/src/native/unix/native/version.h b/src/native/unix/native/version.h
index 51623a1..03b9962 100644
--- a/src/native/unix/native/version.h
+++ b/src/native/unix/native/version.h
@@ -31,7 +31,7 @@
 #define JSVC_MINOR_VERSION      0
 
 /** patch level */
-#define JSVC_PATCH_VERSION      7
+#define JSVC_PATCH_VERSION      8
 
 /**
  *  This symbol is defined for internal, "development" copies of JSVC.
diff --git a/src/native/unix/support/apjava.m4 b/src/native/unix/support/apjava.m4
index eafda99..12c5c28 100644
--- a/src/native/unix/support/apjava.m4
+++ b/src/native/unix/support/apjava.m4
@@ -16,76 +16,12 @@ dnl limitations under the License.
 dnl
 
 dnl -------------------------------------------------------------------------
-dnl Author  Pier Fumagalli <mailto:pier.fumagalli at eng.sun.com>
-dnl Version $Id: apjava.m4 480469 2006-11-29 08:22:04Z bayard $
+dnl Author  Pier Fumagalli
+dnl Author  Mladen Turk
+dnl Version $Id: apjava.m4 1196262 2011-11-01 20:35:39Z mturk $
 dnl -------------------------------------------------------------------------
 
-AC_DEFUN([AP_PROG_JAVAC_WORKS],[
-  AC_CACHE_CHECK([wether the Java compiler ($JAVAC) works],ap_cv_prog_javac_works,[
-    echo "public class Test {}" > Test.java
-    $JAVAC $JAVACFLAGS Test.java > /dev/null 2>&1
-    if test $? -eq 0
-    then
-      rm -f Test.java Test.class
-      ap_cv_prog_javac_works=yes
-    else
-      rm -f Test.java Test.class
-      AC_MSG_RESULT(no)
-      AC_MSG_ERROR([installation or configuration problem: javac cannot compile])
-    fi
-  ])
-])
-
-dnl Check for JAVA compilers.
-AC_DEFUN([AP_PROG_JAVAC],[
-  if test "$SABLEVM" != "NONE"
-  then
-    AC_PATH_PROG(JAVACSABLE,javac-sablevm,NONE,$JAVA_HOME/bin)
-  else
-    JAVACSABLE="NONE"
-  fi
-  if test "$JAVACSABLE" = "NONE"
-  then
-    XPATH="$JAVA_HOME/bin:$JAVA_HOME/Commands:$PATH"
-    AC_PATH_PROG(JAVAC,javac,NONE,$XPATH)
-  else
-    AC_PATH_PROG(JAVAC,javac-sablevm,NONE,$JAVA_HOME/bin)
-  fi
-  AC_MSG_RESULT([$JAVAC])
-  if test "$JAVAC" = "NONE"
-  then
-    AC_MSG_ERROR([javac not found])
-  fi
-  AP_PROG_JAVAC_WORKS()
-  AC_PROVIDE([$0])
-  AC_SUBST(JAVAC)
-  AC_SUBST(JAVACFLAGS)
-])
-
-dnl Check for jar archivers.
-AC_DEFUN([AP_PROG_JAR],[
-  if test "$SABLEVM" != "NONE"
-  then
-    AC_PATH_PROG(JARSABLE,jar-sablevm,NONE,$JAVA_HOME/bin)
-  else
-    JARSABLE="NONE"
-  fi
-  if test "$JARSABLE" = "NONE"
-  then
-    XPATH="$JAVA_HOME/bin:$JAVA_HOME/Commands:$PATH"
-    AC_PATH_PROG(JAR,jar,NONE,$XPATH)
-  else
-    AC_PATH_PROG(JAR,jar-sablevm,NONE,$JAVA_HOME/bin)
-  fi
-  if test "$JAR" = "NONE"
-  then
-    AC_MSG_ERROR([jar not found])
-  fi
-  AC_PROVIDE([$0])
-  AC_SUBST(JAR)
-])
-
-AC_DEFUN([AP_JAVA],[
+AC_DEFUN([AP_FIND_JAVA],[
   AC_ARG_WITH(java,[  --with-java=DIR         Specify the location of your JDK installation],[
     AC_MSG_CHECKING([JAVA_HOME])
     if test -d "$withval"
@@ -98,45 +34,61 @@ AC_DEFUN([AP_JAVA],[
     fi
     AC_SUBST(JAVA_HOME)
   ])
-  if test x"$JAVA_HOME" = x
-  then
-    AC_MSG_ERROR([Java Home not defined. Rerun with --with-java=[...] parameter])
-  fi
-])
-
-dnl check if the JVM in JAVA_HOME is sableVM
-dnl $JAVA_HOME/bin/sablevm and /opt/java/lib/sablevm/bin are tested.
-AC_DEFUN([AP_SABLEVM],[
-  if test x"$JAVA_HOME" != x
+  if test "x$JAVA_HOME" = x
   then
-    AC_PATH_PROG(SABLEVM,sablevm,NONE,$JAVA_HOME/bin)
-    if test "$SABLEVM" = "NONE"
+    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
-      dnl java may be SableVM.
-      if $JAVA_HOME/bin/java -version 2> /dev/null | grep SableVM > /dev/null
+      java_bin="`dirname $java_prog`"
+      java_top="`dirname $java_bin`"
+      if test -f "$java_top/include/jni.h"
       then
-        SABLEVM=$JAVA_HOME/bin/java
+        JAVA_HOME="$java_top"
+        AC_MSG_RESULT([${java_top}])
       fi
     fi
-    if test "$SABLEVM" != "NONE"
-    then
-      AC_MSG_RESULT([Using sableVM: $SABLEVM])
-      CFLAGS="$CFLAGS -DHAVE_SABLEVM"
-    fi
+  fi
+  if test x"$JAVA_HOME" = x
+  then
+    AC_MSG_ERROR([Java Home not defined. Rerun with --with-java=[...] parameter])
   fi
 ])
 
-dnl check if the JVM in JAVA_HOME is kaffe
-dnl $JAVA_HOME/bin/kaffe is tested.
-AC_DEFUN([AP_KAFFE],[
-  if test x"$JAVA_HOME" != x
-  then
-    AC_PATH_PROG(KAFFEVM,kaffe,NONE,$JAVA_HOME/bin)
-    if test "$KAFFEVM" != "NONE"
+AC_DEFUN([AP_FIND_JAVA_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_RESULT([Using kaffe: $KAFFEVM])
-      CFLAGS="$CFLAGS -DHAVE_KAFFEVM"
-      LDFLAGS="$LDFLAGS -Wl,-rpath $JAVA_HOME/jre/lib/$HOST_CPU -L $JAVA_HOME/jre/lib/$HOST_CPU -lkaffevm"
+      AC_MSG_ERROR(Not a directory: ${JAVA_HOME}/${tempval})
     fi
-  fi
+    JAVA_OS=$tempval
+  ],
+  [
+    AC_MSG_CHECKING(for JDK os include 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"
+            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
+  ])
 ])
diff --git a/src/native/unix/support/apsupport.m4 b/src/native/unix/support/apsupport.m4
index 1714709..8caf4ad 100644
--- a/src/native/unix/support/apsupport.m4
+++ b/src/native/unix/support/apsupport.m4
@@ -17,7 +17,7 @@ dnl
 
 dnl -------------------------------------------------------------------------
 dnl Author  Pier Fumagalli <mailto:pier.fumagalli at eng.sun.com>
-dnl Version $Id: apsupport.m4 1130610 2011-06-02 15:33:05Z mturk $
+dnl Version $Id: apsupport.m4 1199663 2011-11-09 08:59:08Z mturk $
 dnl -------------------------------------------------------------------------
 
 AC_DEFUN(AP_SUPPORTED_HOST,[
@@ -60,10 +60,11 @@ AC_DEFUN(AP_SUPPORTED_HOST,[
     CFLAGS="$CFLAGS -pthread -DOS_TRU64 -DDSO_DLFCN -D_XOPEN_SOURCE_EXTENDED"
     LDFLAGS="$LDFLAGS -pthread"
     ;;
-  hpux11*)
+  hpux*)
     CFLAGS="$CFLAGS -pthread -DOS_HPUX -DDSO_DLFCN"
     LDFLAGS="$LDFLAGS -pthread"
     LIBS="$LIBS -lpthread"
+    supported_os="hp-ux"
     ;;
   aix5*)
     CFLAGS="$CFLAGS -DOS_AIX -DDSO_DLFCN"
@@ -81,7 +82,7 @@ AC_DEFUN(AP_SUPPORTED_HOST,[
   sparc*)
     CFLAGS="$CFLAGS -DCPU=\\\"$host_cpu\\\""
     HOST_CPU=$host_cpu;;
-  i?86)
+  i?86|x86)
     CFLAGS="$CFLAGS -DCPU=\\\"i386\\\""
     HOST_CPU=i386;;
   x86_64 | amd64)
@@ -102,22 +103,39 @@ AC_DEFUN(AP_SUPPORTED_HOST,[
     CFLAGS="$CFLAGS -DCPU=\\\"alpha\\\""
     supported_os="alpha"
     HOST_CPU=alpha;;
-  hppa2.0w)
-    CFLAGS="$CFLAGS -DCPU=\\\"PA_RISC2.0W\\\""
-    supported_os="hp-ux"
+  hppa2.0w|hppa64)
+    CFLAGS="$CFLAGS -DCPU=\\\"PA_RISC2.0W\\\" -DSO_EXT=\\\"sl\\\""
     HOST_CPU=PA_RISC2.0W;;
+  hppa2.0n)
+    CFLAGS="$CFLAGS -DCPU=\\\"PA_RISC2.0N\\\" -DSO_EXT=\\\"sl\\\""
+    HOST_CPU=PA_RISC2.0N;;
   hppa2.0)
-    CFLAGS="$CFLAGS -DCPU=\\\"PA_RISC2.0\\\""
-    supported_os="hp-ux"
+    CFLAGS="$CFLAGS -DCPU=\\\"PA_RISC2.0\\\" -DSO_EXT=\\\"sl\\\""
     HOST_CPU=PA_RISC2.0;;
   mipsel)
     CFLAGS="$CFLAGS -DCPU=\\\"mipsel\\\""
     supported_os="mipsel"
     HOST_CPU=mipsel;;
-  ia64)
-    CFLAGS="$CFLAGS -DCPU=\\\"ia64\\\""
-    supported_os="ia64"
+  ia64w)
+    if test "$supported_os" = "hp-ux"
+    then
+        CFLAGS="$CFLAGS -mlp64 -DCPU=\\\"IA64W\\\" -DSO_EXT=\\\"so\\\""
+        LDFLAGS="$LDFLAGS -mlp64"
+    else
+        CFLAGS="$CFLAGS -DCPU=\\\"ia64\\\""
+    fi
     HOST_CPU=ia64;;
+  ia64|ia64n)
+    if test "$supported_os" = "hp-ux"
+    then
+        CFLAGS="$CFLAGS -milp32 -DCPU=\\\"IA64N\\\" -DSO_EXT=\\\"so\\\""
+        LDFLAGS="$LDFLAGS -milp32"
+        HOST_CPU=IA64N
+    else
+        CFLAGS="$CFLAGS -DCPU=\\\"ia64\\\""
+        HOST_CPU=ia64
+    fi
+    ;;
   s390)
     CFLAGS="$CFLAGS -DCPU=\\\"s390\\\""
     supported_os="s390"
diff --git a/src/native/unix/support/config.sub b/src/native/unix/support/config.sub
old mode 100644
new mode 100755
index 93a3a14..25b4fd8
--- a/src/native/unix/support/config.sub
+++ b/src/native/unix/support/config.sub
@@ -1,9 +1,10 @@
 #! /bin/sh
 # Configuration validation subroutine script.
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
-#   Free Software Foundation, Inc.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+#   2011 Free Software Foundation, Inc.
 
-timestamp='2001-05-11'
+timestamp='2011-03-23'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -21,21 +22,26 @@ timestamp='2001-05-11'
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
 # configuration script generated by Autoconf, you may include it under
 # the same distribution terms that you use for the rest of that program.
 
-# Please send patches to <config-patches at gnu.org>.
+
+# Please send patches to <config-patches at gnu.org>.  Submit a context
+# diff and a properly formatted GNU ChangeLog entry.
 #
 # Configuration subroutine to validate and canonicalize a configuration type.
 # Supply the specified configuration type as an argument.
 # If it is invalid, we print an error message on stderr and exit with code 1.
 # Otherwise, we print the canonical config type on stdout and succeed.
 
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
 # This file is supposed to be the same for all GNU packages
 # and recognize all the CPU types, system types and aliases
 # that are meaningful with *any* GNU software.
@@ -69,8 +75,9 @@ Report bugs and patches to <config-patches at gnu.org>."
 version="\
 GNU config.sub ($timestamp)
 
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
-Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free
+Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -82,11 +89,11 @@ Try \`$me --help' for more information."
 while test $# -gt 0 ; do
   case $1 in
     --time-stamp | --time* | -t )
-       echo "$timestamp" ; exit 0 ;;
+       echo "$timestamp" ; exit ;;
     --version | -v )
-       echo "$version" ; exit 0 ;;
+       echo "$version" ; exit ;;
     --help | --h* | -h )
-       echo "$usage"; exit 0 ;;
+       echo "$usage"; exit ;;
     -- )     # Stop option processing
        shift; break ;;
     - )	# Use stdin as input.
@@ -98,7 +105,7 @@ while test $# -gt 0 ; do
     *local*)
        # First pass through any local machine types.
        echo $1
-       exit 0;;
+       exit ;;
 
     * )
        break ;;
@@ -117,7 +124,11 @@ esac
 # Here we must recognize all the valid KERNEL-OS combinations.
 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
-  nto-qnx* | linux-gnu* | storm-chaos* | os2-emx*)
+  nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
+  linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+  knetbsd*-gnu* | netbsd*-gnu* | \
+  kopensolaris*-gnu* | \
+  storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     ;;
@@ -143,10 +154,13 @@ case $os in
 	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
 	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
 	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-	-apple | -axis)
+	-apple | -axis | -knuth | -cray | -microblaze)
 		os=
 		basic_machine=$1
 		;;
+	-bluegene*)
+		os=-cnk
+		;;
 	-sim | -cisco | -oki | -wec | -winbond)
 		os=
 		basic_machine=$1
@@ -157,9 +171,21 @@ case $os in
 		os=-vxworks
 		basic_machine=$1
 		;;
+	-chorusos*)
+		os=-chorusos
+		basic_machine=$1
+		;;
+	-chorusrdb)
+		os=-chorusrdb
+		basic_machine=$1
+		;;
 	-hiux*)
 		os=-hiuxwe2
 		;;
+	-sco6)
+		os=-sco5v6
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
 	-sco5)
 		os=-sco3.2v5
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@@ -176,6 +202,10 @@ case $os in
 		# Don't forget version if it is 3.2v4 or newer.
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
 		;;
+	-sco5v6*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
 	-sco*)
 		os=-sco3.2v2
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@@ -215,34 +245,97 @@ esac
 case $basic_machine in
 	# Recognize the basic CPU types without company name.
 	# Some are omitted here because they have special meanings below.
-	tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc \
-	        | arm | arme[lb] | arm[bl]e | armv[2345] | armv[345][lb] | strongarm | xscale \
-		| pyramid | mn10200 | mn10300 | tron | a29k \
-		| 580 | i960 | h8300 \
-		| x86 | ppcbe | mipsbe | mipsle | shbe | shle \
-		| hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \
-		| hppa64 \
-		| alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \
-		| alphaev6[78] \
-		| we32k | ns16k | clipper | i370 | sh | sh[34] \
-		| powerpc | powerpcle \
-		| 1750a | dsp16xx | pdp10 | pdp11 \
-		| mips16 | mips64 | mipsel | mips64el \
-		| mips64orion | mips64orionel | mipstx39 | mipstx39el \
-		| mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \
-		| mips64vr5000 | miprs64vr5000el | mcore | s390 | s390x \
-		| sparc | sparclet | sparclite | sparc64 | sparcv9 | sparcv9b \
-		| v850 | c4x \
-		| thumb | d10v | d30v | fr30 | avr | openrisc | tic80 \
-		| pj | pjl | h8500 | z8k)
+	1750a | 580 \
+	| a29k \
+	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+	| am33_2.0 \
+	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+	| bfin \
+	| c4x | clipper \
+	| d10v | d30v | dlx | dsp16xx \
+	| fido | fr30 | frv \
+	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+	| i370 | i860 | i960 | ia64 | ia64[nw] \
+	| ip2k | iq2000 \
+	| lm32 \
+	| m32c | m32r | m32rle | m68000 | m68k | m88k \
+	| maxq | mb | microblaze | mcore | mep | metag \
+	| mips | mipsbe | mipseb | mipsel | mipsle \
+	| mips16 \
+	| mips64 | mips64el \
+	| mips64octeon | mips64octeonel \
+	| mips64orion | mips64orionel \
+	| mips64r5900 | mips64r5900el \
+	| mips64vr | mips64vrel \
+	| mips64vr4100 | mips64vr4100el \
+	| mips64vr4300 | mips64vr4300el \
+	| mips64vr5000 | mips64vr5000el \
+	| mips64vr5900 | mips64vr5900el \
+	| mipsisa32 | mipsisa32el \
+	| mipsisa32r2 | mipsisa32r2el \
+	| mipsisa64 | mipsisa64el \
+	| mipsisa64r2 | mipsisa64r2el \
+	| mipsisa64sb1 | mipsisa64sb1el \
+	| mipsisa64sr71k | mipsisa64sr71kel \
+	| mipstx39 | mipstx39el \
+	| mn10200 | mn10300 \
+	| moxie \
+	| mt \
+	| msp430 \
+	| nds32 | nds32le | nds32be \
+	| nios | nios2 \
+	| ns16k | ns32k \
+	| open8 \
+	| or32 \
+	| pdp10 | pdp11 | pj | pjl \
+	| powerpc | powerpc64 | powerpc64le | powerpcle \
+	| pyramid \
+	| rx \
+	| score \
+	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+	| sh64 | sh64le \
+	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+	| spu \
+	| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
+	| ubicom32 \
+	| v850 | v850e \
+	| we32k \
+	| x86 | xc16x | xstormy16 | xtensa \
+	| z8k | z80)
 		basic_machine=$basic_machine-unknown
 		;;
-	m6811 | m68hc11 | m6812 | m68hc12)
+	c54x)
+		basic_machine=tic54x-unknown
+		;;
+	c55x)
+		basic_machine=tic55x-unknown
+		;;
+	c6x)
+		basic_machine=tic6x-unknown
+		;;
+	m6811 | m68hc11 | m6812 | m68hc12 | picochip)
 		# Motorola 68HC11/12.
 		basic_machine=$basic_machine-unknown
 		os=-none
 		;;
-	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | w65 | z8k)
+	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+		;;
+	ms1)
+		basic_machine=mt-unknown
+		;;
+
+	strongarm | thumb | xscale)
+		basic_machine=arm-unknown
+		;;
+
+	xscaleeb)
+		basic_machine=armeb-unknown
+		;;
+
+	xscaleel)
+		basic_machine=armel-unknown
 		;;
 
 	# We use `pc' rather than `unknown'
@@ -257,31 +350,77 @@ case $basic_machine in
 		exit 1
 		;;
 	# Recognize the basic CPU types with company name.
-	# FIXME: clean up the formatting here.
-	vax-* | tahoe-* | i*86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \
-	      | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | c[123]* \
-	      | arm-*  | armbe-* | armle-* | armv*-* | strongarm-* | xscale-* \
-	      | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
-	      | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \
-	      | xmp-* | ymp-* \
-	      | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* \
-	      | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \
-	      | hppa2.0n-* | hppa64-* \
-	      | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \
-	      | alphaev6[78]-* \
-	      | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \
-	      | clipper-* | orion-* \
-	      | sparclite-* | pdp10-* | pdp11-* | sh-* | sh[34]-* | sh[34]eb-* \
-	      | powerpc-* | powerpcle-* | sparc64-* | sparcv9-* | sparcv9b-* | sparc86x-* \
-	      | mips16-* | mips64-* | mipsel-* \
-	      | mips64el-* | mips64orion-* | mips64orionel-* \
-	      | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \
-	      | mipstx39-* | mipstx39el-* | mcore-* \
-	      | f30[01]-* | f700-* | s390-* | s390x-* | sv1-* | t3e-* \
-	      | [cjt]90-* \
-	      | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \
-	      | thumb-* | v850-* | d30v-* | tic30-* | tic80-* | c30-* | fr30-* \
-	      | bs2000-* | tic54x-* | c54x-* | x86_64-* | pj-* | pjl-*)
+	580-* \
+	| a29k-* \
+	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+	| avr-* | avr32-* \
+	| bfin-* | bs2000-* \
+	| c[123]* | c30-* | [cjt]90-* | c4x-* \
+	| clipper-* | craynv-* | cydra-* \
+	| d10v-* | d30v-* | dlx-* \
+	| elxsi-* \
+	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+	| h8300-* | h8500-* \
+	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+	| i*86-* | i860-* | i960-* | ia64-* | ia64[nw]-* \
+	| ip2k-* | iq2000-* \
+	| lm32-* \
+	| m32c-* | m32r-* | m32rle-* \
+	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
+	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+	| mips16-* \
+	| mips64-* | mips64el-* \
+	| mips64octeon-* | mips64octeonel-* \
+	| mips64orion-* | mips64orionel-* \
+	| mips64r5900-* | mips64r5900el-* \
+	| mips64vr-* | mips64vrel-* \
+	| mips64vr4100-* | mips64vr4100el-* \
+	| mips64vr4300-* | mips64vr4300el-* \
+	| mips64vr5000-* | mips64vr5000el-* \
+	| mips64vr5900-* | mips64vr5900el-* \
+	| mipsisa32-* | mipsisa32el-* \
+	| mipsisa32r2-* | mipsisa32r2el-* \
+	| mipsisa64-* | mipsisa64el-* \
+	| mipsisa64r2-* | mipsisa64r2el-* \
+	| mipsisa64sb1-* | mipsisa64sb1el-* \
+	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+	| mipstx39-* | mipstx39el-* \
+	| mmix-* \
+	| mt-* \
+	| msp430-* \
+	| nds32-* | nds32le-* | nds32be-* \
+	| nios-* | nios2-* \
+	| none-* | np1-* | ns16k-* | ns32k-* \
+	| open8-* \
+	| orion-* \
+	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
+	| pyramid-* \
+	| romp-* | rs6000-* | rx-* \
+	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+	| sparclite-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
+	| tahoe-* \
+	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+	| tile-* | tilegx-* \
+	| tron-* \
+	| ubicom32-* \
+	| v850-* | v850e-* | vax-* \
+	| we32k-* \
+	| x86-* | x86_64-* | xc16x-* | xps100-* \
+	| xstormy16-* | xtensa*-* \
+	| ymp-* \
+	| z8k-* | z80-*)
+		;;
+	# Recognize the basic CPU types without company name, with glob match.
+	xtensa*)
+		basic_machine=$basic_machine-unknown
 		;;
 	# Recognize the various machine names and aliases which stand
 	# for a CPU type and a company and sometimes even an OS.
@@ -299,6 +438,9 @@ case $basic_machine in
 		basic_machine=a29k-amd
 		os=-udi
 		;;
+	abacus)
+		basic_machine=abacus-unknown
+		;;
 	adobe68k)
 		basic_machine=m68010-adobe
 		os=-scout
@@ -313,6 +455,12 @@ case $basic_machine in
 		basic_machine=a29k-none
 		os=-bsd
 		;;
+	amd64)
+		basic_machine=x86_64-pc
+		;;
+	amd64-*)
+		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
 	amdahl)
 		basic_machine=580-amdahl
 		os=-sysv
@@ -336,6 +484,10 @@ case $basic_machine in
 		basic_machine=m68k-apollo
 		os=-bsd
 		;;
+	aros)
+		basic_machine=i386-pc
+		os=-aros
+		;;
 	aux)
 		basic_machine=m68k-apple
 		os=-aux
@@ -344,6 +496,35 @@ case $basic_machine in
 		basic_machine=ns32k-sequent
 		os=-dynix
 		;;
+	blackfin)
+		basic_machine=bfin-unknown
+		os=-linux
+		;;
+	blackfin-*)
+		basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
+	bluegene*)
+		basic_machine=powerpc-ibm
+		os=-cnk
+		;;
+	c54x-*)
+		basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	c55x-*)
+		basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	c6x-*)
+		basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	c90)
+		basic_machine=c90-cray
+		os=-unicos
+		;;
+	cegcc)
+		basic_machine=arm-unknown
+		os=-cegcc
+		;;
 	convex-c1)
 		basic_machine=c1-convex
 		os=-bsd
@@ -364,30 +545,45 @@ case $basic_machine in
 		basic_machine=c38-convex
 		os=-bsd
 		;;
-	cray | ymp)
-		basic_machine=ymp-cray
+	cray | j90)
+		basic_machine=j90-cray
 		os=-unicos
 		;;
-	cray2)
-		basic_machine=cray2-cray
-		os=-unicos
+	craynv)
+		basic_machine=craynv-cray
+		os=-unicosmp
 		;;
-	[cjt]90)
-		basic_machine=${basic_machine}-cray
-		os=-unicos
+	cr16 | cr16-*)
+		basic_machine=cr16-unknown
+		os=-elf
 		;;
 	crds | unos)
 		basic_machine=m68k-crds
 		;;
+	crisv32 | crisv32-* | etraxfs*)
+		basic_machine=crisv32-axis
+		;;
 	cris | cris-* | etrax*)
 		basic_machine=cris-axis
 		;;
+	crx)
+		basic_machine=crx-unknown
+		os=-elf
+		;;
 	da30 | da30-*)
 		basic_machine=m68k-da30
 		;;
 	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
 		basic_machine=mips-dec
 		;;
+	decsystem10* | dec10*)
+		basic_machine=pdp10-dec
+		os=-tops10
+		;;
+	decsystem20* | dec20*)
+		basic_machine=pdp10-dec
+		os=-tops20
+		;;
 	delta | 3300 | motorola-3300 | motorola-delta \
 	      | 3300-motorola | delta-motorola)
 		basic_machine=m68k-motorola
@@ -396,6 +592,14 @@ case $basic_machine in
 		basic_machine=m88k-motorola
 		os=-sysv3
 		;;
+	dicos)
+		basic_machine=i686-pc
+		os=-dicos
+		;;
+	djgpp)
+		basic_machine=i586-pc
+		os=-msdosdjgpp
+		;;
 	dpx20 | dpx20-*)
 		basic_machine=rs6000-bull
 		os=-bosx
@@ -546,6 +750,14 @@ case $basic_machine in
 		basic_machine=m68k-isi
 		os=-sysv
 		;;
+	m68knommu)
+		basic_machine=m68k-unknown
+		os=-linux
+		;;
+	m68knommu-*)
+		basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
 	m88k-omron*)
 		basic_machine=m88k-omron
 		;;
@@ -557,10 +769,17 @@ case $basic_machine in
 		basic_machine=ns32k-utek
 		os=-sysv
 		;;
+	microblaze)
+		basic_machine=microblaze-xilinx
+		;;
 	mingw32)
 		basic_machine=i386-pc
 		os=-mingw32
 		;;
+	mingw32ce)
+		basic_machine=arm-unknown
+		os=-mingw32ce
+		;;
 	miniframe)
 		basic_machine=m68000-convergent
 		;;
@@ -568,32 +787,27 @@ case $basic_machine in
 		basic_machine=m68k-atari
 		os=-mint
 		;;
-	mipsel*-linux*)
-		basic_machine=mipsel-unknown
-		os=-linux-gnu
-		;;
-	mips*-linux*)
-		basic_machine=mips-unknown
-		os=-linux-gnu
-		;;
 	mips3*-*)
 		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
 		;;
 	mips3*)
 		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
 		;;
-	mmix*)
-		basic_machine=mmix-knuth
-		os=-mmixware
-		;;
 	monitor)
 		basic_machine=m68k-rom68k
 		os=-coff
 		;;
+	morphos)
+		basic_machine=powerpc-unknown
+		os=-morphos
+		;;
 	msdos)
 		basic_machine=i386-pc
 		os=-msdos
 		;;
+	ms1-*)
+		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+		;;
 	mvs)
 		basic_machine=i370-ibm
 		os=-mvs
@@ -662,6 +876,12 @@ case $basic_machine in
 	np1)
 		basic_machine=np1-gould
 		;;
+	neo-tandem)
+		basic_machine=neo-tandem
+		;;
+	nse-tandem)
+		basic_machine=nse-tandem
+		;;
 	nsr-tandem)
 		basic_machine=nsr-tandem
 		;;
@@ -669,6 +889,13 @@ case $basic_machine in
 		basic_machine=hppa1.1-oki
 		os=-proelf
 		;;
+	openrisc | openrisc-*)
+		basic_machine=or32-unknown
+		;;
+	os400)
+		basic_machine=powerpc-ibm
+		os=-os400
+		;;
 	OSE68000 | ose68000)
 		basic_machine=m68000-ericsson
 		os=-ose
@@ -685,48 +912,79 @@ case $basic_machine in
 		basic_machine=i860-intel
 		os=-osf
 		;;
+	parisc)
+		basic_machine=hppa-unknown
+		os=-linux
+		;;
+	parisc-*)
+		basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
 	pbd)
 		basic_machine=sparc-tti
 		;;
 	pbb)
 		basic_machine=m68k-tti
 		;;
-        pc532 | pc532-*)
+	pc532 | pc532-*)
 		basic_machine=ns32k-pc532
 		;;
-	pentium | p5 | k5 | k6 | nexgen)
+	pc98)
+		basic_machine=i386-pc
+		;;
+	pc98-*)
+		basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium | p5 | k5 | k6 | nexgen | viac3)
 		basic_machine=i586-pc
 		;;
-	pentiumpro | p6 | 6x86 | athlon)
+	pentiumpro | p6 | 6x86 | athlon | athlon_*)
 		basic_machine=i686-pc
 		;;
-	pentiumii | pentium2)
+	pentiumii | pentium2 | pentiumiii | pentium3)
 		basic_machine=i686-pc
 		;;
-	pentium-* | p5-* | k5-* | k6-* | nexgen-*)
+	pentium4)
+		basic_machine=i786-pc
+		;;
+	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
 		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
 	pentiumpro-* | p6-* | 6x86-* | athlon-*)
 		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
-	pentiumii-* | pentium2-*)
+	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
 		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
+	pentium4-*)
+		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
 	pn)
 		basic_machine=pn-gould
 		;;
 	power)	basic_machine=power-ibm
 		;;
-	ppc)	basic_machine=powerpc-unknown
-	        ;;
-	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+	ppc | ppcbe)	basic_machine=powerpc-unknown
+		;;
+	ppc-* | ppcbe-*)
+		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
 	ppcle | powerpclittle | ppc-le | powerpc-little)
 		basic_machine=powerpcle-unknown
-	        ;;
+		;;
 	ppcle-* | powerpclittle-*)
 		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
+	ppc64)	basic_machine=powerpc64-unknown
+		;;
+	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+		basic_machine=powerpc64le-unknown
+		;;
+	ppc64le-* | powerpc64little-*)
+		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
 	ps2)
 		basic_machine=i386-ibm
 		;;
@@ -734,6 +992,10 @@ case $basic_machine in
 		basic_machine=i586-unknown
 		os=-pw32
 		;;
+	rdos)
+		basic_machine=i386-pc
+		os=-rdos
+		;;
 	rom68k)
 		basic_machine=m68k-rom68k
 		os=-coff
@@ -744,10 +1006,30 @@ case $basic_machine in
 	rtpc | rtpc-*)
 		basic_machine=romp-ibm
 		;;
+	s390 | s390-*)
+		basic_machine=s390-ibm
+		;;
+	s390x | s390x-*)
+		basic_machine=s390x-ibm
+		;;
 	sa29200)
 		basic_machine=a29k-amd
 		os=-udi
 		;;
+	sb1)
+		basic_machine=mipsisa64sb1-unknown
+		;;
+	sb1el)
+		basic_machine=mipsisa64sb1el-unknown
+		;;
+	sde)
+		basic_machine=mipsisa32-sde
+		os=-elf
+		;;
+	sei)
+		basic_machine=mips-sei
+		os=-seiux
+		;;
 	sequent)
 		basic_machine=i386-sequent
 		;;
@@ -755,7 +1037,13 @@ case $basic_machine in
 		basic_machine=sh-hitachi
 		os=-hms
 		;;
-	sparclite-wrs)
+	sh5el)
+		basic_machine=sh5le-unknown
+		;;
+	sh64)
+		basic_machine=sh64-unknown
+		;;
+	sparclite-wrs | simso-wrs)
 		basic_machine=sparclite-wrs
 		os=-vxworks
 		;;
@@ -773,6 +1061,9 @@ case $basic_machine in
 		basic_machine=i860-stratus
 		os=-sysv4
 		;;
+	strongarm-* | thumb-*)
+		basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
 	sun2)
 		basic_machine=m68000-sun
 		;;
@@ -822,12 +1113,21 @@ case $basic_machine in
 		os=-dynix
 		;;
 	t3e)
-		basic_machine=t3e-cray
+		basic_machine=alphaev5-cray
 		os=-unicos
 		;;
-	tic54x | c54x*)
-		basic_machine=tic54x-unknown
-		os=-coff
+	t90)
+		basic_machine=t90-cray
+		os=-unicos
+		;;
+	# This must be matched before tile*.
+	tilegx*)
+		basic_machine=tilegx-unknown
+		os=-linux-gnu
+		;;
+	tile*)
+		basic_machine=tile-unknown
+		os=-linux-gnu
 		;;
 	tx39)
 		basic_machine=mipstx39-unknown
@@ -835,9 +1135,17 @@ case $basic_machine in
 	tx39el)
 		basic_machine=mipstx39el-unknown
 		;;
+	toad1)
+		basic_machine=pdp10-xkl
+		os=-tops20
+		;;
 	tower | tower-32)
 		basic_machine=m68k-ncr
 		;;
+	tpf)
+		basic_machine=s390x-ibm
+		os=-tpf
+		;;
 	udi29k)
 		basic_machine=a29k-amd
 		os=-udi
@@ -859,8 +1167,8 @@ case $basic_machine in
 		os=-vms
 		;;
 	vpp*|vx|vx-*)
-               basic_machine=f301-fujitsu
-               ;;
+		basic_machine=f301-fujitsu
+		;;
 	vxworks960)
 		basic_machine=i960-wrs
 		os=-vxworks
@@ -881,17 +1189,28 @@ case $basic_machine in
 		basic_machine=hppa1.1-winbond
 		os=-proelf
 		;;
-	xmp)
-		basic_machine=xmp-cray
-		os=-unicos
+	xbox)
+		basic_machine=i686-pc
+		os=-mingw32
 		;;
-        xps | xps100)
+	xps | xps100)
 		basic_machine=xps100-honeywell
 		;;
+	xscale-* | xscalee[bl]-*)
+		basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
+		;;
+	ymp)
+		basic_machine=ymp-cray
+		os=-unicos
+		;;
 	z8k-*-coff)
 		basic_machine=z8k-unknown
 		os=-sim
 		;;
+	z80-*-coff)
+		basic_machine=z80-unknown
+		os=-sim
+		;;
 	none)
 		basic_machine=none-none
 		os=-none
@@ -908,16 +1227,12 @@ case $basic_machine in
 	op60c)
 		basic_machine=hppa1.1-oki
 		;;
-	mips)
-		if [ x$os = x-linux-gnu ]; then
-			basic_machine=mips-unknown
-		else
-			basic_machine=mips-mips
-		fi
-		;;
 	romp)
 		basic_machine=romp-ibm
 		;;
+	mmix)
+		basic_machine=mmix-knuth
+		;;
 	rs6000)
 		basic_machine=rs6000-ibm
 		;;
@@ -934,13 +1249,13 @@ case $basic_machine in
 	we32k)
 		basic_machine=we32k-att
 		;;
-	sh3 | sh4)
+	sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
 		basic_machine=sh-unknown
 		;;
-	sparc | sparcv9 | sparcv9b)
+	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
 		basic_machine=sparc-sun
 		;;
-        cydra)
+	cydra)
 		basic_machine=cydra-cydrome
 		;;
 	orion)
@@ -955,10 +1270,6 @@ case $basic_machine in
 	pmac | pmac-mpw)
 		basic_machine=powerpc-apple
 		;;
-	c4x*)
-		basic_machine=c4x-none
-		os=-coff
-		;;
 	*-unknown)
 		# Make sure to match an already-canonicalized machine name.
 		;;
@@ -985,9 +1296,12 @@ esac
 if [ x"$os" != x"" ]
 then
 case $os in
-        # First match some system type aliases
-        # that might get confused with valid system types.
+	# First match some system type aliases
+	# that might get confused with valid system types.
 	# -solaris* is a basic system type, with this one exception.
+	-auroraux)
+		os=-auroraux
+		;;
 	-solaris1 | -solaris1.*)
 		os=`echo $os | sed -e 's|solaris1|sunos4|'`
 		;;
@@ -1008,21 +1322,31 @@ case $os in
 	# Each alternative MUST END IN A *, to match a version number.
 	# -sysv* is not here because it comes later, after sysvr4.
 	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
-	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
-	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
+	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+	      | -sym* | -kopensolaris* \
 	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
-	      | -aos* \
+	      | -aos* | -aros* \
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
-	      | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
-	      | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+	      | -openbsd* | -solidbsd* \
+	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+	      | -chorusos* | -chorusrdb* | -cegcc* \
 	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-	      | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
-	      | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
+	      | -mingw32* | -linux-gnu* | -linux-android* \
+	      | -linux-newlib* | -linux-uclibc* \
+	      | -uxpv* | -beos* | -mpeix* | -udk* \
+	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
-	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* | -os2*)
+	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
 	-qnx*)
@@ -1034,16 +1358,21 @@ case $os in
 			;;
 		esac
 		;;
+	-nto-qnx*)
+		;;
 	-nto*)
-		os=-nto-qnx
+		os=`echo $os | sed -e 's|nto|nto-qnx|'`
 		;;
 	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
-	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
+	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
 	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
 		;;
 	-mac*)
 		os=`echo $os | sed -e 's|mac|macos|'`
 		;;
+	-linux-dietlibc)
+		os=-linux-dietlibc
+		;;
 	-linux*)
 		os=`echo $os | sed -e 's|linux|linux-gnu|'`
 		;;
@@ -1056,6 +1385,9 @@ case $os in
 	-opened*)
 		os=-openedition
 		;;
+	-os400*)
+		os=-os400
+		;;
 	-wince*)
 		os=-wince
 		;;
@@ -1074,14 +1406,23 @@ case $os in
 	-acis*)
 		os=-aos
 		;;
+	-atheos*)
+		os=-atheos
+		;;
+	-syllable*)
+		os=-syllable
+		;;
 	-386bsd)
 		os=-bsd
 		;;
 	-ctix* | -uts*)
 		os=-sysv
 		;;
+	-nova*)
+		os=-rtmk-nova
+		;;
 	-ns2 )
-	        os=-nextstep2
+		os=-nextstep2
 		;;
 	-nsk*)
 		os=-nsk
@@ -1093,6 +1434,9 @@ case $os in
 	-sinix*)
 		os=-sysv4
 		;;
+	-tpf*)
+		os=-tpf
+		;;
 	-triton*)
 		os=-sysv3
 		;;
@@ -1120,8 +1464,22 @@ case $os in
 	-xenix)
 		os=-xenix
 		;;
-        -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
-	        os=-mint
+	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+		os=-mint
+		;;
+	-aros*)
+		os=-aros
+		;;
+	-kaos*)
+		os=-kaos
+		;;
+	-zvmoe)
+		os=-zvmoe
+		;;
+	-dicos*)
+		os=-dicos
+		;;
+	-nacl*)
 		;;
 	-none)
 		;;
@@ -1145,6 +1503,12 @@ else
 # system, and we'll never get to this point.
 
 case $basic_machine in
+	score-*)
+		os=-elf
+		;;
+	spu-*)
+		os=-elf
+		;;
 	*-acorn)
 		os=-riscix1.2
 		;;
@@ -1154,10 +1518,23 @@ case $basic_machine in
 	arm*-semi)
 		os=-aout
 		;;
+	c4x-* | tic4x-*)
+		os=-coff
+		;;
+	tic54x-*)
+		os=-coff
+		;;
+	tic55x-*)
+		os=-coff
+		;;
+	tic6x-*)
+		os=-coff
+		;;
+	# This must come before the *-dec entry.
 	pdp10-*)
 		os=-tops20
 		;;
-        pdp11-*)
+	pdp11-*)
 		os=-none
 		;;
 	*-dec | vax-*)
@@ -1178,12 +1555,18 @@ case $basic_machine in
 	m68*-cisco)
 		os=-aout
 		;;
+	mep-*)
+		os=-elf
+		;;
 	mips*-cisco)
 		os=-elf
 		;;
 	mips*-*)
 		os=-elf
 		;;
+	or32-*)
+		os=-coff
+		;;
 	*-tti)	# must be before sparc entry or we get the wrong os.
 		os=-sysv3
 		;;
@@ -1193,9 +1576,15 @@ case $basic_machine in
 	*-be)
 		os=-beos
 		;;
+	*-haiku)
+		os=-haiku
+		;;
 	*-ibm)
 		os=-aix
 		;;
+	*-knuth)
+		os=-mmixware
+		;;
 	*-wec)
 		os=-proelf
 		;;
@@ -1247,19 +1636,19 @@ case $basic_machine in
 	*-next)
 		os=-nextstep3
 		;;
-        *-gould)
+	*-gould)
 		os=-sysv
 		;;
-        *-highlevel)
+	*-highlevel)
 		os=-bsd
 		;;
 	*-encore)
 		os=-bsd
 		;;
-        *-sgi)
+	*-sgi)
 		os=-irix
 		;;
-        *-siemens)
+	*-siemens)
 		os=-sysv4
 		;;
 	*-masscomp)
@@ -1298,7 +1687,7 @@ case $basic_machine in
 			-sunos*)
 				vendor=sun
 				;;
-			-aix*)
+			-cnk*|-aix*)
 				vendor=ibm
 				;;
 			-beos*)
@@ -1328,10 +1717,16 @@ case $basic_machine in
 			-mvs* | -opened*)
 				vendor=ibm
 				;;
+			-os400*)
+				vendor=ibm
+				;;
 			-ptx*)
 				vendor=sequent
 				;;
-			-vxsim* | -vxworks*)
+			-tpf*)
+				vendor=ibm
+				;;
+			-vxsim* | -vxworks* | -windiss*)
 				vendor=wrs
 				;;
 			-aux*)
@@ -1346,13 +1741,16 @@ case $basic_machine in
 			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
 				vendor=atari
 				;;
+			-vos*)
+				vendor=stratus
+				;;
 		esac
 		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
 		;;
 esac
 
 echo $basic_machine$os
-exit 0
+exit
 
 # Local variables:
 # eval: (add-hook 'write-file-hooks 'time-stamp)
diff --git a/src/native/windows/apps/prunmgr/prunmgr.c b/src/native/windows/apps/prunmgr/prunmgr.c
index acdef73..11d6db5 100644
--- a/src/native/windows/apps/prunmgr/prunmgr.c
+++ b/src/native/windows/apps/prunmgr/prunmgr.c
@@ -89,6 +89,15 @@ static LPCWSTR _commands[] = {
     NULL
 };
 
+static LPCWSTR _altcmds[] = {
+    L"manage",      /* 1 Manage Service (default)*/
+    L"monitor",     /* 2 Monitor Service */
+    L"start",       /* 3 Monitor Service and start if not runing */
+    L"quit",        /* 4 Quit all running Monitor applications */
+    NULL
+};
+
+
 /* Allowed procrun parameters */
 static APXCMDLINEOPT _options[] = {
 /* 0  */    { L"AllowMultiInstances", NULL, NULL,   APXCMDOPT_INT, NULL, 0},
@@ -1622,7 +1631,7 @@ int WINAPI WinMain(HINSTANCE hInstance,
     hPool     = apxPoolCreate(NULL, 0);
 
     /* Parse the command line */
-    if ((lpCmdline = apxCmdlineParse(hPool, _options, _commands)) == NULL) {
+    if ((lpCmdline = apxCmdlineParse(hPool, _options, _commands, _altcmds)) == NULL) {
         /* TODO: dispalay error message */
         apxDisplayError(TRUE, NULL, 0, "Error parsing command line");
         goto cleanup;
diff --git a/src/native/windows/apps/prunmgr/prunmgr.h b/src/native/windows/apps/prunmgr/prunmgr.h
index 2a205e7..eec2470 100644
--- a/src/native/windows/apps/prunmgr/prunmgr.h
+++ b/src/native/windows/apps/prunmgr/prunmgr.h
@@ -24,7 +24,7 @@
 #define _PRUNMGR_H
 
 #undef  PRG_VERSION
-#define PRG_VERSION    "1.0.7.0"
+#define PRG_VERSION    "1.0.8.0"
 #define PRG_REGROOT   L"Apache Software Foundation\\Procrun 2.0"
 
 #define IDM_TM_EXIT                     2000
diff --git a/src/native/windows/apps/prunmgr/prunmgr.rc b/src/native/windows/apps/prunmgr/prunmgr.rc
index 4909a51..a8228fc 100644
--- a/src/native/windows/apps/prunmgr/prunmgr.rc
+++ b/src/native/windows/apps/prunmgr/prunmgr.rc
@@ -228,7 +228,7 @@ END
 STRINGTABLE
 BEGIN
     IDS_APPLICATION     RSTR_PSM
-    IDS_APPVERSION      "Version 1.0.7"
+    IDS_APPVERSION      "Version 1.0.8"
     IDS_APPFULLNAME     RSTR_PSM " Version " PRG_VERSION
     IDS_APPCOPYRIGHT    "Copyright (c) 2000-2011 The Apache Software Foundation"
     IDS_APPDESCRIPTION  "Apache Commons Daemon Service Management Tool"
@@ -259,8 +259,8 @@ BEGIN
 END
 
 1 VERSIONINFO
- FILEVERSION 1,0,7,0
- PRODUCTVERSION 1,0,7,0
+ FILEVERSION 1,0,8,0
+ PRODUCTVERSION 1,0,8,0
  FILEFLAGSMASK 0x3fL
 #if defined(_DEBUG)
  FILEFLAGS 0x03L
diff --git a/src/native/windows/apps/prunsrv/prunsrv.c b/src/native/windows/apps/prunsrv/prunsrv.c
index a342acd..6e3bf37 100644
--- a/src/native/windows/apps/prunsrv/prunsrv.c
+++ b/src/native/windows/apps/prunsrv/prunsrv.c
@@ -58,29 +58,42 @@ typedef struct APX_STDWRAP {
 } APX_STDWRAP;
 
 /* Use static variables instead of #defines */
-static LPCWSTR      PRSRV_AUTO   = L"auto";
-static LPCWSTR      PRSRV_JAVA   = L"java";
-static LPCWSTR      PRSRV_JVM    = L"jvm";
-static LPCWSTR      PRSRV_JDK    = L"jdk";
-static LPCWSTR      PRSRV_JRE    = L"jre";
-static LPCWSTR      PRSRV_MANUAL = L"manual";
-static LPCWSTR      PRSRV_JBIN   = L"\\bin\\java.exe";
-static LPCWSTR      PRSRV_PBIN   = L"\\bin";
-static LPCWSTR      PRSRV_SIGNAL = L"SIGNAL";
-
-static LPCWSTR      STYPE_INTERACTIVE = L"interactive";
+static LPCWSTR  PRSRV_AUTO        = L"auto";
+static LPCWSTR  PRSRV_JAVA        = L"java";
+static LPCWSTR  PRSRV_JVM         = L"jvm";
+static LPCWSTR  PRSRV_JDK         = L"jdk";
+static LPCWSTR  PRSRV_JRE         = L"jre";
+static LPCWSTR  PRSRV_MANUAL      = L"manual";
+static LPCWSTR  PRSRV_JBIN        = L"\\bin\\java.exe";
+static LPCWSTR  PRSRV_PBIN        = L"\\bin";
+static LPCWSTR  PRSRV_SIGNAL      = L"SIGNAL";
+static LPCWSTR  STYPE_INTERACTIVE = L"interactive";
 
 static LPWSTR       _service_name = NULL;
 /* Allowed procrun commands */
 static LPCWSTR _commands[] = {
     L"TS",      /* 1 Run Service as console application (default)*/
     L"RS",      /* 2 Run Service */
-    L"SS",      /* 3 Stop Service */
-    L"US",      /* 4 Update Service parameters */
-    L"IS",      /* 5 Install Service */
-    L"DS",      /* 6 Delete Service */
-    L"?",       /* 7 Help */
-    L"VS",      /* 8 Version */
+    L"ES",      /* 3 Execute start */
+    L"SS",      /* 4 Stop Service */
+    L"US",      /* 5 Update Service parameters */
+    L"IS",      /* 6 Install Service */
+    L"DS",      /* 7 Delete Service */
+    L"?",       /* 8 Help */
+    L"VS",      /* 9 Version */
+    NULL
+};
+
+static LPCWSTR _altcmds[] = {
+    L"run",         /* 1 Run Service as console application (default)*/
+    L"service",     /* 2 Run Service */
+    L"start",       /* 3 Version */
+    L"stop",        /* 4 Stop Service */
+    L"update",      /* 5 Update Service parameters */
+    L"install",     /* 6 Install Service */
+    L"delete",      /* 7 Delete Service */
+    L"help",        /* 8 Help */
+    L"version",     /* 9 Version */
     NULL
 };
 
@@ -131,6 +144,7 @@ static APXCMDLINEOPT _options[] = {
 /* 36 */    { L"StdOutput",         L"StdOutput",       L"Log",         APXCMDOPT_STE | APXCMDOPT_REG, NULL, 0},
 /* 37 */    { L"LogJniMessages",    L"LogJniMessages",  L"Log",         APXCMDOPT_INT | APXCMDOPT_REG, NULL, 1},
 /* 38 */    { L"PidFile",           L"PidFile",         L"Log",         APXCMDOPT_STR | APXCMDOPT_REG, NULL, 0},
+/* 39 */    { L"Rotate",            L"Rotate",          L"Log",         APXCMDOPT_INT | APXCMDOPT_REG, NULL, 0},
             /* NULL terminate the array */
             { NULL }
 };
@@ -193,14 +207,7 @@ static APXCMDLINEOPT _options[] = {
 #define SO_STDOUTPUT        GET_OPT_V(36)
 #define SO_JNIVFPRINTF      GET_OPT_I(37)
 #define SO_PIDFILE          GET_OPT_V(38)
-
-/* Main service table entry
- * filled at run-time
- */
-static SERVICE_TABLE_ENTRYW _service_table[] = {
-        {NULL, NULL},
-        {NULL, NULL}
-};
+#define SO_LOGROTATE        GET_OPT_I(39)
 
 static SERVICE_STATUS        _service_status;
 static SERVICE_STATUS_HANDLE _service_status_handle = NULL;
@@ -218,6 +225,8 @@ static BOOL                  _java_shutdown = FALSE;
 static APXHANDLE    gPool;
 static APXHANDLE    gWorker;
 static APX_STDWRAP  gStdwrap;           /* stdio/stderr redirection */
+static int          gExitval;
+static LPWSTR       gStartPath;
 
 static LPWSTR   _jni_jvmpath              = NULL;   /* Path to jvm dll */
 static LPSTR    _jni_jvmoptions           = NULL;   /* Path to jvm options */
@@ -229,7 +238,6 @@ static LPSTR    _jni_rmethod              = NULL;    /* Startup  method */
 static LPSTR    _jni_smethod              = NULL;    /* Shutdown method */
 static LPSTR    _jni_rclass               = NULL;    /* Startup  class */
 static LPSTR    _jni_sclass               = NULL;    /* Shutdown class */
-
 static HANDLE gShutdownEvent = NULL;
 static HANDLE gSignalEvent   = NULL;
 static HANDLE gSignalThread  = NULL;
@@ -239,18 +247,28 @@ static BOOL   gSignalValid   = TRUE;
 static APXJAVA_THREADARGS gRargs;
 static APXJAVA_THREADARGS gSargs;
 
-
 DWORD WINAPI eventThread(LPVOID lpParam)
 {
+    DWORD dwRotateCnt = SO_LOGROTATE;
+
     for (;;) {
-        DWORD dw = WaitForSingleObject(gSignalEvent, INFINITE);
+        DWORD dw = WaitForSingleObject(gSignalEvent, 1000);
+        if (dw == WAIT_TIMEOUT) {
+            /* Do process maintenance */
+            if (SO_LOGROTATE != 0 && --dwRotateCnt == 0) {
+                /* Perform log rotation. */
+
+                 dwRotateCnt = SO_LOGROTATE;
+            }
+            continue;
+        }
         if (dw == WAIT_OBJECT_0 && gSignalValid) {
             if (!GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT, 0))
                 apxLogWrite(APXLOG_MARK_SYSERR);
             ResetEvent(gSignalEvent);
+            continue;
         }
-        else
-            break;
+        break;
     }
     ExitThread(0);
     return 0;
@@ -266,8 +284,16 @@ static BOOL redirectStdStreams(APX_STDWRAP *lpWrapper, LPAPXCMDLINE lpCmdline)
     BOOL aErr = FALSE;
     BOOL aOut = FALSE;
 
-    if (lpWrapper->szStdOutFilename || lpWrapper->szStdErrFilename)
-        AllocConsole();
+    if (lpWrapper->szStdOutFilename || lpWrapper->szStdErrFilename) {
+        /* Alloc console if it doesn't exists. */
+        if (!AttachConsole(ATTACH_PARENT_PROCESS) &&
+             GetLastError() == ERROR_INVALID_HANDLE) {
+            HWND hc;
+            AllocConsole();
+            if ((hc = GetConsoleWindow()) != NULL)
+                ShowWindow(hc, SW_HIDE);
+        }
+    }
     /* redirect to file or console */
     if (lpWrapper->szStdOutFilename) {
         if (lstrcmpiW(lpWrapper->szStdOutFilename, PRSRV_AUTO) == 0) {
@@ -279,7 +305,8 @@ static BOOL redirectStdStreams(APX_STDWRAP *lpWrapper, LPAPXCMDLINE lpCmdline)
             lpWrapper->szStdOutFilename = apxLogFile(gPool,
                                                      lpWrapper->szLogPath,
                                                      lsn,
-                                                     NULL, TRUE);
+                                                     NULL, TRUE,
+                                                     SO_LOGROTATE);
         }
         /* Delete the file if not in append mode
          * XXX: See if we can use the params instead of that.
@@ -305,7 +332,8 @@ static BOOL redirectStdStreams(APX_STDWRAP *lpWrapper, LPAPXCMDLINE lpCmdline)
             lpWrapper->szStdErrFilename = apxLogFile(gPool,
                                                      lpWrapper->szLogPath,
                                                      lsn,
-                                                     NULL, TRUE);
+                                                     NULL, TRUE,
+                                                     SO_LOGROTATE);
         }
         if (!aErr)
             DeleteFileW(lpWrapper->szStdErrFilename);
@@ -330,19 +358,19 @@ static BOOL redirectStdStreams(APX_STDWRAP *lpWrapper, LPAPXCMDLINE lpCmdline)
 static void printUsage(LPAPXCMDLINE lpCmdline, BOOL isHelp)
 {
     int i = 0;
-    fwprintf(stderr, L"Usage: %s //CMD//Service [--options]\n",
+    fwprintf(stderr, L"Usage: %s command [ServiceName] [--options]\n",
              lpCmdline->szExecutable);
     fwprintf(stderr, L"  Commands:\n");
     if (isHelp)
-        fwprintf(stderr, L"  //?                  This page\n");
-    fwprintf(stderr, L"  //IS[//ServiceName]  Install Service\n");
-    fwprintf(stderr, L"  //US[//ServiceName]  Update Service parameters\n");
-    fwprintf(stderr, L"  //DS[//ServiceName]  Delete Service\n");
-    fwprintf(stderr, L"  //RS[//ServiceName]  Run Service\n");
-    fwprintf(stderr, L"  //SS[//ServiceName]  Stop Service\n");
-    fwprintf(stderr, L"  //TS[//ServiceName]  Run Service as console application\n");
-    fwprintf(stderr, L"  //PP[//Num Seconds]  Sleep for n Seconds (defaults to 60)\n");
-    fwprintf(stderr, L"  //VS                 Display version\n");
+        fwprintf(stderr, L"  help                   This page\n");
+    fwprintf(stderr, L"  install [ServiceName]  Install Service\n");
+    fwprintf(stderr, L"  update  [ServiceName]  Update Service parameters\n");
+    fwprintf(stderr, L"  delete  [ServiceName]  Delete Service\n");
+    fwprintf(stderr, L"  start   [ServiceName]  Start Service\n");
+    fwprintf(stderr, L"  stop    [ServiceName]  Stop Service\n");
+    fwprintf(stderr, L"  run     [ServiceName]  Run Service as console application\n");
+    fwprintf(stderr, L"  pause   [Num Seconds]  Sleep for n Seconds (defaults to 60)\n");
+    fwprintf(stderr, L"  version                Display version\n");
     fwprintf(stderr, L"  Options:\n");
     while (_options[i].szName) {
         fwprintf(stderr, L"  --%s\n", _options[i].szName);
@@ -684,6 +712,44 @@ static BOOL docmdStopService(LPAPXCMDLINE lpCmdline)
     return rv;
 }
 
+static BOOL docmdStartService(LPAPXCMDLINE lpCmdline)
+{
+    APXHANDLE hService;
+    BOOL  rv = FALSE;
+
+    apxLogWrite(APXLOG_MARK_INFO "Starting service '%S' ...",
+                lpCmdline->szApplication);
+    hService = apxCreateService(gPool, GENERIC_ALL, FALSE);
+    if (IS_INVALID_HANDLE(hService)) {
+        apxLogWrite(APXLOG_MARK_ERROR "Unable to open the Service Manager");
+        return FALSE;
+    }
+
+    SetLastError(ERROR_SUCCESS);
+    /* Open the service */
+    if (apxServiceOpen(hService, lpCmdline->szApplication,
+                       GENERIC_READ | GENERIC_EXECUTE)) {
+        rv = apxServiceControl(hService,
+                               SERVICE_CONTROL_CONTINUE,
+                               0,
+                               NULL,
+                               NULL);
+        if (rv)
+            apxLogWrite(APXLOG_MARK_INFO "Service '%S' started",
+                        lpCmdline->szApplication);
+        else
+            apxLogWrite(APXLOG_MARK_ERROR "Failed to start '%S' service",
+                        lpCmdline->szApplication);
+
+    }
+    else
+        apxDisplayError(FALSE, NULL, 0, "Unable to open '%S' service",
+                        lpCmdline->szApplication);
+    apxCloseHandle(hService);
+    apxLogWrite(APXLOG_MARK_INFO "Start service finished.");
+    return rv;
+}
+
 static BOOL docmdUpdateService(LPAPXCMDLINE lpCmdline)
 {
     APXHANDLE hService;
@@ -810,10 +876,21 @@ BOOL child_callback(APXHANDLE hObject, UINT uMsg,
     return TRUE;
 }
 
-static int onExitHook(void)
+static int onExitStop(void)
 {
-    apxLogWrite(APXLOG_MARK_DEBUG "On exit hook called ...");
-    reportServiceStatus(SERVICE_STOPPED, NO_ERROR, 0);
+    if (_service_mode) {
+        apxLogWrite(APXLOG_MARK_DEBUG "Stop exit hook called ...");
+        reportServiceStatus(SERVICE_STOPPED, NO_ERROR, 0);
+    }
+    return 0;
+}
+
+static int onExitStart(void)
+{
+    if (_service_mode) {
+        apxLogWrite(APXLOG_MARK_DEBUG "Start exit hook called ...");
+        reportServiceStatus(SERVICE_STOPPED, NO_ERROR, 0);
+    }
     return 0;
 }
 
@@ -857,9 +934,9 @@ static DWORD WINAPI serviceStop(LPVOID lpParameter)
         gSargs.szStdErrFilename = NULL;
         gSargs.szStdOutFilename = NULL;
         gSargs.szLibraryPath    = SO_LIBPATH;
-
-        if (lstrcmpA(_jni_sclass, "java/lang/System") == 0)
-            _onexit(onExitHook);
+        /* Register onexit hook
+         */
+        _onexit(onExitStop);
         /* Create sutdown event */
         gShutdownEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
         if (!apxJavaStart(&gSargs)) {
@@ -1016,7 +1093,7 @@ static DWORD serviceStart()
         return TRUE;    /* Nothing to do */
     }
     if (IS_VALID_STRING(SO_PIDFILE)) {
-        gPidfileName = apxLogFile(gPool, SO_LOGPATH, SO_PIDFILE, NULL, FALSE);
+        gPidfileName = apxLogFile(gPool, SO_LOGPATH, SO_PIDFILE, NULL, FALSE, 0);
         if (GetFileAttributesW(gPidfileName) !=  INVALID_FILE_ATTRIBUTES) {
             /* Pid file exists */
             if (!DeleteFileW(gPidfileName)) {
@@ -1029,6 +1106,8 @@ static DWORD serviceStart()
     }
     GetSystemTimeAsFileTime(&fts);
     if (_jni_startup) {
+        if (IS_EMPTY_STRING(SO_STARTPATH))
+            SO_STARTPATH = gStartPath;
         if (IS_VALID_STRING(SO_STARTPATH)) {
             /* If the Working path is specified change the current directory */
             SetCurrentDirectoryW(SO_STARTPATH);
@@ -1058,7 +1137,9 @@ static DWORD serviceStart()
         gRargs.szStdErrFilename = gStdwrap.szStdErrFilename;
         gRargs.szStdOutFilename = gStdwrap.szStdOutFilename;
         gRargs.szLibraryPath    = SO_LIBPATH;
-
+        /* Register onexit hook
+         */
+        _onexit(onExitStart);
         if (!apxJavaStart(&gRargs)) {
             rv = 4;
             apxLogWrite(APXLOG_MARK_ERROR "Failed to start Java");
@@ -1185,7 +1266,12 @@ void WINAPI service_ctrl_handler(DWORD dwCtrlCode)
                                       serviceStop,
                                       (LPVOID)SERVICE_CONTROL_STOP,
                                       0, &threadId);
+#if 0
+            /* Seems we don't need to wait for the stop thread
+             * to finish
+             */
             WaitForSingleObject(stopThread, INFINITE);
+#endif
             CloseHandle(stopThread);
 
             return;
@@ -1246,7 +1332,7 @@ BOOL WINAPI console_handler(DWORD dwCtrlType)
 /* Main service execution loop */
 void WINAPI serviceMain(DWORD argc, LPTSTR *argv)
 {
-    DWORD rc;
+    DWORD rc = 0;
     _service_status.dwServiceType      = SERVICE_WIN32_OWN_PROCESS;
     _service_status.dwCurrentState     = SERVICE_START_PENDING;
     _service_status.dwControlsAccepted = SERVICE_ACCEPT_STOP |
@@ -1266,8 +1352,7 @@ void WINAPI serviceMain(DWORD argc, LPTSTR *argv)
         lstrlcatW(en, SIZ_DESLEN, _service_name);
         lstrlcatW(en, SIZ_DESLEN, PRSRV_SIGNAL);
         for (i = 7; i < lstrlenW(en); i++) {
-            if (en[i] >= L'a' && en[i] <= L'z')
-                en[i] = en[i] - 32;
+            en[i] = towlower(en[i]);
         }
         gSignalEvent = CreateEventW(sa, TRUE, FALSE, en);
         CleanNullACL((void *)sa);
@@ -1281,9 +1366,15 @@ void WINAPI serviceMain(DWORD argc, LPTSTR *argv)
     if (IS_VALID_STRING(SO_STARTMODE)) {
         if (!lstrcmpiW(SO_STARTMODE, PRSRV_JVM)) {
             _jni_startup = TRUE;
-            _jni_rclass  = WideToUTF8(SO_STARTCLASS);
-            /* Exchange all dots with slashes */
-            apxStrCharReplaceA(_jni_rclass, '.', '/');
+            if (IS_VALID_STRING(SO_STARTCLASS)) {
+                _jni_rclass  = WideToANSI(SO_STARTCLASS);
+                /* Exchange all dots with slashes */
+                apxStrCharReplaceA(_jni_rclass, '.', '/');
+            }
+            else {
+                /* Presume its main */
+                _jni_rclass = WideToANSI(L"Main");
+            }
             _jni_rparam = SO_STARTPARAMS;
         }
         else if (!lstrcmpiW(SO_STARTMODE, PRSRV_JAVA)) {
@@ -1323,8 +1414,14 @@ void WINAPI serviceMain(DWORD argc, LPTSTR *argv)
     if (IS_VALID_STRING(SO_STOPMODE)) {
         if (!lstrcmpiW(SO_STOPMODE, PRSRV_JVM)) {
             _jni_shutdown = TRUE;
-            _jni_sclass = WideToUTF8(SO_STOPCLASS);
-            apxStrCharReplaceA(_jni_sclass, '.', '/');
+            if (IS_VALID_STRING(SO_STOPCLASS)) {
+                _jni_sclass = WideToANSI(SO_STOPCLASS);
+                apxStrCharReplaceA(_jni_sclass, '.', '/');
+            }
+            else {
+                /* Defaults to Main */
+                _jni_sclass = WideToANSI(L"Main");
+            }
             _jni_sparam = SO_STOPPARAMS;
         }
         else if (!lstrcmpiW(SO_STOPMODE, PRSRV_JAVA)) {
@@ -1367,12 +1464,12 @@ void WINAPI serviceMain(DWORD argc, LPTSTR *argv)
                 _jni_jvmpath = SO_JVM;
         }
         if (IS_VALID_STRING(SO_CLASSPATH))
-            _jni_classpath = WideToUTF8(SO_CLASSPATH);
+            _jni_classpath = WideToANSI(SO_CLASSPATH);
         if (IS_VALID_STRING(SO_STARTMETHOD))
-            _jni_rmethod   = WideToAscii(SO_STARTMETHOD, (LPSTR)SO_STARTMETHOD);
+            _jni_rmethod   = WideToANSI(SO_STARTMETHOD);
         if (IS_VALID_STRING(SO_STOPMETHOD))
-            _jni_smethod   = WideToAscii(SO_STOPMETHOD, (LPSTR)SO_STOPMETHOD);
-        _jni_jvmoptions    = MzWideToUTF8(SO_JVMOPTIONS);
+            _jni_smethod   = WideToANSI(SO_STOPMETHOD);
+        _jni_jvmoptions    = MzWideToANSI(SO_JVMOPTIONS);
     }
     if (_service_mode) {
         /* Register Service Control handler */
@@ -1384,18 +1481,23 @@ void WINAPI serviceMain(DWORD argc, LPTSTR *argv)
             goto cleanup;
         }
         /* Allocate console so that events gets processed */
-        AllocConsole();
+        if (!AttachConsole(ATTACH_PARENT_PROCESS) &&
+             GetLastError() == ERROR_INVALID_HANDLE) {
+            HWND hc;
+            AllocConsole();
+            if ((hc = GetConsoleWindow()) != NULL)
+                ShowWindow(hc, SW_HIDE);
+        }
     }
     reportServiceStatus(SERVICE_START_PENDING, NO_ERROR, 3000);
     if ((rc = serviceStart()) == 0) {
         /* Service is started */
-        DWORD rv;
         reportServiceStatus(SERVICE_RUNNING, NO_ERROR, 0);
         apxLogWrite(APXLOG_MARK_DEBUG "Waiting for worker to finish...");
         /* Set console handler to capture CTRL events */
         SetConsoleCtrlHandler((PHANDLER_ROUTINE)console_handler, TRUE);
 
-        rv = apxHandleWait(gWorker, INFINITE, FALSE);
+        apxHandleWait(gWorker, INFINITE, FALSE);
         apxLogWrite(APXLOG_MARK_DEBUG "Worker finished.");
     }
     else {
@@ -1429,7 +1531,8 @@ void WINAPI serviceMain(DWORD argc, LPTSTR *argv)
     return;
 cleanup:
     /* Cleanup */
-    reportServiceStatus(SERVICE_STOPPED, ERROR_SERVICE_SPECIFIC_ERROR, 0);
+    reportServiceStatus(SERVICE_STOPPED, ERROR_SERVICE_SPECIFIC_ERROR, rc);
+    gExitval = rc;
     return;
 }
 
@@ -1437,28 +1540,34 @@ cleanup:
 /* Run the service in the debug mode */
 BOOL docmdDebugService(LPAPXCMDLINE lpCmdline)
 {
-    BOOL rv = TRUE;
-
     _service_mode = FALSE;
     _service_name = lpCmdline->szApplication;
-    apxLogWrite(APXLOG_MARK_INFO "Debugging '%S' Service...", _service_name);
+    apxLogWrite(APXLOG_MARK_INFO "Debugging '%S' service...", _service_name);
     serviceMain(0, NULL);
-    apxLogWrite(APXLOG_MARK_INFO "Debug service finished.");
+    apxLogWrite(APXLOG_MARK_INFO "Debug service finished with exit code %d", gExitval);
     SAFE_CLOSE_HANDLE(gPidfileHandle);
-    return rv;
+    return gExitval == 0 ? TRUE : FALSE;
 }
 
 BOOL docmdRunService(LPAPXCMDLINE lpCmdline)
 {
-    BOOL rv = FALSE;
-
+    BOOL rv;
+    SERVICE_TABLE_ENTRYW dispatch_table[] = {
+        { lpCmdline->szApplication, (LPSERVICE_MAIN_FUNCTIONW)serviceMain },
+        { NULL, NULL }
+    };
     _service_mode = TRUE;
     _service_name = lpCmdline->szApplication;
     apxLogWrite(APXLOG_MARK_INFO "Running '%S' Service...", _service_name);
-    _service_table[0].lpServiceName = lpCmdline->szApplication;
-    _service_table[0].lpServiceProc = (LPSERVICE_MAIN_FUNCTIONW)serviceMain;
-    rv = (StartServiceCtrlDispatcherW(_service_table) != 0);
-    apxLogWrite(APXLOG_MARK_INFO "Run service finished.");
+    if (StartServiceCtrlDispatcherW(dispatch_table)) {
+        apxLogWrite(APXLOG_MARK_INFO "Run service finished.");
+        rv = TRUE;
+    }
+    else {
+        apxLogWrite(APXLOG_MARK_ERROR "StartServiceCtrlDispatcher for '%S' failed",
+                    lpCmdline->szApplication);
+        rv = FALSE;
+    }
     SAFE_CLOSE_HANDLE(gPidfileHandle);
     return rv;
 }
@@ -1469,6 +1578,7 @@ static const char *gSzProc[] = {
     "load configuration",
     "run service as console application",
     "run service",
+    "start service",
     "stop service",
     "update service parameters",
     "install service",
@@ -1482,24 +1592,39 @@ void __cdecl main(int argc, char **argv)
 
     LPAPXCMDLINE lpCmdline;
 
-    if (argc > 1 && strncmp(argv[1], "//PP", 4) == 0) {
-        /* Handy sleep routine defaulting to 1 minute */
-        DWORD ss = 60;
-        if (argv[1][4] && argv[1][5] && argv[1][6]) {
-             int us = atoi(argv[1] + 6);
-             if (us > 0)
-                ss = (DWORD)us;
+    if (argc > 1) {
+        DWORD ss = 0;
+        if (strncmp(argv[1], "//PP", 4) == 0) {
+            /* Handy sleep routine defaulting to 1 minute */
+            if (argv[1][4] && argv[1][5] && argv[1][6]) {
+                int us = atoi(argv[1] + 6);
+                if (us > 0)
+                    ss = (DWORD)us;
+            }
+            Sleep(ss * 1000);
+            ExitProcess(0);
+            return;
+        }
+        else if (strcmp(argv[1], "pause") == 0) {
+            /* Handy sleep routine defaulting to 1 minute */
+            if (argc > 2) {
+                int us = atoi(argv[2]);
+                if (us > 0)
+                    ss = (DWORD)us;
+            }
+        }
+        if (ss) {
+            Sleep(ss * 1000);
+            ExitProcess(0);
+            return;
         }
-        Sleep(ss * 1000);
-        ExitProcess(0);
-        return;
     }
     apxHandleManagerInitialize();
     /* Create the main Pool */
     gPool = apxPoolCreate(NULL, 0);
 
     /* Parse the command line */
-    if ((lpCmdline = apxCmdlineParse(gPool, _options, _commands)) == NULL) {
+    if ((lpCmdline = apxCmdlineParse(gPool, _options, _commands, _altcmds)) == NULL) {
         apxLogWrite(APXLOG_MARK_ERROR "Invalid command line arguments");
         rv = 1;
         goto cleanup;
@@ -1514,14 +1639,17 @@ void __cdecl main(int argc, char **argv)
         }
     }
 
-    apxLogOpen(gPool, SO_LOGPATH, SO_LOGPREFIX);
+    apxLogOpen(gPool, SO_LOGPATH, SO_LOGPREFIX, SO_LOGROTATE);
     apxLogLevelSetW(NULL, SO_LOGLEVEL);
     apxLogWrite(APXLOG_MARK_DEBUG "Commons Daemon procrun log initialized");
+    if (SO_LOGROTATE)
+        apxLogWrite(APXLOG_MARK_DEBUG "Log will rotate each %d seconds.", SO_LOGROTATE);
+
     apxLogWrite(APXLOG_MARK_INFO "Commons Daemon procrun (%s %d-bit) started",
                 PRG_VERSION, PRG_BITS);
 
     AplZeroMemory(&gStdwrap, sizeof(APX_STDWRAP));
-
+    gStartPath = lpCmdline->szExePath;
     gStdwrap.szLogPath = SO_LOGPATH;
     /* In debug mode allways use console */
     if (lpCmdline->dwCmdIndex != 1) {
@@ -1550,26 +1678,30 @@ void __cdecl main(int argc, char **argv)
             if (!docmdRunService(lpCmdline))
                 rv = 4;
         break;
-        case 3: /* Stop Service */
-            if (!docmdStopService(lpCmdline))
+        case 3: /* Start service */
+            if (!docmdStartService(lpCmdline))
                 rv = 5;
         break;
-        case 4: /* Update Service parameters */
-            if (!docmdUpdateService(lpCmdline))
+        case 4: /* Stop Service */
+            if (!docmdStopService(lpCmdline))
                 rv = 6;
         break;
-        case 5: /* Install Service */
-            if (!docmdInstallService(lpCmdline))
+        case 5: /* Update Service parameters */
+            if (!docmdUpdateService(lpCmdline))
                 rv = 7;
         break;
-        case 6: /* Delete Service */
-            if (!docmdDeleteService(lpCmdline))
+        case 6: /* Install Service */
+            if (!docmdInstallService(lpCmdline))
                 rv = 8;
         break;
-        case 7: /* Print Usage and exit */
+        case 7: /* Delete Service */
+            if (!docmdDeleteService(lpCmdline))
+                rv = 9;
+        break;
+        case 8: /* Print Usage and exit */
             printUsage(lpCmdline, TRUE);
         break;
-        case 8: /* Print version and exit */
+        case 9: /* Print version and exit */
             printVersion();
         break;
         default:
@@ -1582,15 +1714,15 @@ void __cdecl main(int argc, char **argv)
 
 cleanup:
     if (rv) {
-        int ipx = 0;
-        if (rv > 0 && rv < 7)
-            ipx = rv;
+        int ix = 0;
+        if (rv > 0 && rv < 10)
+            ix = rv;
         apxLogWrite(APXLOG_MARK_ERROR "Commons Daemon procrun failed "
                                       "with exit value: %d (Failed to %s)",
-                                      rv, gSzProc[ipx]);
-        if (ipx > 2 && !_service_mode) {
+                                      rv, gSzProc[ix]);
+        if (ix > 2 && !_service_mode) {
             /* Print something to the user console */
-            apxDisplayError(FALSE, NULL, 0, "Failed to %s", gSzProc[ipx]);
+            apxDisplayError(FALSE, NULL, 0, "Failed to %s", gSzProc[ix]);
         }
     }
     else
@@ -1600,6 +1732,7 @@ cleanup:
     if (_service_status_handle)
         CloseHandle(_service_status_handle);
     _service_status_handle = NULL;
+    _service_mode = FALSE;
     _flushall();
     apxLogClose(NULL);
     apxHandleManagerDestroy();
diff --git a/src/native/windows/apps/prunsrv/prunsrv.h b/src/native/windows/apps/prunsrv/prunsrv.h
index 06a55c0..d862eb7 100644
--- a/src/native/windows/apps/prunsrv/prunsrv.h
+++ b/src/native/windows/apps/prunsrv/prunsrv.h
@@ -25,7 +25,7 @@
 #define _PRUNSRV_H
 
 #undef  PRG_VERSION
-#define PRG_VERSION    "1.0.7.0"
+#define PRG_VERSION    "1.0.8.0"
 #define PRG_REGROOT   L"Apache Software Foundation\\Procrun 2.0"
 
 #endif /* _PRUNSRV_H */
diff --git a/src/native/windows/apps/prunsrv/prunsrv.rc b/src/native/windows/apps/prunsrv/prunsrv.rc
index 8ef5b6c..399aa83 100644
--- a/src/native/windows/apps/prunsrv/prunsrv.rc
+++ b/src/native/windows/apps/prunsrv/prunsrv.rc
@@ -22,8 +22,8 @@
 IDI_MAINICON         ICON                   "../../resources/procrunw.ico"
 
 1 VERSIONINFO
- FILEVERSION 1,0,7,0
- PRODUCTVERSION 1,0,7,0
+ FILEVERSION 1,0,8,0
+ PRODUCTVERSION 1,0,8,0
  FILEFLAGSMASK 0x3fL
 #if defined(_DEBUG)
  FILEFLAGS 0x03L
diff --git a/src/native/windows/include/apxwin.h b/src/native/windows/include/apxwin.h
index 146729d..ecfa05f 100644
--- a/src/native/windows/include/apxwin.h
+++ b/src/native/windows/include/apxwin.h
@@ -63,6 +63,7 @@ typedef _W64 int            intptr_t;
 
 #define IS_INVALID_HANDLE(h) (((h) == NULL || (h) == INVALID_HANDLE_VALUE))
 #define IS_VALID_STRING(s)   ((s) != NULL && *(s) != 0)
+#define IS_EMPTY_STRING(s)   ((s) == NULL || *(s) == 0)
 
 #define DYNOLAD_TYPE_DECLARE(fnName, callconv, retType)             \
     typedef retType (callconv *PFN_##fnName)                        \
@@ -144,10 +145,9 @@ typedef enum {
 
 APX_OSLEVEL apxGetOsLevel();
 LPWSTR      AsciiToWide(LPCSTR s, LPWSTR ws);
-LPSTR       WideToAscii(LPCWSTR ws, LPSTR s);
 LPSTR       MzWideToAscii(LPCWSTR ws, LPSTR s);
-LPSTR       WideToUTF8(LPCWSTR ws);
-LPSTR       MzWideToUTF8(LPCWSTR ws);
+LPSTR       WideToANSI(LPCWSTR ws);
+LPSTR       MzWideToANSI(LPCWSTR ws);
 
 typedef struct APXMULTISZ APXMULTISZ;
 typedef APXMULTISZ*       LPAPXMULTISZ;
diff --git a/src/native/windows/include/cmdline.h b/src/native/windows/include/cmdline.h
index 3ec8677..57629bb 100644
--- a/src/native/windows/include/cmdline.h
+++ b/src/native/windows/include/cmdline.h
@@ -47,6 +47,7 @@ struct APXCMDLINEOPT {
 
 typedef struct APXCMDLINE {
     APXCMDLINEOPT       *lpOptions;
+    LPWSTR              szArgv0;
     LPWSTR              szExecutable;   /* Parsed argv0 */
     LPWSTR              szExePath;      /* Parsed argv0 */
     LPWSTR              szApplication;  /* Fist string after //CMD// */
@@ -60,7 +61,8 @@ typedef struct APXCMDLINE {
 LPAPXCMDLINE apxCmdlineParse(
     APXHANDLE hPool,
     APXCMDLINEOPT   *lpOptions,
-    LPCWSTR         *lpszCommands
+    LPCWSTR         *lpszCommands,
+    LPCWSTR         *lpszAltcmds
 );
 
 void apxCmdlineLoadEnvVars(
diff --git a/src/native/windows/include/log.h b/src/native/windows/include/log.h
index 64243d4..d7b5ed7 100644
--- a/src/native/windows/include/log.h
+++ b/src/native/windows/include/log.h
@@ -43,8 +43,8 @@ __APXBEGIN_DECLS
 #define APXLOG_LEVEL_WARN   2
 #define APXLOG_LEVEL_ERROR  3
 
-#define APXLOG_MARK_INFO    NULL, APXLOG_LEVEL_INFO,  TRUE,  NULL, 0, ""
-#define APXLOG_MARK_WARN    NULL, APXLOG_LEVEL_WARN,  TRUE,  NULL, 0, ""
+#define APXLOG_MARK_INFO    NULL, APXLOG_LEVEL_INFO,  TRUE,  __FILE__, __LINE__, ""
+#define APXLOG_MARK_WARN    NULL, APXLOG_LEVEL_WARN,  TRUE,  __FILE__, __LINE__, ""
 #define APXLOG_MARK_ERROR   NULL, APXLOG_LEVEL_ERROR, TRUE,  __FILE__, __LINE__, ""
 #define APXLOG_MARK_DEBUG   NULL, APXLOG_LEVEL_DEBUG, TRUE,  __FILE__, __LINE__, ""
 #define APXLOG_MARK_RAW     NULL, APXLOG_LEVEL_INFO,  FALSE, NULL, 0,
@@ -55,13 +55,15 @@ LPWSTR apxLogFile(
     LPCWSTR szPath,
     LPCWSTR szPrefix,
     LPCWSTR szName,
-    BOOL bTimeStamp
+    BOOL bTimeStamp,
+    DWORD dwRotate
 );
 
 HANDLE apxLogOpen(
     APXHANDLE hPool,
     LPCWSTR szPath,
-    LPCWSTR szPrefix
+    LPCWSTR szPrefix,
+    DWORD dwRotate
 );
 
 void apxLogClose(
diff --git a/src/native/windows/src/cmdline.c b/src/native/windows/src/cmdline.c
index 11f2937..cbd88ed 100644
--- a/src/native/windows/src/cmdline.c
+++ b/src/native/windows/src/cmdline.c
@@ -40,59 +40,41 @@ static WCHAR    _st_sys_appexe[MAX_PATH];
 LPAPXCMDLINE apxCmdlineParse(
     APXHANDLE hPool,
     APXCMDLINEOPT   *lpOptions,
-    LPCWSTR         *lpszCommands)
+    LPCWSTR         *lpszCommands,
+    LPCWSTR         *lpszAltcmds)
 {
 
     LPAPXCMDLINE lpCmdline = NULL;
-    DWORD l, i = 0, s = 1;
+    DWORD l, i, s = 1;
     LPWSTR p;
-    WCHAR  cmd[4];
     DWORD  match;
+    WCHAR  mh[SIZ_HUGLEN];
 
     if (_st_sys_argc < 1)
         return NULL;
 
-    l = lstrlenW(_st_sys_argvw[0]);
-    if (l < EXE_SUFFIXLEN)
-        return NULL;
     if (!(lpCmdline = (LPAPXCMDLINE)apxPoolCalloc(hPool, sizeof(APXCMDLINE))))
         return NULL;
-    lpCmdline->hPool       = hPool;
-    lpCmdline->lpOptions   = lpOptions;
-    lpCmdline->szExePath   = _st_sys_argvw[0];
-    p = lpCmdline->szExePath + l;
-
-    while (p > lpCmdline->szExePath) {
-        if (*p == L'\\') {
+    lpCmdline->hPool     = hPool;
+    lpCmdline->lpOptions = lpOptions;
+    if (GetModuleFileNameW(GetModuleHandle(NULL), mh, SIZ_HUGLEN)) {
+        GetLongPathNameW(mh, mh, SIZ_HUGLEN);
+        lpCmdline->szExePath = apxPoolStrdupW(hPool, mh);
+        lpCmdline->szArgv0   = apxPoolStrdupW(hPool, mh);
+        if (lpCmdline->szExePath == NULL || lpCmdline->szArgv0 == NULL)
+            return NULL;
+        if ((p = wcsrchr(lpCmdline->szExePath, L'\\')))
             *p++ = L'\0';
-            break;
-        }
-        p--;
-    }
-    /* Find the path if it wasn't specified in the argv[0] */
-    if (p == lpCmdline->szExePath) {
-        WCHAR  mh[SIZ_HUGLEN];
-        LPWSTR m;
-        if (GetModuleFileNameW(GetModuleHandle(NULL), mh, SIZ_HUGLEN)) {
-            GetLongPathNameW(mh, mh, SIZ_HUGLEN);
-            lpCmdline->szExePath = apxPoolStrdupW(hPool, mh);
-            m = lpCmdline->szExePath + lstrlenW(lpCmdline->szExePath);
-            while (m > lpCmdline->szExePath) {
-                if (*(m--) == L'\\') {
-                    *(++m) = L'\0';
-                    break;
-                }
-            }
-        }
+        else
+            return NULL;
     }
+    else
+        return NULL;
     lpCmdline->szExecutable = p;
-    p = _st_sys_argvw[0] + l - EXE_SUFFIXLEN;
-    if (lstrcmpiW(p, EXE_SUFFIX) == 0)
+    p = wcsrchr(lpCmdline->szExecutable, L'.');
+    if (p && lstrcmpiW(p, EXE_SUFFIX) == 0)
         *p = L'\0';
-    /* Strip CPU specific suffixes */
-    l = lstrlenW(_st_sys_argvw[0]);
-    if (l > EXE_SUFFIXLEN) {
-        p = _st_sys_argvw[0] + l - EXE_SUFFIXLEN;
+    if ((p = wcsrchr(lpCmdline->szExecutable, L'.'))) {
         if (lstrcmpiW(p, X86_SUFFIX) == 0) {
             *p = L'\0';
         }
@@ -103,40 +85,57 @@ LPAPXCMDLINE apxCmdlineParse(
             *p = L'\0';
         }
     }
-    if (lpszCommands && _st_sys_argc > 1 && lstrlenW(_st_sys_argvw[1]) > 2) {
-        LPWSTR ca = _st_sys_argvw[1];
+    if (_st_sys_argc > 1 && lstrlenW(_st_sys_argvw[1]) > 2) {
+        LPWSTR cp = _st_sys_argvw[1];
+        LPWSTR cn = _st_sys_argc > 2 ? _st_sys_argvw[2] : NULL;
+        LPWSTR ca = cp;
+        i = 0;
         if (ca[0] == L'/' && ca[1] == L'/') {
-            l   = 0;
             ca += 2;
-            while (*ca && *ca != L'/') {
-                cmd[l] = *ca;
-                if (++l > 2)
+            if ((cn = wcschr(ca, L'/'))) {
+                *cn++ = L'\0';
+                while (*cn == L'/')
+                    cn++;
+                if (*cn == L'\0')
+                    cn = NULL;
+            }
+            if (cn == NULL)
+                cn = lpCmdline->szExecutable;
+            while (lpszCommands[i]) {
+                if (lstrcmpW(lpszCommands[i++], ca) == 0) {
+                    lpCmdline->dwCmdIndex = i;
                     break;
-                ca++;
+                }
             }
-            cmd[l] = L'\0';
-            if (*ca == L'\0' || *ca == L'/') {
-                while (lpszCommands[i]) {
-                    if (lstrcmpW(lpszCommands[i++], cmd) == 0) {
-                        lpCmdline->dwCmdIndex = i;
-                        break;
-                    }
+            if (lpCmdline->dwCmdIndex) {
+                lpCmdline->szApplication = cn;
+                s = 2;
+            }
+            else {
+                apxLogWrite(APXLOG_MARK_ERROR "Unrecognized cmd option %S", cp);
+                return NULL;
+            }
+        }
+        else {
+            while (lpszAltcmds[i]) {
+                if (lstrcmpW(lpszAltcmds[i++], ca) == 0) {
+                    lpCmdline->dwCmdIndex = i;
+                    break;
                 }
             }
             if (lpCmdline->dwCmdIndex) {
-                while (*ca == '/')
-                    *(ca++) = L'\0';
-                if (*ca == '\0')
-                    lpCmdline->szApplication = _st_sys_argvw[0];
+                s = 2;
+                if (cn && iswalnum(*cn)) {
+                    s++;
+                    lpCmdline->szApplication = cn;
+                }
                 else
-                    lpCmdline->szApplication = ca;
+                    lpCmdline->szApplication = lpCmdline->szExecutable;
             }
             else {
-                apxLogWrite(APXLOG_MARK_ERROR "Unrecognized cmd option %S",
-                            _st_sys_argvw[1]);
+                apxLogWrite(APXLOG_MARK_ERROR "Unrecognized cmd option %S", cp);
                 return NULL;
             }
-            s = 2;
         }
     }
     else {
diff --git a/src/native/windows/src/javajni.c b/src/native/windows/src/javajni.c
index e3dafb8..85a46d7 100644
--- a/src/native/windows/src/javajni.c
+++ b/src/native/windows/src/javajni.c
@@ -792,8 +792,18 @@ apxJavaLoadMainClass(APXHANDLE hJava, LPCSTR szClassName,
     if (hJava->dwType != APXHANDLE_TYPE_JVM)
         return FALSE;
     lpJava = APXHANDLE_DATA(hJava);
-    if (!__apxJvmAttach(lpJava))
+    if (!lpJava)
         return FALSE;
+    if (IS_EMPTY_STRING(szMethodName))
+        szMethodName = "main";
+    if (lstrcmpA(szClassName, "java/lang/System") == 0) {
+        /* Usable only for exit method, so force */
+        szSignature  = "(I)V";
+        szMethodName = "exit";
+    }
+    lstrlcpyA(lpJava->clWorker.sClazz, 1024, szClassName);
+    lstrlcpyA(lpJava->clWorker.sMethod, 512, szMethodName);
+
     jClazz = JNICALL_1(FindClass, JAVA_CLASSSTRING);
     if (!jClazz) {
         JVM_EXCEPTION_CLEAR(lpJava);
@@ -802,7 +812,6 @@ apxJavaLoadMainClass(APXHANDLE hJava, LPCSTR szClassName,
     }
     lpJava->clString.jClazz = JNICALL_1(NewGlobalRef, jClazz);
     JNI_LOCAL_UNREF(jClazz);
-
     /* Find the class */
     jClazz  = JNICALL_1(FindClass, szClassName);
     if (!jClazz) {
@@ -814,15 +823,6 @@ apxJavaLoadMainClass(APXHANDLE hJava, LPCSTR szClassName,
     lpJava->clWorker.jClazz  = JNICALL_1(NewGlobalRef, jClazz);
     JNI_LOCAL_UNREF(jClazz);
 
-    if (!szMethodName)
-        szMethodName = "main";
-    if (lstrcmpA(szClassName, "java/lang/System") == 0) {
-        /* Usable only for exit method, so force */
-        szSignature  = "(I)V";
-        szMethodName = "exit";
-    }
-    lstrlcpyA(lpJava->clWorker.sClazz, 1024, szClassName);
-    lstrlcpyA(lpJava->clWorker.sMethod, 512, szMethodName);
     lpJava->clWorker.jMethod = JNICALL_3(GetStaticMethodID,
                                          lpJava->clWorker.jClazz,
                                          szMethodName, szSignature);
@@ -855,16 +855,18 @@ apxJavaLoadMainClass(APXHANDLE hJava, LPCSTR szClassName,
  */
 static DWORD WINAPI __apxJavaWorkerThread(LPVOID lpParameter)
 {
-#define WORKER_EXIT(x)  { rv = x; goto finished; }
+#define WORKER_EXIT(x)  do { rv = x; goto finished; } while(0)
     DWORD rv = 0;
-    LPAPXJAVAVM lpJava;
+    LPAPXJAVAVM lpJava = NULL;
     LPAPXJAVA_THREADARGS pArgs = (LPAPXJAVA_THREADARGS)lpParameter;
     APXHANDLE hJava;
 
-    hJava = (APXHANDLE)pArgs->hJava;
+    hJava  = (APXHANDLE)pArgs->hJava;
     if (hJava->dwType != APXHANDLE_TYPE_JVM)
         WORKER_EXIT(1);
-
+    lpJava = APXHANDLE_DATA(pArgs->hJava);
+    if (!lpJava)
+        WORKER_EXIT(1);
     if (!apxJavaInitialize(pArgs->hJava,
                            pArgs->szClassPath,
                            pArgs->lpOptions,
@@ -882,17 +884,16 @@ static DWORD WINAPI __apxJavaWorkerThread(LPVOID lpParameter)
                               pArgs->szClassName,
                               pArgs->szMethodName,
                               pArgs->lpArguments)) {
-        WORKER_EXIT(2);
+        WORKER_EXIT(3);
     }
     apxJavaSetOut(pArgs->hJava, TRUE,  pArgs->szStdErrFilename);
     apxJavaSetOut(pArgs->hJava, FALSE, pArgs->szStdOutFilename);
 
-    lpJava = APXHANDLE_DATA(pArgs->hJava);
     /* Check if we have a class and a method */
     if (!lpJava->clWorker.jClazz || !lpJava->clWorker.jMethod)
-        WORKER_EXIT(2);
+        WORKER_EXIT(4);
     if (!__apxJvmAttach(lpJava))
-        WORKER_EXIT(3);
+        WORKER_EXIT(5);
     apxLogWrite(APXLOG_MARK_DEBUG "Java Worker thread started %s:%s",
                 lpJava->clWorker.sClazz, lpJava->clWorker.sMethod);
     lpJava->dwWorkerStatus = 1;
@@ -902,26 +903,30 @@ static DWORD WINAPI __apxJavaWorkerThread(LPVOID lpParameter)
               lpJava->clWorker.jMethod,
               lpJava->clWorker.jArgs);
     if (JVM_EXCEPTION_CHECK(lpJava)) {
-        WORKER_EXIT(4);
+        WORKER_EXIT(6);
     }
     else {
         __apxJvmDetach(lpJava);
     }
 finished:
-    lpJava->dwWorkerStatus = 0;
-    apxLogWrite(APXLOG_MARK_DEBUG "Java Worker thread finished %s:%s with status=%d",
-                lpJava->clWorker.sClazz, lpJava->clWorker.sMethod, rv);
-    SetEvent(lpJava->hWorkerSync);
+    if (lpJava) {
+        lpJava->dwWorkerStatus = 0;
+        apxLogWrite(APXLOG_MARK_DEBUG "Java Worker thread finished %s:%s with status=%d",
+                    lpJava->clWorker.sClazz, lpJava->clWorker.sMethod, rv);
+        SetEvent(lpJava->hWorkerSync);
+    }
     ExitThread(rv);
     /* never gets here but keep the compiler happy */
-    return 0;
+    return rv;
 }
 
+BOOL
 apxJavaStart(LPAPXJAVA_THREADARGS pArgs)
 {
-
     LPAPXJAVAVM lpJava;
     lpJava = APXHANDLE_DATA(pArgs->hJava);
+    if (!lpJava)
+        return FALSE;
     lpJava->dwWorkerStatus = 0;
     lpJava->hWorkerSync    = CreateEvent(NULL, FALSE, FALSE, NULL);
     lpJava->hWorkerThread  = CreateThread(NULL,
@@ -936,6 +941,8 @@ apxJavaStart(LPAPXJAVA_THREADARGS pArgs)
     ResumeThread(lpJava->hWorkerThread);
     /* Wait until the worker thread initializes */
     WaitForSingleObject(lpJava->hWorkerSync, INFINITE);
+    if (lpJava->dwWorkerStatus == 0)
+        return FALSE;
     if (lstrcmpA(lpJava->clWorker.sClazz, "java/lang/System")) {
         /* Give some time to initialize the thread
          * Unless we are calling System.exit(0).
diff --git a/src/native/windows/src/log.c b/src/native/windows/src/log.c
index c7fc941..8b8e8e8 100644
--- a/src/native/windows/src/log.c
+++ b/src/native/windows/src/log.c
@@ -20,6 +20,7 @@
 
 #define LINE_SEP    "\r\n"
 #define LOGF_EXT    L".%04d-%02d-%02d.log"
+#define LOGF_EXR    L".%04d-%02d-%02d.%02d%02d%02d.log"
 
 static LPCSTR _log_level[] = {
     "[debug] ",
@@ -32,9 +33,11 @@ static LPCSTR _log_level[] = {
 typedef struct apx_logfile_st {
     HANDLE      hFile;
     DWORD       dwLogLevel;
+    DWORD       dwRotate;
     SYSTEMTIME  sysTime;
     WCHAR       szPath[SIZ_PATHLEN];
     WCHAR       szPrefix[MAX_PATH];
+    WCHAR       szFile[MAX_PATH];
 } apx_logfile_st;
 
 /* Per-application master log file */
@@ -42,13 +45,60 @@ static apx_logfile_st *_st_sys_loghandle = NULL;
 
 static apx_logfile_st  _st_sys_errhandle = { NULL, APXLOG_LEVEL_WARN, FALSE};
 
+static void logRotate(apx_logfile_st *lf, LPSYSTEMTIME t)
+{
+    WCHAR sName[SIZ_PATHLEN];
+    ULARGE_INTEGER cft;
+    ULARGE_INTEGER lft;
+    HANDLE h;
+
+    if (lf->dwRotate == 0)
+        return;
+
+    SystemTimeToFileTime(&lf->sysTime, (LPFILETIME)&lft);
+    SystemTimeToFileTime(t, (LPFILETIME)&cft);
+    if (cft.QuadPart < (lft.QuadPart + lf->dwRotate * 10000000ULL))
+        return;
+    /* Rotate time */
+    lf->sysTime = *t;
+    if (lf->dwRotate < 86400)
+        wsprintfW(sName, L"\\%s"  LOGF_EXR,
+                  lf->szPrefix,
+                  lf->sysTime.wYear,
+                  lf->sysTime.wMonth,
+                  lf->sysTime.wDay,
+                  lf->sysTime.wHour,
+                  lf->sysTime.wMinute,
+                  lf->sysTime.wSecond);
+    else
+        wsprintfW(sName, L"\\%s"  LOGF_EXT,
+                  lf->szPrefix,
+                  lf->sysTime.wYear,
+                  lf->sysTime.wMonth,
+                  lf->sysTime.wDay);
+    lstrlcpyW(lf->szFile, MAX_PATH, lf->szPath);
+    lstrlcatW(lf->szFile, MAX_PATH, sName);
+    h =  CreateFileW(lf->szFile,
+                     GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
+                     NULL,
+                     OPEN_ALWAYS,
+                     FILE_ATTRIBUTE_NORMAL | FILE_FLAG_WRITE_THROUGH | FILE_FLAG_SEQUENTIAL_SCAN,
+                     NULL);
+    if (h == INVALID_HANDLE_VALUE) {
+        /* TODO: Log something */
+        return;
+    }
+    CloseHandle(lf->hFile);
+    lf->hFile = h;
+}
 
 LPWSTR apxLogFile(
     APXHANDLE hPool,
     LPCWSTR szPath,
     LPCWSTR szPrefix,
     LPCWSTR szName,
-    BOOL bTimeStamp)
+    BOOL bTimeStamp,
+    DWORD dwRotate)
 {
     LPWSTR sRet;
     WCHAR sPath[SIZ_PATHLEN];
@@ -68,20 +118,33 @@ LPWSTR apxLogFile(
         szPrefix = L"";
     if (!szName)
         szName   = L"";
-    if (bTimeStamp)
-        wsprintfW(sName,
-                  L"\\%s%s" LOGF_EXT,
+    if (bTimeStamp) {
+        if (dwRotate != 0 && dwRotate < 86400)
+            wsprintfW(sName,
+                  L"\\%s%s" LOGF_EXR,
                   szPrefix,
                   szName,
                   sysTime.wYear,
                   sysTime.wMonth,
-                  sysTime.wDay);
-    else
+                  sysTime.wDay,
+                  0,
+                  0,
+                  0);
+        else
+            wsprintfW(sName,
+                      L"\\%s%s" LOGF_EXT,
+                      szPrefix,
+                      szName,
+                      sysTime.wYear,
+                      sysTime.wMonth,
+                      sysTime.wDay);
+    }
+    else {
         wsprintfW(sName,
                   L"\\%s%s",
                   szPrefix,
                   szName);
-
+    }
     sRet = apxPoolAlloc(hPool, (SIZ_PATHLEN) * sizeof(WCHAR));
     /* Set default level to info */
     CreateDirectoryW(sPath, NULL);
@@ -99,7 +162,8 @@ LPWSTR apxLogFile(
 HANDLE apxLogOpen(
     APXHANDLE hPool,
     LPCWSTR szPath,
-    LPCWSTR szPrefix)
+    LPCWSTR szPrefix,
+    DWORD dwRotate)
 {
 
     WCHAR sPath[SIZ_PATHLEN];
@@ -127,11 +191,21 @@ HANDLE apxLogOpen(
     }
     if (!szPrefix)
         szPrefix = L"commons-daemon";
-    wsprintfW(sName, L"\\%s"  LOGF_EXT,
-              szPrefix,
-              sysTime.wYear,
-              sysTime.wMonth,
-              sysTime.wDay);
+    if (dwRotate != 0 && dwRotate < 86400)
+        wsprintfW(sName, L"\\%s"  LOGF_EXR,
+                  szPrefix,
+                  sysTime.wYear,
+                  sysTime.wMonth,
+                  sysTime.wDay,
+                  0,
+                  0,
+                  0);
+    else
+        wsprintfW(sName, L"\\%s"  LOGF_EXT,
+                  szPrefix,
+                  sysTime.wYear,
+                  sysTime.wMonth,
+                  sysTime.wDay);
     if (!(h = (apx_logfile_st *)apxPoolCalloc(hPool, sizeof(apx_logfile_st))))
         return INVALID_HANDLE_VALUE;
     /* Set default level to info */
@@ -140,10 +214,11 @@ HANDLE apxLogOpen(
 
     h->sysTime = sysTime;
     lstrlcpyW(h->szPath, MAX_PATH, sPath);
-    lstrlcatW(sPath, MAX_PATH, sName);
+    lstrlcpyW(h->szFile, MAX_PATH, sPath);
+    lstrlcatW(h->szFile, MAX_PATH, sName);
     lstrlcpyW(h->szPrefix, MAX_PATH, szPrefix);
 
-    h->hFile =  CreateFileW(sPath,
+    h->hFile =  CreateFileW(h->szFile,
                       GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
                       NULL,
                       OPEN_ALWAYS,
@@ -153,9 +228,12 @@ HANDLE apxLogOpen(
         /* Make sure we write somewhere */
         h = &_st_sys_errhandle;
         apxDisplayError(FALSE, NULL, 0,
-                        "Unable to create logger at '%S'\n", sPath);
+                        "Unable to create logger at '%S'\n", h->szFile);
         return (HANDLE)h;
     }
+    else {
+        h->dwRotate = dwRotate;
+    }
     /* Set this file as system log file */
     if (!_st_sys_loghandle)
         _st_sys_loghandle = h;
@@ -226,7 +304,7 @@ apxLogWrite(
     }
     if (dwLevel < lf->dwLogLevel)
         return 0;
-    if (f) {
+    if (f && (lf->dwLogLevel == APXLOG_LEVEL_DEBUG || dwLevel == APXLOG_LEVEL_ERROR)) {
         f = (szFile + lstrlenA(szFile) - 1);
         while(f != szFile && '\\' != *f && '/' != *f)
             f--;
@@ -234,7 +312,7 @@ apxLogWrite(
             f++;
     }
     else
-        f = "";
+        f = NULL;
     szBp = buffer;
     if (!szFormat) {
         if (err == 0) {
@@ -271,6 +349,7 @@ apxLogWrite(
             GetLocalTime(&t);
             if (dolock) {
                 APX_LOGLOCK(lf->hFile);
+                logRotate(lf, &t);
             }
             if (bTimeStamp) {
                 wsprintfA(sb, "[%d-%02d-%02d %02d:%02d:%02d] ",
@@ -279,7 +358,7 @@ apxLogWrite(
                 WriteFile(lf->hFile, sb, lstrlenA(sb), &wr, NULL);
             }
             WriteFile(lf->hFile, _log_level[dwLevel],
-                          strlen(_log_level[dwLevel]), &wr, NULL);
+                      lstrlenA(_log_level[dwLevel]), &wr, NULL);
             if (f && lf->dwLogLevel == APXLOG_LEVEL_DEBUG) {
                 wsprintfA(sb, "(%10s:%-4d) ", f, dwLine);
                 WriteFile(lf->hFile, sb, lstrlenA(sb), &wr, NULL);
diff --git a/src/native/windows/src/private.h b/src/native/windows/src/private.h
index bf47a11..6abc3c5 100644
--- a/src/native/windows/src/private.h
+++ b/src/native/windows/src/private.h
@@ -253,8 +253,6 @@ typedef struct APXREGENUM {
 } APXREGENUM, *LPAPXREGENUM;
 
 BOOL    apxRegistryEnumServices(LPAPXREGENUM lpEnum, LPAPXSERVENTRY lpEntry);
-
-BOOL    apxSetServiceDescriptionW(LPCWSTR szServiceName, LPCWSTR szDescription);
 BOOL    apxGetServiceDescriptionW(LPCWSTR szServiceName, LPWSTR szDescription,
                                   DWORD dwDescriptionLength);
 BOOL    apxGetServiceUserW(LPCWSTR szServiceName, LPWSTR szUser,
diff --git a/src/native/windows/src/registry.c b/src/native/windows/src/registry.c
index c284f22..e82a71d 100644
--- a/src/native/windows/src/registry.c
+++ b/src/native/windows/src/registry.c
@@ -1062,32 +1062,6 @@ BOOL apxRegistryEnumServices(LPAPXREGENUM lpEnum, LPAPXSERVENTRY lpEntry)
     return TRUE;
 }
 
-/* We could use the ChangeServiceConfig2 on WIN2K+
- * For now use the registry.
- */
-BOOL apxSetServiceDescriptionW(LPCWSTR szServiceName, LPCWSTR szDescription)
-{
-    HKEY  hKey;
-    WCHAR wcName[SIZ_RESLEN];
-    DWORD rc;
-
-    if (lstrlenW(szServiceName) > SIZ_RESMAX)
-        return FALSE;
-    lstrcpyW(wcName, REGSERVICE_ROOT);
-    lstrcatW(wcName, szServiceName);
-
-    rc = RegOpenKeyExW(HKEY_LOCAL_MACHINE, wcName, 0, KEY_WRITE, &hKey);
-    if (rc != ERROR_SUCCESS) {
-        return FALSE;
-    }
-
-    rc = RegSetValueExW(hKey, REGDESCRIPTION, 0, REG_SZ, (CONST BYTE *)szDescription,
-                        (lstrlenW(szDescription) + 1) * sizeof(WCHAR));
-    SAFE_CLOSE_KEY(hKey);
-
-    return rc == ERROR_SUCCESS;
-}
-
 BOOL apxGetServiceDescriptionW(LPCWSTR szServiceName, LPWSTR szDescription,
                                DWORD dwDescriptionLength)
 {
diff --git a/src/native/windows/src/service.c b/src/native/windows/src/service.c
index 0f3e686..5596669 100644
--- a/src/native/windows/src/service.c
+++ b/src/native/windows/src/service.c
@@ -23,11 +23,6 @@
         (h) = NULL;                                     \
     }
 
-#define CHANGE_SERVICE(h, b, u, p, d)   \
-    ChangeServiceConfigW(h, SERVICE_NO_CHANGE, SERVICE_NO_CHANGE,   \
-                         SERVICE_NO_CHANGE,b,NULL,NULL,NULL,        \
-                         u,p,d)
-
 typedef struct APXSERVICE {
     /* Are we a service manager or we are the service itself */
     BOOL            bManagerMode;
@@ -197,6 +192,7 @@ apxServiceSetNames(APXHANDLE hService,
                    LPCWSTR szPassword)
 {
     LPAPXSERVICE lpService;
+    DWORD dwServiceType = SERVICE_NO_CHANGE;
 
     if (hService->dwType != APXHANDLE_TYPE_SERVICE)
         return FALSE;
@@ -208,17 +204,28 @@ apxServiceSetNames(APXHANDLE hService,
     /* Check if the ServiceOpen has been called */
     if (IS_INVALID_HANDLE(lpService->hService))
         return FALSE;
-    if (!CHANGE_SERVICE(lpService->hService,
-                                        szImagePath,
-                                        szUsername,
-                                        szPassword,
-                                        szDisplayName)) {
+    if (szUsername || szPassword)
+        dwServiceType = SERVICE_WIN32_OWN_PROCESS;
+    if (!ChangeServiceConfigW(lpService->hService,
+                              dwServiceType,
+                              SERVICE_NO_CHANGE,
+                              SERVICE_NO_CHANGE,
+                              szImagePath,
+                              NULL,
+                              NULL,
+                              NULL,
+                              szUsername,
+                              szPassword,
+                              szDisplayName)) {
         apxLogWrite(APXLOG_MARK_SYSERR);
         return FALSE;
     }
     if (szDescription) {
-        return apxSetServiceDescriptionW(lpService->stServiceEntry.szServiceName,
-                                         szDescription);
+        SERVICE_DESCRIPTIONW desc;
+        desc.lpDescription = (LPWSTR)szDescription;
+        return ChangeServiceConfig2(lpService->hService,
+                                    SERVICE_CONFIG_DESCRIPTION,
+                                    &desc);
     }
     return TRUE;
 }
diff --git a/src/native/windows/src/utils.c b/src/native/windows/src/utils.c
index c633389..f0fd49e 100644
--- a/src/native/windows/src/utils.c
+++ b/src/native/windows/src/utils.c
@@ -147,40 +147,26 @@ LPWSTR AsciiToWide(LPCSTR s, LPWSTR ws)
     return pszSave;
 }
 
-LPSTR WideToAscii(LPCWSTR ws, LPSTR s)
-{
-    LPSTR pszSave = s;
-
-    if (!ws) {
-        *s = '\0';
-        return pszSave;
-    }
-    do {
-        *s++ = (CHAR)*ws;
-    } while( *ws++);
-    return pszSave;
-}
-
-LPSTR WideToUTF8(LPCWSTR ws)
+LPSTR WideToANSI(LPCWSTR ws)
 {
 
     LPSTR s;
-    int cch = WideCharToMultiByte(CP_UTF8, 0, ws, -1, NULL, 0, NULL, NULL);
+    int cch = WideCharToMultiByte(CP_ACP, 0, ws, -1, NULL, 0, NULL, NULL);
     s = (LPSTR)apxAlloc(cch);
-    if (!WideCharToMultiByte(CP_UTF8, 0, ws, -1, s, cch, NULL, NULL)) {
+    if (!WideCharToMultiByte(CP_ACP, 0, ws, -1, s, cch, NULL, NULL)) {
         apxFree(s);
         return NULL;
     }
     return s;
 }
 
-LPWSTR UTF8ToWide(LPCSTR cs)
+LPWSTR ANSIToWide(LPCSTR cs)
 {
 
     LPWSTR s;
-    int cch = MultiByteToWideChar(CP_UTF8, 0, cs, -1, NULL, 0);
+    int cch = MultiByteToWideChar(CP_ACP, 0, cs, -1, NULL, 0);
     s = (LPWSTR)apxAlloc(cch * sizeof(WCHAR));
-    if (!MultiByteToWideChar(CP_UTF8, 0, cs, -1, s, cch)) {
+    if (!MultiByteToWideChar(CP_ACP, 0, cs, -1, s, cch)) {
         apxFree(s);
         return NULL;
     }
@@ -203,7 +189,7 @@ LPSTR MzWideToAscii(LPCWSTR ws, LPSTR s)
     return pszSave;
 }
 
-LPSTR MzWideToUTF8(LPCWSTR ws)
+LPSTR MzWideToANSI(LPCWSTR ws)
 {
     LPSTR str;
     LPSTR s;
@@ -211,7 +197,7 @@ LPSTR MzWideToUTF8(LPCWSTR ws)
     int cch = 0;
 
     for ( ; p && *p; p++) {
-        int len = WideCharToMultiByte(CP_UTF8, 0, p, -1, NULL, 0, NULL, NULL);
+        int len = WideCharToMultiByte(CP_ACP, 0, p, -1, NULL, 0, NULL, NULL);
         if (len > 0)
             cch += len;
         while (*p)
@@ -222,7 +208,7 @@ LPSTR MzWideToUTF8(LPCWSTR ws)
 
     p = ws;
     for ( ; p && *p; p++) {
-        int len = WideCharToMultiByte(CP_UTF8, 0, p, -1, s, cch, NULL, NULL);
+        int len = WideCharToMultiByte(CP_ACP, 0, p, -1, s, cch, NULL, NULL);
         if (len > 0) {
             s = s + len;
             cch -= len;
@@ -441,6 +427,8 @@ LPTSTR apxStrCharRemove(LPTSTR szString, TCHAR chSkip)
 {
   LPTSTR p = szString;
   LPTSTR q = szString;
+  if (IS_EMPTY_STRING(szString))
+    return szString;
   while (*p) {
     if(*p != chSkip)
       *q++ = *p;
@@ -456,6 +444,8 @@ DWORD apxStrCharRemoveA(LPSTR szString, CHAR chSkip)
   LPSTR p = szString;
   LPSTR q = szString;
   DWORD c = 0;
+  if (IS_EMPTY_STRING(szString))
+    return c;
   while (*p) {
     if(*p != chSkip)
       *q++ = *p;
@@ -473,6 +463,8 @@ DWORD apxStrCharRemoveW(LPWSTR szString, WCHAR chSkip)
   LPWSTR p = szString;
   LPWSTR q = szString;
   DWORD  c = 0;
+  if (IS_EMPTY_STRING(szString))
+    return c;
   while (*p) {
     if(*p != chSkip)
       *q++ = *p;
@@ -490,6 +482,9 @@ apxStrCharReplaceA(LPSTR szString, CHAR chReplace, CHAR chReplaceWith)
 {
   LPSTR p = szString;
   LPSTR q = szString;
+  
+  if (IS_EMPTY_STRING(szString))
+    return;
   while (*p) {
     if(*p == chReplace)
       *q++ = chReplaceWith;
@@ -505,6 +500,8 @@ apxStrCharReplaceW(LPWSTR szString, WCHAR chReplace, WCHAR chReplaceWith)
 {
   LPWSTR p = szString;
   LPWSTR q = szString;
+  if (IS_EMPTY_STRING(szString))
+    return;
   while (*p) {
     if(*p == chReplace)
       *q++ = chReplaceWith;
diff --git a/src/samples/Tomcat5.sh b/src/samples/Tomcat5.sh
deleted file mode 100755
index c9d7e91..0000000
--- a/src/samples/Tomcat5.sh
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/bin/sh
-##############################################################################
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-##############################################################################
-#
-# Small shell script to show how to start/stop Tomcat using jsvc
-# If you want to have Tomcat running on port 80 please modify the server.xml
-# file:
-#
-#    <!-- Define a non-SSL HTTP/1.1 Connector on port 80 -->
-#    <Connector className="org.apache.catalina.connector.http.HttpConnector"
-#               port="80" minProcessors="5" maxProcessors="75"
-#               enableLookups="true" redirectPort="8443"
-#               acceptCount="10" debug="0" connectionTimeout="60000"/>
-#
-# That is for Tomcat-5.0.x (Apache Tomcat/5.0)
-#
-# Adapt the following lines to your configuration
-JAVA_HOME=/home2/java/j2sdk1.4.2_03
-CATALINA_HOME=/home/tomcat5/tomcat5/jakarta-tomcat-5/build
-DAEMON_HOME=/home/jfclere/daemon
-TOMCAT_USER=tomcat5
-
-# for multi instances adapt those lines.
-TMP_DIR=/var/tmp
-PID_FILE=/var/run/jsvc.pid
-CATALINA_BASE=/home/tomcat5/tomcat5/jakarta-tomcat-5/build
-
-CATALINA_OPTS="-Djava.library.path=/home/jfclere/jakarta-tomcat-connectors/jni/native/.libs"
-CLASSPATH=\
-$JAVA_HOME/lib/tools.jar:\
-$CATALINA_HOME/bin/commons-daemon.jar:\
-$CATALINA_HOME/bin/bootstrap.jar
-
-case "$1" in
-  start)
-    #
-    # Start Tomcat
-    #
-    $DAEMON_HOME/src/native/unix/jsvc $JSVC_OPTS \
-    -user $TOMCAT_USER \
-    -home $JAVA_HOME \
-    -Dcatalina.home=$CATALINA_HOME \
-    -Dcatalina.base=$CATALINA_BASE \
-    -Djava.io.tmpdir=$TMP_DIR \
-    -wait 10 \
-    -pidfile $PID_FILE \
-    -outfile $CATALINA_HOME/logs/catalina.out \
-    -errfile '&1' \
-    $CATALINA_OPTS \
-    -cp $CLASSPATH \
-    org.apache.catalina.startup.Bootstrap
-    #
-    # To get a verbose JVM
-    #-verbose \
-    # To get a debug of jsvc.
-    #-debug \
-    exit $?
-    ;;
-
-  stop)
-    #
-    # Stop Tomcat
-    #
-    $DAEMON_HOME/src/native/unix/jsvc $JSVC_OPTS \
-    -stop \
-    -pidfile $PID_FILE \
-    org.apache.catalina.startup.Bootstrap
-    exit $?
-    ;;
-
-  *)
-    echo "Usage tomcat.sh start/stop"
-    exit 1;;
-esac
diff --git a/src/samples/Tomcat7.sh b/src/samples/Tomcat7.sh
deleted file mode 100755
index d52774b..0000000
--- a/src/samples/Tomcat7.sh
+++ /dev/null
@@ -1,235 +0,0 @@
-#!/bin/sh
-
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# resolve links - $0 may be a softlink
-ARG0="$0"
-while [ -h "$ARG0" ]; do
-  ls=`ls -ld "$ARG0"`
-  link=`expr "$ls" : '.*-> \(.*\)$'`
-  if expr "$link" : '/.*' > /dev/null; then
-    ARG0="$link"
-  else
-    ARG0="`dirname $ARG0`/$link"
-  fi
-done
-DIRNAME="`dirname $ARG0`"
-PROGRAM="`basename $ARG0`"
-for o
-do
-  case "$o" in
-    --java-home )
-        JAVA_HOME="$2"
-        shift; shift;
-        continue
-    ;;
-    --catalina-home )
-        CATALINA_HOME="$2"
-        shift; shift;
-        continue
-    ;;
-    --catalina-base )
-        CATALINA_BASE="$2"
-        shift; shift;
-        continue
-    ;;
-    --catalina-pid )
-        CATALINA_PID="$2"
-        shift; shift;
-        continue
-    ;;
-    --tomcat-user )
-        TOMCAT_USER="$2"
-        shift; shift;
-        continue
-    ;;
-    * )
-        break
-    ;;
-  esac
-done
-# OS specific support (must be 'true' or 'false').
-cygwin=false;
-darwin=false;
-case "`uname`" in
-    CYGWIN*)
-        cygwin=true
-        ;;
-    Darwin*)
-        darwin=true
-        ;;
-esac
-
-# Use the maximum available, or set MAX_FD != -1 to use that
-test ".$MAX_FD" = . && MAX_FD="maximum"
-# Setup parameters for running the jsvc
-#
-test ".$TOMCAT_USER" = . && TOMCAT_USER=tomcat
-# Set JAVA_HOME to working JDK or JRE
-# JAVA_HOME=/opt/jdk-1.6.0.22
-# If not set we'll try to guess the JAVA_HOME
-# from java binary if on the PATH
-#
-if [ -z "$JAVA_HOME" ]; then
-    JAVA_BIN="`which java 2>/dev/null || type java 2>&1`"
-    test -x "$JAVA_BIN" && JAVA_HOME="`dirname $JAVA_BIN`"
-    test ".$JAVA_HOME" != . && JAVA_HOME=`cd "$JAVA_HOME/.." >/dev/null; pwd`
-else
-    JAVA_BIN="$JAVA_HOME/bin/java"
-fi
-
-# Only set CATALINA_HOME if not already set
-test ".$CATALINA_HOME" = . && CATALINA_HOME=`cd "$DIRNAME/.." >/dev/null; pwd`
-test ".$CATALINA_BASE" = . && CATALINA_BASE="$CATALINA_HOME"
-test ".$CATALINA_MAIN" = . && CATALINA_MAIN=org.apache.catalina.startup.Bootstrap
-test ".$JSVC" = . && JSVC="$CATALINA_BASE/bin/jsvc"
-
-# Ensure that any user defined CLASSPATH variables are not used on startup,
-# but allow them to be specified in setenv.sh, in rare case when it is needed.
-CLASSPATH=
-JAVA_OPTS=
-if [ -r "$CATALINA_BASE/bin/setenv.sh" ]; then
-  . "$CATALINA_BASE/bin/setenv.sh"
-elif [ -r "$CATALINA_HOME/bin/setenv.sh" ]; then
-  . "$CATALINA_HOME/bin/setenv.sh"
-fi
-
-# Add on extra jar files to CLASSPATH
-test ".$CLASSPATH" != . && CLASSPATH="${CLASSPATH}:"
-CLASSPATH="$CLASSPATH$CATALINA_HOME/bin/bootstrap.jar:$CATALINA_HOME/bin/commons-daemon.jar"
-
-test ".$CATALINA_OUT" = . && CATALINA_OUT="$CATALINA_BASE/logs/catalina-daemon.out"
-test ".$CATALINA_TMP" = . && CATALINA_TMP="$CATALINA_BASE/temp"
-
-# Add tomcat-juli.jar to classpath
-# tomcat-juli.jar can be over-ridden per instance
-if [ -r "$CATALINA_BASE/bin/tomcat-juli.jar" ] ; then
-  CLASSPATH="$CLASSPATH:$CATALINA_BASE/bin/tomcat-juli.jar"
-else
-  CLASSPATH="$CLASSPATH:$CATALINA_HOME/bin/tomcat-juli.jar"
-fi
-# Set juli LogManager config file if it is present and an override has not been issued
-if [ -z "$LOGGING_CONFIG" ]; then
-  if [ -r "$CATALINA_BASE/conf/logging.properties" ]; then
-    LOGGING_CONFIG="-Djava.util.logging.config.file=$CATALINA_BASE/conf/logging.properties"
-  else
-    # Bugzilla 45585
-    LOGGING_CONFIG="-Dnop"
-  fi
-fi
-
-test ".$LOGGING_MANAGER" = . && LOGGING_MANAGER="-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager"
-JAVA_OPTS="$JAVA_OPTS $LOGGING_MANAGER"
-
-# Set -pidfile
-test ".$CATALINA_PID" = . && CATALINA_PID="$CATALINA_BASE/logs/catalina-daemon.pid"
-
-# Increase the maximum file descriptors if we can
-if [ "$cygwin" = "false" ]; then
-    MAX_FD_LIMIT=`ulimit -H -n`
-    if [ "$?" -eq 0 ]; then
-        # Darwin does not allow RLIMIT_INFINITY on file soft limit
-        if [ "$darwin" = "true" -a "$MAX_FD_LIMIT" = "unlimited" ]; then
-            MAX_FD_LIMIT=`/usr/sbin/sysctl -n kern.maxfilesperproc`
-        fi
-        test ".$MAX_FD" = ".maximum" && MAX_FD="$MAX_FD_LIMIT"
-        ulimit -n $MAX_FD
-        if [ "$?" -ne 0 ]; then
-            echo "$PROGRAM: Could not set maximum file descriptor limit: $MAX_FD"
-        fi
-    else
-        echo "$PROGRAM: Could not query system maximum file descriptor limit: $MAX_FD_LIMIT"
-    fi
-fi
-
-# ----- Execute The Requested Command -----------------------------------------
-case "$1" in
-    run     )
-      shift
-      "$JSVC" $* \
-      $JSVC_OPTS \
-      -java-home "$JAVA_HOME" \
-      -pidfile "$CATALINA_PID" \
-      -wait 10 \
-      -nodetach \
-      -outfile "&1" \
-      -errfile "&2" \
-      -classpath "$CLASSPATH" \
-      "$LOGGING_CONFIG" $JAVA_OPTS $CATALINA_OPTS \
-      -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \
-      -Dcatalina.base="$CATALINA_BASE" \
-      -Dcatalina.home="$CATALINA_HOME" \
-      -Djava.io.tmpdir="$CATALINA_TMP" \
-      $CATALINA_MAIN
-      exit $?
-    ;;
-    start   )
-      "$JSVC" $JSVC_OPTS \
-      -java-home "$JAVA_HOME" \
-      -user $TOMCAT_USER \
-      -pidfile "$CATALINA_PID" \
-      -wait 10 \
-      -outfile "$CATALINA_OUT" \
-      -errfile "&1" \
-      -classpath "$CLASSPATH" \
-      "$LOGGING_CONFIG" $JAVA_OPTS $CATALINA_OPTS \
-      -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \
-      -Dcatalina.base="$CATALINA_BASE" \
-      -Dcatalina.home="$CATALINA_HOME" \
-      -Djava.io.tmpdir="$CATALINA_TMP" \
-      $CATALINA_MAIN
-      exit $?
-    ;;
-    stop    )
-      "$JSVC" $JSVC_OPTS \
-      -stop \
-      -pidfile "$CATALINA_PID" \
-      -classpath "$CLASSPATH" \
-      -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \
-      -Dcatalina.base="$CATALINA_BASE" \
-      -Dcatalina.home="$CATALINA_HOME" \
-      -Djava.io.tmpdir="$CATALINA_TMP" \
-      $CATALINA_MAIN
-      exit $?
-    ;;
-    version  )
-      "$JSVC" \
-      -java-home "$JAVA_HOME" \
-      -pidfile "$CATALINA_PID" \
-      -classpath "$CLASSPATH" \
-      -errfile "&2" \
-      -version \
-      -check \
-      $CATALINA_MAIN
-      if [ "$?" = 0 ]; then
-        "$JAVA_BIN" \
-        -classpath "$CATALINA_HOME/lib/catalina.jar" \
-        org.apache.catalina.util.ServerInfo
-      fi
-      exit $?
-    ;;
-    *       )
-      echo "Unkown command: \`$1'"
-      echo "Usage: $PROGRAM ( commands ... )"
-      echo "commands:"
-      echo "  run               Start Catalina without detaching from console"
-      echo "  start             Start Catalina"
-      echo "  stop              Stop Catalina"
-      echo "  version           What version of commons daemon and Tomcat"
-      echo "                    are you running?"
-      exit 1
-    ;;
-esac
diff --git a/src/test/org/apache/commons/daemon/SimpleDaemon.java b/src/test/java/org/apache/commons/daemon/SimpleDaemon.java
similarity index 100%
rename from src/test/org/apache/commons/daemon/SimpleDaemon.java
rename to src/test/java/org/apache/commons/daemon/SimpleDaemon.java

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/commons-daemon.git



More information about the pkg-java-commits mailing list