UIMA-2466 Add APR-iconv to Windows build and other small fixes

git-svn-id: https://svn.apache.org/repos/asf/uima/uimacpp/trunk@1378926 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/README.4src b/README.4src
index 3c3936a..42b7062 100644
--- a/README.4src
+++ b/README.4src
@@ -43,7 +43,7 @@
 Xerces-C      >= 2.8
 JDK           for building the JNI interface
 ActiveMQ CPP  >= 3.4.1  (optional) to build the UIMA-AS service wrapper
-APR-Util      >= 1.3.8  (optional) an ActiveMQ prerequisite
+APR-util      >= 1.3.8  (optional) an ActiveMQ prerequisite
 
 
 On Linux the following GNU build tools are required:
@@ -72,7 +72,7 @@
 --------------------
 
 To build an SDK it is recommended that all prerequisite components, APR, ICU, Xerces-C,
-ActiveMQ-cpp and APR-Util be built from source and "make
+ActiveMQ-cpp and APR-util be built from source and "make
 install" run. They need not be installed in system directories.
 
 Prerequisite installs from compatible binary distributions can be used to build
@@ -154,18 +154,18 @@
 ----------------------
 
 To build an SDK all prerequisite components, APR, ICU, Xerces-C,
-ActiveMQ-cpp and APR-Util must first be built on the machine, and a
+ActiveMQ-cpp, APR-util and APR-iconv must first be built, and a
 JDK installed. The location of the dependencies must be set in
-environment variables APR_HOME, ICU_HOME, XERCES_HOME, ACTIVEMQ_HOME,
-APU_HOME and JAVA_INCLUDE.
+environment variables APR_HOME, ICU_HOME, XERCES_HOME, ACTIVEMQ_HOME
+and JAVA_HOME.
 
 For details on building the dependencies, please see section 5.2 of 
 this document.
 
-In order to be able to build annotators, the SDK must be built as the
-annotator MSVC projects setup requires the environment variable 
-UIMACPP_HOME to be set to the location of the SDK and finds all
-dependencies under UIMACPP_HOME.
+In order to be able to build annotators, the SDK must be built as
+described below in step 4, since the annotator projects use the 
+environment variable UIMACPP_HOME to locate the UIMA libraries
+and dependencies.
 
 If using MSVC Express Edition, first run these prebuild steps. 
   - cd uimacpp-2.X.Y\src
@@ -195,9 +195,10 @@
   builddocs
 
 4 Build the SDK tree:
-  set MSVCRT_HOME to the directory with the msvc*.dll files required.
-  set ACTIVEMQ_HOME and APU_HOME if building and distributing the ActiveMQ CPP service wrapper, deployCppService.
+  set MSVCRT_HOME to the directory with the required msvc*.dll files.
+  set ACTIVEMQ_HOME if building the ActiveMQ service wrapper, deployCppService.
 
+  cd \uimacpp-2.X.Y
   buildsdk "target_dir [clean]"
 
 5 Package the SDK zipfile by creating a compressed folder of 
@@ -248,12 +249,11 @@
 
 
 ----------------------------------------------------------------------------
-5. Building the dependencies: APR, APR-Util, ICU, Xerses-c and Activemq-cpp
+5. Building the dependencies: APR et al, ICU, Xerses-c and Activemq-cpp
 ----------------------------------------------------------------------------
 
 Download and build information for these libraries are at:
   APR      - http://apr.apache.org/
-  APR-Util - http://apr.apache.org/
   ICU      - http://www.icu-project.org/
   XERCES   - http://xml.apache.org/xerces-c/
   ACTIVEMQ - http://activemq.apache.org/cms/download.html
@@ -261,7 +261,7 @@
 ACTIVEMQ CPP library version 3.2 or higher is required to support
 the ActiveMQ failover protocol and to support multi-byte payload data.
 ACTIVEMQ CPP 3.2 and higher has a dependency on APR at version 1.3.8
-or higher and APR-Util 1.3.8.
+or higher and APR-util 1.3.8.  (On Windows APR-util requires APR-iconv)
 
 
 5.1 Building Dependencies on Unix/MacOSX
@@ -274,10 +274,11 @@
 5.2 Building Dependencies on Windows:
 -------------------------------------
 The build of dependent libraries on Windows is less consistent.
-APR and APR-Util libraries are expected in %APR_HOME%\Release and
-%APU_HOME%\Release respectively.  ActiveMQ libraries are in
-%ACTIVEMQ_HOME%\vs2008-build\ReleaseDLL (or DebugDLL) and ActiveMQ
-headers are expected in %ACTIVEMQ_HOME%\src\main.
+The APR components must be checked out and built in parallel 
+directories (see apr.apache.org) and the libraries are expected 
+to be located relative to %APR_HOME%.
+ActiveMQ libraries are in %ACTIVEMQ_HOME%\vs2008-build\ReleaseDLL
+and the headers are expected in %ACTIVEMQ_HOME%\src\main.
 
 On Windows, buildsdk command tries to copy the msvc*.dll runtime libs from
 C:\Program Files\Microsoft Visual Studio8\VC\redist\x86\Microsoft.VC80.CRT 
@@ -299,16 +300,17 @@
 Run 
 sed.exe -f downgrade_sln_vc9_to_vc8.sed vs2008-build/activemq-cpp.vcproj > vs2008-build/activemq-cpp2005.vcproj
 
-On Windows, the only activemq-cpp targets needed by uimacpp are ReleaseDLL and DebugDLL,
+The only activemq-cpp target needed by uimacpp is ReleaseDLL,
  e.g. devenv vs2008-build/activemq-cpp2005.vcproj /build ReleaseDLL
-      devenv vs2008-build/activemq-cpp2005.vcproj /build DebugDLL
  
-APR and APR-Util
-Also, the APR and APR-Util libraries can be built by launching
-libapr.dsp or by following the instructions in Makefile.win.
+The three APR libraries can be built by launching aprutil.dsw and
+building libaprutil or by following the instructions in Makefile.win.
 
 XERCES and ICU
 Binary distributions are available for Xerces and ICU.
+Use only those built with a compatible version of Visual Studio!
+Currently the SDK uses xerces-c_2 so if a higher version is 
+installed the MSVC project files must be edited.
 
 
 ----------------------------------
diff --git a/buildsdk.cmd b/buildsdk.cmd
index 6de5411..4d3af04 100644
--- a/buildsdk.cmd
+++ b/buildsdk.cmd
@@ -34,7 +34,6 @@
 	echo       ICU_HOME - root of the ICU install. Required.

 	echo       XERCES_HOME - root of the XERCES install. Required.

 	echo       MSVCRT_HOME - directory with required msvc*.dll files

-	echo       APU_HOME - root of the APR Util install Required if ACTIVEMQ_HOME is set.

 	echo       ACTIVEMQ_HOME - root of the XERCES install. Optional.

 	echo     Optional environment variable:

 	echo       UIMA_INSTALL - 'install' location of uimacpp build.

@@ -55,10 +54,6 @@
 if "%APR_HOME%" == "" goto Missing

 if "%ICU_HOME%" == "" goto Missing

 if "%XERCES_HOME%" == "" goto Missing

-if not "%ACTIVEMQ_HOME%" == "" (

-  if "%APU_HOME%" == "" goto MissingAprUtil

-

-)

 

 echo.

 echo SDK directory tree will be built in %UIMA_DIR%

@@ -101,12 +96,13 @@
 	goto error

 )

 

-if "%MSVCRT_HOME%" == "" (

-        set MSVCRT_HOME=C:\Program Files\Microsoft Visual Studio 8\VC\redist\x86\Microsoft.VC80.CRT

-        echo MSVCRT_HOME undefined: trying: "%MSVCRT_HOME%"

-)

+if not "%MSVCRT_HOME%" == "" goto check

 

-if not exist "%MSVCRT_HOME%" (

+set MSVCRT_HOME=C:\Program Files\Microsoft Visual Studio 8\VC\redist\x86\Microsoft.VC80.CRT

+echo MSVCRT_HOME undefined: trying: "%MSVCRT_HOME%"

+

+:check

+if not exist "%MSVCRT_HOME%"\msvc*.dll (

         echo ERROR: MSVCRT_HOME "%MSVCRT_HOME%" is invalid.

         goto error

 )

@@ -188,8 +184,8 @@
 echo copying from %APR_HOME%...

 mkdir %UIMA_DIR%\include\apr

 xcopy /Q /Y %APR_HOME%\include\apr*.h %UIMA_DIR%\include\apr

-xcopy /Q /Y %APR_HOME%\Release\libapr*.dll %UIMA_DIR%\bin

-xcopy /Q /Y %APR_HOME%\Release\libapr*.lib %UIMA_DIR%\lib

+xcopy /Q /Y %APR_HOME%\Release\libapr-*.dll %UIMA_DIR%\bin

+xcopy /Q /Y %APR_HOME%\Release\libapr-*.lib %UIMA_DIR%\lib

 

 

 echo.

@@ -203,8 +199,11 @@
 echo copying from %XERCES_HOME%...

 mkdir %UIMA_DIR%\include\xercesc

 xcopy /S /Q /Y %XERCES_HOME%\include\xercesc %UIMA_DIR%\include\xercesc

-xcopy /Q /Y %XERCES_HOME%\bin\xerces-c_2*.dll %UIMA_DIR%\bin

-xcopy /Q /Y %XERCES_HOME%\lib\xerces-c_2*.lib %UIMA_DIR%\lib

+xcopy /Q /Y %XERCES_HOME%\bin\xerces-c_*.dll %UIMA_DIR%\bin

+xcopy /Q /Y %XERCES_HOME%\lib\xerces-c_*.lib %UIMA_DIR%\lib

+del %UIMA_DIR%\bin\xerces-c*d.dll 2> NUL

+del %UIMA_DIR%\lib\xerces-c*d.lib 2> NUL

+del %UIMA_DIR%\lib\xerces-c_static* 2> NUL

 

 echo.

 echo copying MSVC redistribution libs

@@ -268,19 +267,21 @@
 

 if not "%ACTIVEMQ_HOME%" == "" (

   echo.

-  echo copying from %APU_HOME%...

-  xcopy /Q /Y %APU_HOME%\Release\libaprutil*.dll %UIMA_DIR%\bin

-  xcopy /Q /Y %APU_HOME%\Release\libaprutil*.lib %UIMA_DIR%\lib

+  echo copying libaprutil and libapriconv ...

+  xcopy /Q /Y %APR_HOME%\..\apr-util\Release\libaprutil*.dll %UIMA_DIR%\bin

+  xcopy /Q /Y %APR_HOME%\..\apr-util\Release\libaprutil*.lib %UIMA_DIR%\lib

+  xcopy /Q /Y %APR_HOME%\..\apr-iconv\Release\libapriconv*.dll %UIMA_DIR%\bin

+  xcopy /Q /Y %APR_HOME%\..\apr-iconv\Release\libapriconv*.lib %UIMA_DIR%\lib

   echo.

   echo copying from %ACTIVEMQ_HOME%...

   xcopy /Q /Y %ACTIVEMQ_HOME%\vs2008-build\win32\ReleaseDLL\activemq-cpp.dll %UIMA_DIR%\bin

-  xcopy /Q /Y %ACTIVEMQ_HOME%\vs2008-build\win32\DebugDLL\activemq-cppd.dll %UIMA_DIR%\bin

 )

 

 echo cleaning the target tree

 for /R %UIMA_DIR% %%d in (.) do del %%d\*~ 2> NUL

 

 echo DONE SDK image in %UIMA_DIR%

+echo Please check that all copies were successful

 goto end

 

 :Missing

@@ -288,11 +289,6 @@
 echo and must contain the directories produced by their "install" builds

 goto end

 

-:MissingAprUtil

-echo APU_HOME must be specifed when ACTIVEMQ_HOME is specified

-echo and must contain the directories produced by apr-util "install" build

-goto end

-

 :error

 echo FAILED: UIMA C++ SDK was not built.

 

diff --git a/docs/overview_and_setup.html b/docs/overview_and_setup.html
index 17d5685..79d56c9 100644
--- a/docs/overview_and_setup.html
+++ b/docs/overview_and_setup.html
@@ -241,7 +241,7 @@
 <h4>2.3.2 On Linux</h4>
 <ul>
     <code>
-      start the ActiveMQ broker following directions in $UIMA_HOME/uima-as/readme<br>
+      start the ActiveMQ broker following directions in $UIMA_HOME/README<br>
       cd $UIMACPP_HOME/examples/tutorial<br>
       runRemoteAsyncAE.sh  tcp://localhost:61616 MeetingAnnotator \<br>
       <dir><code>-d descriptors/Deploy_MeetingAnnotator.xml</code></dir>
@@ -250,7 +250,7 @@
 <h4>2.3.3 On Windows</h4>
 <ul>
     <code>
-      start the ActiveMQ broker following directions in %UIMA_HOME%\uima-as\readme<br>
+      start the ActiveMQ broker following directions in %UIMA_HOME%\README<br>
       cd %UIMACPP_HOME%\examples\tutorial<br>
       runRemoteAsyncAE  tcp://localhost:61616 MeetingAnnotator \<br>
       <dir><code>-d descriptors\Deploy_MeetingAnnotator.xml</code></dir>
diff --git a/src/checkEnvVars.bat b/src/checkEnvVars.bat
index f181562..c6e1553 100644
--- a/src/checkEnvVars.bat
+++ b/src/checkEnvVars.bat
@@ -22,8 +22,8 @@
 @REM which are include in the SDK

 @REM These may be overridden by setting APR_HOME or ICU_HOME or XERCES_HOME

 

-if not exist "%JAVA_INCLUDE%\jni.h" (

-  echo Error: failed to find JDK headers in %JAVA_INCLUDE%

+if not exist "%JAVA_HOME%\include\jni.h" (

+  echo Error: failed to find JDK headers in %JAVA_HOME%

   goto end

 )

 

diff --git a/src/deployCppService.vcproj b/src/deployCppService.vcproj
index 726fab6..95ae7c4 100644
--- a/src/deployCppService.vcproj
+++ b/src/deployCppService.vcproj
@@ -64,10 +64,10 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="wsock32.lib rpcrt4.lib activemq-cppD.lib xerces-c_2.lib icuuc.lib libapr-1.lib uimaD.lib"
+				AdditionalDependencies="wsock32.lib rpcrt4.lib activemq-cpp.lib xerces-c_2.lib icuuc.lib libapr-1.lib uimaD.lib"
 				OutputFile="$(OutDir)/deployCppServiceD.exe"
 				LinkIncremental="1"
-				AdditionalLibraryDirectories="&quot;$(OutDir)\..\lib&quot;;&quot;$(APR_HOME)\$(ConfigurationName)&quot;;&quot;$(XERCES_HOME)\lib&quot;;&quot;$(ICU_HOME)\lib&quot;;&quot;$(UIMACPP_HOME)\lib&quot;;&quot;$(ACTIVEMQ_HOME)\vs2008-build\win32\DebugDLL&quot;"
+				AdditionalLibraryDirectories="&quot;$(OutDir)\..\lib&quot;;&quot;$(APR_HOME)\Release&quot;;&quot;$(XERCES_HOME)\lib&quot;;&quot;$(ICU_HOME)\lib&quot;;&quot;$(UIMACPP_HOME)\lib&quot;;&quot;$(ACTIVEMQ_HOME)\vs2008-build\win32\ReleaseDLL&quot;"
 				GenerateDebugInformation="true"
 				ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"
 				SubSystem="1"
@@ -148,7 +148,7 @@
 				AdditionalDependencies="wsock32.lib rpcrt4.lib activemq-cpp.lib xerces-c_2.lib icuuc.lib libapr-1.lib uima.lib"
 				OutputFile="$(OutDir)/deployCppService.exe"
 				LinkIncremental="1"
-				AdditionalLibraryDirectories="&quot;$(OutDir)\..\lib&quot;;&quot;$(APR_HOME)\$(ConfigurationName)&quot;;&quot;$(XERCES_HOME)\lib&quot;;&quot;$(ICU_HOME)\lib&quot;;&quot;$(UIMACPP_HOME)\lib&quot;;&quot;$(ACTIVEMQ_HOME)\vs2008-build\win32\ReleaseDLL&quot;"
+				AdditionalLibraryDirectories="&quot;$(OutDir)\..\lib&quot;;&quot;$(APR_HOME)\Release&quot;;&quot;$(XERCES_HOME)\lib&quot;;&quot;$(ICU_HOME)\lib&quot;;&quot;$(UIMACPP_HOME)\lib&quot;;&quot;$(ACTIVEMQ_HOME)\vs2008-build\win32\ReleaseDLL&quot;"
 				GenerateDebugInformation="false"
 				ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"
 				SubSystem="1"
diff --git a/src/runaecpp.vcproj b/src/runaecpp.vcproj
index fb4ff81..3adf462 100644
--- a/src/runaecpp.vcproj
+++ b/src/runaecpp.vcproj
@@ -67,7 +67,7 @@
 				AdditionalDependencies="xerces-c_2.lib icuuc.lib libapr-1.lib uimaD.lib"

 				OutputFile="$(OutDir)/runAECppD.exe"

 				LinkIncremental="1"

-				AdditionalLibraryDirectories="&quot;$(OutDir)\..\lib&quot;;&quot;$(APR_HOME)\$(ConfigurationName)&quot;;&quot;$(XERCES_HOME)\lib&quot;;&quot;$(ICU_HOME)\lib&quot;;&quot;$(UIMACPP_HOME)\lib&quot;"

+				AdditionalLibraryDirectories="&quot;$(OutDir)\..\lib&quot;;&quot;$(APR_HOME)\Release&quot;;&quot;$(XERCES_HOME)\lib&quot;;&quot;$(ICU_HOME)\lib&quot;;&quot;$(UIMACPP_HOME)\lib&quot;"

 				GenerateDebugInformation="true"

 				ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"

 				SubSystem="1"

@@ -148,7 +148,7 @@
 				AdditionalDependencies="xerces-c_2.lib icuuc.lib libapr-1.lib uima.lib"

 				OutputFile="$(OutDir)/runAECpp.exe"

 				LinkIncremental="1"

-				AdditionalLibraryDirectories="&quot;$(OutDir)\..\lib&quot;;&quot;$(APR_HOME)\$(ConfigurationName)&quot;;&quot;$(XERCES_HOME)\lib&quot;;&quot;$(ICU_HOME)\lib&quot;;&quot;$(UIMACPP_HOME)\lib&quot;"

+				AdditionalLibraryDirectories="&quot;$(OutDir)\..\lib&quot;;&quot;$(APR_HOME)\Release&quot;;&quot;$(XERCES_HOME)\lib&quot;;&quot;$(ICU_HOME)\lib&quot;;&quot;$(UIMACPP_HOME)\lib&quot;"

 				GenerateDebugInformation="false"

 				ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"

 				SubSystem="1"

diff --git a/src/uimacpp.vcproj b/src/uimacpp.vcproj
index 32b8f8b..c49e441 100644
--- a/src/uimacpp.vcproj
+++ b/src/uimacpp.vcproj
@@ -43,7 +43,7 @@
 				Name="VCCLCompilerTool"

 				AdditionalOptions="/EHac"

 				Optimization="0"

-				AdditionalIncludeDirectories="cas;framework;jni;&quot;$(APR_HOME)\include&quot;;&quot;$(ICU_HOME)\include&quot;;&quot;$(XERCES_HOME)\include&quot;;&quot;$(JAVA_INCLUDE)&quot;;&quot;$(JAVA_INCLUDE)\win32&quot;;&quot;$(UIMACPP_HOME)\include&quot;;&quot;$(UIMACPP_HOME)\include\apr&quot;"

+				AdditionalIncludeDirectories="cas;framework;jni;&quot;$(APR_HOME)\include&quot;;&quot;$(ICU_HOME)\include&quot;;&quot;$(XERCES_HOME)\include&quot;;&quot;$(JAVA_HOME)\include&quot;;&quot;$(JAVA_HOME)\include\win32&quot;;&quot;$(UIMACPP_HOME)\include&quot;;&quot;$(UIMACPP_HOME)\include\apr&quot;"

 				PreprocessorDefinitions="_UIMA_LIBRARY_;UIMA_VERSION=1.4.4;UIMA_SUPPRESS_TIMING;WIN32;_WINDOWS;_USRDLL;_DEBUG;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"

 				IgnoreStandardIncludePath="false"

 				GeneratePreprocessedFile="0"

@@ -70,7 +70,7 @@
 				AdditionalDependencies="xerces-c_2.lib icuuc.lib libapr-1.lib"

 				OutputFile="$(OutDir)\..\bin\uimaD.dll"

 				LinkIncremental="1"

-				AdditionalLibraryDirectories="&quot;$(OutDir)&quot;;&quot;$(APR_HOME)\Debug&quot;;&quot;$(XERCES_HOME)\lib&quot;;&quot;$(ICU_HOME)\lib&quot;;&quot;$(UIMACPP_HOME)\lib&quot;"

+				AdditionalLibraryDirectories="&quot;$(OutDir)&quot;;&quot;$(APR_HOME)\Release&quot;;&quot;$(XERCES_HOME)\lib&quot;;&quot;$(ICU_HOME)\lib&quot;;&quot;$(UIMACPP_HOME)\lib&quot;"

 				GenerateDebugInformation="true"

 				ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"

 				GenerateMapFile="true"

@@ -134,7 +134,7 @@
 				Name="VCCLCompilerTool"

 				AdditionalOptions="/EHac"

 				Optimization="3"

-				AdditionalIncludeDirectories="cas;framework;jni;&quot;$(APR_HOME)\include&quot;;&quot;$(ICU_HOME)\include&quot;;&quot;$(XERCES_HOME)\include&quot;;&quot;$(JAVA_INCLUDE)&quot;;&quot;$(JAVA_INCLUDE)\win32&quot;;&quot;$(UIMACPP_HOME)\include&quot;;&quot;$(UIMACPP_HOME)\include\apr&quot;"

+				AdditionalIncludeDirectories="cas;framework;jni;&quot;$(APR_HOME)\include&quot;;&quot;$(ICU_HOME)\include&quot;;&quot;$(XERCES_HOME)\include&quot;;&quot;$(JAVA_HOME)\include&quot;;&quot;$(JAVA_HOME)\include\win32&quot;;&quot;$(UIMACPP_HOME)\include&quot;;&quot;$(UIMACPP_HOME)\include\apr&quot;"

 				PreprocessorDefinitions="_UIMA_LIBRARY_;UIMA_VERSION=1.4.4;UIMA_SUPPRESS_TIMING;WIN32;_WINDOWS;_USRDLL;TRACEOFF;NDEBUG;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"

 				ExceptionHandling="0"

 				RuntimeLibrary="2"

diff --git a/src/winmake.cmd b/src/winmake.cmd
index 8628b8c..6822d02 100644
--- a/src/winmake.cmd
+++ b/src/winmake.cmd
@@ -23,7 +23,7 @@
 set UIMACPP_HOME=

 

 REM need a Java JRE for the JNI interface

-if not exist %JAVA_INCLUDE%\jni.h goto nojava

+if not exist %JAVA_HOME%\include\jni.h goto nojava

 

 REM Other requied dependencies

 if "%APR_HOME%"==""     goto noapr

@@ -58,7 +58,7 @@
 goto end

 

 :nojava

-echo JAVA_INCLUDE is not set or does not contain jni.h

+echo JAVA_HOME is not set or does not contain include\jni.h

 

 :end

 endlocal