Blob Blame History Raw
diff --git a/lib/cpp/COPYING b/lib/cpp/COPYING
new file mode 100644
index 0000000..d62cc1a
--- /dev/null
+++ b/lib/cpp/COPYING
@@ -0,0 +1,31 @@
+
+SOFTWARE RIGHTS
+
+ANTLR 1989-2006 Developed by Terence Parr
+Partially supported by University of San Francisco & jGuru.com
+
+We reserve no legal rights to the ANTLR--it is fully in the
+public domain. An individual or company may do whatever
+they wish with source code distributed with ANTLR or the
+code generated by ANTLR, including the incorporation of
+ANTLR, or its output, into commerical software.
+
+We encourage users to develop software with ANTLR. However,
+we do ask that credit is given to us for developing
+ANTLR. By "credit", we mean that if you use ANTLR or
+incorporate any source code into one of your programs
+(commercial product, research project, or otherwise) that
+you acknowledge this fact somewhere in the documentation,
+research report, etc... If you like ANTLR and have
+developed a nice tool with the output, please mention that
+you developed it using ANTLR. In addition, we ask that the
+headers remain intact in our source code. As long as these
+guidelines are kept, we expect to continue enhancing this
+system and expect to make other tools available as they are
+completed.
+
+The primary ANTLR guy:
+
+Terence Parr
+parrt@cs.usfca.edu
+parrt@antlr.org
diff --git a/lib/cpp/Makefile.am b/lib/cpp/Makefile.am
new file mode 100644
index 0000000..769f9e2
--- /dev/null
+++ b/lib/cpp/Makefile.am
@@ -0,0 +1,5 @@
+SUBDIRS = antlr src
+ACLOCAL_AMFLAGS = -I m4
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = antlr2.pc
diff --git a/lib/cpp/antlr/CharScanner.hpp b/lib/cpp/antlr/CharScanner.hpp
index b92e0fa..ec3ff6f 100644
--- a/lib/cpp/antlr/CharScanner.hpp
+++ b/lib/cpp/antlr/CharScanner.hpp
@@ -26,6 +27,12 @@
 # include <stdio.h>
 #endif
 
+#ifdef __MINGW32__
+extern "C" {
+_CRTIMP int __cdecl __MINGW_NOTHROW     _strcmpi (const char*, const char*);
+}
+#endif
+
 #include <antlr/TokenStream.hpp>
 #include <antlr/RecognitionException.hpp>
 #include <antlr/SemanticException.hpp>
@@ -563,6 +570,8 @@ inline bool CharScannerLiteralsLess::operator() (const ANTLR_USE_NAMESPACE(std)s
 	{
 #ifdef NO_STRCASECMP
 		return (stricmp(x.c_str(),y.c_str())<0);
+#elif defined(__MINGW32__)
+		return (_strcmpi(x.c_str(),y.c_str())<0);
 #else
 		return (strcasecmp(x.c_str(),y.c_str())<0);
 #endif
diff --git a/lib/cpp/antlr/Makefile.am b/lib/cpp/antlr/Makefile.am
new file mode 100644
index 0000000..e05a50d
--- /dev/null
+++ b/lib/cpp/antlr/Makefile.am
@@ -0,0 +1,55 @@
+include_antlrdir = $(includedir)/antlr
+
+include_antlr_HEADERS = \
+	ANTLRException.hpp \
+	ANTLRUtil.hpp \
+	ASTArray.hpp \
+	ASTFactory.hpp \
+	AST.hpp \
+	ASTNULLType.hpp \
+	ASTPair.hpp \
+	ASTRefCount.hpp \
+	BaseAST.hpp \
+	BitSet.hpp \
+	CharBuffer.hpp \
+	CharInputBuffer.hpp \
+	CharScanner.hpp \
+	CharStreamException.hpp \
+	CharStreamIOException.hpp \
+	CircularQueue.hpp \
+	CommonAST.hpp \
+	CommonASTWithHiddenTokens.hpp \
+	CommonHiddenStreamToken.hpp \
+	CommonToken.hpp \
+	config.hpp \
+	InputBuffer.hpp \
+	IOException.hpp \
+	LexerSharedInputState.hpp \
+	LLkParser.hpp \
+	Makefile.am \
+	Makefile.in \
+	MismatchedCharException.hpp \
+	MismatchedTokenException.hpp \
+	NoViableAltException.hpp \
+	NoViableAltForCharException.hpp \
+	Parser.hpp \
+	ParserSharedInputState.hpp \
+	RecognitionException.hpp \
+	RefCount.hpp \
+	SemanticException.hpp \
+	String.hpp \
+	TokenBuffer.hpp \
+	Token.hpp \
+	TokenRefCount.hpp \
+	TokenStreamBasicFilter.hpp \
+	TokenStreamException.hpp \
+	TokenStreamHiddenTokenFilter.hpp \
+	TokenStream.hpp \
+	TokenStreamIOException.hpp \
+	TokenStreamRecognitionException.hpp \
+	TokenStreamRetryException.hpp \
+	TokenStreamRewriteEngine.hpp \
+	TokenStreamSelector.hpp \
+	TokenWithIndex.hpp \
+	TreeParser.hpp \
+	TreeParserSharedInputState.hpp
diff --git a/lib/cpp/antlr2.pc.in b/lib/cpp/antlr2.pc.in
new file mode 100644
index 0000000..50a6bef
--- /dev/null
+++ b/lib/cpp/antlr2.pc.in
@@ -0,0 +1,13 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+datarootdir=@datarootdir@
+datadir=@datadir@
+includedir=@includedir@
+
+Name: antlr2
+Description: C++ runtime for the ANTLR parser generator
+Version: @PACKAGE_VERSION@
+URL: http://www.antlr2.org/
+Libs: -L${libdir} -lantlr2
+Cflags: -I${includedir}/antlr
diff --git a/lib/cpp/configure.ac b/lib/cpp/configure.ac
new file mode 100644
index 0000000..cb3ec4e
--- /dev/null
+++ b/lib/cpp/configure.ac
@@ -0,0 +1,881 @@
+dnl --*- sh -*--
+##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx##
+## This file is part of ANTLR. See LICENSE.txt for licence  ##
+## details. Written by W. Haefelinger                       ##
+##                                                          ##
+## ...............Copyright (C) Wolfgang Haefelinger, 2004  ##
+## ...............Copyright (C) Thomas Sailer, 2011         ##
+##                                                          ##
+##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx##
+
+## Process this file with autoconf to produce a configure
+## script.
+AC_INIT(antlr, 2.7.7)
+AC_CONFIG_AUX_DIR(scripts)
+AM_INIT_AUTOMAKE(antlr, 2.7.7)
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_SRCDIR([README])
+AC_CONFIG_MACRO_DIR([m4])
+
+## ANTLR's core libraries for each supporte language. The variable
+## in  uppercase letters denotes the absolute name of the library.
+## When in  lower  cases  letters - see below - the variable just
+## holds the basename.
+AC_SUBST([ANTLR_JAR])
+AC_SUBST([ANTLR_LIB])
+AC_SUBST([ANTLR_NET])
+AC_SUBST([ANTLR_PY])
+AC_SUBST([ASTFRAME_NET])
+
+AC_SUBST([antlr_jar])
+AC_SUBST([antlr_lib])
+AC_SUBST([antlr_net])
+AC_SUBST([antlr_py])
+AC_SUBST([astframe_net])
+
+AC_SUBST([ANTLRFLAGS])
+AC_SUBST([ANTLR])
+AC_SUBST([ANTLR_ACTION_FILES])
+AC_SUBST([ANTLR_ANTLR_FILES])
+AC_SUBST([ANTLR_COMPILE_CMD])
+AC_SUBST([ANTLR_CYGWIN])
+AC_SUBST([ANTLR_MINGW])
+AC_SUBST([ANTLR_TOKDEF_FILES])
+AC_SUBST([ANTLR_WIN32])
+AC_SUBST([ANTLR_WITH_ANTLR_CMD])
+AC_SUBST([ANTLR_WITH_ANTLR_JAR])
+AC_SUBST([ARFLAGS])
+AC_SUBST([AR])
+AC_SUBST([AS])
+AC_SUBST([BOOTCLASSPATH])
+AC_SUBST([CSHARPCFLAGS])
+AC_SUBST([CSHARPC])
+AC_SUBST([CSHARP_COMPILE_CMD])
+AC_SUBST([CLR])
+AC_SUBST([CXX_COMPILE_CMD])
+AC_SUBST([CXX_LIB_CMD])
+AC_SUBST([CXX_LINK_CMD])
+AC_SUBST([CYGPATH])
+AC_SUBST([C_COMPILE_CMD])
+AC_SUBST([DEBUG])
+AC_SUBST([EXEEXT])
+AC_SUBST([JARFLAGS])
+AC_SUBST([JAR])
+AC_SUBST([JAR_CMD])
+AC_SUBST([JAVACFLAGS])
+AC_SUBST([JAVAC])
+AC_SUBST([JAVAFLAGS])
+AC_SUBST([JAVA])
+AC_SUBST([JAVA_CMD])
+AC_SUBST([JAVA_COMPILE_CMD])
+AC_SUBST([LIBEXT])
+AC_SUBST([MAKE])
+AC_SUBST([OBJEXT])
+AC_SUBST([PATCHLEVEL])
+AC_SUBST([PYTHONFLAGS])
+AC_SUBST([PYTHON])
+AC_SUBST([SUBVERSION])
+AC_SUBST([TIMESTAMP])
+AC_SUBST([TOUCH])
+AC_SUBST([VERBOSE])
+AC_SUBST([VERSION])
+AC_SUBST([WITH_EXAMPLES])
+AC_SUBST([abs_this_builddir])
+AC_SUBST([cxx])
+AC_SUBST([jar])
+AC_SUBST([java])
+AC_SUBST([javac])
+# create strong named assemblies [true|false(*)]
+AC_SUBST([STRONGNAME])
+# file containing public/private key pair for creating strong named
+# assemblies (no default value)
+AC_SUBST([KEYFILE])
+# Allow partially trusted callers (C#)
+AC_SUBST([APTC])
+
+
+## introduce package information as autoconf vars.
+VERSION=`echo $PACKAGE_VERSION | cut -d . -f 1`
+SUBVERSION=`echo $PACKAGE_VERSION | cut -d . -f 2`
+PATCHLEVEL=`echo $PACKAGE_VERSION | cut -d . -f 3`
+TIMESTAMP=`date +%Y%m%d`
+
+## @abs_this_builddir@  - absolute path to top of build directory.
+## According to GNU autoconf we can rely on that there's a proper
+## pwd around.
+abs_this_builddir=`pwd`
+
+## This is how we compile Java files ..
+JAVA_COMPILE_CMD="/bin/sh $abs_this_builddir/scripts/javac.sh"
+
+## This is how we run Java ..
+JAVA_CMD="/bin/sh $abs_this_builddir/scripts/java.sh"
+
+## This is how we pack Java (class) files ..
+JAR_CMD="/bin/sh $abs_this_builddir/scripts/jar.sh"
+
+## And this is how we are going to compile ANTLR grammar files ..
+ANTLR_COMPILE_CMD="/bin/sh $abs_this_builddir/scripts/antlr.sh"
+
+## This is how we compile CSHARP files ..
+CSHARP_COMPILE_CMD="/bin/sh $abs_this_builddir/scripts/csc.sh"
+
+## This is how we compile C++ files and how we are going to create
+## libantlr.a or antlr.lib etc. ..
+
+CXX_COMPILE_CMD="/bin/sh $abs_this_builddir/scripts/cxx.sh"
+CXX_LIB_CMD="/bin/sh $abs_this_builddir/scripts/lib.sh"
+CXX_LINK_CMD="/bin/sh $abs_this_builddir/scripts/link.sh"
+
+C_COMPILE_CMD="/bin/sh $abs_this_builddir/scripts/c.sh"
+
+ANTLR_JAR="$abs_this_builddir/antlr/antlr.jar"
+ANTLR_NET="$abs_this_builddir/lib/antlr.runtime.dll"
+ASTFRAME_NET="$abs_this_builddir/lib/antlr.astframe.dll"
+ANTLR_PY="$abs_this_builddir/lib/python/antlr/python.py"
+
+## Note: values might be overriden in C++ section.
+OBJEXT=".o"
+LIBEXT=".a"
+ANTLR_LIB="$abs_this_builddir/lib/cpp/src/libantlr.a"
+
+stdvars="scripts/config.vars"
+stddeps="scripts/config.deps"
+stdmake="scripts/config.make"
+
+##
+## option --enable-java
+##
+AX_ARG_ENABLE([java],[LANG_JAVA],[enable or disable ANTLR for Java (enabled)],[1],)
+
+##
+## option --enable-cxx
+##
+AX_ARG_ENABLE([cxx],[LANG_CXX],[enable or disable ANTLR for C++ (enabled)],[1],)
+
+##
+## option --enable-python
+##
+AX_ARG_ENABLE([python],[LANG_PY],[enable or disable ANTLR for Python (enabled).],[1],)
+
+##
+## option --enable-csharp
+##
+AX_ARG_ENABLE([csharp],[LANG_CS],[enable or disable ANTLR for C# (enabled)],[1],)
+
+##
+## option --enable-verbose=<level>
+##
+AX_ARG_ENABLE([verbose],[VERBOSE],[turn on verbosity when building package.],[0],)
+
+##
+## option --enable-debug=<level>
+##
+AX_ARG_ENABLE([debug],[DEBUG],[set debug level - any value greater zero enables a debug version],[0],)
+
+##
+## option --enable-examples
+##
+
+WITH_EXAMPLES=1
+
+AX_ARG_ENABLE([examples],[WITH_EXAMPLES],[include examples into this configuration (enabled)],[1],)
+
+##
+## option --enable-allow-partially-trusted-callers
+##
+
+APTC=1
+
+AX_ARG_ENABLE([allow-partially-trusted-callers],[APTC],[allow partially trusted callers (C#)],[1],)
+
+case $APTC in
+  0) APTC=false ;;
+  *) APTC=true  ;;
+esac
+    
+
+##
+## option --with-antlr-jar
+##
+ANTLR_WITH_ANTLR_JAR=""
+
+AC_ARG_WITH([antlr-jar],
+  [AC_HELP_STRING([--with-antlr-jar=ARG],
+      [use given file (antlr.jar) to bootstrap])
+    ],[
+    if test -n "${ANTLR_WITH_ANTLR_CMD}" ; then
+      opts="--with-antlr-jar,--with-antlr-cmd"
+      #AC_MSG_ERROR(
+      #  [this configuration options mutually exclusive: $opts])
+    fi
+    ANTLR_WITH_ANTLR_JAR="${withval}"]
+)
+
+##
+## option --with-antlr-cmd
+##
+ANTLR_WITH_ANTLR_CMD=""
+
+AC_ARG_WITH([antlr-cmd],
+  [AC_HELP_STRING([--with-antlr-cmd=ARG],
+      [use given command to compile ANTLR grammar files while bootstrapping..])
+    ],[
+    if test -n "${ANTLR_WITH_ANTLR_JAR}" ; then
+      opts="--with-antlr-jar,--with-antlr-cmd"
+      #AC_MSG_ERROR(
+      #  [this configuration options mutually exclusive: $opts])
+    fi
+    ANTLR_WITH_ANTLR_CMD="${withval}"
+  ]
+)
+
+##
+## option --with-strong-assemblies
+##
+STRONGNAME=false
+KEYFILE=
+
+AC_ARG_WITH([strong-assemblies],
+  [AC_HELP_STRING([--with-strong-assemblies=ARG],
+      [enable strong named assemblies by passing a keyfile holding a public/private key pair (only useful when building C#)])
+    ],[
+    STRONGNAME=true
+    KEYFILE="${withval}"
+  ]
+)
+
+AC_ARG_WITH([bootclasspath],
+  [AC_HELP_STRING([--with-bootclasspath=ARG],
+      [use this option to set bootclasspath when using jikes. ARG is a white
+        space seperated list of absolute file or directory names, typically
+        /opt/jdk1.3/jre/lib/rt.jar. In most cases this option is not requird
+        as configure tries to detect rt.jar itself. If configure fails or
+        detects the wrong boot library you may use this option. Note that
+        this option is only used when using jikes.
+        ])
+    ],[
+    BOOTCLASSPATH="${withval}"
+  ]
+)
+
+AX_ARG_WITH([cxx],[CXX],)
+
+AX_ARG_WITH([make],[MAKE],)
+
+AX_ARG_WITH([java],[JAVA],)
+
+AX_ARG_WITH([javac],[JAVAC],)
+
+AX_ARG_WITH([jar],[JAR],)
+
+AX_ARG_WITH([python],[PYTHON],)
+
+AX_ARG_WITH([csharpc],[CSHARPC],)
+
+#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx#
+#                     S T A R T   T E S T S                          #
+#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx#
+
+# get host_os set
+AC_CANONICAL_HOST
+
+LT_INIT([win32-dll])
+
+AC_ISC_POSIX
+AC_PROG_CC
+AM_PROG_CC_STDC
+AM_PROG_CC_C_O
+AC_HEADER_STDC
+AC_FUNC_ALLOCA
+AC_PROG_CPP
+AC_PROG_CXX
+AC_PROG_CXXCPP
+AC_LIBTOOL_WIN32_DLL
+AC_DISABLE_STATIC
+
+AC_LANG_CPLUSPLUS
+
+AC_CYGWIN
+AC_MINGW32
+AC_EXEEXT
+AC_OBJEXT
+
+AM_CONDITIONAL(WIN32, test x$CYGWIN = xyes -o x$MINGW32 = xyes)
+
+# Detect cygwin or mingw
+ANTLR_CYGWIN=no
+ANTLR_MINGW=no
+
+AC_MSG_CHECKING(whether this is Cygwin)
+case $host_os in
+   *cygwin* )
+    ANTLR_CYGWIN=yes
+    ;;
+  *)
+    AC_MSG_RESULT(no)
+  ;;
+esac
+
+AC_MSG_CHECKING(whether this is MinGW)
+case $host_os in
+   *mingw* )
+    ANTLR_MINGW=yes
+    ;;
+  *)
+    AC_MSG_RESULT(no)
+  ;;
+esac
+
+## Set common file extensions depending on OS we are running on.
+## File extensions depend on C++/C compiler in use. This values
+## are just guesses and redefined further below.
+
+case "${host_os}" in
+  *mingw*|*cygwin*)
+    OBJEXT=".o"
+    LIBEXT=".a"
+    EXEEXT=".exe"
+    ;;
+  *)
+    OBJEXT=".o"
+    LIBEXT=".a"
+    EXEEXT=""
+    ;;
+esac
+
+## Test whether we have cygpath
+test -z "$CYGPATH"    && AC_PATH_PROGS(CYGPATH, cygpath$EXEEXT )
+
+AC_SUBST([CYGPATH_M])
+AC_SUBST([CYGPATH_W])
+
+if test -n "$CYGPATH" ; then
+  CYGPATH_M="${CYGPATH} -m"
+  CYGPATH_W="${CYGPATH} -w"
+else
+  CYGPATH_M="echo"
+  CYGPATH_W="echo"
+fi
+
+AC_ARG_VAR(
+  [ANTLRFLAGS],
+  [Use environment variable ANTLRFLAGS to pass some extra flags to antlr
+   when compiling grammar (*.g) files.
+  ]
+)
+
+AX_PATH_PROGS([CP],  [/bin/cp   /usr/bin/cp   cp])
+AX_PATH_PROGS([ECHO],[/bin/echo /usr/bin/echo echo])
+AX_PATH_PROGS([FIND],[/bin/find /usr/bin/find find])
+
+AX_VAR_HEAD([CP])
+AX_VAR_HEAD([ECHO])
+AX_VAR_HEAD([FIND])
+
+#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx#
+#                             MAKE                                   #
+#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx#
+## Check whether there's a make program around. We search for a
+## couple of well know names within $PATH. A user may skip this
+## search by providing variable $MAKE.
+AC_ARG_VAR(
+  [MAKE],
+  [By default we search for "make", "gmake" and "gnumake" in your PATH
+   as well as "/bin/make" and "/usr/bin/make". You may  override  this
+   search by  using  enviromnent variable $MAKE.  Note that a GNU make
+   is required to build this package. However,  when  providing   your
+   own candidate a check for GNU make is skipped and all bets are on.
+  ]
+)
+
+## @MAKE@ shall contain absolut path name of make program found.
+
+## Search for well known make programs - take user given MAKE
+## into account. The result will be a list of valid make prog-
+## grams found and will be stored in variable MAKE.
+user_make="${MAKE}"
+AX_PATH_PROGS(
+  [MAKE],
+  [make gmake gnumake /bin/make /usr/bin/make]
+)
+
+## right now we need to have a GNU make around, other makes are
+## not supported and likely to fail.
+if test "x${user_make}" == "x" ; then
+  AX_GNU_MAKE(
+    [MAKE],
+    [
+     #AC_MSG_ERROR( [package requires GNU make])
+    ]
+  )
+fi
+
+## we lookup 'make' in PATH. If the one found is not the same
+## as the configured one we issue a warning message.
+AC_PATH_PROGS([just_make],[make],[%])
+
+case "${just_make}" in
+  ${MAKE})
+    ;;
+  *)
+    AC_CONFIG_COMMANDS([notice],[
+        AC_MSG_NOTICE([
+ ---------------------------------------------------------
+                   * WARNING *
+
+  This package has been configured to be build by using
+
+   $MAKE
+
+  It is very likely that just running "make" from  the
+  command line will fail. Please remember therefore to
+  use the configured version.
+ =========================================================
+          ])
+        ],[
+        MAKE="${MAKE}"
+      ]
+    )
+  ;;
+esac
+
+#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx#
+#                             JAVA                                   #
+#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx#
+## @JAVAC@ shall contain absolut path name of javac program and
+## similar to  CXXFLAGS, @JAVACFLAGS@ shall contain all options
+## required to compile JAVA source files.
+
+AC_ARG_VAR(
+  [JAVAC],
+  [By default we search for "jikes", "javac" and "gcj" in your $PATH
+   on how to comile Java source files.  You may override this search
+   by using enviromnent variable $JAVAC. JAVAC may contain a list of
+   candidates, either as absolute path names or as a relative one.
+   In case a relative name is given, a search  in $PATH will take
+   place, otherwise the absolute name is tried.
+  ]
+)
+AC_ARG_VAR(
+  [JAVACFLAGS],
+  [Environment variable JAVACFLAGS can be used to change or override
+   all flags required to compile Java source files. Note that
+   JAVACFLAGS understands the following:
+   "+ flag1 flag2 .." append  "flag1 flag2 .." to precomputed list
+   "- flag1 flag2 .." prepend "flag1 flag2 .." to precomputed list
+   "= flag1 flag2 ..   override with flag1 flag2 ..". If there is
+   a need to hardwire additional flags then edit scripts/javac.sh.in
+   and run "CONFIG_FILES=scripts/javac.sh ./config.status" again.
+  ]
+)
+## @JAVA@ shall contain absolut path name of java  program and
+## similar to  CXXFLAGS, @JAVAFLAGS@ shall contain all options
+## required to run JAVA class files.
+
+AC_ARG_VAR(
+  [JAVA],
+  [By default we search for "java" and "gij" in your PATH on how
+   to run Java class files. You may override this search by
+   using enviromnent variable $JAVA. JAVA may contain a list of
+   candidates, either as absolute path name or as a relative one.
+   In case of a relative name, a search in $PATH will take place.
+   Otherwise the absolute name will be accepted if existing.
+  ]
+)
+AC_ARG_VAR(
+  [JAVAFLAGS],
+  [Shall contain all flags required to run Java class files.
+   You may override by using environment variable JAVAFLAGS.
+  ]
+)
+
+AX_JAVA_PROGS(
+  [JAVA],
+  [java gij],
+  [AX_VAR_HEAD([JAVA])]
+)
+AX_JAVA_PROGS(
+  [JAVAC],
+  [jikes javac gcj],
+  [AX_VAR_HEAD([JAVAC])]
+)
+AX_JAVA_PROGS(
+  [JAR],
+  [fastjar jar],
+  [
+    AX_VAR_HEAD([JAR])
+  ]
+)
+
+case $LANG_JAVA in
+  1)
+    jar="`basename $JAR`"
+    jar="`echo ${jar}|sed 's,\..*$,,'`"
+
+    ## This macro tries to determine which javac compiler is
+    ## being used. Well  known  compilers are gcj, jikes and
+    ## javac. A unknown compiler is treated as  if javac has
+    ## been  given  in  the  very, very naive  hope that all
+    ## javac compiler have at least the same  options as the
+    ## original, ie. javac.
+    ## If your compiler is not in the list  and does not be-
+    ## have like javac, then you need  to  extend this macro
+    ## by writing a specialized test.
+    AX_WHICH_JAVAC([javac])
+    ## Jikes cannot live without having a Java around. Have
+    ## therefore a look into  Java  installations found for
+    ## a 'rt.jar'.
+    test -n "${BOOTCLASSPATH}" && {
+      for f in ${BOOTCLASSPATH} ; do
+        AC_MSG_CHECKING([bootclasspath \"$f\"])
+        test -f "${f}" -o -d "${f}" || {
+          AC_MSG_RESULT([does not exist])
+          AC_MSG_ERROR(
+            [
+===================================================================
+Please check arguments given to
+  --with-bootclasspath
+ or
+  \${BOOTCLASSPATH}
+Each argument must be a valid file or directory. Use whitespace to
+seperate your args.
+===================================================================
+          ])
+        }
+        AC_MSG_RESULT([good])
+      done
+    }
+    test -z "${BOOTCLASSPATH}" && {
+      case "${javac}" in
+        jikes)
+          BOOTCLASSPATH=""
+          set x ${JAVA}
+          while test $# -gt 1 ; do
+            x="$2" ; shift
+            d=`dirname $x`
+            test -d "$d" || continue
+            d=`(cd $d && cd .. && pwd)`
+            test -d "$d" || continue
+            test -f "$d/jre/lib/rt.jar" && {
+              BOOTCLASSPATH="$d/jre/lib/rt.jar"
+              ## we need to try whether jikes accept .. (tbd)
+              break
+            }
+            test -f "$d/lib/rt.jar" && {
+              BOOTCLASSPATH="$d/lib/rt.jar"
+              ## we need to try whether jikes accept .. (tbd)
+              break
+            }
+          done
+          ## go for some unusual locations (MacOS)
+          test -z "${BOOTCLASSPATH}" && {
+            fwdir=/System/Library/Frameworks/JavaVM.framework/Versions
+            for x in 1.4.1 1.3.1 ; do
+              if test -f "$fwdir/$x/Classes/classes.jar" ; then
+                BOOTCLASSPATH="$fwdir/$x/Classes/classes.jar"
+                break
+              fi
+            done
+          }
+          ## give up in case we can't set.
+          test -z "${BOOTCLASSPATH}" && {
+            AC_MSG_ERROR(
+              [Unable to set BOOTCLASSPATH - there is no rt.jar around.])
+          }
+          ;;
+        *)
+          BOOTCLASSPATH=""
+          ;;
+      esac
+    }
+    test -n "${BOOTCLASSPATH}" && {
+      ## Finalize BOOTCLASSPATH. Depending on platform join arguments using
+      ## a different seperator.
+      case $build_os in
+        cygwin)
+          sep=";"
+          ;;
+        *)
+          sep=":"
+          ;;
+      esac
+      set x $BOOTCLASSPATH ; shift
+      BOOTCLASSPATH="$1"
+      shift
+      while test $# -gt 0 ; do
+        BOOTCLASSPATH="${BOOTCLASSPATH}${sep}${1}"
+        shift
+      done
+    }
+    ## Use Java first in list.
+    AX_VAR_HEAD([JAVA])
+
+    ;;
+esac
+
+#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx#
+#                             C++                                    #
+#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx#
+
+case $LANG_CXX in
+  1)
+    AX_PATH_PROGS(
+      [AR],
+      [tlib lib ar /usr/bin/ar]
+    )
+    ## Try to figure out what C++ compiler shall be used. Note that CC
+    ## clashes on cygwin. While CC is usually SUN's C++ compiler name,
+    ## CC is also present on Cygwin - it's just an alias for gcc. The
+    ## real alias is  actually  'cc'  but  names  are searched in non-
+    ## sensitive manner. To solve this problem we  use  kind  of  hack
+    ## here and list compilers availabe to known operating systems.
+    case $build_os in
+      cygwin*|mingw*)
+        ## On Cygwin/Microsoft we are aware of Borland C++, Microsoft
+        ## C++ and GNU.
+        cxx_compiler_list="bcc32 cl g++"
+		  # FIXME: for bcc32
+		  c_compiler_list="cl gcc"
+        ;;
+      *)
+        ## On other platforms we now HP C++ (aCC), IBM C++ (xlC*) and
+        ## of  course GNU. If there's a GNU compiler around we prefer
+        ## GNU. This avoids also  a  problem  with  vendors having CC
+        ## a symbolic link to "gcc" instead of "g++".
+        cxx_compiler_list="g++ aCC CC xlC xlC_r cxx c++"
+		  # FIXME: for other unix flavours
+		  c_compiler_list="cc gcc xlc_r acc"
+        ;;
+    esac
+
+    ## Find a compiler for me. If compiler is not in list you can al-
+    ## ways override by using environment varialbe CXX.
+    ## dnl AC_PROG_CXX([${cxx_compiler_list}])
+    ## dnl AC_PROG_CC([${c_compiler_list}])
+
+    ## just  overrule what autoconf figured out - we never asked for
+    ## this anyway. Our  handling  of compiler options is done below
+    ## in the fine tuning section.
+    ##CXXFLAGS=""
+
+    ## 'cxx'  shall  be  the canonical compiler name. For example, gcc
+    ## cl, bcc, CC, etc. Note that this is in general not equal to CXX.
+    ## For example, CYGWIN  appears to have c++ as name for g++ and cc
+    ## as alias for gcc.
+    ## CXX is used to call the compiler, 'cxx' shall be used for
+    ## decisions based on compiler in use.
+    cxx=""
+
+    if test "x$GXX" = xyes; then
+      cxx="gcc"
+    else
+      cxx=`basename $CXX`
+      cxx=`echo ${cxx}|sed 's,\.@<:@^.@:>@*$,,'`
+    fi
+
+    case ${cxx} in
+      gcc*)
+        cxx='gcc'
+        ;;
+      cl*|CL*)
+        cxx='cl'
+        ## check whether this is Microsoft C++ (tbd)
+        ;;
+      bcc32*|BCC32*)
+        cxx='bcc32'
+        ## check whether this is Borland C++ (tbd)
+        ;;
+      CC*)
+        ## check whether this is SUN C++ (tbd)
+        cxx="CC"
+        ;;
+      xlC*|xlC_r*)
+        cxx="xlC"
+        ## check whether this is IBM C++ (tbd)
+        ;;
+      aCC*)
+        cxx='aCC'
+        ## check whether this is HP C++ (tbd)
+        ;;
+      cxx*)
+        cxx='cxx'
+        ## check for Digital UNIX cxx (Tru64)??
+        ;;
+      *)
+        ## unknown compiler - good luck.
+        AX_MSG_UNKOWN_CXX
+        ;;
+    esac
+
+    ##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx##
+    ##                  COMPILER TUNING SECTION                     ##
+    ##==============================================================##
+
+    ## compiler tuning has basically removed from this configure
+    ## script as it appears not  to  be handy and practical. All
+    ## compiler flags  are  set  in  cxx.sh.in.  If there is any
+    ## change required, go there and change.
+    ## Note that flags  given in this file may overrule settings
+    ## given in cxx.sh.in. Therefore, if you "add" flags here,
+    ## put a "+" in front of variable CXXFLAGS. For example, let's
+    ## say you want to add "-g". Then do this:
+    ##
+    ##  CXXFLAGS="-g"
+    ##  ..
+    ##  CXXFLAGS="+ ${CXXFLAGS}"
+    ##
+    ## The addition of "+"  CXXFLAGS should be the last action for
+    ## that variable. The net effect is that "-g" will be added to
+    ## flags set in cxx.sh.in. So the result may look like
+    ## gcc -Wall -c -g ..
+    ##
+    ## Similar, put a "-" in front to get "gcc -g -Wall -c .." and
+    ## put nothing or a "=" in front to get "gcc -g ..".
+    ##
+    ## Similar to CXXFLAGS are LDFLAGS and ARFLAGS for linking
+    ## and making a static library.
+
+    case "${cxx}" in
+      cl|bcc32)
+        OBJEXT=".obj"
+        LIBEXT=".lib"
+        EXEEXT=".exe"
+        ANTLR_LIB="$abs_this_builddir/lib/cpp/src/antlr.lib"
+        CPP="${cxx}"
+        CPPFLAGS="-EP"
+        ;;
+      *)
+        OBJEXT=".o"
+        ;;
+    esac
+
+    LDFLAGS=
+    AX_VAR_HEAD([AR])
+
+    ##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx##
+    ##               END  COMPILER TUNING SECTION                   ##
+    ##==============================================================##
+
+    # Checks for header files.
+    AC_HEADER_STDC
+    AC_CHECK_HEADERS([stdlib.h unistd.h])
+
+    # Checks for typedefs, structures, and compiler characteristics.
+    AC_C_CONST
+    AC_C_INLINE
+
+    # Checks for library functions.
+    AC_FUNC_MALLOC
+    AC_CHECK_FUNCS([strcasecmp])
+
+    ## Some further specific test required as are using std C++.
+    ## (tbd)
+    ;;
+esac
+
+##
+test -z "$DOXYGEN" && AC_PATH_PROG(DOXYGEN, doxygen, doxygen,  )
+
+# This seems to convince configure to use an absolute path to the backup
+# install-sh script.
+ac_install_sh="$PWD/scripts/install-sh"
+AC_PROG_INSTALL
+#dnl AC_PROG_RANLIB
+
+#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx#
+#                             PYTHON                                 #
+#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx#
+
+AC_ARG_VAR([PYTHON],
+  [By default we search for "python" in $PATH to execute Python files.
+    Override this by providing a list of candidates in environment
+    variable $PYTHON and use whitespace as spereration character. A
+    candidate can be either a relative or absolute path name. In
+    the former case a lookup in $PATH takes place, in the latter, the
+    absolute path name must exist.])
+
+AC_ARG_VAR([PYTHONFLAGS],[
+    Shall contain all flags required to run Python. Override the
+    default by using environment variable $PYTHONFLAGS.
+])
+
+AX_PYTHON_PROGS(
+  [PYTHON],
+  [python],
+  [AX_VAR_HEAD([PYTHON])]
+)
+
+
+#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx#
+#                             CSHARP                                 #
+#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx#
+
+AC_ARG_VAR([CSHARPC],
+  [By default we search for "cscc", "msc" and "csc" in $PATH to compile C# files.
+    Override this by providing a list of candidates in environment
+    variable $CSHARP and use whitespace as spereration character. A
+    candidate can be either a relative or absolute path name. In
+    the former case a lookup in $PATH takes place, in the latter, the
+    absolute path name must exist.])
+
+AC_ARG_VAR([CSHARPCFLAGS],[
+    Shall contain all flags required to compile a #C file. Override the
+    default by using environment variable $CSHARPCFLAGS.
+])
+
+AX_CSHARP_PROGS(
+  [CSHARPC],
+  [cscc mcs csc /usr/local/bin/cscc /usr/local/bin/mcs /opt/bin/cscc /opt/bin/mcs],
+  [AX_VAR_HEAD([CSHARPC])]
+)
+
+## get the basename of C# compiler. Depending on basename we try to
+## decide about the CLR.
+test -n "${CSHARPC}"  && {
+  csharpc=`basename ${CSHARPC}`
+  csharpc_d=`dirname ${CSHARPC}`
+}
+
+case $csharpc in
+  cscc*)
+    AX_CSHARP_PROGS(
+      [CLR],
+      [${csharpc_d}/ilrun ilrun /usr/local/bin/ilrun /opt/bin/ilrun],
+      [AX_VAR_HEAD([CLR])]
+    )
+    ;;
+  mcs*)
+    AX_CSHARP_PROGS(
+      [CLR],
+      [${csharpc_d}/mono mono /usr/local/bin/mono /opt/bin/mono],
+      [AX_VAR_HEAD([CLR])]
+    )
+    ;;
+esac
+
+## compute basename of core libraries
+antlr_jar=`basename ${ANTLR_JAR}`
+antlr_net=`basename ${ANTLR_NET}`
+antlr_lib=`basename ${ANTLR_LIB}`
+antlr_py=`basename ${ANTLR_PY}`
+astframe_net=`basename ${ASTFRAME_NET}`
+
+test -z "${JAVA}" && {
+  JAVA=java
+}
+
+### cygwin has no (supported) Java - users are requested to have java
+### in their PATH in order to execute "bin/antlr.sh". To support this
+### I'm making sure that just the basename is used.
+case $host_os in
+  *cygwin* |*mingw*|*msys*)
+  AX_BASENAME([JAVA])
+  ;;
+esac
+
+AC_OUTPUT([Makefile
+antlr2.pc
+antlr/Makefile
+src/Makefile])
+
diff --git a/lib/cpp/m4/ax.m4 b/lib/cpp/m4/ax.m4
new file mode 100644
index 0000000..d8abb54
--- /dev/null
+++ b/lib/cpp/m4/ax.m4
@@ -0,0 +1,762 @@
+dnl --*- sh -*--
+##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx##
+## This file is part of ANTLR. See LICENSE.txt for licence  ##
+## details. Written by W. Haefelinger - initial version by  ##
+## R. Laren.                                                ##
+## ...............Copyright (C) Wolfgang Haefelinger, 2004  ##
+##                                                          ##
+##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx##
+
+dnl
+dnl ===============================================================
+dnl A couple of Macros have been copied from the GNU Autoconf Macro 
+dnl Archive: 
+dnl            http://www.gnu.org/software/ac-archive
+dnl ===============================================================
+dnl
+
+AC_DEFUN(
+  [AC_CHECK_CLASSPATH],
+  [
+    test "x$CLASSPATH" = x && AC_MSG_ERROR(
+      [CLASSPATH not set. Please set it to include the directory containing configure.])
+    if test "x$CLASSPATH" = x; then
+      :
+    else
+      echo "CLASSPATH set to:"
+      echo "$CLASSPATH"
+      echo "IMPORTANT: make sure the current directory containing configure"
+      echo "is in the CLASSPATH"
+    fi
+  ]
+)
+
+#dnl /**
+#dnl  * Test.java: used to test dynamicaly if a class exists.
+#dnl  */
+#dnl public class Test
+#dnl {
+#dnl
+#dnl public static void
+#dnl main( String[] argv )
+#dnl {
+#dnl     Class lib;
+#dnl     if (argv.length < 1)
+#dnl      {
+#dnl             System.err.println ("Missing argument");
+#dnl             System.exit (77);
+#dnl      }
+#dnl     try
+#dnl      {
+#dnl             lib = Class.forName (argv[0]);
+#dnl      }
+#dnl     catch (ClassNotFoundException e)
+#dnl      {
+#dnl             System.exit (1);
+#dnl      }
+#dnl     lib = null;
+#dnl     System.exit (0);
+#dnl }
+#dnl
+#dnl }
+
+AC_DEFUN(
+  [AC_CHECK_CLASS],[
+    AC_REQUIRE([AC_PROG_JAVA])
+    ac_var_name=`echo $1 | sed 's/\./_/g'`
+    #dnl Normaly I'd use a AC_CACHE_CHECK here but since the variable name is
+    #dnl dynamic I need an extra level of extraction
+    AC_MSG_CHECKING([for $1 class])
+    AC_CACHE_VAL(ac_cv_class_$ac_var_name,[
+        if test x$ac_cv_prog_uudecode_base64 = xyes; then
+          cat << \EOF > Test.uue
+begin-base64 644 Test.class
+yv66vgADAC0AKQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE
+bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51
+bWJlclRhYmxlDAAKAAsBAANlcnIBABVMamF2YS9pby9QcmludFN0cmVhbTsJ
+AA0ACQcADgEAEGphdmEvbGFuZy9TeXN0ZW0IABABABBNaXNzaW5nIGFyZ3Vt
+ZW50DAASABMBAAdwcmludGxuAQAVKExqYXZhL2xhbmcvU3RyaW5nOylWCgAV
+ABEHABYBABNqYXZhL2lvL1ByaW50U3RyZWFtDAAYABkBAARleGl0AQAEKEkp
+VgoADQAXDAAcAB0BAAdmb3JOYW1lAQAlKExqYXZhL2xhbmcvU3RyaW5nOylM
+amF2YS9sYW5nL0NsYXNzOwoAHwAbBwAgAQAPamF2YS9sYW5nL0NsYXNzBwAi
+AQAgamF2YS9sYW5nL0NsYXNzTm90Rm91bmRFeGNlcHRpb24BAAY8aW5pdD4B
+AAMoKVYMACMAJAoAAwAlAQAKU291cmNlRmlsZQEACVRlc3QuamF2YQAhAAEA
+AwAAAAAAAgAJAAUABgABAAcAAABtAAMAAwAAACkqvgSiABCyAAwSD7YAFBBN
+uAAaKgMyuAAeTKcACE0EuAAaAUwDuAAasQABABMAGgAdACEAAQAIAAAAKgAK
+AAAACgAAAAsABgANAA4ADgATABAAEwASAB4AFgAiABgAJAAZACgAGgABACMA
+JAABAAcAAAAhAAEAAQAAAAUqtwAmsQAAAAEACAAAAAoAAgAAAAQABAAEAAEA
+JwAAAAIAKA==
+====
+EOF
+          if uudecode$EXEEXT Test.uue; then
+            :
+          else
+            echo "configure: __oline__: uudecode had trouble decoding base 64 file 'Test.uue'" >&AC_FD_CC
+            echo "configure: failed file was:" >&AC_FD_CC
+            cat Test.uue >&AC_FD_CC
+            ac_cv_prog_uudecode_base64=no
+          fi
+          rm -f Test.uue
+          
+          if AC_TRY_COMMAND($JAVA $JAVAFLAGS Test $1) >/dev/null 2>&1; then
+            eval "ac_cv_class_$ac_var_name=yes"
+          else
+            eval "ac_cv_class_$ac_var_name=no"
+          fi
+          rm -f Test.class
+        else
+          AC_TRY_COMPILE_JAVA([$1], , 
+            [eval "ac_cv_class_$ac_var_name=yes"],
+            [eval "ac_cv_class_$ac_var_name=no"])
+        fi
+        eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`"
+        eval "HAVE_$ac_var_name=$`echo ac_cv_class_$ac_var_val`"
+        HAVE_LAST_CLASS=$ac_var_val
+        if test x$ac_var_val = xyes; then
+          ifelse([$2], , :, [$2])
+        else
+          ifelse([$3], , :, [$3])
+        fi
+      ]
+    )
+    #dnl for some reason the above statment didn't fall though here?
+    #dnl do scripts have variable scoping?
+    eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`"
+    AC_MSG_RESULT($ac_var_val)
+  ]
+)
+
+AC_DEFUN([AC_CHECK_JAVA_HOME],[
+    AC_REQUIRE([AC_EXEEXT])dnl
+    TRY_JAVA_HOME=`ls -dr /usr/java/* 2> /dev/null | head -n 1`
+    if test x$TRY_JAVA_HOME != x; then
+      PATH=$PATH:$TRY_JAVA_HOME/bin
+    fi
+    AC_PATH_PROG(JAVA_PATH_NAME, java$EXEEXT)
+    if test x$JAVA_PATH_NAME != x; then
+      JAVA_HOME=`echo $JAVA_PATH_NAME | sed "s/\(.*\)[[/]]bin[[/]]java$EXEEXT$/\1/"`
+    fi;dnl
+    ]
+)
+
+
+AC_DEFUN([AC_PROG_JAR],
+  [
+    AC_REQUIRE([AC_EXEEXT])dnl
+    if test "x$JAVAPREFIX" = x; then
+      test "x$JAR" = x && AC_CHECK_PROGS(JAR, jar$EXEEXT)
+    else
+      test "x$JAR" = x && AC_CHECK_PROGS(JAR, jar, $JAVAPREFIX)
+    fi
+    test "x$JAR" = x && AC_MSG_ERROR([no acceptable jar program found in \$PATH])
+    AC_PROVIDE([$0])dnl
+    ]
+)
+
+AC_DEFUN([AC_PROG_JAVA],[
+    AC_REQUIRE([AC_EXEEXT])dnl
+    if test x$JAVAPREFIX = x; then
+      test x$JAVA = x && AC_CHECK_PROGS(JAVA, kaffe$EXEEXT java$EXEEXT)
+    else
+      test x$JAVA = x && AC_CHECK_PROGS(JAVA, kaffe$EXEEXT java$EXEEXT, $JAVAPREFIX)
+    fi
+    test x$JAVA = x && AC_MSG_ERROR([no acceptable Java virtual machine found in \$PATH])
+    AC_PROG_JAVA_WORKS
+    AC_PROVIDE([$0])dnl
+    ]
+)
+
+
+#dnl /**
+#dnl  * Test.java: used to test if java compiler works.
+#dnl  */
+#dnl public class Test
+#dnl {
+#dnl
+#dnl public static void
+#dnl main( String[] argv )
+#dnl {
+#dnl     System.exit (0);
+#dnl }
+#dnl
+#dnl }
+
+AC_DEFUN([AC_PROG_JAVA_WORKS],
+  [
+    AC_CHECK_PROG(uudecode, uudecode$EXEEXT, yes)
+    if test x$uudecode = xyes; then
+      AC_CACHE_CHECK([if uudecode can decode base 64 file], ac_cv_prog_uudecode_base64, [
+          cat << \EOF > Test.uue
+begin-base64 644 Test.class
+yv66vgADAC0AFQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE
+bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51
+bWJlclRhYmxlDAAKAAsBAARleGl0AQAEKEkpVgoADQAJBwAOAQAQamF2YS9s
+YW5nL1N5c3RlbQEABjxpbml0PgEAAygpVgwADwAQCgADABEBAApTb3VyY2VG
+aWxlAQAJVGVzdC5qYXZhACEAAQADAAAAAAACAAkABQAGAAEABwAAACEAAQAB
+AAAABQO4AAyxAAAAAQAIAAAACgACAAAACgAEAAsAAQAPABAAAQAHAAAAIQAB
+AAEAAAAFKrcAErEAAAABAAgAAAAKAAIAAAAEAAQABAABABMAAAACABQ=
+====
+EOF
+          if uudecode$EXEEXT Test.uue; then
+            ac_cv_prog_uudecode_base64=yes
+          else
+            echo "configure: __oline__: uudecode had trouble decoding base 64 file 'Test.uue'" >&AC_FD_CC
+            echo "configure: failed file was:" >&AC_FD_CC
+            cat Test.uue >&AC_FD_CC
+            ac_cv_prog_uudecode_base64=no
+          fi
+          rm -f Test.uue])
+    fi
+    if test x$ac_cv_prog_uudecode_base64 != xyes; then
+      rm -f Test.class
+      AC_MSG_WARN([I have to compile Test.class from scratch])
+      if test x$ac_cv_prog_javac_works = xno; then
+        AC_MSG_ERROR([Cannot compile java source. $JAVAC does not work properly])
+      fi
+      if test x$ac_cv_prog_javac_works = x; then
+        AC_PROG_JAVAC
+      fi
+    fi
+    AC_CACHE_CHECK(if $JAVA works, ac_cv_prog_java_works, [
+        JAVA_TEST=Test.java
+        CLASS_TEST=Test.class
+        TEST=Test
+        changequote(, )dnl
+        cat << \EOF > $JAVA_TEST
+/* [#]line __oline__ "configure" */
+public class Test {
+public static void main (String args[]) {
+        System.exit (0);
+} }
+EOF
+        changequote([, ])dnl
+        if test x$ac_cv_prog_uudecode_base64 != xyes; then
+          if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) && test -s $CLASS_TEST; then
+            :
+          else
+            echo "configure: failed program was:" >&AC_FD_CC
+            cat $JAVA_TEST >&AC_FD_CC
+            AC_MSG_ERROR(The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?))
+          fi
+        fi
+        if AC_TRY_COMMAND($JAVA $JAVAFLAGS $TEST) >/dev/null 2>&1; then
+          ac_cv_prog_java_works=yes
+        else
+          echo "configure: failed program was:" >&AC_FD_CC
+          cat $JAVA_TEST >&AC_FD_CC
+          AC_MSG_ERROR(The Java VM $JAVA failed (see config.log, check the CLASSPATH?))
+        fi
+        rm -fr $JAVA_TEST $CLASS_TEST Test.uue
+        ])
+    AC_PROVIDE([$0])dnl
+  ]
+)
+
+AC_DEFUN([AC_PROG_JAVAC],
+  [
+    AC_REQUIRE([AC_EXEEXT])dnl
+    if test "x$JAVAPREFIX" = x; then
+      test "x$JAVAC" = x && AC_CHECK_PROGS(JAVAC, javac$EXEEXT "gcj$EXEEXT -C" guavac$EXEEXT jikes$EXEEXT)
+    else
+      test "x$JAVAC" = x && AC_CHECK_PROGS(JAVAC, javac$EXEEXT "gcj$EXEEXT -C" guavac$EXEEXT jikes$EXEEXT, $JAVAPREFIX)
+    fi
+    test "x$JAVAC" = x && AC_MSG_ERROR([no acceptable Java compiler found in \$PATH])
+    AC_PROG_JAVAC_WORKS
+    AC_PROVIDE([$0])dnl
+    ]
+)
+
+AC_DEFUN([AC_PROG_JAVAC_WORKS],[
+    AC_CACHE_CHECK([if $JAVAC works], ac_cv_prog_javac_works, [
+        JAVA_TEST=Test.java
+        CLASS_TEST=Test.class
+        cat << \EOF > $JAVA_TEST
+/* [#]line __oline__ "configure" */
+public class Test {
+}
+EOF
+        if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) >/dev/null 2>&1; then
+          ac_cv_prog_javac_works=yes
+        else
+          AC_MSG_ERROR([The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)])
+          echo "configure: failed program was:" >&AC_FD_CC
+          cat $JAVA_TEST >&AC_FD_CC
+        fi
+        rm -f $JAVA_TEST $CLASS_TEST
+        ])
+    AC_PROVIDE([$0])dnl
+    ])
+
+AC_DEFUN([AC_TRY_COMPILE_JAVA],[
+    AC_REQUIRE([AC_PROG_JAVAC])dnl
+    cat << \EOF > Test.java
+/* [#]line __oline__ "configure" */
+ifelse([$1], , , [import $1;])
+public class Test {
+[$2]
+}
+EOF
+    if AC_TRY_COMMAND($JAVAC $JAVACFLAGS Test.java) && test -s Test.class ; then
+      #dnl Don't remove the temporary files here, so they can be examined.
+    ifelse([$3], , :, [$3])
+    else
+    echo "configure: failed program was:" >&AC_FD_CC
+    cat Test.java >&AC_FD_CC
+    ifelse([$4], , , [  rm -fr Test*
+        $4
+        ])dnl
+    fi
+    rm -fr Test*
+    ]
+)
+
+AC_DEFUN([AC_TRY_RUN_JAVA],[
+    AC_REQUIRE([AC_PROG_JAVAC])dnl
+    AC_REQUIRE([AC_PROG_JAVA])dnl
+    cat << \EOF > Test.java
+/* [#]line __oline__ "configure" */
+ifelse([$1], , , [include $1;])
+public class Test {
+[$2]
+}
+EOF
+    if AC_TRY_COMMAND($JAVAC $JAVACFLAGS Test.java) && test -s Test.class && ($JAVA $JAVAFLAGS Test; exit) 2>/dev/null
+      then
+#dnl Don't remove the temporary files here, so they can be examined.
+      ifelse([$3], , :, [$3])
+    else
+      echo "configure: failed program was:" >&AC_FD_CC
+      cat Test.java >&AC_FD_CC
+      ifelse([$4], , , [  rm -fr Test*
+          $4
+          ])dnl
+    fi
+    rm -fr Test*])
+
+#dnl#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+#dnl#                      AX_TRY_COMPILE_JAVA
+#dnl#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+#dnl $1 => import section
+#dnl $2 => class body section
+#dnl $3 => if_good_action
+#dnl $4 => if_fails_action [implicit action: candidate is removed from
+#dnl       list]. This cannot be overridden by providing a action.
+
+AC_DEFUN([AX_TRY_COMPILE_JAVA],
+[
+  ## make sure that we do not use an existing file
+  i=0;cn="Test\${i}"; eval "fj=${cn}.java"
+  while test -f "${fj}"
+  do
+    i=`expr $i + 1`
+    eval "fj=${cn}.java"
+  done  
+  eval "fc=${cn}.class"
+  eval "cn=${cn}"
+
+  cat << [_ACEOF] > ${fj}
+  [$1]
+  public class ${cn} {
+  [$2]
+  }
+[_ACEOF]
+  ## wh: how do I check that a file has a non-zero size (test -s)
+  ## wh: is not portable.
+  if AC_TRY_COMMAND($JAVAC $JAVACFLAGS ${fj}) && test -f "${fc}"
+  then  
+    $3
+  else
+    ifelse([$4], ,[
+    echo ""
+    echo "@configure:__oline__: failed to compile java input ...."
+    echo "======================================================="
+    cat ${fj}
+    echo "======================================================="
+    echo "exec $JAVAC $JAVACFLAGS ${fj}"
+    echo ""
+    rm -rf "${fc}" "${fj}"
+    ],[$4])
+  fi
+  rm -rf "${fc}" "${fj}"
+  ## eof [AX_TRY_COMPILE_JAVA]
+])dnl
+
+#dnl AX_GNU_MAKE
+#dnl $1->var that contains list of suitable candidates [not empty]
+#dnl $2->action_if_not_found || empty
+#dnl $3->action_if_found || empty
+#dnl => $MAKE
+
+AC_DEFUN(
+  [AX_GNU_MAKE], 
+  [
+    #Search all the common names for GNU make
+    ax_gnu_make_list="${[$1]}"
+    [$1]=
+    for a in . ${ax_gnu_make_list} ; do
+      if test "$a" == "." ; then 
+        continue
+      fi
+      AC_MSG_CHECKING([whether ${a} is GNU make])
+      if (/bin/sh -c "$a --version" 2> /dev/null | grep GNU  2>&1 > /dev/null );  then
+        [$1]="$a"
+        AC_MSG_RESULT(yes)
+        break
+      else
+        AC_MSG_RESULT(no)
+      fi 
+    done 
+    ## handle search result 
+    if test  "x${[$1]}" == "x"  ; then
+      :
+      $2
+    else
+      :
+      $3
+    fi
+  ]
+)dnl
+
+
+###dnl Like AC_PATH_PROGS. However, each argument in $2 will be checked.
+###dnl The result will be added to $1. There's no caching etc.
+###dnl
+
+AC_DEFUN(
+  [AX_TYPE_DASHA],
+  [
+    for ac_prog in [$2] ; do
+      set dummy $ac_prog; ac_word=${2}
+      ## if argument is absolute we check whether such a file exists,
+      ## otherwise we lookup PATH. Each hit will be added to main
+      ## variable.
+      case $ac_word in
+        @<:@\\/@:>@* | ?:@<:@\\/@:>@*)      
+          AC_MSG_CHECKING([for $ac_word])
+          if test -f $ac_word ; then
+            [$1]="${[$1]} ${ac_word}"
+            AC_MSG_RESULT(yes)
+          else
+            AC_MSG_RESULT(no)
+          fi
+          ;;
+        *)
+          as_found=
+          as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+          for as_dir in $PATH
+          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
+               [$1]="${[$1]} $as_dir/$ac_word$ac_exec_ext"
+               AC_MSG_CHECKING([for $ac_word])
+               AC_MSG_RESULT([$as_dir/$ac_word$ac_exec_ext])
+               as_found=1
+             fi
+           done
+          done
+          test "x$as_found" == "x" && {
+            AC_MSG_CHECKING([for $ac_word])
+            AC_MSG_RESULT([no])
+          }
+          ;;
+      esac
+    done
+  ]
+)dnl
+
+###dnl Like AC_PATH_PROGS but if <variable> is given, then it's argument
+###dnl is taken unconditionally(?).
+AC_DEFUN(
+  [AX_PATH_PROGS],
+  [
+    ax_arg_list="[$2]"
+    if test "x${[$1]}" != "x" ; then
+      ax_arg_list="${[$1]}"
+    fi
+    [$1]=""
+    AX_TYPE_DASHA([$1],[${ax_arg_list}])
+    if test "x${[$1]}" != "x" ; then
+      ifelse([$3], ,[:],$3)
+    else
+      ifelse([$4], ,[
+          AC_MSG_ERROR([no suitable value has been found for [$1]])
+          ],$4)
+    fi
+  ]
+)
+
+
+AC_DEFUN([AX_JAVAC],
+[
+  ## make sure that we do not use an existing file
+  i=0;cn="Test\${i}"; eval "fj=${cn}.java"
+  while test -f "${fj}"
+  do
+    i=`expr $i + 1`
+    eval "fj=${cn}.java"
+  done  
+  eval "fc=${cn}.class"
+  eval "cn=${cn}"
+
+  cat << [_ACEOF] > ${fj}
+  [$1]
+  public class ${cn} {
+  [$2]
+  }
+[_ACEOF]
+  ## wh: how do I check that a file has a non-zero size (test -s)
+  ## wh: is not portable.
+  if AC_TRY_COMMAND($JAVAC $JAVACFLAGS ${fj}) && test -f "${fc}"
+  then  
+    $3
+  else
+    ifelse([$4], ,[
+    echo ""
+    echo "@configure:__oline__: failed to compile java input ...."
+    echo "======================================================="
+    cat ${fj}
+    echo "======================================================="
+    echo "exec $JAVAC $JAVACFLAGS ${fj}"
+    echo ""
+    rm -rf "${fc}" "${fj}"
+    ],[$4])
+  fi
+  rm -rf "${fc}" "${fj}"
+  ## eof [AX_TRY_COMPILE_JAVA]
+])dnl
+
+AC_DEFUN([AX_WHICH_JAVAC],[
+    AC_SUBST([$1])
+    if (/bin/sh -c "$JAVAC --version" 2>&1 | grep -i 'GCC' 2>&1 > /dev/null ) ; then
+      [$1]=gcj
+    elif (/bin/sh -c "$JAVAC --version" 2>&1 | grep -i 'jikes' 2>&1 > /dev/null ) ; then
+      [$1]=jikes
+    else
+      [$1]=javac
+    fi
+  ]
+)
+
+AC_DEFUN([AX_VAR_HEAD],[
+    set x ${[$1]}
+    [$1]="${2}"
+  ]
+)
+
+AC_DEFUN([AX_VAR_ADD],[
+    ifelse([$3], ,,[$1=$3])
+    $1="${[$1]} $2"
+  ]
+)
+
+
+AC_DEFUN([AX_JAVA_PROGS],[
+    case $LANG_JAVA in
+      1)
+        AX_PATH_PROGS([$1],[$2],[$3],[
+            LANG_JAVA=0
+            cat <<EOF
+
+============================================================
+Warning:
+Support for JAVA has been disabled as I have not been able
+locate to locate a mandatory program. Please change \$PATH or run 
+with option --help on how to overcome this problem.
+============================================================
+
+EOF
+          ]
+        )
+        ;;
+    esac
+  ]
+)
+
+AC_DEFUN([AX_PYTHON_PROGS],[
+    case $LANG_PY in
+      1)
+        AX_PATH_PROGS([$1],[$2],[$3],[
+            LANG_PY=0
+            cat <<EOF
+
+============================================================
+Warning:
+Support for Python has been disabled as I have not been able
+to locate a mandatory program. Please change \$PATH or run 
+with option --help on how to overcome this problem.
+============================================================
+
+EOF
+          ]
+        )
+        ;;
+    esac
+  ]
+)
+
+AC_DEFUN([AX_CSHARP_PROGS],[
+    case $LANG_CS in
+      1)
+        AX_PATH_PROGS([$1],[$2],[$3],[
+            LANG_CS=0
+            cat <<EOF
+
+============================================================
+Warning:
+Support for C# has been disabled as I have not been able to
+locate a mandatory program. Please change \$PATH or run 
+with option --help on how to overcome this problem.
+============================================================
+
+EOF
+          ]
+        )
+        ;;
+    esac
+  ]
+)
+
+AC_DEFUN([AX_CXX_PROGS],[
+    case $LANG_CXX in
+      1)
+        AX_PATH_PROGS([$1],[$2],[$3],[
+            LANG_CXX=0
+            cat <<EOF
+
+============================================================
+Warning:
+Support for C++ has been disabled as I have not been able to
+locate a mandatory program. Please change \$PATH or run 
+with option --help on how to overcome this problem.
+============================================================
+
+EOF
+          ]
+        )
+        ;;
+    esac
+  ]
+)
+
+AC_DEFUN([AX_LANG_JAVA],[
+    case $LANG_JAVA in
+      1)
+        ifelse([$1], ,[:],$1)
+        ;;
+    esac
+  ]
+)
+AC_DEFUN([AX_LANG_CXX],[
+    case $LANG_CXX in
+      1)
+        ifelse([$1], ,[:],$1)
+        ;;
+    esac
+  ]
+)
+AC_DEFUN([AX_LANG_PYTHON],[
+    case $LANG_PY in
+      1)
+        ifelse([$1], ,[:],$1)
+        ;;
+    esac
+  ]
+)
+AC_DEFUN([AX_LANG_CSHARP],[
+    case $LANG_CS in
+      1)
+        ifelse([$1], ,[:],$1)
+        ;;
+    esac
+  ]
+)
+
+AC_DEFUN([AX_MSG_UNKOWN_CXX],[
+    AC_MSG_WARN([
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+          U N K N O W N  C++ COMPILER:  ${cxx}  
+============================================================
+Compilation  is  very  likely to fail as we are not aware of
+this compiler yet. In case of problems  please  try  to  set
+additional flags by using environment variable CXXFLAGS.
+
+If CXXFLAGS does not help you, please edit either
+
+ ${srcdir}/scripts/cxx.sh.in   ; or
+ ${srcdir}/scripts/link.sh.in
+
+Those scripts are getting called for compilation of all C++
+source code (cxx.sh.in) or for linking binaries (link.sh.in).
+
+In very obscure cases, building the library may also fail.If
+so, please try variable ARFLAGS or edit 
+
+ ${srcdir}/scripts/lib.sh.in
+  
+============================================================
+
+  *** PLEASE PROVIDE FEEDBACK TO antlr.org - THANK YOU ***
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+])
+    ]
+)
+
+
+AC_DEFUN([AX_ARG_WITH],[
+    AC_ARG_WITH(
+      [$1],
+      [AC_HELP_STRING(
+          [--with-$1=ARG],
+          [given argument will override variable $$2. For a detailed
+            description of $$2 see below.])
+        ],
+      [[$2]="${withval}"]
+    )
+    AC_ARG_WITH(
+      [$1flags],
+      [AC_HELP_STRING(
+          [--with-$1flags=ARG],
+          [given argument will override variable $$2FLAGS. For a detailed
+            description of $$2FLAGS see below.])
+        ],
+      [[$2FLAGS]="${withval}"]
+    )
+  ]
+)
+
+
+AC_DEFUN([AX_ARG_ENABLE],[
+    $2=$4
+    AC_ARG_ENABLE(
+      [$1],
+      [AC_HELP_STRING(
+          [--enable-$1],
+          [$3])
+        ],[
+        $2="${enableval}"
+        case "${$2}" in
+          no|0|false) $2=0;;
+          * )         $2=1;;
+        esac
+      ]
+    )
+  ]
+)
+
+
+AC_DEFUN([AX_MAKEVARS_ADD],[
+    cat >> "$[$1]" <<EOF
+$2
+EOF
+  ]
+)
+
+AC_DEFUN([AX_BASENAME],[
+    test -n "$1" && {
+      $1=`basename ${$1}`
+    }
+  ]
+)
\ No newline at end of file
diff --git a/lib/cpp/src/Makefile.am b/lib/cpp/src/Makefile.am
new file mode 100644
index 0000000..08144b9
--- /dev/null
+++ b/lib/cpp/src/Makefile.am
@@ -0,0 +1,44 @@
+AM_CXXFLAGS = @CXXFLAGS@
+
+INCLUDES = -I$(top_srcdir)
+
+lib_LTLIBRARIES = libantlr2.la
+
+if WIN32
+win32_dlls_ldflags = -no-undefined -Wl,--export-all-symbols
+else
+win32_dlls_ldflags = -no-undefined
+endif
+
+libantlr2_la_LDFLAGS = $(win32_dlls_ldflags) -version-info 0:0:0
+libantlr2_la_SOURCES = \
+	ANTLRUtil.cpp \
+	ASTFactory.cpp \
+	ASTNULLType.cpp \
+	ASTRefCount.cpp \
+	BaseAST.cpp \
+	BitSet.cpp \
+	CharBuffer.cpp \
+	CharScanner.cpp \
+	CommonAST.cpp \
+	CommonASTWithHiddenTokens.cpp \
+	CommonHiddenStreamToken.cpp \
+	CommonToken.cpp \
+	InputBuffer.cpp \
+	LLkParser.cpp \
+	Makefile.in \
+	MismatchedCharException.cpp \
+	MismatchedTokenException.cpp \
+	NoViableAltException.cpp \
+	NoViableAltForCharException.cpp \
+	Parser.cpp \
+	RecognitionException.cpp \
+	String.cpp \
+	TokenBuffer.cpp \
+	Token.cpp \
+	TokenRefCount.cpp \
+	TokenStreamBasicFilter.cpp \
+	TokenStreamHiddenTokenFilter.cpp \
+	TokenStreamRewriteEngine.cpp \
+	TokenStreamSelector.cpp \
+	TreeParser.cpp
diff --git a/scripts/antlr-config.in b/scripts/antlr-config.in
index 75b94c6..5fba532 100755
--- a/scripts/antlr-config.in
+++ b/scripts/antlr-config.in
@@ -19,7 +19,7 @@ Options:
 	[--cflags]
 	[--cxxflags]
 Libraries:
-	libantlr.a
+	libantlr2.a
 EOF
 	exit $1
 }
@@ -48,17 +48,17 @@ while test $# -gt 0; do
 		echo @PACKAGE_VERSION@
       exit 0
       ;;
-	--cflags|-cxxflags)
+	--cflags|-cxxflags|--cxxflags)
       includes="-I${includedir}"
       echo_cflags="yes"
       ;;
 	--libs)
       case @cxx@ in
         cl|bcc32)
-          libs="${libdir}/antlr.lib"
+          libs="${libdir}/antlr2.lib"
           ;;
           *)
-          libs="${libdir}/libantlr.a"
+          libs="-L${libdir} -lantlr2"
           ;;
       esac
       echo_libs=yes