diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml new file mode 100644 index 0000000..350d708 --- /dev/null +++ b/.github/workflows/check.yaml @@ -0,0 +1,46 @@ +on: [push, pull_request] + +name: check + +jobs: + check: + runs-on: ${{ matrix.os }} + env: + NOAWT: 1 + + name: ${{ matrix.os }}, R ${{ matrix.r }}, Java ${{ matrix.java }} + + strategy: + fail-fast: false + matrix: + os: [ macos-14, macos-15-intel, windows-2022, ubuntu-22.04, ubuntu-24.04 ] + r: [ devel ] + java: [ 8, 11 ] + + steps: + - uses: actions/checkout@v4 + + - name: Install R + uses: s-u/R-actions/install@v2 + with: + r-version: ${{ matrix.r }} + tools: base + + - uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: ${{ matrix.java }} + + - name: Setup R Java support + if: runner.os != 'Windows' + run: | + echo export PATH=$PATH > reconf.sh + echo export JAVA_HOME=$JAVA_HOME >> reconf.sh + echo R CMD javareconf >> reconf.sh + sudo bash reconf.sh + shell: bash + + - uses: s-u/R-actions/pkg-check@master + with: + build-script: sh mkdist + debian-deps: libpcre2-dev liblzma-dev libbz2-dev libdeflate-dev diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b25c15b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*~ diff --git a/.gitmodules b/.gitmodules index c5f09a9..70d6d4f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "jri/REngine"] - path = jri/REngine + path = src/jri/REngine url = https://github.com/s-u/REngine.git diff --git a/DESCRIPTION b/DESCRIPTION index 96dd453..df0cdf2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,11 +1,12 @@ Package: rJava Version: (populated by mkdist!) Title: Low-Level R to Java Interface -Author: Simon Urbanek -Maintainer: Simon Urbanek -Depends: R (>= 2.5.0), methods +Author: Simon Urbanek [aut, cre, cph] (https://urbanek.nz, ) +Maintainer: Simon Urbanek +Authors@R: person("Simon", "Urbanek", role=c("aut","cre","cph"), email="Simon.Urbanek@r-project.org", comment=c("https://urbanek.nz", ORCID="0000-0003-2297-1732")) +Depends: R (>= 3.6.0), methods Description: Low-level interface to Java VM very much like .C/.Call and friends. Allows creation of objects, calling methods and accessing fields. -License: GPL-2 -URL: http://www.rforge.net/rJava/ +License: LGPL-2.1 +URL: https://www.rforge.net/rJava/ SystemRequirements: Java JDK 1.2 or higher (for JRI/REngine JDK 1.4 or higher), GNU make BugReports: https://github.com/s-u/rJava/issues diff --git a/NAMESPACE b/NAMESPACE index 89e0163..9156174 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -32,7 +32,7 @@ S3method(within, jclassName) # within requires that with.jobjRef is visible outside export(with.jobjRef) -if( exists( ".DollarNames", asNamespace("utils") ) ) importFrom( utils, .DollarNames ) +importFrom( utils, .DollarNames ) S3method(.DollarNames, jobjRef) S3method(.DollarNames, jarrayRef) S3method(.DollarNames, jrectRef) diff --git a/NEWS b/NEWS index 6ca4238..25d3751 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,281 @@ NEWS/ChangeLog for rJava -------------------------- +1.0-18 2026-04-08 + o JRI: fix regression in 1.0-16 breaking older versions of R. + + o JRI: use R embedding declarations where available (needed for + R 4.6.0) + + +1.0-17 2026-03-20 + o Some more API changes for R 4.6.0 + + +1.0-16 2026-03-15 + o Adjust to API removal in R 4.6.0 + + o Add defensive protection during REXP conversion and rniEval + + +1.0-15 2026-03-11 + o Move JRI sources to src/jri to avoid the top level warning. + + o Add compatibility re-maps in JRI for R 4.5.0+ + + +1.0-14 2026-01-19 + o Minor changes to replace EXTPTR macros with API calls globally. + + o Added Authors@R and ORCID. + + o Add some protection fixes. + + +1.0-13 2025-05-12 + o The default Java parameters have changed from -Xmx512m to + -Xmx1g and will be only set by .jinit() if the java.parameters + option is not set (and no parameters are specified). (#341) + Previously, the java.parameters option would be set on load + (if not present), now it is not changed by rJava at all and + left to the user. + + o .jinit() interprets parameters=NA as "use rJava default" (see + above) and NULL is a shorthand for character(). + + +1.0-12 2024-01-26 + o Win32: minor changes to adapt to (undocumented) API changes in + R 4.2.0. + + o Win32: warn if R_HOME path is too long. + + o dispatch on superclasses when converting native types in + the reflection API (J/.jrcall). Please note that it is + safer to use the native API than to rely on reflection + conversions so packages are encouraged to use the native API + which is much faster and type-safe. (#317) + + o remove JavaDoc from the distribution tar ball due to + security issues (#303). Note that JavaDoc can be generated + from the source package by running `make javadoc` in the + `src/java` directory. + + o bugfix: .jarray(..., dispatch=TRUE) was generating nested + arrays with incorrect content if the input array had more than + two dimensions. (#5) + + o the IGNORE env var was misspelled in configure.win. (#304) + + +1.0-10 2023-11-30 + o minor documentation fixes + + o fix format specifier in an error message + + +1.0-9 2023-11-28 + o clean up benign C warnings + + +1.0-8 2022-12-30 + o attempt to prevent (close to) infinite loop in stack + detection due to unwanted tail call optimization by + gcc >= 11 if JDK older than Java 10 is used. (#300) + + +1.0-7 2022-04-29 + o fix conversion from native encoding into UTF-16 (introduced + in 1.0-2) to work correctly if the native encoding is + neither UTF-8 nor Latin1. (#228) + + o debugging: if DEBUG_ENCODING C macro is defined string + conversion routines will output debugging information + when strings are converted between R and Java. + + o JRI: console callbacks (Read/WriteConsole) encode and decode + strings between native encoding and Java. (#24) + Previously, only UTF-8 native locales were supported. + + o Replaced deprected constructors like new Double(double) with + valueOf() calls to make recent JDKs happy. + + o Work around a crash in RStudio on UCRT Windows. (#296) + + o add .jvmState() reporting the state of the JVM. (#259) + + +1.0-6 2021-12-10 + o remove obsolete autoconf macros + + o JRI 0.5-7 changes: + - add support for JRI_CPPFLAGS and JRI_LIBS variables which + allow specific flag overrides in JRI only + - use config.h in jri.h (except for Windows) + - add header checks needed for R_ext/eventloop.h (#284) + - update automake tools + + +1.0-5 2021-09-24 + o allow access modifications to fail on JDK-17 + + == Important note to Java developers: + JDK-17 no longer allows access overrides, so J() wrapper + will fail for cases where the underlying class does + not allow public access. This means that it is no longer + possible to write high-level code that behaves as if it was a + member of the class. Do not upgrade to JDK-17 if that is + important in your application or write a Java wrapper that + exposes the necessary fields/methods as public. + + +1.0-4 2021-09-03 + o make jverify() check the object type before checking for + serialization content. This fixes possible segfaults, + including one in .jfield() when used on jclassName objects + where jverify() was used on the wrapping S4 class. + + +1.0-3 2021-04-16 + o update URLs referring to Java docs to current 1.8 website + + +1.0-2 2021-04-15 + o convert UTF-16 surrogate pairs to UTF-8 when retrieving strings + from Java to R (#51) + + o use UTF-16 encoding when converting R strings to Java + + o avoid warnings in the "blah" R Windows API by casting to + different types on Windows and unix. + + +1.0-1 2021-04-12 + o New feature: support for custom class loaders. It is strongly + recommended that package authors that use rJava in their + package use this new feature since it avoids conflicts of + classes in packages. (#250) + + The main mechanism is the own.loader=TRUE option in + .jpackage() which instantiates a new, clean class loader for a + package such that it is not affected by subsequent class path + changes by the user or other packages. In order to use it, the + package has to use class.loader=.rJava.class.loader in calls + to functions that need to load classes such as .jnew() or J(). + This can also be done automatically via something like + + J <- function(...) rJava::J(..., class.loader=.rJava.class.loader) + + in the package without need to change every call to J() + separately. See the documentation for .jpackage() for details. + + o J() will automatically call .jinit() if rJava has not been + initialized yet. + + o .jchar(x) supports single non-NA string by calling the + String$toCharArray() method. + + o raw vectors were not recognised in J() API (#260) + + +0.9-14 2021-02-04 + o JRI: fixed detection of the major Java version (#239) + + o JRI: support Java major versions with suffixes like 13-ea (#236) + + o JRI: Windows: flags sources as 1.8 to support Java 14 and + higher where changes in the language break old code (#241) + + o Fixed compilation of JRI on macOS to not require the JavaVM + framework, but rely on flags from R CMD javareconf. This avoids + breakage on macOS 11 which no longer provides JavaVM in the SDK. + (#248) + + +0.9-13 2020-07-06 + o increase default JVM stack size by adding -Xss2m to JVM parameters + unless -Xss is already specified in .jinit(). This is an + attempt to address stack overflow problems in Java 11 and higher + on some platforms which appear to use very small stack + sizes. (#224) + + o re-define EXTPTR_xx macros to avoid ABI breakage between R 4.0.0 + and later R 4.0.x versions. + + o add missing C entry points to the symbol cache. (#221) + + o disable dynamic symbol lookup to catch any (inadvertent) use of + unregistered symbols. + + +0.9-12 2020-03-23 + o rJava has a new option --enable-dynload which enables rJava to load + JVM dynamically at run-time. It is only supported on unix platforms + at this point and is enabled by default on macOS. When enabled, + rJava library does not link to JVM, but instead assumes that the + JVM library will be loaded into R before JVM functions are used. + + The default initialization uses the following order to find JVM at + run-time: + - use JAVA_HOME (typically set by R CMD javareconf) + - call /usr/libexec/java_home (if JAVA_HOME is not set) + Find ${JAVA_HOME}[/jre]/lib/server/libjvm.{so|dylib} + If not found, Java cannot be loaded. + + On Windows the order has not changed: getOption("java.home"), + JAVA_HOME environment variable and registry. However, if the + Java home setting is specified, it must be a valid directory, + otherwise a warning is issued (#209) and it is assumed to + be "" and thus the search continues in the registry. + + o convert class names from Java objects into JNI notation when + constructing method signatures. (#81) + + o fix a bug in .jfield() which prevented accessing static fields + if rJava class loader was not present yet (only affected + initialization). + + o modify bootstrap to avoid reflection calls which are broken in + Java 12 (see #175 and https://bugs.openjdk.java.net/browse/JDK-8221530). + + o added .jgc() to run JVM garbage collector (#180) + + o fix filtered .jfields() to return actual values (#213) + + o .jfields() and .jmethods() now correctly filter results even for + as.obj=TRUE (#212). Filtering is done by retrieving the names and + applying the regular expression specified in `name'. + + +0.9-11 2019-03-27 + o fix segfault if en exception is thrown during rJava initialization + (#177) + + o disable Java stack workaround if loaded from a JVM process (#130) + + o bump JVM target to 1.8 for JDK 12 and higher since such target is + no longer supported (#174). + + o fix HAVE_XRS detection (#168) + + o Windows: fix build if javah.exe is missing (#157) + + o Windows: detect JAVA_HOME correctly from registry even if the + key is using JDK instead Java Development Kit (#120) + + o Windows: don't fail if `RuntimeLib` registry entry is missing (#163) + + +0.9-10 2018-05-29 + o support builds with JDKs that are missing javah (#141) + + o detect JDKs that don't call themselves Java (such as openjdk) + (#146) + + o macOS: pre-load libjvm.dylib to avoid issues with incorrect ID + in Oracle's released binaries + + 0.9-9 2017-10-11 o add support for --disable-Xrs configure option in case java -Xrs is so broken that it cannot even be tested - reportedly the case @@ -14,10 +289,18 @@ so you can still build 1.2/1.4 targets by reverting 992828b and using a JDK that won't break on 1.4 targets. - o Process events on Widnows while in rniIndle. (#23) + o Process events on Windows while in rniIndle. (#23) - o Add a work-around for a bug in Oracle Java on Linux which causes - segfaults due to stack truncation. (#102) + o Work around a bug of Oracle's Java on Linux which caps the stack of + R at 2M. (#102) The bug leads to segfaults in recursive + computations (not an R error as R doesn't know the stack size has + been reduced). The workaround can be disabled via environment + variable RJAVA_JVM_STACK_WORKAROUND=0, which may produce better + results with memory access checkers (ASAN, valgrind), because the + workaround detects the new stack size by trying to access + inaccessible memory. This JVM behavior was a workaround for an + issue in old Linux systems (JDK-4466587) and is going to be fixed in + Java 10. o Work around a change in registry location on Windows for Oracle Java 1.9. (#120) @@ -68,17 +351,17 @@ o added support for unboxing of Double[], Integer[] and Boolean[] to .jevalArray(.., simplify=TRUE) and thus also to .jcall() - o Windows: add Java configuartion paths before existing PATH + o Windows: add Java configuration paths before existing PATH entries o Windows: honor a new option "java.home" to override JAVA_HOME environment variable and system settings to allow co-existence - of other tools that may require differen Java paths. + of other tools that may require different Java paths. o Windows: fix a buglet in error reporting when no Java is installed o raise an error if the number of arguments to a Java call exceeds - maxJavaPars. Previously, calls woud be silently truncated. + maxJavaPars. Previously, calls would be silently truncated. Note that maxJavaPars can be raised by compiling rJava, e.g. with: PKG_CFLAGS=-DmaxJavaPars=96 R CMD INSTAL rJava_... @@ -105,16 +388,16 @@ 0.9-0 2011-06-22 o fixes issues introduced by several new features in the late - 0.8 series. Most imporantly .jarray() and .jevalArray() behave + 0.8 series. Most importantly .jarray() and .jevalArray() behave as intended (and as implemented in previous versions). The same applies to .jcall() behavior with respect to arrays and - its evalArray arument. The defaults for some new arguments + its evalArray argument. The defaults for some new arguments have been changed to reflect the original behavior. o .jevalArray() has an additional argument `simplify' which allows multi-dimensional arrays to be converted to native R types. Use with care - it may convert more recursive types in - the future so it should be used preferrably where you have + the future so it should be used preferably where you have control over the types converted. o fixed a bug in .jevalArray that was not simplifying string @@ -132,7 +415,7 @@ loader (not from additional jars) 0.8-7 2010-10-18 - o Windows updates to accomodate changes in R 2.12 and layout + o Windows updates to accommodate changes in R 2.12 and layout changes in recent Sun Java installations. 0.8-6 2010-09-17 @@ -148,7 +431,7 @@ o if the rJava class loader is used as a primary loader it will also register as the context class loader. Some projects rely on the thread context class loader instead of - Class.getClassLoader() [which is still more reliable] + Class.getClassLoader() [which is still more reliable] so those will now work as well. o JRI 0.5-3 (bugfixes) @@ -211,12 +494,12 @@ o new exception handling was introduced: Java exceptions are mapped to Exception conditions which can - be used to catch the exception at R level using e.g tryCatch. - + be used to catch the exception at R level using e.g tryCatch. + The class name automatically contains "Exception", "error" and "condition", as well as all the names (without package path) - of the classes in the inheritance tree of the actual class of the - Exception. This allows targetted handlers: + of the classes in the inheritance tree of the actual class of the + Exception. This allows targeted handlers: tryCatch(.jnew("foo"), NoClassDefFoundError=function(e) ...) In addition JNI code now causes an error instead of a warning, @@ -237,71 +520,71 @@ An additional class "jclassName" was created to support static calls to accessor methods such as $ and calls to new(). - + o [RF] arrays are now split in two classes : "jrectRef" for rectangular - arrays, similar to R arrays, and jarrayRef for rugged arrays. - Indexing of all arrays is supported using the double bracket + arrays, similar to R arrays, and jarrayRef for rugged arrays. + Indexing of all arrays is supported using the double bracket indexer "[[" and "[[<-" - - The single indexer "[" is only currently implemented for - rectangular arrays. This is experimental. Replacement ([<-) + + The single indexer "[" is only currently implemented for + rectangular arrays. This is experimental. Replacement ([<-) is not supported yet. o [RF] with.jclassName and within.jclassName is added to support - "with" semantics on static fields and methods of java classes. - + "with" semantics on static fields and methods of java classes. + Double <- J("java.lang.Double" ) with( Double, parseDouble( "10.2" ) ) - + o [RF] length.jarrayRef queries the number - of objects in a java array. An exception is generated if the - object is not an array. Also array$length can be used - similary to array.length in java - - o [RF] .jcast gains arguments "check" and "convert.array". Their - default value is FALSE for backwards compatibility with + of objects in a java array. An exception is generated if the + object is not an array. Also array$length can be used + similarly to array.length in java + + o [RF] .jcast gains arguments "check" and "convert.array". Their + default value is FALSE for backwards compatibility with previous releases of rJava - - o [RF] Binary operators <, >, <=, >= to compare two objects where - at least one is a java object reference. + + o [RF] Binary operators <, >, <=, >= to compare two objects where + at least one is a java object reference. d <- new( J("java.lang.Double"), 0.0 ) d < 1.0 d < 1L Comparison of arrays is not currently supported - + o [RF] lapply and sapply may now be used on Iterable java objects such as Vector and java arrays. see ?as.list.jobjRef - - o [RF] The generic "clone" function is added, and an implementation for - java objects. an Object must implement the Cloneable - interface, otherwise an exception will be raised. - Furthermore, careful reading of the java documentation + + o [RF] The generic "clone" function is added, and an implementation for + java objects. an Object must implement the Cloneable + interface, otherwise an exception will be raised. + Furthermore, careful reading of the java documentation of Object#clone is recommended since this is not standard - java behaviour. Currently "clone" is not supported on + java behaviour. Currently "clone" is not supported on arrays - - o [RF] A mechanism for "attach"ing java packages has been introduced, + + o [RF] A mechanism for "attach"ing java packages has been introduced, following the mechanism of the RObjectTables package from the OmegaHat project. This allows to "attach" a set of - java package paths to R's search path: - + java package paths to R's search path: + > attach( javaImport( "java.util", "java.lang" ) ) - + and then use classes from this package like this : - + > new( Vector ) > new( HashMap ) > new( Double, 10.2 ) - > new( Integer, 10L ) + > new( Integer, 10L ) > Collections$EMPTY_MAP - + This feature is currently __very__ experimental and is as dangerous as any other use of attach 0.7-1 (never released) - o [RF] added .J high-level java constructor (based on reflection + o [RF] added .J high-level java constructor (based on reflection as opposed to complete match as .jnew does) o [RF] added .jinstanceof and instanceof operator @@ -312,6 +595,7 @@ o fixed synchronization issues in both JRI and REngine + 0.7-0 2009-08-22 o fixed bug in $ getter of fields using old .jfield API @@ -337,6 +621,7 @@ o update to JRI 0.5-0 + 0.6-3 2009-06-14 o update to JRI 0.4-3 (adds REngine API, enhanced support for environments and references) @@ -345,16 +630,15 @@ o added lib.loc parameter to .jpackage() + 0.6-2 2009-01-26 o fix --enable-debug to really enable debug code o improve Windows setup (add only paths if they are not already - listed and check thier presence first) and warn if the system + listed and check their presence first) and warn if the system suffers from PATH truncation bug (or PATH is truncated in general) -[0.6-branch is created as a stable branch -- see trunk for development] - 0.6-1 2008-12-23 o substitute $(JAVA_HOME) in configuration flags when necessary @@ -410,7 +694,7 @@ o Add support for short Java type - o Add support for convertors + o Add support for converters o Fix R-devel compatibility issues @@ -428,11 +712,9 @@ -0.4 branch has been branched off the trunk, see 0.4-branch for NEWS - 0.4-13 2007-01-14 o Fix Java-side memory leaks (temporary parameters to methods - were not propery released, thanks to Erik van Barneveld for + were not properly released, thanks to Erik van Barneveld for supplying a reproducible example). o Fix a bug that caused only the first VM parameter to be passed @@ -450,7 +732,7 @@ o Update URL to http://www.rforge.net/rJava/ - o Update to JRI 0.3-7 (LCons, createRJavaRef, assign XT_NONE) + o Update to JRI 0.3-7 (LCons, createRJavaRef, assign XT_NONE) 0.4-12 2006-11-29 o Added documentation for .jthrow, .jclear and .jgetEx and @@ -521,7 +803,7 @@ Also `show' is now used instead of `print' and the output format was changed. - o Protoype for jobjRef is now a valid null-Object + o Prototype for jobjRef is now a valid null-Object o Added .jequals and corresponding ==, != op methods. Currently == and != operators feature the same behavior as @@ -612,9 +894,18 @@ loop is unaware of the separate thread and can deadlock it. 0.3-6 2006-01-30 + 0.3-5 2006-01-02 + 0.3-4 2005-12-28 + 0.3-3 2005-12-20 -0.3 2005-12-19 [finalizers, arrays] -0.2 2005-09-03 [S4 classes] -0.1 2003-08-26 [initial release] + +0.3 2005-12-19 + o finalizers, arrays + +0.2 2005-09-03 + o S4 classes + +0.1 2003-08-26 + o initial release diff --git a/R/0classes.R b/R/0classes.R index 5c0a08e..99be2f5 100644 --- a/R/0classes.R +++ b/R/0classes.R @@ -45,7 +45,12 @@ setClass("jchar", representation("array" ) ) } # and char (experimental) .jchar <- function(x){ - storage.mode( x ) <- "integer" - new("jchar", as.integer(x)) + if (is.character(x)) { + if (length(x) != 1L || is.na(x)) + stop(".jchar() supports only (non-NA) character vectors of length one (aka strings)") + ## use Java to actually do the conversion + x <- .jcall(.jnew("java.lang.String", x), "[C", "toCharArray") + } + storage.mode( x ) <- "integer" + new("jchar", x) } - diff --git a/R/J.R b/R/J.R index e4044c9..a6c89e1 100644 --- a/R/J.R +++ b/R/J.R @@ -1,25 +1,30 @@ setClass("jclassName", representation(name="character", jobj="jobjRef")) -jclassName <- function(class){ + +jclassName <- function(class, class.loader=.rJava.class.loader) { + if (.need.init()) .jinit() if( is( class, "jobjRef" ) && .jinherits(class, "java/lang/Class" ) ){ jobj <- class name <- .jcall( class, "Ljava/lang/String;", "getName", evalString = TRUE ) } else{ name <- gsub("/",".",as.character(class)) - jobj <- .jfindClass(as.character(class)) + jobj <- .jfindClass(as.character(class), class.loader=class.loader) } new("jclassName", name=name, jobj=jobj) } setGeneric("new") -setMethod("new", signature(Class="jclassName"), function(Class, ...) .J(Class@name, ...)) +setMethod("new", signature(Class="jclassName"), function(Class, ...) .J(Class, ...)) +## FIXME: this is not quite right - it looks at static method/fields only, +## but that prevents things like x = J("foo"); x$equals(x) from working +## while x$class$equals(x) works. setMethod("$", c(x="jclassName"), function(x, name) { if( name == "class" ){ x@jobj } else if (classHasField(x@jobj, name, TRUE)){ - .jfield(x@name, , name) + .jfield(x, , name) } else if (classHasMethod(x@jobj, name, TRUE)){ - function(...) .jrcall(x@name, name, ...) + function(...) .jrcall(x, name, ...) } else if( classHasClass(x@jobj, name, FALSE) ){ inner.cl <- .jcall( "RJavaTools", "Ljava/lang/Class;", "getClass", x@jobj, name, FALSE ) new("jclassName", name=.jcall(inner.cl, "S", "getName"), jobj=inner.cl) @@ -27,9 +32,9 @@ setMethod("$", c(x="jclassName"), function(x, name) { stop("no static field, method or inner class called `", name, "' in `", x@name, "'") } }) -setMethod("$<-", c(x="jclassName"), function(x, name, value) .jfield(x@name, name) <- value) +setMethod("$<-", c(x="jclassName"), function(x, name, value) .jfield(x, name) <- value) setMethod("show", c(object="jclassName"), function(object) invisible(show(paste("Java-Class-Name:",object@name)))) setMethod("as.character", c(x="jclassName"), function(x, ...) x@name) ## the magic `J' -J<-function(class, method, ...) if (nargs() == 1L && missing(method)) jclassName(class) else .jrcall(class, method, ...) +J<-function(class, method, ..., class.loader=.rJava.class.loader) if (nargs() <= 2L && missing(method)) jclassName(class, class.loader=class.loader) else .jrcall(class, method, ..., class.loader=class.loader) diff --git a/R/call.R b/R/call.R index 9ffcc20..81caf12 100644 --- a/R/call.R +++ b/R/call.R @@ -271,9 +271,9 @@ getDim <- function(x){ # we cannot use .jcall here since it will try to simplify the array # or go back to java to calculate its dimensions, ... - r <- .External( "RcallMethod", builder@jobj, - "Ljava/lang/Object;", "getArray", PACKAGE="rJava") - + r <- .External( RcallMethod, builder@jobj, + "Ljava/lang/Object;", "getArray" ) + new( "jrectRef", jobj = r, dimension = dim, jclass = clazz, jsig = tojni( clazz ) ) } @@ -312,14 +312,14 @@ is.jnull <- function(x) { # return class object for a given class name; silent determines whether # an error should be thrown on failure (FALSE) or just null reference (TRUE) -.jfindClass <- function(cl, silent=FALSE) { +.jfindClass <- function(cl, silent=FALSE, class.loader=.rJava.class.loader) { if (inherits(cl, "jclassName")) return(cl@jobj) if (!is.character(cl) || length(cl)!=1) stop("invalid class name") cl<-gsub("/",".",cl) a <- NULL - if (!is.jnull(.rJava.class.loader)) - try(a <- .jcall("java/lang/Class","Ljava/lang/Class;","forName",cl,TRUE,.jcast(.rJava.class.loader,"java.lang.ClassLoader"), check=FALSE)) + if (!is.jnull(class.loader)) + try(a <- .jcall("java/lang/Class","Ljava/lang/Class;","forName",cl,TRUE,.jcast(class.loader, "java.lang.ClassLoader"), check=FALSE)) else try(a <- .jcall("java/lang/Class","Ljava/lang/Class;","forName",cl,check=FALSE)) # this is really .jcheck but we don't want it to appear on the call stack @@ -330,10 +330,10 @@ is.jnull <- function(x) { # Java-side inheritance check; NULL inherits from any class, because # it can be cast to any class type; cl can be a class name or a jobjRef to a class object -.jinherits <- function(o, cl) { +.jinherits <- function(o, cl, class.loader=.rJava.class.loader) { if (is.jnull(o)) return(TRUE) if (!is(o, "jobjRef")) stop("invalid object") - if (is.character(cl)) cl <- .jfindClass(cl) else if (inherits(cl, "jclassName")) cl <- cl@jobj + if (is.character(cl)) cl <- .jfindClass(cl, class.loader=class.loader) else if (inherits(cl, "jclassName")) cl <- cl@jobj if (!is(cl, "jobjRef")) stop("invalid class object") ocl <- .jclassRef(o) .Call(RisAssignableFrom, ocl@jobj, cl@jobj) @@ -384,5 +384,4 @@ is.jnull <- function(x) { } ".jfield<-" <- function(o, name, value) - .Call(RsetField, o, name, value) - + .Call(RsetField, o, name, value) diff --git a/R/gc.R b/R/gc.R new file mode 100644 index 0000000..26200ae --- /dev/null +++ b/R/gc.R @@ -0,0 +1,4 @@ +.jgc <- function(R.gc=TRUE, ...) { + if (R.gc) gc(...) + .jcall(.jcall("java.lang.Runtime","Ljava/lang/Runtime;","getRuntime"), "V", "gc") +} diff --git a/R/import.R b/R/import.R index 7235ebb..69f9f3f 100644 --- a/R/import.R +++ b/R/import.R @@ -138,7 +138,5 @@ lookup <- function( name = "Object", ..., caller = sys.function(-1L) ){ javaImport <- function( packages = "java.lang" ){ importer <- .jnew( "RJavaImport", .jcast( .rJava.class.loader, "java/lang/ClassLoader" ) ) .jcall( importer, "V", "importPackage", packages ) - .Call( "newRJavaLookupTable" , importer, - PACKAGE = "rJava" ) + .Call( newRJavaLookupTable , importer ) } - diff --git a/R/jfirst.R b/R/jfirst.R index b7ca554..8f40142 100644 --- a/R/jfirst.R +++ b/R/jfirst.R @@ -19,11 +19,12 @@ "RcreateArray", "RgetBoolArrayCont", "RgetByteArrayCont", "RgetCharArrayCont", "RgetDoubleArrayCont", "RgetField", "RgetFloatArrayCont", "RgetIntArrayCont", "RgetLongArrayCont", "RgetNullReference", "RgetObjectArrayCont", - "RgetShortArrayCont", "RgetStringArrayCont", "RidenticalRef", + "RgetShortArrayCont", "RgetStringArrayCont", "RidenticalRef", "RgetSimpleClassNames", "RisAssignableFrom", "RpollException", "RsetField", "RthrowException", - "javaObjectCache", + "javaObjectCache", "initRJavaTools", "newRJavaLookupTable", "useDynamicSymbols", + "RgetJVMstate", # .External - "RcreateObject", "RgetStringValue", "RinitJVM", "RtoString", + "RcreateObject", "RgetStringValue", "RinitJVM", "RtoString", "RcallMethod", # .C "RclearException", "RuseJNICache" ) @@ -34,16 +35,17 @@ for (name in .register.addr) .env[[name]] <- addr[[name]]$address + # disable symbol lookup from now on - if there is an error + # in native calls from now on, it means a symbol has not + # been added to the list above + .Call(useDynamicSymbols, FALSE) + assign(".rJava.base.path", paste(libname, pkgname, sep=.Platform$file.sep), .env) assign(".jzeroRef", .Call(RgetNullReference), .env) for (x in .delayed.variables) assign(x, NULL, .env) assign(".jniInitialized", FALSE, .env) - # default JVM initialization parameters - if (is.null(getOption("java.parameters"))) - options("java.parameters"="-Xmx512m") - ## S4 classes update - all classes are created earlier in classes.R, but jobjRef's prototype is only valid after the dylib is loaded setClass("jobjRef", representation(jobj="externalptr", jclass="character"), prototype=list(jobj=.jzeroRef, jclass="java/lang/Object"), where=.env) } diff --git a/R/jinit.R b/R/jinit.R index fef2d75..736fc8e 100644 --- a/R/jinit.R +++ b/R/jinit.R @@ -10,7 +10,7 @@ .Call(RJava_needs_init) ## initialization -.jinit <- function(classpath=NULL, parameters=getOption("java.parameters"), ..., silent=FALSE, force.init=FALSE) { +.jinit <- function(classpath=NULL, parameters=getOption("java.parameters", NA), ..., silent=FALSE, force.init=FALSE) { running.classpath <- character() if (!.need.init()) { running.classpath <- .jclassPath() @@ -23,6 +23,21 @@ } } + # default JVM initialization parameters + # Up until 1.0-12 jfirst (=onLoad) set java.parameters to -Xmx512m to increase the heap + # size, so parameters was always -Xmx512m unless the user set java.parameters or parameters. + # We now leave the java.parameters alone and only set the default heap size if + # java.parameters is not set -- with mostly the same effect. + # (NB: JVMs have changed the default from 256Mb to 25% of available memory in some cases, + # thus the default is becoming less important nowadays.) + # We also increase the default heap size since machines using R are unlikely + # to be starved for RAM. Note that the meaning of NULL has changed to "none" + # since 1.0-13. + if (any(is.na(parameters))) + parameters <- "-Xmx1g" + if (is.null(parameters)) + parameters <- character() + ## determine path separator path.sep <- .Platform$path.sep @@ -51,6 +66,10 @@ ## unfortunately Sys/setlocale()/Sys.getlocale() have incompatible interfaces so there ## is no good way to get/set locales -- so we have to hack around it ... locale.list <- c("LC_COLLATE", "LC_CTYPE", "LC_MONETARY", "LC_NUMERIC", "LC_TIME", "LC_MESSAGES", "LC_PAPER", "LC_MEASUREMENT") + ## RStudio on Windows crashes due to missing error handlers if locales + ## are queried that Windows does not support so we remove those to work around it + if (identical(.Platform$OS.type, "windows")) + locale.list <- locale.list[-(6:8)] locales <- sapply(locale.list, Sys.getlocale) loc.sig <- Sys.getlocale() @@ -85,21 +104,11 @@ assign(".jclassClass", .jcall("java/lang/Class","Ljava/lang/Class;","forName","java.lang.Class"), .env) assign(".jclassString", .jcall("java/lang/Class","Ljava/lang/Class;","forName","java.lang.String"), .env) - ic <- .jcall("java/lang/Class","Ljava/lang/Class;","forName","java.lang.Integer") - f<-.jcall(ic,"Ljava/lang/reflect/Field;","getField", "TYPE") - assign(".jclass.int", .jcast(.jcall(f,"Ljava/lang/Object;","get",.jcast(ic,"java/lang/Object")),"java/lang/Class"), .env) - ic <- .jcall("java/lang/Class","Ljava/lang/Class;","forName","java.lang.Double") - f<-.jcall(ic,"Ljava/lang/reflect/Field;","getField", "TYPE") - assign(".jclass.double", .jcast(.jcall(f,"Ljava/lang/Object;","get",.jcast(ic,"java/lang/Object")),"java/lang/Class"), .env) - ic <- .jcall("java/lang/Class","Ljava/lang/Class;","forName","java.lang.Float") - f<-.jcall(ic,"Ljava/lang/reflect/Field;","getField", "TYPE") - assign(".jclass.float", .jcast(.jcall(f,"Ljava/lang/Object;","get",.jcast(ic,"java/lang/Object")),"java/lang/Class"), .env) - ic <- .jcall("java/lang/Class","Ljava/lang/Class;","forName","java.lang.Boolean") - f<-.jcall(ic,"Ljava/lang/reflect/Field;","getField", "TYPE") - assign(".jclass.boolean", .jcast(.jcall(f,"Ljava/lang/Object;","get",.jcast(ic,"java/lang/Object")),"java/lang/Class"), .env) - ic <- .jcall("java/lang/Class","Ljava/lang/Class;","forName","java.lang.Void") - f<-.jcall(ic,"Ljava/lang/reflect/Field;","getField", "TYPE") - assign(".jclass.void", .jcast(.jcall(f,"Ljava/lang/Object;","get",.jcast(ic,"java/lang/Object")),"java/lang/Class"), .env) + assign(".jclass.int", .jfield("java/lang/Integer", "Ljava/lang/Class;", "TYPE"), .env) + assign(".jclass.double", .jfield("java/lang/Double", "Ljava/lang/Class;", "TYPE"), .env) + assign(".jclass.float", .jfield("java/lang/Float", "Ljava/lang/Class;", "TYPE"), .env) + assign(".jclass.boolean", .jfield("java/lang/Boolean", "Ljava/lang/Class;", "TYPE"), .env) + assign(".jclass.void", .jfield("java/lang/Void", "Ljava/lang/Class;", "TYPE"), .env) ## if NOAWT is set, set AWT to headless if (nzchar(Sys.getenv("NOAWT"))) .jcall("java/lang/System","S","setProperty","java.awt.headless","true") @@ -167,9 +176,9 @@ } # FIXME: is this the best place or should this be done - # internally right after the RJavaClassLoader is instanciated + # internally right after the RJavaClassLoader is instantiated # init the cached RJavaTools class in the jni side - .Call( "initRJavaTools", PACKAGE = "rJava" ) + .Call(initRJavaTools) # not yet # import( c( "java.lang", "java.util") ) @@ -236,3 +245,5 @@ } # if #rcp>0 invisible(.jcall("java/lang/System","S","getProperty","java.class.path")) } + +.jvmState <- function() .Call(RgetJVMstate) diff --git a/R/loader.R b/R/loader.R index 0e2adb8..5a0a353 100644 --- a/R/loader.R +++ b/R/loader.R @@ -1,64 +1,81 @@ -.jaddClassPath <- function(path) { +.jaddClassPath <- function(path, class.loader=.rJava.class.loader) { if (!length(path)) return(invisible(NULL)) - if (!is.jnull(.rJava.class.loader)) - invisible(.jcall(.rJava.class.loader,"V","addClassPath",as.character(path))) + if (!is.jnull(class.loader)) + invisible(.jcall(class.loader, "V", "addClassPath", as.character(path))) else { - cpr <- try(.jmergeClassPath(paste(path,collapse=.Platform$path.sep)), silent=TRUE) + cpr <- try(.jmergeClassPath(paste(path, collapse=.Platform$path.sep)), silent=TRUE) invisible(!inherits(cpr, "try-error")) } } -.jclassPath <- function() { - if (is.jnull(.rJava.class.loader)) { +.jclassPath <- function(class.loader=.rJava.class.loader) { + if (is.jnull(class.loader)) { cp <- .jcall("java/lang/System", "S", "getProperty", "java.class.path") unlist(strsplit(cp, .Platform$path.sep)) } else { - .jcall(.rJava.class.loader,"[Ljava/lang/String;","getClassPath") + .jcall(class.loader,"[Ljava/lang/String;","getClassPath") } } -.jaddLibrary <- function(name, path) { - if (!is.jnull(.rJava.class.loader)) - invisible(.jcall(.rJava.class.loader, "V", "addRLibrary", as.character(name)[1], as.character(path)[1])) +.jaddLibrary <- function(name, path, class.loader=.rJava.class.loader) { + if (!is.jnull(class.loader)) + invisible(.jcall(class.loader, "V", "addRLibrary", as.character(name)[1], as.character(path)[1])) } .jrmLibrary <- function(name) { ## FIXME: unimplemented } -.jclassLoader <- function() { +.jclassLoader <- function(package=NULL) { + if (!is.null(package)) { + loader <- asNamespace(package)$.rJava.class.loader + if (!is.jnull(loader)) return(loader) + } .rJava.class.loader } -.jpackage <- function(name, jars='*', morePaths='', nativeLibrary=FALSE, lib.loc=NULL) { - if (!.jniInitialized) .jinit() - classes <- system.file("java", package=name, lib.loc=lib.loc) - if (nchar(classes)) { - .jaddClassPath(classes) - if (length(jars)) { - if (length(jars)==1 && jars=='*') { - jars <- grep(".*\\.jar",list.files(classes,full.names=TRUE),TRUE,value=TRUE) - if (length(jars)) .jaddClassPath(jars) - } else .jaddClassPath(paste(classes,jars,sep=.Platform$file.sep)) +.jpackage <- function(name, jars='*', morePaths='', nativeLibrary=FALSE, lib.loc=NULL, + parameters=getOption("java.parameters"), own.loader=FALSE) { + if (!.jniInitialized) + .jinit(parameters=parameters) + loader <- .rJava.class.loader + if (isTRUE(own.loader)) { + lib <- "libs" + if (nchar(.Platform$r_arch)) + lib <- file.path("libs", .Platform$r_arch) + ns <- asNamespace(name) + loader <- ns$.rJava.class.loader <- + .jnew("RJavaClassLoader", .rJava.base.path, + file.path(.rJava.base.path, lib), .rJava.class.loader, check = FALSE) + } + + classes <- system.file("java", package=name, lib.loc=lib.loc) + if (nchar(classes)) { + .jaddClassPath(classes, class.loader=loader) + if (length(jars)) { + if (length(jars) == 1 && jars == '*') { + jars <- grep(".*\\.jar", list.files(classes, full.names=TRUE), TRUE, value=TRUE) + if (length(jars)) .jaddClassPath(jars, class.loader=loader) + } else .jaddClassPath(paste(classes, jars, sep=.Platform$file.sep), class.loader=loader) + } } - } - if (any(nchar(morePaths))) { - cl <- as.character(morePaths) - cl <- cl[nchar(cl)>0] - .jaddClassPath(cl) - } - if (is.logical(nativeLibrary)) { - if (nativeLibrary) { - libs <- "libs" - if (nchar(.Platform$r_arch)) lib <- file.path("libs", .Platform$r_arch) - lib <- system.file(libs, paste(name, .Platform$dynlib.ext, sep=''), package=name, lib.loc=lib.loc) - if (nchar(lib)) - .jaddLibrary(name, lib) - else - warning("Native library for `",name,"' could not be found.") + if (any(nchar(morePaths))) { + cl <- as.character(morePaths) + cl <- cl[nchar(cl)>0] + .jaddClassPath(cl, class.loader=loader) + } + if (is.logical(nativeLibrary)) { + if (nativeLibrary) { + libs <- "libs" + if (nchar(.Platform$r_arch)) lib <- file.path("libs", .Platform$r_arch) + lib <- system.file(libs, paste(name, .Platform$dynlib.ext, sep=''), package=name, lib.loc=lib.loc) + if (nchar(lib)) + .jaddLibrary(name, lib, class.loader=loader) + else + warning("Native library for `",name,"' could not be found.") + } + } else { + .jaddLibrary(name, nativeLibrary, class.loader=loader) } - } else { - .jaddLibrary(name, nativeLibrary) - } - invisible(TRUE) + invisible(TRUE) } diff --git a/R/reflection.R b/R/reflection.R index c8f9ef6..3876307 100644 --- a/R/reflection.R +++ b/R/reflection.R @@ -4,34 +4,37 @@ ### reflection tools (inofficial so far, because it returns strings ### instead of the reflection objects - it's useful for quick checks, ### though) -.jmethods <- function(o, name=NULL, as.obj=FALSE) { - cl <- if (is(o, "jobjRef")) .jcall(o, "Ljava/lang/Class;", "getClass") else if (is(o, "jclassName")) o@jobj else .jfindClass(as.character(o)) +.jmethods <- function(o, name=NULL, as.obj=FALSE, class.loader=.rJava.class.loader) { + cl <- if (is(o, "jobjRef")) .jcall(o, "Ljava/lang/Class;", "getClass") else if (is(o, "jclassName")) o@jobj else .jfindClass(as.character(o), class.loader=class.loader) ms<-.jcall(cl,"[Ljava/lang/reflect/Method;","getMethods") - if (isTRUE(as.obj)) return(ms) - ss<-unlist(lapply(ms,function(x) .jcall(x,"S","toString"))) - if (!is.null(name)) - grep(paste("\\.",name,"\\(",sep=''),ss,value=TRUE) - else - ss + if (length(name)) { + n <- sapply(ms, function(o) .jcall(o, "S", "getName")) + ms <- ms[grep(name, n)] + } + if (isTRUE(as.obj)) ms else unlist(lapply(ms,function(x) .jcall(x,"S","toString"))) } -.jconstructors <- function(o, as.obj=FALSE) { - cl <- if (is(o, "jobjRef")) .jcall(o, "Ljava/lang/Class;", "getClass") else if (is(o, "jclassName")) o@jobj else .jfindClass(as.character(o)) +.jconstructors <- function(o, as.obj=FALSE, class.loader=.rJava.class.loader) { + cl <- if (is(o, "jobjRef")) .jcall(o, "Ljava/lang/Class;", "getClass") else if (is(o, "jclassName")) o@jobj else .jfindClass(as.character(o), class.loader=class.loader) cs<-.jcall(cl,"[Ljava/lang/reflect/Constructor;","getConstructors") if (isTRUE(as.obj)) return(cs) unlist(lapply(cs,function(x) .jcall(x,"S","toString"))) } ### this list maps R class names to Java class names for which the constructor does the necessary conversion (for use in .jrcall) -.class.to.jclass <- c(character= "java/lang/String", - jbyte = "java/lang/Byte", - integer = "java/lang/Integer", - numeric = "java/lang/Double", - logical = "java/lang/Boolean", - jlong = "java/lang/Long", - jchar = "java/lang/Character", - jshort = "java/lang/Short", - jfloat = "java/lang/Float") +### The order matters in case an object inherits from multiple (S3) classes - then the first one +### in the list is picked. +.class.to.jclass <- c( + jlong = "java/lang/Long", + jchar = "java/lang/Character", + jshort = "java/lang/Short", + jfloat = "java/lang/Float", + jbyte = "java/lang/Byte", + integer = "java/lang/Integer", + numeric = "java/lang/Double", + logical = "java/lang/Boolean", + character= "java/lang/String" +) ### Java classes that have a corresponding primitive type and thus a corresponding TYPE field to use with scalars .primitive.classes = c("java/lang/Byte", "java/lang/Integer", "java/lang/Double", "java/lang/Boolean", @@ -43,17 +46,23 @@ # this is used for internal purposes only, in particular # it does not dispatch arrays to jrectRef ._java_valid_object <- function(a) { - if (is(a, "jobjRef")) a - else if (is.null(a)) .jnull() else { - cm <- match(class(a)[1], names(.class.to.jclass)) - if (!any(is.na(cm))) { - if (length(a) == 1) { + if (is(a, "jobjRef")) a + else if (is(a, "jclassName")) a@jobj + else if (is.null(a)) .jnull() + else if (is.raw(a)) .jarray(a, dispatch=FALSE) ## raw is always [B + else { + ## check all classes (in S3 case, see #317) + cm <- match(class(a), names(.class.to.jclass)) + if (!all(is.na(cm))) { ## at least one subclass matches + cm <- min(cm, na.rm=TRUE) ## pick the lowest (i.e. in precedence of the order above) + ## scalar? then create directly + if (length(a) == 1) { y <- .jnew(.class.to.jclass[cm], a) if (.class.to.jclass[cm] %in% .primitive.classes) attr(y, "primitive") <- TRUE - y + y } else .jarray(a, dispatch = FALSE) } else { - stop("Sorry, parameter type `", cm ,"' is ambiguous or not supported.") + stop("Sorry, parameter type `", class(a)[1] ,"' is ambiguous or not supported.") } } } @@ -69,6 +78,7 @@ isTRUE(attr(x, "primitive")) ._java_class <- function( x ){ + ## FIXME: not sure how to pass though the class loader here - only affects NULL objects if (is.jnull(x)) { if (is(x,"jobjRef")) .jfindClass(x@jclass) else .jclassObject } else { if (._isPrimitiveReference(x)) .jfield(x, "Ljava/lang/Class;", "TYPE") else .jcall(x, "Ljava/lang/Class;", "getClass") } @@ -79,14 +89,17 @@ ### reflected call - this high-level call uses reflection to call a method ### it is much less efficient than .jcall but doesn't require return type ### specification or exact matching of parameter types -.jrcall <- function(o, method, ..., simplify=TRUE) { +.jrcall <- function(o, method, ..., simplify=TRUE, class.loader=.rJava.class.loader) { if (!is.character(method) | length(method) != 1) stop("Invalid method name - must be exactly one character string.") - if (inherits(o, "jobjRef") || inherits(o, "jarrayRef")) + if (.need.init()) .jinit() + if (is(o, "jclassName")) + cl <- o@jobj + else if (is(o, "jobjRef")) cl <- .jcall(o, "Ljava/lang/Class;", "getClass") else - cl <- .jfindClass(o) - if (is.null(cl)) + cl <- .jfindClass(o, class.loader=class.loader) + if (is.jnull(cl)) stop("Cannot find class of the object.") # p is a list of parameters that are formed solely by valid Java objects @@ -126,10 +139,16 @@ ### on the classes of the ... it does not require exact match between ### the objects and the constructor parameters ### This is to .jnew what .jrcall is to .jcall -.J <- function(class, ...) { - # allow non-JNI specifiation - class <- gsub("\\.","/",class) - +.J <- function(class, ..., class.loader=.rJava.class.loader) { + ## if it is a name, load the class, otherwise assume we have the object + if (is.character(class)) { + ## allow non-JNI specifiation + class <- gsub("\\.","/",class) + class <- .jfindClass(class, class.loader=class.loader) + } else if (is(class, "jclassName")) { + class <- class@jobj + } + # p is a list of parameters that are formed solely by valid Java objects p <- ._java_valid_objects_list(...) @@ -138,7 +157,7 @@ # use RJavaTools to find create the object o <- .jcall("RJavaTools", "Ljava/lang/Object;", - "newInstance", .jfindClass(class), + "newInstance", class, .jarray(p,"java/lang/Object", dispatch = FALSE ), .jarray(pc,"java/lang/Class", dispatch = FALSE ), evalString = FALSE, evalArray = FALSE, use.true.class = TRUE ) @@ -188,12 +207,15 @@ #! } ### list the fields of a class or object -.jfields <- function(o, name=NULL, as.obj=FALSE) { - cl <- if (is(o, "jobjRef")) .jcall(o, "Ljava/lang/Class;", "getClass") else if (is(o, "jclassName")) o@jobj else .jfindClass(as.character(o)) +.jfields <- function(o, name=NULL, as.obj=FALSE, class.loader=.rJava.class.loader) { + cl <- if (is(o, "jobjRef")) .jcall(o, "Ljava/lang/Class;", "getClass") else if (is(o, "jclassName")) o@jobj else .jfindClass(as.character(o), class.loader=class.loader) f <- .jcall(cl, "[Ljava/lang/reflect/Field;", "getFields") - if (isTRUE(as.obj)) return(f) - fl <- unlist(lapply(f, function(x) .jcall(x, "S", "toString"))) - if (!is.null(name)) grep(paste("\\.",name,"$",sep=''), fl) else fl + if (length(name)) { + n <- sapply(f, function(o) .jcall(o, "S", "getName")) + f <- f[grep(name, n)] + } + if (isTRUE(as.obj)) f else + unlist(lapply(f, function(x) .jcall(x, "S", "toString"))) } ._must_be_character_of_length_one <- function(name){ @@ -218,20 +240,20 @@ hasClass <- function( x, name){ } ### the following ones are needed for the static version of $ -classHasField <- function(x, name, static=FALSE) { - if (is(x, "jclassName")) x <- x@jobj else if (!is(x, "jobjRef")) x <- .jfindClass(as.character(x)) +classHasField <- function(x, name, static=FALSE, class.loader=.rJava.class.loader) { + if (is(x, "jclassName")) x <- x@jobj else if (!is(x, "jobjRef")) x <- .jfindClass(as.character(x), class.loader=class.loader) ._must_be_character_of_length_one(name) .jcall("RJavaTools", "Z", "classHasField", x, name, static) } -classHasMethod <- function(x, name, static=FALSE) { - if (is(x, "jclassName")) x <- x@jobj else if (!is(x, "jobjRef")) x <- .jfindClass(as.character(x)) +classHasMethod <- function(x, name, static=FALSE, class.loader=.rJava.class.loader) { + if (is(x, "jclassName")) x <- x@jobj else if (!is(x, "jobjRef")) x <- .jfindClass(as.character(x), class.loader=class.loader) ._must_be_character_of_length_one(name) .jcall("RJavaTools", "Z", "classHasMethod", x, name, static) } -classHasClass <- function(x, name, static=FALSE) { - if (is(x, "jclassName")) x <- x@jobj else if (!is(x, "jobjRef")) x <- .jfindClass(as.character(x)) +classHasClass <- function(x, name, static=FALSE, class.loader=.rJava.class.loader) { + if (is(x, "jclassName")) x <- x@jobj else if (!is(x, "jobjRef")) x <- .jfindClass(as.character(x), class.loader=class.loader) ._must_be_character_of_length_one(name) .jcall("RJavaTools", "Z", "classHasClass", x, name, static) } diff --git a/R/windows/FirstLib.R b/R/windows/FirstLib.R index 09694b4..2c0da98 100755 --- a/R/windows/FirstLib.R +++ b/R/windows/FirstLib.R @@ -1,8 +1,16 @@ +.msg <- message + .onLoad <- function(libname, pkgname) { OPATH <- Sys.getenv("PATH") javahome <- if (!is.null(getOption("java.home"))) getOption("java.home") else Sys.getenv("JAVA_HOME") - if(!nchar(javahome)) { ## JAVA_HOME was not set explicitly + if (nzchar(javahome) && !dir.exists(javahome)) { + .msg("java.home option: ", getOption("java.home")) + .msg("JAVA_HOME environment variable: ", Sys.getenv("JAVA_HOME")) + warning("Java home setting is INVALID, it will be ignored.\nPlease do NOT set it unless you want to override system settings.") + javahome <- "" + } + if(!nzchar(javahome)) { ## JAVA_HOME was not set explicitly find.java <- function() { for (root in c("HLM", "HCU")) for(key in c( @@ -23,7 +31,7 @@ function(libname, pkgname) { stop("No CurrentVersion entry in Software/JavaSoft registry! Try re-installing Java and make sure R and Java have matching architectures.") this <- hive[[hive$CurrentVersion]] javahome <- this$JavaHome - paths <- dirname(this$RuntimeLib) # wrong on 64-bit + paths <- if (is.character(this$RuntimeLib)) dirname(this$RuntimeLib) else character() # wrong on 64-bit } else paths <- character() if(is.null(javahome) || !length(javahome) || !nchar(javahome)) stop("JAVA_HOME is not set and could not be determined from the registry") diff --git a/R/zzz.R.in b/R/zzz.R.in index eb8aba7..93d0643 100644 --- a/R/zzz.R.in +++ b/R/zzz.R.in @@ -1,20 +1,53 @@ .onLoad <- function(libname, pkgname) { - Sys.setenv("LD_LIBRARY_PATH"=paste(Sys.getenv("LD_LIBRARY_PATH"),"@JAVA_LD@",sep=':')) - ## On OS X with Oracle Java we may need to work around Oracle bug: - ## https://bugs.openjdk.java.net/browse/JDK-7131356 - if (length(grep("^darwin", R.version$os)) && file.exists("/usr/libexec/java_home")) { - jh <- Sys.getenv("JAVA_HOME") - if (!nzchar(jh)) jh <- system("/usr/libexec/java_home", intern=TRUE)[1L] - if (file.exists(file.path(jh, "jre/lib"))) jh <- file.path(jh, "jre") - if (file.exists(jli <- file.path(jh, "lib/jli/libjli.dylib"))) { - dyn.load(jli, FALSE) - dlp <- Sys.getenv("DYLD_LIBRARY_PATH") - if (nzchar(dlp)) dlp <- paste0(":", dlp) - if (file.exists(file.path(jh, "lib/server/libjvm.dylib"))) - Sys.setenv(DYLD_LIBRARY_PATH=paste0(file.path(jh, "lib/server"), dlp)) - } - } - library.dynam("rJava", pkgname, libname) - # pass on to the system-independent part - .jfirst(libname, pkgname) + ## we can skip all the detection logic if forced - assuming the user has loaded JVM already + if (!nzchar(Sys.getenv("RJAVA_FORCE_LOAD"))) { + ## On OS X with Oracle Java we may need to work around Oracle bug: + ## https://bugs.openjdk.java.net/browse/JDK-7131356 + use.dynload <- FALSE + @USE_DYNLOAD_TRUE@use.dynload <- TRUE + if (length(grep("^darwin", R.version$os))) { + jh <- Sys.getenv("JAVA_HOME") + if (nzchar(jh) && !dir.exists(jh)) { + warning("JAVA_HOME is set incorrectly! Ingoring.") + jh <- "" + } + if (!nzchar(jh) && file.exists("/usr/libexec/java_home")) + jh <- system("/usr/libexec/java_home", intern=TRUE)[1L] + if (!nzchar(jh)) { + if (use.dynload) + stop("Cannot find Java. Install Java run-time and use R CMD javareconf.\nAs a last resort you can set JAVA_HOME appropriately.") + warning("Cannot find Java. Install Java run-time and use R CMD javareconf.\nAs a last resort you can set JAVA_HOME if you know the correct value.") + } + if (file.exists(file.path(jh, "jre/lib"))) jh <- file.path(jh, "jre") + dlp <- Sys.getenv("DYLD_LIBRARY_PATH") + if (nzchar(dlp)) dlp <- paste0(":", dlp) + ## pre-load JLI due to Oracle bug + if (file.exists(jli <- file.path(jh, "lib/jli/libjli.dylib"))) + dyn.load(jli, FALSE) + ## this is mandatory - we need the JVM + if (file.exists(jvm <- file.path(jh, "lib/server/libjvm.dylib"))) { + dyn.load(jvm, FALSE) + Sys.setenv(DYLD_LIBRARY_PATH=paste0(file.path(jh, "lib/server"), dlp)) + } else { + warning("Cannot find JVM library '", jvm, "'\nInstall Java and/or check JAVA_HOME (if in doubt, do NOT set it, it will be detected)") + if (use.dynload) stop("JVM could not be found") + } + } else if (use.dynload) { + jh <- Sys.getenv("JAVA_HOME") + if (nzchar(jh) && !dir.exists(jh)) { + warning("JAVA_HOME is set incorrectly! Ingoring.") + jh <- "" + } + if (!nzchar(jh)) + stop("JAVA_HOME is requied for dynamically loaded JVM, but is not set.\nRe-run R CMD javareconf or set JAVA_HOME correctly.") + if (file.exists(file.path(jh, "jre/lib"))) jh <- file.path(jh, "jre") + if (!file.exists(jvm <- file.path(jh, "lib/server/libjvm.so"))) + stop("Cannot find ", jvm,", re-configure R or use valid JAVA_HOME") + dyn.load(jvm, FALSE) + } + } ## RJAVA_FORCE_LOAD + + library.dynam("rJava", pkgname, libname) + # pass on to the system-independent part + .jfirst(libname, pkgname) } diff --git a/README.md b/README.md index 3bf875f..0c743ad 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,30 @@ # rJava + +[![CRAN](https://rforge.net/do/cransvg/rJava)](https://cran.r-project.org/package=rJava) +[![RForge](https://rforge.net/do/versvg/rJava)](https://RForge.net/rJava) +[![rJava check](https://github.com/s-u/rJava/actions/workflows/check.yaml/badge.svg)](https://github.com/s-u/rJava/actions/workflows/check.yaml) + R/Java interface allowing the use of Java from R as well as embedding R into Java (via JRI) -Please visit the [main rJava project page on -RForge.net](http://rforge.net) for details. +Please visit the [main rJava project page on RForge.net](https://rforge.net/rJava) for details on the project. For some FAQs and troubleshooting see below - read before reporting bugs! ### Installation -Recommended installation of the latest development version is via +Recommended installation of the CRAN version is via + + install.packages("rJava") + +in R. If you have all tools (and knowledge) necessary to compile +R packages from sources, you can install the latest development +version with + + install.packages("rJava", repos="https://rforge.net") - install.packages("rJava",,"http://rforge.net") +The RForge.net repository is updated automatically on each +commit. On macOS/Windows you may need to add `type='source'`. -in R. The RForge.net repository is updated automatically on each -commit. On OS X you may need to add `type='source'`. +__IMPORTANT__: You must have Java installed and it must be of the same architecture as the R you are using. See below for some troubleshooting help. ### Sources @@ -21,13 +33,48 @@ When checking out the sources, you *must* use git clone --recursive https://github.com/s-u/rJava.git since rJava includes REngine as a submodule. If you want to create a -package from the source checkout, you *must* use `sh mkdist` to do so -since the checkout is not the acutal package. +package from the source checkout, you __must__ use `sh mkdist` to do so +since the checkout is _not_ the actual R package but a source to +generate one (which involves compilation of Java code). + +### Bug reports + +Please use [rJava GitHub issues page](https://github.com/s-u/rJava/issues) to +report bugs, but read the following documentation and search previous issues before you do so. + +## Troubleshooting + +Rule #1: do __not__ set `JAVA_HOME` unless you are an expert. rJava attempts to find the correct settings automatically on most platforms, so setting `JAVA_HOME` incorrecty will just break things. + +### Windows + +Please make sure you install Java that matches your R architecture. R from CRAN is installed by default both in 32-bit and 64-bit versions so if in doubt, install both 32-bit and 64-bit Java. The most common mistake is to use 64-bit R but only have 32-bit Java installed. + +rJava determines the Java location from the registry, so make sure you use the official Oracle installer so that your Java installation can be found. + +### macOS + +On modern macOS versions Apple no longer supplies Java, so it must be downloaded from 3rd parties. Probably the most commonly used distributions on macOS are [adoptium.net](https://adoptium.net) and [Azul Zulu](https://www.azul.com/downloads/). Please note that if you are using arm64 R on Apple silicon (M1+) based Macs you will need at least R-4.1.2 or else you will get `trap R` errors when loading Java (see [#267](https://github.com/s-u/rJava/issues/267) for details). + +When installing from a zip or tar ball, put your Java installation in `/Library/Java/JavaVirtualMachines`. For example, if installing Zulu, unpack/move it such that it results in `/Library/Java/JavaVirtualMachines/zulu-11.jdk`. + +Most recent rJava version will try to automatically detect the Java location and load it dynamically. You can also check the version selected by your settings via `/usr/libexec/java_home` in the Terminal. + +If you have multiple versions and want to pick one without changing the macOS Java settings, you can set `JAVA_HOME` but it must point to the `Home` directory inside the JDK, so, for example, for that above Zulu JDK that would be `JAVA_HOME=/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home`. Again, don't do this unless you want to change the default behavior. + +### Linux + +There is no standard location of JDK on Linux, so you must configure R with Java support before you can use rJava. It is usually done by running `R CMD javareconf` which detects all necessary settings and modifies the Java configuration in `$R_HOME/etc/javaconf`. Note that you must have sufficient privileges to update that file in order to configure R. + +Also note that `sudo` may change environment variables, so if you need to run with elevated privileges, try `sudo -i` first then check if you still have access to the Java you want to use and then run `R CMD javareconf`. Alternatively you can temporarily change permissions on `$R_HOME/etc` to allow you to update it. -### Mailing list and bug reports +The way Java R configuration on Linux works is for the `R` start script to modify `LD_LIBRARY_PATH` to make sure the JVM libraries can be loaded (it does so according to the `javaconf` settings). Therefore if you use a process embbedding R you need to run it via `R CMD ` such that those setting are honored, otherwise you're on your own. -Please use -[stats-rosuda-devel](https://mailman.rz.uni-augsburg.de/mailman/listinfo/stats-rosuda-devel) -mailing list for questions about rJava and [rJava GitHub issues -page](https://github.com/s-u/rJava/issues) to report bugs. +If you are installing rJava from sources, make sure you have the full JDK installed and all the necessary libraries needed to compile packages. For example, on Debian/Ubuntu that would require at least `r-base-dev`. If you run into issues, please check `config.log` which gives a clue as to what went wrong - usually some missing R dependency such as `pcre2`. The `config.log` file will be in the directory you used to build rJava in which is claned by R by default, so to keep it you can use e.g.: +``` +curl -LO https://rforge.net/rJava/snapshot/rJava_1.0-6.tar.gz +tar fxz rJava_1.0-6.tar.gz +R CMD INSTALL rJava +## on failure check rJava/config.log +``` diff --git a/configure b/configure index b3b95f1..12aab97 100755 --- a/configure +++ b/configure @@ -1,11 +1,12 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for rJava 0.8. +# Generated by GNU Autoconf 2.72 for rJava 0.8. # # Report bugs to . # # -# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# Copyright (C) 1992-1996, 1998-2017, 2020-2023 Free Software Foundation, +# Inc. # # # This configure script is free software; the Free Software Foundation @@ -16,63 +17,65 @@ # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( +else case e in #( + e) case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; +esac ;; esac fi + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then +if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -81,13 +84,6 @@ if test "${PATH_SEPARATOR+set}" != set; then fi -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -96,43 +92,27 @@ case $0 in #(( for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS ;; esac -# We did not find ourselves, most probably we were run as `sh COMMAND' +# We did not find ourselves, most probably we were run as 'sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. @@ -153,26 +133,28 @@ case $- in # (((( esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -as_fn_exit 255 +# out after a failed 'exec'. +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + as_bourne_compatible="if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in #( +else case e in #( + e) case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; +esac ;; esac fi " @@ -187,42 +169,54 @@ as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : +if ( set x; as_fn_ret_success y && test x = \"\$1\" ) +then : -else - exitcode=1; echo positional parameters were not saved. +else case e in #( + e) exitcode=1; echo positional parameters were not saved. ;; +esac fi test x\$exitcode = x0 || exit 1 +blah=\$(echo \$(echo blah)) +test x\"\$blah\" = xblah || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && - test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 -test \$(( 1 + 1 )) = 2 || exit 1" - if (eval "$as_required") 2>/dev/null; then : + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1" + if (eval "$as_required") 2>/dev/null +then : as_have_required=yes -else - as_have_required=no +else case e in #( + e) as_have_required=no ;; +esac fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null +then : -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +else case e in #( + e) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base + as_shell=$as_dir$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null +then : break 2 fi fi @@ -230,14 +224,22 @@ fi esac as_found=false done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } IFS=$as_save_IFS +if $as_found +then : + +else case e in #( + e) if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi ;; +esac +fi - if test "x$CONFIG_SHELL" != x; then : + if test "x$CONFIG_SHELL" != x +then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also @@ -254,26 +256,28 @@ case $- in # (((( esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +# out after a failed 'exec'. +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." + if test x$as_have_required = xno +then : + printf "%s\n" "$0: This script requires a shell more modern than all" + printf "%s\n" "$0: the shells that I found on your system." + if test ${ZSH_VERSION+y} ; then + printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" + printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." else - $as_echo "$0: Please tell bug-autoconf@gnu.org and + printf "%s\n" "$0: Please tell bug-autoconf@gnu.org and $0: Simon.Urbanek@r-project.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 -fi +fi ;; +esac fi fi SHELL=${CONFIG_SHELL-/bin/sh} @@ -294,6 +298,7 @@ as_fn_unset () } as_unset=as_fn_unset + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -325,7 +330,7 @@ as_fn_mkdir_p () as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -334,7 +339,7 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | +printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -373,16 +378,18 @@ as_fn_executable_p () # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : eval 'as_fn_append () { eval $1+=\$2 }' -else - as_fn_append () +else case e in #( + e) as_fn_append () { eval $1=\$$1\$2 - } + } ;; +esac fi # as_fn_append # as_fn_arith ARG... @@ -390,16 +397,18 @@ fi # as_fn_append # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else - as_fn_arith () +else case e in #( + e) as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` - } + } ;; +esac fi # as_fn_arith @@ -413,9 +422,9 @@ as_fn_error () as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $2" >&2 + printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -442,7 +451,7 @@ as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -475,6 +484,8 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits /[$]LINENO/= ' <$as_myself | sed ' + t clear + :clear s/[$]LINENO.*/&-/ t lineno b @@ -486,7 +497,7 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall @@ -500,6 +511,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits exit } + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -513,6 +528,12 @@ case `echo -n x` in #((((( ECHO_N='-n';; esac +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -524,9 +545,9 @@ if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. + # 1) On MSYS, both 'ln -s file dir' and 'ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; 'ln -s' creates a wrapper executable. + # In both cases, we have to default to 'cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then @@ -551,10 +572,12 @@ as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" +as_sed_cpp="y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" +as_tr_cpp="eval sed '$as_sed_cpp'" # deprecated # Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" +as_sed_sh="y%*+%pp%;s%[^_$as_cr_alnum]%_%g" +as_tr_sh="eval sed '$as_sed_sh'" # deprecated test -n "$DJDIR" || exec 7<&0 /dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: '$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -839,9 +857,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: '$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -994,6 +1012,15 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1043,9 +1070,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: '$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -1059,9 +1086,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: '$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -1089,8 +1116,8 @@ do | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; - -*) as_fn_error $? "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information" + -*) as_fn_error $? "unrecognized option: '$ac_option' +Try '$0 --help' for more information" ;; *=*) @@ -1098,16 +1125,16 @@ Try \`$0 --help' for more information" # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + as_fn_error $? "invalid variable name: '$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; @@ -1123,7 +1150,7 @@ if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1131,7 +1158,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1148,7 +1175,7 @@ do as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done -# There might be people who depend on the old broken behavior: `$host' +# There might be people who depend on the old broken behavior: '$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias @@ -1187,7 +1214,7 @@ $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | +printf "%s\n" X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -1216,7 +1243,7 @@ if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_msg="sources are in $srcdir, but 'cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` @@ -1244,7 +1271,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures rJava 0.8 to adapt to many kinds of systems. +'configure' configures rJava 0.8 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1258,11 +1285,11 @@ Configuration: --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking ...' messages + -q, --quiet, --silent do not print 'checking ...' messages --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' + -C, --config-cache alias for '--cache-file=config.cache' -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] + --srcdir=DIR find the sources in DIR [configure dir or '..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX @@ -1270,10 +1297,10 @@ Installation directories: --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. +By default, 'make install' will install all the files in +'$ac_default_prefix/bin', '$ac_default_prefix/lib' etc. You can specify +an installation prefix other than '$ac_default_prefix' using '--prefix', +for instance '--prefix=\$HOME'. For better control, use the options below. @@ -1284,6 +1311,7 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -1331,6 +1359,7 @@ Optional Features: programs to embed R. [auto] --enable-headless enable initialization in headless mode. [auto] --enable-Xrs use -Xrs in Java initialization. [auto] + --enable-dynload load JVM dynamically (without linking). [auto] --enable-debug enable debug flags and output. [no] --enable-mem-profile enable memory profiling. [debug] --enable-callbacks enable the support for callbacks from Java into R. @@ -1345,9 +1374,8 @@ Some influential environment variables: LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory - CPP C preprocessor -Use these variables to override the choices made by `configure' or to help +Use these variables to override the choices made by 'configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . @@ -1366,9 +1394,9 @@ if test "$ac_init_help" = "recursive"; then case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -1396,7 +1424,8 @@ esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. + # Check for configure.gnu first; this name is used for a wrapper for + # Metaconfig's "Configure" on case-insensitive file systems. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive @@ -1404,7 +1433,7 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix echo && $SHELL "$ac_srcdir/configure" --help=recursive else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done @@ -1414,9 +1443,9 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF rJava configure 0.8 -generated by GNU Autoconf 2.69 +generated by GNU Autoconf 2.72 -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2023 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1433,14 +1462,14 @@ fi ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext + rm -f conftest.$ac_objext conftest.beam if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1448,192 +1477,24 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_compile - -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : + } && test -s conftest.$ac_objext +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else case e in #( + e) printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_cpp - -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; + ac_retval=1 ;; esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval -} # ac_fn_c_try_run - -# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists, giving a warning if it cannot be compiled using -# the include files in INCLUDES and setting the cache variable VAR -# accordingly. -ac_fn_c_check_header_mongrel () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval \${$3+:} false; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 -$as_echo_n "checking $2 usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_header_compiler=yes -else - ac_header_compiler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <$2> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no -fi -rm -f conftest.err conftest.i conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} -( $as_echo "## ------------------------------------------ ## -## Report this to Simon.Urbanek@r-project.org ## -## ------------------------------------------ ##" - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_mongrel +} # ac_fn_c_try_compile # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- @@ -1642,49 +1503,56 @@ fi ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : eval "$3=yes" -else - eval "$3=no" +else case e in #( + e) eval "$3=no" ;; +esac fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile -# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES -# --------------------------------------------- +# ac_fn_check_decl LINENO SYMBOL VAR INCLUDES EXTRA-OPTIONS FLAG-VAR +# ------------------------------------------------------------------ # Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR -# accordingly. -ac_fn_c_check_decl () +# accordingly. Pass EXTRA-OPTIONS to the compiler, using FLAG-VAR. +ac_fn_check_decl () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack as_decl_name=`echo $2|sed 's/ *(.*//'` - as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 -$as_echo_n "checking whether $as_decl_name is declared... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +printf %s "checking whether $as_decl_name is declared... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` + eval ac_save_FLAGS=\$$6 + as_fn_append $6 " $5" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int -main () +main (void) { #ifndef $as_decl_name #ifdef __cplusplus @@ -1698,19 +1566,24 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : eval "$3=yes" -else - eval "$3=no" +else case e in #( + e) eval "$3=no" ;; +esac fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + eval $6=\$ac_save_FLAGS + ;; +esac fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno -} # ac_fn_c_check_decl +} # ac_fn_check_decl # ac_fn_c_try_link LINENO # ----------------------- @@ -1718,14 +1591,14 @@ $as_echo "$ac_res" >&6; } ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1733,20 +1606,22 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext - }; then : + } +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else case e in #( + e) printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_retval=1 + ac_retval=1 ;; +esac fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would @@ -1757,14 +1632,78 @@ fi as_fn_set_status $ac_retval } # ac_fn_c_try_link + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that +# executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } +then : + ac_retval=0 +else case e in #( + e) printf "%s\n" "$as_me: program exited with status $ac_status" >&5 + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status ;; +esac +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run +ac_configure_args_raw= +for ac_arg +do + case $ac_arg in + *\'*) + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append ac_configure_args_raw " '$ac_arg'" +done + +case $ac_configure_args_raw in + *$as_nl*) + ac_safe_unquote= ;; + *) + ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. + ac_unsafe_a="$ac_unsafe_z#~" + ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" + ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; +esac + cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by rJava $as_me 0.8, which was -generated by GNU Autoconf 2.69. Invocation command line was +generated by GNU Autoconf 2.72. Invocation command line was - $ $0 $@ + $ $0$ac_configure_args_raw _ACEOF exec 5>>config.log @@ -1797,8 +1736,12 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + printf "%s\n" "PATH: $as_dir" done IFS=$as_save_IFS @@ -1833,7 +1776,7 @@ do | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; @@ -1868,11 +1811,13 @@ done # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? + # Sanitize IFS. + IFS=" "" $as_nl" # Save into config.log some information that might help in debugging. { echo - $as_echo "## ---------------- ## + printf "%s\n" "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo @@ -1883,8 +1828,8 @@ trap 'exit_status=$? case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -1908,7 +1853,7 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; ) echo - $as_echo "## ----------------- ## + printf "%s\n" "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo @@ -1916,14 +1861,14 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - $as_echo "$ac_var='\''$ac_val'\''" + printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## + printf "%s\n" "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo @@ -1931,15 +1876,15 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - $as_echo "$ac_var='\''$ac_val'\''" + printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then - $as_echo "## ----------- ## + printf "%s\n" "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo @@ -1947,8 +1892,8 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; echo fi test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" + printf "%s\n" "$as_me: caught signal $ac_signal" + printf "%s\n" "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && @@ -1962,65 +1907,50 @@ ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h -$as_echo "/* confdefs.h */" > confdefs.h +printf "%s\n" "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF +printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF +printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF +printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF +printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF +printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" -_ACEOF +printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in #(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac + ac_site_files="$CONFIG_SITE" elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site + ac_site_files="$prefix/share/config.site $prefix/etc/config.site" else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site + ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" + +for ac_site_file in $ac_site_files do - test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} + case $ac_site_file in #( + */*) : + ;; #( + *) : + ac_site_file=./$ac_site_file ;; +esac + if test -f "$ac_site_file" && test -r "$ac_site_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5; } +See 'config.log' for more details" "$LINENO" 5; } fi done @@ -2028,61 +1958,395 @@ if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +printf "%s\n" "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +printf "%s\n" "$as_me: creating cache $cache_file" >&6;} >$cache_file fi -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} +# Test code for whether the C compiler supports C89 (global declarations) +ac_c_conftest_c89_globals=' +/* Does the compiler advertise C89 conformance? + Do not test the value of __STDC__, because some compilers set it to 0 + while being otherwise adequately conformant. */ +#if !defined __STDC__ +# error "Compiler does not advertise C89 conformance" +#endif + +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ +struct buf { int x; }; +struct buf * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (char **p, int i) +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* C89 style stringification. */ +#define noexpand_stringify(a) #a +const char *stringified = noexpand_stringify(arbitrary+token=sequence); + +/* C89 style token pasting. Exercises some of the corner cases that + e.g. old MSVC gets wrong, but not very hard. */ +#define noexpand_concat(a,b) a##b +#define expand_concat(a,b) noexpand_concat(a,b) +extern int vA; +extern int vbee; +#define aye A +#define bee B +int *pvA = &expand_concat(v,aye); +int *pvbee = &noexpand_concat(v,bee); + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not \xHH hex character constants. + These do not provoke an error unfortunately, instead are silently treated + as an "x". The following induces an error, until -std is added to get + proper ANSI mode. Curiously \x00 != x always comes out true, for an + array size at least. It is necessary to write \x00 == 0 to get something + that is true only with -std. */ +int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) '\''x'\'' +int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), + int, int);' + +# Test code for whether the C compiler supports C89 (body of main). +ac_c_conftest_c89_main=' +ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); +' + +# Test code for whether the C compiler supports C99 (global declarations) +ac_c_conftest_c99_globals=' +/* Does the compiler advertise C99 conformance? */ +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L +# error "Compiler does not advertise C99 conformance" +#endif + +// See if C++-style comments work. + +#include +extern int puts (const char *); +extern int printf (const char *, ...); +extern int dprintf (int, const char *, ...); +extern void *malloc (size_t); +extern void free (void *); + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +// dprintf is used instead of fprintf to avoid needing to declare +// FILE and stderr. +#define debug(...) dprintf (2, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + #error "your preprocessor is broken" +#endif +#if BIG_OK +#else + #error "your preprocessor is broken" +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static bool +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str = ""; + int number = 0; + float fnumber = 0; + + while (*format) + { + switch (*format++) + { + case '\''s'\'': // string + str = va_arg (args_copy, const char *); + break; + case '\''d'\'': // int + number = va_arg (args_copy, int); + break; + case '\''f'\'': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); + + return *str && number && fnumber; +} +' + +# Test code for whether the C compiler supports C99 (body of main). +ac_c_conftest_c99_main=' + // Check bool. + _Bool success = false; + success |= (argc != 0); + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + // Work around memory leak warnings. + free (ia); + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[0] = argv[0][0]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' + || dynamic_array[ni.number - 1] != 543); +' + +# Test code for whether the C compiler supports C11 (global declarations) +ac_c_conftest_c11_globals=' +/* Does the compiler advertise C11 conformance? */ +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L +# error "Compiler does not advertise C11 conformance" +#endif + +// Check _Alignas. +char _Alignas (double) aligned_as_double; +char _Alignas (0) no_special_alignment; +extern char aligned_as_int; +char _Alignas (0) _Alignas (int) aligned_as_int; + +// Check _Alignof. +enum +{ + int_alignment = _Alignof (int), + int_array_alignment = _Alignof (int[100]), + char_alignment = _Alignof (char) +}; +_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); + +// Check _Noreturn. +int _Noreturn does_not_return (void) { for (;;) continue; } + +// Check _Static_assert. +struct test_static_assert +{ + int x; + _Static_assert (sizeof (int) <= sizeof (long int), + "_Static_assert does not work in struct"); + long int y; +}; + +// Check UTF-8 literals. +#define u8 syntax error! +char const utf8_literal[] = u8"happens to be ASCII" "another string"; + +// Check duplicate typedefs. +typedef long *long_ptr; +typedef long int *long_ptr; +typedef long_ptr long_ptr; + +// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. +struct anonymous +{ + union { + struct { int i; int j; }; + struct { int k; long int l; } w; + }; + int m; +} v1; +' + +# Test code for whether the C compiler supports C11 (body of main). +ac_c_conftest_c11_main=' + _Static_assert ((offsetof (struct anonymous, i) + == offsetof (struct anonymous, w.k)), + "Anonymous union alignment botch"); + v1.i = 2; + v1.w.k = 5; + ok |= v1.i != 5; +' + +# Test code for whether the C compiler supports C11 (complete). +ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} +${ac_c_conftest_c11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + ${ac_c_conftest_c11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C99 (complete). +ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + return ok; +} +" + +# Test code for whether the C compiler supports C89 (complete). +ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + return ok; +} +" + +as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" +as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" +as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" +as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" +as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" +as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" +as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" +as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" +as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' was set to '$ac_old_val' in the previous run" >&5 +printf "%s\n" "$as_me: error: '$ac_var' was set to '$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' was not set in the previous run" >&5 +printf "%s\n" "$as_me: error: '$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' has changed since the previous run:" >&5 +printf "%s\n" "$as_me: error: '$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in '$ac_var' since the previous run:" >&5 +printf "%s\n" "$as_me: warning: ignoring whitespace changes in '$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: '$ac_old_val'" >&5 +printf "%s\n" "$as_me: former value: '$ac_old_val'" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: '$ac_new_val'" >&5 +printf "%s\n" "$as_me: current value: '$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in @@ -2092,11 +2356,12 @@ $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi done if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run '${MAKE-make} distclean' and/or 'rm $cache_file' + and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## @@ -2113,6 +2378,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers src/config.h" + # find R home and set CC/CFLAGS : ${R_HOME=`R RHOME`} if test -z "${R_HOME}"; then @@ -2133,78 +2399,120 @@ fi ## enable threads, i.e. Java is running is a separate thread # Check whether --enable-threads was given. -if test "${enable_threads+set}" = set; then : +if test ${enable_threads+y} +then : enableval=$enable_threads; want_threads="${enableval}" -else - want_threads=no +else case e in #( + e) want_threads=no ;; +esac fi ## enable JNI-cache # Check whether --enable-jni-cache was given. -if test "${enable_jni_cache+set}" = set; then : +if test ${enable_jni_cache+y} +then : enableval=$enable_jni_cache; want_jni_cache="${enableval}" -else - want_jni_cache=no +else case e in #( + e) want_jni_cache=no ;; +esac fi ## enable JRI # Check whether --enable-jri was given. -if test "${enable_jri+set}" = set; then : +if test ${enable_jri+y} +then : enableval=$enable_jri; want_jri="${enableval}" -else - want_jri=auto +else case e in #( + e) want_jri=auto ;; +esac fi ## enable headless # Check whether --enable-headless was given. -if test "${enable_headless+set}" = set; then : +if test ${enable_headless+y} +then : enableval=$enable_headless; want_headless="${enableval}" -else - want_headless=auto +else case e in #( + e) want_headless=auto ;; +esac fi ## enable -Xrs support # Check whether --enable-Xrs was given. -if test "${enable_Xrs+set}" = set; then : +if test ${enable_Xrs+y} +then : enableval=$enable_Xrs; want_xrs="${enableval}" -else - want_xrs=auto +else case e in #( + e) want_xrs=auto ;; +esac +fi + + +## enable dynloaded JVM +# Check whether --enable-dynload was given. +if test ${enable_dynload+y} +then : + enableval=$enable_dynload; want_dynload="${enableval}" +else case e in #( + e) want_dynload=auto ;; +esac fi ## enable debug flags # Check whether --enable-debug was given. -if test "${enable_debug+set}" = set; then : +if test ${enable_debug+y} +then : enableval=$enable_debug; want_debug="${enableval}" -else - want_debug=no +else case e in #( + e) want_debug=no ;; +esac fi ## enable memory profiling # Check whether --enable-mem-profile was given. -if test "${enable_mem_profile+set}" = set; then : +if test ${enable_mem_profile+y} +then : enableval=$enable_mem_profile; want_memprof="${enableval}" -else - want_memprof=debug +else case e in #( + e) want_memprof=debug ;; +esac fi ## enable callbacks (experimental) # Check whether --enable-callbacks was given. -if test "${enable_callbacks+set}" = set; then : +if test ${enable_callbacks+y} +then : enableval=$enable_callbacks; want_callbacks="${enableval}" -else - want_callbacks=no +else case e in #( + e) want_callbacks=no ;; +esac fi # Checks for programs. +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -2213,38 +2521,44 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS -fi +fi ;; +esac fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -2253,38 +2567,44 @@ if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS -fi +fi ;; +esac fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then @@ -2292,8 +2612,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -2306,38 +2626,44 @@ if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS -fi +fi ;; +esac fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -2346,12 +2672,13 @@ fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no @@ -2359,15 +2686,19 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2383,18 +2714,19 @@ if test $ac_prog_rejected = yes; then # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" fi fi -fi +fi ;; +esac fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -2405,38 +2737,44 @@ if test -z "$CC"; then do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS -fi +fi ;; +esac fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -2449,38 +2787,44 @@ if test -z "$CC"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS -fi +fi ;; +esac fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -2492,34 +2836,140 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. +set dummy ${ac_tool_prefix}clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "clang", so it can be a program name with args. +set dummy clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi +else + CC="$ac_cv_prog_CC" fi fi -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } +See 'config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 -for ac_option in --version -v -V -qversion; do +for ac_option in --version -v -V -qversion -version; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -2529,7 +2979,7 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done @@ -2537,7 +2987,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; @@ -2549,9 +2999,9 @@ ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +printf %s "checking whether the C compiler works... " >&6; } +ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" @@ -2572,13 +3022,14 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + # Autoconf-2.13 could set the ac_cv_exeext variable to 'no'. +# So ignore a value of 'no', otherwise this would lead to 'EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. @@ -2593,12 +3044,12 @@ do # certainly right. break;; *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' + # safe: cross compilers may not add the suffix if given an '-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. @@ -2609,48 +3060,52 @@ do done test "$ac_cv_exeext" = no && ac_cv_exeext= -else - ac_file='' +else case e in #( + e) ac_file='' ;; +esac fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 +if test -z "$ac_file" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +See 'config.log' for more details" "$LINENO" 5; } +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } ;; +esac fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +printf %s "checking for C compiler default output file name... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +printf "%s\n" "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +printf %s "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + # If both 'conftest.exe' and 'conftest' are 'present' (well, observable) +# catch 'conftest.exe'. For instance with Cygwin, 'ls conftest' will +# work properly (i.e., refer to 'conftest.exe'), while it won't with +# 'rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in @@ -2660,15 +3115,16 @@ for ac_file in conftest.exe conftest conftest.*; do * ) break;; esac done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +else case e in #( + e) { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5; } +See 'config.log' for more details" "$LINENO" 5; } ;; +esac fi rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +printf "%s\n" "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext @@ -2677,9 +3133,11 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main () +main (void) { FILE *f = fopen ("conftest.out", "w"); + if (!f) + return 1; return ferror (f) || fclose (f) != 0; ; @@ -2689,8 +3147,8 @@ _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +printf %s "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in @@ -2698,10 +3156,10 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in @@ -2709,39 +3167,41 @@ $as_echo "$ac_try_echo"; } >&5 *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5; } + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error 77 "cannot run C compiled programs. +If you meant to cross compile, use '--host'. +See 'config.log' for more details" "$LINENO" 5; } fi fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +printf "%s\n" "$cross_compiling" >&6; } -rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +rm -f conftest.$ac_ext conftest$ac_cv_exeext \ + conftest.o conftest.obj conftest.out ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +printf %s "checking for suffix of object files... " >&6; } +if test ${ac_cv_objext+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; @@ -2755,11 +3215,12 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in @@ -2768,31 +3229,34 @@ $as_echo "$ac_try_echo"; } >&5 break;; esac done -else - $as_echo "$as_me: failed program was:" >&5 +else case e in #( + e) printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5; } +See 'config.log' for more details" "$LINENO" 5; } ;; +esac fi -rm -f conftest.$ac_cv_objext conftest.$ac_ext +rm -f conftest.$ac_cv_objext conftest.$ac_ext ;; +esac fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +printf "%s\n" "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 +printf %s "checking whether the compiler supports GNU C... " >&6; } +if test ${ac_cv_c_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { #ifndef __GNUC__ choke me @@ -2802,30 +3266,36 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_compiler_gnu=yes -else - ac_compiler_gnu=no +else case e in #( + e) ac_compiler_gnu=no ;; +esac fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu - + ;; +esac fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_c_compiler_gnu + if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi -ac_test_CFLAGS=${CFLAGS+set} +ac_test_CFLAGS=${CFLAGS+y} ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +printf %s "checking whether $CC accepts -g... " >&6; } +if test ${ac_cv_prog_cc_g+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" @@ -2833,57 +3303,63 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_g=yes -else - CFLAGS="" +else case e in #( + e) CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : -else - ac_c_werror_flag=$ac_save_c_werror_flag +else case e in #( + e) ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_g=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag ;; +esac fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +printf "%s\n" "$ac_cv_prog_cc_g" >&6; } +if test $ac_test_CFLAGS; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then @@ -2894,497 +3370,177 @@ elif test $ac_cv_prog_cc_g = yes; then else if test "$GCC" = yes; then CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -# Checks for libraries. - -# Checks for header files. - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_GREP" || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_EGREP" || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no + else + CFLAGS= + fi fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +ac_prog_cc_stdc=no +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 +printf %s "checking for $CC option to enable C11 features... " >&6; } +if test ${ac_cv_prog_cc_c11+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_cv_prog_cc_c11=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - +$ac_c_conftest_c11_program _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no +for ac_arg in '' -std=gnu11 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c11=$ac_arg fi -rm -f conftest* - +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c11" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC ;; +esac fi -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +if test "x$ac_cv_prog_cc_c11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else case e in #( + e) if test "x$ac_cv_prog_cc_c11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } + CC="$CC $ac_cv_prog_cc_c11" ;; +esac +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 + ac_prog_cc_stdc=c11 ;; +esac +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 +printf %s "checking for $CC option to enable C99 features... " >&6; } +if test ${ac_cv_prog_cc_c99+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - +$ac_c_conftest_c99_program _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no +for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c99=$ac_arg fi -rm -f conftest* - +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC ;; +esac fi -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +if test "x$ac_cv_prog_cc_c99" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else case e in #( + e) if test "x$ac_cv_prog_cc_c99" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } + CC="$CC $ac_cv_prog_cc_c99" ;; +esac +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 + ac_prog_cc_stdc=c99 ;; +esac +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 +printf %s "checking for $CC option to enable C89 features... " >&6; } +if test ${ac_cv_prog_cc_c89+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} +$ac_c_conftest_c89_program _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c89=$ac_arg fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC ;; +esac fi +if test "x$ac_cv_prog_cc_c89" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else case e in #( + e) if test "x$ac_cv_prog_cc_c89" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } + CC="$CC $ac_cv_prog_cc_c89" ;; +esac +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 + ac_prog_cc_stdc=c89 ;; +esac fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then -$as_echo "#define STDC_HEADERS 1" >>confdefs.h +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + -fi +# Checks for libraries. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5 -$as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; } -if ${ac_cv_header_sys_wait_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +# Checks for header files. + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5 +printf %s "checking for sys/wait.h that is POSIX.1 compatible... " >&6; } +if test ${ac_cv_header_sys_wait_h+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include @@ -3396,7 +3552,7 @@ else #endif int -main () +main (void) { int s; wait (&s); @@ -3405,63 +3561,85 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_header_sys_wait_h=yes -else - ac_cv_header_sys_wait_h=no +else case e in #( + e) ac_cv_header_sys_wait_h=no ;; +esac fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5 -$as_echo "$ac_cv_header_sys_wait_h" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5 +printf "%s\n" "$ac_cv_header_sys_wait_h" >&6; } if test $ac_cv_header_sys_wait_h = yes; then -$as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h +printf "%s\n" "#define HAVE_SYS_WAIT_H 1" >>confdefs.h fi -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +ac_header= ac_cache= +for ac_item in $ac_header_c_list +do + if test $ac_cache; then + ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" + if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then + printf "%s\n" "#define $ac_item 1" >> confdefs.h + fi + ac_header= ac_cache= + elif test $ac_header; then + ac_cache=$ac_item + else + ac_header=$ac_item + fi +done + -fi -done -for ac_header in string.h sys/time.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF + + + +if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes +then : + +printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h fi +ac_fn_c_check_header_compile "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default" +if test "x$ac_cv_header_string_h" = xyes +then : + printf "%s\n" "#define HAVE_STRING_H 1" >>confdefs.h -done +fi +ac_fn_c_check_header_compile "$LINENO" "sys/time.h" "ac_cv_header_sys_time_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_time_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_TIME_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default" +if test "x$ac_cv_header_unistd_h" = xyes +then : + printf "%s\n" "#define HAVE_UNISTD_H 1" >>confdefs.h + +fi # Checks for typedefs, structures, and compiler characteristics. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 -$as_echo_n "checking for an ANSI C-conforming const... " >&6; } -if ${ac_cv_c_const+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 +printf %s "checking for an ANSI C-conforming const... " >&6; } +if test ${ac_cv_c_const+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { #ifndef __cplusplus @@ -3474,7 +3652,7 @@ main () /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; - /* AIX XL C 1.02.0.0 rejects this. + /* IBM XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ @@ -3502,7 +3680,7 @@ main () iptr p = 0; ++p; } - { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying + { /* IBM XL C 1.02.0.0 rejects this sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; } bx; struct s *b = &bx; b->j = 5; @@ -3518,93 +3696,64 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_c_const=yes -else - ac_cv_c_const=no +else case e in #( + e) ac_cv_c_const=no ;; +esac fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 -$as_echo "$ac_cv_c_const" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 +printf "%s\n" "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then -$as_echo "#define const /**/" >>confdefs.h - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 -$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } -if ${ac_cv_header_time+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include - -int -main () -{ -if ((struct tm *) 0) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_time=yes -else - ac_cv_header_time=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 -$as_echo "$ac_cv_header_time" >&6; } -if test $ac_cv_header_time = yes; then - -$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h +printf "%s\n" "#define const /**/" >>confdefs.h fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports static inline..." >&5 -$as_echo "$as_me: checking whether ${CC} supports static inline..." >&6;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports static inline..." >&5 +printf "%s\n" "$as_me: checking whether ${CC} supports static inline..." >&6;} can_inline=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ static inline int foo(int a, int b); -static f = 1; +static int f = 1; static inline int foo(int a, int b) { return a+b; } int main(void) { return foo(f,-1); } + _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : can_inline=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${can_inline}" >&5 -$as_echo "${can_inline}" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${can_inline}" >&5 +printf "%s\n" "${can_inline}" >&6; } if test "${can_inline}" = yes; then -$as_echo "#define HAVE_STATIC_INLINE 1" >>confdefs.h +printf "%s\n" "#define HAVE_STATIC_INLINE 1" >>confdefs.h fi ### from R m4/R.m4 - needed to hack R 2.9.x -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether setjmp.h is POSIX.1 compatible" >&5 -$as_echo_n "checking whether setjmp.h is POSIX.1 compatible... " >&6; } -if ${r_cv_header_setjmp_posix+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether setjmp.h is POSIX.1 compatible" >&5 +printf %s "checking whether setjmp.h is POSIX.1 compatible... " >&6; } +if test ${r_cv_header_setjmp_posix+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main () +main (void) { sigjmp_buf b; sigsetjmp(b, 0); @@ -3613,37 +3762,121 @@ siglongjmp(b, 1); return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : r_cv_header_setjmp_posix=yes -else - r_cv_header_setjmp_posix=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else case e in #( + e) r_cv_header_setjmp_posix=no ;; +esac fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $r_cv_header_setjmp_posix" >&5 -$as_echo "$r_cv_header_setjmp_posix" >&6; } -ac_fn_c_check_decl "$LINENO" "sigsetjmp" "ac_cv_have_decl_sigsetjmp" "#include -" -if test "x$ac_cv_have_decl_sigsetjmp" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $r_cv_header_setjmp_posix" >&5 +printf "%s\n" "$r_cv_header_setjmp_posix" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC options needed to detect all undeclared functions" >&5 +printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; } +if test ${ac_cv_c_undeclared_builtin_options+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_save_CFLAGS=$CFLAGS + ac_cv_c_undeclared_builtin_options='cannot detect' + for ac_arg in '' -fno-builtin; do + CFLAGS="$ac_save_CFLAGS $ac_arg" + # This test program should *not* compile successfully. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SIGSETJMP $ac_have_decl +int +main (void) +{ +(void) strchr; + ; + return 0; +} _ACEOF -ac_fn_c_check_decl "$LINENO" "siglongjmp" "ac_cv_have_decl_siglongjmp" "#include -" -if test "x$ac_cv_have_decl_siglongjmp" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi +if ac_fn_c_try_compile "$LINENO" +then : + +else case e in #( + e) # This test program should compile successfully. + # No library function is consistently available on + # freestanding implementations, so test against a dummy + # declaration. Include always-available headers on the + # off chance that they somehow elicit warnings. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +extern void ac_decl (int, char *); + +int +main (void) +{ +(void) ac_decl (0, (char *) 0); + (void) ac_decl; -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SIGLONGJMP $ac_have_decl + ; + return 0; +} _ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + if test x"$ac_arg" = x +then : + ac_cv_c_undeclared_builtin_options='none needed' +else case e in #( + e) ac_cv_c_undeclared_builtin_options=$ac_arg ;; +esac +fi + break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + done + CFLAGS=$ac_save_CFLAGS + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_undeclared_builtin_options" >&5 +printf "%s\n" "$ac_cv_c_undeclared_builtin_options" >&6; } + case $ac_cv_c_undeclared_builtin_options in #( + 'cannot detect') : + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error $? "cannot make $CC report undeclared builtins +See 'config.log' for more details" "$LINENO" 5; } ;; #( + 'none needed') : + ac_c_undeclared_builtin_options='' ;; #( + *) : + ac_c_undeclared_builtin_options=$ac_cv_c_undeclared_builtin_options ;; +esac + +ac_fn_check_decl "$LINENO" "sigsetjmp" "ac_cv_have_decl_sigsetjmp" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_sigsetjmp" = xyes +then : + ac_have_decl=1 +else case e in #( + e) ac_have_decl=0 ;; +esac +fi +printf "%s\n" "#define HAVE_DECL_SIGSETJMP $ac_have_decl" >>confdefs.h +ac_fn_check_decl "$LINENO" "siglongjmp" "ac_cv_have_decl_siglongjmp" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_siglongjmp" = xyes +then : + ac_have_decl=1 +else case e in #( + e) ac_have_decl=0 ;; +esac +fi +printf "%s\n" "#define HAVE_DECL_SIGLONGJMP $ac_have_decl" >>confdefs.h if test "$ac_cv_have_decl_sigsetjmp" = no; then r_cv_header_setjmp_posix=no @@ -3653,12 +3886,12 @@ if test "$ac_cv_have_decl_siglongjmp" = no; then fi if test "${r_cv_header_setjmp_posix}" = yes; then -$as_echo "#define HAVE_POSIX_SETJMP 1" >>confdefs.h +printf "%s\n" "#define HAVE_POSIX_SETJMP 1" >>confdefs.h fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Java support in R" >&5 -$as_echo_n "checking Java support in R... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking Java support in R" >&5 +printf %s "checking Java support in R... " >&6; } R_JAVA_HOME=`"${RBIN}" CMD config JAVA_HOME` : ${JAVA_HOME="${R_JAVA_HOME}"} if test -z "${JAVA_HOME}"; then @@ -3679,14 +3912,14 @@ fi : ${JAVA_CPPFLAGS=`"${RBIN}" CMD config JAVA_CPPFLAGS|sed 's/ERROR:.*//'`} : ${JAVA_LIBS=`"${RBIN}" CMD config JAVA_LIBS|sed 's/ERROR:.*//'`} -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: present: +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: present: interpreter : '${JAVA}' archiver : '${JAR}' compiler : '${JAVAC}' header prep.: '${JAVAH}' cpp flags : '${JAVA_CPPFLAGS}' java libs : '${JAVA_LIBS}'" >&5 -$as_echo "present: +printf "%s\n" "present: interpreter : '${JAVA}' archiver : '${JAR}' compiler : '${JAVAC}' @@ -3703,7 +3936,7 @@ if test -z "${JAVAC}"; then fi have_all_flags=no -if test -n "${JAVA}" && test -n "${JAVAC}" && test -n "${JAVAH}" && \ +if test -n "${JAVA}" && test -n "${JAVAC}" && \ test -n "${JAVA_CPPFLAGS}" && test -n "${JAVA_LIBS}" && test -n "${JAR}"; then have_all_flags=yes; fi @@ -3724,8 +3957,8 @@ if test `echo foo | sed -e 's:foo:bar:'` = bar; then JAVA_LIBS0=`echo ${JAVA_LIBS} | sed -e 's:$(JAVA_HOME):'${JAVA_HOME}':g'` JAVA_LD_LIBRARY_PATH0=`echo ${JAVA_LD_LIBRARY_PATH} | sed -e 's:$(JAVA_HOME):'${JAVA_HOME}':g'` else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: sed is not working properly - the configuration may fail" >&5 -$as_echo "$as_me: WARNING: sed is not working properly - the configuration may fail" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: sed is not working properly - the configuration may fail" >&5 +printf "%s\n" "$as_me: WARNING: sed is not working properly - the configuration may fail" >&2;} JAVA_CPPFLAGS0="${JAVA_CPPFLAGS}" JAVA_LIBS0="${JAVA_LIBS}" JAVA_LD_LIBRARY_PATH0="${JAVA_LD_LIBRARY_PATH}" @@ -3742,42 +3975,66 @@ if test "x$OSNAME" = xDarwin; then export DYLD_FALLBACK_LIBRARY_PATH fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Java run-time works" >&5 -$as_echo_n "checking whether Java run-time works... " >&6; } -if "$JAVA" -classpath . getsp; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether Java run-time works" >&5 +printf %s "checking whether Java run-time works... " >&6; } +if "$JAVA" -classpath tools getsp; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } as_fn_error $? "Java interpreter '$JAVA' does not work" "$LINENO" 5 fi has_xrs="$want_xrs" if test x"$has_xrs" = xauto; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -Xrs is supported" >&5 -$as_echo_n "checking whether -Xrs is supported... " >&6; } - if "$JAVA" -Xrs -classpath . getsp; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -Xrs is supported" >&5 +printf %s "checking whether -Xrs is supported... " >&6; } + if "$JAVA" -Xrs -classpath tools getsp; then has_xrs=yes else has_xrs=no fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${has_xrs}" >&5 -$as_echo "${has_xrs}" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${has_xrs}" >&5 +printf "%s\n" "${has_xrs}" >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -Xrs will be used" >&5 -$as_echo_n "checking whether -Xrs will be used... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${has_xrs}" >&5 -$as_echo "${has_xrs}" >&6; } -if test "$has_xrs" = xyes; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -Xrs will be used" >&5 +printf %s "checking whether -Xrs will be used... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${has_xrs}" >&5 +printf "%s\n" "${has_xrs}" >&6; } +if test x"$has_xrs" = xyes; then -$as_echo "#define HAVE_XRS 1" >>confdefs.h +printf "%s\n" "#define HAVE_XRS 1" >>confdefs.h fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether JNI programs can be compiled" >&5 -$as_echo_n "checking whether JNI programs can be compiled... " >&6; } +use_dynload="$want_dynload" +if test x"$use_dynload" = xauto; then + if test "x$OSNAME" = xDarwin; then + use_dynload=yes + else + use_dynload=no + fi +fi +if test x"$use_dynload" != xyes; then + use_dynload=no +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether JVM will be loaded dynamically" >&5 +printf %s "checking whether JVM will be loaded dynamically... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${use_dynload}" >&5 +printf "%s\n" "${use_dynload}" >&6; } + if test "x${use_dynload}" = xyes; then + USE_DYNLOAD_TRUE= + USE_DYNLOAD_FALSE='#' +else + USE_DYNLOAD_TRUE='#' + USE_DYNLOAD_FALSE= +fi + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether JNI programs can be compiled" >&5 +printf %s "checking whether JNI programs can be compiled... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -3789,26 +4046,63 @@ int main(void) { } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - as_fn_error $? "Cannot compile a simple JNI program. See config.log for details. +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else case e in #( + e) as_fn_error $? "Cannot compile a simple JNI program. See config.log for details. Make sure you have Java Development Kit installed and correctly registered in R. If in doubt, re-run \"R CMD javareconf\" as root. -" "$LINENO" 5 +" "$LINENO" 5 ;; +esac fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking JNI data types" >&5 -$as_echo_n "checking JNI data types... " >&6; } -if test "$cross_compiling" = yes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: don't know (cross-compiling)" >&5 -$as_echo "don't know (cross-compiling)" >&6; } -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether JNI programs run" >&5 +printf %s "checking whether JNI programs run... " >&6; } +if test "$cross_compiling" = yes +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: don't know (cross-compiling)" >&5 +printf "%s\n" "don't know (cross-compiling)" >&6; } +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +int main(void) { + jsize n; + JNI_GetCreatedJavaVMs(NULL, 0, &n); + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else case e in #( + e) as_fn_error $? "Unable to run a simple JNI program. Make sure you have configured R with Java support (see R documentation) and check config.log for failure reason." "$LINENO" 5 ;; +esac +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking JNI data types" >&5 +printf %s "checking JNI data types... " >&6; } +if test "$cross_compiling" = yes +then : + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See 'config.log' for more details" "$LINENO" 5; } +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -3817,22 +4111,26 @@ int main(void) { } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 -$as_echo "ok" >&6; } -else - as_fn_error $? "One or more JNI types differ from the corresponding native type. You may need to use non-standard compiler flags or a different compiler in order to fix this." "$LINENO" 5 +if ac_fn_c_try_run "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +printf "%s\n" "ok" >&6; } +else case e in #( + e) as_fn_error $? "One or more JNI types differ from the corresponding native type. You may need to use non-standard compiler flags or a different compiler in order to fix this." "$LINENO" 5 ;; +esac fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext + conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi + if test "${want_jri}" = auto; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether JRI should be compiled (autodetect)" >&5 -$as_echo_n "checking whether JRI should be compiled (autodetect)... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${has_R_shlib}" >&5 -$as_echo "${has_R_shlib}" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether JRI should be compiled (autodetect)" >&5 +printf %s "checking whether JRI should be compiled (autodetect)... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${has_R_shlib}" >&5 +printf "%s\n" "${has_R_shlib}" >&6; } want_jri=${has_R_shlib} fi if test "x${want_jri}" = xyes; then @@ -3844,31 +4142,31 @@ else fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether debugging output should be enabled" >&5 -$as_echo_n "checking whether debugging output should be enabled... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether debugging output should be enabled" >&5 +printf %s "checking whether debugging output should be enabled... " >&6; } if test "${want_debug}" = yes; then JAVA_CPPFLAGS="-g -DRJ_DEBUG ${JAVA_CPPFLAGS}" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether memory profiling is desired" >&5 -$as_echo_n "checking whether memory profiling is desired... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether memory profiling is desired" >&5 +printf %s "checking whether memory profiling is desired... " >&6; } if test "${want_memprof}" = debug; then want_memprof="${want_debug}" fi if test "${want_memprof}" = yes; then -$as_echo "#define MEMPROF 1" >>confdefs.h +printf "%s\n" "#define MEMPROF 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3879,63 +4177,63 @@ fi use_threads=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether threads support is requested" >&5 -$as_echo_n "checking whether threads support is requested... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether threads support is requested" >&5 +printf %s "checking whether threads support is requested... " >&6; } if test "${want_threads}" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether threads can be enabled" >&5 -$as_echo_n "checking whether threads can be enabled... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether threads can be enabled" >&5 +printf %s "checking whether threads can be enabled... " >&6; } # check whether we can add THREADS support # we don't want to run full AC_CANONICAL_HOST, all we care about is OS X if test "x$OSNAME" = xDarwin; then use_threads=yes -$as_echo "#define THREADS 1" >>confdefs.h +printf "%s\n" "#define THREADS 1" >>confdefs.h fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${use_threads}" >&5 -$as_echo "${use_threads}" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${use_threads}" >&5 +printf "%s\n" "${use_threads}" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi ## enable callbacks if desired -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether callbacks support is requested" >&5 -$as_echo_n "checking whether callbacks support is requested... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether callbacks support is requested" >&5 +printf %s "checking whether callbacks support is requested... " >&6; } if test "${want_callbacks}" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } if test "${want_jri}" != yes; then as_fn_error $? "Callbacks support can be only enabled if JRI is enabled as well." "$LINENO" 5 fi -$as_echo "#define ENABLE_JRICB 1" >>confdefs.h +printf "%s\n" "#define ENABLE_JRICB 1" >>confdefs.h else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether JNI cache support is requested" >&5 -$as_echo_n "checking whether JNI cache support is requested... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether JNI cache support is requested" >&5 +printf %s "checking whether JNI cache support is requested... " >&6; } if test "${want_jni_cache}" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } if test "${use_threads}" = yes; then as_fn_error $? "Threads and JNI cache cannot be used at the same time, because JNI cache is by definition not thread-safe. Please disable either option." "$LINENO" 5 fi -$as_echo "#define JNI_CACHE 1" >>confdefs.h +printf "%s\n" "#define JNI_CACHE 1" >>confdefs.h else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether headless init is enabled" >&5 -$as_echo_n "checking whether headless init is enabled... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether headless init is enabled" >&5 +printf %s "checking whether headless init is enabled... " >&6; } if test "${want_headless}" = auto; then want_headless=no ## only Darwin defaults to headless @@ -3943,59 +4241,30 @@ if test "${want_headless}" = auto; then want_headless=yes fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${want_headless}" >&5 -$as_echo "${want_headless}" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${want_headless}" >&5 +printf "%s\n" "${want_headless}" >&6; } if test "${want_headless}" = yes; then -$as_echo "#define USE_HEADLESS_INIT 1" >>confdefs.h +printf "%s\n" "#define USE_HEADLESS_INIT 1" >>confdefs.h fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether JRI is requested" >&5 -$as_echo_n "checking whether JRI is requested... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether JRI is requested" >&5 +printf %s "checking whether JRI is requested... " >&6; } if test "${want_jri}" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } export R_HOME export JAVA_HOME JAVA_CPPFLAGS JAVA_LIBS JAVA_LD_LIBRARY_PATH JAVA JAVAC JAVAH JAR CONFIGURED=1 export CONFIGURED - ac_aux_dir= -for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 -fi - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - - -subdirs="$subdirs jri" +subdirs="$subdirs src/jri" else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi ac_config_files="$ac_config_files src/Makevars" @@ -4012,8 +4281,8 @@ cat >confcache <<\_ACEOF # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the +# 'ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* 'ac_cv_foo' will be assigned the # following values. _ACEOF @@ -4029,8 +4298,8 @@ _ACEOF case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -4043,14 +4312,14 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes: double-quote + # 'set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) - # `set' quotes correctly as required by POSIX, so do not add quotes. + # 'set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | @@ -4060,15 +4329,15 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; /^ac_cv_env_/b end t clear :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +printf "%s\n" "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else @@ -4082,8 +4351,8 @@ $as_echo "$as_me: updating cache $cache_file" >&6;} fi fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache @@ -4100,7 +4369,7 @@ U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" @@ -4111,6 +4380,10 @@ LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs +if test -z "${USE_DYNLOAD_TRUE}" && test -z "${USE_DYNLOAD_FALSE}"; then + as_fn_error $? "conditional \"USE_DYNLOAD\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${WANT_JRI_TRUE}" && test -z "${WANT_JRI_FALSE}"; then as_fn_error $? "conditional \"WANT_JRI\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -4120,8 +4393,8 @@ fi ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL @@ -4144,63 +4417,65 @@ cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( +else case e in #( + e) case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; +esac ;; esac fi + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then +if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -4209,13 +4484,6 @@ if test "${PATH_SEPARATOR+set}" != set; then fi -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -4224,43 +4492,27 @@ case $0 in #(( for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS ;; esac -# We did not find ourselves, most probably we were run as `sh COMMAND' +# We did not find ourselves, most probably we were run as 'sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] @@ -4273,9 +4525,9 @@ as_fn_error () as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $2" >&2 + printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -4306,22 +4558,25 @@ as_fn_unset () { eval $1=; unset $1;} } as_unset=as_fn_unset + # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : eval 'as_fn_append () { eval $1+=\$2 }' -else - as_fn_append () +else case e in #( + e) as_fn_append () { eval $1=\$$1\$2 - } + } ;; +esac fi # as_fn_append # as_fn_arith ARG... @@ -4329,16 +4584,18 @@ fi # as_fn_append # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else - as_fn_arith () +else case e in #( + e) as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` - } + } ;; +esac fi # as_fn_arith @@ -4365,7 +4622,7 @@ as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -4387,6 +4644,10 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -4400,6 +4661,12 @@ case `echo -n x` in #((((( ECHO_N='-n';; esac +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -4411,9 +4678,9 @@ if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. + # 1) On MSYS, both 'ln -s file dir' and 'ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; 'ln -s' creates a wrapper executable. + # In both cases, we have to default to 'cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then @@ -4441,7 +4708,7 @@ as_fn_mkdir_p () as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -4450,7 +4717,7 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | +printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -4494,10 +4761,12 @@ as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" +as_sed_cpp="y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" +as_tr_cpp="eval sed '$as_sed_cpp'" # deprecated # Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" +as_sed_sh="y%*+%pp%;s%[^_$as_cr_alnum]%_%g" +as_tr_sh="eval sed '$as_sed_sh'" # deprecated exec 6>&1 @@ -4513,7 +4782,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by rJava $as_me 0.8, which was -generated by GNU Autoconf 2.69. Invocation command line was +generated by GNU Autoconf 2.72. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -4544,7 +4813,7 @@ _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ -\`$as_me' instantiates files and other configuration actions +'$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. @@ -4571,14 +4840,16 @@ $config_headers Report bugs to ." _ACEOF +ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` +ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ rJava config.status 0.8 -configured by $0, generated by GNU Autoconf 2.69, +configured by $0, generated by GNU Autoconf 2.72, with options \\"\$ac_cs_config\\" -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2023 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -4615,15 +4886,15 @@ do -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; + printf "%s\n" "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; + printf "%s\n" "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" @@ -4631,23 +4902,23 @@ do --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header - as_fn_error $? "ambiguous option: \`$1' -Try \`$0 --help' for more information.";; + as_fn_error $? "ambiguous option: '$1' +Try '$0 --help' for more information.";; --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; + printf "%s\n" "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. - -*) as_fn_error $? "unrecognized option: \`$1' -Try \`$0 --help' for more information." ;; + -*) as_fn_error $? "unrecognized option: '$1' +Try '$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; @@ -4668,7 +4939,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" @@ -4682,7 +4953,7 @@ exec 5>>config.log sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX - $as_echo "$ac_log" + printf "%s\n" "$ac_log" } >&5 _ACEOF @@ -4699,7 +4970,7 @@ do "src/Makevars") CONFIG_FILES="$CONFIG_FILES src/Makevars" ;; "R/zzz.R") CONFIG_FILES="$CONFIG_FILES R/zzz.R" ;; - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + *) as_fn_error $? "invalid argument: '$ac_config_target'" "$LINENO" 5;; esac done @@ -4709,8 +4980,8 @@ done # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files + test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers fi # Have a temporary directory for convenience. Make it in the build tree @@ -4718,7 +4989,7 @@ fi # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. +# after its creation but before its name has been assigned to '$tmp'. $debug || { tmp= ac_tmp= @@ -4742,7 +5013,7 @@ ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. -# This happens for instance with `./config.status config.h'. +# This happens for instance with './config.status config.h'. if test -n "$CONFIG_FILES"; then @@ -4900,13 +5171,13 @@ fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. -# This happens for instance with `./config.status Makefile'. +# This happens for instance with './config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF -# Transform confdefs.h into an awk script `defines.awk', embedded as +# Transform confdefs.h into an awk script 'defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. @@ -5016,7 +5287,7 @@ do esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :L* | :C*:*) as_fn_error $? "invalid tag '$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -5038,33 +5309,33 @@ do -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. + # because $ac_f cannot contain ':'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + as_fn_error 1 "cannot find input file: '$ac_f'" "$LINENO" 5;; esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done - # Let's still pretend it is `configure' which instantiates (i.e., don't + # Let's still pretend it is 'configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | + ac_sed_conf_input=`printf "%s\n" "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac @@ -5081,7 +5352,7 @@ $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | +printf "%s\n" X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -5105,9 +5376,9 @@ $as_echo X"$ac_file" | case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -5160,8 +5431,8 @@ ac_sed_dataroot=' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' @@ -5174,7 +5445,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 esac _ACEOF -# Neutralize VPATH when `$srcdir' = `.'. +# Neutralize VPATH when '$srcdir' = '.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 @@ -5203,9 +5474,9 @@ test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable 'datarootdir' which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable 'datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" @@ -5221,20 +5492,20 @@ which seems to be undefined. Please make sure it is defined" >&2;} # if test x"$ac_file" != x-; then { - $as_echo "/* $configure_input */" \ + printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 -$as_echo "$as_me: $ac_file is unchanged" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else - $as_echo "/* $configure_input */" \ + printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi @@ -5314,7 +5585,7 @@ if test "$no_recursion" != yes; then ;; *) case $ac_arg in - *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append ac_sub_configure_args " '$ac_arg'" ;; esac @@ -5324,7 +5595,7 @@ if test "$no_recursion" != yes; then # in subdir configurations. ac_arg="--prefix=$prefix" case $ac_arg in - *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac ac_sub_configure_args="'$ac_arg' $ac_sub_configure_args" @@ -5345,17 +5616,17 @@ if test "$no_recursion" != yes; then test -d "$srcdir/$ac_dir" || continue ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)" - $as_echo "$as_me:${as_lineno-$LINENO}: $ac_msg" >&5 - $as_echo "$ac_msg" >&6 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_msg" >&5 + printf "%s\n" "$ac_msg" >&6 as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -5385,17 +5656,15 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" - # Check for guested configure; otherwise get Cygnus style configure. + # Check for configure.gnu first; this name is used for a wrapper for + # Metaconfig's "Configure" on case-insensitive file systems. if test -f "$ac_srcdir/configure.gnu"; then ac_sub_configure=$ac_srcdir/configure.gnu elif test -f "$ac_srcdir/configure"; then ac_sub_configure=$ac_srcdir/configure - elif test -f "$ac_srcdir/configure.in"; then - # This should be Cygnus configure. - ac_sub_configure=$ac_aux_dir/configure else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no configuration information is in $ac_dir" >&5 -$as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: no configuration information is in $ac_dir" >&5 +printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} ac_sub_configure= fi @@ -5408,8 +5677,8 @@ $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} ac_sub_cache_file=$ac_top_build_prefix$cache_file ;; esac - { $as_echo "$as_me:${as_lineno-$LINENO}: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 -$as_echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 +printf "%s\n" "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} # The eval makes quoting arguments work. eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \ --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" || @@ -5420,7 +5689,8 @@ $as_echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cach done fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi + diff --git a/configure.ac b/configure.ac index d7dfb89..afcb9be 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,8 @@ # Process this file with autoconf to produce a configure script. -AC_INIT(rJava, 0.8, Simon.Urbanek@r-project.org) +AC_INIT([rJava],[0.8],[Simon.Urbanek@r-project.org]) AC_CONFIG_SRCDIR([src/rJava.c]) -AC_CONFIG_HEADER([src/config.h]) +AC_CONFIG_HEADERS([src/config.h]) +AC_CONFIG_AUX_DIR([tools]) # find R home and set CC/CFLAGS : ${R_HOME=`R RHOME`} @@ -23,8 +24,7 @@ fi ## enable threads, i.e. Java is running is a separate thread AC_ARG_ENABLE([threads], -[AC_HELP_STRING([--enable-threads], - [enable the use of threads, i.e. Java is run on a separate thread. +[AS_HELP_STRING([--enable-threads],[enable the use of threads, i.e. Java is run on a separate thread. This is necessary for some implementations of AWT. This feature is highly experimental, becasue of synchronization issues, so use with care. @<:@no@:>@])], @@ -33,8 +33,7 @@ AC_ARG_ENABLE([threads], ## enable JNI-cache AC_ARG_ENABLE([jni-cache], -[AC_HELP_STRING([--enable-jni-cache], - [enable support for caching of the JNI environment. With this +[AS_HELP_STRING([--enable-jni-cache],[enable support for caching of the JNI environment. With this option turned on, the JNI state is stored locally and re-used for subsequent calls. This will work *only* if no threads are used, because each thread has a separate JNI state. Enabling @@ -46,71 +45,71 @@ AC_ARG_ENABLE([jni-cache], ## enable JRI AC_ARG_ENABLE([jri], -[AC_HELP_STRING([--enable-jri], - [enable Java to R interface (JRI), which allows Java programs +[AS_HELP_STRING([--enable-jri],[enable Java to R interface (JRI), which allows Java programs to embed R. @<:@auto@:>@])], [want_jri="${enableval}"], [want_jri=auto]) ## enable headless AC_ARG_ENABLE([headless], -[AC_HELP_STRING([--enable-headless], - [enable initialization in headless mode. @<:@auto@:>@])], +[AS_HELP_STRING([--enable-headless],[enable initialization in headless mode. @<:@auto@:>@])], [want_headless="${enableval}"], [want_headless=auto]) ## enable -Xrs support AC_ARG_ENABLE([Xrs], -[AC_HELP_STRING([--enable-Xrs], - [use -Xrs in Java initialization. @<:@auto@:>@])], +[AS_HELP_STRING([--enable-Xrs],[use -Xrs in Java initialization. @<:@auto@:>@])], [want_xrs="${enableval}"], [want_xrs=auto]) +## enable dynloaded JVM +AC_ARG_ENABLE([dynload], +[AS_HELP_STRING([--enable-dynload],[load JVM dynamically (without linking). @<:@auto@:>@])], +[want_dynload="${enableval}"], +[want_dynload=auto]) + ## enable debug flags AC_ARG_ENABLE([debug], -[AC_HELP_STRING([--enable-debug], - [enable debug flags and output. @<:@no@:>@])], +[AS_HELP_STRING([--enable-debug],[enable debug flags and output. @<:@no@:>@])], [want_debug="${enableval}"], [want_debug=no]) ## enable memory profiling AC_ARG_ENABLE([mem-profile], -[AC_HELP_STRING([--enable-mem-profile], - [enable memory profiling. @<:@debug@:>@])], +[AS_HELP_STRING([--enable-mem-profile],[enable memory profiling. @<:@debug@:>@])], [want_memprof="${enableval}"], [want_memprof=debug]) ## enable callbacks (experimental) AC_ARG_ENABLE([callbacks], -[AC_HELP_STRING([--enable-callbacks], - [enable the support for callbacks from Java into R. This requires JRI and is currently experimental/incomplete. @<:@no@:>@])], +[AS_HELP_STRING([--enable-callbacks],[enable the support for callbacks from Java into R. This requires JRI and is currently experimental/incomplete. @<:@no@:>@])], [want_callbacks="${enableval}"], [want_callbacks=no]) # Checks for programs. +AC_LANG(C) AC_PROG_CC # Checks for libraries. # Checks for header files. -AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS([string.h sys/time.h unistd.h]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST -AC_HEADER_TIME -AC_CHECKING([whether ${CC} supports static inline]) +AS_MESSAGE([checking whether ${CC} supports static inline...]) can_inline=no -AC_COMPILE_IFELSE([AC_LANG_SOURCE([ +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ static inline int foo(int a, int b); -static f = 1; +static int f = 1; static inline int foo(int a, int b) { return a+b; } int main(void) { return foo(f,-1); -}])],can_inline=yes) +} +]])],[can_inline=yes]) AC_MSG_RESULT(${can_inline}) if test "${can_inline}" = yes; then AC_DEFINE(HAVE_STATIC_INLINE, 1, [Define to 1 when static inline works]) @@ -176,7 +175,7 @@ if test -z "${JAVAC}"; then fi have_all_flags=no -if test -n "${JAVA}" && test -n "${JAVAC}" && test -n "${JAVAH}" && \ +if test -n "${JAVA}" && test -n "${JAVAC}" && \ test -n "${JAVA_CPPFLAGS}" && test -n "${JAVA_LIBS}" && test -n "${JAR}"; then have_all_flags=yes; fi @@ -215,7 +214,7 @@ if test "x$OSNAME" = xDarwin; then fi AC_MSG_CHECKING([whether Java run-time works]) -if "$JAVA" -classpath . getsp; then +if "$JAVA" -classpath tools getsp; then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) @@ -225,7 +224,7 @@ fi has_xrs="$want_xrs" if test x"$has_xrs" = xauto; then AC_MSG_CHECKING([whether -Xrs is supported]) - if "$JAVA" -Xrs -classpath . getsp; then + if "$JAVA" -Xrs -classpath tools getsp; then has_xrs=yes else has_xrs=no @@ -235,36 +234,61 @@ fi AC_MSG_CHECKING([whether -Xrs will be used]) AC_MSG_RESULT(${has_xrs}) -if test "$has_xrs" = xyes; then +if test x"$has_xrs" = xyes; then AC_DEFINE(HAVE_XRS, 1, [Set if the Java parameter -Xrs is supported]) fi +use_dynload="$want_dynload" +if test x"$use_dynload" = xauto; then + if test "x$OSNAME" = xDarwin; then + use_dynload=yes + else + use_dynload=no + fi +fi +if test x"$use_dynload" != xyes; then + use_dynload=no +fi +AC_MSG_CHECKING([whether JVM will be loaded dynamically]) +AC_MSG_RESULT(${use_dynload}) +AM_CONDITIONAL(USE_DYNLOAD, [test "x${use_dynload}" = xyes]) + AC_MSG_CHECKING([whether JNI programs can be compiled]) -AC_LINK_IFELSE([AC_LANG_SOURCE([ +AC_LINK_IFELSE([AC_LANG_SOURCE([[ #include int main(void) { jobject o; JNI_CreateJavaVM(0, 0, 0); return 0; } - ])],[AC_MSG_RESULT(yes)], + ]])],[AC_MSG_RESULT(yes)], [AC_MSG_ERROR([Cannot compile a simple JNI program. See config.log for details. Make sure you have Java Development Kit installed and correctly registered in R. If in doubt, re-run "R CMD javareconf" as root. ])]) +AC_MSG_CHECKING([whether JNI programs run]) +AC_RUN_IFELSE([AC_LANG_SOURCE([ +#include +int main(void) { + jsize n; + JNI_GetCreatedJavaVMs(NULL, 0, &n); + return 0; +} + ])], + [AC_MSG_RESULT([yes])], + [AC_MSG_ERROR([Unable to run a simple JNI program. Make sure you have configured R with Java support (see R documentation) and check config.log for failure reason.])], + [AC_MSG_RESULT([don't know (cross-compiling)])]) + AC_MSG_CHECKING([JNI data types]) -AC_TRY_RUN( - [ +AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include int main(void) { return (sizeof(int)==sizeof(jint) && sizeof(long)==sizeof(long) && sizeof(jbyte)==sizeof(char) && sizeof(jshort)==sizeof(short) && sizeof(jfloat)==sizeof(float) && sizeof(jdouble)==sizeof(double))?0:1; } - ], - [AC_MSG_RESULT([ok])], - [AC_MSG_ERROR([One or more JNI types differ from the corresponding native type. You may need to use non-standard compiler flags or a different compiler in order to fix this.])], - [AC_MSG_RESULT([don't know (cross-compiling)])]) + ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([One or more JNI types differ from the corresponding native type. You may need to use non-standard compiler flags or a different compiler in order to fix this.])],[]) + if test "${want_jri}" = auto; then AC_MSG_CHECKING([whether JRI should be compiled (autodetect)]) @@ -358,7 +382,7 @@ if test "${want_jri}" = yes; then export JAVA_HOME JAVA_CPPFLAGS JAVA_LIBS JAVA_LD_LIBRARY_PATH JAVA JAVAC JAVAH JAR CONFIGURED=1 export CONFIGURED - AC_CONFIG_SUBDIRS(jri) + AC_CONFIG_SUBDIRS(src/jri) else AC_MSG_RESULT([no]) fi diff --git a/configure.win b/configure.win index cd1b09a..f72c921 100644 --- a/configure.win +++ b/configure.win @@ -50,7 +50,7 @@ if [ -e jri/configure.win ]; then cp -r jri/run.bat jri/src/jri.dll jri/src/JRI.jar jri/examples inst/jri/ else echo "**** WARNING: JRI could NOT be built" >&2 - if [ -z "$INGORE" ]; then + if [ -z "$IGNORE" ]; then echo "Set IGNORE=1 if you want to build rJava anyway." exit 1 fi diff --git a/jri/REngine b/jri/REngine deleted file mode 160000 index 7181bbc..0000000 --- a/jri/REngine +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7181bbc28b1feb73fb8c891a55028ee03ade371f diff --git a/jri/src/Makefile.all b/jri/src/Makefile.all deleted file mode 100644 index 3e9c66f..0000000 --- a/jri/src/Makefile.all +++ /dev/null @@ -1,50 +0,0 @@ -# JRI - Java/R Interface experimental! -#-------------------------------------------------------------------------- - -JRI_JSRC=$(wildcard ../*.java) -TARGETS=$(JNIPREFIX)jri$(JNISO) JRI.jar - -# we need to force JDK 1.4 for compatibility (or 1.6 for J9) -JFLAGS+=-target 1.6 -source 1.6 - -all: $(TARGETS) - -JRI.jar: $(JRI_JSRC) $(JNIPREFIX)jri$(JNISO) - $(JAVAC) $(JFLAGS) -d . $(JRI_JSRC) - $(JAR) fc $@ org $(JNIPREFIX)jri$(JNISO) - -org_rosuda_JRI_Rengine.h: org/rosuda/JRI/Rengine.class - $(JAVAH) -d . -classpath . org.rosuda.JRI.Rengine - -Rcallbacks.o: Rcallbacks.c Rcallbacks.h globals.h org_rosuda_JRI_Rengine.h - $(CC) -c -o $@ $< $(CFLAGS) $(CPICF) $(JAVAINC) $(RINC) - -Rinit.o: Rinit.c Rinit.h Rcallbacks.h - $(CC) -c -o $@ $< $(CFLAGS) $(CPICF) $(RINC) - -globals.o: globals.c globals.h - $(CC) -c -o $@ $< $(CFLAGS) $(CPICF) $(JAVAINC) - -rjava.o: rjava.c rjava.h - $(CC) -c -o $@ $< $(CFLAGS) $(CPICF) $(JAVAINC) - -Rengine.o: Rengine.c org_rosuda_JRI_Rengine.h globals.h Rcallbacks.h Rinit.h - $(CC) -c -o $@ Rengine.c $(CFLAGS) $(CPICF) $(JAVAINC) $(RINC) - -jri.o: jri.c - $(CC) -c -o $@ jri.c $(CFLAGS) $(CPICF) $(JAVAINC) $(RINC) - -$(JNIPREFIX)jri$(JNISO): Rengine.o jri.o Rcallbacks.o Rinit.o globals.o rjava.o $(JRIDEPS) - $(CC) -o $@ $^ $(LDFLAGS) $(JNILD) $(RLD) - -win32/libjvm.dll.a: - make -C win32 libjvm.dll.a - -org/rosuda/JRI/Rengine.class org/rosuda/JRI/REXP.class org/rosuda/JRI/Mutex.class: $(JRI_JSRC) - $(JAVAC) $(JFLAGS) -d . $^ - -clean: - rm -rf $(TARGETS) org *.o *~ org_rosuda_JRI_Rengine.h *$(JNISO) *.class *~ - -.PHONY: clean all - diff --git a/jri/src/Rdecl.h b/jri/src/Rdecl.h deleted file mode 100644 index 48910f2..0000000 --- a/jri/src/Rdecl.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef __RDECL_H__ -#define __RDECL_H__ - -/* declarations from R internals or other include files */ -/* last update: R 2.4.0 */ - -void run_Rmainloop(void); /* main/main.c */ -int R_ReadConsole(char*, unsigned char*, int, int); /* include/Defn.h */ -void Rf_checkArity(SEXP, SEXP); /* include/Defn.h */ -int Rf_initialize_R(int ac, char **av); /* include/Rembedded.h */ - -#endif diff --git a/jri/src/config.h.in b/jri/src/config.h.in deleted file mode 100644 index 260ad1d..0000000 --- a/jri/src/config.h.in +++ /dev/null @@ -1,19 +0,0 @@ -/* src/config.h.in. Generated from configure.ac by autoheader. */ - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS diff --git a/jri/src/rjava.c b/jri/src/rjava.c deleted file mode 100644 index c66f52f..0000000 --- a/jri/src/rjava.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "rjava.h" -#include - -#ifdef _WIN64 -typedef long long ptrlong; -#else -typedef long ptrlong; -#endif - -int ipcout; -int resin; -int *rjctrl = 0; - -typedef void(callbackfn)(void *); - -int RJava_request_lock() { - ptrlong buf[4]; - int n; - if (rjctrl && *rjctrl) return 2; - - buf[0] = IPCC_LOCK_REQUEST; - write(ipcout, buf, sizeof(ptrlong)); - n = read(resin, buf, sizeof(ptrlong)); - return (n > 0 && buf[0] == IPCC_LOCK_GRANTED) ? 1 : 0; -} - -int RJava_clear_lock() { - ptrlong buf[4]; - buf[0] = IPCC_CLEAR_LOCK; - write(ipcout, buf, sizeof(ptrlong)); - return 1; -} - -void RJava_request_callback(callbackfn *fn, void *data) { - ptrlong buf[4]; - buf[0] = IPCC_CALL_REQUEST; - buf[1] = (ptrlong) fn; - buf[2] = (ptrlong) data; - write(ipcout, buf, sizeof(ptrlong) * 3); -} - -void RJava_setup(int _in, int _out) { - /* ptrlong buf[4]; */ - ipcout = _out; - resin = _in; -} - -void RJava_init_ctrl() { - ptrlong buf[4]; - buf[0] = IPCC_CONTROL_ADDR; - write(ipcout, buf, sizeof(ptrlong)); - read(resin, buf, sizeof(ptrlong) * 2); - if (buf[0] == IPCC_CONTROL_ADDR) { - rjctrl= (int*) buf[1]; - } -} diff --git a/jri/tools/config.sub b/jri/tools/config.sub deleted file mode 100755 index 9633db7..0000000 --- a/jri/tools/config.sub +++ /dev/null @@ -1,1791 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright 1992-2013 Free Software Foundation, Inc. - -timestamp='2013-08-10' - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, see . -# -# 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. This Exception is an additional permission under section 7 -# of the GNU General Public License, version 3 ("GPLv3"). - - -# Please send patches with a ChangeLog entry to config-patches@gnu.org. -# -# 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. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS - -Canonicalize a configuration name. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.sub ($timestamp) - -Copyright 1992-2013 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." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo $1 - exit ;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# 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* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-musl* | 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/'` - ;; - android-linux) - os=-linux-android - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -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 | -knuth | -cray | -microblaze*) - os= - basic_machine=$1 - ;; - -bluegene*) - os=-cnk - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - 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/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # 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/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*178) - os=-lynxos178 - ;; - -lynx*5) - os=-lynxos5 - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | aarch64 | aarch64_be \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ - | arc | arceb \ - | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ - | avr | avr32 \ - | be32 | be64 \ - | bfin \ - | c4x | c8051 | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | epiphany \ - | fido | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | hexagon \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ - | le32 | le64 \ - | lm32 \ - | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | microblazeel | 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 \ - | mipsr5900 | mipsr5900el \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | moxie \ - | mt \ - | msp430 \ - | nds32 | nds32le | nds32be \ - | nios | nios2 | nios2eb | nios2el \ - | ns16k | ns32k \ - | open8 \ - | or1k | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle \ - | pyramid \ - | rl78 | 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 | v850e1 | v850e2 | v850es | v850e2v3 \ - | we32k \ - | x86 | xc16x | xstormy16 | xtensa \ - | z8k | z80) - basic_machine=$basic_machine-unknown - ;; - c54x) - basic_machine=tic54x-unknown - ;; - c55x) - basic_machine=tic55x-unknown - ;; - c6x) - basic_machine=tic6x-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - ms1) - basic_machine=mt-unknown - ;; - - strongarm | thumb | xscale) - basic_machine=arm-unknown - ;; - xgate) - basic_machine=$basic_machine-unknown - os=-none - ;; - xscaleeb) - basic_machine=armeb-unknown - ;; - - xscaleel) - basic_machine=armel-unknown - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | aarch64-* | aarch64_be-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* | avr32-* \ - | be32-* | be64-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | c8051-* | 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-* \ - | hexagon-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ - | le32-* | le64-* \ - | lm32-* \ - | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ - | microblaze-* | microblazeel-* \ - | 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-* \ - | mipsr5900-* | mipsr5900el-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | mt-* \ - | msp430-* \ - | nds32-* | nds32le-* | nds32be-* \ - | nios-* | nios2-* | nios2eb-* | nios2el-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | open8-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ - | pyramid-* \ - | rl78-* | 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*-* \ - | tron-* \ - | ubicom32-* \ - | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ - | 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. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - 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 - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aros) - basic_machine=i386-pc - os=-aros - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - 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 - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; - 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 - ;; - delta88) - 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 - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - 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 - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - microblaze*) - basic_machine=microblaze-xilinx - ;; - mingw64) - basic_machine=x86_64-pc - os=-mingw64 - ;; - mingw32) - basic_machine=i686-pc - os=-mingw32 - ;; - mingw32ce) - basic_machine=arm-unknown - os=-mingw32ce - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - 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-/'` - ;; - msys) - basic_machine=i686-pc - os=-msys - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - nacl) - basic_machine=le32-unknown - os=-nacl - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - neo-tandem) - basic_machine=neo-tandem - ;; - nse-tandem) - basic_machine=nse-tandem - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - 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 - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - 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-*) - basic_machine=ns32k-pc532 - ;; - 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 | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - 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-* | 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 | 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 - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rdos | rdos64) - basic_machine=x86_64-pc - os=-rdos - ;; - rdos32) - basic_machine=i386-pc - os=-rdos - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - 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 - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sh5el) - basic_machine=sh5le-unknown - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - strongarm-* | thumb-*) - basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - tile*) - basic_machine=$basic_machine-unknown - os=-linux-gnu - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - 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 - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - xbox) - basic_machine=i686-pc - os=-mingw32 - ;; - 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 - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - mmix) - basic_machine=mmix-knuth - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # 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|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # 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* | -cnk* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ - | -sym* | -kopensolaris* | -plan9* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -bitrig* | -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* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ - | -linux-newlib* | -linux-musl* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -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*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto-qnx*) - ;; - -nto*) - os=`echo $os | sed -e 's|nto|nto-qnx|'` - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -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|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -os400*) - os=-os400 - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -atheos*) - os=-atheos - ;; - -syllable*) - os=-syllable - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -nova*) - os=-rtmk-nova - ;; - -ns2 ) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -tpf*) - os=-tpf - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -aros*) - os=-aros - ;; - -zvmoe) - os=-zvmoe - ;; - -dicos*) - os=-dicos - ;; - -nacl*) - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - score-*) - os=-elf - ;; - spu-*) - os=-elf - ;; - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - c4x-* | tic4x-*) - os=-coff - ;; - c8051-*) - os=-elf - ;; - hexagon-*) - os=-elf - ;; - tic54x-*) - os=-coff - ;; - tic55x-*) - os=-coff - ;; - tic6x-*) - os=-coff - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - ;; - m68*-cisco) - os=-aout - ;; - mep-*) - os=-elf - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - or1k-*) - os=-elf - ;; - or32-*) - os=-coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-haiku) - os=-haiku - ;; - *-ibm) - os=-aix - ;; - *-knuth) - os=-mmixware - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -cnk*|-aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -os400*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -tpf*) - vendor=ibm - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*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 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/jri/tools/getsp.class b/jri/tools/getsp.class deleted file mode 100644 index 76e0581..0000000 Binary files a/jri/tools/getsp.class and /dev/null differ diff --git a/jri/tools/mkinstalldirs b/jri/tools/mkinstalldirs deleted file mode 100755 index 8ab885e..0000000 --- a/jri/tools/mkinstalldirs +++ /dev/null @@ -1,99 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman -# Created: 1993-05-16 -# Public domain - -errstatus=0 -dirmode="" - -usage="\ -Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." - -# process command line arguments -while test $# -gt 0 ; do - case "${1}" in - -h | --help | --h* ) # -h for help - echo "${usage}" 1>&2; exit 0 ;; - -m ) # -m PERM arg - shift - test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } - dirmode="${1}" - shift ;; - -- ) shift; break ;; # stop option processing - -* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option - * ) break ;; # first non-opt arg - esac -done - -for file -do - if test -d "$file"; then - shift - else - break - fi -done - -case $# in -0) exit 0 ;; -esac - -case $dirmode in -'') - if mkdir -p -- . 2>/dev/null; then - echo "mkdir -p -- $*" - exec mkdir -p -- "$@" - fi ;; -*) - if mkdir -m "$dirmode" -p -- . 2>/dev/null; then - echo "mkdir -m $dirmode -p -- $*" - exec mkdir -m "$dirmode" -p -- "$@" - fi ;; -esac - -for file -do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift - - pathcomp= - for d - do - pathcomp="$pathcomp$d" - case "$pathcomp" in - -* ) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" - - mkdir "$pathcomp" || lasterr=$? - - if test ! -d "$pathcomp"; then - errstatus=$lasterr - else - if test ! -z "$dirmode"; then - echo "chmod $dirmode $pathcomp" - - lasterr="" - chmod "$dirmode" "$pathcomp" || lasterr=$? - - if test ! -z "$lasterr"; then - errstatus=$lasterr - fi - fi - fi - fi - - pathcomp="$pathcomp/" - done -done - -exit $errstatus - -# Local Variables: -# mode: shell-script -# sh-indentation: 3 -# End: -# mkinstalldirs ends here diff --git a/man/J.Rd b/man/J.Rd index fa5a3e2..413c891 100644 --- a/man/J.Rd +++ b/man/J.Rd @@ -7,7 +7,7 @@ High level API for accessing Java \code{J} creates a Java class reference or calls a Java method } \usage{ -J(class, method, ...) +J(class, method, ..., class.loader=.rJava.class.loader) } \arguments{ \item{class}{ @@ -23,6 +23,8 @@ J(class, method, ...) optional parameters that will be passed to the method (if the \code{method} argument is present) } + \item{class.loader}{optional, custom loader to use if a class look-up + is necessary (i.e., if \code{class} is a string)} } \details{ \code{J} is the high-level access to Java. diff --git a/man/accessOp.Rd b/man/accessOp.Rd index a51155d..524f2e7 100644 --- a/man/accessOp.Rd +++ b/man/accessOp.Rd @@ -41,14 +41,14 @@ } } \details{ - rJava provies two levels of API: low-level JNI-API in the form of \code{\link{.jcall}} function and high-level reflection API based on the \code{$} operator. The former is very fast, but inflexible. The latter is a convenient way to use Java-like programming at the cost of performance. The reflection API is build around the \code{$} operator on \code{\link{jobjRef-class}} objects that allows to access Java attributes and call object methods. + rJava provides two levels of API: low-level JNI-API in the form of \code{\link{.jcall}} function and high-level reflection API based on the \code{$} operator. The former is very fast, but inflexible. The latter is a convenient way to use Java-like programming at the cost of performance. The reflection API is build around the \code{$} operator on \code{\link{jobjRef-class}} objects that allows to access Java attributes and call object methods. \code{$} returns either the value of the attribute or calls a method, depending on which name matches first. \code{$<-} assigns a value to the corresponding Java attribute. - \code{names} and \code{.DollarNames} returns all fields and methods associated with the object. - Method names are followed by \code{(} or \code{()} depending on arity. + \code{names} and \code{.DollarNames} returns all fields and methods associated with the object. + Method names are followed by \code{(} or \code{()} depending on arity. This use of names is mainly useful for code completion, it is not intended to be used programmatically. This is just a convenience API. Internally all calls are mapped into \code{\link{.jcall}} calls, therefore the calling conventions and returning objects use the same rules. For time-critical Java calls \code{\link{.jcall}} should be used directly. @@ -66,7 +66,7 @@ names(v) \dontshow{ stopifnot( v$length() == 12L ) -stopifnot( v$indexOf("World") == 6L ) +stopifnot( v$indexOf("World") == 6L ) } J("java.lang.String")$valueOf(10) @@ -74,7 +74,7 @@ J("java.lang.String")$valueOf(10) Double <- J("java.lang.Double") # the class pseudo field - instance of Class for the associated class # similar to java Double.class -Double$class +Double$class \dontshow{ stopifnot( Double$class$getName() == "java.lang.Double" ) } diff --git a/man/jarray.Rd b/man/jarray.Rd index ac531b4..21af8c1 100644 --- a/man/jarray.Rd +++ b/man/jarray.Rd @@ -21,16 +21,16 @@ \item{contents.class}{common class of the contained objects, see details} \item{obj}{Java object reference to an array that is to be evaluated} - \item{rawJNIRefSignature}{JNI signature that whould be used for + \item{rawJNIRefSignature}{JNI signature that would be used for conversion. If set to \code{NULL}, the signature is detected automatically.} \item{silent}{if set to true, warnings are suppressed} - \item{dispatch}{logical. If \code{TRUE} the code attemps to dispatch + \item{dispatch}{logical. If \code{TRUE} the code attempts to dispatch to either a \code{jarrayRef} object for rugged arrays and \code{jrectRef} objects for rectangular arrays, creating possibly a multi-dimensional object in Java (e.g., when used with a matrix).} \item{simplify}{if set to \code{TRUE} more than two-dimensional arrays - are converted to native obejcts (e.g., matrices) if their type and + are converted to native objects (e.g., matrices) if their type and size matches (essentially the inverse for objects created with \code{dispatch=TRUE}).} } @@ -68,7 +68,7 @@ \code{.jevalArray} currently supports only a subset of all possible array types. Recursive arrays are handled by returning a list of references which can then be evaluated separately. The only exception - is \code{simplify=TRUE} in which case \code{.jevalArray} arrempts to + is \code{simplify=TRUE} in which case \code{.jevalArray} attempts to convert multi-dimensional arrays into native R type if there is a such. This only works for rectangular arrays of the same basic type (i.e. the length and type of each referenced array is the same - diff --git a/man/java-tools.Rd b/man/java-tools.Rd index 925c883..1d12216 100644 --- a/man/java-tools.Rd +++ b/man/java-tools.Rd @@ -13,9 +13,9 @@ J("RectangularArrayBuilder_Test")$runtests() p <- .jnew( "java/awt/Point" ) - classes <- .Call( "RgetSimpleClassNames", p@jobj, TRUE, PACKAGE = "rJava" ) + classes <- .Call( rJava:::RgetSimpleClassNames, p@jobj, TRUE ) stopifnot( all( c( "Point", "Point2D", "Object", "error", "condition" ) \%in\% classes ) ) - classes <- .Call( "RgetSimpleClassNames", p@jobj, FALSE, PACKAGE = "rJava" ) + classes <- .Call( rJava:::RgetSimpleClassNames, p@jobj, FALSE ) stopifnot( all( c( "Point", "Point2D", "Object" ) \%in\% classes ) ) } diff --git a/man/javaImport.Rd b/man/javaImport.Rd index cdee869..08653f3 100644 --- a/man/javaImport.Rd +++ b/man/javaImport.Rd @@ -19,7 +19,7 @@ An external pointer to a java specific \code{UserDefinedDatabase} object } \references{ \emph{User-Defined Tables in the R Search Path}. Duncan Temple Lang. December 4, 2001 - \url{http://www.omegahat.org/RObjectTables/} + \url{https://www.omegahat.net/RObjectTables/} } \author{ Romain Francois diff --git a/man/jcall.Rd b/man/jcall.Rd index b8e801b..4f311b7 100644 --- a/man/jcall.Rd +++ b/man/jcall.Rd @@ -7,8 +7,8 @@ \code{.jcall} calls a Java method with the supplied arguments. } \usage{ -.jcall(obj, returnSig = "V", method, ..., evalArray = TRUE, - evalString = TRUE, check = TRUE, interface = "RcallMethod", +.jcall(obj, returnSig = "V", method, ..., evalArray = TRUE, + evalString = TRUE, check = TRUE, interface = "RcallMethod", simplify = FALSE, use.true.class = FALSE) } \arguments{ @@ -22,7 +22,7 @@ type \code{short}.} \item{method}{The name of the method to be called} \item{...}{ - Any parametes that will be passed to the Java method. The parameter + Any parameters that will be passed to the Java method. The parameter types are determined automatically and/or taken from the \code{jobjRef} object. All named parameters are discarded.} \item{evalArray}{This flag determines whether the array return value @@ -35,22 +35,22 @@ \item{check}{If set to \code{TRUE} then checks for exceptions are performed before and after the call using \code{\link{.jcheck}(silent=FALSE)}. This is usually the desired - behavior, because all calls fail until an expection is cleared.} + behavior, because all calls fail until an exception is cleared.} \item{interface}{This option is experimental and specifies the interface used for calling the Java method; the current implementation supports two interfaces: - \itemize{ + \describe{ \item{\code{"RcallMethod"}}{the default interface.} \item{\code{"RcallSyncMethod"}}{synchronized call of a - method. This has simmilar effect as using \code{synchronize} in + method. This has similar effect as using \code{synchronize} in Java.} } } \item{use.true.class}{logical. If set to \code{TRUE}, the true class - of the returned object will be used instead of the declared signature. - \code{TRUE} allows for example to grab the actual class of an object when - the return type is an interface, or allows to grab an array when the - declared type is Object and the returned object is an array. Use \code{FALSE} + of the returned object will be used instead of the declared signature. + \code{TRUE} allows for example to grab the actual class of an object when + the return type is an interface, or allows to grab an array when the + declared type is Object and the returned object is an array. Use \code{FALSE} for efficiency when you are sure about the return type. } } \value{ @@ -88,7 +88,7 @@ memory usage), but 3rd party code may not (e.g. older packages). Also rJava relies on correct encoding flags for strings passed to it and will attempt to perform conversions where - necessary. If some 3rd party code produces strings incorreclty + necessary. If some 3rd party code produces strings incorrectly flagged, all bets are off. Finally, for performance reasons class, method and field names as diff --git a/man/jcastToArray.Rd b/man/jcastToArray.Rd index d3543bd..75181ad 100644 --- a/man/jcastToArray.Rd +++ b/man/jcastToArray.Rd @@ -29,17 +29,17 @@ } \details{ Sometimes a result of a method is by definition of the class - \code{java.lang.Object}, but the acutal referenced object may be an + \code{java.lang.Object}, but the actual referenced object may be an array. In that case the method returns a Java object reference instead of an array reference. In order to obtain an array reference, it is necessary to cast such an object to an array reference - this is done using the above \code{.jcastToArray} function. - The input is an object reference that points to an array. Ususally the + The input is an object reference that points to an array. Usually the signature should be left at \code{NULL} such that it is determined from the object's class. This is also a check, because if the object's class is not an array, then the functions fails either with an error - (when \code{quiet=FALSE}) or by returing the original object (when + (when \code{quiet=FALSE}) or by returning the original object (when \code{quiet=TRUE}). If the signature is set to anything else, it is not verified and the array reference is always created, even if it may be invalid and unusable. diff --git a/man/jcheck.Rd b/man/jcheck.Rd index d9f6efc..f52c1ed 100644 --- a/man/jcheck.Rd +++ b/man/jcheck.Rd @@ -12,7 +12,7 @@ \code{.jthrow} throws a Java exception. - \code{.jgetEx} polls for any pending expections and returns the exception object. + \code{.jgetEx} polls for any pending exceptions and returns the exception object. \code{.jclear} clears a pending exception. } @@ -29,7 +29,7 @@ \code{stderr} so it will not appear there (as of rJava 0.5-1 some errors that the JVM prints using the vfprintf callback are passed to R. However, some parts are printed using \code{System.err} in - which case the ususal redirection using the \code{System} class + which case the usual redirection using the \code{System} class can be used by the user).} \item{exception}{is either a class name of an exception to create or a throwable object reference that is to be thrown.} @@ -54,9 +54,9 @@ instructed to not do so. If you want to handle Java exceptions, you should make sure that those function don't clear the exception you may want to catch. - + The exception handling is still as a very low-level and experimental, - because it requires polling of exceptions. A more elaboate system + because it requires polling of exceptions. A more elaborate system using constructs similar to \code{try} ... \code{catch} is planned for next major version of \code{rJava}. diff --git a/man/jfield.Rd b/man/jfield.Rd index 46438c8..10eab25 100644 --- a/man/jfield.Rd +++ b/man/jfield.Rd @@ -2,7 +2,7 @@ \alias{.jfield} \alias{.jfield<-} \title{ - Obtains the value of a field + Obtains the value of a field } \description{ \code{.jfield} returns the value of the specified field on an object. @@ -21,7 +21,7 @@ the reflection lookup is quite expensive.} \item{name}{name of the field to access} \item{true.class}{by default the class of the resulting object matches - the siganture of the field. Setting this flag to \code{TRUE} causes + the signature of the field. Setting this flag to \code{TRUE} causes \code{.jfield} to use true class name of the resulting object instead. (this flag has no effect on scalar fields)} \item{convert}{when set to \code{TRUE} all references are converted to diff --git a/man/jfloat.Rd b/man/jfloat.Rd index 378918d..42e9f8f 100644 --- a/man/jfloat.Rd +++ b/man/jfloat.Rd @@ -15,7 +15,9 @@ \description{ \code{.jfloat} marks a numeric vector as an object that can be used as parameter to Java calls that require \code{float} parameters. - Similarly, \code{.jlong} marks a numeric vector as \code{long} parameter. + Similarly, \code{.jlong} marks a numeric vector as \code{long} + parameter, \code{.jshort} as \code{short} and \code{.jbyte} as + \code{byte}. } \usage{ .jfloat(x) @@ -47,12 +49,19 @@ has no native type that will hold a \code{long} value, so conversion between Java's \code{long} type and R's numeric is potentially lossy. - \code{.jbyte} is used when a scalar byte is to be passed ot Java. Note - that byte arrays are natively passed as RAW vectors, not as - \code{.jbyte} arrays. - - \code{jchar} is strictly experimental and may be based on - \code{character} vectors in the future. + \code{.jbyte} is used when a scalar byte is to be passed to Java. Note + that byte arrays are natively passed as raw vectors, not as + \code{.jbyte} arrays, although non-scalar \code{.jbyte} is equivalent + except for using four-times as much memory. + + \code{.jchar} is strictly experimental and uses integer vector as + storage class. The type \code{char} in Java + represents 16-bit Unicode code points (not to be confused with + \code{char} in C which is \code{byte} in Java!), see Java + documentation for details. \code{x} can also be a non-\code{NA} string + in which case \code{.jchar(x)} is just a shorthand for + \code{.jnew("java.lang.String", x)$toCharArray()} and thus performs a + Java call (unlike all other functions mentioned here). } \seealso{ \code{\link{.jcall}}, \code{\link{jfloat-class}} diff --git a/man/jgc.Rd b/man/jgc.Rd new file mode 100644 index 0000000..15eb225 --- /dev/null +++ b/man/jgc.Rd @@ -0,0 +1,25 @@ +\name{.jgc} +\alias{.jgc} +\title{ + Invoke Java Garbage Collection +} +\description{ + \code{.jgc} invokes the R and Java garbage collectors. +} +\usage{ +.jgc(R.gc = TRUE, ...) +} +\arguments{ + \item{R.gc}{logical, if \code{TRUE} then \code{gc(\dots)} is called + first, if \code{FALSE} only Java garbage collector is called} + \item{\dots}{any additional parameters passed to \code{gc()}} +} +\details{ + \code{.jgc} invokes the R garbage collector (unless + \code{R.gc=FALSE}) which removes any unused Java references and then + invokes the Java garbage collector to reclaim Java heap space. +} +\author{ +Simon Urbanek +} +\keyword{interface} diff --git a/man/jinit.Rd b/man/jinit.Rd index 075f521..4f9d88d 100644 --- a/man/jinit.Rd +++ b/man/jinit.Rd @@ -1,15 +1,19 @@ \name{jinit} \alias{.jinit} +\alias{.jvmState} \title{ Initialize Java VM } \description{ \code{.jinit} initializes the Java Virtual Machine (JVM). This function must be called before any rJava functions can be used. + + \code{.jvmState() returns the state of the current JVM.} } \usage{ -.jinit(classpath = NULL, parameters = getOption("java.parameters"), ..., -silent = FALSE, force.init = FALSE) +.jinit(classpath = NULL, parameters = getOption("java.parameters", NA), ..., + silent = FALSE, force.init = FALSE) +.jvmState() } \arguments{ \item{classpath}{Any additional classes to include in the Java class @@ -21,7 +25,10 @@ silent = FALSE, force.init = FALSE) the virtual machine. They are implementation dependent and apply to JDK version 1.2 or higher only. Please note that each parameter must be in a separate element of the array, you cannot use a - space-separated string with multiple parameters.} + space-separated string with multiple parameters. The value of + \code{NA} means "use rJava default" which is \code{"-Xmx1g"} + currently. \code{NULL} is equivalent to \code{character()}. + } \item{...}{Other optional Java initialization parameters (implementation-dependent).} \item{silent}{If set to \code{TRUE} no warnings are issued.} \item{force.init}{If set to \code{TRUE} JVM is re-initialized even if @@ -33,6 +40,20 @@ silent = FALSE, force.init = FALSE) initialization and positive values signify partially successful initilization (i.e. the VM is up, but parameters or class path could not be set due to an existing or incompatible VM). + + \code{.jvmState} returns a named list with at least the following + elements: + \item{initialized}{\code{TRUE} if rJava is initialized and has a + runing JVM, \code{FALSE} otherwise.} + \item{state}{string representing the current state of the JVM. One of + the following values: + \code{"none"} if there is no JVM, \code{"created"} if the current + JVM has been created by rJava, \code{"attached"} if rJava attached + into an existing JVM (typically when R is embedded into a running + JVM via JRI), \code{"detached"} if there is a JVM (such as embedded + R), but rJava has not been initialized to use it, \code{"dead"} if + the process is about to die due to the JVM forcing en exit or + \code{"destroyed"} if a JVM existed before, but was destroyed.} } \details{ Starting with version 0.5 rJava provides a custom class loader that can @@ -59,16 +80,30 @@ silent = FALSE, force.init = FALSE) At any rate, it is impossible to change any other VM parameters of a running VM, so when using \code{.jinit} in a package, be generous with limits and don't use VM parameters to unnecessarily restrict - resources (or preferably use \code{\link{.jpackage}} instead). + resources (or preferably use \code{\link{.jpackage}} instead). JVM + parameters can only be set if the initial state of the JVM is + \code{"none"}. + + There is a subtle difference between \code{"initialized"} and the JVM + state. It is in theory possible for \code{"initialized"} to be + \code{FALSE} and still \code{"state"} to be \code{"created"} or + \code{"attached"} in case where JVM was created but rJava has not been + able to initialize for other reasons, although such state should be + rare and problematic in either case. Behavior of rJava functions other + than \code{.jinit} and \code{.jvmState} is undefined unless + \code{.jvmState()$initialized} is \code{TRUE}. + + NOTE: \code{.jinit()} can be called implicitly by other functions such + as \code{\link{.jpackage}} or \code{\link{J}}. } \seealso{ \code{\link{.jpackage}} } \examples{ \dontrun{ -## set heap size limit to 512MB (see java -X) and -## use "myClasses.jar" as the class path -.jinit(classpath="myClasses.jar", parameters="-Xmx512m") +## set heap size limit to 512MB (see java -X) +.jinit(parameters="-Xmx512m") +.jvmState() } } \keyword{interface} diff --git a/man/jmemprof.Rd b/man/jmemprof.Rd index 9f0857b..19ccce0 100644 --- a/man/jmemprof.Rd +++ b/man/jmemprof.Rd @@ -26,22 +26,23 @@ Note that lots of finalizers are run only when R exists, so usually you want to enable profiling early and let R exit to get a sensible - profile. Runninng gc may be helpful to get rid of references that can + profile. Running gc may be helpful to get rid of references that can be collected in R. A simple perl script is provided to analyze the result of the profiler. Due to its simple text format, it is possible to capture entire stdout including the profiler information to have both the console context for the allocations and the profile. Memory profiling - is also helful if rJava debug is enabled. + is also helpful if rJava debug is enabled. Note that memory profiling support must be compiled in rJava and it is by default compiled only if debug mode is enabled (which is not the case by default). } \examples{ -\donttest{ -.jmemprof("rJava.mem.profile.txt") -} +## memory profiling support is optional so only works when enabled +tryCatch( +.jmemprof("rJava.mem.profile.txt"), +error=function(e) message(e)) } \keyword{interface} diff --git a/man/jnew.Rd b/man/jnew.Rd index d599012..f5d31e7 100644 --- a/man/jnew.Rd +++ b/man/jnew.Rd @@ -31,9 +31,9 @@ } \item{class.loader}{optional class loader to force for loading the class. If not set, the rJava class loader is used first. The default - Java class loader is always used as a last resort. This is for - expert use only! If you set the class loader, the class loading - behavior changes - use only in very special circumstances.} + Java class loader is always used as a last resort. Set to + \code{.rJava.class.loader} inside a package if it uses its own class + loader (see \code{\link{.jpackage}} for details).} } \value{ Returns the reference (\code{jobjRef}) to the newly created object or diff --git a/man/jnull.Rd b/man/jnull.Rd index 2f316f7..0831b04 100644 --- a/man/jnull.Rd +++ b/man/jnull.Rd @@ -28,14 +28,14 @@ is.jnull(x) \code{TRUE} or if \code{x} is a Java \code{null} reference. } \details{ - \code{.jnull} is necesary if \code{null} is to be passed as an + \code{.jnull} is necessary if \code{null} is to be passed as an argument of \code{\link{.jcall}} or \code{\link{.jnew}}, in order to be able to find the correct method/constructor. Example: given the following method definitions of the class \code{A}: \itemize{ - \item{o}{public static void run(String a);} - \item{o}{public static void run(Double n);} + \item \code{public static void run(String a);} + \item \code{public static void run(Double n);} } Calling \code{.jcall("A",,"run",NULL)} is ambiguous, because it is unclear which method is to be used. Therefore rJava requires class diff --git a/man/jpackage.Rd b/man/jpackage.Rd index 29daddf..e129c23 100644 --- a/man/jpackage.Rd +++ b/man/jpackage.Rd @@ -10,7 +10,9 @@ function must be called before any rJava functions can be used. } \usage{ -.jpackage(name, jars='*', morePaths='', nativeLibrary=FALSE, lib.loc=NULL) +.jpackage(name, jars='*', morePaths='', nativeLibrary=FALSE, + lib.loc=NULL, parameters = getOption("java.parameters"), + own.loader = FALSE) } \arguments{ \item{name}{name of the package. It should correspond to the @@ -27,7 +29,12 @@ for native code in the R package's shared object or not.} \item{lib.loc}{a character vector with path names of R libraries, or \code{NULL} (see \code{\link{system.file}} and examples below).} - + \item{parameters}{optional JVM initialization parameters which will be + used if JVM is not initilized yet (see \code{\link{.jinit}}).} + \item{own.loader}{if \code{TRUE} then a new, separate class loader + will be initilized for the package and assigned to the + \code{.pkg.class.loader} variable in the package namespace. New + packages should make use of this feature.} } \value{ The return value is an invisible TRUE if the initialization was successful. @@ -52,6 +59,34 @@ option can be used to set them on initialization. Note, however, that Java parameters can only be used during JVM initialization and other package may have intialized JVM already. + + Since rJava 0.9-14 there is support of package-specific class + loaders using the \code{own.loader=TRUE} option. This is important for + packages that may be using classes that conflict with other packages + are therefore is highly recommended for new packages. Before this + feature, there was only one global class loader which means that the + class path was shared for all class look ups. If two packages + use the same (fully qualified) class name, even in a dependency, they + are likely to clash with each if they don't use exactly the same + version. Therefore it is safer for each package use use a private + class loader for its classes to guarantee that the only the classes + supplied with the package will be used. To do that, a package will set + \code{own.loader=TRUE} which instructs rJava to not change the global + loader, but instead create a separate one for the package and assign + it to \code{.rJava.class.loader} in the package namespace. Then if + package wants to instantiate a new class, it would use + \code{.jnew("myClass", class.loader=.rJava.class.loader)} to use its + own loader instead of the global one. The global loader's class path + won't be touched, so it won't find the package's classes. It is + possible to get the loader used in a package using + \code{.jclassLoader(package="foo")} which will return the global one if + the package has not registered its own. Similarly, to retrieve the + class path used by a package, one would use + \code{.jclassPath(.jclassLoader(package="foo"))}. + + Note that with the advent of multiple class loaders the value of the + \code{java.class.path} property is no longer meaningful as it can + reflect only one of the loaders. } \seealso{ \code{\link{.jinit}} @@ -59,7 +94,10 @@ \examples{ \dontrun{ .onLoad <- function(libname, pkgname) { - .jpackage(pkgname, lib.loc=libname) + .jpackage(pkgname, lib.loc=libname, own.loader=TRUE) + ## do not use, just an illustration of the concept: + cat("my Java class path: ") + print(.jclassPath(.jclassLoader(package=pkgname))) } } } diff --git a/man/jrectRef-class.Rd b/man/jrectRef-class.Rd index 88787d0..6cf7904 100644 --- a/man/jrectRef-class.Rd +++ b/man/jrectRef-class.Rd @@ -17,11 +17,11 @@ \alias{range,jrectRef-method} \title{Rectangular java arrays} -\description{References to java arrays that are guaranteed to be rectangular, i.e similar +\description{References to java arrays that are guaranteed to be rectangular, i.e similar to R arrays} \section{Objects from the Class}{ -Objects of this class should *not* be created directly. -Instead, they usually come as a result of a java method call. +Objects of this class should *not* be created directly. +Instead, they usually come as a result of a java method call. } \section{Slots}{ \describe{ @@ -37,11 +37,11 @@ Class \code{"\linkS4class{jobjRef}"}, by class "jarrayRef", distance 2. } \section{Methods}{ \describe{ - \item{length}{\code{signature(x = "jrectRef")}: The number of elements in the array. - Note that if the array has more than one dimension, - it gives the number of arrays in the first dimension, and not the total - number of atomic objects in tha array (like R does). This gives what would be - returned by \code{array.length} in java.} + \item{length}{\code{signature(x = "jrectRef")}: The number of elements in the array. + Note that if the array has more than one dimension, + it gives the number of arrays in the first dimension, and not the total + number of atomic objects in the array (like R does). This gives what would be + returned by \code{array.length} in java.} \item{str}{\code{signature(object = "jrectRef")}: ... } \item{[}{\code{signature(x = "jrectRef")}: R indexing of rectangular java arrays } \item{dim}{\code{signature(x = "jrectRef")}: extracts the dimensions of the array } @@ -71,7 +71,7 @@ array[ c(TRUE,FALSE,TRUE) ] array[ 1:2 ] array[ -3 ] -# length +# length length( array ) \dontshow{stopifnot(length(array) == 3L)} @@ -95,7 +95,7 @@ x <- .jcall( "RectangularArrayExamples", "[[I", stopifnot( identical( typeof( x ), "integer" ) ) stopifnot( identical( dim(x) , dim2d ) ) stopifnot( identical( as.vector(x), 0:9 ) ) - + x <- .jcall( "RectangularArrayExamples", "[[B", "getByteDoubleRectangularArrayExample", evalArray = TRUE, simplify = TRUE ) stopifnot( identical( typeof( x ), "raw" ) ) @@ -141,7 +141,7 @@ stopifnot( identical( as.vector(x), as.character(0:9) ) ) # 3d -dim3d <- c(5L, 3L, 2L) +dim3d <- c(5L, 3L, 2L) x <- .jcall( "RectangularArrayExamples", "[[[Z", "getBooleanTripleRectangularArrayExample", evalArray = TRUE, simplify = TRUE) @@ -154,7 +154,7 @@ x <- .jcall( "RectangularArrayExamples", "[[[I", stopifnot( identical( typeof( x ), "integer" ) ) stopifnot( identical( dim(x) , dim3d ) ) stopifnot( identical( as.vector(x), 0:29 ) ) - + x <- .jcall( "RectangularArrayExamples", "[[[B", "getByteTripleRectangularArrayExample", evalArray = TRUE, simplify = TRUE ) stopifnot( identical( typeof( x ), "raw" ) ) @@ -196,7 +196,7 @@ x <- .jcall( "RectangularArrayExamples", "[[[Ljava/lang/String;", stopifnot( identical( typeof( x ), "character" ) ) stopifnot( identical( dim(x) , dim3d ) ) stopifnot( identical( as.vector(x), as.character(0:29) ) ) - + # testing the indexing @@ -247,7 +247,7 @@ stopifnot( dim(xu) == 2L ) # test duplicated x <- .jarray( rep( 1:2, each = 5 ), dispatch = TRUE ) xd <- duplicated( x ) -stopifnot( xd == rep( c( FALSE, TRUE, TRUE, TRUE, TRUE), 2L ) ) +stopifnot( xd == rep( c( FALSE, TRUE, TRUE, TRUE, TRUE), 2L ) ) if (rJava:::.base.has.anyDuplicated) stopifnot( anyDuplicated( x ) == 2L ) p1 <- .jnew( "java/awt/Point" ) diff --git a/man/jreflection.Rd b/man/jreflection.Rd index 7d3b060..5b874d5 100644 --- a/man/jreflection.Rd +++ b/man/jreflection.Rd @@ -10,32 +10,35 @@ a given class or object. \code{.jmethods} returns a character vector with all methods for a given class or object. - \code{.jfields} returns a character vector with all fileds (aka attributes) for a given class or object. + \code{.jfields} returns a character vector with all fields (aka attributes) for a given class or object. } \usage{ -.jconstructors(o, as.obj = FALSE) -.jmethods(o, name = NULL, as.obj = FALSE) -.jfields(o, name = NULL, as.obj = FALSE) +.jconstructors(o, as.obj = FALSE, class.loader=.rJava.class.loader) +.jmethods(o, name = NULL, as.obj = FALSE, class.loader=.rJava.class.loader) +.jfields(o, name = NULL, as.obj = FALSE, class.loader=.rJava.class.loader) } \arguments{ \item{o}{Name of a class (either notation is fine) or an object whose class will be queried} - \item{name}{Name of the method/field to look for. May contain regular - expressions except for \code{^$}.} + \item{name}{string, regular expression of the method/field to look for} \item{as.obj}{if \code{TRUE} then a list of Java objects is returned, otherwise a character vector (obtained by calling \code{toString()} on each entry).} + \item{class.loader}{optional, class loader to use for class look up if + needed (i.e., if \code{o} is a string)} } \value{ Returns a character vector (if \code{as.obj} is \code{FALSE}) or a list of Java objects. Each entry corresponds to the - \code{Constructor} resp. \code{Method} resp. \code{Field} object. + \code{Constructor} resp. \code{Method} resp. \code{Field} + object. The string result is constructed by calling + \code{toString()} on the objects. } \details{ There first two functions are intended to help with finding correct signatures for methods and constructors. Since the low-level API in rJava doesn't use reflection automatically, it is necessary to - provide a proper signature. That is somewhat easier using the above + provide a proper signature. That is somewhat easier using the above methods. } \seealso{ @@ -43,8 +46,8 @@ } \examples{ \dontrun{ -.jconstructors("java/util/Vector") -v <- .jnew("java/util/Vector") +.jconstructors("java.util.Vector") +v <- .jnew("java.util.Vector") .jmethods(v, "add") } } diff --git a/man/jserialize.Rd b/man/jserialize.Rd index 29383d5..ad0663d 100644 --- a/man/jserialize.Rd +++ b/man/jserialize.Rd @@ -84,7 +84,7 @@ hold a reference to a Java object in R that is also referenced by the serialized Java object on the Java side, then this relationship cannot be retained upon restore. Instead, two copies of disjoint - objects will be created which can cause confusion and errorneous + objects will be created which can cause confusion and erroneous behavior. The cache is attached to the reference external pointer and thus it diff --git a/man/loader.Rd b/man/loader.Rd index f7a8e4a..30f6b83 100644 --- a/man/loader.Rd +++ b/man/loader.Rd @@ -1,33 +1,62 @@ \name{loader} \alias{.jaddClassPath} \alias{.jclassPath} +\alias{.jclassLoader} \title{ - Java class loader + Java Class Loader } \description{ \code{.jaddClassPath} adds directories or JAR files to the class path. - \code{.jclassPath} returns a vector containg the current entries in + \code{.jclassPath} returns a vector containing the current entries in the class path } \usage{ -.jaddClassPath(path) -.jclassPath() +.jaddClassPath(path, class.loader=.rJava.class.loader) +.jclassPath(class.loader=.rJava.class.loader) +.jclassLoader(package=NULL) } \arguments{ \item{path}{character string vector listing the paths to add to the class path} + \item{class.loader}{Java class loader to use for the query of + madification. Defaults to global class loader.} + \item{package}{string, name of a package or \code{NULL} for the global + class loader} } \value{ \code{.jclassPath} returns a character vector listing the class path sequence. } -%\details{ -% -%} -%\seealso{ -% \code{\link{.jpackage}} -%} +\details{ + Whenever a class needs to be instantiated in Java it is referred by + name which is used to locate a file with the bytecode for the + class. The mechanism to map a name to an actual bytecode to load ind + instantiate is habdled by the Java class loader. It typically keeps a + list of directories and JAR files to search for the class names. + + The \code{.jaddClassPath()} function allows the user to append new + locations to the list of places which will be searched. The function + \code{.jclassPath} retrieves the current sarch list from the loader. + + When rJava is initialized, it instantiates the global class loader + which is responsible for finding classes in functions such as + \code{.jnew()}. In addition to the global class loader, R packages can + create their own class loaders to avoid conflicts between packages + such that they can be sure to use their own files to look for + classes. See \code{\link{.jpackage}} for details on how that works. + If the \code{package} argument is supplied \code{.jclassLoader} will + look in that package to see if it has a custom loader and will return + it, otherwise it returns the global loader. Note that is will fail with + an error when supplied a non-existing package name. + + If you want to trace issues related to missing classes, you can enable + debugging in the class loader by using the \code{setDebug} method, for + example: \code{.jclassLoader()$setDebug(1L)} +} +\seealso{ + \code{\link{.jpackage}} +} \examples{ \dontrun{ .jaddClassPath("/my/jars/foo.jar","/my/classes/") diff --git a/man/rJava-internal.Rd b/man/rJava-internal.Rd new file mode 100644 index 0000000..c6439ed --- /dev/null +++ b/man/rJava-internal.Rd @@ -0,0 +1,80 @@ +\name{rJava-internal} +\alias{rJava-internal} +\alias{.jaddLibrary} +\alias{.jclass} +\alias{.jclass.boolean} +\alias{.jclass.double} +\alias{.jclass.float} +\alias{.jclass.int} +\alias{.jclass.void} +\alias{.jclassClass} +\alias{.jclassObject} +\alias{.jclassRef} +\alias{.jclassString} +\alias{.jfindClass} +\alias{.jfirst} +\alias{.jidenticalRef} +\alias{.jinherits} +\alias{.jinit.merge.error} +\alias{.jmergeClassPath} +\alias{.jmkref} +\alias{.jniInitialized} +\alias{.joptions} +\alias{.jproperty} +\alias{.jrcall} +\alias{.jrmLibrary} +\alias{.jsetJConvertor} +\alias{.jsetRConvertor} +\alias{.jstrVal} +\alias{.jzeroRef} +\alias{.r2j} +\alias{.rJava.base.path} +\title{ + Internal functions and constants +} +\description{ + The following functions are either internal or are not officially part + of the API and therefore may changes in the future. +} +\usage{ +.jaddLibrary(name, path, class.loader = .rJava.class.loader) +.jclass(o, true = TRUE) +.jclassRef(x, silent = FALSE) +.jfindClass(cl, silent = FALSE, class.loader = .rJava.class.loader) +.jfirst(libname, pkgname) +.jidenticalRef(a, b) +.jinherits(o, cl, class.loader = .rJava.class.loader) +.jmergeClassPath(cp) +.jmkref(jobj, jclass = "java/lang/Object") +.joptions(...) +.jproperty(key) +.jrcall(o, method, ..., simplify = TRUE, class.loader = .rJava.class.loader) +.jrmLibrary(name) +.jsetJConvertor(java.class, fn) +.jsetRConvertor(r.class, fn) +.jstrVal(obj) +.r2j(x, engine = NULL, convert = TRUE) +} +\arguments{ + \item{name}{string, name of the library} + \item{path}{string, path} + \item{class.loader}{class loader object} + \item{o}{Java object} + \item{x}{Java object} + \item{cl}{string, class name (or Java class name object)} + \item{libname}{string, library location} + \item{pkgname}{string, package name} + \item{a}{Java object} + \item{b}{Java object} + \item{cp}{string, class path} + \item{jobj}{Java object} + \item{simplify}{logical} + \item{java.class}{string, class name} + \item{fn}{convertor function} + \item{r.class}{string, R class} + \item{obj}{Java object} + \item{engine}{Java engine object, if \code{NULL} uses the main engine} + \item{convert}{logical} + \item{\dots}{additional parameters} +} +\keyword{internal} diff --git a/man/toJava.Rd b/man/toJava.Rd index f05004b..5c09945 100644 --- a/man/toJava.Rd +++ b/man/toJava.Rd @@ -5,7 +5,7 @@ Convert R objects to REXP references in Java } \description{ \code{toJava} takes an R object and creates a reference to that object -in Java. This reference can then be passed to Java methods such taht +in Java. This reference can then be passed to Java methods such that they can refer to it back in R. This is commonly used to pass functions to Java such that Java code can call those functions later. } diff --git a/man/with.Rd b/man/with.Rd index 86c5e30..4ac4b2f 100644 --- a/man/with.Rd +++ b/man/with.Rd @@ -56,7 +56,7 @@ Romain Francois } \references{ the \code{java.lang.reflect} package: - \url{http://java.sun.com/j2se/1.5.0/docs/api/java/lang/reflect/package-summary.html} + \url{https://docs.oracle.com/javase/8/docs/api/java/lang/reflect/package-summary.html} } \examples{ \dontshow{.jinit()} diff --git a/mkdist b/mkdist index 9466475..2574b31 100644 --- a/mkdist +++ b/mkdist @@ -22,9 +22,9 @@ mkdir /tmp/rJava echo "Copying package base ..." cp -r . /tmp/rJava -if [ -e "${SWD}/jri/mkdist" ]; then - JRI="${SWD}/jri" - rm -rf /tmp/rJava/jri +if [ -e "${SWD}/src/jri/mkdist" ]; then + JRI="${SWD}/src/jri" + rm -rf /tmp/rJava/src/jri echo "Embedded JRI: ${JRI}" fi @@ -38,7 +38,7 @@ rm -f /tmp/rJava/README.md cd /tmp/rJava if [ "$1" = "-c" ]; then - rm -f configure install-sh jri/configure + rm -f configure tools/install-sh src/jri/configure fi if [ -e /tmp/rJava/configure ]; then @@ -50,7 +50,7 @@ else rm -rf autom4te* acloc* fi -if [ ! -e install-sh ]; then +if [ ! -e tools/install-sh ]; then echo "Fetching install-sh ..." ams=/usr/share/automake/install-sh if [ ! -e $ams ]; then @@ -60,21 +60,21 @@ if [ ! -e install-sh ]; then echo "*** ERROR: install-sh is not present and I can't find it in /usr/share" exit 2 fi - cp $ams install-sh + cp $ams tools/install-sh fi -if [ ! -e getsp.class ]; then +if [ ! -e tools/getsp.class ]; then echo "Compiling getsp.class" - javac -target 1.2 -source 1.2 getsp.java + (cd tools && javac -target 1.2 -source 1.2 getsp.java) fi echo "Removing CVS/SVN and backup files ..." rm -rf `find . -name CVS -or -name .svn -or -name \*~` ## since we merged JRI and rJava trees we no longer support ORG builds -if [ ! -e jri/configure ]; then - if [ -e "${SWD}/jri/mkdist" ]; then - DEFAULTJRI="${SWD}/jri" +if [ ! -e src/jri/configure ]; then + if [ -e "${SWD}/src/jri/mkdist" ]; then + DEFAULTJRI="${SWD}/src/jri" fi : ${JRI=$DEFAULTJRI} if [ ! -e "$JRI" ]; then @@ -96,35 +96,35 @@ if [ ! -e jri/configure ]; then echo "*** ERROR: Cannot get JRI distro!" exit 1 fi - rm -rf jri JRI ${SWD}/JRI_* + rm -rf jri src/jri JRI ${SWD}/JRI_* #mkdir jri 2> /dev/null > /dev/null cd /tmp/rJava - tar fvxz $jf + tar fvxz $jf -C src else - tar fxz $JRI + tar fxz $JRI -C src fi - if [ -e jri/JRI ]; then + if [ -e src/jri/JRI ]; then rm -rf 1 - mv jri 1 - mv 1/JRI jri + mv src/jri 1 + mv 1/JRI src/jri rm -rf 1 fi - if [ ! -e jri/Makefile.in ]; then - if [ -e JRI/Makefile.in ]; then - mv JRI jri + if [ ! -e src/jri/Makefile.in ]; then + if [ -e src/JRI/Makefile.in ]; then + mv src/JRI src/jri else echo "*** ERROR: jri is not correctly set up." exit 1 fi fi - if [ -e jri/Makefile.in -a -e JRI/Makefile.in ]; then + if [ -e src/jri/Makefile.in -a -e src/JRI/Makefile.in ]; then # case-insensitive fs - but we need lower case *sigh* - mv JRI 1 - mv 1 jri + mv src/JRI 1 + mv 1 src/jri fi fi -DEFAULTRENG="${SWD}/jri/REngine" +DEFAULTRENG="${SWD}/src/jri/REngine" if [ ! -e "$DEFAULTRENG/Makefile" ]; then echo "*** WARNING *** cannot find REngine sources, the distribution will NOT include REngine!" else @@ -158,8 +158,9 @@ mkdir -p inst/java/boot cd src/java make clean make compile -echo "Generate javadoc documentation" -make javadoc +# do not generate javadoc (see #303) +#echo "Generate javadoc documentation" +#make javadoc cd ../.. echo "Copy compiled Java classes ..." # copy all complied Java classes and sources @@ -168,7 +169,7 @@ cp src/java/*.java inst/java # move RJavaClassLoader into boot area since it will be loaded by the system class loader mv inst/java/RJavaClassLoader* inst/java/boot # move javadoc directory -mv src/java/javadoc inst/javadoc +if [ -e src/java/javadoc ]; then mv src/java/javadoc inst/javadoc; fi echo "Updating version ..." cd /tmp/rJava @@ -192,7 +193,8 @@ fi echo "Creating package ..." cd .. rm -f `find rJava -name ._\*` -rm -rf rJava/.git rJava/jri/REngine/.git +rm -rf rJava/.git* rJava/src/jri/REngine/.git* +rm -f rJava/version R CMD build rJava cd ${SWD} cp /tmp/rJava_${VER}.tar.gz .. diff --git a/src/Makevars.in b/src/Makevars.in index e87396c..f59c622 100644 --- a/src/Makevars.in +++ b/src/Makevars.in @@ -1,17 +1,17 @@ # we need to add JNI specific stuff here PKG_CPPFLAGS=-I. @JAVA_CPPFLAGS@ -PKG_LIBS=@JAVA_LIBS@ +@USE_DYNLOAD_FALSE@PKG_LIBS=@JAVA_LIBS@ JAVA_HOME=@JAVA_HOME@ # make SHLIB believe that we know better what the objects are #OBJECTS=Rglue.o callJNI.o initJNI.o rJava.o jri.o jri_glue.o -all: $(SHLIB) @WANT_JRI_TRUE@ jri +all: $(SHLIB) @WANT_JRI_TRUE@ build-jri -.PHONY: all +.PHONY: all build-jri # this is a hack to force SHLIB to run our sub-make -jri: - (cd ../jri && $(MAKE)) +build-jri: + (cd jri && $(MAKE)) -@mkdir -p ../inst/jri - @(cp -r ../jri/src/JRI.jar ../jri/*jri.* ../jri/run ../jri/examples ../inst/jri/) + @(cp -r jri/src/JRI.jar jri/*jri.* jri/run jri/examples ../inst/jri/) diff --git a/src/Rglue.c b/src/Rglue.c index 2246680..c76da2f 100644 --- a/src/Rglue.c +++ b/src/Rglue.c @@ -4,10 +4,12 @@ #include #include #include - +#include +#include +#include "rjstring.h" #include -/* max supported # of parameters to Java methdos */ +/* max supported # of parameters to Java methods */ #ifndef maxJavaPars #define maxJavaPars 32 #endif @@ -18,7 +20,7 @@ #endif /** returns TRUE if JRI has callback support compiled in or FALSE otherwise */ -REPC SEXP RJava_has_jri_cb() { +REPC SEXP RJava_has_jri_cb(void) { SEXP r = allocVector(LGLSXP, 1); #ifdef ENABLE_JRICB LOGICAL(r)[0] = 1; @@ -26,7 +28,7 @@ REPC SEXP RJava_has_jri_cb() { LOGICAL(r)[0] = 0; #endif return r; -} +} /* debugging output (enable with -DRJ_DEBUG) */ #ifdef RJ_DEBUG @@ -46,7 +48,7 @@ HIDE void rjprintf(char *fmt, ...) { #ifdef RJ_PROFILE #include -HIDE long time_ms() { +HIDE long time_ms(void) { #ifdef Win32 return 0; /* in Win32 we have no gettimeofday :( */ #else @@ -115,7 +117,7 @@ SEXP j2SEXP(JNIEnv *env, jobject o, int releaseLocal) { releaseObject(env, o); o=go; } - + { SEXP xp = R_MakeExternalPtr(o, R_NilValue, R_NilValue); @@ -138,16 +140,27 @@ SEXP j2SEXP(JNIEnv *env, jobject o, int releaseLocal) { } } -#if R_VERSION >= R_Version(2,7,0) -/* returns string from a CHARSXP making sure that the result is in UTF-8 */ +/* returns string from a CHARSXP making sure that the result is in UTF-8 + NOTE: this should NOT be used to create Java strings as they require UTF-16 natively + For Java strings use rj_*_utf16 function from rjstring.h */ const char *rj_char_utf8(SEXP s) { - if (Rf_getCharCE(s) == CE_UTF8) return CHAR(s); - return Rf_reEnc(CHAR(s), getCharCE(s), CE_UTF8, 0); /* subst. invalid chars: 1=hex, 2=., 3=?, other=skip */ -} +#ifdef DEBUG_ENCODING + fprintf(stderr, "rJava.rj_char_utf8, CE=%d: \"%s\"\n", (int)Rf_getCharCE(s), CHAR(s)); +// { const char *c0 = CHAR(s); while (*c0) fprintf(stderr, " %02x", (int)((unsigned char)*(c0++))); } +// fprintf(stderr, "\n"); #endif + return (Rf_getCharCE(s) == CE_UTF8) ? CHAR(s) : Rf_reEnc(CHAR(s), getCharCE(s), CE_UTF8, 0); /* subst. invalid chars: 1=hex, 2=., 3=?, other=skip */ +} + + +static jstring newJavaString(JNIEnv *env, SEXP sChar) { + jchar *s; + size_t len = rj_rchar_utf16(sChar, &s); + return newString16(env, s, (len + 1) >> 1); +} HIDE void deserializeSEXP(SEXP o) { - _dbg(rjprintf("attempt to deserialize %p (clCL=%p, oCL=%p)\n", o, clClassLoader, oClassLoader)); + _dbg(rjprintf("attempt to deserialize %p (clCl=%p, oCL=%p)\n", o, clClassLoader, oClassLoader)); SEXP s = EXTPTR_PROT(o); if (TYPEOF(s) == RAWSXP && EXTPTR_PTR(o) == NULL) { JNIEnv *env = getJNIEnv(); @@ -163,18 +176,18 @@ HIDE void deserializeSEXP(SEXP o) { if (go) { _dbg(rjprintf(" - succeeded: %p\n", go)); /* set the deserialized object */ - EXTPTR_PTR(o) = (SEXP) go; + R_SetExternalPtrAddr(o, go); /* Note: currently we don't remove the serialized content, because it was created explicitly using .jcache to allow repeated saving. Once this is handled by a hook, we shall remove it. However, to assure compatibility TAG is always NULL for now, so we do clear the cache if TAG is non-null for future use. */ if (EXTPTR_TAG(o) != R_NilValue) { /* remove the serialized raw vector */ - SETCDR(o, R_NilValue); /* Note: this is abuse of the API since it uses the fact that PROT is stored in CDR */ + R_SetExternalPtrTag(o, R_NilValue); } } } } releaseObject(env, ser); } - } + } } } @@ -198,6 +211,18 @@ static void strcats(sig_buffer_t *sig, const char *add) { sig->len += l; } +/* call strcats() but also convert class names to JNI notation */ +static void strcats_conv(sig_buffer_t *sig, const char *add) { + int ol = sig->len, nl; + strcats(sig, add); + nl = sig->len; + while (ol < nl) { + if (sig->sig[ol] == '.') + sig->sig[ol] = '/'; + ol++; + } +} + /* initialize a signature buffer */ HIDE void init_sigbuf(sig_buffer_t *sb) { sb->len = 0; @@ -206,7 +231,7 @@ HIDE void init_sigbuf(sig_buffer_t *sb) { } /* free the content of a signature buffer (if necessary) */ -HIDE void done_sigbuf(sig_buffer_t *sb) { +HIDE void done_sigbuf(sig_buffer_t *sb) { if (sb->sig != sb->sigbuf) free(sb->sig); } @@ -217,7 +242,9 @@ static int Rpar2jvalue(JNIEnv *env, SEXP par, jvalue *jpar, sig_buffer_t *sig, i SEXP p=par; SEXP e; int jvpos=0; - int i=0; +#ifdef RJ_DEBUG + int i = 0; +#endif while (p && TYPEOF(p)==LISTSXP && (e=CAR(p))) { /* skip all named arguments */ @@ -228,7 +255,7 @@ static int Rpar2jvalue(JNIEnv *env, SEXP par, jvalue *jpar, sig_buffer_t *sig, i Rf_error("Too many arguments in Java call. maxJavaPars is %d, recompile rJava with higher number if needed.", maxJavaPars); break; } - + _dbg(rjprintf("Rpar2jvalue: par %d type %d\n",i,TYPEOF(e))); if (TYPEOF(e)==STRSXP) { _dbg(rjprintf(" string vector of length %d\n",LENGTH(e))); @@ -238,7 +265,7 @@ static int Rpar2jvalue(JNIEnv *env, SEXP par, jvalue *jpar, sig_buffer_t *sig, i if (sv == R_NaString) { addtmpo(tmpo, jpar[jvpos++].l = 0); } else { - addtmpo(tmpo, jpar[jvpos++].l = newString(env, CHAR_UTF8(sv))); + addtmpo(tmpo, jpar[jvpos++].l = newJavaString(env, sv)); } } else { int j = 0; @@ -254,7 +281,7 @@ static int Rpar2jvalue(JNIEnv *env, SEXP par, jvalue *jpar, sig_buffer_t *sig, i SEXP sv = STRING_ELT(e,j); if (sv == R_NaString) { } else { - jobject s = newString(env, CHAR_UTF8(sv)); + jobject s = newJavaString(env, sv); _dbg(rjprintf (" [%d] \"%s\"\n",j,CHAR_UTF8(sv))); (*env)->SetObjectArrayElement(env, sa, j, s); if (s) releaseObject(env, s); @@ -345,7 +372,12 @@ static int Rpar2jvalue(JNIEnv *env, SEXP par, jvalue *jpar, sig_buffer_t *sig, i addtmpo(tmpo, jpar[jvpos++].l=newBooleanArrayI(env, LOGICAL(e),LENGTH(e))); } } else if (TYPEOF(e)==VECSXP || TYPEOF(e)==S4SXP) { - _dbg(rjprintf(" generic vector of length %d\n", LENGTH(e))); + if (TYPEOF(e) == VECSXP) + _dbg(rjprintf(" generic vector of length %d\n", LENGTH(e))); + if (inherits(e, "jclassName")) { + _dbg(rjprintf(" jclassName, replacing with embedded class jobjRef")); + e = GET_SLOT(e, install("jobj")); + } if (IS_JOBJREF(e)) { jobject o=(jobject)0; const char *jc=0; @@ -375,9 +407,9 @@ static int Rpar2jvalue(JNIEnv *env, SEXP par, jvalue *jpar, sig_buffer_t *sig, i } if (jc) { if (*jc!='[') { /* not an array, we assume it's an object of that class */ - strcats(sig,"L"); strcats(sig,jc); strcats(sig,";"); + strcats(sig,"L"); strcats_conv(sig,jc); strcats(sig,";"); } else /* array signature is passed as-is */ - strcats(sig,jc); + strcats_conv(sig,jc); } else strcats(sig,"Ljava/lang/Object;"); jpar[jvpos++].l=o; @@ -385,7 +417,9 @@ static int Rpar2jvalue(JNIEnv *env, SEXP par, jvalue *jpar, sig_buffer_t *sig, i _dbg(rjprintf(" (ignoring)\n")); } } +#ifdef RJ_DEBUG i++; +#endif p=CDR(p); } fintmpo(tmpo); @@ -406,7 +440,8 @@ static void Rfreejpars(JNIEnv *env, jobject *tmpo) { HIDE jvalue R1par2jvalue(JNIEnv *env, SEXP par, sig_buffer_t *sig, jobject *otr) { jobject tmpo[4] = {0, 0}; jvalue v[4]; - int p = Rpar2jvalue(env, CONS(par, R_NilValue), v, sig, 2, tmpo); + int p = Rpar2jvalue(env, PROTECT(CONS(par, R_NilValue)), v, sig, 2, tmpo); + UNPROTECT(1); /* this should never happen, but just in case - we can only assume responsibility for one value ... */ if (p != 1 || (tmpo[0] && tmpo[1])) { Rfreejpars(env, tmpo); @@ -430,10 +465,10 @@ REPE SEXP RcallMethod(SEXP par) { jmethodID mid = 0; jclass cls; JNIEnv *env = getJNIEnv(); - + profStart(); p=CDR(p); e=CAR(p); p=CDR(p); - if (e==R_NilValue) + if (e==R_NilValue) error_return("RcallMethod: call on a NULL object"); if (TYPEOF(e)==EXTPTRSXP) { jverify(e); @@ -465,7 +500,7 @@ REPE SEXP RcallMethod(SEXP par) { if (TYPEOF(e)==STRSXP && LENGTH(e)==1) { /* signature */ retsig=CHAR_UTF8(STRING_ELT(e,0)); /* - } else if (inherits(e, "jobjRef")) { method object + } else if (inherits(e, "jobjRef")) { method object SEXP mexp = GET_SLOT(e, install("jobj")); jobject mobj = (jobject)(INTEGER(mexp)[0]); _dbg(rjprintf(" signature is Java object %x - using reflection\n", mobj); @@ -473,7 +508,7 @@ REPE SEXP RcallMethod(SEXP par) { retsig = getReturnSigFromMethodObject(mobj); */ } else error_return("RcallMethod: invalid return signature parameter"); - + e=CAR(p); p=CDR(p); if (TYPEOF(e)!=STRSXP || LENGTH(e)!=1) error_return("RcallMethod: invalid method name"); @@ -518,7 +553,7 @@ END_RJAVA_CALL BEGIN_RJAVA_CALL int r=o? (*env)->CallIntMethodA(env, o, mid, jpar): - (*env)->CallStaticIntMethodA(env, cls, mid, jpar); + (*env)->CallStaticIntMethodA(env, cls, mid, jpar); e = allocVector(INTSXP, 1); INTEGER(e)[0] = r; END_RJAVA_CALL @@ -553,7 +588,7 @@ END_RJAVA_CALL _prof(profReport("Method \"%s\" returned:",mnam)); return e; } - case 'J': { + case 'J': { BEGIN_RJAVA_CALL jlong r=o? (*env)->CallLongMethodA(env, o, mid, jpar): @@ -566,7 +601,7 @@ END_RJAVA_CALL _prof(profReport("Method \"%s\" returned:",mnam)); return e; } - case 'S': { + case 'S': { BEGIN_RJAVA_CALL jshort r=o? (*env)->CallShortMethodA(env, o, mid, jpar): @@ -640,7 +675,7 @@ END_RJAVA_CALL } /* switch */ _prof(profReport("Method \"%s\" has an unknown signature, not called:",mnam)); releaseObject(env, cls); - error("unsupported/invalid mathod signature %s", retsig); + error("unsupported/invalid method signature %s", retsig); return R_NilValue; } @@ -651,7 +686,7 @@ REPE SEXP RcallSyncMethod(SEXP par) { JNIEnv *env=getJNIEnv(); p=CDR(p); e=CAR(p); p=CDR(p); - if (e==R_NilValue) + if (e==R_NilValue) error("RcallSyncMethod: call on a NULL object"); if (TYPEOF(e)==EXTPTRSXP) { jverify(e); @@ -670,8 +705,11 @@ REPE SEXP RcallSyncMethod(SEXP par) { e = RcallMethod(par); - if ((*env)->MonitorExit(env, o) != JNI_OK) + if ((*env)->MonitorExit(env, o) != JNI_OK) { + PROTECT(e); REprintf("Rglue.SERIOUS PROBLEM: MonitorExit failed, subsequent calls may cause a deadlock!\n"); + UNPROTECT(1); + } return e; } @@ -748,7 +786,7 @@ END_RJAVA_CALL } } #endif - + return j2SEXP(env, o, 1); } @@ -785,18 +823,17 @@ static SEXP getObjectClassName(JNIEnv *env, jobject o) { /** creates a new jobjRef object. If klass is NULL then the class is determined from the object (if also o=NULL then the class is set to java/lang/Object) */ HIDE SEXP new_jobjRef(JNIEnv *env, jobject o, const char *klass) { - SEXP oo = NEW_OBJECT(MAKE_CLASS("jobjRef")); + SEXP oo = PROTECT(NEW_OBJECT(PROTECT(MAKE_CLASS("jobjRef")))); if (!inherits(oo, "jobjRef")) error("unable to create jobjRef object"); - PROTECT(oo); SET_SLOT(oo, install("jclass"), - klass?mkString(klass):getObjectClassName(env, o)); - SET_SLOT(oo, install("jobj"), j2SEXP(env, o, 1)); - UNPROTECT(1); + PROTECT(klass ? mkString(klass) : getObjectClassName(env, o))); + SET_SLOT(oo, install("jobj"), PROTECT(j2SEXP(env, o, 1))); + UNPROTECT(4); return oo; } -/** +/** * creates a new jclassName object. similar to what the jclassName * function does in the R side * @@ -804,22 +841,21 @@ HIDE SEXP new_jobjRef(JNIEnv *env, jobject o, const char *klass) { * @param cl Class instance */ HIDE SEXP new_jclassName(JNIEnv *env, jobject/*Class*/ cl ) { - SEXP oo = NEW_OBJECT(MAKE_CLASS("jclassName")); + SEXP oo = PROTECT(NEW_OBJECT(PROTECT(MAKE_CLASS("jclassName")))); if (!inherits(oo, "jclassName")) error("unable to create jclassName object"); - PROTECT(oo); - SET_SLOT(oo, install("name"), getName(env, cl) ); - SET_SLOT(oo, install("jobj"), new_jobjRef( env, cl, "java/lang/Class" ) ); - UNPROTECT(1); + SET_SLOT(oo, install("name"), PROTECT(getName(env, cl)) ); + SET_SLOT(oo, install("jobj"), PROTECT(new_jobjRef( env, cl, "java/lang/Class" )) ); + UNPROTECT(4); return oo; } /** Calls the Class.getName method and return the result as an R STRSXP */ HIDE SEXP getName( JNIEnv *env, jobject/*Class*/ cl){ char cn[128]; - + jstring r = (*env)->CallObjectMethod(env, cl, mid_getName); - + cn[127]=0; *cn=0; int sl = (*env)->GetStringLength(env, r); if (sl>127) { @@ -828,31 +864,30 @@ HIDE SEXP getName( JNIEnv *env, jobject/*Class*/ cl){ if (sl) (*env)->GetStringUTFRegion(env, r, 0, sl, cn); char *c=cn; while(*c) { if (*c=='.') *c='/'; c++; } - SEXP res = PROTECT( mkString(cn ) ); + SEXP res = mkString(cn); releaseObject(env, r); - UNPROTECT(1); /* res */ return res; } static SEXP new_jarrayRef(JNIEnv *env, jobject a, const char *sig) { /* it is too tedious to try to do this in C, so we use 'new' R function instead */ /* SEXP oo = eval(LCONS(install("new"),LCONS(mkString("jarrayRef"),R_NilValue)), R_GlobalEnv); */ - SEXP oo = NEW_OBJECT(MAKE_CLASS("jarrayRef")); + SEXP oo = PROTECT(NEW_OBJECT(PROTECT(MAKE_CLASS("jarrayRef")))); /* .. and set the slots in C .. */ if (! IS_JARRAYREF(oo) ) error("unable to create an array"); - PROTECT(oo); - SET_SLOT(oo, install("jobj"), j2SEXP(env, a, 1)); - SET_SLOT(oo, install("jclass"), mkString(sig)); - SET_SLOT(oo, install("jsig"), mkString(sig)); - UNPROTECT(1); + SET_SLOT(oo, install("jobj"), PROTECT(j2SEXP(env, a, 1))); + SET_SLOT(oo, install("jclass"), PROTECT(mkString(sig))); + SET_SLOT(oo, install("jsig"), PROTECT(mkString(sig))); + UNPROTECT(5); return oo; } +#if 0 /* FIXME: no longer used */ /** * Creates a reference to a rectangular java array. * - * @param env + * @param env * @param a the java object * @param sig signature (class of the array object) * @param dim dimension vector @@ -860,34 +895,34 @@ static SEXP new_jarrayRef(JNIEnv *env, jobject a, const char *sig) { static SEXP new_jrectRef(JNIEnv *env, jobject a, const char *sig, SEXP dim ) { /* it is too tedious to try to do this in C, so we use 'new' R function instead */ /* SEXP oo = eval(LCONS(install("new"),LCONS(mkString("jrectRef"),R_NilValue)), R_GlobalEnv); */ - SEXP oo = NEW_OBJECT(MAKE_CLASS("jrectRef")); + SEXP oo = PROTECT(NEW_OBJECT(PROTECT(MAKE_CLASS("jrectRef")))); /* .. and set the slots in C .. */ if (! IS_JRECTREF(oo) ) error("unable to create an array"); - PROTECT(oo); - SET_SLOT(oo, install("jobj"), j2SEXP(env, a, 1)); - SET_SLOT(oo, install("jclass"), mkString(sig)); - SET_SLOT(oo, install("jsig"), mkString(sig)); + SET_SLOT(oo, install("jobj"), PROTECT(j2SEXP(env, a, 1))); + SET_SLOT(oo, install("jclass"), PROTECT(mkString(sig))); + SET_SLOT(oo, install("jsig"), PROTECT(mkString(sig))); SET_SLOT(oo, install("dimension"), dim); - - UNPROTECT(1); /* oo */ + + UNPROTECT(5); /* oo + slots */ return oo; } +#endif /* this does not take care of multi dimensional arrays properly */ /** - * Creates a one dimensionnal java array + * Creates a one dimensional java array * * @param an R list or vector * @param cl the class name */ REPC SEXP RcreateArray(SEXP ar, SEXP cl) { JNIEnv *env=getJNIEnv(); - + if (ar==R_NilValue) return R_NilValue; switch(TYPEOF(ar)) { - case INTSXP: + case INTSXP: { if (inherits(ar, "jbyte")) { jbyteArray a = newByteArrayI(env, INTEGER(ar), LENGTH(ar)); @@ -896,7 +931,7 @@ REPC SEXP RcreateArray(SEXP ar, SEXP cl) { } else if (inherits(ar, "jchar")) { jcharArray a = newCharArrayI(env, INTEGER(ar), LENGTH(ar)); if (!a) error("unable to create a char array"); - return new_jarrayRef(env, a, "[C" ); + return new_jarrayRef(env, a, "[C" ); } else if (inherits(ar, "jshort")) { jshortArray a = newShortArrayI(env, INTEGER(ar), LENGTH(ar)); if (!a) error("unable to create a short integer array"); @@ -931,7 +966,7 @@ REPC SEXP RcreateArray(SEXP ar, SEXP cl) { while (i < LENGTH(ar)) { SEXP sa = STRING_ELT(ar, i); if (sa != R_NaString) { - jobject so = newString(env, CHAR_UTF8(sa)); + jobject so = newJavaString(env, sa); (*env)->SetObjectArrayElement(env, a, i, so); releaseObject(env, so); } @@ -952,12 +987,12 @@ REPC SEXP RcreateArray(SEXP ar, SEXP cl) { jclass ac = javaObjectClass; const char *sigName = 0; char buf[256]; - + while (iSetObjectArrayElement(env, a, i, o); i++; } @@ -1020,7 +1055,7 @@ REPC SEXP RcreateArray(SEXP ar, SEXP cl) { /** check whether there is an exception pending and return the exception if any (NULL otherwise) */ -REPC SEXP RpollException() { +REPC SEXP RpollException(void) { JNIEnv *env=getJNIEnv(); jthrowable t; BEGIN_RJAVA_CALL @@ -1031,10 +1066,10 @@ END_RJAVA_CALL } /** clear any pending exceptions */ -REP void RclearException() { +REP void RclearException(void) { JNIEnv *env=getJNIEnv(); BEGIN_RJAVA_CALL - (*env)->ExceptionClear(env); + (*env)->ExceptionClear(env); END_RJAVA_CALL } @@ -1043,7 +1078,7 @@ REPC SEXP javaObjectCache(SEXP o, SEXP what) { error("invalid object"); if (TYPEOF(what) == RAWSXP || what == R_NilValue) { /* set PROT to the serialization of NULL */ - SETCDR(o, what); + R_SetExternalPtrProtected(o, what); return what; } if (TYPEOF(what) == LGLSXP) @@ -1061,7 +1096,7 @@ REPC SEXP RthrowException(SEXP ex) { if (!inherits(ex, "jobjRef")) error("Invalid throwable object."); - + exr=GET_SLOT(ex, install("jobj")); if (exr && TYPEOF(exr)==EXTPTRSXP) { jverify(exr); @@ -1069,7 +1104,7 @@ REPC SEXP RthrowException(SEXP ex) { } if (!t) error("Throwable must be non-null."); - + BEGIN_RJAVA_CALL tr = (*env)->Throw(env, t); END_RJAVA_CALL @@ -1077,3 +1112,24 @@ END_RJAVA_CALL INTEGER(res)[0]=tr; return res; } + +extern int existingJVMs(void); /* init.c */ + +REPC SEXP RgetJVMstate(void) { + const char *names[] = { "initialized", "state", "" }; + SEXP res = PROTECT(Rf_mkNamed(VECSXP, names)); + const char *st = "unknown"; + switch (rJava_JVM_state) { + case JVM_STATE_NONE: /* could be detached */ + st = (existingJVMs() > 0) ? "detached" : "none"; + break; + case JVM_STATE_CREATED: st = "created"; break; + case JVM_STATE_ATTACHED: st = "attached"; break; + case JVM_STATE_DEAD: st = "dead"; break; + case JVM_STATE_DESTROYED: st = "destroyed"; break; + } + SET_VECTOR_ELT(res, 0, Rf_ScalarLogical(rJava_initialized)); + SET_VECTOR_ELT(res, 1, Rf_mkString(st)); + UNPROTECT(1); + return res; +} diff --git a/src/callJNI.c b/src/callJNI.c index 24b6d8f..46a3df7 100644 --- a/src/callJNI.c +++ b/src/callJNI.c @@ -30,9 +30,9 @@ HIDE void* errJNI(const char *err, ...) { msg[511]=0; vsnprintf(msg, 511, err, ap); #ifdef RJ_DEBUG - Rf_warning(msg); + Rf_warning("%s", msg); #else - Rf_error(msg); + Rf_error("%s", msg); /* this never returns and is just a fallback in case ckx doesn't return */ #endif va_end(ap); @@ -305,6 +305,12 @@ HIDE jstring newString(JNIEnv *env, const char *cont) { return s?s:errJNI("newString(\"%s\") failed",cont); } +HIDE jstring newString16(JNIEnv *env, const jchar *cont, jsize len) { + jstring s=(*env)->NewString(env, cont, len); + _mp(MEM_PROF_OUT(" %08x LNEW string [%p,%d]\n", (int) s, cont, (int) len)) + return s?s:errJNI("newString16(%p,%d) failed", cont, (int)len); +} + HIDE void releaseObject(JNIEnv *env, jobject o) { /* Rprintf("releaseObject: %lx\n", (long)o); printObject(env, o); */ diff --git a/src/config.h.in b/src/config.h.in index 061556a..2bd7e26 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -3,20 +3,17 @@ /* define if callbacks support is enabled. */ #undef ENABLE_JRICB -/* Define to 1 if you have the declaration of `siglongjmp', and to 0 if you +/* Define to 1 if you have the declaration of 'siglongjmp', and to 0 if you don't. */ #undef HAVE_DECL_SIGLONGJMP -/* Define to 1 if you have the declaration of `sigsetjmp', and to 0 if you +/* Define to 1 if you have the declaration of 'sigsetjmp', and to 0 if you don't. */ #undef HAVE_DECL_SIGSETJMP /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - /* Define if you have POSIX.1 compatible sigsetjmp/siglongjmp. */ #undef HAVE_POSIX_SETJMP @@ -26,6 +23,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H +/* Define to 1 if you have the header file. */ +#undef HAVE_STDIO_H + /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H @@ -77,17 +77,16 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION -/* Define to 1 if you have the ANSI C header files. */ +/* Define to 1 if all of the C89 standard headers exist (not just the ones + required in a freestanding environment). This macro is provided for + backward compatibility; new code need not use it. */ #undef STDC_HEADERS /* Set if threading support should be enabled. */ #undef THREADS -/* Define to 1 if you can safely include both and . */ -#undef TIME_WITH_SYS_TIME - /* Set if headless mode is to be used when starting the JVM */ #undef USE_HEADLESS_INIT -/* Define to empty if `const' does not conform to ANSI C. */ +/* Define to empty if 'const' does not conform to ANSI C. */ #undef const diff --git a/src/fields.c b/src/fields.c index 8bfdd0c..a78f2af 100644 --- a/src/fields.c +++ b/src/fields.c @@ -22,7 +22,7 @@ static char *classToJNI(const char *cl) { if (!strcmp(cl, "short")) return strdup("S"); if (!strcmp(cl, "float")) return strdup("F"); if (!strcmp(cl, "char")) return strdup("C"); - + /* anything else is a real class -> wrap into L..; */ char *jc = malloc(strlen(cl)+3); *jc='L'; @@ -32,6 +32,77 @@ static char *classToJNI(const char *cl) { return jc; } +static SEXP R_Sym_jobj = 0; + +/* get an R object and extract Java class and Java object from it. + if it is a string of class reference then jobj will + be NULL and only the class is provided. + is_local is set to1 if the returned cls is a local reference + that needs to be released, 0 otherwise (typically if it is NULL + or comes from jclassName object) + FIXME: This is fairly generic - should we move it to tools? +*/ +static jclass inputToClass(JNIEnv *env, SEXP obj, jobject *jobj, int *is_local) { + jclass cls = 0; + jobject o = 0; + + if (is_local) + *is_local = 0; + + if (!R_Sym_jobj) + R_Sym_jobj = Rf_install("jobj"); + + /* jclassName is the result of J("class.name") and has the class object in jobj slot */ + if (inherits(obj, "jclassName")) { + obj = GET_SLOT(obj, R_Sym_jobj); + jverify(obj); /* twice wrapped: className has @jobj slot which in turn contains jobjRef to the class */ + obj = GET_SLOT(obj, R_Sym_jobj); + jverify(obj); + cls = (jclass)EXTPTR_PTR(obj); +#ifdef RJ_DEBUG + if (cls) { + rjprintf("inputToClass, class: "); printObject(env, cls); + } +#endif + } else { + char *clnam = 0; + + if (IS_JOBJREF(obj)) /* any of the jobjRef derivates */ + obj = GET_SLOT(obj, install("jobj")); + if (TYPEOF(obj) == EXTPTRSXP) { + jverify(obj); + o = (jobject)EXTPTR_PTR(obj); + } else if (TYPEOF(obj) == STRSXP && LENGTH(obj) == 1) + clnam = strdup(CHAR(STRING_ELT(obj, 0))); + else + error("invalid object parameter"); + if (!o && !clnam) + error("cannot access a NULL object"); +#ifdef RJ_DEBUG + if (o) { + rjprintf("inputToClass, object: "); printObject(env, o); + } else { + rjprintf("inputToClass, class: %s\n", clnam); + } +#endif + if (o) + cls = objectClass(env, o); + else { /* this should be rare since is doesn't provide a way to specify the class loader */ + cls = findClass(env, clnam, oClassLoader); + free(clnam); + if (!cls) { + error("cannot find class %s", CHAR(STRING_ELT(obj, 0))); + } + } + if (cls && is_local) + *is_local = 1; + } + if (jobj) + *jobj = o; + return cls; +} + + /* find field signature using reflection. Basically it is the same as: cls.getField(fnam).getType().getName() + class2JNI mangling */ @@ -74,67 +145,39 @@ REPC SEXP RgetField(SEXP obj, SEXP sig, SEXP name, SEXP trueclass) { jobject o = 0; SEXP e; const char *retsig, *fnam; - char *clnam = 0, *detsig = 0; + char *detsig = 0; jfieldID fid; jclass cls; - int tc = asInteger(trueclass); + int tc = asInteger(trueclass), cls_local = 0; JNIEnv *env=getJNIEnv(); if (obj == R_NilValue) return R_NilValue; - if ( IS_JOBJREF(obj) ) - obj = GET_SLOT(obj, install("jobj")); - if (TYPEOF(obj)==EXTPTRSXP) { - jverify(obj); - o=(jobject)EXTPTR_PTR(obj); - } else if (TYPEOF(obj)==STRSXP && LENGTH(obj)==1) - clnam = strdup(CHAR(STRING_ELT(obj, 0))); - else - error("invalid object parameter"); - if (!o && !clnam) - error("cannot access a field of a NULL object"); -#ifdef RJ_DEBUG - if (o) { - rjprintf("RgetField.object: "); printObject(env, o); - } else { - rjprintf("RgetField.class: %s\n", clnam); - } -#endif - if (o) - cls = objectClass(env, o); - else { - char *c = clnam; - while(*c) { if (*c=='/') *c='.'; c++; } - cls = findClass(env, clnam, oClassLoader); - free(clnam); - if (!cls) { - error("cannot find class %s", CHAR(STRING_ELT(obj, 0))); - } - } + cls = inputToClass(env, obj, &o, &cls_local); if (!cls) error("cannot determine object class"); #ifdef RJ_DEBUG rjprintf("RgetField.class: "); printObject(env, cls); #endif if (TYPEOF(name)!=STRSXP || LENGTH(name)!=1) { - releaseObject(env, cls); + if (cls_local) releaseObject(env, cls); error("invalid field name"); } fnam = CHAR(STRING_ELT(name,0)); if (sig == R_NilValue) { retsig = detsig = findFieldSignature(env, cls, fnam); if (!retsig) { - releaseObject(env, cls); + if (cls_local) releaseObject(env, cls); error("unable to detect signature for field '%s'", fnam); } } else { if (TYPEOF(sig)!=STRSXP || LENGTH(sig)!=1) { - releaseObject(env, cls); + if (cls_local) releaseObject(env, cls); error("invalid signature parameter"); } retsig = CHAR(STRING_ELT(sig,0)); } _dbg(rjprintf("field %s signature is %s\n",fnam,retsig)); - + if (o) { /* first try non-static fields */ fid = (*env)->GetFieldID(env, cls, fnam, retsig); checkExceptionsX(env, 1); @@ -147,7 +190,7 @@ REPC SEXP RgetField(SEXP obj, SEXP sig, SEXP name, SEXP trueclass) { if (!fid) { checkExceptionsX(env, 1); - releaseObject(env, cls); + if (cls_local) releaseObject(env, cls); if (detsig) free(detsig); error("RgetField: field %s not found", fnam); } @@ -158,7 +201,7 @@ REPC SEXP RgetField(SEXP obj, SEXP sig, SEXP name, SEXP trueclass) { (*env)->GetStaticIntField(env, cls, fid); e = allocVector(INTSXP, 1); INTEGER(e)[0] = r; - releaseObject(env, cls); + if (cls_local) releaseObject(env, cls); if (detsig) free(detsig); return e; } @@ -168,7 +211,7 @@ REPC SEXP RgetField(SEXP obj, SEXP sig, SEXP name, SEXP trueclass) { (*env)->GetStaticShortField(env, cls, fid); e = allocVector(INTSXP, 1); INTEGER(e)[0] = r; - releaseObject(env, cls); + if (cls_local) releaseObject(env, cls); if (detsig) free(detsig); return e; } @@ -178,7 +221,7 @@ REPC SEXP RgetField(SEXP obj, SEXP sig, SEXP name, SEXP trueclass) { (*env)->GetStaticCharField(env, cls, fid)); e = allocVector(INTSXP, 1); INTEGER(e)[0] = r; - releaseObject(env, cls); + if (cls_local) releaseObject(env, cls); if (detsig) free(detsig); return e; } @@ -188,7 +231,7 @@ REPC SEXP RgetField(SEXP obj, SEXP sig, SEXP name, SEXP trueclass) { (*env)->GetStaticByteField(env, cls, fid)); e = allocVector(INTSXP, 1); INTEGER(e)[0] = r; - releaseObject(env, cls); + if (cls_local) releaseObject(env, cls); if (detsig) free(detsig); return e; } @@ -198,7 +241,7 @@ REPC SEXP RgetField(SEXP obj, SEXP sig, SEXP name, SEXP trueclass) { (*env)->GetStaticLongField(env, cls, fid); e = allocVector(REALSXP, 1); REAL(e)[0] = (double)r; - releaseObject(env, cls); + if (cls_local) releaseObject(env, cls); if (detsig) free(detsig); return e; } @@ -208,7 +251,7 @@ REPC SEXP RgetField(SEXP obj, SEXP sig, SEXP name, SEXP trueclass) { (*env)->GetStaticBooleanField(env, cls, fid); e = allocVector(LGLSXP, 1); LOGICAL(e)[0] = r?1:0; - releaseObject(env, cls); + if (cls_local) releaseObject(env, cls); if (detsig) free(detsig); return e; } @@ -218,7 +261,7 @@ REPC SEXP RgetField(SEXP obj, SEXP sig, SEXP name, SEXP trueclass) { (*env)->GetStaticDoubleField(env, cls, fid); e = allocVector(REALSXP, 1); REAL(e)[0] = r; - releaseObject(env, cls); + if (cls_local) releaseObject(env, cls); if (detsig) free(detsig); return e; } @@ -228,7 +271,7 @@ REPC SEXP RgetField(SEXP obj, SEXP sig, SEXP name, SEXP trueclass) { (*env)->GetStaticFloatField(env, cls, fid)); e = allocVector(REALSXP, 1); REAL(e)[0] = r; - releaseObject(env, cls); + if (cls_local) releaseObject(env, cls); if (detsig) free(detsig); return e; } @@ -239,12 +282,12 @@ REPC SEXP RgetField(SEXP obj, SEXP sig, SEXP name, SEXP trueclass) { (*env)->GetObjectField(env, o, fid): (*env)->GetStaticObjectField(env, cls, fid); _mp(MEM_PROF_OUT(" %08x LNEW field value\n", (int) r)) - releaseObject(env, cls); + if (cls_local) releaseObject(env, cls); if (tc) { if (detsig) free(detsig); return new_jobjRef(env, r, 0); } - if (*retsig=='L') { /* need to fix the class name */ + if (*retsig=='L') { /* need to fix the class name */ char *d = strdup(retsig), *c = d; while (*c) { if (*c==';') { *c=0; break; }; c++; } rv = new_jobjRef(env, r, d+1); @@ -255,7 +298,7 @@ REPC SEXP RgetField(SEXP obj, SEXP sig, SEXP name, SEXP trueclass) { return rv; } } /* switch */ - releaseObject(env, cls); + if (cls_local) releaseObject(env, cls); if (detsig) { free(detsig); error("unknown field signature"); @@ -269,44 +312,17 @@ REPC SEXP RsetField(SEXP ref, SEXP name, SEXP value) { SEXP obj = ref; const char *fnam; sig_buffer_t sig; - char *clnam = 0; jfieldID fid; jclass cls; jvalue jval; + int cls_local = 0; JNIEnv *env=getJNIEnv(); if (TYPEOF(name)!=STRSXP && LENGTH(name)!=1) error("invalid field name"); fnam = CHAR(STRING_ELT(name, 0)); if (obj == R_NilValue) error("cannot set a field of a NULL object"); - if (IS_JOBJREF(obj)) - obj = GET_SLOT(obj, install("jobj")); - if (TYPEOF(obj)==EXTPTRSXP) { - jverify(obj); - o=(jobject)EXTPTR_PTR(obj); - } else if (TYPEOF(obj)==STRSXP && LENGTH(obj)==1) - clnam = strdup(CHAR(STRING_ELT(obj, 0))); - else - error("invalid object parameter"); - if (!o && !clnam) - error("cannot set a field of a NULL object"); -#ifdef RJ_DEBUG - if (o) { - rjprintf("RsetField.object: "); printObject(env, o); - } else { - rjprintf("RsetField.class: %s\n", clnam); - } -#endif - if (o) - cls = objectClass(env, o); - else { - char *c = clnam; - while(*c) { if (*c=='/') *c='.'; c++; } - cls = findClass(env, clnam, oClassLoader); - if (!cls) { - error("cannot find class %s", CHAR(STRING_ELT(obj, 0))); - } - } + cls = inputToClass(env, obj, &o, &cls_local); if (!cls) error("cannot determine object class"); #ifdef RJ_DEBUG @@ -314,7 +330,7 @@ REPC SEXP RsetField(SEXP ref, SEXP name, SEXP value) { #endif init_sigbuf(&sig); jval = R1par2jvalue(env, value, &sig, &otr); - + if (o) { fid = (*env)->GetFieldID(env, cls, fnam, sig.sig); if (!fid) { @@ -326,7 +342,7 @@ REPC SEXP RsetField(SEXP ref, SEXP name, SEXP value) { fid = (*env)->GetStaticFieldID(env, cls, fnam, sig.sig); if (!fid) { checkExceptionsX(env, 1); - releaseObject(env, cls); + if (cls_local) releaseObject(env, cls); if (otr) releaseObject(env, otr); done_sigbuf(&sig); error("cannot find field %s with signature %s", fnam, sig.sigbuf); @@ -370,13 +386,13 @@ REPC SEXP RsetField(SEXP ref, SEXP name, SEXP value) { (*env)->SetStaticObjectField(env, cls, fid, jval.l); break; default: - releaseObject(env, cls); + if (cls_local) releaseObject(env, cls); if (otr) releaseObject(env, otr); done_sigbuf(&sig); - error("unknown field sighanture %s", sig.sigbuf); + error("unknown field siganture %s", sig.sigbuf); } done_sigbuf(&sig); - releaseObject(env, cls); + if (cls_local) releaseObject(env, cls); if (otr) releaseObject(env, otr); return ref; } diff --git a/src/init.c b/src/init.c index 091a29e..d44d92d 100644 --- a/src/init.c +++ b/src/init.c @@ -9,6 +9,9 @@ JavaVM *jvm; /* this will be set when Java tries to exit() but we carry on */ int java_is_dead = 0; +/* current JVM state */ +int rJava_JVM_state = JVM_STATE_NONE; + /* cached, global objects */ jclass javaStringClass; @@ -40,10 +43,10 @@ int rJava_initialized = 0; static int jvm_opts=0; static char **jvm_optv=0; -#ifdef JNI_VERSION_1_2 +#ifdef JNI_VERSION_1_2 static JavaVMOption *vm_options; static JavaVMInitArgs vm_args; -#else +#else #error "Java/JNI 1.2 or higher is required!" #endif @@ -78,6 +81,7 @@ static int JNICALL vfprintf_hook(FILE *f, const char *fmt, va_list ap) { static void JNICALL exit_hook(int status) { /* REprintf("\nJava requested System.exit(%d), trying to raise R error - this may crash if Java is in a bad state.\n", status); */ java_is_dead = 1; + rJava_JVM_state = JVM_STATE_DEAD; Rf_error("Java called System.exit(%d) requesting R to quit - trying to recover", status); /* FIXME: we could do something smart here such as running a call-back into R ... jump into R event loop ... at any rate we cannot return, @@ -85,48 +89,84 @@ static void JNICALL exit_hook(int status) { exit(status); } +int existingJVMs(void) { + jsize vms = 0; + JavaVM *jvms[32]; + return (JNI_GetCreatedJavaVMs(jvms, 32, &vms) >= 0) ? vms : 0; +} + /* in reality WIN64 implies WIN32 but to make sure ... */ #if defined(_WIN64) || defined(_WIN32) #include #include #endif -static int initJVM(const char *user_classpath, int opts, char **optv, int hooks) { - int total_num_properties, propNum = 0; +/* disableGuardPages - nonzero when the VM should be initialized with + experimental option to disable primordial thread guard pages. If the + VM fails to initialize for any reason, including because it does not + support this option, -2 is returned; this feature is relevant to Oracle + JVM version 10 and above on Linux; only used with JVM_STACK_WORKAROUND */ +static int initJVM(const char *user_classpath, int opts, char **optv, int hooks, + int disableGuardPages) { + int total_num_properties, propNum = 0, add_Xss = 1; jint res; char *classpath; - + if(!user_classpath) /* use the CLASSPATH environment variable as default */ user_classpath = getenv("CLASSPATH"); if(!user_classpath) user_classpath = ""; - + vm_args.version = JNI_VERSION_1_2; if(JNI_GetDefaultJavaVMInitArgs(&vm_args) != JNI_OK) { error("JNI 1.2 or higher is required"); - return -1; + return -1; + } + + vm_args.version = JNI_VERSION_1_2; /* should we do that or keep the default? */ + + /* quick pre-check whether there is a chance that primordial thread guard + pages may be disabled */ +#ifndef JNI_VERSION_10 + /* the binary can be compiled against older JVM includes, + but run with a new JDK, so we cannot assume absence of the define + to mean anything. Hence we define it according to the current specs. */ +#define JNI_VERSION_10 0x000a0000 +#endif + if (disableGuardPages) { + vm_args.version = JNI_VERSION_10; + if(JNI_GetDefaultJavaVMInitArgs(&vm_args) != JNI_OK) + return -2; + vm_args.version = JNI_VERSION_10; /* probably not needed */ } - + /* leave room for class.path, and optional jni args */ - total_num_properties = 6 + opts; - + total_num_properties = 8 + opts; + vm_options = (JavaVMOption *) calloc(total_num_properties, sizeof(JavaVMOption)); - vm_args.version = JNI_VERSION_1_2; /* should we do that or keep the default? */ vm_args.options = vm_options; - vm_args.ignoreUnrecognized = JNI_TRUE; - + vm_args.ignoreUnrecognized = disableGuardPages ? JNI_FALSE : JNI_TRUE; + classpath = (char*) calloc(24 + strlen(user_classpath), sizeof(char)); - sprintf(classpath, "-Djava.class.path=%s", user_classpath); - - vm_options[propNum++].optionString = classpath; - + if (!classpath) + error("Cannot allocate memory for classpath"); + snprintf(classpath, (24 + strlen(user_classpath)) * sizeof(char), "-Djava.class.path=%s", user_classpath); + + vm_options[propNum++].optionString = classpath; + /* print JNI-related messages */ /* vm_options[propNum++].optionString = "-verbose:class,jni"; */ - + if (optv) { - int i=0; - while (iFindClass(env, "java/lang/String"); if (!c) error("unable to find the basic String class"); javaStringClass=(*env)->NewGlobalRef(env, c); @@ -236,17 +289,17 @@ HIDE void init_rJava(void) { mid_forName = (*env)->GetStaticMethodID(env, javaClassClass, "forName", "(Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class;"); if (!mid_forName) error("cannot obtain Class.forName method ID"); - + mid_getName = (*env)->GetMethodID(env, javaClassClass, "getName", "()Ljava/lang/String;"); if (!mid_getName) error("cannot obtain Class.getName method ID"); - + mid_getSuperclass =(*env)->GetMethodID(env, javaClassClass, "getSuperclass", "()Ljava/lang/Class;"); if (!mid_getSuperclass) error("cannot obtain Class.getSuperclass method ID"); - + mid_getField = (*env)->GetMethodID(env, javaClassClass, "getField", "(Ljava/lang/String;)Ljava/lang/reflect/Field;"); if (!mid_getField) error("cannot obtain Class.getField method ID"); - + mid_getType = (*env)->GetMethodID(env, javaFieldClass, "getType", "()Ljava/lang/Class;"); if (!mid_getType) error("cannot obtain Field.getType method ID"); @@ -254,18 +307,21 @@ HIDE void init_rJava(void) { rJava_initialized = 1; } - -static SEXP RinitJVM_real(SEXP par) +/* disableGuardPages - attempt to disable primordial thread guard pages, + see initJVM(); if the VM fails to initialize for any reason including + that disabling is not supported, NULL (C level) is returned; + disableGuardPages is ignored with THREADS. */ +static SEXP RinitJVM_real(SEXP par, int disableGuardPages) { const char *c=0; SEXP e=CADR(par); int r=0; JavaVM *jvms[32]; jsize vms=0; - + jvm_opts=0; jvm_optv=0; - + if (TYPEOF(e)==STRSXP && LENGTH(e)>0) c=CHAR(STRING_ELT(e,0)); @@ -305,7 +361,7 @@ static SEXP RinitJVM_real(SEXP par) } if (jvm_opts) jvm_optv[jvm_opts] = 0; - + r=JNI_GetCreatedJavaVMs(jvms, 32, &vms); if (r) { Rf_error("JNI_GetCreatedJavaVMs returned %d\n", r); @@ -316,7 +372,10 @@ static SEXP RinitJVM_real(SEXP par) while (iAttachCurrentThread(jvms[i], (void**)&eenv, NULL)) { - _dbg(rjprintf("RinitJVM: Attached to existing JVM #%d.\n", i+1)); + /* attaching our own created JVM doesn't change it to attached */ + if (rJava_JVM_state != JVM_STATE_CREATED) + rJava_JVM_state = JVM_STATE_ATTACHED; + _dbg(rjprintf("RinitJVM: Attached to existing JVM #%d.\n", i+1)); break; } } @@ -348,11 +407,19 @@ static SEXP RinitJVM_real(SEXP par) _dbg(rjprintf("RinitJVM(threads): attach\n")); /* since JVM was initialized by another thread, we need to attach ourselves */ (*jvm)->AttachCurrentThread(jvm, (void**)&eenv, NULL); + if (rJava_JVM_state != JVM_STATE_CREATED) + rJava_JVM_state = JVM_STATE_ATTACHED; _dbg(rjprintf("RinitJVM(threads): done.\n")); r = thInitResult; #else profStart(); - r=initJVM(c, jvm_opts, jvm_optv, default_hooks); + r=initJVM(c, jvm_opts, jvm_optv, default_hooks, disableGuardPages); + if (disableGuardPages && r==-2) { + _dbg(rjprintf("RinitJVM(non-threaded): cannot disable guard pages\n")); + if (jvm_optv) free(jvm_optv); + jvm_opts=0; + return NULL; + } init_rJava(); _prof(profReport("init_rJava:")); _dbg(rjprintf("RinitJVM(non-threaded): initJVM returned %d\n", r)); @@ -390,6 +457,11 @@ static SEXP RinitJVM_real(SEXP par) is claimed to be a workaround for issues in RH7.2. The problem is still present in JVM 9. Moreover, on Linux the JVM inserts guard pages also based on the setting of -Xss. + + As of Java 10, Oracle JVM allows to disable these guard pages via + an experimental VM option -XX:+DisablePrimordialThreadGuardPages. This is + by default tried first, and only if it fails, the machinery of filling up + slightly the C stack is attempted as described above. */ #undef JVM_STACK_WORKAROUND @@ -425,7 +497,7 @@ extern int R_CStackDir; bound is the new first address not to access dir is 1 (stack grows up) or -1 (stack grows down, the usual) so, incrementing by dir one traverses from stack start, from the oldest - things on the stace; note that in R_CStackDir, 1 means stack grows down + things on the stack; note that in R_CStackDir, 1 means stack grows down returns NULL in case of error, limit when no new limit is found, a new limit when found @@ -460,7 +532,7 @@ static char* findBound(char *from, char *limit, int dir) _exit(0); } else { /* Parent process, writes data to the pipe looking for EFAULT error which - indicates an inaccesible page. For performance, the reading is first + indicates an inaccessible page. For performance, the reading is first done using a buffer (of the size of a page), but once EFAULT is reached, it is re-tried byte-by-byte for the last buffer not read successfully. */ @@ -502,14 +574,14 @@ static char* findBound(char *from, char *limit, int dir) than allocating large arrays on the C stack, both via definition and alloca. */ static SEXP RinitJVM_with_padding(SEXP par, intptr_t padding, char *last) { - char dummy[1]; + volatile char dummy[1]; /* reduce the risk that dummy will be optimized out */ dummy[0] = (char) (uintptr_t) &dummy; padding -= (last - dummy) * R_CStackDir; if (padding <= 0) - return RinitJVM_real(par); + return RinitJVM_real(par, 0); else - return RinitJVM_with_padding(par, padding, dummy); + return RinitJVM_with_padding(par, padding, (char*) dummy); } /* Run RinitJVM with the Java stack workaround */ @@ -527,6 +599,7 @@ static SEXP RinitJVM_jsw(SEXP par) { #define JSW_DETECT 1 #define JSW_ADJUST 2 #define JSW_PREVENT 3 + #define JSW_JAVA10 4 #define JSW_PADDING 2*1024*1024 #define JSW_CHECK_BOUND 16*1024*1024 @@ -534,18 +607,40 @@ static SEXP RinitJVM_jsw(SEXP par) { /* 0 - disabled 1 - detect guard pages 2 - detect guard pages and adjust R stack size - 3 - prevent guard page creation, detect, and adjust */ - int val = JSW_PREVENT; + 3 - prevent guard page creation, detect, and adjust + 4 - try to use JAVA10 feature to disable guard pages, (3) if it fails */ + int val = JSW_JAVA10; char *vval = getenv("RJAVA_JVM_STACK_WORKAROUND"); if (vval != NULL) val = atoi(vval); - if (val < 0 || val > 3) + if (val < 0 || val > 4) error("Invalid value for RJAVA_JVM_STACK_WORKAROUND"); _dbg(rjprintf("JSW workaround: (level %d)\n", val)); + /* before we get anywhere, check whether we're inside a running JVM already */ + { + JavaVM *jvms[32]; + jsize vms = 0; + int r = JNI_GetCreatedJavaVMs(jvms, 32, &vms); + if (r == 0 && vms > 0) { + _dbg(rjprintf("JSW workaround: detected running VMs, disabling work-around.")); + return RinitJVM_real(par, 0); + } + } + + if (val == JSW_JAVA10) { + /* try to use Java 10 experimental option to disable guard pages */ + SEXP res = RinitJVM_real(par, 1); + if (res != NULL) { + _dbg(rjprintf("JSW workaround: disabled guard pages\n", val)); + return res; + } + val = JSW_PREVENT; + } + if (val == JSW_DISABLED) - return RinitJVM_real(par); + return RinitJVM_real(par, 0); /* Figure out the original stack limit */ uintptr_t rlimsize = 0; @@ -636,7 +731,7 @@ static SEXP RinitJVM_jsw(SEXP par) { /* the message may be confusing when R_CStackLimit was set to -1 because the original stack size was too large */ REprintf("Rjava.init.warning: stack size reduced from unlimited to" - " %u bytes after JVM initialization.\n", newlim); + " %lu bytes after JVM initialization.\n", (unsigned long) newlim); bigloss = 1; } else { unsigned lost = (unsigned) (oldlim - newlim); @@ -667,68 +762,68 @@ static SEXP RinitJVM_jsw(SEXP par) { REP SEXP RinitJVM(SEXP par) { #ifndef JVM_STACK_WORKAROUND - return RinitJVM_real(par); + return RinitJVM_real(par, 0); #else return RinitJVM_jsw(par); #endif } -REP void doneJVM() { +REP void doneJVM(void) { (*jvm)->DestroyJavaVM(jvm); jvm = 0; eenv = 0; + rJava_JVM_state = JVM_STATE_DESTROYED; } /** * Initializes the cached values of classes and methods used internally * These classes and methods are the ones that are in rJava (RJavaTools, ...) * not java standard classes (Object, Class) - */ -REPC SEXP initRJavaTools(){ + */ +REPC SEXP initRJavaTools(void){ JNIEnv *env=getJNIEnv(); - jclass c; - + jclass c; + /* classes */ - + /* RJavaTools class */ c = findClass(env, "RJavaTools", oClassLoader); if (!c) error("unable to find the RJavaTools class"); rj_RJavaTools_Class=(*env)->NewGlobalRef(env, c); if (!rj_RJavaTools_Class) error("unable to create a global reference to the RJavaTools class"); (*env)->DeleteLocalRef(env, c); - + /* RJavaImport */ - c = findClass(env, "RJavaImport", oClassLoader); + c = findClass(env, "RJavaImport", oClassLoader); if (!c) error("unable to find the RJavaImport class"); rj_RJavaImport_Class=(*env)->NewGlobalRef(env, c); if (!rj_RJavaImport_Class) error("unable to create a global reference to the RJavaImport class"); (*env)->DeleteLocalRef(env, c); - - + + /* methods */ - - mid_RJavaTools_getFieldTypeName = (*env)->GetStaticMethodID(env, rj_RJavaTools_Class, + + mid_RJavaTools_getFieldTypeName = (*env)->GetStaticMethodID(env, rj_RJavaTools_Class, "getFieldTypeName", "(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/String;"); if (!mid_RJavaTools_getFieldTypeName) error("cannot obtain RJavaTools.getFieldTypeName method ID"); - - mid_rj_getSimpleClassNames = (*env)->GetStaticMethodID(env, rj_RJavaTools_Class, + + mid_rj_getSimpleClassNames = (*env)->GetStaticMethodID(env, rj_RJavaTools_Class, "getSimpleClassNames", "(Ljava/lang/Object;Z)[Ljava/lang/String;"); if (!mid_rj_getSimpleClassNames) error("cannot obtain RJavaTools.getDimpleClassNames method ID"); - - mid_RJavaImport_getKnownClasses = (*env)->GetMethodID(env, rj_RJavaImport_Class, + + mid_RJavaImport_getKnownClasses = (*env)->GetMethodID(env, rj_RJavaImport_Class, "getKnownClasses", "()[Ljava/lang/String;"); if (!mid_RJavaImport_getKnownClasses) error("cannot obtain RJavaImport.getKnownClasses method ID"); - - mid_RJavaImport_lookup = (*env)->GetMethodID(env, rj_RJavaImport_Class, + + mid_RJavaImport_lookup = (*env)->GetMethodID(env, rj_RJavaImport_Class, "lookup", "(Ljava/lang/String;)Ljava/lang/Class;"); if( !mid_RJavaImport_lookup) error("cannot obtain RJavaImport.lookup method ID"); - - mid_RJavaImport_exists = (*env)->GetMethodID(env, rj_RJavaImport_Class, + + mid_RJavaImport_exists = (*env)->GetMethodID(env, rj_RJavaImport_Class, "exists", "(Ljava/lang/String;)Z"); if( ! mid_RJavaImport_exists ) error("cannot obtain RJavaImport.exists method ID"); // maybe add RJavaArrayTools, ... - - return R_NilValue; -} + return R_NilValue; +} diff --git a/src/java/DummyPoint.java b/src/java/DummyPoint.java index 9407bd9..5870b0f 100644 --- a/src/java/DummyPoint.java +++ b/src/java/DummyPoint.java @@ -16,5 +16,7 @@ public void move(int x, int y){ this.x += x ; this.y += y ; } - + public Object clone() { + return new DummyPoint(x, y); + } } diff --git a/src/java/Makefile b/src/java/Makefile index 4ac3e6a..cef4fed 100644 --- a/src/java/Makefile +++ b/src/java/Makefile @@ -1,5 +1,8 @@ JAVA_SRC=$(wildcard *.java) -JFLAGS=-source 1.6 -target 1.6 +ifeq ($(JTARGET),) +JTARGET:=$(shell for i in 1.6 8 11 17; do if javac -source $$i -target $$i RJavaTools.java >/dev/null 2>&1; then echo $$i; break; fi; done) +endif +JFLAGS=-source $(JTARGET) -target $(JTARGET) JAVAC=javac JAVA=java JAVADOC=javadoc diff --git a/src/java/RJavaArrayIterator.java b/src/java/RJavaArrayIterator.java index 3b0df62..c5c3789 100644 --- a/src/java/RJavaArrayIterator.java +++ b/src/java/RJavaArrayIterator.java @@ -71,6 +71,7 @@ protected Object next( ){ index[i] = 0 ; } else{ index[i] = index[i] + 1 ; + break; } } diff --git a/src/java/RJavaArrayTools.java b/src/java/RJavaArrayTools.java index 6f1098a..6ccbced 100644 --- a/src/java/RJavaArrayTools.java +++ b/src/java/RJavaArrayTools.java @@ -633,19 +633,25 @@ public static Object[] rep( Object o, int size ) throws Throwable { Method m = getCloneMethod( o.getClass() ) ; boolean access = m.isAccessible() ; - m.setAccessible( true ) ; + if (!access) { + try { + m.setAccessible( true ) ; + } catch (Throwable e) { + access = true; /* give up */ + } + } + try{ for( int i=0; i 0 && !rjd.equals("0")) verbose = true; - if (verbose) System.out.println("RJavaClassLoader(\""+path+"\",\""+libpath+"\")"); + if (verbose) System.out.println("RJavaClassLoader(\""+path+"\", \""+libpath+"\", "+ ((parent == null) ? "no parent" : parent) + ")"); if (primaryLoader==null) { primaryLoader = this; if (verbose) System.out.println(" - primary loader"); } else { if (verbose) System.out.println(" - NOT primrary (this="+this+", primary="+primaryLoader+")"); } + libMap = new HashMap/**/(); classPath = new Vector/**/(); @@ -378,8 +391,8 @@ protected Class findClass(String name) throws ClassNotFoundException { throw (new ClassNotFoundException("Class not found - candidate class binary found but could not be loaded", defineException)); // giving up - if( verbose ) System.out.println(" >> ClassNotFoundException "); if (cl == null) { + if( verbose ) System.out.println(" >> ClassNotFoundException "); throw (new ClassNotFoundException()); } return cl; @@ -560,14 +573,13 @@ public static String u2w(String fn) { /** * main method * - *

This uses the system properties: + *

This uses the system properties:

*
    *
  • rjava.path : path of the rJava package
  • *
  • rjava.lib : lib sub directory of the rJava package
  • *
  • main.class : main class to "boot", assumes Main if not specified
  • *
  • rjava.class.path : set of paths to populate the initiate the class path
  • *
- *

* *

and boots the "main" method of the specified main.class, * passing the args down to the booted class

diff --git a/src/java/RJavaComparator.java b/src/java/RJavaComparator.java index 30e3f14..0614e4b 100644 --- a/src/java/RJavaComparator.java +++ b/src/java/RJavaComparator.java @@ -28,8 +28,8 @@ public static int compare( Object a, Object b ) throws NotComparableException{ // treat Number s separately if( a instanceof Number && b instanceof Number && !( a.getClass() == b.getClass() ) ){ - Double _a = new Double( ((Number)a).doubleValue() ); - Double _b = new Double( ((Number)b).doubleValue() ); + Double _a = Double.valueOf( ((Number)a).doubleValue() ); + Double _b = Double.valueOf( ((Number)b).doubleValue() ); return _a.compareTo( _b ); } diff --git a/src/java/RJavaTools.java b/src/java/RJavaTools.java index f6f3424..3b52c85 100644 --- a/src/java/RJavaTools.java +++ b/src/java/RJavaTools.java @@ -345,7 +345,13 @@ public static Object newInstance( Class o_clazz, Object[] args, Class[] clazzes /* enforcing accessibility (workaround for bug 128) */ boolean access = cons.isAccessible(); - cons.setAccessible( true ); + if (!access) { + try { /* since JDK-17 this may fail */ + cons.setAccessible( true ); + } catch (Throwable e) { + access = true; /* nothing we can do, just let it fail below */ + } + } Object o; try{ @@ -354,7 +360,8 @@ public static Object newInstance( Class o_clazz, Object[] args, Class[] clazzes /* the target exception is much more useful than the reflection wrapper */ throw e.getTargetException() ; } finally{ - cons.setAccessible( access ); + if (!access) + cons.setAccessible( access ); } return o; } @@ -378,8 +385,14 @@ public static Object invokeMethod( Class o_clazz, Object o, String name, Object[ Method m = getMethod( o_clazz, name, clazzes, arg_is_null(args) ); /* enforcing accessibility (workaround for bug 128) */ - boolean access = m.isAccessible(); - m.setAccessible( true ); + boolean access = m.isAccessible(); + if (!access) { + try { /* since JDK-17 this may fail */ + m.setAccessible( true ); + } catch (Throwable e) { + access = true; /* nothing we can do, fail later with proper error ... */ + } + } Object out; try{ @@ -388,7 +401,8 @@ public static Object invokeMethod( Class o_clazz, Object o, String name, Object[ /* the target exception is much more useful than the reflection wrapper */ throw e.getTargetException() ; } finally{ - m.setAccessible( access ); + if (!access) + m.setAccessible( access ); } return out ; } diff --git a/src/java/RJavaTools_Test.java b/src/java/RJavaTools_Test.java index 0d33384..2b67716 100644 --- a/src/java/RJavaTools_Test.java +++ b/src/java/RJavaTools_Test.java @@ -767,7 +767,8 @@ private static void invokemethod() throws TestException{ try{ Object o = RJavaTools.invokeMethod( set.getClass(), set, "iterator", (Object[])null, (Class[])null ); } catch( Throwable e){ - throw new TestException( "not able to enforce accessibility" ) ; + System.out.println(" : FAILED (expected for JDK-17 and above)"); + return; } System.out.println( " : ok " ) ; // }}} diff --git a/jri/LGPL.txt b/src/jri/LGPL.txt similarity index 100% rename from jri/LGPL.txt rename to src/jri/LGPL.txt diff --git a/jri/LICENSE b/src/jri/LICENSE similarity index 100% rename from jri/LICENSE rename to src/jri/LICENSE diff --git a/jri/Makefile.all b/src/jri/Makefile.all similarity index 97% rename from jri/Makefile.all rename to src/jri/Makefile.all index ad56e5e..2774eeb 100644 --- a/jri/Makefile.all +++ b/src/jri/Makefile.all @@ -11,8 +11,6 @@ EX_JAVA=$(wildcard examples/*.java) EX_CLASS=$(EX_JAVA:%.java=%.class) -JFLAGS+=-target 1.6 -source 1.6 - TARGETS=src/JRI.jar $(JRILIB) $(EX_CLASS) all: $(TARGETS) @@ -45,3 +43,4 @@ doc: $(JRI_JDOCSRC) .PHONY: clean all examples doc +.NOTPARALLEL: diff --git a/jri/Makefile.in b/src/jri/Makefile.in similarity index 95% rename from jri/Makefile.in rename to src/jri/Makefile.in index 7ccbfca..8d806d1 100644 --- a/jri/Makefile.in +++ b/src/jri/Makefile.in @@ -7,6 +7,7 @@ RHOME=@R_HOME@ JAVAC=@JAVAC@ JAVAH=@JAVAH@ JAVA=@JAVA_PROG@ +JFLAGS=@JFLAGS@ JRILIB=@JNIPREFIX@jri@JNISO@ diff --git a/jri/Makefile.win b/src/jri/Makefile.win similarity index 100% rename from jri/Makefile.win rename to src/jri/Makefile.win diff --git a/jri/Makevars.win b/src/jri/Makevars.win similarity index 94% rename from jri/Makevars.win rename to src/jri/Makevars.win index 24a7a15..64047b5 100644 --- a/jri/Makevars.win +++ b/src/jri/Makevars.win @@ -9,7 +9,6 @@ CFLAGS+=-DWin32 -D_JNI_IMPLEMENTATION_ JAVA_PROG=$(JAVAHOME)/bin/java JAVA=$(JAVAHOME)/bin/java JAVAC=$(JAVAHOME)/bin/javac -JAVAH=$(JAVAHOME)/bin/javah JAR=$(JAVAHOME)/bin/jar JRIDEPS=win32/libjvm.dll.a JNIPREFIX= diff --git a/jri/Mutex.java b/src/jri/Mutex.java similarity index 100% rename from jri/Mutex.java rename to src/jri/Mutex.java diff --git a/jri/NEWS b/src/jri/NEWS similarity index 100% rename from jri/NEWS rename to src/jri/NEWS diff --git a/jri/RBool.java b/src/jri/RBool.java similarity index 100% rename from jri/RBool.java rename to src/jri/RBool.java diff --git a/jri/RConsoleOutputStream.java b/src/jri/RConsoleOutputStream.java similarity index 100% rename from jri/RConsoleOutputStream.java rename to src/jri/RConsoleOutputStream.java diff --git a/jri/README b/src/jri/README similarity index 100% rename from jri/README rename to src/jri/README diff --git a/jri/REXP.java b/src/jri/REXP.java similarity index 100% rename from jri/REXP.java rename to src/jri/REXP.java diff --git a/src/jri/REngine b/src/jri/REngine new file mode 160000 index 0000000..4455acb --- /dev/null +++ b/src/jri/REngine @@ -0,0 +1 @@ +Subproject commit 4455acba2ec859bc3e51df285e54ff40d823271d diff --git a/jri/RFactor.java b/src/jri/RFactor.java similarity index 97% rename from jri/RFactor.java rename to src/jri/RFactor.java index a217f8a..71342aa 100644 --- a/jri/RFactor.java +++ b/src/jri/RFactor.java @@ -39,7 +39,7 @@ public RFactor(int[] i, String[] v) { int j; if (i!=null && i.length>0) for(j=0;j0) for(j=0;j Important note: All methods starting with rni (R Native Interface) are low-level native methods that should be avoided if a high-level methods exists. They do NOT attempt any synchronization, so it is the duty of the calling program to ensure that the invocation is safe (see {@link #getRsync()} for details). At some point in the future when the high-level API is complete they should become private. However, currently this high-level layer is not complete, so they are available for now.

All rni methods use long type to reference SEXPs on R side. Those reference should never be modified or used in arithmetics - the only reason for not using an extra interface class to wrap those references is that rni methods are all native methods and therefore it would be too expensive to handle the unwrapping on the C side.

jri methods are called internally by R and invoke the corresponding method from the even loop handler. Those methods should usualy not be called directly. +/** Rengine class is the interface between an instance of R and the Java VM. Due to the fact that R has no threading support, you can run only one instance of R withing a multi-threaded application. There are two ways to use R from Java: individual call and full event loop. See the Rengine {@link #Rengine constructor} for details.

Important note: All methods starting with rni (R Native Interface) are low-level native methods that should be avoided if a high-level methods exists. They do NOT attempt any synchronization, so it is the duty of the calling program to ensure that the invocation is safe (see {@link #getRsync()} for details). At some point in the future when the high-level API is complete they should become private. However, currently this high-level layer is not complete, so they are available for now.

All rni methods use long type to reference SEXPs on R side. Those reference should never be modified or used in arithmetics - the only reason for not using an extra interface class to wrap those references is that rni methods are all native methods and therefore it would be too expensive to handle the unwrapping on the C side.

jri methods are called internally by R and invoke the corresponding method from the even loop handler. Those methods should usually not be called directly. -

Since 0.5 a failure to load the JRI naitve library will not be fatal if jri.ignore.ule=yes system preference is set. Rengine will still not work, but that gives a chance to GUI programs to report the error in a more meaningful way (use {@link #jriLoaded} to check the availability of JRI). +

Since 0.5 a failure to load the JRI naitve library will not be fatal if jri.ignore.ule=yes system preference is set. Rengine will still not work, but that gives a chance to GUI programs to report the error in a more meaningful way (use {@link #jriLoaded} to check the availability of JRI). */ public class Rengine extends Thread { - /** this flags is set to true if the native code was successfully loaded. If this flag is false then none of the rni methods are available. Previous + /** this flags is set to true if the native code was successfully loaded. If this flag is false then none of the rni methods are available. Previous @since API 1.9, JRI 0.5 */ public static boolean jriLoaded; boolean loopHasLock = false; - + static { try { System.loadLibrary("jri"); @@ -31,7 +31,7 @@ public class Rengine extends Thread { static Thread mainRThread = null; - // constrants to be used with rniSpecialObject + // constants to be used with rniSpecialObject /** constant to be used in {@link #rniSpecialObject} to return R_NilValue reference */ public static final int SO_NilValue = 0; /** constant to be used in {@link #rniSpecialObject} to return R_GlobalEnv reference */ @@ -60,18 +60,18 @@ public static long getVersion() { public static boolean versionCheck() { return (getVersion()==rniGetVersion()); } - + /** debug flag. Set to value >0 to enable debugging messages. The verbosity increases with increasing number */ public static int DEBUG = 0; - + /** this value specifies the time (in ms) to spend sleeping between checks for R shutdown requests if R event loop is not used. The default is 200ms. Higher values lower the CPU usage but may make R less responsive to shutdown attempts (in theory it should not matter because {@link #stop()} uses interrupt to awake from the idle sleep immediately, but some implementation may not honor that). @since JRI 0.3 */ public int idleDelay = 200; - + /** main engine. Since there can be only one instance of R, this is also the only instance. */ static Rengine mainEngine=null; - + /** return the current main R engine instance. Since there can be only one true R instance at a time, this is also the only instance. This may not be true for future versions, though. @return current instance of the R engine or null if no R engine was started yet. */ public static Rengine getMainEngine() { return mainEngine; } @@ -99,8 +99,8 @@ public static boolean inMainRThread() { Mutex Rsync; /** callback handler */ RMainLoopCallbacks callback; - - /** create and start a new instance of R. + + /** create and start a new instance of R. @param args arguments to be passed to R. Please note that R requires the presence of certain arguments (e.g. --save or --no-save or equivalents), so passing an empty list usually doesn't work. @param runMainLoop if set to true the the event loop will be started as soon as possible, otherwise no event loop is started. Running loop requires initialCallbacks to be set correspondingly as well. @param initialCallbacks an instance implementing the {@link org.rosuda.JRI.RMainLoopCallbacks RMainLoopCallbacks} interface that provides methods to be called by R @@ -117,7 +117,7 @@ public Rengine(String[] args, boolean runMainLoop, RMainLoopCallbacks initialCal mainEngine=this; mainRThread=this; start(); - while (!alive && !died) yield(); + while (!alive && !died) super.yield(); } /** create a new engine by hooking into an existing, initialized R instance which is calling this constructor. Currently JRI won't influence this R instance other than disabling stack checks (i.e. no callbacks can be registered etc.). It is *not* the designated constructor and it should be used *only* from withing rJava. @@ -143,7 +143,7 @@ public Rengine() { @return result code */ native int rniSetupR(String[] args); - + /** RNI: setup IPC with RJava. This method is used by rJava to pass the IPC information to the JRI engine for synchronization @since experimental, not in the public API! */ @@ -159,7 +159,7 @@ public Rengine() { synchronized int setupR() { return setupR(null); } - + synchronized int setupR(String[] args) { int r=rniSetupR(args); if (r==0) { @@ -169,7 +169,7 @@ synchronized int setupR(String[] args) { } return r; } - + /** RNI: parses a string into R expressions (do NOT use directly unless you know exactly what you're doing, where possible use {@link #eval} instead). Note that no synchronization is performed! @param s string to parse @param parts number of expressions contained in the string @@ -256,7 +256,7 @@ synchronized int setupR(String[] args) { @param exps initial contents of the vector consisiting of an array of references @return reference to the resulting VECSXP */ public synchronized native long rniPutVector(long[] exps); - + /** RNI: get an attribute @param exp reference to the object whose attribute is requested @param name name of the attribute @@ -264,9 +264,9 @@ synchronized int setupR(String[] args) { public synchronized native long rniGetAttr(long exp, String name); /** RNI: get attribute names @param exp reference to the object whose attributes are requested - @return a list of strings naming all attributes or null if there are none + @return a list of strings naming all attributes or null if there are none @since API 1.9, JRI 0.5 */ - public synchronized native String[] rniGetAttrNames(long exp); + public synchronized native String[] rniGetAttrNames(long exp); /** RNI: set an attribute @param exp reference to the object whose attribute is to be modified @param name attribute name @@ -277,7 +277,7 @@ synchronized int setupR(String[] args) { @since API 1.5, JRI 0.3 @param exp reference to an object @param cName name of the class to check - @return true if cName inherits from class cName (see inherits in R) */ + @return true if cName inherits from class cName (see inherits in R) */ public synchronized native boolean rniInherits(long exp, String cName); /** RNI: create a dotted-pair list (LISTSXP or LANGSXP) @@ -355,7 +355,7 @@ synchronized int setupR(String[] args) { @since API 1.9, JRI 0.5 @param exp reference to an R object */ public synchronized native void rniRelease(long exp); - + /** RNI: return the parent environment @since API 1.9, JRI 0.5 @param exp reference to environment @@ -381,7 +381,7 @@ synchronized int setupR(String[] args) { @param which constant referring to a particular special object (see SO_xxx constants) @return reference to a special object or 0 if the kind of object it unknown/unsupported */ public synchronized native long rniSpecialObject(int which); - + //--- was API 1.4 but it only caused portability problems, so we got rid of it //public static native void rniSetEnv(String key, String val); //public static native String rniGetEnv(String key); @@ -399,16 +399,16 @@ synchronized int setupR(String[] args) { @since API 1.5, JRI 0.3 */ public synchronized native Object rniXrefToJava(long exp); - + /** RNI: return the API version of the native library @return API version of the native library */ public static native long rniGetVersion(); - + /** RNI: interrupt the R process (if possible). Note that R handles interrupt requests in (R-thread-)synchronous, co-operative fashion as it wants to make sure that the interrupted state is recoverable. If interrupting from another thread while using blocking ReadConsole REPL make sure you also interrupt your ReadConsole call after rniStop such that R can act on the signalled interrupt. @param flag determines how to attempt to inform R about the interrput. For normal (safe) operation using flag signalling must be 0. Other options are 1 (SIGINT for compatibility with older JRI API) and 2 (Rf_onintr call - use only on the R thread and only if you know what it means). Values other than 0 are only supported since JRI 0.5-4. @return result code (currently 0) */ public native int rniStop(int flag); - + /** RNI: assign a value to an environment @param name name @param exp value @@ -417,14 +417,14 @@ synchronized int setupR(String[] args) { @since API 1.10, JRI 0.5-1 (existed before but returned void) */ public synchronized native boolean rniAssign(String name, long exp, long rho); - + /** RNI: get the SEXP type @param exp reference to a SEXP @return type of the expression (see xxxSEXP constants) */ public synchronized native int rniExpType(long exp); /** RNI: run the main loop.
Note: this is an internal method and it doesn't return until the loop exits. Don't use directly! */ public native void rniRunMainLoop(); - + /** RNI: run other event handlers in R */ public synchronized native void rniIdle(); @@ -439,7 +439,7 @@ public void addMainLoopCallbacks(RMainLoopCallbacks c) public void startMainLoop() { runLoop=true; } - + //============ R callback methods ========= /** JRI: R_WriteConsole call-back from R @@ -486,7 +486,7 @@ public void jriShowMessage(String message) { if (callback!=null) callback.rShowMessage(this, message); } - + /** JRI: R_loadhistory call-back from R @param filename name of the history file */ public void jriLoadHistory(String filename) @@ -500,7 +500,7 @@ public void jriSaveHistory(String filename) { if (callback!=null) callback.rSaveHistory(this, filename); } - + /** JRI: R_ChooseFile call-back from R @param newFile flag specifying whether an existing or new file is requested @return name of the selected file or null if cancelled */ @@ -509,14 +509,14 @@ public String jriChooseFile(int newFile) if (callback!=null) return callback.rChooseFile(this, newFile); return null; } - - /** JRI: R_FlushConsole call-back from R */ + + /** JRI: R_FlushConsole call-back from R */ public void jriFlushConsole() { if (callback!=null) callback.rFlushConsole(this); } - - + + //============ "official" API ============= @@ -526,7 +526,7 @@ public void jriFlushConsole() public synchronized REXP eval(String s) { return eval(s, true); } - + /** Parses and evaluates an R expression and returns the result. @since JRI 0.3 @param s expression (as string) to parse and evaluate @@ -548,7 +548,16 @@ public synchronized REXP eval(String s, boolean convert) { if (pr != 0) { long er = rniEval(pr, 0); if (er != 0) { - REXP x = new REXP(this, er, convert); + REXP x; + if (convert) { + rniProtect(er); + try { + x = new REXP(this, er, convert); + } finally { + rniUnprotect(1); + } + } else + x = new REXP(this, er, convert); if (DEBUG>0) System.out.println("Rengine.eval("+s+"): END (OK)"+Thread.currentThread()); return x; } @@ -559,7 +568,7 @@ public synchronized REXP eval(String s, boolean convert) { if (DEBUG>0) System.out.println("Rengine.eval("+s+"): END (ERR)"+Thread.currentThread()); return null; } - + /** This method is very much like {@link #eval(String)}, except that it is non-blocking and returns null if the engine is busy. @param s string to evaluate @return result of the evaluation or null if the engine is busy @@ -592,7 +601,7 @@ public synchronized REXP idleEval(String s, boolean convert) { } return null; } - + /** returns the synchronization mutex for this engine. If an external code needs to use RNI calls, it should do so only in properly protected environment secured by this mutex. Usually the procedure should be as follows:

 	boolean obtainedLock = e.getRsync().safeLock();
 	try {
@@ -607,7 +616,7 @@ public synchronized REXP idleEval(String s, boolean convert) {
 	public Mutex getRsync() {
 		return Rsync;
 	}
-	
+
     /** check the state of R
 		@return true if R is alive and false if R died or exitted */
     public synchronized boolean waitForR() {
@@ -619,21 +628,21 @@ public void end() {
         alive = false;
         interrupt();
     }
-    
-    /** The implementation of the R thread. This method should not be called directly. */	
+
+    /** The implementation of the R thread. This method should not be called directly. */
     public void run() {
 	if (DEBUG > 0)
 	    System.out.println("Starting R...");
 	loopHasLock = Rsync.safeLock(); // force all code to wait until R is ready
 	try {
 	    if (setupR(args) == 0) {
-		if (!runLoop && loopHasLock) { // without event loop we can unlock now since we woin't do anything
+		if (!runLoop && loopHasLock) { // without event loop we can unlock now since we won't do anything
 		    Rsync.unlock();
 		    loopHasLock = false;
 		}
 		while (alive) {
 		    try {
-			if (runLoop) {                        
+			if (runLoop) {
 			    if (DEBUG > 0)
 				System.out.println("***> launching main loop:");
 			    loopRunning = true;
@@ -662,7 +671,7 @@ public void run() {
 	    if (loopHasLock) Rsync.unlock();
 	}
     }
-	
+
 	/** assign a string value to a symbol in R. The symbol is created if it doesn't exist already.
          *  @param sym symbol name.  The symbol name is used as-is, i.e. as if it was quoted in R code (for example assigning to "foo$bar" has the same effect as `foo$bar`<- and NOT foo$bar<-).
 	 *  @param ct contents
diff --git a/jri/bootstrap/Boot.java b/src/jri/bootstrap/Boot.java
similarity index 100%
rename from jri/bootstrap/Boot.java
rename to src/jri/bootstrap/Boot.java
diff --git a/jri/bootstrap/DelegatedClassLoader.java b/src/jri/bootstrap/DelegatedClassLoader.java
similarity index 100%
rename from jri/bootstrap/DelegatedClassLoader.java
rename to src/jri/bootstrap/DelegatedClassLoader.java
diff --git a/jri/bootstrap/DelegatedURLClassLoader.java b/src/jri/bootstrap/DelegatedURLClassLoader.java
similarity index 100%
rename from jri/bootstrap/DelegatedURLClassLoader.java
rename to src/jri/bootstrap/DelegatedURLClassLoader.java
diff --git a/jri/bootstrap/JRIBootstrap.c b/src/jri/bootstrap/JRIBootstrap.c
similarity index 100%
rename from jri/bootstrap/JRIBootstrap.c
rename to src/jri/bootstrap/JRIBootstrap.c
diff --git a/jri/bootstrap/JRIBootstrap.h b/src/jri/bootstrap/JRIBootstrap.h
similarity index 100%
rename from jri/bootstrap/JRIBootstrap.h
rename to src/jri/bootstrap/JRIBootstrap.h
diff --git a/jri/bootstrap/JRIBootstrap.java b/src/jri/bootstrap/JRIBootstrap.java
similarity index 100%
rename from jri/bootstrap/JRIBootstrap.java
rename to src/jri/bootstrap/JRIBootstrap.java
diff --git a/jri/bootstrap/JRIClassLoader.java b/src/jri/bootstrap/JRIClassLoader.java
similarity index 100%
rename from jri/bootstrap/JRIClassLoader.java
rename to src/jri/bootstrap/JRIClassLoader.java
diff --git a/jri/bootstrap/Makefile b/src/jri/bootstrap/Makefile
similarity index 100%
rename from jri/bootstrap/Makefile
rename to src/jri/bootstrap/Makefile
diff --git a/jri/bootstrap/mft b/src/jri/bootstrap/mft
similarity index 100%
rename from jri/bootstrap/mft
rename to src/jri/bootstrap/mft
diff --git a/jri/configure b/src/jri/configure
similarity index 61%
rename from jri/configure
rename to src/jri/configure
index 501cd32..30bd7a8 100755
--- a/jri/configure
+++ b/src/jri/configure
@@ -1,11 +1,12 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for JRI 0.3.
+# Generated by GNU Autoconf 2.72 for JRI 0.3.
 #
 # Report bugs to .
 #
 #
-# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
+# Copyright (C) 1992-1996, 1998-2017, 2020-2023 Free Software Foundation,
+# Inc.
 #
 #
 # This configure script is free software; the Free Software Foundation
@@ -16,63 +17,65 @@
 
 # Be more Bourne compatible
 DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1
+then :
   emulate sh
   NULLCMD=:
   # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
   # is contrary to our usage.  Disable this feature.
   alias -g '${1+"$@"}'='"$@"'
   setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in #(
+else case e in #(
+  e) case `(set -o) 2>/dev/null` in #(
   *posix*) :
     set -o posix ;; #(
   *) :
      ;;
+esac ;;
 esac
 fi
 
 
+
+# Reset variables that may have inherited troublesome values from
+# the environment.
+
+# IFS needs to be set, to space, tab, and newline, in precisely that order.
+# (If _AS_PATH_WALK were called with IFS unset, it would have the
+# side effect of setting IFS to empty, thus disabling word splitting.)
+# Quoting is to prevent editors from complaining about space-tab.
 as_nl='
 '
 export as_nl
-# Printing a long string crashes Solaris 7 /usr/bin/printf.
-as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
-# Prefer a ksh shell builtin over an external printf program on Solaris,
-# but without wasting forks for bash or zsh.
-if test -z "$BASH_VERSION$ZSH_VERSION" \
-    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
-  as_echo='print -r --'
-  as_echo_n='print -rn --'
-elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
-  as_echo='printf %s\n'
-  as_echo_n='printf %s'
-else
-  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
-    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
-    as_echo_n='/usr/ucb/echo -n'
-  else
-    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
-    as_echo_n_body='eval
-      arg=$1;
-      case $arg in #(
-      *"$as_nl"*)
-	expr "X$arg" : "X\\(.*\\)$as_nl";
-	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
-      esac;
-      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
-    '
-    export as_echo_n_body
-    as_echo_n='sh -c $as_echo_n_body as_echo'
-  fi
-  export as_echo_body
-  as_echo='sh -c $as_echo_body as_echo'
-fi
+IFS=" ""	$as_nl"
+
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# Ensure predictable behavior from utilities with locale-dependent output.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# We cannot yet rely on "unset" to work, but we need these variables
+# to be unset--not just set to an empty or harmless value--now, to
+# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh).  This construct
+# also avoids known problems related to "unset" and subshell syntax
+# in other old shells (e.g. bash 2.01 and pdksh 5.2.14).
+for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH
+do eval test \${$as_var+y} \
+  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+
+# Ensure that fds 0, 1, and 2 are open.
+if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi
+if (exec 3>&2)            ; then :; else exec 2>/dev/null; fi
 
 # The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
+if ${PATH_SEPARATOR+false} :; then
   PATH_SEPARATOR=:
   (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
     (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
@@ -81,13 +84,6 @@ if test "${PATH_SEPARATOR+set}" != set; then
 fi
 
 
-# IFS
-# We need space, tab and new line, in precisely that order.  Quoting is
-# there to prevent editors from complaining about space-tab.
-# (If _AS_PATH_WALK were called with IFS unset, it would disable word
-# splitting by setting IFS to empty value.)
-IFS=" ""	$as_nl"
-
 # Find who we are.  Look in the path if we contain no directory separator.
 as_myself=
 case $0 in #((
@@ -96,43 +92,27 @@ case $0 in #((
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
+    test -r "$as_dir$0" && as_myself=$as_dir$0 && break
   done
 IFS=$as_save_IFS
 
      ;;
 esac
-# We did not find ourselves, most probably we were run as `sh COMMAND'
+# We did not find ourselves, most probably we were run as 'sh COMMAND'
 # in which case we are not to be found in the path.
 if test "x$as_myself" = x; then
   as_myself=$0
 fi
 if test ! -f "$as_myself"; then
-  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
   exit 1
 fi
 
-# Unset variables that we do not need and which cause bugs (e.g. in
-# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
-# suppresses any "Segmentation fault" message there.  '((' could
-# trigger a bug in pdksh 5.2.14.
-for as_var in BASH_ENV ENV MAIL MAILPATH
-do eval test x\${$as_var+set} = xset \
-  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
-done
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-LC_ALL=C
-export LC_ALL
-LANGUAGE=C
-export LANGUAGE
-
-# CDPATH.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 
 # Use a proper internal environment variable to ensure we don't fall
   # into an infinite loop, continuously re-executing ourselves.
@@ -153,26 +133,28 @@ case $- in # ((((
 esac
 exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
 # Admittedly, this is quite paranoid, since all the known shells bail
-# out after a failed `exec'.
-$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
-as_fn_exit 255
+# out after a failed 'exec'.
+printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
   fi
   # We don't want this to propagate to other subprocesses.
           { _as_can_reexec=; unset _as_can_reexec;}
 if test "x$CONFIG_SHELL" = x; then
-  as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
+  as_bourne_compatible="if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1
+then :
   emulate sh
   NULLCMD=:
   # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
   # is contrary to our usage.  Disable this feature.
   alias -g '\${1+\"\$@\"}'='\"\$@\"'
   setopt NO_GLOB_SUBST
-else
-  case \`(set -o) 2>/dev/null\` in #(
+else case e in #(
+  e) case \`(set -o) 2>/dev/null\` in #(
   *posix*) :
     set -o posix ;; #(
   *) :
      ;;
+esac ;;
 esac
 fi
 "
@@ -187,42 +169,54 @@ as_fn_success || { exitcode=1; echo as_fn_success failed.; }
 as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
 as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
 as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
-if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
+if ( set x; as_fn_ret_success y && test x = \"\$1\" )
+then :
 
-else
-  exitcode=1; echo positional parameters were not saved.
+else case e in #(
+  e) exitcode=1; echo positional parameters were not saved. ;;
+esac
 fi
 test x\$exitcode = x0 || exit 1
+blah=\$(echo \$(echo blah))
+test x\"\$blah\" = xblah || exit 1
 test -x / || exit 1"
   as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
   as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
   eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
-  test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
-test \$(( 1 + 1 )) = 2 || exit 1"
-  if (eval "$as_required") 2>/dev/null; then :
+  test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1"
+  if (eval "$as_required") 2>/dev/null
+then :
   as_have_required=yes
-else
-  as_have_required=no
+else case e in #(
+  e) as_have_required=no ;;
+esac
 fi
-  if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
+  if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null
+then :
 
-else
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+else case e in #(
+  e) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 as_found=false
 for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
 do
   IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
   as_found=:
   case $as_dir in #(
 	 /*)
 	   for as_base in sh bash ksh sh5; do
 	     # Try only shells that exist, to save several forks.
-	     as_shell=$as_dir/$as_base
+	     as_shell=$as_dir$as_base
 	     if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
-		    { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+		    as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null
+then :
   CONFIG_SHELL=$as_shell as_have_required=yes
-		   if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+		   if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null
+then :
   break 2
 fi
 fi
@@ -230,14 +224,22 @@ fi
        esac
   as_found=false
 done
-$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
-	      { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
-  CONFIG_SHELL=$SHELL as_have_required=yes
-fi; }
 IFS=$as_save_IFS
+if $as_found
+then :
 
+else case e in #(
+  e) if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+	      as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null
+then :
+  CONFIG_SHELL=$SHELL as_have_required=yes
+fi ;;
+esac
+fi
 
-      if test "x$CONFIG_SHELL" != x; then :
+
+      if test "x$CONFIG_SHELL" != x
+then :
   export CONFIG_SHELL
              # We cannot yet assume a decent shell, so we have to provide a
 # neutralization value for shells without unset; and this also
@@ -254,26 +256,28 @@ case $- in # ((((
 esac
 exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
 # Admittedly, this is quite paranoid, since all the known shells bail
-# out after a failed `exec'.
-$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+# out after a failed 'exec'.
+printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2
 exit 255
 fi
 
-    if test x$as_have_required = xno; then :
-  $as_echo "$0: This script requires a shell more modern than all"
-  $as_echo "$0: the shells that I found on your system."
-  if test x${ZSH_VERSION+set} = xset ; then
-    $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
-    $as_echo "$0: be upgraded to zsh 4.3.4 or later."
+    if test x$as_have_required = xno
+then :
+  printf "%s\n" "$0: This script requires a shell more modern than all"
+  printf "%s\n" "$0: the shells that I found on your system."
+  if test ${ZSH_VERSION+y} ; then
+    printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+    printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later."
   else
-    $as_echo "$0: Please tell bug-autoconf@gnu.org and
+    printf "%s\n" "$0: Please tell bug-autoconf@gnu.org and
 $0: simon.urbanek@r-project.org about your system,
 $0: including any error possibly output before this
 $0: message. Then install a modern shell, or manually run
 $0: the script under such a shell if you do have one."
   fi
   exit 1
-fi
+fi ;;
+esac
 fi
 fi
 SHELL=${CONFIG_SHELL-/bin/sh}
@@ -294,6 +298,7 @@ as_fn_unset ()
 }
 as_unset=as_fn_unset
 
+
 # as_fn_set_status STATUS
 # -----------------------
 # Set $? to STATUS, without forking.
@@ -325,7 +330,7 @@ as_fn_mkdir_p ()
     as_dirs=
     while :; do
       case $as_dir in #(
-      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+      *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
       *) as_qdir=$as_dir;;
       esac
       as_dirs="'$as_qdir' $as_dirs"
@@ -334,7 +339,7 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
 	 X"$as_dir" : 'X\(//\)[^/]' \| \
 	 X"$as_dir" : 'X\(//\)$' \| \
 	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$as_dir" |
+printf "%s\n" X"$as_dir" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
 	    s//\1/
 	    q
@@ -373,16 +378,18 @@ as_fn_executable_p ()
 # advantage of any shell optimizations that allow amortized linear growth over
 # repeated appends, instead of the typical quadratic growth present in naive
 # implementations.
-if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null
+then :
   eval 'as_fn_append ()
   {
     eval $1+=\$2
   }'
-else
-  as_fn_append ()
+else case e in #(
+  e) as_fn_append ()
   {
     eval $1=\$$1\$2
-  }
+  } ;;
+esac
 fi # as_fn_append
 
 # as_fn_arith ARG...
@@ -390,16 +397,18 @@ fi # as_fn_append
 # Perform arithmetic evaluation on the ARGs, and store the result in the
 # global $as_val. Take advantage of shells that can avoid forks. The arguments
 # must be portable across $(()) and expr.
-if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null
+then :
   eval 'as_fn_arith ()
   {
     as_val=$(( $* ))
   }'
-else
-  as_fn_arith ()
+else case e in #(
+  e) as_fn_arith ()
   {
     as_val=`expr "$@" || test $? -eq 1`
-  }
+  } ;;
+esac
 fi # as_fn_arith
 
 
@@ -413,9 +422,9 @@ as_fn_error ()
   as_status=$1; test $as_status -eq 0 && as_status=1
   if test "$4"; then
     as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+    printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
   fi
-  $as_echo "$as_me: error: $2" >&2
+  printf "%s\n" "$as_me: error: $2" >&2
   as_fn_exit $as_status
 } # as_fn_error
 
@@ -442,7 +451,7 @@ as_me=`$as_basename -- "$0" ||
 $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
 	 X"$0" : 'X\(//\)$' \| \
 	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X/"$0" |
+printf "%s\n" X/"$0" |
     sed '/^.*\/\([^/][^/]*\)\/*$/{
 	    s//\1/
 	    q
@@ -475,6 +484,8 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
     /[$]LINENO/=
   ' <$as_myself |
     sed '
+      t clear
+      :clear
       s/[$]LINENO.*/&-/
       t lineno
       b
@@ -486,7 +497,7 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
       s/-\n.*//
     ' >$as_me.lineno &&
   chmod +x "$as_me.lineno" ||
-    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+    { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
 
   # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
   # already done that, so ensure we don't try to do so again and fall
@@ -500,6 +511,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
   exit
 }
 
+
+# Determine whether it's possible to make 'echo' print without a newline.
+# These variables are no longer used directly by Autoconf, but are AC_SUBSTed
+# for compatibility with existing Makefiles.
 ECHO_C= ECHO_N= ECHO_T=
 case `echo -n x` in #(((((
 -n*)
@@ -513,6 +528,12 @@ case `echo -n x` in #(((((
   ECHO_N='-n';;
 esac
 
+# For backward compatibility with old third-party macros, we provide
+# the shell variables $as_echo and $as_echo_n.  New code should use
+# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively.
+as_echo='printf %s\n'
+as_echo_n='printf %s'
+
 rm -f conf$$ conf$$.exe conf$$.file
 if test -d conf$$.dir; then
   rm -f conf$$.dir/conf$$.file
@@ -524,9 +545,9 @@ if (echo >conf$$.file) 2>/dev/null; then
   if ln -s conf$$.file conf$$ 2>/dev/null; then
     as_ln_s='ln -s'
     # ... but there are two gotchas:
-    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
-    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -pR'.
+    # 1) On MSYS, both 'ln -s file dir' and 'ln file dir' fail.
+    # 2) DJGPP < 2.04 has no symlinks; 'ln -s' creates a wrapper executable.
+    # In both cases, we have to default to 'cp -pR'.
     ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
       as_ln_s='cp -pR'
   elif ln conf$$.file conf$$ 2>/dev/null; then
@@ -551,10 +572,12 @@ as_test_x='test -x'
 as_executable_p=as_fn_executable_p
 
 # Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+as_sed_cpp="y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
+as_tr_cpp="eval sed '$as_sed_cpp'" # deprecated
 
 # Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+as_sed_sh="y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
+as_tr_sh="eval sed '$as_sed_sh'" # deprecated
 
 
 test -n "$DJDIR" || exec 7<&0 /dev/null &&
-      as_fn_error $? "invalid feature name: $ac_useropt"
+      as_fn_error $? "invalid feature name: '$ac_useropt'"
     ac_useropt_orig=$ac_useropt
-    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'`
     case $ac_user_opts in
       *"
 "enable_$ac_useropt"
@@ -812,9 +864,9 @@ do
     ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      as_fn_error $? "invalid feature name: $ac_useropt"
+      as_fn_error $? "invalid feature name: '$ac_useropt'"
     ac_useropt_orig=$ac_useropt
-    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'`
     case $ac_user_opts in
       *"
 "enable_$ac_useropt"
@@ -967,6 +1019,15 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1016,9 +1077,9 @@ do
     ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      as_fn_error $? "invalid package name: $ac_useropt"
+      as_fn_error $? "invalid package name: '$ac_useropt'"
     ac_useropt_orig=$ac_useropt
-    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'`
     case $ac_user_opts in
       *"
 "with_$ac_useropt"
@@ -1032,9 +1093,9 @@ do
     ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      as_fn_error $? "invalid package name: $ac_useropt"
+      as_fn_error $? "invalid package name: '$ac_useropt'"
     ac_useropt_orig=$ac_useropt
-    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'`
     case $ac_user_opts in
       *"
 "with_$ac_useropt"
@@ -1062,8 +1123,8 @@ do
   | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
     x_libraries=$ac_optarg ;;
 
-  -*) as_fn_error $? "unrecognized option: \`$ac_option'
-Try \`$0 --help' for more information"
+  -*) as_fn_error $? "unrecognized option: '$ac_option'
+Try '$0 --help' for more information"
     ;;
 
   *=*)
@@ -1071,16 +1132,16 @@ Try \`$0 --help' for more information"
     # Reject names that are not valid shell variable names.
     case $ac_envvar in #(
       '' | [0-9]* | *[!_$as_cr_alnum]* )
-      as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
+      as_fn_error $? "invalid variable name: '$ac_envvar'" ;;
     esac
     eval $ac_envvar=\$ac_optarg
     export $ac_envvar ;;
 
   *)
     # FIXME: should be removed in autoconf 3.0.
-    $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+    printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2
     expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
-      $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+      printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2
     : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
     ;;
 
@@ -1096,7 +1157,7 @@ if test -n "$ac_unrecognized_opts"; then
   case $enable_option_checking in
     no) ;;
     fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
-    *)     $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+    *)     printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
   esac
 fi
 
@@ -1104,7 +1165,7 @@ fi
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
+		libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1121,7 +1182,7 @@ do
   as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
 done
 
-# There might be people who depend on the old broken behavior: `$host'
+# There might be people who depend on the old broken behavior: '$host'
 # used to hold the argument of --host etc.
 # FIXME: To remove some day.
 build=$build_alias
@@ -1160,7 +1221,7 @@ $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
 	 X"$as_myself" : 'X\(//\)[^/]' \| \
 	 X"$as_myself" : 'X\(//\)$' \| \
 	 X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$as_myself" |
+printf "%s\n" X"$as_myself" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
 	    s//\1/
 	    q
@@ -1189,7 +1250,7 @@ if test ! -r "$srcdir/$ac_unique_file"; then
   test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
   as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
 fi
-ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_msg="sources are in $srcdir, but 'cd $srcdir' does not work"
 ac_abs_confdir=`(
 	cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
 	pwd)`
@@ -1217,7 +1278,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures JRI 0.3 to adapt to many kinds of systems.
+'configure' configures JRI 0.3 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1231,11 +1292,11 @@ Configuration:
       --help=short        display options specific to this package
       --help=recursive    display the short help of all the included packages
   -V, --version           display version information and exit
-  -q, --quiet, --silent   do not print \`checking ...' messages
+  -q, --quiet, --silent   do not print 'checking ...' messages
       --cache-file=FILE   cache test results in FILE [disabled]
-  -C, --config-cache      alias for \`--cache-file=config.cache'
+  -C, --config-cache      alias for '--cache-file=config.cache'
   -n, --no-create         do not create output files
-      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
+      --srcdir=DIR        find the sources in DIR [configure dir or '..']
 
 Installation directories:
   --prefix=PREFIX         install architecture-independent files in PREFIX
@@ -1243,10 +1304,10 @@ Installation directories:
   --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                           [PREFIX]
 
-By default, \`make install' will install all the files in
-\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
-an installation prefix other than \`$ac_default_prefix' using \`--prefix',
-for instance \`--prefix=\$HOME'.
+By default, 'make install' will install all the files in
+'$ac_default_prefix/bin', '$ac_default_prefix/lib' etc.  You can specify
+an installation prefix other than '$ac_default_prefix' using '--prefix',
+for instance '--prefix=\$HOME'.
 
 For better control, use the options below.
 
@@ -1257,6 +1318,7 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
@@ -1294,9 +1356,8 @@ Some influential environment variables:
   LIBS        libraries to pass to the linker, e.g. -l
   CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I if
               you have headers in a nonstandard directory 
-  CPP         C preprocessor
 
-Use these variables to override the choices made by `configure' or to help
+Use these variables to override the choices made by 'configure' or to help
 it to find libraries and programs with nonstandard names/locations.
 
 Report bugs to .
@@ -1315,9 +1376,9 @@ if test "$ac_init_help" = "recursive"; then
 case "$ac_dir" in
 .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
 *)
-  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+  ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'`
   # A ".." for each directory in $ac_dir_suffix.
-  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+  ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
   case $ac_top_builddir_sub in
   "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
   *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
@@ -1345,7 +1406,8 @@ esac
 ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
 
     cd "$ac_dir" || { ac_status=$?; continue; }
-    # Check for guested configure.
+    # Check for configure.gnu first; this name is used for a wrapper for
+    # Metaconfig's "Configure" on case-insensitive file systems.
     if test -f "$ac_srcdir/configure.gnu"; then
       echo &&
       $SHELL "$ac_srcdir/configure.gnu" --help=recursive
@@ -1353,7 +1415,7 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
       echo &&
       $SHELL "$ac_srcdir/configure" --help=recursive
     else
-      $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+      printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2
     fi || ac_status=$?
     cd "$ac_pwd" || { ac_status=$?; break; }
   done
@@ -1363,9 +1425,9 @@ test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
 JRI configure 0.3
-generated by GNU Autoconf 2.69
+generated by GNU Autoconf 2.72
 
-Copyright (C) 2012 Free Software Foundation, Inc.
+Copyright (C) 2023 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 _ACEOF
@@ -1382,14 +1444,14 @@ fi
 ac_fn_c_try_compile ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  rm -f conftest.$ac_objext
+  rm -f conftest.$ac_objext conftest.beam
   if { { ac_try="$ac_compile"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
+printf "%s\n" "$ac_try_echo"; } >&5
   (eval "$ac_compile") 2>conftest.err
   ac_status=$?
   if test -s conftest.err; then
@@ -1397,64 +1459,112 @@ $as_echo "$ac_try_echo"; } >&5
     cat conftest.er1 >&5
     mv -f conftest.er1 conftest.err
   fi
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; } && {
 	 test -z "$ac_c_werror_flag" ||
 	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then :
+       } && test -s conftest.$ac_objext
+then :
   ac_retval=0
-else
-  $as_echo "$as_me: failed program was:" >&5
+else case e in #(
+  e) printf "%s\n" "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_retval=1
+	ac_retval=1 ;;
+esac
 fi
   eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
   as_fn_set_status $ac_retval
 
 } # ac_fn_c_try_compile
 
-# ac_fn_c_try_cpp LINENO
-# ----------------------
-# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
-ac_fn_c_try_cpp ()
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+printf %s "checking for $2... " >&6; }
+if eval test \${$3+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+  eval "$3=yes"
+else case e in #(
+  e) eval "$3=no" ;;
+esac
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
+esac
+fi
+eval ac_res=\$$3
+	       { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+printf "%s\n" "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_compile
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if { { ac_try="$ac_cpp conftest.$ac_ext"
+  rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext
+  if { { ac_try="$ac_link"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+printf "%s\n" "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>conftest.err
   ac_status=$?
   if test -s conftest.err; then
     grep -v '^ *+' conftest.err >conftest.er1
     cat conftest.er1 >&5
     mv -f conftest.er1 conftest.err
   fi
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } > conftest.i && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_c_werror_flag" ||
 	 test ! -s conftest.err
-       }; then :
+       } && test -s conftest$ac_exeext && {
+	 test "$cross_compiling" = yes ||
+	 test -x conftest$ac_exeext
+       }
+then :
   ac_retval=0
-else
-  $as_echo "$as_me: failed program was:" >&5
+else case e in #(
+  e) printf "%s\n" "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-    ac_retval=1
+	ac_retval=1 ;;
+esac
 fi
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+  # interfere with the next link command; also delete a directory that is
+  # left behind by Apple's compiler.  We do this before executing the actions.
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
   eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
   as_fn_set_status $ac_retval
 
-} # ac_fn_c_try_cpp
+} # ac_fn_c_try_link
 
 # ac_fn_c_try_run LINENO
 # ----------------------
-# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
-# that executables *can* be run.
+# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that
+# executables *can* be run.
 ac_fn_c_try_run ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
@@ -1464,88 +1574,64 @@ case "(($ac_try" in
   *) ac_try_echo=$ac_try;;
 esac
 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
+printf "%s\n" "$ac_try_echo"; } >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
   { { case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
+printf "%s\n" "$ac_try_echo"; } >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; }; then :
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+then :
   ac_retval=0
-else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-       $as_echo "$as_me: failed program was:" >&5
+else case e in #(
+  e) printf "%s\n" "$as_me: program exited with status $ac_status" >&5
+       printf "%s\n" "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-       ac_retval=$ac_status
+       ac_retval=$ac_status ;;
+esac
 fi
   rm -rf conftest.dSYM conftest_ipa8_conftest.oo
   eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
   as_fn_set_status $ac_retval
 
 } # ac_fn_c_try_run
+ac_configure_args_raw=
+for ac_arg
+do
+  case $ac_arg in
+  *\'*)
+    ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+  esac
+  as_fn_append ac_configure_args_raw " '$ac_arg'"
+done
 
-# ac_fn_c_try_link LINENO
-# -----------------------
-# Try to link conftest.$ac_ext, and return whether this succeeded.
-ac_fn_c_try_link ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  rm -f conftest.$ac_objext conftest$ac_exeext
-  if { { ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+case $ac_configure_args_raw in
+  *$as_nl*)
+    ac_safe_unquote= ;;
+  *)
+    ac_unsafe_z='|&;<>()$`\\"*?[ ''	' # This string ends in space, tab.
+    ac_unsafe_a="$ac_unsafe_z#~"
+    ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g"
+    ac_configure_args_raw=`      printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;;
 esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_link") 2>conftest.err
-  ac_status=$?
-  if test -s conftest.err; then
-    grep -v '^ *+' conftest.err >conftest.er1
-    cat conftest.er1 >&5
-    mv -f conftest.er1 conftest.err
-  fi
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 test -x conftest$ac_exeext
-       }; then :
-  ac_retval=0
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_retval=1
-fi
-  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
-  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
-  # interfere with the next link command; also delete a directory that is
-  # left behind by Apple's compiler.  We do this before executing the actions.
-  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-  as_fn_set_status $ac_retval
 
-} # ac_fn_c_try_link
 cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
 It was created by JRI $as_me 0.3, which was
-generated by GNU Autoconf 2.69.  Invocation command line was
+generated by GNU Autoconf 2.72.  Invocation command line was
 
-  $ $0 $@
+  $ $0$ac_configure_args_raw
 
 _ACEOF
 exec 5>>config.log
@@ -1578,8 +1664,12 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    $as_echo "PATH: $as_dir"
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
+    printf "%s\n" "PATH: $as_dir"
   done
 IFS=$as_save_IFS
 
@@ -1614,7 +1704,7 @@ do
     | -silent | --silent | --silen | --sile | --sil)
       continue ;;
     *\'*)
-      ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+      ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
     esac
     case $ac_pass in
     1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
@@ -1649,11 +1739,13 @@ done
 # WARNING: Use '\'' to represent an apostrophe within the trap.
 # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
 trap 'exit_status=$?
+  # Sanitize IFS.
+  IFS=" ""	$as_nl"
   # Save into config.log some information that might help in debugging.
   {
     echo
 
-    $as_echo "## ---------------- ##
+    printf "%s\n" "## ---------------- ##
 ## Cache variables. ##
 ## ---------------- ##"
     echo
@@ -1664,8 +1756,8 @@ trap 'exit_status=$?
     case $ac_val in #(
     *${as_nl}*)
       case $ac_var in #(
-      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
-$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+      *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
       esac
       case $ac_var in #(
       _ | IFS | as_nl) ;; #(
@@ -1689,7 +1781,7 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
 )
     echo
 
-    $as_echo "## ----------------- ##
+    printf "%s\n" "## ----------------- ##
 ## Output variables. ##
 ## ----------------- ##"
     echo
@@ -1697,14 +1789,14 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
     do
       eval ac_val=\$$ac_var
       case $ac_val in
-      *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+      *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
       esac
-      $as_echo "$ac_var='\''$ac_val'\''"
+      printf "%s\n" "$ac_var='\''$ac_val'\''"
     done | sort
     echo
 
     if test -n "$ac_subst_files"; then
-      $as_echo "## ------------------- ##
+      printf "%s\n" "## ------------------- ##
 ## File substitutions. ##
 ## ------------------- ##"
       echo
@@ -1712,15 +1804,15 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
       do
 	eval ac_val=\$$ac_var
 	case $ac_val in
-	*\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+	*\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
 	esac
-	$as_echo "$ac_var='\''$ac_val'\''"
+	printf "%s\n" "$ac_var='\''$ac_val'\''"
       done | sort
       echo
     fi
 
     if test -s confdefs.h; then
-      $as_echo "## ----------- ##
+      printf "%s\n" "## ----------- ##
 ## confdefs.h. ##
 ## ----------- ##"
       echo
@@ -1728,8 +1820,8 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
       echo
     fi
     test "$ac_signal" != 0 &&
-      $as_echo "$as_me: caught signal $ac_signal"
-    $as_echo "$as_me: exit $exit_status"
+      printf "%s\n" "$as_me: caught signal $ac_signal"
+    printf "%s\n" "$as_me: exit $exit_status"
   } >&5
   rm -f core *.core core.conftest.* &&
     rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
@@ -1743,65 +1835,50 @@ ac_signal=0
 # confdefs.h avoids OS command line length limits that DEFS can exceed.
 rm -f -r conftest* confdefs.h
 
-$as_echo "/* confdefs.h */" > confdefs.h
+printf "%s\n" "/* confdefs.h */" > confdefs.h
 
 # Predefined preprocessor variables.
 
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_NAME "$PACKAGE_NAME"
-_ACEOF
+printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h
 
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
-_ACEOF
+printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h
 
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_VERSION "$PACKAGE_VERSION"
-_ACEOF
+printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h
 
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_STRING "$PACKAGE_STRING"
-_ACEOF
+printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h
 
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
-_ACEOF
+printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h
 
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_URL "$PACKAGE_URL"
-_ACEOF
+printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h
 
 
 # Let the site file select an alternate cache file if it wants to.
 # Prefer an explicitly selected file to automatically selected ones.
-ac_site_file1=NONE
-ac_site_file2=NONE
 if test -n "$CONFIG_SITE"; then
-  # We do not want a PATH search for config.site.
-  case $CONFIG_SITE in #((
-    -*)  ac_site_file1=./$CONFIG_SITE;;
-    */*) ac_site_file1=$CONFIG_SITE;;
-    *)   ac_site_file1=./$CONFIG_SITE;;
-  esac
+  ac_site_files="$CONFIG_SITE"
 elif test "x$prefix" != xNONE; then
-  ac_site_file1=$prefix/share/config.site
-  ac_site_file2=$prefix/etc/config.site
+  ac_site_files="$prefix/share/config.site $prefix/etc/config.site"
 else
-  ac_site_file1=$ac_default_prefix/share/config.site
-  ac_site_file2=$ac_default_prefix/etc/config.site
+  ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
 fi
-for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+
+for ac_site_file in $ac_site_files
 do
-  test "x$ac_site_file" = xNONE && continue
-  if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
-$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+  case $ac_site_file in #(
+  */*) :
+     ;; #(
+  *) :
+    ac_site_file=./$ac_site_file ;;
+esac
+  if test -f "$ac_site_file" && test -r "$ac_site_file"; then
+    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;}
     sed 's/^/| /' "$ac_site_file" >&5
     . "$ac_site_file" \
-      || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+      || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}
 as_fn_error $? "failed to load site script $ac_site_file
-See \`config.log' for more details" "$LINENO" 5; }
+See 'config.log' for more details" "$LINENO" 5; }
   fi
 done
 
@@ -1809,19 +1886,452 @@ if test -r "$cache_file"; then
   # Some versions of bash will fail to source /dev/null (special files
   # actually), so we avoid doing that.  DJGPP emulates it as a regular file.
   if test /dev/null != "$cache_file" && test -f "$cache_file"; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
-$as_echo "$as_me: loading cache $cache_file" >&6;}
+    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+printf "%s\n" "$as_me: loading cache $cache_file" >&6;}
     case $cache_file in
       [\\/]* | ?:[\\/]* ) . "$cache_file";;
       *)                      . "./$cache_file";;
     esac
   fi
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
-$as_echo "$as_me: creating cache $cache_file" >&6;}
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+printf "%s\n" "$as_me: creating cache $cache_file" >&6;}
   >$cache_file
 fi
 
+# Test code for whether the C compiler supports C89 (global declarations)
+ac_c_conftest_c89_globals='
+/* Does the compiler advertise C89 conformance?
+   Do not test the value of __STDC__, because some compilers set it to 0
+   while being otherwise adequately conformant. */
+#if !defined __STDC__
+# error "Compiler does not advertise C89 conformance"
+#endif
+
+#include 
+#include 
+struct stat;
+/* Most of the following tests are stolen from RCS 5.7 src/conf.sh.  */
+struct buf { int x; };
+struct buf * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (char **p, int i)
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* C89 style stringification. */
+#define noexpand_stringify(a) #a
+const char *stringified = noexpand_stringify(arbitrary+token=sequence);
+
+/* C89 style token pasting.  Exercises some of the corner cases that
+   e.g. old MSVC gets wrong, but not very hard. */
+#define noexpand_concat(a,b) a##b
+#define expand_concat(a,b) noexpand_concat(a,b)
+extern int vA;
+extern int vbee;
+#define aye A
+#define bee B
+int *pvA = &expand_concat(v,aye);
+int *pvbee = &noexpand_concat(v,bee);
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not \xHH hex character constants.
+   These do not provoke an error unfortunately, instead are silently treated
+   as an "x".  The following induces an error, until -std is added to get
+   proper ANSI mode.  Curiously \x00 != x always comes out true, for an
+   array size at least.  It is necessary to write \x00 == 0 to get something
+   that is true only with -std.  */
+int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+   inside strings and character constants.  */
+#define FOO(x) '\''x'\''
+int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int),
+               int, int);'
+
+# Test code for whether the C compiler supports C89 (body of main).
+ac_c_conftest_c89_main='
+ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]);
+'
+
+# Test code for whether the C compiler supports C99 (global declarations)
+ac_c_conftest_c99_globals='
+/* Does the compiler advertise C99 conformance? */
+#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L
+# error "Compiler does not advertise C99 conformance"
+#endif
+
+// See if C++-style comments work.
+
+#include 
+extern int puts (const char *);
+extern int printf (const char *, ...);
+extern int dprintf (int, const char *, ...);
+extern void *malloc (size_t);
+extern void free (void *);
+
+// Check varargs macros.  These examples are taken from C99 6.10.3.5.
+// dprintf is used instead of fprintf to avoid needing to declare
+// FILE and stderr.
+#define debug(...) dprintf (2, __VA_ARGS__)
+#define showlist(...) puts (#__VA_ARGS__)
+#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__))
+static void
+test_varargs_macros (void)
+{
+  int x = 1234;
+  int y = 5678;
+  debug ("Flag");
+  debug ("X = %d\n", x);
+  showlist (The first, second, and third items.);
+  report (x>y, "x is %d but y is %d", x, y);
+}
+
+// Check long long types.
+#define BIG64 18446744073709551615ull
+#define BIG32 4294967295ul
+#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0)
+#if !BIG_OK
+  #error "your preprocessor is broken"
+#endif
+#if BIG_OK
+#else
+  #error "your preprocessor is broken"
+#endif
+static long long int bignum = -9223372036854775807LL;
+static unsigned long long int ubignum = BIG64;
+
+struct incomplete_array
+{
+  int datasize;
+  double data[];
+};
+
+struct named_init {
+  int number;
+  const wchar_t *name;
+  double average;
+};
+
+typedef const char *ccp;
+
+static inline int
+test_restrict (ccp restrict text)
+{
+  // Iterate through items via the restricted pointer.
+  // Also check for declarations in for loops.
+  for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i)
+    continue;
+  return 0;
+}
+
+// Check varargs and va_copy.
+static bool
+test_varargs (const char *format, ...)
+{
+  va_list args;
+  va_start (args, format);
+  va_list args_copy;
+  va_copy (args_copy, args);
+
+  const char *str = "";
+  int number = 0;
+  float fnumber = 0;
+
+  while (*format)
+    {
+      switch (*format++)
+	{
+	case '\''s'\'': // string
+	  str = va_arg (args_copy, const char *);
+	  break;
+	case '\''d'\'': // int
+	  number = va_arg (args_copy, int);
+	  break;
+	case '\''f'\'': // float
+	  fnumber = va_arg (args_copy, double);
+	  break;
+	default:
+	  break;
+	}
+    }
+  va_end (args_copy);
+  va_end (args);
+
+  return *str && number && fnumber;
+}
+'
+
+# Test code for whether the C compiler supports C99 (body of main).
+ac_c_conftest_c99_main='
+  // Check bool.
+  _Bool success = false;
+  success |= (argc != 0);
+
+  // Check restrict.
+  if (test_restrict ("String literal") == 0)
+    success = true;
+  char *restrict newvar = "Another string";
+
+  // Check varargs.
+  success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234);
+  test_varargs_macros ();
+
+  // Check flexible array members.
+  struct incomplete_array *ia =
+    malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));
+  ia->datasize = 10;
+  for (int i = 0; i < ia->datasize; ++i)
+    ia->data[i] = i * 1.234;
+  // Work around memory leak warnings.
+  free (ia);
+
+  // Check named initializers.
+  struct named_init ni = {
+    .number = 34,
+    .name = L"Test wide string",
+    .average = 543.34343,
+  };
+
+  ni.number = 58;
+
+  int dynamic_array[ni.number];
+  dynamic_array[0] = argv[0][0];
+  dynamic_array[ni.number - 1] = 543;
+
+  // work around unused variable warnings
+  ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\''
+	 || dynamic_array[ni.number - 1] != 543);
+'
+
+# Test code for whether the C compiler supports C11 (global declarations)
+ac_c_conftest_c11_globals='
+/* Does the compiler advertise C11 conformance? */
+#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L
+# error "Compiler does not advertise C11 conformance"
+#endif
+
+// Check _Alignas.
+char _Alignas (double) aligned_as_double;
+char _Alignas (0) no_special_alignment;
+extern char aligned_as_int;
+char _Alignas (0) _Alignas (int) aligned_as_int;
+
+// Check _Alignof.
+enum
+{
+  int_alignment = _Alignof (int),
+  int_array_alignment = _Alignof (int[100]),
+  char_alignment = _Alignof (char)
+};
+_Static_assert (0 < -_Alignof (int), "_Alignof is signed");
+
+// Check _Noreturn.
+int _Noreturn does_not_return (void) { for (;;) continue; }
+
+// Check _Static_assert.
+struct test_static_assert
+{
+  int x;
+  _Static_assert (sizeof (int) <= sizeof (long int),
+                  "_Static_assert does not work in struct");
+  long int y;
+};
+
+// Check UTF-8 literals.
+#define u8 syntax error!
+char const utf8_literal[] = u8"happens to be ASCII" "another string";
+
+// Check duplicate typedefs.
+typedef long *long_ptr;
+typedef long int *long_ptr;
+typedef long_ptr long_ptr;
+
+// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1.
+struct anonymous
+{
+  union {
+    struct { int i; int j; };
+    struct { int k; long int l; } w;
+  };
+  int m;
+} v1;
+'
+
+# Test code for whether the C compiler supports C11 (body of main).
+ac_c_conftest_c11_main='
+  _Static_assert ((offsetof (struct anonymous, i)
+		   == offsetof (struct anonymous, w.k)),
+		  "Anonymous union alignment botch");
+  v1.i = 2;
+  v1.w.k = 5;
+  ok |= v1.i != 5;
+'
+
+# Test code for whether the C compiler supports C11 (complete).
+ac_c_conftest_c11_program="${ac_c_conftest_c89_globals}
+${ac_c_conftest_c99_globals}
+${ac_c_conftest_c11_globals}
+
+int
+main (int argc, char **argv)
+{
+  int ok = 0;
+  ${ac_c_conftest_c89_main}
+  ${ac_c_conftest_c99_main}
+  ${ac_c_conftest_c11_main}
+  return ok;
+}
+"
+
+# Test code for whether the C compiler supports C99 (complete).
+ac_c_conftest_c99_program="${ac_c_conftest_c89_globals}
+${ac_c_conftest_c99_globals}
+
+int
+main (int argc, char **argv)
+{
+  int ok = 0;
+  ${ac_c_conftest_c89_main}
+  ${ac_c_conftest_c99_main}
+  return ok;
+}
+"
+
+# Test code for whether the C compiler supports C89 (complete).
+ac_c_conftest_c89_program="${ac_c_conftest_c89_globals}
+
+int
+main (int argc, char **argv)
+{
+  int ok = 0;
+  ${ac_c_conftest_c89_main}
+  return ok;
+}
+"
+
+as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H"
+as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H"
+as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H"
+as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H"
+as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H"
+as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H"
+as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H"
+as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H"
+as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H"
+
+# Auxiliary files required by this configure script.
+ac_aux_files="config.guess config.sub"
+
+# Locations in which to look for auxiliary files.
+ac_aux_dir_candidates="${srcdir}/tools"
+
+# Search for a directory containing all of the required auxiliary files,
+# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates.
+# If we don't find one directory that contains all the files we need,
+# we report the set of missing files from the *first* directory in
+# $ac_aux_dir_candidates and give up.
+ac_missing_aux_files=""
+ac_first_candidate=:
+printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
+for as_dir in $ac_aux_dir_candidates
+do
+  IFS=$as_save_IFS
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
+  as_found=:
+
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}:  trying $as_dir" >&5
+  ac_aux_dir_found=yes
+  ac_install_sh=
+  for ac_aux in $ac_aux_files
+  do
+    # As a special case, if "install-sh" is required, that requirement
+    # can be satisfied by any of "install-sh", "install.sh", or "shtool",
+    # and $ac_install_sh is set appropriately for whichever one is found.
+    if test x"$ac_aux" = x"install-sh"
+    then
+      if test -f "${as_dir}install-sh"; then
+        printf "%s\n" "$as_me:${as_lineno-$LINENO}:   ${as_dir}install-sh found" >&5
+        ac_install_sh="${as_dir}install-sh -c"
+      elif test -f "${as_dir}install.sh"; then
+        printf "%s\n" "$as_me:${as_lineno-$LINENO}:   ${as_dir}install.sh found" >&5
+        ac_install_sh="${as_dir}install.sh -c"
+      elif test -f "${as_dir}shtool"; then
+        printf "%s\n" "$as_me:${as_lineno-$LINENO}:   ${as_dir}shtool found" >&5
+        ac_install_sh="${as_dir}shtool install -c"
+      else
+        ac_aux_dir_found=no
+        if $ac_first_candidate; then
+          ac_missing_aux_files="${ac_missing_aux_files} install-sh"
+        else
+          break
+        fi
+      fi
+    else
+      if test -f "${as_dir}${ac_aux}"; then
+        printf "%s\n" "$as_me:${as_lineno-$LINENO}:   ${as_dir}${ac_aux} found" >&5
+      else
+        ac_aux_dir_found=no
+        if $ac_first_candidate; then
+          ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}"
+        else
+          break
+        fi
+      fi
+    fi
+  done
+  if test "$ac_aux_dir_found" = yes; then
+    ac_aux_dir="$as_dir"
+    break
+  fi
+  ac_first_candidate=false
+
+  as_found=false
+done
+IFS=$as_save_IFS
+if $as_found
+then :
+
+else case e in #(
+  e) as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 ;;
+esac
+fi
+
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+if test -f "${ac_aux_dir}config.guess"; then
+  ac_config_guess="$SHELL ${ac_aux_dir}config.guess"
+fi
+if test -f "${ac_aux_dir}config.sub"; then
+  ac_config_sub="$SHELL ${ac_aux_dir}config.sub"
+fi
+if test -f "$ac_aux_dir/configure"; then
+  ac_configure="$SHELL ${ac_aux_dir}configure"
+fi
+
 # Check that the precious variables saved in the cache have kept the same
 # value.
 ac_cache_corrupted=false
@@ -1832,12 +2342,12 @@ for ac_var in $ac_precious_vars; do
   eval ac_new_val=\$ac_env_${ac_var}_value
   case $ac_old_set,$ac_new_set in
     set,)
-      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
-$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' was set to '$ac_old_val' in the previous run" >&5
+printf "%s\n" "$as_me: error: '$ac_var' was set to '$ac_old_val' in the previous run" >&2;}
       ac_cache_corrupted=: ;;
     ,set)
-      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
-$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+      { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' was not set in the previous run" >&5
+printf "%s\n" "$as_me: error: '$ac_var' was not set in the previous run" >&2;}
       ac_cache_corrupted=: ;;
     ,);;
     *)
@@ -1846,24 +2356,24 @@ $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
 	ac_old_val_w=`echo x $ac_old_val`
 	ac_new_val_w=`echo x $ac_new_val`
 	if test "$ac_old_val_w" != "$ac_new_val_w"; then
-	  { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
-$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+	  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' has changed since the previous run:" >&5
+printf "%s\n" "$as_me: error: '$ac_var' has changed since the previous run:" >&2;}
 	  ac_cache_corrupted=:
 	else
-	  { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
-$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+	  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in '$ac_var' since the previous run:" >&5
+printf "%s\n" "$as_me: warning: ignoring whitespace changes in '$ac_var' since the previous run:" >&2;}
 	  eval $ac_var=\$ac_old_val
 	fi
-	{ $as_echo "$as_me:${as_lineno-$LINENO}:   former value:  \`$ac_old_val'" >&5
-$as_echo "$as_me:   former value:  \`$ac_old_val'" >&2;}
-	{ $as_echo "$as_me:${as_lineno-$LINENO}:   current value: \`$ac_new_val'" >&5
-$as_echo "$as_me:   current value: \`$ac_new_val'" >&2;}
+	{ printf "%s\n" "$as_me:${as_lineno-$LINENO}:   former value:  '$ac_old_val'" >&5
+printf "%s\n" "$as_me:   former value:  '$ac_old_val'" >&2;}
+	{ printf "%s\n" "$as_me:${as_lineno-$LINENO}:   current value: '$ac_new_val'" >&5
+printf "%s\n" "$as_me:   current value: '$ac_new_val'" >&2;}
       fi;;
   esac
   # Pass precious variables to config.status.
   if test "$ac_new_set" = set; then
     case $ac_new_val in
-    *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
     *) ac_arg=$ac_var=$ac_new_val ;;
     esac
     case " $ac_configure_args " in
@@ -1873,11 +2383,12 @@ $as_echo "$as_me:   current value: \`$ac_new_val'" >&2;}
   fi
 done
 if $ac_cache_corrupted; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-  { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
-$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
-  as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;}
+  as_fn_error $? "run '${MAKE-make} distclean' and/or 'rm $cache_file'
+	    and start over" "$LINENO" 5
 fi
 ## -------------------- ##
 ## Main body of script. ##
@@ -1893,56 +2404,33 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 ac_config_headers="$ac_config_headers src/config.h"
 
-ac_aux_dir=
-for ac_dir in tools "$srcdir"/tools; do
-  if test -f "$ac_dir/install-sh"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install-sh -c"
-    break
-  elif test -f "$ac_dir/install.sh"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install.sh -c"
-    break
-  elif test -f "$ac_dir/shtool"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/shtool install -c"
-    break
-  fi
-done
-if test -z "$ac_aux_dir"; then
-  as_fn_error $? "cannot find install-sh, install.sh, or shtool in tools \"$srcdir\"/tools" "$LINENO" 5
-fi
 
-# These three variables are undocumented and unsupported,
-# and are intended to be withdrawn in a future Autoconf release.
-# They can cause serious problems if a builder's source tree is in a directory
-# whose full name contains unusual characters.
-ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
-ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
-ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
 
 
 
-# Make sure we can run config.sub.
-$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
-  as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
-$as_echo_n "checking build system type... " >&6; }
-if ${ac_cv_build+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_build_alias=$build_alias
+  # Make sure we can run config.sub.
+$SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 ||
+  as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5
+
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
+printf %s "checking build system type... " >&6; }
+if test ${ac_cv_build+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) ac_build_alias=$build_alias
 test "x$ac_build_alias" = x &&
-  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+  ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"`
 test "x$ac_build_alias" = x &&
   as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
-ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
-  as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
-
+ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` ||
+  as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5
+ ;;
+esac
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
-$as_echo "$ac_cv_build" >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
+printf "%s\n" "$ac_cv_build" >&6; }
 case $ac_cv_build in
 *-*-*) ;;
 *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
@@ -1961,21 +2449,23 @@ IFS=$ac_save_IFS
 case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
-$as_echo_n "checking host system type... " >&6; }
-if ${ac_cv_host+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test "x$host_alias" = x; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
+printf %s "checking host system type... " >&6; }
+if test ${ac_cv_host+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) if test "x$host_alias" = x; then
   ac_cv_host=$ac_cv_build
 else
-  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
-    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+  ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` ||
+    as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5
 fi
-
+ ;;
+esac
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
-$as_echo "$ac_cv_host" >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+printf "%s\n" "$ac_cv_host" >&6; }
 case $ac_cv_host in
 *-*-*) ;;
 *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
@@ -2004,10 +2494,10 @@ fi
 # we attempt to use the same compiler as R did
 RBIN="${R_HOME}/bin/R"
 R_CC=`"${RBIN}" CMD config CC`
-R_CPP=`"${RBIN}" CMD config CPP`
+## CPP is now deprecated
+R_CPP="${R_CC} -E"
 R_CFLAGS=`"${RBIN}" CMD config CFLAGS`
 
-
 # find R_SHARE_DIR
 : ${R_SHARE_DIR=`"${RBIN}" CMD sh -c 'echo $R_SHARE_DIR'`}
 if test -z "${R_SHARE_DIR}"; then
@@ -2052,6 +2542,21 @@ fi
 
 
 
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+
+
+
+
+
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -2060,38 +2565,44 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
 set dummy ${ac_tool_prefix}gcc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$CC"; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_CC+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="${ac_tool_prefix}gcc"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
   done
 IFS=$as_save_IFS
 
-fi
+fi ;;
+esac
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+printf "%s\n" "$CC" >&6; }
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
 fi
 
 
@@ -2100,38 +2611,44 @@ if test -z "$ac_cv_prog_CC"; then
   ac_ct_CC=$CC
   # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_CC"; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_ac_ct_CC+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) if test -n "$ac_ct_CC"; then
   ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_CC="gcc"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
   done
 IFS=$as_save_IFS
 
-fi
+fi ;;
+esac
 fi
 ac_ct_CC=$ac_cv_prog_ac_ct_CC
 if test -n "$ac_ct_CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
-$as_echo "$ac_ct_CC" >&6; }
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+printf "%s\n" "$ac_ct_CC" >&6; }
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
 fi
 
   if test "x$ac_ct_CC" = x; then
@@ -2139,8 +2656,8 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
     CC=$ac_ct_CC
@@ -2153,38 +2670,44 @@ if test -z "$CC"; then
           if test -n "$ac_tool_prefix"; then
     # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
 set dummy ${ac_tool_prefix}cc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$CC"; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_CC+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="${ac_tool_prefix}cc"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
   done
 IFS=$as_save_IFS
 
-fi
+fi ;;
+esac
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+printf "%s\n" "$CC" >&6; }
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
 fi
 
 
@@ -2193,12 +2716,13 @@ fi
 if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$CC"; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_CC+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
   ac_prog_rejected=no
@@ -2206,15 +2730,19 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+  if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
+    if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
        ac_prog_rejected=yes
        continue
      fi
     ac_cv_prog_CC="cc"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -2230,18 +2758,19 @@ if test $ac_prog_rejected = yes; then
     # However, it has the same basename, so the bogon will be chosen
     # first if we set CC to just the basename; use the full file name.
     shift
-    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+    ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@"
   fi
 fi
-fi
+fi ;;
+esac
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+printf "%s\n" "$CC" >&6; }
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
 fi
 
 
@@ -2252,38 +2781,44 @@ if test -z "$CC"; then
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$CC"; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_CC+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
   done
 IFS=$as_save_IFS
 
-fi
+fi ;;
+esac
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+printf "%s\n" "$CC" >&6; }
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
 fi
 
 
@@ -2296,38 +2831,44 @@ if test -z "$CC"; then
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_CC"; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_ac_ct_CC+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) if test -n "$ac_ct_CC"; then
   ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_CC="$ac_prog"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
   done
 IFS=$as_save_IFS
 
-fi
+fi ;;
+esac
 fi
 ac_ct_CC=$ac_cv_prog_ac_ct_CC
 if test -n "$ac_ct_CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
-$as_echo "$ac_ct_CC" >&6; }
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+printf "%s\n" "$ac_ct_CC" >&6; }
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
 fi
 
 
@@ -2339,8 +2880,8 @@ done
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
     CC=$ac_ct_CC
@@ -2348,25 +2889,131 @@ esac
 fi
 
 fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args.
+set dummy ${ac_tool_prefix}clang; ac_word=$2
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_CC+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}clang"
+    printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi ;;
+esac
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+printf "%s\n" "$CC" >&6; }
+else
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "clang", so it can be a program name with args.
+set dummy clang; ac_word=$2
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_ac_ct_CC+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="clang"
+    printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
 
+fi ;;
+esac
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+printf "%s\n" "$ac_ct_CC" >&6; }
+else
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+fi
 
-test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+fi
+
+
+test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}
 as_fn_error $? "no acceptable C compiler found in \$PATH
-See \`config.log' for more details" "$LINENO" 5; }
+See 'config.log' for more details" "$LINENO" 5; }
 
 # Provide some information about the compiler.
-$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
 set X $ac_compile
 ac_compiler=$2
-for ac_option in --version -v -V -qversion; do
+for ac_option in --version -v -V -qversion -version; do
   { { ac_try="$ac_compiler $ac_option >&5"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
+printf "%s\n" "$ac_try_echo"; } >&5
   (eval "$ac_compiler $ac_option >&5") 2>conftest.err
   ac_status=$?
   if test -s conftest.err; then
@@ -2376,7 +3023,7 @@ $as_echo "$ac_try_echo"; } >&5
     cat conftest.er1 >&5
   fi
   rm -f conftest.er1 conftest.err
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }
 done
 
@@ -2384,7 +3031,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
-main ()
+main (void)
 {
 
   ;
@@ -2396,9 +3043,9 @@ ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
 # Try to create an executable without -o first, disregard a.out.
 # It will help us diagnose broken compilers, and finding out an intuition
 # of exeext.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
-$as_echo_n "checking whether the C compiler works... " >&6; }
-ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+printf %s "checking whether the C compiler works... " >&6; }
+ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
 
 # The possible output files:
 ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
@@ -2419,13 +3066,14 @@ case "(($ac_try" in
   *) ac_try_echo=$ac_try;;
 esac
 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
+printf "%s\n" "$ac_try_echo"; } >&5
   (eval "$ac_link_default") 2>&5
   ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then :
-  # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
-# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+then :
+  # Autoconf-2.13 could set the ac_cv_exeext variable to 'no'.
+# So ignore a value of 'no', otherwise this would lead to 'EXEEXT = no'
 # in a Makefile.  We should not override ac_cv_exeext if it was cached,
 # so that the user can short-circuit this test for compilers unknown to
 # Autoconf.
@@ -2440,12 +3088,12 @@ do
 	# certainly right.
 	break;;
     *.* )
-	if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+	if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no;
 	then :; else
 	   ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
 	fi
 	# We set ac_cv_exeext here because the later test for it is not
-	# safe: cross compilers may not add the suffix if given an `-o'
+	# safe: cross compilers may not add the suffix if given an '-o'
 	# argument, so we may need to know it at that point already.
 	# Even if this section looks crufty: it has the advantage of
 	# actually working.
@@ -2456,48 +3104,52 @@ do
 done
 test "$ac_cv_exeext" = no && ac_cv_exeext=
 
-else
-  ac_file=''
+else case e in #(
+  e) ac_file='' ;;
+esac
 fi
-if test -z "$ac_file"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-$as_echo "$as_me: failed program was:" >&5
+if test -z "$ac_file"
+then :
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+printf "%s\n" "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}
 as_fn_error 77 "C compiler cannot create executables
-See \`config.log' for more details" "$LINENO" 5; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
+See 'config.log' for more details" "$LINENO" 5; }
+else case e in #(
+  e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+printf "%s\n" "yes" >&6; } ;;
+esac
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
-$as_echo_n "checking for C compiler default output file name... " >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
-$as_echo "$ac_file" >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+printf %s "checking for C compiler default output file name... " >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+printf "%s\n" "$ac_file" >&6; }
 ac_exeext=$ac_cv_exeext
 
 rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
 ac_clean_files=$ac_clean_files_save
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
-$as_echo_n "checking for suffix of executables... " >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+printf %s "checking for suffix of executables... " >&6; }
 if { { ac_try="$ac_link"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
+printf "%s\n" "$ac_try_echo"; } >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then :
-  # If both `conftest.exe' and `conftest' are `present' (well, observable)
-# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
-# work properly (i.e., refer to `conftest.exe'), while it won't with
-# `rm'.
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+then :
+  # If both 'conftest.exe' and 'conftest' are 'present' (well, observable)
+# catch 'conftest.exe'.  For instance with Cygwin, 'ls conftest' will
+# work properly (i.e., refer to 'conftest.exe'), while it won't with
+# 'rm'.
 for ac_file in conftest.exe conftest conftest.*; do
   test -f "$ac_file" || continue
   case $ac_file in
@@ -2507,15 +3159,16 @@ for ac_file in conftest.exe conftest conftest.*; do
     * ) break;;
   esac
 done
-else
-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+else case e in #(
+  e) { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}
 as_fn_error $? "cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details" "$LINENO" 5; }
+See 'config.log' for more details" "$LINENO" 5; } ;;
+esac
 fi
 rm -f conftest conftest$ac_cv_exeext
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
-$as_echo "$ac_cv_exeext" >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+printf "%s\n" "$ac_cv_exeext" >&6; }
 
 rm -f conftest.$ac_ext
 EXEEXT=$ac_cv_exeext
@@ -2524,9 +3177,11 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include 
 int
-main ()
+main (void)
 {
 FILE *f = fopen ("conftest.out", "w");
+ if (!f)
+  return 1;
  return ferror (f) || fclose (f) != 0;
 
   ;
@@ -2536,8 +3191,8 @@ _ACEOF
 ac_clean_files="$ac_clean_files conftest.out"
 # Check that the compiler produces executables we can run.  If not, either
 # the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
-$as_echo_n "checking whether we are cross compiling... " >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+printf %s "checking whether we are cross compiling... " >&6; }
 if test "$cross_compiling" != yes; then
   { { ac_try="$ac_link"
 case "(($ac_try" in
@@ -2545,10 +3200,10 @@ case "(($ac_try" in
   *) ac_try_echo=$ac_try;;
 esac
 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
+printf "%s\n" "$ac_try_echo"; } >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }
   if { ac_try='./conftest$ac_cv_exeext'
   { { case "(($ac_try" in
@@ -2556,39 +3211,41 @@ $as_echo "$ac_try_echo"; } >&5
   *) ac_try_echo=$ac_try;;
 esac
 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
+printf "%s\n" "$ac_try_echo"; } >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; }; then
     cross_compiling=no
   else
     if test "$cross_compiling" = maybe; then
 	cross_compiling=yes
     else
-	{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details" "$LINENO" 5; }
+	{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}
+as_fn_error 77 "cannot run C compiled programs.
+If you meant to cross compile, use '--host'.
+See 'config.log' for more details" "$LINENO" 5; }
     fi
   fi
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
-$as_echo "$cross_compiling" >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+printf "%s\n" "$cross_compiling" >&6; }
 
-rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+rm -f conftest.$ac_ext conftest$ac_cv_exeext \
+  conftest.o conftest.obj conftest.out
 ac_clean_files=$ac_clean_files_save
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
-$as_echo_n "checking for suffix of object files... " >&6; }
-if ${ac_cv_objext+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+printf %s "checking for suffix of object files... " >&6; }
+if test ${ac_cv_objext+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
-main ()
+main (void)
 {
 
   ;
@@ -2602,11 +3259,12 @@ case "(($ac_try" in
   *) ac_try_echo=$ac_try;;
 esac
 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
+printf "%s\n" "$ac_try_echo"; } >&5
   (eval "$ac_compile") 2>&5
   ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then :
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+then :
   for ac_file in conftest.o conftest.obj conftest.*; do
   test -f "$ac_file" || continue;
   case $ac_file in
@@ -2615,31 +3273,34 @@ $as_echo "$ac_try_echo"; } >&5
        break;;
   esac
 done
-else
-  $as_echo "$as_me: failed program was:" >&5
+else case e in #(
+  e) printf "%s\n" "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}
 as_fn_error $? "cannot compute suffix of object files: cannot compile
-See \`config.log' for more details" "$LINENO" 5; }
+See 'config.log' for more details" "$LINENO" 5; } ;;
+esac
 fi
-rm -f conftest.$ac_cv_objext conftest.$ac_ext
+rm -f conftest.$ac_cv_objext conftest.$ac_ext ;;
+esac
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
-$as_echo "$ac_cv_objext" >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+printf "%s\n" "$ac_cv_objext" >&6; }
 OBJEXT=$ac_cv_objext
 ac_objext=$OBJEXT
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
-$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
-if ${ac_cv_c_compiler_gnu+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5
+printf %s "checking whether the compiler supports GNU C... " >&6; }
+if test ${ac_cv_c_compiler_gnu+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
-main ()
+main (void)
 {
 #ifndef __GNUC__
        choke me
@@ -2649,30 +3310,36 @@ main ()
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+if ac_fn_c_try_compile "$LINENO"
+then :
   ac_compiler_gnu=yes
-else
-  ac_compiler_gnu=no
+else case e in #(
+  e) ac_compiler_gnu=no ;;
+esac
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
 ac_cv_c_compiler_gnu=$ac_compiler_gnu
-
+ ;;
+esac
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
-$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; }
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
 if test $ac_compiler_gnu = yes; then
   GCC=yes
 else
   GCC=
 fi
-ac_test_CFLAGS=${CFLAGS+set}
+ac_test_CFLAGS=${CFLAGS+y}
 ac_save_CFLAGS=$CFLAGS
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
-$as_echo_n "checking whether $CC accepts -g... " >&6; }
-if ${ac_cv_prog_cc_g+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_save_c_werror_flag=$ac_c_werror_flag
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+printf %s "checking whether $CC accepts -g... " >&6; }
+if test ${ac_cv_prog_cc_g+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) ac_save_c_werror_flag=$ac_c_werror_flag
    ac_c_werror_flag=yes
    ac_cv_prog_cc_g=no
    CFLAGS="-g"
@@ -2680,57 +3347,63 @@ else
 /* end confdefs.h.  */
 
 int
-main ()
+main (void)
 {
 
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+if ac_fn_c_try_compile "$LINENO"
+then :
   ac_cv_prog_cc_g=yes
-else
-  CFLAGS=""
+else case e in #(
+  e) CFLAGS=""
       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
-main ()
+main (void)
 {
 
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+if ac_fn_c_try_compile "$LINENO"
+then :
 
-else
-  ac_c_werror_flag=$ac_save_c_werror_flag
+else case e in #(
+  e) ac_c_werror_flag=$ac_save_c_werror_flag
 	 CFLAGS="-g"
 	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
-main ()
+main (void)
 {
 
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+if ac_fn_c_try_compile "$LINENO"
+then :
   ac_cv_prog_cc_g=yes
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
+esac
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
+esac
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-   ac_c_werror_flag=$ac_save_c_werror_flag
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+   ac_c_werror_flag=$ac_save_c_werror_flag ;;
+esac
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
-$as_echo "$ac_cv_prog_cc_g" >&6; }
-if test "$ac_test_CFLAGS" = set; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+printf "%s\n" "$ac_cv_prog_cc_g" >&6; }
+if test $ac_test_CFLAGS; then
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
@@ -2745,232 +3418,153 @@ else
     CFLAGS=
   fi
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
-$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if ${ac_cv_prog_cc_c89+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_prog_cc_c89=no
+ac_prog_cc_stdc=no
+if test x$ac_prog_cc_stdc = xno
+then :
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5
+printf %s "checking for $CC option to enable C11 features... " >&6; }
+if test ${ac_cv_prog_cc_c11+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) ac_cv_prog_cc_c11=no
 ac_save_CC=$CC
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include 
-#include 
-struct stat;
-/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
-struct buf { int x; };
-FILE * (*rcsopen) (struct buf *, struct stat *, int);
-static char *e (p, i)
-     char **p;
-     int i;
-{
-  return p[i];
-}
-static char *f (char * (*g) (char **, int), char **p, ...)
-{
-  char *s;
-  va_list v;
-  va_start (v,p);
-  s = g (p, va_arg (v,int));
-  va_end (v);
-  return s;
-}
-
-/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
-   function prototypes and stuff, but not '\xHH' hex character constants.
-   These don't provoke an error unfortunately, instead are silently treated
-   as 'x'.  The following induces an error, until -std is added to get
-   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
-   array size at least.  It's necessary to write '\x00'==0 to get something
-   that's true only with -std.  */
-int osf4_cc_array ['\x00' == 0 ? 1 : -1];
-
-/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
-   inside strings and character constants.  */
-#define FOO(x) 'x'
-int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
-
-int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};
-int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
-int argc;
-char **argv;
-int
-main ()
-{
-return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
-  ;
-  return 0;
-}
+$ac_c_conftest_c11_program
 _ACEOF
-for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
-	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+for ac_arg in '' -std=gnu11
 do
   CC="$ac_save_CC $ac_arg"
-  if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_prog_cc_c89=$ac_arg
+  if ac_fn_c_try_compile "$LINENO"
+then :
+  ac_cv_prog_cc_c11=$ac_arg
 fi
-rm -f core conftest.err conftest.$ac_objext
-  test "x$ac_cv_prog_cc_c89" != "xno" && break
+rm -f core conftest.err conftest.$ac_objext conftest.beam
+  test "x$ac_cv_prog_cc_c11" != "xno" && break
 done
 rm -f conftest.$ac_ext
-CC=$ac_save_CC
+CC=$ac_save_CC ;;
+esac
+fi
 
+if test "x$ac_cv_prog_cc_c11" = xno
+then :
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+printf "%s\n" "unsupported" >&6; }
+else case e in #(
+  e) if test "x$ac_cv_prog_cc_c11" = x
+then :
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+printf "%s\n" "none needed" >&6; }
+else case e in #(
+  e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5
+printf "%s\n" "$ac_cv_prog_cc_c11" >&6; }
+     CC="$CC $ac_cv_prog_cc_c11" ;;
+esac
 fi
-# AC_CACHE_VAL
-case "x$ac_cv_prog_cc_c89" in
-  x)
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
-$as_echo "none needed" >&6; } ;;
-  xno)
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
-$as_echo "unsupported" >&6; } ;;
-  *)
-    CC="$CC $ac_cv_prog_cc_c89"
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
-$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+  ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11
+  ac_prog_cc_stdc=c11 ;;
 esac
-if test "x$ac_cv_prog_cc_c89" != xno; then :
-
 fi
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
-$as_echo_n "checking how to run the C preprocessor... " >&6; }
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
-  CPP=
-fi
-if test -z "$CPP"; then
-  if ${ac_cv_prog_CPP+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-      # Double quotes because CPP needs to be expanded
-    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
-    do
-      ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
-  # Use a header file that comes with gcc, so configuring glibc
-  # with a fresh cross-compiler works.
-  # Prefer  to  if __STDC__ is defined, since
-  #  exists even on freestanding compilers.
-  # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp. "Syntax error" is here to catch this case.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include 
-#else
-# include 
-#endif
-		     Syntax error
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-
-else
-  # Broken: fails on valid input.
-continue
 fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+if test x$ac_prog_cc_stdc = xno
+then :
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5
+printf %s "checking for $CC option to enable C99 features... " >&6; }
+if test ${ac_cv_prog_cc_c99+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) ac_cv_prog_cc_c99=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include 
+$ac_c_conftest_c99_program
 _ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-  # Broken: success on invalid input.
-continue
-else
-  # Passes both tests.
-ac_preproc_ok=:
-break
+for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99=
+do
+  CC="$ac_save_CC $ac_arg"
+  if ac_fn_c_try_compile "$LINENO"
+then :
+  ac_cv_prog_cc_c99=$ac_arg
 fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
+rm -f core conftest.err conftest.$ac_objext conftest.beam
+  test "x$ac_cv_prog_cc_c99" != "xno" && break
 done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.i conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then :
-  break
+rm -f conftest.$ac_ext
+CC=$ac_save_CC ;;
+esac
 fi
 
-    done
-    ac_cv_prog_CPP=$CPP
-
+if test "x$ac_cv_prog_cc_c99" = xno
+then :
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+printf "%s\n" "unsupported" >&6; }
+else case e in #(
+  e) if test "x$ac_cv_prog_cc_c99" = x
+then :
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+printf "%s\n" "none needed" >&6; }
+else case e in #(
+  e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5
+printf "%s\n" "$ac_cv_prog_cc_c99" >&6; }
+     CC="$CC $ac_cv_prog_cc_c99" ;;
+esac
 fi
-  CPP=$ac_cv_prog_CPP
-else
-  ac_cv_prog_CPP=$CPP
+  ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99
+  ac_prog_cc_stdc=c99 ;;
+esac
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
-$as_echo "$CPP" >&6; }
-ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
-  # Use a header file that comes with gcc, so configuring glibc
-  # with a fresh cross-compiler works.
-  # Prefer  to  if __STDC__ is defined, since
-  #  exists even on freestanding compilers.
-  # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp. "Syntax error" is here to catch this case.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include 
-#else
-# include 
-#endif
-		     Syntax error
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-
-else
-  # Broken: fails on valid input.
-continue
 fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+if test x$ac_prog_cc_stdc = xno
+then :
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5
+printf %s "checking for $CC option to enable C89 features... " >&6; }
+if test ${ac_cv_prog_cc_c89+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include 
+$ac_c_conftest_c89_program
 _ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-  # Broken: success on invalid input.
-continue
-else
-  # Passes both tests.
-ac_preproc_ok=:
-break
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  if ac_fn_c_try_compile "$LINENO"
+then :
+  ac_cv_prog_cc_c89=$ac_arg
 fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
+rm -f core conftest.err conftest.$ac_objext conftest.beam
+  test "x$ac_cv_prog_cc_c89" != "xno" && break
 done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.i conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then :
+rm -f conftest.$ac_ext
+CC=$ac_save_CC ;;
+esac
+fi
 
-else
-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5; }
+if test "x$ac_cv_prog_cc_c89" = xno
+then :
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+printf "%s\n" "unsupported" >&6; }
+else case e in #(
+  e) if test "x$ac_cv_prog_cc_c89" = x
+then :
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+printf "%s\n" "none needed" >&6; }
+else case e in #(
+  e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+printf "%s\n" "$ac_cv_prog_cc_c89" >&6; }
+     CC="$CC $ac_cv_prog_cc_c89" ;;
+esac
+fi
+  ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89
+  ac_prog_cc_stdc=c89 ;;
+esac
+fi
 fi
 
 ac_ext=c
@@ -2980,245 +3574,54 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
-$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
-if ${ac_cv_path_GREP+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -z "$GREP"; then
-  ac_path_GREP_found=false
-  # Loop through the user's path and test for each of PROGNAME-LIST
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_prog in grep ggrep; do
-    for ac_exec_ext in '' $ac_executable_extensions; do
-      ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
-      as_fn_executable_p "$ac_path_GREP" || continue
-# Check for GNU ac_path_GREP and select it if it is found.
-  # Check for GNU $ac_path_GREP
-case `"$ac_path_GREP" --version 2>&1` in
-*GNU*)
-  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
-*)
-  ac_count=0
-  $as_echo_n 0123456789 >"conftest.in"
-  while :
-  do
-    cat "conftest.in" "conftest.in" >"conftest.tmp"
-    mv "conftest.tmp" "conftest.in"
-    cp "conftest.in" "conftest.nl"
-    $as_echo 'GREP' >> "conftest.nl"
-    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
-    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    as_fn_arith $ac_count + 1 && ac_count=$as_val
-    if test $ac_count -gt ${ac_path_GREP_max-0}; then
-      # Best one so far, save it but keep looking for a better one
-      ac_cv_path_GREP="$ac_path_GREP"
-      ac_path_GREP_max=$ac_count
-    fi
-    # 10*(2^10) chars as input seems more than enough
-    test $ac_count -gt 10 && break
-  done
-  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
-      $ac_path_GREP_found && break 3
-    done
-  done
-  done
-IFS=$as_save_IFS
-  if test -z "$ac_cv_path_GREP"; then
-    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
-  fi
-else
-  ac_cv_path_GREP=$GREP
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
-$as_echo "$ac_cv_path_GREP" >&6; }
- GREP="$ac_cv_path_GREP"
-
+## we need HAVE_..._H for R-ext/eventloop.h which requires
+## defines from R's config.h which are not shipped with R
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
-$as_echo_n "checking for egrep... " >&6; }
-if ${ac_cv_path_EGREP+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
-   then ac_cv_path_EGREP="$GREP -E"
-   else
-     if test -z "$EGREP"; then
-  ac_path_EGREP_found=false
-  # Loop through the user's path and test for each of PROGNAME-LIST
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+ac_header= ac_cache=
+for ac_item in $ac_header_c_list
 do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_prog in egrep; do
-    for ac_exec_ext in '' $ac_executable_extensions; do
-      ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
-      as_fn_executable_p "$ac_path_EGREP" || continue
-# Check for GNU ac_path_EGREP and select it if it is found.
-  # Check for GNU $ac_path_EGREP
-case `"$ac_path_EGREP" --version 2>&1` in
-*GNU*)
-  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
-*)
-  ac_count=0
-  $as_echo_n 0123456789 >"conftest.in"
-  while :
-  do
-    cat "conftest.in" "conftest.in" >"conftest.tmp"
-    mv "conftest.tmp" "conftest.in"
-    cp "conftest.in" "conftest.nl"
-    $as_echo 'EGREP' >> "conftest.nl"
-    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
-    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    as_fn_arith $ac_count + 1 && ac_count=$as_val
-    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
-      # Best one so far, save it but keep looking for a better one
-      ac_cv_path_EGREP="$ac_path_EGREP"
-      ac_path_EGREP_max=$ac_count
+  if test $ac_cache; then
+    ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default"
+    if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then
+      printf "%s\n" "#define $ac_item 1" >> confdefs.h
     fi
-    # 10*(2^10) chars as input seems more than enough
-    test $ac_count -gt 10 && break
-  done
-  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
-      $ac_path_EGREP_found && break 3
-    done
-  done
-  done
-IFS=$as_save_IFS
-  if test -z "$ac_cv_path_EGREP"; then
-    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+    ac_header= ac_cache=
+  elif test $ac_header; then
+    ac_cache=$ac_item
+  else
+    ac_header=$ac_item
   fi
-else
-  ac_cv_path_EGREP=$EGREP
-fi
-
-   fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
-$as_echo "$ac_cv_path_EGREP" >&6; }
- EGREP="$ac_cv_path_EGREP"
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
-$as_echo_n "checking for ANSI C header files... " >&6; }
-if ${ac_cv_header_stdc+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include 
-#include 
-#include 
-#include 
+done
 
-int
-main ()
-{
 
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_header_stdc=yes
-else
-  ac_cv_header_stdc=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
-if test $ac_cv_header_stdc = yes; then
-  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include 
 
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "memchr" >/dev/null 2>&1; then :
 
-else
-  ac_cv_header_stdc=no
-fi
-rm -f conftest*
 
-fi
 
-if test $ac_cv_header_stdc = yes; then
-  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include 
 
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "free" >/dev/null 2>&1; then :
+if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes
+then :
 
-else
-  ac_cv_header_stdc=no
-fi
-rm -f conftest*
+printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h
 
 fi
+ac_fn_c_check_header_compile "$LINENO" "sys/time.h" "ac_cv_header_sys_time_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_time_h" = xyes
+then :
+  printf "%s\n" "#define HAVE_SYS_TIME_H 1" >>confdefs.h
 
-if test $ac_cv_header_stdc = yes; then
-  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-  if test "$cross_compiling" = yes; then :
-  :
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include 
-#include 
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) \
-		   (('a' <= (c) && (c) <= 'i') \
-		     || ('j' <= (c) && (c) <= 'r') \
-		     || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
-
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int
-main ()
-{
-  int i;
-  for (i = 0; i < 256; i++)
-    if (XOR (islower (i), ISLOWER (i))
-	|| toupper (i) != TOUPPER (i))
-      return 2;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-
-else
-  ac_cv_header_stdc=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
+ac_fn_c_check_header_compile "$LINENO" "sys/types.h" "ac_cv_header_sys_types_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_types_h" = xyes
+then :
+  printf "%s\n" "#define HAVE_SYS_TYPES_H 1" >>confdefs.h
 
 fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
-$as_echo "$ac_cv_header_stdc" >&6; }
-if test $ac_cv_header_stdc = yes; then
-
-$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+ac_fn_c_check_header_compile "$LINENO" "sys/select.h" "ac_cv_header_sys_select_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_select_h" = xyes
+then :
+  printf "%s\n" "#define HAVE_SYS_SELECT_H 1" >>confdefs.h
 
 fi
 
@@ -3230,7 +3633,7 @@ fi
 
 
 if test -n "${CONFIGURED}"; then
-## re-map varibles that don't match
+## re-map variables that don't match
 JAVA_PROG="${JAVA}"
 JAVA_INC="${JAVA_CPPFLAGS}"
 JAVA_LD_PATH="${JAVA_LD_LIBRARY_PATH}"
@@ -3250,12 +3653,13 @@ for ac_prog in java
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_JAVA_PROG+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $JAVA_PROG in
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_path_JAVA_PROG+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) case $JAVA_PROG in
   [\\/]* | ?:[\\/]*)
   ac_cv_path_JAVA_PROG="$JAVA_PROG" # Let the user override the test with a path.
   ;;
@@ -3264,11 +3668,15 @@ else
 for as_dir in ${JAVA_PATH}
 do
   IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_JAVA_PROG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+  if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
+    ac_cv_path_JAVA_PROG="$as_dir$ac_word$ac_exec_ext"
+    printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -3276,15 +3684,16 @@ done
 IFS=$as_save_IFS
 
   ;;
+esac ;;
 esac
 fi
 JAVA_PROG=$ac_cv_path_JAVA_PROG
 if test -n "$JAVA_PROG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVA_PROG" >&5
-$as_echo "$JAVA_PROG" >&6; }
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $JAVA_PROG" >&5
+printf "%s\n" "$JAVA_PROG" >&6; }
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
 fi
 
 
@@ -3296,12 +3705,13 @@ for ac_prog in javac
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_JAVAC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $JAVAC in
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_path_JAVAC+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) case $JAVAC in
   [\\/]* | ?:[\\/]*)
   ac_cv_path_JAVAC="$JAVAC" # Let the user override the test with a path.
   ;;
@@ -3310,11 +3720,15 @@ else
 for as_dir in ${JAVA_PATH}
 do
   IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_JAVAC="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+  if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
+    ac_cv_path_JAVAC="$as_dir$ac_word$ac_exec_ext"
+    printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -3322,15 +3736,16 @@ done
 IFS=$as_save_IFS
 
   ;;
+esac ;;
 esac
 fi
 JAVAC=$ac_cv_path_JAVAC
 if test -n "$JAVAC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVAC" >&5
-$as_echo "$JAVAC" >&6; }
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $JAVAC" >&5
+printf "%s\n" "$JAVAC" >&6; }
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
 fi
 
 
@@ -3341,12 +3756,13 @@ for ac_prog in javah
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_JAVAH+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $JAVAH in
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_path_JAVAH+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) case $JAVAH in
   [\\/]* | ?:[\\/]*)
   ac_cv_path_JAVAH="$JAVAH" # Let the user override the test with a path.
   ;;
@@ -3355,11 +3771,15 @@ else
 for as_dir in ${JAVA_PATH}
 do
   IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_JAVAH="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+  if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
+    ac_cv_path_JAVAH="$as_dir$ac_word$ac_exec_ext"
+    printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -3367,15 +3787,16 @@ done
 IFS=$as_save_IFS
 
   ;;
+esac ;;
 esac
 fi
 JAVAH=$ac_cv_path_JAVAH
 if test -n "$JAVAH"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVAH" >&5
-$as_echo "$JAVAH" >&6; }
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $JAVAH" >&5
+printf "%s\n" "$JAVAH" >&6; }
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
 fi
 
 
@@ -3386,12 +3807,13 @@ for ac_prog in jar
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_JAR+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $JAR in
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_path_JAR+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) case $JAR in
   [\\/]* | ?:[\\/]*)
   ac_cv_path_JAR="$JAR" # Let the user override the test with a path.
   ;;
@@ -3400,11 +3822,15 @@ else
 for as_dir in ${JAVA_PATH}
 do
   IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_JAR="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+  if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
+    ac_cv_path_JAR="$as_dir$ac_word$ac_exec_ext"
+    printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -3412,15 +3838,16 @@ done
 IFS=$as_save_IFS
 
   ;;
+esac ;;
 esac
 fi
 JAR=$ac_cv_path_JAR
 if test -n "$JAR"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAR" >&5
-$as_echo "$JAR" >&6; }
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $JAR" >&5
+printf "%s\n" "$JAR" >&6; }
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
 fi
 
 
@@ -3429,10 +3856,59 @@ done
 
 fi
 
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking Java version" >&5
+printf %s "checking Java version... " >&6; }
+JVER=`"$JAVA" -version 2>&1 | sed -n 's:^.* version "::p' | sed 's:".*::'`
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $JVER" >&5
+printf "%s\n" "$JVER" >&6; }
+
+if test -z "$JVER"; then
+   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: **** Cannot detect Java version - the java -version output is unknown! ****" >&5
+printf "%s\n" "$as_me: WARNING: **** Cannot detect Java version - the java -version output is unknown! ****" >&2;}
+else
+   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking Java compatibility version (integer)" >&5
+printf %s "checking Java compatibility version (integer)... " >&6; }
+   ## .. Oracle decided to completely screw up Java version so have to try extract something meaningful ..
+   if echo $JVER | grep '^1\.' >/dev/null; then ## old style 1.X
+      JMVER=`echo $JVER | sed 's:^..::' | sed 's:\..*::'`
+   else ## new stype omitting the major version
+      JMVER=`echo $JVER | sed 's:\..*::'`
+   fi
+   ## strip -.* for versions like 13-ea
+   JMVER=`echo $JMVER | sed 's:-.*::'`
+   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $JMVER" >&5
+printf "%s\n" "$JMVER" >&6; }
+fi
+
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $JAVAH actually works" >&5
+printf %s "checking whether $JAVAH actually works... " >&6; }
+if "$JAVAH" -version >/dev/null 2>&1; then
+   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+printf "%s\n" "yes" >&6; }
+else
+   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+   JAVAH=
+fi
+
 have_all_java=yes
+## Java 1.10 has no javah anymore -- it uses javac -h . instaead
+if test -z "$JAVAH"; then
+   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether javah was replaced by javac -h" >&5
+printf %s "checking whether javah was replaced by javac -h... " >&6; }
+   if test "$JMVER" -gt 9; then
+      { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+printf "%s\n" "yes" >&6; }
+      ## create headres in the compile step instead
+      JFLAGS=' -h .'
+   else
+      { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+      have_all_java=no;
+   fi
+fi
 if test -z "$JAVA_PROG"; then have_all_java=no; fi
 if test -z "$JAVAC"; then have_all_java=no; fi
-if test -z "$JAVAH"; then have_all_java=no; fi
 if test -z "$JAR"; then have_all_java=no; fi
 if test ${have_all_java} = no; then
   as_fn_error $? "one or more Java tools are missing.
@@ -3440,11 +3916,31 @@ if test ${have_all_java} = no; then
 *** JDK is incomplete! Please make sure you have a complete JDK. JRE is *not* sufficient." "$LINENO" 5
 fi
 
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for target flags" >&5
+printf %s "checking for target flags... " >&6; }
+## set JFLAGS target -- depends on the JDK version
+if echo $JFLAGS | grep '[-]target' >/dev/null; then
+   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: user-supplied: $JFLAGS" >&5
+printf "%s\n" "user-supplied: $JFLAGS" >&6; }
+else
+   if test "$JMVER" -lt 9; then
+      JFLAGS="$JFLAGS -target 1.4 -source 1.4"
+   else
+      if test "$JMVER" -lt 12; then
+         JFLAGS="$JFLAGS -target 1.6 -source 1.6"
+      else
+         JFLAGS="$JFLAGS -target 1.8 -source 1.8"
+      fi
+   fi
+   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $JFLAGS" >&5
+printf "%s\n" "$JFLAGS" >&6; }
+fi
+
 ## this is where our test-class lives
 getsp_cp=tools
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Java interpreter works" >&5
-$as_echo_n "checking whether Java interpreter works... " >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether Java interpreter works" >&5
+printf %s "checking whether Java interpreter works... " >&6; }
 acx_java_works=no
 if test -n "${JAVA_PROG}" ; then
 
@@ -3474,11 +3970,11 @@ fi
 if test -z "${CONFIGURED}"; then
 
 if test ${acx_java_works} = yes; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+printf "%s\n" "yes" >&6; }
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Java environment" >&5
-$as_echo_n "checking for Java environment... " >&6; }
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Java environment" >&5
+printf %s "checking for Java environment... " >&6; }
   ## retrieve JAVA_HOME from Java itself if not set
   if test -z "${JAVA_HOME}" ; then
 
@@ -3497,17 +3993,19 @@ $as_echo_n "checking for Java environment... " >&6; }
   ## the availability of JAVA_HOME will tell us whether it's supported
   if test -z "${JAVA_HOME}" ; then
     if test x$acx_java_env_msg != xyes; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
-$as_echo "not found" >&6; }
+      { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+printf "%s\n" "not found" >&6; }
     fi
   else
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: in ${JAVA_HOME}" >&5
-$as_echo "in ${JAVA_HOME}" >&6; }
+    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: in ${JAVA_HOME}" >&5
+printf "%s\n" "in ${JAVA_HOME}" >&6; }
 
     case "${host_os}" in
       darwin*)
-        JAVA_LIBS="-framework JavaVM"
-        JAVA_LD_PATH=
+        if  -z "${JAVA_LIBS}" ; then
+          JAVA_LIBS="-framework JavaVM"
+          JAVA_LD_PATH=
+        fi
         ;;
       *)
 
@@ -3541,79 +4039,94 @@ $as_echo "in ${JAVA_HOME}" >&6; }
     have_java=yes
   fi
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
   as_fn_error $? "Java not found. Please install JDK 1.4 or later, make sure that the binaries are on the PATH and re-try. If that doesn't work, set JAVA_HOME correspondingly." "$LINENO" 5
 fi
 
-as_ac_File=`$as_echo "ac_cv_file_${JAVA_HOME}/include/jni.h" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${JAVA_HOME}/include/jni.h" >&5
-$as_echo_n "checking for ${JAVA_HOME}/include/jni.h... " >&6; }
-if eval \${$as_ac_File+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  test "$cross_compiling" = yes &&
+as_ac_File=`printf "%s\n" "ac_cv_file_${JAVA_HOME}/include/jni.h" | sed "$as_sed_sh"`
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ${JAVA_HOME}/include/jni.h" >&5
+printf %s "checking for ${JAVA_HOME}/include/jni.h... " >&6; }
+if eval test \${$as_ac_File+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) test "$cross_compiling" = yes &&
   as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
 if test -r "${JAVA_HOME}/include/jni.h"; then
   eval "$as_ac_File=yes"
 else
   eval "$as_ac_File=no"
-fi
+fi ;;
+esac
 fi
 eval ac_res=\$$as_ac_File
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_File"\" = x"yes"; then :
+	       { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+printf "%s\n" "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_File"\" = x"yes"
+then :
   JNI_H="${JAVA_HOME}/include"
-else
-  as_ac_File=`$as_echo "ac_cv_file_${JAVA_HOME}/jni.h" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${JAVA_HOME}/jni.h" >&5
-$as_echo_n "checking for ${JAVA_HOME}/jni.h... " >&6; }
-if eval \${$as_ac_File+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  test "$cross_compiling" = yes &&
+else case e in #(
+  e) as_ac_File=`printf "%s\n" "ac_cv_file_${JAVA_HOME}/jni.h" | sed "$as_sed_sh"`
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ${JAVA_HOME}/jni.h" >&5
+printf %s "checking for ${JAVA_HOME}/jni.h... " >&6; }
+if eval test \${$as_ac_File+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) test "$cross_compiling" = yes &&
   as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
 if test -r "${JAVA_HOME}/jni.h"; then
   eval "$as_ac_File=yes"
 else
   eval "$as_ac_File=no"
-fi
+fi ;;
+esac
 fi
 eval ac_res=\$$as_ac_File
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_File"\" = x"yes"; then :
+	       { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+printf "%s\n" "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_File"\" = x"yes"
+then :
   JNI_H="${JAVA_HOME}"
-else
-  as_ac_File=`$as_echo "ac_cv_file_${JAVA_HOME}/../include/jni.h" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${JAVA_HOME}/../include/jni.h" >&5
-$as_echo_n "checking for ${JAVA_HOME}/../include/jni.h... " >&6; }
-if eval \${$as_ac_File+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  test "$cross_compiling" = yes &&
+else case e in #(
+  e) as_ac_File=`printf "%s\n" "ac_cv_file_${JAVA_HOME}/../include/jni.h" | sed "$as_sed_sh"`
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ${JAVA_HOME}/../include/jni.h" >&5
+printf %s "checking for ${JAVA_HOME}/../include/jni.h... " >&6; }
+if eval test \${$as_ac_File+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) test "$cross_compiling" = yes &&
   as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
 if test -r "${JAVA_HOME}/../include/jni.h"; then
   eval "$as_ac_File=yes"
 else
   eval "$as_ac_File=no"
-fi
+fi ;;
+esac
 fi
 eval ac_res=\$$as_ac_File
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_File"\" = x"yes"; then :
+	       { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+printf "%s\n" "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_File"\" = x"yes"
+then :
   JNI_H="${JAVA_HOME}/../include"
-else
-  as_fn_error $? "jni headers not found. Please make sure you have a proper JDK installed." "$LINENO" 5
-
+else case e in #(
+  e) as_fn_error $? "Cannot compile JNI programs, check jri/config.log for details.
+Please make sure you have a proper JDK installed.
+Use --disable-jri when you install rJava and don't need JRI.
+" "$LINENO" 5
+   ;;
+esac
 fi
 
-
+  ;;
+esac
 fi
 
-
+ ;;
+esac
 fi
 
 
@@ -3626,24 +4139,27 @@ JAVA_INC="-I${JNI_H}"
 # at least as of now - 01/2004)
 jac_found_md=no
 for mddir in . linux solaris ppc irix alpha aix hp-ux genunix cygwin win32 freebsd; do
-as_ac_File=`$as_echo "ac_cv_file_${JNI_H}/$mddir/jni_md.h" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${JNI_H}/$mddir/jni_md.h" >&5
-$as_echo_n "checking for ${JNI_H}/$mddir/jni_md.h... " >&6; }
-if eval \${$as_ac_File+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  test "$cross_compiling" = yes &&
+as_ac_File=`printf "%s\n" "ac_cv_file_${JNI_H}/$mddir/jni_md.h" | sed "$as_sed_sh"`
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ${JNI_H}/$mddir/jni_md.h" >&5
+printf %s "checking for ${JNI_H}/$mddir/jni_md.h... " >&6; }
+if eval test \${$as_ac_File+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) test "$cross_compiling" = yes &&
   as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
 if test -r "${JNI_H}/$mddir/jni_md.h"; then
   eval "$as_ac_File=yes"
 else
   eval "$as_ac_File=no"
-fi
+fi ;;
+esac
 fi
 eval ac_res=\$$as_ac_File
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_File"\" = x"yes"; then :
+	       { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+printf "%s\n" "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_File"\" = x"yes"
+then :
   JAVA_INC="${JAVA_INC} -I${JNI_H}/$mddir" jac_found_md=yes
 fi
 
@@ -3658,8 +4174,8 @@ if test `echo foo | sed -e 's:foo:bar:'` = bar; then
    JAVA_LIBS0=`echo ${JAVA_LIBS} | sed -e 's:$(JAVA_HOME):'${JAVA_HOME}':g'`
    JAVA_LD_PATH0=`echo ${JAVA_LD_PATH} | sed -e 's:$(JAVA_HOME):'${JAVA_HOME}':g'`
 else
-   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: sed is not working properly - the configuration may fail" >&5
-$as_echo "$as_me: WARNING: sed is not working properly - the configuration may fail" >&2;}
+   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: sed is not working properly - the configuration may fail" >&5
+printf "%s\n" "$as_me: WARNING: sed is not working properly - the configuration may fail" >&2;}
    JAVA_INC0="${JAVA_INC}"
    JAVA_LIBS0="${JAVA_LIBS}"
    JAVA_LD_PATH0="${JAVA_LD_PATH}"
@@ -3668,8 +4184,8 @@ fi
 LIBS="${LIBS} ${JAVA_LIBS0}"
 CFLAGS="${CFLAGS} ${JAVA_CFLAGS} ${JAVA_INC0}"
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether JNI programs can be compiled" >&5
-$as_echo_n "checking whether JNI programs can be compiled... " >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether JNI programs can be compiled" >&5
+printf %s "checking whether JNI programs can be compiled... " >&6; }
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -3680,27 +4196,30 @@ int main(void) {
 }
 
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
-  as_fn_error $? "Cannot compile a simple JNI program. See config.log for details." "$LINENO" 5
+if ac_fn_c_try_link "$LINENO"
+then :
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+printf "%s\n" "yes" >&6; }
+else case e in #(
+  e) as_fn_error $? "Cannot compile a simple JNI program. See config.log for details." "$LINENO" 5 ;;
+esac
 fi
-rm -f core conftest.err conftest.$ac_objext \
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
     conftest$ac_exeext conftest.$ac_ext
 
 LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${JAVA_LD_PATH0}
 export LD_LIBRARY_PATH
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether JNI programs can be run" >&5
-$as_echo_n "checking whether JNI programs can be run... " >&6; }
-if test "$cross_compiling" = yes; then :
-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether JNI programs can be run" >&5
+printf %s "checking whether JNI programs can be run... " >&6; }
+if test "$cross_compiling" = yes
+then :
+  { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}
 as_fn_error $? "cannot run test program while cross compiling
-See \`config.log' for more details" "$LINENO" 5; }
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+See 'config.log' for more details" "$LINENO" 5; }
+else case e in #(
+  e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 #include 
@@ -3710,26 +4229,32 @@ int main(void) {
 }
 
 _ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
-  as_fn_error $? "Cannot run a simple JNI program - probably your jvm library is in non-standard location or JVM is unsupported. See config.log for details." "$LINENO" 5
+if ac_fn_c_try_run "$LINENO"
+then :
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+printf "%s\n" "yes" >&6; }
+else case e in #(
+  e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+	 as_fn_error $? "Cannot run a simple JNI program - probably your jvm library is in non-standard location or JVM is unsupported. See config.log for details." "$LINENO" 5 ;;
+esac
 fi
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
+  conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
+esac
 fi
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking JNI data types" >&5
-$as_echo_n "checking JNI data types... " >&6; }
-if test "$cross_compiling" = yes; then :
-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking JNI data types" >&5
+printf %s "checking JNI data types... " >&6; }
+if test "$cross_compiling" = yes
+then :
+  { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}
 as_fn_error $? "cannot run test program while cross compiling
-See \`config.log' for more details" "$LINENO" 5; }
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+See 'config.log' for more details" "$LINENO" 5; }
+else case e in #(
+  e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 #include 
@@ -3738,14 +4263,17 @@ int main(void) {
 }
 
 _ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
-$as_echo "ok" >&6; }
-else
-  as_fn_error $? "One or more JNI types differ from the corresponding native type. You may need to use non-standard compiler flags or a different compiler in order to fix this." "$LINENO" 5
+if ac_fn_c_try_run "$LINENO"
+then :
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+printf "%s\n" "ok" >&6; }
+else case e in #(
+  e) as_fn_error $? "One or more JNI types differ from the corresponding native type. You may need to use non-standard compiler flags or a different compiler in order to fix this." "$LINENO" 5 ;;
+esac
 fi
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
+  conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
+esac
 fi
 
 
@@ -3758,7 +4286,7 @@ JNILD=`"${RBIN}" CMD config SHLIB_LDFLAGS`" ${JAVA_LIBS}"
 case "${host_os}" in
   darwin*)
     JNISO=.jnilib
-    JNILD="-dynamiclib -framework JavaVM"
+    JNILD="-dynamiclib $JNILD"
     CPICF=-fno-common
 
     if test -e "${R_HOME}/lib/i386" -a -e "${R_HOME}/lib/ppc" -a -e "${R_HOME}/lib/libR.dylib"; then
@@ -3793,8 +4321,8 @@ esac
 origCFLAGS=$CFLAGS
 CFLAGS="${CFLAGS} ${R_CFLAGS} ${RINC}"
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Rinterface.h exports R_CStackXXX variables" >&5
-$as_echo_n "checking whether Rinterface.h exports R_CStackXXX variables... " >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether Rinterface.h exports R_CStackXXX variables" >&5
+printf %s "checking whether Rinterface.h exports R_CStackXXX variables... " >&6; }
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -3806,18 +4334,20 @@ int main(void) {
 }
 
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
+if ac_fn_c_try_compile "$LINENO"
+then :
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+printf "%s\n" "yes" >&6; }
            DEFFLAGS="${DEFFLAGS} -DRIF_HAS_CSTACK"
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+else case e in #(
+  e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; } ;;
+esac
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Rinterface.h exports R_SignalHandlers" >&5
-$as_echo_n "checking whether Rinterface.h exports R_SignalHandlers... " >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether Rinterface.h exports R_SignalHandlers" >&5
+printf %s "checking whether Rinterface.h exports R_SignalHandlers... " >&6; }
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -3828,15 +4358,17 @@ int main(void) {
 }
 
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
+if ac_fn_c_try_compile "$LINENO"
+then :
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+printf "%s\n" "yes" >&6; }
            DEFFLAGS="${DEFFLAGS} -DRIF_HAS_RSIGHAND"
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+else case e in #(
+  e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; } ;;
+esac
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
 
 CFLAGS=${origCFLAGS}
 
@@ -3858,6 +4390,7 @@ CFLAGS=${origCFLAGS}
 
 
 
+
 
 
 ac_config_files="$ac_config_files src/Makefile"
@@ -3877,8 +4410,8 @@ cat >confcache <<\_ACEOF
 # config.status only pays attention to the cache file if you give it
 # the --recheck option to rerun configure.
 #
-# `ac_cv_env_foo' variables (set or unset) will be overridden when
-# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# 'ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* 'ac_cv_foo' will be assigned the
 # following values.
 
 _ACEOF
@@ -3894,8 +4427,8 @@ _ACEOF
     case $ac_val in #(
     *${as_nl}*)
       case $ac_var in #(
-      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
-$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+      *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
       esac
       case $ac_var in #(
       _ | IFS | as_nl) ;; #(
@@ -3908,14 +4441,14 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
   (set) 2>&1 |
     case $as_nl`(ac_space=' '; set) 2>&1` in #(
     *${as_nl}ac_space=\ *)
-      # `set' does not quote correctly, so add quotes: double-quote
+      # 'set' does not quote correctly, so add quotes: double-quote
       # substitution turns \\\\ into \\, and sed turns \\ into \.
       sed -n \
 	"s/'/'\\\\''/g;
 	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
       ;; #(
     *)
-      # `set' quotes correctly as required by POSIX, so do not add quotes.
+      # 'set' quotes correctly as required by POSIX, so do not add quotes.
       sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
       ;;
     esac |
@@ -3925,15 +4458,15 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
      /^ac_cv_env_/b end
      t clear
      :clear
-     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+     s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/
      t end
      s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
      :end' >>confcache
 if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
   if test -w "$cache_file"; then
     if test "x$cache_file" != "x/dev/null"; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
-$as_echo "$as_me: updating cache $cache_file" >&6;}
+      { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
+printf "%s\n" "$as_me: updating cache $cache_file" >&6;}
       if test ! -f "$cache_file" || test -h "$cache_file"; then
 	cat confcache >"$cache_file"
       else
@@ -3947,8 +4480,8 @@ $as_echo "$as_me: updating cache $cache_file" >&6;}
       fi
     fi
   else
-    { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
-$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
+printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;}
   fi
 fi
 rm -f confcache
@@ -3965,7 +4498,7 @@ U=
 for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
   # 1. Remove the extension, and $U if already installed.
   ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
-  ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+  ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"`
   # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
   #    will be set to the directory where LIBOBJS objects are built.
   as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
@@ -3981,8 +4514,8 @@ LTLIBOBJS=$ac_ltlibobjs
 ac_write_fail=0
 ac_clean_files_save=$ac_clean_files
 ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
-$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
+printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;}
 as_write_fail=0
 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
 #! $SHELL
@@ -4005,63 +4538,65 @@ cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
 
 # Be more Bourne compatible
 DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1
+then :
   emulate sh
   NULLCMD=:
   # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
   # is contrary to our usage.  Disable this feature.
   alias -g '${1+"$@"}'='"$@"'
   setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in #(
+else case e in #(
+  e) case `(set -o) 2>/dev/null` in #(
   *posix*) :
     set -o posix ;; #(
   *) :
      ;;
+esac ;;
 esac
 fi
 
 
+
+# Reset variables that may have inherited troublesome values from
+# the environment.
+
+# IFS needs to be set, to space, tab, and newline, in precisely that order.
+# (If _AS_PATH_WALK were called with IFS unset, it would have the
+# side effect of setting IFS to empty, thus disabling word splitting.)
+# Quoting is to prevent editors from complaining about space-tab.
 as_nl='
 '
 export as_nl
-# Printing a long string crashes Solaris 7 /usr/bin/printf.
-as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
-# Prefer a ksh shell builtin over an external printf program on Solaris,
-# but without wasting forks for bash or zsh.
-if test -z "$BASH_VERSION$ZSH_VERSION" \
-    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
-  as_echo='print -r --'
-  as_echo_n='print -rn --'
-elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
-  as_echo='printf %s\n'
-  as_echo_n='printf %s'
-else
-  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
-    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
-    as_echo_n='/usr/ucb/echo -n'
-  else
-    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
-    as_echo_n_body='eval
-      arg=$1;
-      case $arg in #(
-      *"$as_nl"*)
-	expr "X$arg" : "X\\(.*\\)$as_nl";
-	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
-      esac;
-      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
-    '
-    export as_echo_n_body
-    as_echo_n='sh -c $as_echo_n_body as_echo'
-  fi
-  export as_echo_body
-  as_echo='sh -c $as_echo_body as_echo'
-fi
+IFS=" ""	$as_nl"
+
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# Ensure predictable behavior from utilities with locale-dependent output.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# We cannot yet rely on "unset" to work, but we need these variables
+# to be unset--not just set to an empty or harmless value--now, to
+# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh).  This construct
+# also avoids known problems related to "unset" and subshell syntax
+# in other old shells (e.g. bash 2.01 and pdksh 5.2.14).
+for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH
+do eval test \${$as_var+y} \
+  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+
+# Ensure that fds 0, 1, and 2 are open.
+if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi
+if (exec 3>&2)            ; then :; else exec 2>/dev/null; fi
 
 # The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
+if ${PATH_SEPARATOR+false} :; then
   PATH_SEPARATOR=:
   (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
     (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
@@ -4070,13 +4605,6 @@ if test "${PATH_SEPARATOR+set}" != set; then
 fi
 
 
-# IFS
-# We need space, tab and new line, in precisely that order.  Quoting is
-# there to prevent editors from complaining about space-tab.
-# (If _AS_PATH_WALK were called with IFS unset, it would disable word
-# splitting by setting IFS to empty value.)
-IFS=" ""	$as_nl"
-
 # Find who we are.  Look in the path if we contain no directory separator.
 as_myself=
 case $0 in #((
@@ -4085,43 +4613,27 @@ case $0 in #((
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
+    test -r "$as_dir$0" && as_myself=$as_dir$0 && break
   done
 IFS=$as_save_IFS
 
      ;;
 esac
-# We did not find ourselves, most probably we were run as `sh COMMAND'
+# We did not find ourselves, most probably we were run as 'sh COMMAND'
 # in which case we are not to be found in the path.
 if test "x$as_myself" = x; then
   as_myself=$0
 fi
 if test ! -f "$as_myself"; then
-  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
   exit 1
 fi
 
-# Unset variables that we do not need and which cause bugs (e.g. in
-# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
-# suppresses any "Segmentation fault" message there.  '((' could
-# trigger a bug in pdksh 5.2.14.
-for as_var in BASH_ENV ENV MAIL MAILPATH
-do eval test x\${$as_var+set} = xset \
-  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
-done
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-LC_ALL=C
-export LC_ALL
-LANGUAGE=C
-export LANGUAGE
-
-# CDPATH.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 
 
 # as_fn_error STATUS ERROR [LINENO LOG_FD]
@@ -4134,9 +4646,9 @@ as_fn_error ()
   as_status=$1; test $as_status -eq 0 && as_status=1
   if test "$4"; then
     as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+    printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
   fi
-  $as_echo "$as_me: error: $2" >&2
+  printf "%s\n" "$as_me: error: $2" >&2
   as_fn_exit $as_status
 } # as_fn_error
 
@@ -4167,22 +4679,25 @@ as_fn_unset ()
   { eval $1=; unset $1;}
 }
 as_unset=as_fn_unset
+
 # as_fn_append VAR VALUE
 # ----------------------
 # Append the text in VALUE to the end of the definition contained in VAR. Take
 # advantage of any shell optimizations that allow amortized linear growth over
 # repeated appends, instead of the typical quadratic growth present in naive
 # implementations.
-if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null
+then :
   eval 'as_fn_append ()
   {
     eval $1+=\$2
   }'
-else
-  as_fn_append ()
+else case e in #(
+  e) as_fn_append ()
   {
     eval $1=\$$1\$2
-  }
+  } ;;
+esac
 fi # as_fn_append
 
 # as_fn_arith ARG...
@@ -4190,16 +4705,18 @@ fi # as_fn_append
 # Perform arithmetic evaluation on the ARGs, and store the result in the
 # global $as_val. Take advantage of shells that can avoid forks. The arguments
 # must be portable across $(()) and expr.
-if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null
+then :
   eval 'as_fn_arith ()
   {
     as_val=$(( $* ))
   }'
-else
-  as_fn_arith ()
+else case e in #(
+  e) as_fn_arith ()
   {
     as_val=`expr "$@" || test $? -eq 1`
-  }
+  } ;;
+esac
 fi # as_fn_arith
 
 
@@ -4226,7 +4743,7 @@ as_me=`$as_basename -- "$0" ||
 $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
 	 X"$0" : 'X\(//\)$' \| \
 	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X/"$0" |
+printf "%s\n" X/"$0" |
     sed '/^.*\/\([^/][^/]*\)\/*$/{
 	    s//\1/
 	    q
@@ -4248,6 +4765,10 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS
 as_cr_digits='0123456789'
 as_cr_alnum=$as_cr_Letters$as_cr_digits
 
+
+# Determine whether it's possible to make 'echo' print without a newline.
+# These variables are no longer used directly by Autoconf, but are AC_SUBSTed
+# for compatibility with existing Makefiles.
 ECHO_C= ECHO_N= ECHO_T=
 case `echo -n x` in #(((((
 -n*)
@@ -4261,6 +4782,12 @@ case `echo -n x` in #(((((
   ECHO_N='-n';;
 esac
 
+# For backward compatibility with old third-party macros, we provide
+# the shell variables $as_echo and $as_echo_n.  New code should use
+# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively.
+as_echo='printf %s\n'
+as_echo_n='printf %s'
+
 rm -f conf$$ conf$$.exe conf$$.file
 if test -d conf$$.dir; then
   rm -f conf$$.dir/conf$$.file
@@ -4272,9 +4799,9 @@ if (echo >conf$$.file) 2>/dev/null; then
   if ln -s conf$$.file conf$$ 2>/dev/null; then
     as_ln_s='ln -s'
     # ... but there are two gotchas:
-    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
-    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -pR'.
+    # 1) On MSYS, both 'ln -s file dir' and 'ln file dir' fail.
+    # 2) DJGPP < 2.04 has no symlinks; 'ln -s' creates a wrapper executable.
+    # In both cases, we have to default to 'cp -pR'.
     ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
       as_ln_s='cp -pR'
   elif ln conf$$.file conf$$ 2>/dev/null; then
@@ -4302,7 +4829,7 @@ as_fn_mkdir_p ()
     as_dirs=
     while :; do
       case $as_dir in #(
-      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+      *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
       *) as_qdir=$as_dir;;
       esac
       as_dirs="'$as_qdir' $as_dirs"
@@ -4311,7 +4838,7 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
 	 X"$as_dir" : 'X\(//\)[^/]' \| \
 	 X"$as_dir" : 'X\(//\)$' \| \
 	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$as_dir" |
+printf "%s\n" X"$as_dir" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
 	    s//\1/
 	    q
@@ -4355,10 +4882,12 @@ as_test_x='test -x'
 as_executable_p=as_fn_executable_p
 
 # Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+as_sed_cpp="y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
+as_tr_cpp="eval sed '$as_sed_cpp'" # deprecated
 
 # Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+as_sed_sh="y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
+as_tr_sh="eval sed '$as_sed_sh'" # deprecated
 
 
 exec 6>&1
@@ -4374,7 +4903,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # values after options handling.
 ac_log="
 This file was extended by JRI $as_me 0.3, which was
-generated by GNU Autoconf 2.69.  Invocation command line was
+generated by GNU Autoconf 2.72.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -4405,7 +4934,7 @@ _ACEOF
 
 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 ac_cs_usage="\
-\`$as_me' instantiates files and other configuration actions
+'$as_me' instantiates files and other configuration actions
 from templates according to the current configuration.  Unless the files
 and actions are specified as TAGs, all are instantiated by default.
 
@@ -4432,14 +4961,16 @@ $config_headers
 Report bugs to ."
 
 _ACEOF
+ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"`
+ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"`
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
+ac_cs_config='$ac_cs_config_escaped'
 ac_cs_version="\\
 JRI config.status 0.3
-configured by $0, generated by GNU Autoconf 2.69,
+configured by $0, generated by GNU Autoconf 2.72,
   with options \\"\$ac_cs_config\\"
 
-Copyright (C) 2012 Free Software Foundation, Inc.
+Copyright (C) 2023 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it."
 
@@ -4476,15 +5007,15 @@ do
   -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
     ac_cs_recheck=: ;;
   --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
-    $as_echo "$ac_cs_version"; exit ;;
+    printf "%s\n" "$ac_cs_version"; exit ;;
   --config | --confi | --conf | --con | --co | --c )
-    $as_echo "$ac_cs_config"; exit ;;
+    printf "%s\n" "$ac_cs_config"; exit ;;
   --debug | --debu | --deb | --de | --d | -d )
     debug=: ;;
   --file | --fil | --fi | --f )
     $ac_shift
     case $ac_optarg in
-    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
     '') as_fn_error $? "missing file argument" ;;
     esac
     as_fn_append CONFIG_FILES " '$ac_optarg'"
@@ -4492,23 +5023,23 @@ do
   --header | --heade | --head | --hea )
     $ac_shift
     case $ac_optarg in
-    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
     esac
     as_fn_append CONFIG_HEADERS " '$ac_optarg'"
     ac_need_defaults=false;;
   --he | --h)
     # Conflict between --help and --header
-    as_fn_error $? "ambiguous option: \`$1'
-Try \`$0 --help' for more information.";;
+    as_fn_error $? "ambiguous option: '$1'
+Try '$0 --help' for more information.";;
   --help | --hel | -h )
-    $as_echo "$ac_cs_usage"; exit ;;
+    printf "%s\n" "$ac_cs_usage"; exit ;;
   -q | -quiet | --quiet | --quie | --qui | --qu | --q \
   | -silent | --silent | --silen | --sile | --sil | --si | --s)
     ac_cs_silent=: ;;
 
   # This is an error.
-  -*) as_fn_error $? "unrecognized option: \`$1'
-Try \`$0 --help' for more information." ;;
+  -*) as_fn_error $? "unrecognized option: '$1'
+Try '$0 --help' for more information." ;;
 
   *) as_fn_append ac_config_targets " $1"
      ac_need_defaults=false ;;
@@ -4529,7 +5060,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 if \$ac_cs_recheck; then
   set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
   shift
-  \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+  \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6
   CONFIG_SHELL='$SHELL'
   export CONFIG_SHELL
   exec "\$@"
@@ -4543,7 +5074,7 @@ exec 5>>config.log
   sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
 ## Running $as_me. ##
 _ASBOX
-  $as_echo "$ac_log"
+  printf "%s\n" "$ac_log"
 } >&5
 
 _ACEOF
@@ -4561,7 +5092,7 @@ do
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
     "run") CONFIG_FILES="$CONFIG_FILES run" ;;
 
-  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+  *) as_fn_error $? "invalid argument: '$ac_config_target'" "$LINENO" 5;;
   esac
 done
 
@@ -4571,8 +5102,8 @@ done
 # We use the long form for the default assignment because of an extremely
 # bizarre bug on SunOS 4.1.3.
 if $ac_need_defaults; then
-  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
-  test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+  test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files
+  test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers
 fi
 
 # Have a temporary directory for convenience.  Make it in the build tree
@@ -4580,7 +5111,7 @@ fi
 # creating and moving files from /tmp can sometimes cause problems.
 # Hook for its removal unless debugging.
 # Note that there is a small window in which the directory will not be cleaned:
-# after its creation but before its name has been assigned to `$tmp'.
+# after its creation but before its name has been assigned to '$tmp'.
 $debug ||
 {
   tmp= ac_tmp=
@@ -4604,7 +5135,7 @@ ac_tmp=$tmp
 
 # Set up the scripts for CONFIG_FILES section.
 # No need to generate them if there are no CONFIG_FILES.
-# This happens for instance with `./config.status config.h'.
+# This happens for instance with './config.status config.h'.
 if test -n "$CONFIG_FILES"; then
 
 
@@ -4762,13 +5293,13 @@ fi # test -n "$CONFIG_FILES"
 
 # Set up the scripts for CONFIG_HEADERS section.
 # No need to generate them if there are no CONFIG_HEADERS.
-# This happens for instance with `./config.status Makefile'.
+# This happens for instance with './config.status Makefile'.
 if test -n "$CONFIG_HEADERS"; then
 cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
 BEGIN {
 _ACEOF
 
-# Transform confdefs.h into an awk script `defines.awk', embedded as
+# Transform confdefs.h into an awk script 'defines.awk', embedded as
 # here-document in config.status, that substitutes the proper values into
 # config.h.in to produce config.h.
 
@@ -4878,7 +5409,7 @@ do
   esac
   case $ac_mode$ac_tag in
   :[FHL]*:*);;
-  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
+  :L* | :C*:*) as_fn_error $? "invalid tag '$ac_tag'" "$LINENO" 5;;
   :[FH]-) ac_tag=-:-;;
   :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
   esac
@@ -4900,33 +5431,33 @@ do
       -) ac_f="$ac_tmp/stdin";;
       *) # Look for the file first in the build tree, then in the source tree
 	 # (if the path is not absolute).  The absolute path cannot be DOS-style,
-	 # because $ac_f cannot contain `:'.
+	 # because $ac_f cannot contain ':'.
 	 test -f "$ac_f" ||
 	   case $ac_f in
 	   [\\/$]*) false;;
 	   *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
 	   esac ||
-	   as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+	   as_fn_error 1 "cannot find input file: '$ac_f'" "$LINENO" 5;;
       esac
-      case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+      case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
       as_fn_append ac_file_inputs " '$ac_f'"
     done
 
-    # Let's still pretend it is `configure' which instantiates (i.e., don't
+    # Let's still pretend it is 'configure' which instantiates (i.e., don't
     # use $as_me), people would be surprised to read:
     #    /* config.h.  Generated by config.status.  */
     configure_input='Generated from '`
-	  $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+	  printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
 	`' by configure.'
     if test x"$ac_file" != x-; then
       configure_input="$ac_file.  $configure_input"
-      { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
-$as_echo "$as_me: creating $ac_file" >&6;}
+      { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
+printf "%s\n" "$as_me: creating $ac_file" >&6;}
     fi
     # Neutralize special characters interpreted by sed in replacement strings.
     case $configure_input in #(
     *\&* | *\|* | *\\* )
-       ac_sed_conf_input=`$as_echo "$configure_input" |
+       ac_sed_conf_input=`printf "%s\n" "$configure_input" |
        sed 's/[\\\\&|]/\\\\&/g'`;; #(
     *) ac_sed_conf_input=$configure_input;;
     esac
@@ -4943,7 +5474,7 @@ $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
 	 X"$ac_file" : 'X\(//\)[^/]' \| \
 	 X"$ac_file" : 'X\(//\)$' \| \
 	 X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$ac_file" |
+printf "%s\n" X"$ac_file" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
 	    s//\1/
 	    q
@@ -4967,9 +5498,9 @@ $as_echo X"$ac_file" |
 case "$ac_dir" in
 .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
 *)
-  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+  ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'`
   # A ".." for each directory in $ac_dir_suffix.
-  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+  ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
   case $ac_top_builddir_sub in
   "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
   *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
@@ -5022,8 +5553,8 @@ ac_sed_dataroot='
 case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
 *datarootdir*) ac_datarootdir_seen=yes;;
 *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
-$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
   ac_datarootdir_hack='
@@ -5036,7 +5567,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 esac
 _ACEOF
 
-# Neutralize VPATH when `$srcdir' = `.'.
+# Neutralize VPATH when '$srcdir' = '.'.
 # Shell code in configure.ac might set extrasub.
 # FIXME: do we really want to maintain this feature?
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
@@ -5065,9 +5596,9 @@ test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
   { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
   { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' \
       "$ac_tmp/out"`; test -z "$ac_out"; } &&
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable 'datarootdir'
 which seems to be undefined.  Please make sure it is defined" >&5
-$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable 'datarootdir'
 which seems to be undefined.  Please make sure it is defined" >&2;}
 
   rm -f "$ac_tmp/stdin"
@@ -5083,20 +5614,20 @@ which seems to be undefined.  Please make sure it is defined" >&2;}
   #
   if test x"$ac_file" != x-; then
     {
-      $as_echo "/* $configure_input  */" \
+      printf "%s\n" "/* $configure_input  */" >&1 \
       && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
     } >"$ac_tmp/config.h" \
       || as_fn_error $? "could not create $ac_file" "$LINENO" 5
     if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
-$as_echo "$as_me: $ac_file is unchanged" >&6;}
+      { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
+printf "%s\n" "$as_me: $ac_file is unchanged" >&6;}
     else
       rm -f "$ac_file"
       mv "$ac_tmp/config.h" "$ac_file" \
 	|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
     fi
   else
-    $as_echo "/* $configure_input  */" \
+    printf "%s\n" "/* $configure_input  */" >&1 \
       && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
       || as_fn_error $? "could not create -" "$LINENO" 5
   fi
@@ -5142,7 +5673,8 @@ if test "$no_create" != yes; then
   $ac_cs_success || as_fn_exit 1
 fi
 if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
-$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
 fi
 
+
diff --git a/jri/configure.ac b/src/jri/configure.ac
similarity index 77%
rename from jri/configure.ac
rename to src/jri/configure.ac
index fa8085b..3e56081 100644
--- a/jri/configure.ac
+++ b/src/jri/configure.ac
@@ -1,6 +1,6 @@
 AC_INIT([JRI],[0.3],[simon.urbanek@r-project.org])
 AC_CONFIG_SRCDIR([src/jri.h])
-AC_CONFIG_HEADER([src/config.h])
+AC_CONFIG_HEADERS([src/config.h])
 AC_CONFIG_AUX_DIR([tools])
 
 AC_CANONICAL_BUILD
@@ -15,10 +15,10 @@ fi
 # we attempt to use the same compiler as R did
 RBIN="${R_HOME}/bin/R"
 R_CC=`"${RBIN}" CMD config CC`
-R_CPP=`"${RBIN}" CMD config CPP`
+## CPP is now deprecated
+R_CPP="${R_CC} -E"
 R_CFLAGS=`"${RBIN}" CMD config CFLAGS`
 
-
 # find R_SHARE_DIR
 : ${R_SHARE_DIR=`"${RBIN}" CMD sh -c 'echo $R_SHARE_DIR'`}
 if test -z "${R_SHARE_DIR}"; then
@@ -63,8 +63,12 @@ AC_SUBST(R_SHARE_DIR)
 AC_SUBST(R_DOC_DIR)
 AC_SUBST(R_INCLUDE_DIR)
 
+AC_LANG(C)
 AC_PROG_CC
-AC_HEADER_STDC
+
+## we need HAVE_..._H for R-ext/eventloop.h which requires
+## defines from R's config.h which are not shipped with R
+AC_CHECK_HEADERS([sys/time.h sys/types.h sys/select.h])
 
 ## RUN_JAVA(variable for the result, parameters)
 ## ----------
@@ -84,7 +88,7 @@ AC_DEFUN([RUN_JAVA],
 ])
 
 if test -n "${CONFIGURED}"; then
-## re-map varibles that don't match
+## re-map variables that don't match
 JAVA_PROG="${JAVA}"
 JAVA_INC="${JAVA_CPPFLAGS}"
 JAVA_LD_PATH="${JAVA_LD_LIBRARY_PATH}"
@@ -107,10 +111,48 @@ AC_PATH_PROGS(JAVAH,javah,,${JAVA_PATH})
 AC_PATH_PROGS(JAR,jar,,${JAVA_PATH})
 fi
 
+AC_MSG_CHECKING([Java version])
+JVER=`"$JAVA" -version 2>&1 | sed -n 's:^.* version "::p' | sed 's:".*::'`
+AC_MSG_RESULT([$JVER])
+
+if test -z "$JVER"; then
+   AC_MSG_WARN([**** Cannot detect Java version - the java -version output is unknown! ****])
+else
+   AC_MSG_CHECKING([Java compatibility version (integer)])
+   ## .. Oracle decided to completely screw up Java version so have to try extract something meaningful ..
+   if echo $JVER | grep '^1\.' >/dev/null; then ## old style 1.X
+      JMVER=`echo $JVER | sed 's:^..::' | sed 's:\..*::'`
+   else ## new stype omitting the major version
+      JMVER=`echo $JVER | sed 's:\..*::'`
+   fi
+   ## strip -.* for versions like 13-ea
+   JMVER=`echo $JMVER | sed 's:-.*::'`
+   AC_MSG_RESULT([$JMVER])
+fi
+
+AC_MSG_CHECKING([whether $JAVAH actually works])
+if "$JAVAH" -version >/dev/null 2>&1; then
+   AC_MSG_RESULT([yes])
+else
+   AC_MSG_RESULT([no])
+   JAVAH=
+fi
+
 have_all_java=yes
+## Java 1.10 has no javah anymore -- it uses javac -h . instaead
+if test -z "$JAVAH"; then
+   AC_MSG_CHECKING([whether javah was replaced by javac -h])
+   if test "$JMVER" -gt 9; then
+      AC_MSG_RESULT([yes])
+      ## create headres in the compile step instead
+      JFLAGS=' -h .'
+   else
+      AC_MSG_RESULT([no])
+      have_all_java=no;
+   fi
+fi
 if test -z "$JAVA_PROG"; then have_all_java=no; fi
 if test -z "$JAVAC"; then have_all_java=no; fi
-if test -z "$JAVAH"; then have_all_java=no; fi
 if test -z "$JAR"; then have_all_java=no; fi
 if test ${have_all_java} = no; then
   AC_MSG_ERROR([one or more Java tools are missing.
@@ -118,6 +160,23 @@ if test ${have_all_java} = no; then
 *** JDK is incomplete! Please make sure you have a complete JDK. JRE is *not* sufficient.])
 fi
 
+AC_MSG_CHECKING([for target flags])
+## set JFLAGS target -- depends on the JDK version
+if echo $JFLAGS | grep '[[-]]target' >/dev/null; then
+   AC_MSG_RESULT([user-supplied: $JFLAGS])
+else
+   if test "$JMVER" -lt 9; then
+      JFLAGS="$JFLAGS -target 1.4 -source 1.4"
+   else
+      if test "$JMVER" -lt 12; then
+         JFLAGS="$JFLAGS -target 1.6 -source 1.6"
+      else
+         JFLAGS="$JFLAGS -target 1.8 -source 1.8"
+      fi
+   fi
+   AC_MSG_RESULT([$JFLAGS])
+fi
+
 ## this is where our test-class lives
 getsp_cp=tools
 
@@ -132,7 +191,7 @@ if test -n "${JAVA_PROG}" ; then
 fi
 
 if test "x`uname -s 2>/dev/null`" = xDarwin; then
-  ## we need to pull that out of R in case re-export fails (which is does on 10.11)                                                                  
+  ## we need to pull that out of R in case re-export fails (which is does on 10.11)
   DYLD_FALLBACK_LIBRARY_PATH=`"${RBIN}" --slave --vanilla -e 'cat(Sys.getenv("DYLD_FALLBACK_LIBRARY_PATH"))'`
   export DYLD_FALLBACK_LIBRARY_PATH
 fi
@@ -144,7 +203,7 @@ if test ${acx_java_works} = yes; then
   AC_MSG_RESULT([yes])
 
   AC_MSG_CHECKING([for Java environment])
-  ## retrieve JAVA_HOME from Java itself if not set 
+  ## retrieve JAVA_HOME from Java itself if not set
   if test -z "${JAVA_HOME}" ; then
     RUN_JAVA(JAVA_HOME,[-classpath ${getsp_cp} getsp java.home])
   fi
@@ -159,8 +218,10 @@ if test ${acx_java_works} = yes; then
 
     case "${host_os}" in
       darwin*)
-        JAVA_LIBS="-framework JavaVM"
-        JAVA_LD_PATH=
+        if [ -z "${JAVA_LIBS}" ]; then
+          JAVA_LIBS="-framework JavaVM"
+          JAVA_LD_PATH=
+        fi
         ;;
       *)
         RUN_JAVA(JAVA_LIBS, [-classpath ${getsp_cp} getsp -libs])
@@ -184,7 +245,10 @@ AC_CHECK_FILE(${JAVA_HOME}/include/jni.h,
   [JNI_H="${JAVA_HOME}"],
   [AC_CHECK_FILE(${JAVA_HOME}/../include/jni.h,
    [JNI_H="${JAVA_HOME}/../include"],
-   [AC_MSG_ERROR([jni headers not found. Please make sure you have a proper JDK installed.])
+   [AC_MSG_ERROR([Cannot compile JNI programs, check jri/config.log for details.
+Please make sure you have a proper JDK installed.
+Use --disable-jri when you install rJava and don't need JRI.
+])
   ])
  ])
 ])
@@ -220,27 +284,28 @@ LIBS="${LIBS} ${JAVA_LIBS0}"
 CFLAGS="${CFLAGS} ${JAVA_CFLAGS} ${JAVA_INC0}"
 
 AC_MSG_CHECKING([whether JNI programs can be compiled])
-AC_LINK_IFELSE([
+AC_LINK_IFELSE([AC_LANG_SOURCE([[
 #include 
 int main(void) {
     jobject o;
     return 0;
 }
-        ],[AC_MSG_RESULT(yes)],
+        ]])],[AC_MSG_RESULT(yes)],
         [AC_MSG_ERROR([Cannot compile a simple JNI program. See config.log for details.])])
 
 LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${JAVA_LD_PATH0}
 export LD_LIBRARY_PATH
 
 AC_MSG_CHECKING([whether JNI programs can be run])
-AC_RUN_IFELSE([
+AC_RUN_IFELSE([AC_LANG_SOURCE([[
 #include 
 int main(void) {
     jobject o;
     return 0;
 }
-        ],[AC_MSG_RESULT(yes)],
-        [AC_MSG_ERROR([Cannot run a simple JNI program - probably your jvm library is in non-standard location or JVM is unsupported. See config.log for details.])])
+        ]])],[AC_MSG_RESULT(yes)],
+        [AC_MSG_RESULT(no)
+	 AC_MSG_ERROR([Cannot run a simple JNI program - probably your jvm library is in non-standard location or JVM is unsupported. See config.log for details.])])
 
 AC_MSG_CHECKING([JNI data types])
 AC_RUN_IFELSE([AC_LANG_SOURCE([[
@@ -259,7 +324,7 @@ JNILD=`"${RBIN}" CMD config SHLIB_LDFLAGS`" ${JAVA_LIBS}"
 case "${host_os}" in
   darwin*)
     JNISO=.jnilib
-    JNILD="-dynamiclib -framework JavaVM"
+    JNILD="-dynamiclib $JNILD"
     CPICF=-fno-common
 
     if test -e "${R_HOME}/lib/i386" -a -e "${R_HOME}/lib/ppc" -a -e "${R_HOME}/lib/libR.dylib"; then
@@ -295,25 +360,25 @@ origCFLAGS=$CFLAGS
 CFLAGS="${CFLAGS} ${R_CFLAGS} ${RINC}"
 
 AC_MSG_CHECKING([whether Rinterface.h exports R_CStackXXX variables])
-AC_COMPILE_IFELSE([
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([
 #define CSTACK_DEFNS
 #include 
 #include 
 int main(void) {
     return R_CStackLimit?0:1;
 }
-        ],[AC_MSG_RESULT(yes)
+        ])],[AC_MSG_RESULT(yes)
            DEFFLAGS="${DEFFLAGS} -DRIF_HAS_CSTACK"],
         [AC_MSG_RESULT(no)])
 
 AC_MSG_CHECKING([whether Rinterface.h exports R_SignalHandlers])
-AC_COMPILE_IFELSE([
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([
 #include 
 #include 
 int main(void) {
     return R_SignalHandlers;
 }
-        ],[AC_MSG_RESULT(yes)
+        ])],[AC_MSG_RESULT(yes)
            DEFFLAGS="${DEFFLAGS} -DRIF_HAS_RSIGHAND"],
         [AC_MSG_RESULT(no)])
 
@@ -327,6 +392,7 @@ AC_SUBST(JAVA_INC)
 AC_SUBST(JAVA_CFLAGS)
 AC_SUBST(JAVAC)
 AC_SUBST(JAVAH)
+AC_SUBST(JFLAGS)
 AC_SUBST(JAR)
 AC_SUBST(JNILD)
 AC_SUBST(JNISO)
diff --git a/jri/configure.win b/src/jri/configure.win
similarity index 60%
rename from jri/configure.win
rename to src/jri/configure.win
index 40ed696..757ca49 100644
--- a/jri/configure.win
+++ b/src/jri/configure.win
@@ -35,6 +35,22 @@ echo "  R_HOME=$R_HOME"
 echo "JAVAHOME:=$JAVA_HOME" > src/Makefile.wconf
 echo "RHOME:=$R_HOME" >> src/Makefile.wconf
 
+if [ -e "$JAVA_HOME/bin/javah.exe" ]; then ## does the JDK have javah?
+    echo 'JDK includes javah.exe'
+    echo 'JAVAH=$(JAVAHOME)/bin/javah' >> src/Makefile.wconf
+else ## else we have to create headers during the compilation
+    echo 'JDK has no javah.exe - using javac -h . instead'
+    ## if this is at least 1.8 we can set source/target
+    ## it is mandatory for 14 (and may be earlier) due to yield
+    tgt=`"${JAVA_HOME}/bin/java" -cp tools getsp -minver 8`
+    echo "Is the Java version at least 1.8 ... $tgt"
+    if [ x$tgt = xyes ]; then
+	echo 'JFLAGS=-source 1.8 -target 1.8 -h .' >> src/Makefile.wconf
+    else
+	echo 'JFLAGS=-h .' >> src/Makefile.wconf
+    fi
+fi
+
 echo "Creating Makefiles ..."
 cp Makefile.win Makefile
 cp src/Makefile.win src/Makefile
diff --git a/jri/examples/rtest.java b/src/jri/examples/rtest.java
similarity index 100%
rename from jri/examples/rtest.java
rename to src/jri/examples/rtest.java
diff --git a/jri/examples/rtest2.java b/src/jri/examples/rtest2.java
similarity index 100%
rename from jri/examples/rtest2.java
rename to src/jri/examples/rtest2.java
diff --git a/jri/mkdist b/src/jri/mkdist
similarity index 100%
rename from jri/mkdist
rename to src/jri/mkdist
diff --git a/jri/package-info.java b/src/jri/package-info.java
similarity index 100%
rename from jri/package-info.java
rename to src/jri/package-info.java
diff --git a/jri/run.in b/src/jri/run.in
similarity index 100%
rename from jri/run.in
rename to src/jri/run.in
diff --git a/src/jri/src/Makefile.all b/src/jri/src/Makefile.all
new file mode 100644
index 0000000..3146350
--- /dev/null
+++ b/src/jri/src/Makefile.all
@@ -0,0 +1,53 @@
+# JRI - Java/R Interface      experimental!
+#--------------------------------------------------------------------------
+# JRI_CPPFLAGS and JRI_LIBS are additional overrides that can be supplied
+# by the user
+
+JRI_JSRC=$(wildcard ../*.java)
+TARGETS=$(JNIPREFIX)jri$(JNISO) JRI.jar
+
+all: $(TARGETS)
+
+JRI.jar: $(JRI_JSRC) $(JNIPREFIX)jri$(JNISO)
+	$(JAVAC) $(JFLAGS) $(JRI_JFLAGS) -d . $(JRI_JSRC)
+	$(JAR) fc $@ org $(JNIPREFIX)jri$(JNISO)
+
+org_rosuda_JRI_Rengine.h: org/rosuda/JRI/Rengine.class
+	if [ -n "$(JAVAH)" ]; then $(JAVAH) -d . -classpath . org.rosuda.JRI.Rengine; fi
+
+Rcallbacks.o: Rcallbacks.c Rcallbacks.h globals.h rjstring.h org_rosuda_JRI_Rengine.h
+	$(CC) -c -o $@ $< $(CFLAGS) $(CPICF) $(JAVAINC) $(RINC) $(JRI_CPPFLAGS)
+
+rjstring.o: rjstring.c rjstring.h
+	$(CC) -c -o $@ $< $(CFLAGS) $(CPICF) $(JAVAINC) $(RINC) $(JRI_CPPFLAGS)
+
+Rinit.o: Rinit.c Rinit.h Rcallbacks.h
+	$(CC) -c -o $@ $< $(CFLAGS) $(CPICF) $(RINC) $(JRI_CPPFLAGS)
+
+globals.o: globals.c globals.h
+	$(CC) -c -o $@ $< $(CFLAGS) $(CPICF) $(JAVAINC) $(JRI_CPPFLAGS)
+
+rjava.o: rjava.c rjava.h
+	$(CC) -c -o $@ $< $(CFLAGS) $(CPICF) $(JAVAINC) $(JRI_CPPFLAGS)
+
+Rengine.o: Rengine.c org_rosuda_JRI_Rengine.h globals.h Rcallbacks.h Rinit.h
+	$(CC) -c -o $@ Rengine.c $(CFLAGS) $(CPICF) $(JAVAINC) $(RINC) $(JRI_CPPFLAGS)
+
+jri.o: jri.c
+	$(CC) -c -o $@ jri.c $(CFLAGS) $(CPICF) $(JAVAINC) $(RINC) $(JRI_CPPFLAGS)
+
+$(JNIPREFIX)jri$(JNISO): Rengine.o jri.o Rcallbacks.o Rinit.o globals.o rjava.o rjstring.o $(JRIDEPS)
+	$(CC) -o $@ $^ $(LDFLAGS) $(JNILD) $(RLD) $(JRI_LIBS)
+
+win32/libjvm.dll.a:
+	make -C win32 libjvm.dll.a
+
+org/rosuda/JRI/Rengine.class org/rosuda/JRI/REXP.class org/rosuda/JRI/Mutex.class: $(JRI_JSRC)
+	$(JAVAC) $(JFLAGS) $(JRI_JFLAGS) -d . $^
+
+clean:
+	rm -rf $(TARGETS) org *.o *~ org_rosuda_JRI_Rengine.h *$(JNISO) *.class *~
+
+.PHONY: clean all
+
+.NOTPARALLEL:
diff --git a/jri/src/Makefile.in b/src/jri/src/Makefile.in
similarity index 83%
rename from jri/src/Makefile.in
rename to src/jri/src/Makefile.in
index ec91aae..db85903 100644
--- a/jri/src/Makefile.in
+++ b/src/jri/src/Makefile.in
@@ -5,7 +5,7 @@
 CFLAGS+=-g
 
 CC=@CC@
-CFLAGS+=-Iinclude @DEFFLAGS@ @CFLAGS@ @JAVA_CFLAGS@
+CFLAGS+=-Iinclude @DEFFLAGS@ -DHAVE_CONFIG_H @CFLAGS@ @JAVA_CFLAGS@
 LDFLAGS+=@LDFLAGS@
 
 CC=@CC@
@@ -14,6 +14,7 @@ JAVAC=@JAVAC@
 JAVAH=@JAVAH@
 JAVAINC=@JAVA_INC@
 JAR=@JAR@
+JFLAGS=@JFLAGS@
 
 RINC=@RINC@ -I@R_INCLUDE_DIR@
 RLD=@RLD@
diff --git a/jri/src/Makefile.win b/src/jri/src/Makefile.win
similarity index 100%
rename from jri/src/Makefile.win
rename to src/jri/src/Makefile.win
diff --git a/jri/src/Rcallbacks.c b/src/jri/src/Rcallbacks.c
similarity index 83%
rename from jri/src/Rcallbacks.c
rename to src/jri/src/Rcallbacks.c
index fccb688..1337e22 100644
--- a/jri/src/Rcallbacks.c
+++ b/src/jri/src/Rcallbacks.c
@@ -5,6 +5,7 @@
 #include "globals.h"
 #include "Rdecl.h"
 #include "Rcallbacks.h"
+#include "rjstring.h"
 
 #include "org_rosuda_JRI_Rengine.h"
 #include 
@@ -25,7 +26,8 @@
 #ifndef checkArity
 #define checkArity               Rf_checkArity
 #endif
-#else
+void Rf_checkArity(SEXP, SEXP); /* include/Defn.h */
+#else /* in 2.6.0 re-mapped to Rf_checkArityCall so we just disable it to avoid API issues */
 #define checkArity(X,Y)
 #endif
 
@@ -36,7 +38,7 @@
 /* this method is used rather for debugging purposes - it finds the correct JNIEnv for the current thread. we still have some threading issues to solve, becuase eenv!=env should never happen (uncontrolled), because concurrency issues arise */
 static JavaVM *jvm=0;
 
-JNIEnv *checkEnvironment()
+JNIEnv *checkEnvironment(void)
 {
     JNIEnv *env;
     jsize l;
@@ -62,14 +64,17 @@ JNIEnv *checkEnvironment()
     return env;
 }
 
-int Re_ReadConsole(RCCONST char *prompt, unsigned char *buf, int len, int addtohistory)
+int Re_ReadConsole(RCCONST char *prompt, RCSIGN char *buf, int len, int addtohistory)
 {
-	jstring r,s;
+	jstring r, s;
 	jmethodID mid;
-    JNIEnv *lenv=checkEnvironment();
-	
-    if (!lenv || !engineObj) return -1;
-	
+	JNIEnv *lenv=checkEnvironment();
+	const void *vmax = 0;
+	int ret = -1;
+	const char *c = 0;
+
+	if (!lenv || !engineObj) return -1;
+
 	jri_checkExceptions(lenv, 1);
 	mid=(*lenv)->GetMethodID(eenv, engineClass, "jriReadConsole", "(Ljava/lang/String;I)Ljava/lang/String;");
 #ifdef JRI_DEBUG
@@ -77,28 +82,46 @@ int Re_ReadConsole(RCCONST char *prompt, unsigned char *buf, int len, int addtoh
 #endif
 	jri_checkExceptions(lenv, 0);
 	if (!mid) return -1;
-		
-	s=(*lenv)->NewStringUTF(eenv, prompt);
-	r=(jstring) (*lenv)->CallObjectMethod(lenv, engineObj, mid, s, addtohistory);
+	vmax = vmaxget();
+	s = rj_newNativeJavaString(lenv, prompt, -1);
+	vmaxset(vmax);
+	if (!s) return -1;
+	r = (jstring) (*lenv)->CallObjectMethod(lenv, engineObj, mid, s, addtohistory);
 	jri_checkExceptions(lenv, 1);
 	(*lenv)->DeleteLocalRef(lenv, s);
 	jri_checkExceptions(lenv, 0);
-	if (r) {
-		const char *c=(*lenv)->GetStringUTFChars(lenv, r, 0);
-		if (!c) return -1;
-		{
-			int l=strlen(c);
-			strncpy((char*)buf, c, (l>len-1)?len-1:l);
-			buf[(l>len-1)?len-1:l]=0;
+	while (r) {
+		/* get string in Java UTF-8 */
+		c = (*lenv)->GetStringUTFChars(lenv, r, 0);
+		if (!c) break;
+		vmax = vmaxget();
+
+		/* convert from Java UTF-8 to real UTF-8 in a CHARSXP */
+		SEXP sRes = rj_mkCharUTF8_noerr(c);
+		if (!sRes) {
+			vmaxset(vmax);
+			break;
+		}
+
+		/* UTF8 -> native */
+		const char *rc = Rf_translateChar(sRes);
+		int l = strlen(rc);
+		strncpy((char*)buf, rc, (l > len - 1) ? len - 1 : l);
+		vmaxset(vmax);
+
+		/* truncate if needed */
+		buf[(l > len - 1) ? len - 1 : l] = 0;
 #ifdef JRI_DEBUG
-			printf("Re_ReadConsole succeeded: \"%s\"\n",buf);
+		printf("Re_ReadConsole succeeded: \"%s\"\n", buf);
 #endif
-		}
-		(*lenv)->ReleaseStringUTFChars(lenv, r, c);
+		ret = 1;
+		break;
+	}
+	if (r) {
+		if (c) (*lenv)->ReleaseStringUTFChars(lenv, r, c);
 		(*lenv)->DeleteLocalRef(lenv, r);
-		return 1;
-    }
-    return -1;
+	}
+	return ret;
 }
 
 void Re_Busy(int which)
@@ -118,20 +141,27 @@ void Re_Busy(int which)
 
 void Re_WriteConsoleEx(RCCONST char *buf, int len, int oType)
 {
-    JNIEnv *lenv=checkEnvironment();
-    jri_checkExceptions(lenv, 1);
-    {
-      jstring s=(*lenv)->NewStringUTF(lenv, buf);
-      jmethodID mid=(*lenv)->GetMethodID(lenv, engineClass, "jriWriteConsole", "(Ljava/lang/String;I)V");
-      jri_checkExceptions(lenv, 0);
+	JNIEnv *lenv = checkEnvironment();
+	jri_checkExceptions(lenv, 1);
+
+	const void *vmax = vmaxget();
+	jstring s = rj_newNativeJavaString(lenv, buf, len);
+	vmaxset(vmax);
+	if (!s) {
 #ifdef JRI_DEBUG
-      printf("jriWriteConsole mid=%x\n", mid);
+		printf("jriWriteConsole rj_newNativeJavaString() FAILED!\n");
 #endif
-      if (!mid) return;
-      (*lenv)->CallVoidMethod(lenv, engineObj, mid, s, oType);
-      jri_checkExceptions(lenv, 1);
-      (*lenv)->DeleteLocalRef(lenv, s);
-    }
+		return;
+	}
+	jmethodID mid = (*lenv)->GetMethodID(lenv, engineClass, "jriWriteConsole", "(Ljava/lang/String;I)V");
+	jri_checkExceptions(lenv, 0);
+#ifdef JRI_DEBUG
+	printf("jriWriteConsole mid=%x\n", mid);
+#endif
+	if (!mid) return;
+	(*lenv)->CallVoidMethod(lenv, engineObj, mid, s, oType);
+	jri_checkExceptions(lenv, 1);
+	(*lenv)->DeleteLocalRef(lenv, s);
 }
 
 /* old-style WriteConsole (for old R versions only) */
@@ -141,12 +171,12 @@ void Re_WriteConsole(RCCONST char *buf, int len)
 }
 
 /* Indicate that input is coming from the console */
-void Re_ResetConsole()
+void Re_ResetConsole(void)
 {
 }
 
 /* Stdio support to ensure the console file buffer is flushed */
-void Re_FlushConsole()
+void Re_FlushConsole(void)
 {
     JNIEnv *lenv=checkEnvironment();
     jri_checkExceptions(lenv, 1);
@@ -163,7 +193,7 @@ void Re_FlushConsole()
 }
 
 /* Reset stdin if the user types EOF on the console. */
-void Re_ClearerrConsole()
+void Re_ClearerrConsole(void)
 {
 }
 
diff --git a/jri/src/Rcallbacks.h b/src/jri/src/Rcallbacks.h
similarity index 67%
rename from jri/src/Rcallbacks.h
rename to src/jri/src/Rcallbacks.h
index 9bd75a8..a244e7d 100644
--- a/jri/src/Rcallbacks.h
+++ b/src/jri/src/Rcallbacks.h
@@ -12,14 +12,20 @@
 #else
 #define RCCONST const
 #endif
+/* ReadConsole API has been changed (unannounced and undocumented!) for Windows in r81626 */
+#if defined (WIN32) && (R_VERSION < R_Version(4,2,0))
+#define RCSIGN
+#else
+#define RCSIGN unsigned
+#endif
 
-int  Re_ReadConsole(RCCONST char *prompt, unsigned char *buf, int len, int addtohistory);
+int  Re_ReadConsole(RCCONST char *prompt, RCSIGN char *buf, int len, int addtohistory);
 void Re_Busy(int which);
 void Re_WriteConsole(RCCONST char *buf, int len);
 void Re_WriteConsoleEx(RCCONST char *buf, int len, int oType);
-void Re_ResetConsole();
-void Re_FlushConsole();
-void Re_ClearerrConsole();
+void Re_ResetConsole(void);
+void Re_FlushConsole(void);
+void Re_ClearerrConsole(void);
 int  Re_ChooseFile(int new, char *buf, int len);
 void Re_ShowMessage(RCCONST char *buf);
 void Re_read_history(char *buf);
diff --git a/src/jri/src/Rdecl.h b/src/jri/src/Rdecl.h
new file mode 100644
index 0000000..abe9913
--- /dev/null
+++ b/src/jri/src/Rdecl.h
@@ -0,0 +1,22 @@
+#ifndef __RDECL_H__
+#define __RDECL_H__
+
+/* declarations from R internals or other include files */
+/* last update: R 4.6.0 */
+
+#include 
+
+#define R_INTERFACE_PTRS 1
+#define CSTACK_DEFNS 1
+#include  /* R_ReadConsole since 4.6.0 */
+
+/* some have been added to R 4.6.0 */
+#if R_VERSION >= R_Version(4,6,0)
+#include   /* run_Rmainloop (since 4.6.0), Rf_initialize_R (since 2.4.0) */
+#else
+void run_Rmainloop(void); /* main/main.c */
+int  R_ReadConsole(char*, unsigned char*, int, int); /* include/Defn.h */
+int  Rf_initialize_R(int ac, char **av); /* include/Rembedded.h - exists since 2.4.0 */
+#endif /* R < 4.6.0 */
+
+#endif /* __RDECL_H__ */
diff --git a/jri/src/Rengine.c b/src/jri/src/Rengine.c
similarity index 92%
rename from jri/src/Rengine.c
rename to src/jri/src/Rengine.c
index 4a053de..f58f8f5 100644
--- a/jri/src/Rengine.c
+++ b/src/jri/src/Rengine.c
@@ -21,6 +21,27 @@ LibExtern int R_interrupts_pending;
 #define RS_ParseVector(A,B,C) R_ParseVector(A,B,C,R_NilValue)
 #endif
 
+/* R API compatibility re-mapping */
+#if (R_VERSION >= R_Version(2,0,0))
+/* EXTPTR */
+#ifdef  EXTPTR_PTR
+#undef  EXTPTR_PTR
+#endif
+#define EXTPTR_PTR(X) R_ExternalPtrAddr(X)
+#endif
+
+#if (R_VERSION >= R_Version(4,5,0))
+#ifdef ENCLOS
+#undef ENCLOS
+#endif
+#define ENCLOS(X) R_ParentEnv(X)
+
+#ifdef Rf_findVar
+#undef Rf_findVar
+#endif
+#define Rf_findVar(X, Y) R_getVar(X, Y, FALSE)
+#endif
+
 #include "Rcallbacks.h"
 #include "Rinit.h"
 #include "globals.h"
@@ -140,6 +161,7 @@ JNIEXPORT jlong JNICALL Java_org_rosuda_JRI_Rengine_rniEval
       /* invalid (NULL) expression (parse error, ... ) */
       if (!exp) return 0;
 
+      PROTECT(exps);
       if (TYPEOF(exps) == EXPRSXP) { 
       	  /* if the object is a list of exps, eval them one by one */
           l = LENGTH(exps);
@@ -147,12 +169,16 @@ JNIEXPORT jlong JNICALL Java_org_rosuda_JRI_Rengine_rniEval
               es = R_tryEval(VECTOR_ELT(exps,i), eval_env, &er);
               
               /* an error occured, no need to continue */
-              if (er) return 0;
+              if (er) {
+		  UNPROTECT(1);
+		  return 0;
+	      }
               i++;
           }
       } else
           es = R_tryEval(exps, eval_env, &er);
-      
+      UNPROTECT(1);
+
       /* er is just a flag - on error return 0 */
       if (er) return 0;
       
@@ -216,7 +242,7 @@ JNIEXPORT void JNICALL Java_org_rosuda_JRI_Rengine_rniPrintValue
 JNIEXPORT jlong JNICALL Java_org_rosuda_JRI_Rengine_rniParentEnv
 (JNIEnv *env, jobject this, jlong exp)
 {
-  return SEXP2L(ENCLOS(exp ? L2SEXP(exp) : R_GlobalEnv));
+	return SEXP2L(ENCLOS(exp ? L2SEXP(exp) : R_GlobalEnv));
 }
 
 JNIEXPORT jlong JNICALL Java_org_rosuda_JRI_Rengine_rniFindVar
@@ -231,7 +257,19 @@ JNIEXPORT jlong JNICALL Java_org_rosuda_JRI_Rengine_rniFindVar
 JNIEXPORT jlong JNICALL Java_org_rosuda_JRI_Rengine_rniListEnv
 (JNIEnv *env, jobject this, jlong rho, jboolean all)
 {
+#if (R_VERSION >= R_Version(4,6,0))
+	/* have to do it the hard way - eval ls(rho, all.names=all) */
+	SEXP sRho = PROTECT(rho ? L2SEXP(rho) : R_GlobalEnv);
+	SEXP sAll = PROTECT(Rf_ScalarLogical(all ? 1 : 0));
+	SEXP ana = PROTECT(CONS(sAll, R_NilValue));
+	SET_TAG(ana, Rf_install("all.names"));
+	SEXP ex = PROTECT(lang3(Rf_install("ls"), sRho, ana));
+	SEXP res = Rf_eval(ex, R_BaseEnv);
+	UNPROTECT(4);
+	return SEXP2L(res);
+#else
 	return SEXP2L(R_lsInternal(rho ? L2SEXP(rho) : R_GlobalEnv, all));
+#endif
 }
 
 JNIEXPORT jlong JNICALL Java_org_rosuda_JRI_Rengine_rniSpecialObject
@@ -394,19 +432,33 @@ JNIEXPORT jobjectArray JNICALL Java_org_rosuda_JRI_Rengine_rniGetAttrNames
 (JNIEnv *env, jobject this, jlong exp)
 {
     SEXP o = L2SEXP(exp);
-    SEXP att = ATTRIB(o), ah = att;
     unsigned int ac = 0;
     jobjectArray sa;
+#if (R_VERSION >= R_Version(4,6,0))
+    SEXP ans = R_getAttribNames(o);
+    ac = (unsigned int) XLENGTH(o);
+    if (!ac) return 0;
+#else
+    SEXP att = ATTRIB(o), ah = att;
     if (att == R_NilValue) return 0;
     /* count the number of attributes */
     while (ah != R_NilValue) {
 	ac++;
 	ah = CDR(ah);
     }
+#endif
     /* allocate Java array */
     sa = (*env)->NewObjectArray(env, ac, (*env)->FindClass(env, "java/lang/String"), 0);
     if (!sa) return 0;
     ac = 0;
+#if (R_VERSION >= R_Version(4,6,0))
+    R_xlen_t i = 0, n = XLENGTH(ans);
+    while (i < n) {
+	jobject s = (*env)->NewStringUTF(env, CHAR_UTF8(STRING_ELT(ans, i)));
+	(*env)->SetObjectArrayElement(env, sa, (unsigned int)i, s);
+	i++;
+    }
+#else
     ah = att;
     /* iterate again and set create the strings */
     while (ah != R_NilValue) {
@@ -418,6 +470,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_rosuda_JRI_Rengine_rniGetAttrNames
 	ac++;
 	ah = CDR(ah);
     }
+#endif
     return sa;
 }
 
@@ -428,8 +481,7 @@ JNIEXPORT void JNICALL Java_org_rosuda_JRI_Rengine_rniSetAttr
     if (!an || an==R_NilValue || exp==0 || L2SEXP(exp)==R_NilValue) return;
 
     setAttrib(L2SEXP(exp), an, (attr==0)?R_NilValue:L2SEXP(attr));
-	
-	/* BTW: we don't need to adjust the object bit for "class", setAttrib does that already */
+    /* BTW: we don't need to adjust the object bit for "class", setAttrib does that already */
 
     /* this is not official API, but whoever uses this should know what he's doing
        it's ok for directly constructing attr lists, and that's what it should be used for
diff --git a/jri/src/Rinit.c b/src/jri/src/Rinit.c
similarity index 88%
rename from jri/src/Rinit.c
rename to src/jri/src/Rinit.c
index 9caf7d4..05d815d 100644
--- a/jri/src/Rinit.c
+++ b/src/jri/src/Rinit.c
@@ -2,7 +2,7 @@
 #include 
 #include "Rinit.h"
 #include "Rcallbacks.h"
-#include "Rdecl.h"
+#include "Rdecl.h" /* includes Rinterface.h */
 
 /*-------------------------------------------------------------------*
  * UNIX initialization (includes Darwin/Mac OS X)                    *
@@ -10,9 +10,6 @@
 
 #ifndef Win32
 
-#define R_INTERFACE_PTRS 1
-#define CSTACK_DEFNS 1
-#include 
 /* and SaveAction is not officially exported */
 extern SA_TYPE SaveAction;
 
@@ -85,7 +82,7 @@ int initR(int argc, char **argv) {
     return 0;
 }
 
-void initRinside() {
+void initRinside(void) {
     /* disable stack checking, because threads will thow it off */
     R_CStackLimit = (uintptr_t) -1;
 }
@@ -101,6 +98,7 @@ void initRinside() {
 #include 
 #include 
 #include 
+#include 
 
 /* before we include RStatup.h we need to work around a bug in it for Win64:
    it defines wrong R_size_t if R_SIZE_T_DEFINED is not set */
@@ -136,16 +134,16 @@ extern int UserBreak;
 #endif
 
 /* calls into the R DLL */
-extern char *getDLLVersion();
+extern char *getDLLVersion(void);
 extern void R_DefParams(Rstart);
 extern void R_SetParams(Rstart);
 extern void setup_term_ui(void);
 extern void ProcessEvents(void);
 extern void end_Rmainloop(void), R_ReplDLLinit(void);
-extern int R_ReplDLLdo1();
+extern int R_ReplDLLdo1(void);
 extern void run_Rmainloop(void);
 
-void myCallBack()
+void myCallBack(void)
 {
     /* called during i/o, eval, graphics in ProcessEvents */
 }
@@ -160,12 +158,19 @@ void myCallBack()
 #define CANCEL 0
 #endif
 
-int myYesNoCancel(char *s)
+int myYesNoCancel(RCCONST char *s)
 {
-    char  ss[128];
-    unsigned char a[3];
-
-    sprintf(ss, "%s [y/n/c]: ", s);
+    char  ss[192];
+    RCSIGN char a[3];
+    unsigned int l = (unsigned int) strlen(s);
+
+    if (l + 12 > sizeof(ss)) {
+	memcpy(ss, s, sizeof(ss) - 15);
+	strcpy(ss + sizeof(ss) - 15, "... [y/n/c]: ");
+    } else {
+	memcpy(ss, s, l);
+	strcpy(ss + l, " [y/n/c]: ");
+    }
     Re_ReadConsole(ss, a, 3, 0);
     switch (a[0]) {
     case 'y':
@@ -196,11 +201,11 @@ int initR(int argc, char **argv)
     HKEY k;
     int cvl;
 
-    sprintf(Rversion, "%s.%s", R_MAJOR, R_MINOR);
+    snprintf(Rversion, sizeof(Rversion)-1, "%s.%s", R_MAJOR, R_MINOR);
     cvl=strlen(R_MAJOR)+2;
     if(strncmp(getDLLVersion(), Rversion, cvl) != 0) {
         char msg[512];
-	sprintf(msg, "Error: R.DLL version does not match (DLL: %s, expecting: %s)\n", getDLLVersion(), Rversion);
+	snprintf(msg, sizeof(msg)-1, "Error: R.DLL version does not match (DLL: %s, expecting: %s)\n", getDLLVersion(), Rversion);
 	fprintf(stderr, msg);
 	MessageBox(0, msg, "Version mismatch", MB_OK|MB_ICONERROR);
 	return -1;
@@ -227,7 +232,13 @@ int initR(int argc, char **argv)
 	MessageBox(0, "R_HOME must be set or R properly installed (\\Software\\R-core\\R\\InstallPath registry entry must exist).\n", "Can't find R home", MB_OK|MB_ICONERROR);
 	return -2;
       }
-      sprintf(rhb,"R_HOME=%s",RHome);
+      strcpy(rhb, "R_HOME=");
+      if (strlen(RHome) > sizeof(rhb) - 9) {
+	  fprintf(stderr, "R_HOME path is too long!\n");
+	  MessageBox(0, "R_HOME path it too long! Install R in a different location.\n", "R home path is too long", MB_OK|MB_ICONERROR);
+	  return -2;
+      }
+      strcpy(rhb + 7, RHome);
       putenv(rhb);
     }
     /* on Win32 this should set R_Home (in R_SetParams) as well */
@@ -283,7 +294,7 @@ int initR(int argc, char **argv)
     return 0;
 }
 
-void initRinside() {
+void initRinside(void) {
     /* disable stack checking, because threads will thow it off */
     R_CStackLimit = (uintptr_t) -1;
 }
diff --git a/jri/src/Rinit.h b/src/jri/src/Rinit.h
similarity index 78%
rename from jri/src/Rinit.h
rename to src/jri/src/Rinit.h
index b3cc2f0..9963da5 100644
--- a/jri/src/Rinit.h
+++ b/src/jri/src/Rinit.h
@@ -2,6 +2,6 @@
 #define __R_INIT__H__
 
 int initR(int argc, char **argv);
-void initRinside();
+void initRinside(void);
 
 #endif
diff --git a/src/jri/src/config.h.in b/src/jri/src/config.h.in
new file mode 100644
index 0000000..cdedc70
--- /dev/null
+++ b/src/jri/src/config.h.in
@@ -0,0 +1,57 @@
+/* src/config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_STDIO_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_SYS_SELECT_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_SYS_TIME_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if all of the C89 standard headers exist (not just the ones
+   required in a freestanding environment). This macro is provided for
+   backward compatibility; new code need not use it. */
+#undef STDC_HEADERS
diff --git a/jri/src/globals.c b/src/jri/src/globals.c
similarity index 100%
rename from jri/src/globals.c
rename to src/jri/src/globals.c
diff --git a/jri/src/globals.h b/src/jri/src/globals.h
similarity index 100%
rename from jri/src/globals.h
rename to src/jri/src/globals.h
diff --git a/jri/src/h2ic b/src/jri/src/h2ic
similarity index 100%
rename from jri/src/h2ic
rename to src/jri/src/h2ic
diff --git a/jri/src/jri.c b/src/jri/src/jri.c
similarity index 99%
rename from jri/src/jri.c
rename to src/jri/src/jri.c
index 3913c07..f4b3926 100644
--- a/jri/src/jri.c
+++ b/src/jri/src/jri.c
@@ -303,9 +303,9 @@ SEXP jri_getObjectArray(JNIEnv *env, jarray o) {
   if (l<1) return R_NilValue;
   PROTECT(ar=allocVector(INTSXP,l));
   i=0;
-  while (i < l) { /* to avoid warnings we cast ptr -> ljong -> int
+  while (i < l) { /* to avoid warnings we cast ptr -> size_t -> int
 		     with loss of precision */
-    INTEGER(ar)[i] = (int)(jlong)(*env)->GetObjectArrayElement(env, o, i);
+    INTEGER(ar)[i] = (int)(size_t)(*env)->GetObjectArrayElement(env, o, i);
     i++;
   }
   UNPROTECT(1);
diff --git a/jri/src/jri.h b/src/jri/src/jri.h
similarity index 89%
rename from jri/src/jri.h
rename to src/jri/src/jri.h
index 05dae0f..81e485a 100644
--- a/jri/src/jri.h
+++ b/src/jri/src/jri.h
@@ -2,6 +2,9 @@
 #define __JRI_H__
 
 #include 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 #include 
 #include 
 #include 
@@ -9,21 +12,17 @@
 
 /* the viewpoint is from R, i.e. "get" means "Java->R" whereas "put" means "R->Java" */
 
-#define JRI_VERSION 0x0505 /* JRI v0.5-5 */
+#define JRI_VERSION 0x0507 /* JRI v0.5-7 */
 #define JRI_API     0x010a /* API-version 1.10 */
 
 #ifdef __cplusplus
 extern "C" {
 #endif
-    
-  /* jlong can always hold a pointer 
-     to avoid warnings we go ptr->ulong->jlong */
-#define SEXP2L(s) ((jlong)(s))
-#ifdef WIN64
-#define L2SEXP(s) ((SEXP)((jlong)(s)))
-#else
-#define L2SEXP(s) ((SEXP)((jlong)((unsigned long)(s))))
-#endif
+
+/* jlong can always hold a pointer
+   to avoid warnings we go ptr->size_t->jlong */
+#define SEXP2L(s) ((jlong)((size_t)(s)))
+#define L2SEXP(s) ((SEXP)((jlong)((size_t)(s))))
 
 jstring jri_callToString(JNIEnv *env, jobject o);
 
diff --git a/src/jri/src/rjava.c b/src/jri/src/rjava.c
new file mode 100644
index 0000000..7573e3b
--- /dev/null
+++ b/src/jri/src/rjava.c
@@ -0,0 +1,55 @@
+#include "rjava.h"
+#include 
+
+#ifdef _WIN64
+typedef long long ptrlong;
+#else
+typedef long ptrlong;
+#endif
+
+int ipcout;
+int resin;
+int *rjctrl = 0;
+
+typedef void(callbackfn)(void *);
+
+int RJava_request_lock(void) {
+  ptrlong buf[4];
+  int n;
+  if (rjctrl && *rjctrl) return 2;
+
+  buf[0] = IPCC_LOCK_REQUEST;
+  if (write(ipcout, buf, sizeof(ptrlong)) < sizeof(ptrlong)) return 0;
+  n = read(resin, buf, sizeof(ptrlong));
+  return (n == sizeof(ptrlong) && buf[0] == IPCC_LOCK_GRANTED) ? 1 : 0;
+}
+
+int RJava_clear_lock(void) {
+  ptrlong buf[4];
+  buf[0] = IPCC_CLEAR_LOCK;
+  return (write(ipcout, buf, sizeof(ptrlong)) == sizeof(ptrlong)) ? 1 : 0;
+}
+
+int RJava_request_callback(callbackfn *fn, void *data) {
+  ptrlong buf[4];
+  buf[0] = IPCC_CALL_REQUEST;
+  buf[1] = (ptrlong) fn;
+  buf[2] = (ptrlong) data;
+  return (write(ipcout, buf, sizeof(ptrlong) * 3) == sizeof(ptrlong) * 3) ? 1 : 0;
+}
+
+void RJava_setup(int _in, int _out) {
+  /* ptrlong buf[4]; */
+  ipcout = _out;
+  resin = _in;
+}
+
+void RJava_init_ctrl(void) {
+  ptrlong buf[4];
+  buf[0] = IPCC_CONTROL_ADDR;
+  if (write(ipcout, buf, sizeof(ptrlong)) == sizeof(ptrlong) &&
+      read(resin, buf, sizeof(ptrlong) * 2) == sizeof(ptrlong) * 2 &&
+      buf[0] == IPCC_CONTROL_ADDR) {
+      rjctrl= (int*) buf[1];
+  }
+}
diff --git a/jri/src/rjava.h b/src/jri/src/rjava.h
similarity index 73%
rename from jri/src/rjava.h
rename to src/jri/src/rjava.h
index ba6c84d..8fca0e8 100644
--- a/jri/src/rjava.h
+++ b/src/jri/src/rjava.h
@@ -10,11 +10,10 @@
 #define IPCC_CALL_REQUEST 4 /* pars:   */
 #define IPCC_CONTROL_ADDR 5 /* ipc: request, res:  */
 
-int RJava_request_lock();
-int RJava_clear_lock();
-/* void RJava_request_callback(callbackfn *fn, void *data); */
+int RJava_request_lock(void);
+int RJava_clear_lock(void);
+/* int RJava_request_callback(callbackfn *fn, void *data); */
 void RJava_setup(int _in, int _out);
-void RJava_init_ctrl();
+void RJava_init_ctrl(void);
 
 #endif
-
diff --git a/src/jri/src/rjstring.c b/src/jri/src/rjstring.c
new file mode 100644
index 0000000..6fce28b
--- /dev/null
+++ b/src/jri/src/rjstring.c
@@ -0,0 +1,231 @@
+#include "rjstring.h"
+
+#include 
+#include 
+#include 
+#include 
+
+#ifdef WIN32
+/* -- currently unused - was used to mimick reEnc()
+   extern unsigned int localeCP; 
+   static char cpbuf[16]; */
+#endif
+static jchar js_zero[2] = { 0, 0 };
+static jchar js_buf[128];
+
+/* if len = -1 then c is assumed to be NUL terminated */
+int rj_char_utf16(const char *c, int len, jchar **buf, const char *ifrom, int can_error) {
+    void *ih;
+    const char *ce = (len < 0) ? strchr(c, 0) : (c + len);
+    if (ce == c) {
+	buf[0] = js_zero;
+	return 0;
+    }
+    size_t osize = sizeof(jchar) * (ce - c + 1), isize = ce - c;
+    jchar *js = buf[0] = (osize < sizeof(js_buf)) ? js_buf : (jchar*) R_alloc(sizeof(jchar), ce - c + 1);
+    char *dst = (char*) js;
+    int end_test = 1, is_le = (((char*)&end_test)[0] == 1) ? 1 : 0;
+    if (!ifrom) ifrom = "";
+
+#ifdef DEBUG_ENCODING
+    fprintf(stderr, "rJava.rj_char_utf16_native:");
+    { const char *c0 = c; while (*c0) fprintf(stderr, " %02x", (int)((unsigned char)*(c0++))); }
+    fprintf(stderr, "\n");
+#endif
+
+    ih = Riconv_open(is_le ? "UTF-16LE" : "UTF-16BE", ifrom);
+    if (ih == (void *)(-1)) {
+	if (can_error)
+	    Rf_error("Unable to start conversion to UTF-16");
+	return -1;
+    }
+    while (c < ce) {
+	size_t res = Riconv(ih, &c, &isize, &dst, &osize);
+	/* this should never happen since we allocated far more than needed */
+	if (res == -1 && errno == E2BIG) {
+	    if (can_error)
+		Rf_error("Conversion to UTF-16 failed due to unexpectedly large buffer requirements.");
+	    return -1;
+	} else if(res == -1 && (errno == EILSEQ || errno == EINVAL)) { /* invalid char */
+	    if (is_le) {
+		*(dst++) = '?';
+		*(dst++) = 0;
+	    } else {
+		*(dst++) = 0;
+		*(dst++) = '?';
+	    }
+	    osize -= 2;
+	    c++;
+	    isize--;
+	}
+    }
+    Riconv_close(ih);
+#ifdef DEBUG_ENCODING
+    { const jchar *j = js; while (j < (const jchar*)dst) fprintf(stderr, " %04x", (unsigned int)*(j++)); }
+    fprintf(stderr, "\n");
+#endif
+    return dst - (char*) js;
+}
+
+/* returns string from a CHARSXP making sure that the result is in UTF-16.
+   the buffer is owned by the function and may be static, so copy after use.
+
+   Returns the length of the resulting string or -1 on error (if
+   can_error is 0).
+ */
+static int rj_CHARSXP_utf16_(SEXP s, jchar **buf, int can_error) {
+    cetype_t ce_in = getCharCE(s);
+    const char *ifrom = "", *c = CHAR(s), *ce = strchr(c, 0);
+    if (ce == c) {
+	buf[0] = js_zero;
+	return 0;
+    }
+
+    switch (ce_in) {
+#ifdef WIN32
+    case CE_NATIVE:
+/* reEnc uses this, but translateCharUtf8 uses "" so let's go with ""
+	sprintf(cpbuf, "CP%d", localeCP);
+	ifrom = cpbuf;
+*/
+	break;
+    case CE_LATIN1: ifrom = "CP1252"; break;
+#else
+    case CE_NATIVE: break; /* is already "" */
+    case CE_LATIN1: ifrom = "latin1"; break;
+#endif
+    default:
+	ifrom = "UTF-8"; break;
+    }
+
+    return rj_char_utf16(c, ce - c, buf, ifrom, can_error);
+}
+
+int rj_rchar_utf16(SEXP s, jchar **buf) { return rj_CHARSXP_utf16_(s, buf, 1); }
+int rj_rchar_utf16_noerr(SEXP s, jchar **buf) { return rj_CHARSXP_utf16_(s, buf, 0); }
+
+/* FIXME: we should probably deprecate this as well and use UTF-16 instead.
+   The only reason not to is that we would have to fully implement
+   a full UTF-16 -> UTF-8 conversion including surrogate pairs ... */
+
+/* Java returns *modified* UTF-8 which is incompatible with UTF-8,
+   so we have to detect the illegal surrgoate pairs and convert them */
+SEXP rj_mkCharUTF8_(const char *src, int can_error) {
+    const unsigned char *s = (const unsigned char*) src;
+    const unsigned char *c = (const unsigned char*) s;
+    /* check if the string contains any surrogate pairs, i.e.
+       Unicode in the range 0xD800-0xDFFF
+       We want this to be fast since in 99.99% of cases it will
+       be false */
+    while (*c) {
+	if (c[0] == 0xED &&
+	    (c[1] & 0xE0) == 0xA0)
+	    break;
+	c++;
+    }
+    if (*c) { /* yes, we have to convert them */
+	SEXP res;
+	const unsigned char *e = (const unsigned char*) strchr((const char*)s, 0); /* find the end for size */
+	unsigned char *dst = 0, *d, sbuf[64];
+	if (!e) /* should never occur */
+	    return mkChar("");
+	/* we use static buffer for small strings and dynamic alloc for large */
+	if (e - s >= sizeof(sbuf)) {
+	    /* allocate temp buffer since our input is const */
+	    d = dst = (unsigned char *) malloc(e - s + 1);
+	    if (!dst) {
+		if (can_error)
+		    Rf_error("Cannot allocate memory for surrogate pair conversion");
+		return 0;
+	    }
+	} else
+	    d = (unsigned char *)sbuf;
+	if (c - s > 0) {
+	    memcpy(d, s, c - s);
+	    d += c - s;
+	}
+	while (*c) {
+	    unsigned int u1, u;
+	    *(d++) = *(c++);
+	    /* start of a sequence ? */
+	    if ((c[-1] & 0xC0) != 0xC0)
+		continue;
+	    if ((c[-1] & 0xE0) == 0xC0)  { /* 2-byte, not a surrogate pair */
+		if ((c[0] & 0xC0) != 0x80) {
+		    if (dst) free(dst);
+		    if (can_error)
+			Rf_error("illegal 2-byte sequence in Java string");
+		    return 0;
+		}
+		*(d++) = *(c++);
+		continue;
+	    }
+	    if ((c[-1] & 0xF0) != 0xE0) { /* must be 3-byte */
+		if (dst) free(dst);
+		if (can_error)
+		    Rf_error("illegal multi-byte seqeunce in Java string (>3-byte)");
+		return 0;
+	    }
+	    if (((c[0] & 0xC0) != 0x80 ||
+		 (c[1] & 0xC0) != 0x80)) {
+		if (dst) free(dst);
+		if (can_error)
+		    Rf_error("illegal 3-byte sequence in Java string");
+		return 0;
+	    }
+	    u1 = ((((unsigned int)c[-1]) & 0x0F) << 12) |
+		 ((((unsigned int)c[0]) & 0x3F) << 6) |
+		 (((unsigned int)c[1]) & 0x3F);
+	    if (u1 < 0xD800 || u1 > 0xDBFF) { /* not a surrogate pair -> regular copy */
+		*(d++) = *(c++);
+		*(d++) = *(c++);
+		continue;
+	    }
+	    if (u1 >= 0xDC00 && u1 <= 0xDFFF) { /* low surrogate pair ? */
+		if (dst) free(dst);
+		if (can_error)
+		    Rf_error("illegal sequence in Java string: low surrogate pair without a high one");
+		return 0;
+	    }
+	    c += 2; /* move to the low pair */
+	    if (c[0] != 0xED ||
+		(c[1] & 0xF0) != 0xB0 ||
+		(c[2] & 0xC0) != 0x80) {
+		if (dst) free(dst);
+		if (can_error)
+		    Rf_error("illegal sequence in Java string: high surrogate pair not followed by low one");
+		return 0;
+	    }
+	    /* the actually encoded unicode character */
+	    u = ((((unsigned int)c[1]) & 0x0F) << 6) |
+		(((unsigned int)c[2]) & 0x3F);
+	    u |= (u1 & 0x03FF) << 10;
+	    u += 0x10000;
+	    c += 3;
+	    /* it must be <= 0x10FFFF by design (each surrogate has 10 bits) */
+	    d[-1]  = (unsigned char) (((u >> 18) & 0x0F) | 0xF0);
+	    *(d++) = (unsigned char) (((u >> 12) & 0x3F) | 0x80);
+	    *(d++) = (unsigned char) (((u >> 6) & 0x3F) | 0x80);
+	    *(d++) = (unsigned char) ((u & 0x3F) | 0x80);
+	}
+	res = mkCharLenCE((const char*) (dst ? dst : sbuf), dst ? (d - dst) : (d - sbuf), CE_UTF8);
+	if (dst) free(dst);
+	return res;
+    }
+    return mkCharLenCE(src, c - s, CE_UTF8);
+}
+
+SEXP rj_mkCharUTF8(const char *src) { return rj_mkCharUTF8_(src, 0); }
+SEXP rj_mkCharUTF8_noerr(const char *src) { return rj_mkCharUTF8_(src, 1); }
+
+jstring rj_newJavaString(JNIEnv *env, SEXP sChar) {
+    jchar *s;
+    int len = rj_rchar_utf16(sChar, &s);
+    return (*env)->NewString(env, s, (len + 1) >> 1);
+}
+
+jstring rj_newNativeJavaString(JNIEnv *env, const char *str, int len) {
+    jchar *s;
+    int rlen = rj_char_utf16(str, len, &s, "", 0);
+    return (rlen < 0) ? 0 : (*env)->NewString(env, s, (rlen + 1) >> 1);
+}
diff --git a/src/jri/src/rjstring.h b/src/jri/src/rjstring.h
new file mode 100644
index 0000000..6fd24a1
--- /dev/null
+++ b/src/jri/src/rjstring.h
@@ -0,0 +1,25 @@
+#ifndef RJ_STRING_H__
+#define RJ_STRING_H__
+
+#include          /* for jchar */
+#include   /* for SEXP */
+
+/* --- API --- */
+
+/* Returns static content for short strings so don't re-use.
+   For dynamic strings uses R_alloc */
+int rj_char_utf16(const char *c, int len, jchar **buf, const char *ifrom, int can_error);
+
+/* wrappers for above to use with CHARSXP to detect proper ifrom */
+int rj_rchar_utf16(SEXP s, jchar **buf);
+int rj_rchar_utf16_noerr(SEXP s, jchar **buf);
+
+/* return jstring, but do NOT check exceptions */
+jstring rj_newJavaString(JNIEnv *env, SEXP sChar);
+jstring rj_newNativeJavaString(JNIEnv *env, const char *str, int len);
+
+/* takes modified UTF-8 from Java, creates CHARSXP with valid UTF8 */
+SEXP rj_mkCharUTF8(const char *src);
+SEXP rj_mkCharUTF8_noerr(const char *src);
+
+#endif
diff --git a/jri/src/win32/Makefile b/src/jri/src/win32/Makefile
similarity index 100%
rename from jri/src/win32/Makefile
rename to src/jri/src/win32/Makefile
diff --git a/jri/src/win32/findjava.c b/src/jri/src/win32/findjava.c
similarity index 72%
rename from jri/src/win32/findjava.c
rename to src/jri/src/win32/findjava.c
index 6c84158..d64c306 100644
--- a/jri/src/win32/findjava.c
+++ b/src/jri/src/win32/findjava.c
@@ -17,7 +17,7 @@ int main(int argc, char **argv) {
     } else {
       javakey="Software\\R-core\\R"; s=32767;
       if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,javakey,0,KEY_QUERY_VALUE,&k)!=ERROR_SUCCESS ||
-	  RegQueryValueEx(k,"InstallPAth",0,&t,RegStrBuf,&s)!=ERROR_SUCCESS) {
+	  RegQueryValueEx(k,"InstallPath",0,&t,RegStrBuf,&s)!=ERROR_SUCCESS) {
 	if (RegOpenKeyEx(HKEY_CURRENT_USER,javakey,0,KEY_QUERY_VALUE,&k)!=ERROR_SUCCESS ||
 	    RegQueryValueEx(k,"InstallPath",0,&t,RegStrBuf,&s)!=ERROR_SUCCESS) {
 	  fprintf(stderr, "ERROR*> R - can't open registry keys.\n");
@@ -34,15 +34,23 @@ int main(int argc, char **argv) {
 #ifdef FINDJRE
     if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,javakey,0,KEY_QUERY_VALUE,&k)!=ERROR_SUCCESS ||
 	RegQueryValueEx(k,"CurrentVersion",0,&t,RegStrBuf,&s)!=ERROR_SUCCESS) {
+	javakey="Software\\JavaSoft\\JRE"; s=32767;
+	if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,javakey,0,KEY_QUERY_VALUE,&k)!=ERROR_SUCCESS ||
+	    RegQueryValueEx(k,"CurrentVersion",0,&t,RegStrBuf,&s)!=ERROR_SUCCESS) {
 #endif
-      javakey="Software\\JavaSoft\\Java Development Kit"; s=32767;
-      if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,javakey,0,KEY_QUERY_VALUE,&k)!=ERROR_SUCCESS ||
-	  RegQueryValueEx(k,"CurrentVersion",0,&t,RegStrBuf,&s)!=ERROR_SUCCESS) {
-	fprintf(stderr, "ERROR*> JavaSoft\\{JRE|JDK} can't open registry keys.\n");
-	/* MessageBox(wh, "Can't find Sun's Java runtime.\nPlease install Sun's J2SE JRE or JDK 1.4.2 or later (see http://java.sun.com/).","Can't find Sun's Java",MB_OK|MB_ICONERROR); */
-	return -1;
-      }
+	    javakey="Software\\JavaSoft\\Java Development Kit"; s=32767;
+	    if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,javakey,0,KEY_QUERY_VALUE,&k)!=ERROR_SUCCESS ||
+		RegQueryValueEx(k,"CurrentVersion",0,&t,RegStrBuf,&s)!=ERROR_SUCCESS) {
+		javakey="Software\\JavaSoft\\JDK"; s=32767;
+		if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,javakey,0,KEY_QUERY_VALUE,&k)!=ERROR_SUCCESS ||
+		    RegQueryValueEx(k,"CurrentVersion",0,&t,RegStrBuf,&s)!=ERROR_SUCCESS) {
+		    fprintf(stderr, "ERROR*> JavaSoft\\{JRE|JDK} can't open registry keys.\n");
+		    /* MessageBox(wh, "Can't find Sun's Java runtime.\nPlease install Sun's J2SE JRE or JDK 1.4.2 or later (see http://java.sun.com/).","Can't find Sun's Java",MB_OK|MB_ICONERROR); */
+		    return -1;
+		}
+	    }
 #ifdef FINDJRE
+	}
     }
 #endif
     RegCloseKey(k); s=32767;
diff --git a/jri/src/win32/jvm.def b/src/jri/src/win32/jvm.def
similarity index 100%
rename from jri/src/win32/jvm.def
rename to src/jri/src/win32/jvm.def
diff --git a/jri/src/win32/jvm64.def b/src/jri/src/win32/jvm64.def
similarity index 100%
rename from jri/src/win32/jvm64.def
rename to src/jri/src/win32/jvm64.def
diff --git a/jri/tools/config.guess b/src/jri/tools/config.guess
similarity index 52%
rename from jri/tools/config.guess
rename to src/jri/tools/config.guess
index b79252d..0fc11ed 100755
--- a/jri/tools/config.guess
+++ b/src/jri/tools/config.guess
@@ -1,8 +1,8 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright 1992-2013 Free Software Foundation, Inc.
+#   Copyright 1992-2020 Free Software Foundation, Inc.
 
-timestamp='2013-06-10'
+timestamp='2020-11-07'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -15,7 +15,7 @@ timestamp='2013-06-10'
 # General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, see .
+# along with this program; if not, see .
 #
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -24,22 +24,22 @@ timestamp='2013-06-10'
 # program.  This Exception is an additional permission under section 7
 # of the GNU General Public License, version 3 ("GPLv3").
 #
-# Originally written by Per Bothner.
+# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
 #
 # You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
 #
-# Please send patches with a ChangeLog entry to config-patches@gnu.org.
+# Please send patches to .
 
 
-me=`echo "$0" | sed -e 's,.*/,,'`
+me=$(echo "$0" | sed -e 's,.*/,,')
 
 usage="\
 Usage: $0 [OPTION]
 
 Output the configuration name of the system \`$me' is run on.
 
-Operation modes:
+Options:
   -h, --help         print this help, then exit
   -t, --time-stamp   print date of last modification, then exit
   -v, --version      print version number, then exit
@@ -50,7 +50,7 @@ version="\
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright 1992-2013 Free Software Foundation, Inc.
+Copyright 1992-2020 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."
@@ -84,8 +84,6 @@ if test $# != 0; then
   exit 1
 fi
 
-trap 'exit 1' 1 2 15
-
 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a
 # compiler to aid in system detection is discouraged as it requires
 # temporary files to be created and, as you can see below, it is a
@@ -96,66 +94,77 @@ trap 'exit 1' 1 2 15
 
 # Portable tmp directory creation inspired by the Autoconf team.
 
-set_cc_for_build='
-trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
-trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
-: ${TMPDIR=/tmp} ;
- { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
- { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
- { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
- { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
-dummy=$tmp/dummy ;
-tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
-case $CC_FOR_BUILD,$HOST_CC,$CC in
- ,,)    echo "int x;" > $dummy.c ;
-	for c in cc gcc c89 c99 ; do
-	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
-	     CC_FOR_BUILD="$c"; break ;
-	  fi ;
-	done ;
-	if test x"$CC_FOR_BUILD" = x ; then
-	  CC_FOR_BUILD=no_compiler_found ;
-	fi
-	;;
- ,,*)   CC_FOR_BUILD=$CC ;;
- ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
-esac ; set_cc_for_build= ;'
+tmp=
+# shellcheck disable=SC2172
+trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
+
+set_cc_for_build() {
+    # prevent multiple calls if $tmp is already set
+    test "$tmp" && return 0
+    : "${TMPDIR=/tmp}"
+    # shellcheck disable=SC2039
+    { tmp=$( (umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null) && test -n "$tmp" && test -d "$tmp" ; } ||
+	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
+	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
+    dummy=$tmp/dummy
+    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
+	,,)    echo "int x;" > "$dummy.c"
+	       for driver in cc gcc c89 c99 ; do
+		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
+		       CC_FOR_BUILD="$driver"
+		       break
+		   fi
+	       done
+	       if test x"$CC_FOR_BUILD" = x ; then
+		   CC_FOR_BUILD=no_compiler_found
+	       fi
+	       ;;
+	,,*)   CC_FOR_BUILD=$CC ;;
+	,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+    esac
+}
 
 # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
 # (ghazi@noc.rutgers.edu 1994-08-24)
-if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+if test -f /.attbin/uname ; then
 	PATH=$PATH:/.attbin ; export PATH
 fi
 
-UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
-UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
-UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
-UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+UNAME_MACHINE=$( (uname -m) 2>/dev/null) || UNAME_MACHINE=unknown
+UNAME_RELEASE=$( (uname -r) 2>/dev/null) || UNAME_RELEASE=unknown
+UNAME_SYSTEM=$( (uname -s) 2>/dev/null) || UNAME_SYSTEM=unknown
+UNAME_VERSION=$( (uname -v) 2>/dev/null) || UNAME_VERSION=unknown
 
-case "${UNAME_SYSTEM}" in
+case "$UNAME_SYSTEM" in
 Linux|GNU|GNU/*)
 	# If the system lacks a compiler, then just pick glibc.
 	# We could probably try harder.
 	LIBC=gnu
 
-	eval $set_cc_for_build
-	cat <<-EOF > $dummy.c
+	set_cc_for_build
+	cat <<-EOF > "$dummy.c"
 	#include 
 	#if defined(__UCLIBC__)
 	LIBC=uclibc
 	#elif defined(__dietlibc__)
 	LIBC=dietlibc
 	#else
+	#include 
+	#ifdef __DEFINED_va_list
+	LIBC=musl
+	#else
 	LIBC=gnu
 	#endif
+	#endif
 	EOF
-	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
+	eval "$($CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g')"
 	;;
 esac
 
 # Note: order is significant - the case branches are not exclusive.
 
-case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
     *:NetBSD:*:*)
 	# NetBSD (nbsd) targets should (where applicable) match one or
 	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
@@ -168,21 +177,32 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	# Note: NetBSD doesn't particularly care about the vendor
 	# portion of the name.  We always set it to "unknown".
 	sysctl="sysctl -n hw.machine_arch"
-	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
-	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
-	case "${UNAME_MACHINE_ARCH}" in
+	UNAME_MACHINE_ARCH=$( (uname -p 2>/dev/null || \
+	    "/sbin/$sysctl" 2>/dev/null || \
+	    "/usr/sbin/$sysctl" 2>/dev/null || \
+	    echo unknown))
+	case "$UNAME_MACHINE_ARCH" in
+	    aarch64eb) machine=aarch64_be-unknown ;;
 	    armeb) machine=armeb-unknown ;;
 	    arm*) machine=arm-unknown ;;
 	    sh3el) machine=shl-unknown ;;
 	    sh3eb) machine=sh-unknown ;;
 	    sh5el) machine=sh5le-unknown ;;
-	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+	    earmv*)
+		arch=$(echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,')
+		endian=$(echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p')
+		machine="${arch}${endian}"-unknown
+		;;
+	    *) machine="$UNAME_MACHINE_ARCH"-unknown ;;
 	esac
 	# The Operating System including object format, if it has switched
-	# to ELF recently, or will in the future.
-	case "${UNAME_MACHINE_ARCH}" in
+	# to ELF recently (or will in the future) and ABI.
+	case "$UNAME_MACHINE_ARCH" in
+	    earm*)
+		os=netbsdelf
+		;;
 	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
-		eval $set_cc_for_build
+		set_cc_for_build
 		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
 			| grep -q __ELF__
 		then
@@ -197,117 +217,137 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 		os=netbsd
 		;;
 	esac
+	# Determine ABI tags.
+	case "$UNAME_MACHINE_ARCH" in
+	    earm*)
+		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
+		abi=$(echo "$UNAME_MACHINE_ARCH" | sed -e "$expr")
+		;;
+	esac
 	# The OS release
 	# Debian GNU/NetBSD machines have a different userland, and
 	# thus, need a distinct triplet. However, they do not need
 	# kernel version information, so it can be replaced with a
 	# suitable tag, in the style of linux-gnu.
-	case "${UNAME_VERSION}" in
+	case "$UNAME_VERSION" in
 	    Debian*)
 		release='-gnu'
 		;;
 	    *)
-		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+		release=$(echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2)
 		;;
 	esac
 	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
 	# contains redundant information, the shorter form:
 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
-	echo "${machine}-${os}${release}"
+	echo "$machine-${os}${release}${abi-}"
 	exit ;;
     *:Bitrig:*:*)
-	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
-	echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
+	UNAME_MACHINE_ARCH=$(arch | sed 's/Bitrig.//')
+	echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE"
 	exit ;;
     *:OpenBSD:*:*)
-	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
-	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+	UNAME_MACHINE_ARCH=$(arch | sed 's/OpenBSD.//')
+	echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE"
+	exit ;;
+    *:LibertyBSD:*:*)
+	UNAME_MACHINE_ARCH=$(arch | sed 's/^.*BSD\.//')
+	echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE"
+	exit ;;
+    *:MidnightBSD:*:*)
+	echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE"
 	exit ;;
     *:ekkoBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+	echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE"
 	exit ;;
     *:SolidBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+	echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE"
+	exit ;;
+    *:OS108:*:*)
+	echo "$UNAME_MACHINE"-unknown-os108_"$UNAME_RELEASE"
 	exit ;;
     macppc:MirBSD:*:*)
-	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+	echo powerpc-unknown-mirbsd"$UNAME_RELEASE"
 	exit ;;
     *:MirBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+	echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE"
+	exit ;;
+    *:Sortix:*:*)
+	echo "$UNAME_MACHINE"-unknown-sortix
+	exit ;;
+    *:Twizzler:*:*)
+	echo "$UNAME_MACHINE"-unknown-twizzler
+	exit ;;
+    *:Redox:*:*)
+	echo "$UNAME_MACHINE"-unknown-redox
+	exit ;;
+    mips:OSF1:*.*)
+	echo mips-dec-osf1
 	exit ;;
     alpha:OSF1:*:*)
 	case $UNAME_RELEASE in
 	*4.0)
-		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+		UNAME_RELEASE=$(/usr/sbin/sizer -v | awk '{print $3}')
 		;;
 	*5.*)
-		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+		UNAME_RELEASE=$(/usr/sbin/sizer -v | awk '{print $4}')
 		;;
 	esac
 	# According to Compaq, /usr/sbin/psrinfo has been available on
 	# OSF/1 and Tru64 systems produced since 1995.  I hope that
 	# covers most systems running today.  This code pipes the CPU
 	# types through head -n 1, so we only detect the type of CPU 0.
-	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+	ALPHA_CPU_TYPE=$(/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1)
 	case "$ALPHA_CPU_TYPE" in
 	    "EV4 (21064)")
-		UNAME_MACHINE="alpha" ;;
+		UNAME_MACHINE=alpha ;;
 	    "EV4.5 (21064)")
-		UNAME_MACHINE="alpha" ;;
+		UNAME_MACHINE=alpha ;;
 	    "LCA4 (21066/21068)")
-		UNAME_MACHINE="alpha" ;;
+		UNAME_MACHINE=alpha ;;
 	    "EV5 (21164)")
-		UNAME_MACHINE="alphaev5" ;;
+		UNAME_MACHINE=alphaev5 ;;
 	    "EV5.6 (21164A)")
-		UNAME_MACHINE="alphaev56" ;;
+		UNAME_MACHINE=alphaev56 ;;
 	    "EV5.6 (21164PC)")
-		UNAME_MACHINE="alphapca56" ;;
+		UNAME_MACHINE=alphapca56 ;;
 	    "EV5.7 (21164PC)")
-		UNAME_MACHINE="alphapca57" ;;
+		UNAME_MACHINE=alphapca57 ;;
 	    "EV6 (21264)")
-		UNAME_MACHINE="alphaev6" ;;
+		UNAME_MACHINE=alphaev6 ;;
 	    "EV6.7 (21264A)")
-		UNAME_MACHINE="alphaev67" ;;
+		UNAME_MACHINE=alphaev67 ;;
 	    "EV6.8CB (21264C)")
-		UNAME_MACHINE="alphaev68" ;;
+		UNAME_MACHINE=alphaev68 ;;
 	    "EV6.8AL (21264B)")
-		UNAME_MACHINE="alphaev68" ;;
+		UNAME_MACHINE=alphaev68 ;;
 	    "EV6.8CX (21264D)")
-		UNAME_MACHINE="alphaev68" ;;
+		UNAME_MACHINE=alphaev68 ;;
 	    "EV6.9A (21264/EV69A)")
-		UNAME_MACHINE="alphaev69" ;;
+		UNAME_MACHINE=alphaev69 ;;
 	    "EV7 (21364)")
-		UNAME_MACHINE="alphaev7" ;;
+		UNAME_MACHINE=alphaev7 ;;
 	    "EV7.9 (21364A)")
-		UNAME_MACHINE="alphaev79" ;;
+		UNAME_MACHINE=alphaev79 ;;
 	esac
 	# A Pn.n version is a patched version.
 	# A Vn.n version is a released version.
 	# A Tn.n version is a released field test version.
 	# A Xn.n version is an unreleased experimental baselevel.
 	# 1.2 uses "1.2" for uname -r.
-	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	echo "$UNAME_MACHINE"-dec-osf"$(echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz)"
 	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
 	exitcode=$?
 	trap '' 0
 	exit $exitcode ;;
-    Alpha\ *:Windows_NT*:*)
-	# How do we know it's Interix rather than the generic POSIX subsystem?
-	# Should we change UNAME_MACHINE based on the output of uname instead
-	# of the specific Alpha model?
-	echo alpha-pc-interix
-	exit ;;
-    21064:Windows_NT:50:3)
-	echo alpha-dec-winnt3.5
-	exit ;;
     Amiga*:UNIX_System_V:4.0:*)
 	echo m68k-unknown-sysv4
 	exit ;;
     *:[Aa]miga[Oo][Ss]:*:*)
-	echo ${UNAME_MACHINE}-unknown-amigaos
+	echo "$UNAME_MACHINE"-unknown-amigaos
 	exit ;;
     *:[Mm]orph[Oo][Ss]:*:*)
-	echo ${UNAME_MACHINE}-unknown-morphos
+	echo "$UNAME_MACHINE"-unknown-morphos
 	exit ;;
     *:OS/390:*:*)
 	echo i370-ibm-openedition
@@ -319,7 +359,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	echo powerpc-ibm-os400
 	exit ;;
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
-	echo arm-acorn-riscix${UNAME_RELEASE}
+	echo arm-acorn-riscix"$UNAME_RELEASE"
 	exit ;;
     arm*:riscos:*:*|arm*:RISCOS:*:*)
 	echo arm-unknown-riscos
@@ -329,7 +369,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	exit ;;
     Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
 	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
-	if test "`(/bin/universe) 2>/dev/null`" = att ; then
+	if test "$( (/bin/universe) 2>/dev/null)" = att ; then
 		echo pyramid-pyramid-sysv3
 	else
 		echo pyramid-pyramid-bsd
@@ -342,69 +382,69 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	echo sparc-icl-nx6
 	exit ;;
     DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
-	case `/usr/bin/uname -p` in
+	case $(/usr/bin/uname -p) in
 	    sparc) echo sparc-icl-nx7; exit ;;
 	esac ;;
     s390x:SunOS:*:*)
-	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	echo "$UNAME_MACHINE"-ibm-solaris2"$(echo "$UNAME_RELEASE" | sed -e 's/[^.]*//')"
 	exit ;;
     sun4H:SunOS:5.*:*)
-	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	echo sparc-hal-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')"
 	exit ;;
     sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
-	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	echo sparc-sun-solaris2"$(echo "$UNAME_RELEASE" | sed -e 's/[^.]*//')"
 	exit ;;
     i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
-	echo i386-pc-auroraux${UNAME_RELEASE}
+	echo i386-pc-auroraux"$UNAME_RELEASE"
 	exit ;;
     i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
-	eval $set_cc_for_build
-	SUN_ARCH="i386"
+	set_cc_for_build
+	SUN_ARCH=i386
 	# If there is a compiler, see if it is configured for 64-bit objects.
 	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
 	# This test works for both compilers.
-	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+	if test "$CC_FOR_BUILD" != no_compiler_found; then
 	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
-		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
 		grep IS_64BIT_ARCH >/dev/null
 	    then
-		SUN_ARCH="x86_64"
+		SUN_ARCH=x86_64
 	    fi
 	fi
-	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	echo "$SUN_ARCH"-pc-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')"
 	exit ;;
     sun4*:SunOS:6*:*)
 	# According to config.sub, this is the proper way to canonicalize
 	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
 	# it's likely to be more like Solaris than SunOS4.
-	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	echo sparc-sun-solaris3"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')"
 	exit ;;
     sun4*:SunOS:*:*)
-	case "`/usr/bin/arch -k`" in
+	case "$(/usr/bin/arch -k)" in
 	    Series*|S4*)
-		UNAME_RELEASE=`uname -v`
+		UNAME_RELEASE=$(uname -v)
 		;;
 	esac
 	# Japanese Language versions have a version number like `4.1.3-JL'.
-	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+	echo sparc-sun-sunos"$(echo "$UNAME_RELEASE"|sed -e 's/-/_/')"
 	exit ;;
     sun3*:SunOS:*:*)
-	echo m68k-sun-sunos${UNAME_RELEASE}
+	echo m68k-sun-sunos"$UNAME_RELEASE"
 	exit ;;
     sun*:*:4.2BSD:*)
-	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
-	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
-	case "`/bin/arch`" in
+	UNAME_RELEASE=$( (sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null)
+	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
+	case "$(/bin/arch)" in
 	    sun3)
-		echo m68k-sun-sunos${UNAME_RELEASE}
+		echo m68k-sun-sunos"$UNAME_RELEASE"
 		;;
 	    sun4)
-		echo sparc-sun-sunos${UNAME_RELEASE}
+		echo sparc-sun-sunos"$UNAME_RELEASE"
 		;;
 	esac
 	exit ;;
     aushp:SunOS:*:*)
-	echo sparc-auspex-sunos${UNAME_RELEASE}
+	echo sparc-auspex-sunos"$UNAME_RELEASE"
 	exit ;;
     # The situation for MiNT is a little confusing.  The machine name
     # can be virtually everything (everything which is not
@@ -415,44 +455,44 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     # MiNT.  But MiNT is downward compatible to TOS, so this should
     # be no problem.
     atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
-	echo m68k-atari-mint${UNAME_RELEASE}
+	echo m68k-atari-mint"$UNAME_RELEASE"
 	exit ;;
     atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
-	echo m68k-atari-mint${UNAME_RELEASE}
+	echo m68k-atari-mint"$UNAME_RELEASE"
 	exit ;;
     *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
-	echo m68k-atari-mint${UNAME_RELEASE}
+	echo m68k-atari-mint"$UNAME_RELEASE"
 	exit ;;
     milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
-	echo m68k-milan-mint${UNAME_RELEASE}
+	echo m68k-milan-mint"$UNAME_RELEASE"
 	exit ;;
     hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
-	echo m68k-hades-mint${UNAME_RELEASE}
+	echo m68k-hades-mint"$UNAME_RELEASE"
 	exit ;;
     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
-	echo m68k-unknown-mint${UNAME_RELEASE}
+	echo m68k-unknown-mint"$UNAME_RELEASE"
 	exit ;;
     m68k:machten:*:*)
-	echo m68k-apple-machten${UNAME_RELEASE}
+	echo m68k-apple-machten"$UNAME_RELEASE"
 	exit ;;
     powerpc:machten:*:*)
-	echo powerpc-apple-machten${UNAME_RELEASE}
+	echo powerpc-apple-machten"$UNAME_RELEASE"
 	exit ;;
     RISC*:Mach:*:*)
 	echo mips-dec-mach_bsd4.3
 	exit ;;
     RISC*:ULTRIX:*:*)
-	echo mips-dec-ultrix${UNAME_RELEASE}
+	echo mips-dec-ultrix"$UNAME_RELEASE"
 	exit ;;
     VAX*:ULTRIX*:*:*)
-	echo vax-dec-ultrix${UNAME_RELEASE}
+	echo vax-dec-ultrix"$UNAME_RELEASE"
 	exit ;;
     2020:CLIX:*:* | 2430:CLIX:*:*)
-	echo clipper-intergraph-clix${UNAME_RELEASE}
+	echo clipper-intergraph-clix"$UNAME_RELEASE"
 	exit ;;
     mips:*:*:UMIPS | mips:*:*:RISCos)
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
+	set_cc_for_build
+	sed 's/^	//' << EOF > "$dummy.c"
 #ifdef __cplusplus
 #include   /* for printf() prototype */
 	int main (int argc, char *argv[]) {
@@ -461,23 +501,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 #endif
 	#if defined (host_mips) && defined (MIPSEB)
 	#if defined (SYSTYPE_SYSV)
-	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
 	#endif
 	#if defined (SYSTYPE_SVR4)
-	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
 	#endif
 	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
-	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
 	#endif
 	#endif
 	  exit (-1);
 	}
 EOF
-	$CC_FOR_BUILD -o $dummy $dummy.c &&
-	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
-	  SYSTEM_NAME=`$dummy $dummyarg` &&
+	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
+	  dummyarg=$(echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p') &&
+	  SYSTEM_NAME=$("$dummy" "$dummyarg") &&
 	    { echo "$SYSTEM_NAME"; exit; }
-	echo mips-mips-riscos${UNAME_RELEASE}
+	echo mips-mips-riscos"$UNAME_RELEASE"
 	exit ;;
     Motorola:PowerMAX_OS:*:*)
 	echo powerpc-motorola-powermax
@@ -502,18 +542,18 @@ EOF
 	exit ;;
     AViiON:dgux:*:*)
 	# DG/UX returns AViiON for all architectures
-	UNAME_PROCESSOR=`/usr/bin/uname -p`
-	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+	UNAME_PROCESSOR=$(/usr/bin/uname -p)
+	if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
 	then
-	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
-	       [ ${TARGET_BINARY_INTERFACE}x = x ]
+	    if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
+	       test "$TARGET_BINARY_INTERFACE"x = x
 	    then
-		echo m88k-dg-dgux${UNAME_RELEASE}
+		echo m88k-dg-dgux"$UNAME_RELEASE"
 	    else
-		echo m88k-dg-dguxbcs${UNAME_RELEASE}
+		echo m88k-dg-dguxbcs"$UNAME_RELEASE"
 	    fi
 	else
-	    echo i586-dg-dgux${UNAME_RELEASE}
+	    echo i586-dg-dgux"$UNAME_RELEASE"
 	fi
 	exit ;;
     M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
@@ -530,26 +570,26 @@ EOF
 	echo m68k-tektronix-bsd
 	exit ;;
     *:IRIX*:*:*)
-	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+	echo mips-sgi-irix"$(echo "$UNAME_RELEASE"|sed -e 's/-/_/g')"
 	exit ;;
     ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
 	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
-	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
+	exit ;;               # Note that: echo "'$(uname -s)'" gives 'AIX '
     i*86:AIX:*:*)
 	echo i386-ibm-aix
 	exit ;;
     ia64:AIX:*:*)
-	if [ -x /usr/bin/oslevel ] ; then
-		IBM_REV=`/usr/bin/oslevel`
+	if test -x /usr/bin/oslevel ; then
+		IBM_REV=$(/usr/bin/oslevel)
 	else
-		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+		IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
 	fi
-	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+	echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV"
 	exit ;;
     *:AIX:2:3)
 	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
-		eval $set_cc_for_build
-		sed 's/^		//' << EOF >$dummy.c
+		set_cc_for_build
+		sed 's/^		//' << EOF > "$dummy.c"
 		#include 
 
 		main()
@@ -560,7 +600,7 @@ EOF
 			exit(0);
 			}
 EOF
-		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=$("$dummy")
 		then
 			echo "$SYSTEM_NAME"
 		else
@@ -573,27 +613,28 @@ EOF
 	fi
 	exit ;;
     *:AIX:*:[4567])
-	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
-	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+	IBM_CPU_ID=$(/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }')
+	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
 		IBM_ARCH=rs6000
 	else
 		IBM_ARCH=powerpc
 	fi
-	if [ -x /usr/bin/oslevel ] ; then
-		IBM_REV=`/usr/bin/oslevel`
+	if test -x /usr/bin/lslpp ; then
+		IBM_REV=$(/usr/bin/lslpp -Lqc bos.rte.libc |
+			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/)
 	else
-		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+		IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
 	fi
-	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+	echo "$IBM_ARCH"-ibm-aix"$IBM_REV"
 	exit ;;
     *:AIX:*:*)
 	echo rs6000-ibm-aix
 	exit ;;
-    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
 	echo romp-ibm-bsd4.4
 	exit ;;
     ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
-	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+	echo romp-ibm-bsd"$UNAME_RELEASE"   # 4.3 with uname added to
 	exit ;;                             # report: romp-ibm BSD 4.3
     *:BOSX:*:*)
 	echo rs6000-bull-bosx
@@ -608,28 +649,28 @@ EOF
 	echo m68k-hp-bsd4.4
 	exit ;;
     9000/[34678]??:HP-UX:*:*)
-	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
-	case "${UNAME_MACHINE}" in
-	    9000/31? )            HP_ARCH=m68000 ;;
-	    9000/[34]?? )         HP_ARCH=m68k ;;
+	HPUX_REV=$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//')
+	case "$UNAME_MACHINE" in
+	    9000/31?)            HP_ARCH=m68000 ;;
+	    9000/[34]??)         HP_ARCH=m68k ;;
 	    9000/[678][0-9][0-9])
-		if [ -x /usr/bin/getconf ]; then
-		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
-		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
-		    case "${sc_cpu_version}" in
-		      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
-		      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+		if test -x /usr/bin/getconf; then
+		    sc_cpu_version=$(/usr/bin/getconf SC_CPU_VERSION 2>/dev/null)
+		    sc_kernel_bits=$(/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null)
+		    case "$sc_cpu_version" in
+		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
+		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
 		      532)                      # CPU_PA_RISC2_0
-			case "${sc_kernel_bits}" in
-			  32) HP_ARCH="hppa2.0n" ;;
-			  64) HP_ARCH="hppa2.0w" ;;
-			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+			case "$sc_kernel_bits" in
+			  32) HP_ARCH=hppa2.0n ;;
+			  64) HP_ARCH=hppa2.0w ;;
+			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
 			esac ;;
 		    esac
 		fi
-		if [ "${HP_ARCH}" = "" ]; then
-		    eval $set_cc_for_build
-		    sed 's/^		//' << EOF >$dummy.c
+		if test "$HP_ARCH" = ""; then
+		    set_cc_for_build
+		    sed 's/^		//' << EOF > "$dummy.c"
 
 		#define _HPUX_SOURCE
 		#include 
@@ -662,13 +703,13 @@ EOF
 		    exit (0);
 		}
 EOF
-		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=$("$dummy")
 		    test -z "$HP_ARCH" && HP_ARCH=hppa
 		fi ;;
 	esac
-	if [ ${HP_ARCH} = "hppa2.0w" ]
+	if test "$HP_ARCH" = hppa2.0w
 	then
-	    eval $set_cc_for_build
+	    set_cc_for_build
 
 	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
 	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
@@ -679,23 +720,23 @@ EOF
 	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
 	    # => hppa64-hp-hpux11.23
 
-	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
 		grep -q __LP64__
 	    then
-		HP_ARCH="hppa2.0w"
+		HP_ARCH=hppa2.0w
 	    else
-		HP_ARCH="hppa64"
+		HP_ARCH=hppa64
 	    fi
 	fi
-	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+	echo "$HP_ARCH"-hp-hpux"$HPUX_REV"
 	exit ;;
     ia64:HP-UX:*:*)
-	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
-	echo ia64-hp-hpux${HPUX_REV}
+	HPUX_REV=$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//')
+	echo ia64-hp-hpux"$HPUX_REV"
 	exit ;;
     3050*:HI-UX:*:*)
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
+	set_cc_for_build
+	sed 's/^	//' << EOF > "$dummy.c"
 	#include 
 	int
 	main ()
@@ -720,11 +761,11 @@ EOF
 	  exit (0);
 	}
 EOF
-	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=$("$dummy") &&
 		{ echo "$SYSTEM_NAME"; exit; }
 	echo unknown-hitachi-hiuxwe2
 	exit ;;
-    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
 	echo hppa1.1-hp-bsd
 	exit ;;
     9000/8??:4.3bsd:*:*)
@@ -733,17 +774,17 @@ EOF
     *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
 	echo hppa1.0-hp-mpeix
 	exit ;;
-    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
 	echo hppa1.1-hp-osf
 	exit ;;
     hp8??:OSF1:*:*)
 	echo hppa1.0-hp-osf
 	exit ;;
     i*86:OSF1:*:*)
-	if [ -x /usr/sbin/sysversion ] ; then
-	    echo ${UNAME_MACHINE}-unknown-osf1mk
+	if test -x /usr/sbin/sysversion ; then
+	    echo "$UNAME_MACHINE"-unknown-osf1mk
 	else
-	    echo ${UNAME_MACHINE}-unknown-osf1
+	    echo "$UNAME_MACHINE"-unknown-osf1
 	fi
 	exit ;;
     parisc*:Lites*:*:*)
@@ -768,130 +809,123 @@ EOF
 	echo c4-convex-bsd
 	exit ;;
     CRAY*Y-MP:*:*:*)
-	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
 	exit ;;
     CRAY*[A-Z]90:*:*:*)
-	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
 	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
 	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
 	      -e 's/\.[^.]*$/.X/'
 	exit ;;
     CRAY*TS:*:*:*)
-	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
 	exit ;;
     CRAY*T3E:*:*:*)
-	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
 	exit ;;
     CRAY*SV1:*:*:*)
-	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
 	exit ;;
     *:UNICOS/mp:*:*)
-	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
 	exit ;;
     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
-	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+	FUJITSU_PROC=$(uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz)
+	FUJITSU_SYS=$(uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///')
+	FUJITSU_REL=$(echo "$UNAME_RELEASE" | sed -e 's/ /_/')
 	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
 	exit ;;
     5000:UNIX_System_V:4.*:*)
-	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+	FUJITSU_SYS=$(uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///')
+	FUJITSU_REL=$(echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/')
 	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
 	exit ;;
     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
-	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+	echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE"
 	exit ;;
     sparc*:BSD/OS:*:*)
-	echo sparc-unknown-bsdi${UNAME_RELEASE}
+	echo sparc-unknown-bsdi"$UNAME_RELEASE"
 	exit ;;
     *:BSD/OS:*:*)
-	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+	echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE"
+	exit ;;
+    arm:FreeBSD:*:*)
+	UNAME_PROCESSOR=$(uname -p)
+	set_cc_for_build
+	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
+	    | grep -q __ARM_PCS_VFP
+	then
+	    echo "${UNAME_PROCESSOR}"-unknown-freebsd"$(echo ${UNAME_RELEASE}|sed -e 's/[-(].*//')"-gnueabi
+	else
+	    echo "${UNAME_PROCESSOR}"-unknown-freebsd"$(echo ${UNAME_RELEASE}|sed -e 's/[-(].*//')"-gnueabihf
+	fi
 	exit ;;
     *:FreeBSD:*:*)
-	UNAME_PROCESSOR=`/usr/bin/uname -p`
-	case ${UNAME_PROCESSOR} in
+	UNAME_PROCESSOR=$(/usr/bin/uname -p)
+	case "$UNAME_PROCESSOR" in
 	    amd64)
-		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
-	    *)
-		echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+		UNAME_PROCESSOR=x86_64 ;;
+	    i386)
+		UNAME_PROCESSOR=i586 ;;
 	esac
+	echo "$UNAME_PROCESSOR"-unknown-freebsd"$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')"
 	exit ;;
     i*:CYGWIN*:*)
-	echo ${UNAME_MACHINE}-pc-cygwin
+	echo "$UNAME_MACHINE"-pc-cygwin
 	exit ;;
     *:MINGW64*:*)
-	echo ${UNAME_MACHINE}-pc-mingw64
+	echo "$UNAME_MACHINE"-pc-mingw64
 	exit ;;
     *:MINGW*:*)
-	echo ${UNAME_MACHINE}-pc-mingw32
-	exit ;;
-    i*:MSYS*:*)
-	echo ${UNAME_MACHINE}-pc-msys
+	echo "$UNAME_MACHINE"-pc-mingw32
 	exit ;;
-    i*:windows32*:*)
-	# uname -m includes "-pc" on this system.
-	echo ${UNAME_MACHINE}-mingw32
+    *:MSYS*:*)
+	echo "$UNAME_MACHINE"-pc-msys
 	exit ;;
     i*:PW*:*)
-	echo ${UNAME_MACHINE}-pc-pw32
+	echo "$UNAME_MACHINE"-pc-pw32
 	exit ;;
     *:Interix*:*)
-	case ${UNAME_MACHINE} in
+	case "$UNAME_MACHINE" in
 	    x86)
-		echo i586-pc-interix${UNAME_RELEASE}
+		echo i586-pc-interix"$UNAME_RELEASE"
 		exit ;;
 	    authenticamd | genuineintel | EM64T)
-		echo x86_64-unknown-interix${UNAME_RELEASE}
+		echo x86_64-unknown-interix"$UNAME_RELEASE"
 		exit ;;
 	    IA64)
-		echo ia64-unknown-interix${UNAME_RELEASE}
+		echo ia64-unknown-interix"$UNAME_RELEASE"
 		exit ;;
 	esac ;;
-    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
-	echo i${UNAME_MACHINE}-pc-mks
-	exit ;;
-    8664:Windows_NT:*)
-	echo x86_64-pc-mks
-	exit ;;
-    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
-	# How do we know it's Interix rather than the generic POSIX subsystem?
-	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
-	# UNAME_MACHINE based on the output of uname instead of i386?
-	echo i586-pc-interix
-	exit ;;
     i*:UWIN*:*)
-	echo ${UNAME_MACHINE}-pc-uwin
+	echo "$UNAME_MACHINE"-pc-uwin
 	exit ;;
     amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
-	echo x86_64-unknown-cygwin
-	exit ;;
-    p*:CYGWIN*:*)
-	echo powerpcle-unknown-cygwin
+	echo x86_64-pc-cygwin
 	exit ;;
     prep*:SunOS:5.*:*)
-	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	echo powerpcle-unknown-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')"
 	exit ;;
     *:GNU:*:*)
 	# the GNU system
-	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	echo "$(echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,')-unknown-$LIBC$(echo "$UNAME_RELEASE"|sed -e 's,/.*$,,')"
 	exit ;;
     *:GNU/*:*:*)
 	# other systems with GNU libc and userland
-	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
+	echo "$UNAME_MACHINE-unknown-$(echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]")$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')-$LIBC"
 	exit ;;
-    i*86:Minix:*:*)
-	echo ${UNAME_MACHINE}-pc-minix
+    *:Minix:*:*)
+	echo "$UNAME_MACHINE"-unknown-minix
 	exit ;;
     aarch64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     aarch64_be:Linux:*:*)
 	UNAME_MACHINE=aarch64_be
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     alpha:Linux:*:*)
-	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+	case $(sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null) in
 	  EV5)   UNAME_MACHINE=alphaev5 ;;
 	  EV56)  UNAME_MACHINE=alphaev56 ;;
 	  PCA56) UNAME_MACHINE=alphapca56 ;;
@@ -901,129 +935,179 @@ EOF
 	  EV68*) UNAME_MACHINE=alphaev68 ;;
 	esac
 	objdump --private-headers /bin/sh | grep -q ld.so.1
-	if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     arc:Linux:*:* | arceb:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     arm*:Linux:*:*)
-	eval $set_cc_for_build
+	set_cc_for_build
 	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
 	    | grep -q __ARM_EABI__
 	then
-	    echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	    echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	else
 	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
 		| grep -q __ARM_PCS_VFP
 	    then
-		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
+		echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi
 	    else
-		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
+		echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf
 	    fi
 	fi
 	exit ;;
     avr32*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     cris:Linux:*:*)
-	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
+	echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
 	exit ;;
     crisv32:Linux:*:*)
-	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
+	echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
+	exit ;;
+    e2k:Linux:*:*)
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     frv:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     hexagon:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     i*86:Linux:*:*)
-	echo ${UNAME_MACHINE}-pc-linux-${LIBC}
+	echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
 	exit ;;
     ia64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
+	exit ;;
+    k1om:Linux:*:*)
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     m32r*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     m68*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     mips:Linux:*:* | mips64:Linux:*:*)
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
+	set_cc_for_build
+	IS_GLIBC=0
+	test x"${LIBC}" = xgnu && IS_GLIBC=1
+	sed 's/^	//' << EOF > "$dummy.c"
 	#undef CPU
-	#undef ${UNAME_MACHINE}
-	#undef ${UNAME_MACHINE}el
+	#undef mips
+	#undef mipsel
+	#undef mips64
+	#undef mips64el
+	#if ${IS_GLIBC} && defined(_ABI64)
+	LIBCABI=gnuabi64
+	#else
+	#if ${IS_GLIBC} && defined(_ABIN32)
+	LIBCABI=gnuabin32
+	#else
+	LIBCABI=${LIBC}
+	#endif
+	#endif
+
+	#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
+	CPU=mipsisa64r6
+	#else
+	#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
+	CPU=mipsisa32r6
+	#else
+	#if defined(__mips64)
+	CPU=mips64
+	#else
+	CPU=mips
+	#endif
+	#endif
+	#endif
+
 	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
-	CPU=${UNAME_MACHINE}el
+	MIPS_ENDIAN=el
 	#else
 	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
-	CPU=${UNAME_MACHINE}
+	MIPS_ENDIAN=
 	#else
-	CPU=
+	MIPS_ENDIAN=
 	#endif
 	#endif
 EOF
-	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
-	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
+	eval "$($CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI')"
+	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
 	;;
-    or1k:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+    mips64el:Linux:*:*)
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
+	exit ;;
+    openrisc*:Linux:*:*)
+	echo or1k-unknown-linux-"$LIBC"
 	exit ;;
-    or32:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+    or32:Linux:*:* | or1k*:Linux:*:*)
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     padre:Linux:*:*)
-	echo sparc-unknown-linux-${LIBC}
+	echo sparc-unknown-linux-"$LIBC"
 	exit ;;
     parisc64:Linux:*:* | hppa64:Linux:*:*)
-	echo hppa64-unknown-linux-${LIBC}
+	echo hppa64-unknown-linux-"$LIBC"
 	exit ;;
     parisc:Linux:*:* | hppa:Linux:*:*)
 	# Look for CPU level
-	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
-	  PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
-	  PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
-	  *)    echo hppa-unknown-linux-${LIBC} ;;
+	case $(grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2) in
+	  PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;;
+	  PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;;
+	  *)    echo hppa-unknown-linux-"$LIBC" ;;
 	esac
 	exit ;;
     ppc64:Linux:*:*)
-	echo powerpc64-unknown-linux-${LIBC}
+	echo powerpc64-unknown-linux-"$LIBC"
 	exit ;;
     ppc:Linux:*:*)
-	echo powerpc-unknown-linux-${LIBC}
+	echo powerpc-unknown-linux-"$LIBC"
 	exit ;;
     ppc64le:Linux:*:*)
-	echo powerpc64le-unknown-linux-${LIBC}
+	echo powerpc64le-unknown-linux-"$LIBC"
 	exit ;;
     ppcle:Linux:*:*)
-	echo powerpcle-unknown-linux-${LIBC}
+	echo powerpcle-unknown-linux-"$LIBC"
+	exit ;;
+    riscv32:Linux:*:* | riscv64:Linux:*:*)
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     s390:Linux:*:* | s390x:Linux:*:*)
-	echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
+	echo "$UNAME_MACHINE"-ibm-linux-"$LIBC"
 	exit ;;
     sh64*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     sh*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     sparc:Linux:*:* | sparc64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     tile*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     vax:Linux:*:*)
-	echo ${UNAME_MACHINE}-dec-linux-${LIBC}
+	echo "$UNAME_MACHINE"-dec-linux-"$LIBC"
 	exit ;;
     x86_64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	set_cc_for_build
+	LIBCABI=$LIBC
+	if test "$CC_FOR_BUILD" != no_compiler_found; then
+	    if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
+		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+		grep IS_X32 >/dev/null
+	    then
+		LIBCABI="$LIBC"x32
+	    fi
+	fi
+	echo "$UNAME_MACHINE"-pc-linux-"$LIBCABI"
 	exit ;;
     xtensa*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     i*86:DYNIX/ptx:4*:*)
 	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
@@ -1037,51 +1121,51 @@ EOF
 	# I am not positive that other SVR4 systems won't match this,
 	# I just have to hope.  -- rms.
 	# Use sysv4.2uw... so that sysv4* matches it.
-	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+	echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION"
 	exit ;;
     i*86:OS/2:*:*)
 	# If we were able to find `uname', then EMX Unix compatibility
 	# is probably installed.
-	echo ${UNAME_MACHINE}-pc-os2-emx
+	echo "$UNAME_MACHINE"-pc-os2-emx
 	exit ;;
     i*86:XTS-300:*:STOP)
-	echo ${UNAME_MACHINE}-unknown-stop
+	echo "$UNAME_MACHINE"-unknown-stop
 	exit ;;
     i*86:atheos:*:*)
-	echo ${UNAME_MACHINE}-unknown-atheos
+	echo "$UNAME_MACHINE"-unknown-atheos
 	exit ;;
     i*86:syllable:*:*)
-	echo ${UNAME_MACHINE}-pc-syllable
+	echo "$UNAME_MACHINE"-pc-syllable
 	exit ;;
     i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
-	echo i386-unknown-lynxos${UNAME_RELEASE}
+	echo i386-unknown-lynxos"$UNAME_RELEASE"
 	exit ;;
     i*86:*DOS:*:*)
-	echo ${UNAME_MACHINE}-pc-msdosdjgpp
+	echo "$UNAME_MACHINE"-pc-msdosdjgpp
 	exit ;;
-    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
-	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+    i*86:*:4.*:*)
+	UNAME_REL=$(echo "$UNAME_RELEASE" | sed 's/\/MP$//')
 	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
-		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+		echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL"
 	else
-		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+		echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL"
 	fi
 	exit ;;
     i*86:*:5:[678]*)
 	# UnixWare 7.x, OpenUNIX and OpenServer 6.
-	case `/bin/uname -X | grep "^Machine"` in
+	case $(/bin/uname -X | grep "^Machine") in
 	    *486*)	     UNAME_MACHINE=i486 ;;
 	    *Pentium)	     UNAME_MACHINE=i586 ;;
 	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
 	esac
-	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+	echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}"
 	exit ;;
     i*86:*:3.2:*)
 	if test -f /usr/options/cb.name; then
-		UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then
-		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+		UNAME_REL=$( (/bin/uname -X|grep Release|sed -e 's/.*= //'))
 		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
 		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
 			&& UNAME_MACHINE=i586
@@ -1089,9 +1173,9 @@ EOF
 			&& UNAME_MACHINE=i686
 		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
 			&& UNAME_MACHINE=i686
-		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+		echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL"
 	else
-		echo ${UNAME_MACHINE}-pc-sysv32
+		echo "$UNAME_MACHINE"-pc-sysv32
 	fi
 	exit ;;
     pc:*:*:*)
@@ -1099,7 +1183,7 @@ EOF
 	# uname -m prints for DJGPP always 'pc', but it prints nothing about
 	# the processor, so we play safe by assuming i586.
 	# Note: whatever this is, it MUST be the same as what config.sub
-	# prints for the "djgpp" host, or else GDB configury will decide that
+	# prints for the "djgpp" host, or else GDB configure will decide that
 	# this is a cross-build.
 	echo i586-pc-msdosdjgpp
 	exit ;;
@@ -1111,9 +1195,9 @@ EOF
 	exit ;;
     i860:*:4.*:*) # i860-SVR4
 	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
-	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+	  echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4
 	else # Add other i860-SVR4 vendors below as they are discovered.
-	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+	  echo i860-unknown-sysv"$UNAME_RELEASE"  # Unknown i860-SVR4
 	fi
 	exit ;;
     mini*:CTIX:SYS*5:*)
@@ -1131,41 +1215,41 @@ EOF
     3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
 	OS_REL=''
 	test -r /etc/.relid \
-	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	&& OS_REL=.$(sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid)
 	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
 	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
-	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
     3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
 	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
 	  && { echo i486-ncr-sysv4; exit; } ;;
     NCR*:*:4.2:* | MPRAS*:*:4.2:*)
 	OS_REL='.3'
 	test -r /etc/.relid \
-	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	    && OS_REL=.$(sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid)
 	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-	    && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
 	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
-	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
+	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
 	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
-	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
     m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
-	echo m68k-unknown-lynxos${UNAME_RELEASE}
+	echo m68k-unknown-lynxos"$UNAME_RELEASE"
 	exit ;;
     mc68030:UNIX_System_V:4.*:*)
 	echo m68k-atari-sysv4
 	exit ;;
     TSUNAMI:LynxOS:2.*:*)
-	echo sparc-unknown-lynxos${UNAME_RELEASE}
+	echo sparc-unknown-lynxos"$UNAME_RELEASE"
 	exit ;;
     rs6000:LynxOS:2.*:*)
-	echo rs6000-unknown-lynxos${UNAME_RELEASE}
+	echo rs6000-unknown-lynxos"$UNAME_RELEASE"
 	exit ;;
     PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
-	echo powerpc-unknown-lynxos${UNAME_RELEASE}
+	echo powerpc-unknown-lynxos"$UNAME_RELEASE"
 	exit ;;
     SM[BE]S:UNIX_SV:*:*)
-	echo mips-dde-sysv${UNAME_RELEASE}
+	echo mips-dde-sysv"$UNAME_RELEASE"
 	exit ;;
     RM*:ReliantUNIX-*:*:*)
 	echo mips-sni-sysv4
@@ -1175,8 +1259,8 @@ EOF
 	exit ;;
     *:SINIX-*:*:*)
 	if uname -p 2>/dev/null >/dev/null ; then
-		UNAME_MACHINE=`(uname -p) 2>/dev/null`
-		echo ${UNAME_MACHINE}-sni-sysv4
+		UNAME_MACHINE=$( (uname -p) 2>/dev/null)
+		echo "$UNAME_MACHINE"-sni-sysv4
 	else
 		echo ns32k-sni-sysv
 	fi
@@ -1196,23 +1280,23 @@ EOF
 	exit ;;
     i*86:VOS:*:*)
 	# From Paul.Green@stratus.com.
-	echo ${UNAME_MACHINE}-stratus-vos
+	echo "$UNAME_MACHINE"-stratus-vos
 	exit ;;
     *:VOS:*:*)
 	# From Paul.Green@stratus.com.
 	echo hppa1.1-stratus-vos
 	exit ;;
     mc68*:A/UX:*:*)
-	echo m68k-apple-aux${UNAME_RELEASE}
+	echo m68k-apple-aux"$UNAME_RELEASE"
 	exit ;;
     news*:NEWS-OS:6*:*)
 	echo mips-sony-newsos6
 	exit ;;
     R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
-	if [ -d /usr/nec ]; then
-		echo mips-nec-sysv${UNAME_RELEASE}
+	if test -d /usr/nec; then
+		echo mips-nec-sysv"$UNAME_RELEASE"
 	else
-		echo mips-unknown-sysv${UNAME_RELEASE}
+		echo mips-unknown-sysv"$UNAME_RELEASE"
 	fi
 	exit ;;
     BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
@@ -1231,67 +1315,97 @@ EOF
 	echo x86_64-unknown-haiku
 	exit ;;
     SX-4:SUPER-UX:*:*)
-	echo sx4-nec-superux${UNAME_RELEASE}
+	echo sx4-nec-superux"$UNAME_RELEASE"
 	exit ;;
     SX-5:SUPER-UX:*:*)
-	echo sx5-nec-superux${UNAME_RELEASE}
+	echo sx5-nec-superux"$UNAME_RELEASE"
 	exit ;;
     SX-6:SUPER-UX:*:*)
-	echo sx6-nec-superux${UNAME_RELEASE}
+	echo sx6-nec-superux"$UNAME_RELEASE"
 	exit ;;
     SX-7:SUPER-UX:*:*)
-	echo sx7-nec-superux${UNAME_RELEASE}
+	echo sx7-nec-superux"$UNAME_RELEASE"
 	exit ;;
     SX-8:SUPER-UX:*:*)
-	echo sx8-nec-superux${UNAME_RELEASE}
+	echo sx8-nec-superux"$UNAME_RELEASE"
 	exit ;;
     SX-8R:SUPER-UX:*:*)
-	echo sx8r-nec-superux${UNAME_RELEASE}
+	echo sx8r-nec-superux"$UNAME_RELEASE"
+	exit ;;
+    SX-ACE:SUPER-UX:*:*)
+	echo sxace-nec-superux"$UNAME_RELEASE"
 	exit ;;
     Power*:Rhapsody:*:*)
-	echo powerpc-apple-rhapsody${UNAME_RELEASE}
+	echo powerpc-apple-rhapsody"$UNAME_RELEASE"
 	exit ;;
     *:Rhapsody:*:*)
-	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+	echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE"
+	exit ;;
+    arm64:Darwin:*:*)
+	echo aarch64-apple-darwin"$UNAME_RELEASE"
 	exit ;;
     *:Darwin:*:*)
-	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
-	eval $set_cc_for_build
-	if test "$UNAME_PROCESSOR" = unknown ; then
-	    UNAME_PROCESSOR=powerpc
+	UNAME_PROCESSOR=$(uname -p)
+	case $UNAME_PROCESSOR in
+	    unknown) UNAME_PROCESSOR=powerpc ;;
+	esac
+	if command -v xcode-select > /dev/null 2> /dev/null && \
+		! xcode-select --print-path > /dev/null 2> /dev/null ; then
+	    # Avoid executing cc if there is no toolchain installed as
+	    # cc will be a stub that puts up a graphical alert
+	    # prompting the user to install developer tools.
+	    CC_FOR_BUILD=no_compiler_found
+	else
+	    set_cc_for_build
 	fi
-	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+	if test "$CC_FOR_BUILD" != no_compiler_found; then
 	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
-		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
-		grep IS_64BIT_ARCH >/dev/null
+		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+		   grep IS_64BIT_ARCH >/dev/null
 	    then
 		case $UNAME_PROCESSOR in
 		    i386) UNAME_PROCESSOR=x86_64 ;;
 		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
 		esac
 	    fi
+	    # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
+	    if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
+		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+		   grep IS_PPC >/dev/null
+	    then
+		UNAME_PROCESSOR=powerpc
+	    fi
+	elif test "$UNAME_PROCESSOR" = i386 ; then
+	    # uname -m returns i386 or x86_64
+	    UNAME_PROCESSOR=$UNAME_MACHINE
 	fi
-	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+	echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE"
 	exit ;;
     *:procnto*:*:* | *:QNX:[0123456789]*:*)
-	UNAME_PROCESSOR=`uname -p`
-	if test "$UNAME_PROCESSOR" = "x86"; then
+	UNAME_PROCESSOR=$(uname -p)
+	if test "$UNAME_PROCESSOR" = x86; then
 		UNAME_PROCESSOR=i386
 		UNAME_MACHINE=pc
 	fi
-	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+	echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE"
 	exit ;;
     *:QNX:*:4*)
 	echo i386-pc-qnx
 	exit ;;
-    NEO-?:NONSTOP_KERNEL:*:*)
-	echo neo-tandem-nsk${UNAME_RELEASE}
+    NEO-*:NONSTOP_KERNEL:*:*)
+	echo neo-tandem-nsk"$UNAME_RELEASE"
 	exit ;;
     NSE-*:NONSTOP_KERNEL:*:*)
-	echo nse-tandem-nsk${UNAME_RELEASE}
+	echo nse-tandem-nsk"$UNAME_RELEASE"
 	exit ;;
-    NSR-?:NONSTOP_KERNEL:*:*)
-	echo nsr-tandem-nsk${UNAME_RELEASE}
+    NSR-*:NONSTOP_KERNEL:*:*)
+	echo nsr-tandem-nsk"$UNAME_RELEASE"
+	exit ;;
+    NSV-*:NONSTOP_KERNEL:*:*)
+	echo nsv-tandem-nsk"$UNAME_RELEASE"
+	exit ;;
+    NSX-*:NONSTOP_KERNEL:*:*)
+	echo nsx-tandem-nsk"$UNAME_RELEASE"
 	exit ;;
     *:NonStop-UX:*:*)
 	echo mips-compaq-nonstopux
@@ -1300,18 +1414,19 @@ EOF
 	echo bs2000-siemens-sysv
 	exit ;;
     DS/*:UNIX_System_V:*:*)
-	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+	echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE"
 	exit ;;
     *:Plan9:*:*)
 	# "uname -m" is not consistent, so use $cputype instead. 386
 	# is converted to i386 for consistency with other x86
 	# operating systems.
-	if test "$cputype" = "386"; then
+	# shellcheck disable=SC2154
+	if test "$cputype" = 386; then
 	    UNAME_MACHINE=i386
 	else
 	    UNAME_MACHINE="$cputype"
 	fi
-	echo ${UNAME_MACHINE}-unknown-plan9
+	echo "$UNAME_MACHINE"-unknown-plan9
 	exit ;;
     *:TOPS-10:*:*)
 	echo pdp10-unknown-tops10
@@ -1332,14 +1447,14 @@ EOF
 	echo pdp10-unknown-its
 	exit ;;
     SEI:*:*:SEIUX)
-	echo mips-sei-seiux${UNAME_RELEASE}
+	echo mips-sei-seiux"$UNAME_RELEASE"
 	exit ;;
     *:DragonFly:*:*)
-	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	echo "$UNAME_MACHINE"-unknown-dragonfly"$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')"
 	exit ;;
     *:*VMS:*:*)
-	UNAME_MACHINE=`(uname -p) 2>/dev/null`
-	case "${UNAME_MACHINE}" in
+	UNAME_MACHINE=$( (uname -p) 2>/dev/null)
+	case "$UNAME_MACHINE" in
 	    A*) echo alpha-dec-vms ; exit ;;
 	    I*) echo ia64-dec-vms ; exit ;;
 	    V*) echo vax-dec-vms ; exit ;;
@@ -1348,24 +1463,39 @@ EOF
 	echo i386-pc-xenix
 	exit ;;
     i*86:skyos:*:*)
-	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+	echo "$UNAME_MACHINE"-pc-skyos"$(echo "$UNAME_RELEASE" | sed -e 's/ .*$//')"
 	exit ;;
     i*86:rdos:*:*)
-	echo ${UNAME_MACHINE}-pc-rdos
+	echo "$UNAME_MACHINE"-pc-rdos
 	exit ;;
     i*86:AROS:*:*)
-	echo ${UNAME_MACHINE}-pc-aros
+	echo "$UNAME_MACHINE"-pc-aros
 	exit ;;
     x86_64:VMkernel:*:*)
-	echo ${UNAME_MACHINE}-unknown-esx
+	echo "$UNAME_MACHINE"-unknown-esx
+	exit ;;
+    amd64:Isilon\ OneFS:*:*)
+	echo x86_64-unknown-onefs
+	exit ;;
+    *:Unleashed:*:*)
+	echo "$UNAME_MACHINE"-unknown-unleashed"$UNAME_RELEASE"
 	exit ;;
 esac
 
-eval $set_cc_for_build
-cat >$dummy.c < "$dummy.c" <
-# include 
+#include 
+#include 
+#endif
+#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
+#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
+#include 
+#if defined(_SIZE_T_) || defined(SIGLOST)
+#include 
+#endif
+#endif
 #endif
 main ()
 {
@@ -1378,28 +1508,20 @@ main ()
 #include 
   printf ("m68k-sony-newsos%s\n",
 #ifdef NEWSOS4
-	"4"
+  "4"
 #else
-	""
+  ""
 #endif
-	); exit (0);
+  ); exit (0);
 #endif
 #endif
 
-#if defined (__arm) && defined (__acorn) && defined (__unix)
-  printf ("arm-acorn-riscix\n"); exit (0);
-#endif
-
-#if defined (hp300) && !defined (hpux)
-  printf ("m68k-hp-bsd\n"); exit (0);
-#endif
-
 #if defined (NeXT)
 #if !defined (__ARCHITECTURE__)
 #define __ARCHITECTURE__ "m68k"
 #endif
   int version;
-  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  version=$( (hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null);
   if (version < 4)
     printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
   else
@@ -1433,39 +1555,54 @@ main ()
 #endif
 
 #if defined (_SEQUENT_)
-    struct utsname un;
-
-    uname(&un);
-
-    if (strncmp(un.version, "V2", 2) == 0) {
-	printf ("i386-sequent-ptx2\n"); exit (0);
-    }
-    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
-	printf ("i386-sequent-ptx1\n"); exit (0);
-    }
-    printf ("i386-sequent-ptx\n"); exit (0);
+  struct utsname un;
 
+  uname(&un);
+  if (strncmp(un.version, "V2", 2) == 0) {
+    printf ("i386-sequent-ptx2\n"); exit (0);
+  }
+  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+    printf ("i386-sequent-ptx1\n"); exit (0);
+  }
+  printf ("i386-sequent-ptx\n"); exit (0);
 #endif
 
 #if defined (vax)
-# if !defined (ultrix)
-#  include 
-#  if defined (BSD)
-#   if BSD == 43
-      printf ("vax-dec-bsd4.3\n"); exit (0);
-#   else
-#    if BSD == 199006
-      printf ("vax-dec-bsd4.3reno\n"); exit (0);
-#    else
-      printf ("vax-dec-bsd\n"); exit (0);
-#    endif
-#   endif
-#  else
-    printf ("vax-dec-bsd\n"); exit (0);
-#  endif
-# else
-    printf ("vax-dec-ultrix\n"); exit (0);
-# endif
+#if !defined (ultrix)
+#include 
+#if defined (BSD)
+#if BSD == 43
+  printf ("vax-dec-bsd4.3\n"); exit (0);
+#else
+#if BSD == 199006
+  printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#else
+  printf ("vax-dec-bsd\n"); exit (0);
+#endif
+#endif
+#else
+  printf ("vax-dec-bsd\n"); exit (0);
+#endif
+#else
+#if defined(_SIZE_T_) || defined(SIGLOST)
+  struct utsname un;
+  uname (&un);
+  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
+#else
+  printf ("vax-dec-ultrix\n"); exit (0);
+#endif
+#endif
+#endif
+#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
+#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
+#if defined(_SIZE_T_) || defined(SIGLOST)
+  struct utsname *un;
+  uname (&un);
+  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
+#else
+  printf ("mips-dec-ultrix\n"); exit (0);
+#endif
+#endif
 #endif
 
 #if defined (alliant) && defined (i860)
@@ -1476,82 +1613,73 @@ main ()
 }
 EOF
 
-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=$($dummy) &&
 	{ echo "$SYSTEM_NAME"; exit; }
 
 # Apollos put the system type in the environment.
+test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
 
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+echo "$0: unable to guess system type" >&2
 
-# Convex versions that predate uname can use getsysinfo(1)
+case "$UNAME_MACHINE:$UNAME_SYSTEM" in
+    mips:Linux | mips64:Linux)
+	# If we got here on MIPS GNU/Linux, output extra information.
+	cat >&2 <&2 <&2 < in order to provide the needed
-information to handle your system.
+If $0 has already been updated, send the following data and any
+information you think might be pertinent to config-patches@gnu.org to
+provide the necessary information to handle your system.
 
 config.guess timestamp = $timestamp
 
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
+uname -m = $( (uname -m) 2>/dev/null || echo unknown)
+uname -r = $( (uname -r) 2>/dev/null || echo unknown)
+uname -s = $( (uname -s) 2>/dev/null || echo unknown)
+uname -v = $( (uname -v) 2>/dev/null || echo unknown)
 
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
-/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+/usr/bin/uname -p = $( (/usr/bin/uname -p) 2>/dev/null)
+/bin/uname -X     = $( (/bin/uname -X) 2>/dev/null)
 
-hostinfo               = `(hostinfo) 2>/dev/null`
-/bin/universe          = `(/bin/universe) 2>/dev/null`
-/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
-/bin/arch              = `(/bin/arch) 2>/dev/null`
-/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+hostinfo               = $( (hostinfo) 2>/dev/null)
+/bin/universe          = $( (/bin/universe) 2>/dev/null)
+/usr/bin/arch -k       = $( (/usr/bin/arch -k) 2>/dev/null)
+/bin/arch              = $( (/bin/arch) 2>/dev/null)
+/usr/bin/oslevel       = $( (/usr/bin/oslevel) 2>/dev/null)
+/usr/convex/getsysinfo = $( (/usr/convex/getsysinfo) 2>/dev/null)
 
-UNAME_MACHINE = ${UNAME_MACHINE}
-UNAME_RELEASE = ${UNAME_RELEASE}
-UNAME_SYSTEM  = ${UNAME_SYSTEM}
-UNAME_VERSION = ${UNAME_VERSION}
+UNAME_MACHINE = "$UNAME_MACHINE"
+UNAME_RELEASE = "$UNAME_RELEASE"
+UNAME_SYSTEM  = "$UNAME_SYSTEM"
+UNAME_VERSION = "$UNAME_VERSION"
 EOF
+fi
 
 exit 1
 
 # Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp)
 # time-stamp-start: "timestamp='"
 # time-stamp-format: "%:y-%02m-%02d"
 # time-stamp-end: "'"
diff --git a/src/jri/tools/config.sub b/src/jri/tools/config.sub
new file mode 100755
index 0000000..c874b7a
--- /dev/null
+++ b/src/jri/tools/config.sub
@@ -0,0 +1,1853 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+#   Copyright 1992-2020 Free Software Foundation, Inc.
+
+timestamp='2020-11-07'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see .
+#
+# 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.  This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
+
+
+# Please send patches to .
+#
+# 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:
+# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
+
+# 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.
+# Each package is responsible for reporting which valid configurations
+# it does not support.  The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=$(echo "$0" | sed -e 's,.*/,,')
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
+
+Canonicalize a configuration name.
+
+Options:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to ."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright 1992-2020 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."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+
+    *local*)
+       # First pass through any local machine types.
+       echo "$1"
+       exit ;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
+esac
+
+# Split fields of configuration type
+# shellcheck disable=SC2162
+IFS="-" read field1 field2 field3 field4 <&2
+		exit 1
+		;;
+	*-*-*-*)
+		basic_machine=$field1-$field2
+		basic_os=$field3-$field4
+		;;
+	*-*-*)
+		# Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two
+		# parts
+		maybe_os=$field2-$field3
+		case $maybe_os in
+			nto-qnx* | linux-* | uclinux-uclibc* \
+			| uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \
+			| netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
+			| storm-chaos* | os2-emx* | rtmk-nova*)
+				basic_machine=$field1
+				basic_os=$maybe_os
+				;;
+			android-linux)
+				basic_machine=$field1-unknown
+				basic_os=linux-android
+				;;
+			*)
+				basic_machine=$field1-$field2
+				basic_os=$field3
+				;;
+		esac
+		;;
+	*-*)
+		# A lone config we happen to match not fitting any pattern
+		case $field1-$field2 in
+			decstation-3100)
+				basic_machine=mips-dec
+				basic_os=
+				;;
+			*-*)
+				# Second component is usually, but not always the OS
+				case $field2 in
+					# Prevent following clause from handling this valid os
+					sun*os*)
+						basic_machine=$field1
+						basic_os=$field2
+						;;
+					# Manufacturers
+					dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \
+					| att* | 7300* | 3300* | delta* | motorola* | sun[234]* \
+					| unicom* | ibm* | next | hp | isi* | apollo | altos* \
+					| 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 | knuth | cray \
+					| microblaze* | sim | cisco \
+					| oki | wec | wrs | winbond)
+						basic_machine=$field1-$field2
+						basic_os=
+						;;
+					*)
+						basic_machine=$field1
+						basic_os=$field2
+						;;
+				esac
+			;;
+		esac
+		;;
+	*)
+		# Convert single-component short-hands not valid as part of
+		# multi-component configurations.
+		case $field1 in
+			386bsd)
+				basic_machine=i386-pc
+				basic_os=bsd
+				;;
+			a29khif)
+				basic_machine=a29k-amd
+				basic_os=udi
+				;;
+			adobe68k)
+				basic_machine=m68010-adobe
+				basic_os=scout
+				;;
+			alliant)
+				basic_machine=fx80-alliant
+				basic_os=
+				;;
+			altos | altos3068)
+				basic_machine=m68k-altos
+				basic_os=
+				;;
+			am29k)
+				basic_machine=a29k-none
+				basic_os=bsd
+				;;
+			amdahl)
+				basic_machine=580-amdahl
+				basic_os=sysv
+				;;
+			amiga)
+				basic_machine=m68k-unknown
+				basic_os=
+				;;
+			amigaos | amigados)
+				basic_machine=m68k-unknown
+				basic_os=amigaos
+				;;
+			amigaunix | amix)
+				basic_machine=m68k-unknown
+				basic_os=sysv4
+				;;
+			apollo68)
+				basic_machine=m68k-apollo
+				basic_os=sysv
+				;;
+			apollo68bsd)
+				basic_machine=m68k-apollo
+				basic_os=bsd
+				;;
+			aros)
+				basic_machine=i386-pc
+				basic_os=aros
+				;;
+			aux)
+				basic_machine=m68k-apple
+				basic_os=aux
+				;;
+			balance)
+				basic_machine=ns32k-sequent
+				basic_os=dynix
+				;;
+			blackfin)
+				basic_machine=bfin-unknown
+				basic_os=linux
+				;;
+			cegcc)
+				basic_machine=arm-unknown
+				basic_os=cegcc
+				;;
+			convex-c1)
+				basic_machine=c1-convex
+				basic_os=bsd
+				;;
+			convex-c2)
+				basic_machine=c2-convex
+				basic_os=bsd
+				;;
+			convex-c32)
+				basic_machine=c32-convex
+				basic_os=bsd
+				;;
+			convex-c34)
+				basic_machine=c34-convex
+				basic_os=bsd
+				;;
+			convex-c38)
+				basic_machine=c38-convex
+				basic_os=bsd
+				;;
+			cray)
+				basic_machine=j90-cray
+				basic_os=unicos
+				;;
+			crds | unos)
+				basic_machine=m68k-crds
+				basic_os=
+				;;
+			da30)
+				basic_machine=m68k-da30
+				basic_os=
+				;;
+			decstation | pmax | pmin | dec3100 | decstatn)
+				basic_machine=mips-dec
+				basic_os=
+				;;
+			delta88)
+				basic_machine=m88k-motorola
+				basic_os=sysv3
+				;;
+			dicos)
+				basic_machine=i686-pc
+				basic_os=dicos
+				;;
+			djgpp)
+				basic_machine=i586-pc
+				basic_os=msdosdjgpp
+				;;
+			ebmon29k)
+				basic_machine=a29k-amd
+				basic_os=ebmon
+				;;
+			es1800 | OSE68k | ose68k | ose | OSE)
+				basic_machine=m68k-ericsson
+				basic_os=ose
+				;;
+			gmicro)
+				basic_machine=tron-gmicro
+				basic_os=sysv
+				;;
+			go32)
+				basic_machine=i386-pc
+				basic_os=go32
+				;;
+			h8300hms)
+				basic_machine=h8300-hitachi
+				basic_os=hms
+				;;
+			h8300xray)
+				basic_machine=h8300-hitachi
+				basic_os=xray
+				;;
+			h8500hms)
+				basic_machine=h8500-hitachi
+				basic_os=hms
+				;;
+			harris)
+				basic_machine=m88k-harris
+				basic_os=sysv3
+				;;
+			hp300 | hp300hpux)
+				basic_machine=m68k-hp
+				basic_os=hpux
+				;;
+			hp300bsd)
+				basic_machine=m68k-hp
+				basic_os=bsd
+				;;
+			hppaosf)
+				basic_machine=hppa1.1-hp
+				basic_os=osf
+				;;
+			hppro)
+				basic_machine=hppa1.1-hp
+				basic_os=proelf
+				;;
+			i386mach)
+				basic_machine=i386-mach
+				basic_os=mach
+				;;
+			isi68 | isi)
+				basic_machine=m68k-isi
+				basic_os=sysv
+				;;
+			m68knommu)
+				basic_machine=m68k-unknown
+				basic_os=linux
+				;;
+			magnum | m3230)
+				basic_machine=mips-mips
+				basic_os=sysv
+				;;
+			merlin)
+				basic_machine=ns32k-utek
+				basic_os=sysv
+				;;
+			mingw64)
+				basic_machine=x86_64-pc
+				basic_os=mingw64
+				;;
+			mingw32)
+				basic_machine=i686-pc
+				basic_os=mingw32
+				;;
+			mingw32ce)
+				basic_machine=arm-unknown
+				basic_os=mingw32ce
+				;;
+			monitor)
+				basic_machine=m68k-rom68k
+				basic_os=coff
+				;;
+			morphos)
+				basic_machine=powerpc-unknown
+				basic_os=morphos
+				;;
+			moxiebox)
+				basic_machine=moxie-unknown
+				basic_os=moxiebox
+				;;
+			msdos)
+				basic_machine=i386-pc
+				basic_os=msdos
+				;;
+			msys)
+				basic_machine=i686-pc
+				basic_os=msys
+				;;
+			mvs)
+				basic_machine=i370-ibm
+				basic_os=mvs
+				;;
+			nacl)
+				basic_machine=le32-unknown
+				basic_os=nacl
+				;;
+			ncr3000)
+				basic_machine=i486-ncr
+				basic_os=sysv4
+				;;
+			netbsd386)
+				basic_machine=i386-pc
+				basic_os=netbsd
+				;;
+			netwinder)
+				basic_machine=armv4l-rebel
+				basic_os=linux
+				;;
+			news | news700 | news800 | news900)
+				basic_machine=m68k-sony
+				basic_os=newsos
+				;;
+			news1000)
+				basic_machine=m68030-sony
+				basic_os=newsos
+				;;
+			necv70)
+				basic_machine=v70-nec
+				basic_os=sysv
+				;;
+			nh3000)
+				basic_machine=m68k-harris
+				basic_os=cxux
+				;;
+			nh[45]000)
+				basic_machine=m88k-harris
+				basic_os=cxux
+				;;
+			nindy960)
+				basic_machine=i960-intel
+				basic_os=nindy
+				;;
+			mon960)
+				basic_machine=i960-intel
+				basic_os=mon960
+				;;
+			nonstopux)
+				basic_machine=mips-compaq
+				basic_os=nonstopux
+				;;
+			os400)
+				basic_machine=powerpc-ibm
+				basic_os=os400
+				;;
+			OSE68000 | ose68000)
+				basic_machine=m68000-ericsson
+				basic_os=ose
+				;;
+			os68k)
+				basic_machine=m68k-none
+				basic_os=os68k
+				;;
+			paragon)
+				basic_machine=i860-intel
+				basic_os=osf
+				;;
+			parisc)
+				basic_machine=hppa-unknown
+				basic_os=linux
+				;;
+			psp)
+				basic_machine=mipsallegrexel-sony
+				basic_os=psp
+				;;
+			pw32)
+				basic_machine=i586-unknown
+				basic_os=pw32
+				;;
+			rdos | rdos64)
+				basic_machine=x86_64-pc
+				basic_os=rdos
+				;;
+			rdos32)
+				basic_machine=i386-pc
+				basic_os=rdos
+				;;
+			rom68k)
+				basic_machine=m68k-rom68k
+				basic_os=coff
+				;;
+			sa29200)
+				basic_machine=a29k-amd
+				basic_os=udi
+				;;
+			sei)
+				basic_machine=mips-sei
+				basic_os=seiux
+				;;
+			sequent)
+				basic_machine=i386-sequent
+				basic_os=
+				;;
+			sps7)
+				basic_machine=m68k-bull
+				basic_os=sysv2
+				;;
+			st2000)
+				basic_machine=m68k-tandem
+				basic_os=
+				;;
+			stratus)
+				basic_machine=i860-stratus
+				basic_os=sysv4
+				;;
+			sun2)
+				basic_machine=m68000-sun
+				basic_os=
+				;;
+			sun2os3)
+				basic_machine=m68000-sun
+				basic_os=sunos3
+				;;
+			sun2os4)
+				basic_machine=m68000-sun
+				basic_os=sunos4
+				;;
+			sun3)
+				basic_machine=m68k-sun
+				basic_os=
+				;;
+			sun3os3)
+				basic_machine=m68k-sun
+				basic_os=sunos3
+				;;
+			sun3os4)
+				basic_machine=m68k-sun
+				basic_os=sunos4
+				;;
+			sun4)
+				basic_machine=sparc-sun
+				basic_os=
+				;;
+			sun4os3)
+				basic_machine=sparc-sun
+				basic_os=sunos3
+				;;
+			sun4os4)
+				basic_machine=sparc-sun
+				basic_os=sunos4
+				;;
+			sun4sol2)
+				basic_machine=sparc-sun
+				basic_os=solaris2
+				;;
+			sun386 | sun386i | roadrunner)
+				basic_machine=i386-sun
+				basic_os=
+				;;
+			sv1)
+				basic_machine=sv1-cray
+				basic_os=unicos
+				;;
+			symmetry)
+				basic_machine=i386-sequent
+				basic_os=dynix
+				;;
+			t3e)
+				basic_machine=alphaev5-cray
+				basic_os=unicos
+				;;
+			t90)
+				basic_machine=t90-cray
+				basic_os=unicos
+				;;
+			toad1)
+				basic_machine=pdp10-xkl
+				basic_os=tops20
+				;;
+			tpf)
+				basic_machine=s390x-ibm
+				basic_os=tpf
+				;;
+			udi29k)
+				basic_machine=a29k-amd
+				basic_os=udi
+				;;
+			ultra3)
+				basic_machine=a29k-nyu
+				basic_os=sym1
+				;;
+			v810 | necv810)
+				basic_machine=v810-nec
+				basic_os=none
+				;;
+			vaxv)
+				basic_machine=vax-dec
+				basic_os=sysv
+				;;
+			vms)
+				basic_machine=vax-dec
+				basic_os=vms
+				;;
+			vsta)
+				basic_machine=i386-pc
+				basic_os=vsta
+				;;
+			vxworks960)
+				basic_machine=i960-wrs
+				basic_os=vxworks
+				;;
+			vxworks68)
+				basic_machine=m68k-wrs
+				basic_os=vxworks
+				;;
+			vxworks29k)
+				basic_machine=a29k-wrs
+				basic_os=vxworks
+				;;
+			xbox)
+				basic_machine=i686-pc
+				basic_os=mingw32
+				;;
+			ymp)
+				basic_machine=ymp-cray
+				basic_os=unicos
+				;;
+			*)
+				basic_machine=$1
+				basic_os=
+				;;
+		esac
+		;;
+esac
+
+# Decode 1-component or ad-hoc basic machines
+case $basic_machine in
+	# Here we handle the default manufacturer of certain CPU types.  It is in
+	# some cases the only manufacturer, in others, it is the most popular.
+	w89k)
+		cpu=hppa1.1
+		vendor=winbond
+		;;
+	op50n)
+		cpu=hppa1.1
+		vendor=oki
+		;;
+	op60c)
+		cpu=hppa1.1
+		vendor=oki
+		;;
+	ibm*)
+		cpu=i370
+		vendor=ibm
+		;;
+	orion105)
+		cpu=clipper
+		vendor=highlevel
+		;;
+	mac | mpw | mac-mpw)
+		cpu=m68k
+		vendor=apple
+		;;
+	pmac | pmac-mpw)
+		cpu=powerpc
+		vendor=apple
+		;;
+
+	# Recognize the various machine names and aliases which stand
+	# for a CPU type and a company and sometimes even an OS.
+	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+		cpu=m68000
+		vendor=att
+		;;
+	3b*)
+		cpu=we32k
+		vendor=att
+		;;
+	bluegene*)
+		cpu=powerpc
+		vendor=ibm
+		basic_os=cnk
+		;;
+	decsystem10* | dec10*)
+		cpu=pdp10
+		vendor=dec
+		basic_os=tops10
+		;;
+	decsystem20* | dec20*)
+		cpu=pdp10
+		vendor=dec
+		basic_os=tops20
+		;;
+	delta | 3300 | motorola-3300 | motorola-delta \
+	      | 3300-motorola | delta-motorola)
+		cpu=m68k
+		vendor=motorola
+		;;
+	dpx2*)
+		cpu=m68k
+		vendor=bull
+		basic_os=sysv3
+		;;
+	encore | umax | mmax)
+		cpu=ns32k
+		vendor=encore
+		;;
+	elxsi)
+		cpu=elxsi
+		vendor=elxsi
+		basic_os=${basic_os:-bsd}
+		;;
+	fx2800)
+		cpu=i860
+		vendor=alliant
+		;;
+	genix)
+		cpu=ns32k
+		vendor=ns
+		;;
+	h3050r* | hiux*)
+		cpu=hppa1.1
+		vendor=hitachi
+		basic_os=hiuxwe2
+		;;
+	hp3k9[0-9][0-9] | hp9[0-9][0-9])
+		cpu=hppa1.0
+		vendor=hp
+		;;
+	hp9k2[0-9][0-9] | hp9k31[0-9])
+		cpu=m68000
+		vendor=hp
+		;;
+	hp9k3[2-9][0-9])
+		cpu=m68k
+		vendor=hp
+		;;
+	hp9k6[0-9][0-9] | hp6[0-9][0-9])
+		cpu=hppa1.0
+		vendor=hp
+		;;
+	hp9k7[0-79][0-9] | hp7[0-79][0-9])
+		cpu=hppa1.1
+		vendor=hp
+		;;
+	hp9k78[0-9] | hp78[0-9])
+		# FIXME: really hppa2.0-hp
+		cpu=hppa1.1
+		vendor=hp
+		;;
+	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+		# FIXME: really hppa2.0-hp
+		cpu=hppa1.1
+		vendor=hp
+		;;
+	hp9k8[0-9][13679] | hp8[0-9][13679])
+		cpu=hppa1.1
+		vendor=hp
+		;;
+	hp9k8[0-9][0-9] | hp8[0-9][0-9])
+		cpu=hppa1.0
+		vendor=hp
+		;;
+	i*86v32)
+		cpu=$(echo "$1" | sed -e 's/86.*/86/')
+		vendor=pc
+		basic_os=sysv32
+		;;
+	i*86v4*)
+		cpu=$(echo "$1" | sed -e 's/86.*/86/')
+		vendor=pc
+		basic_os=sysv4
+		;;
+	i*86v)
+		cpu=$(echo "$1" | sed -e 's/86.*/86/')
+		vendor=pc
+		basic_os=sysv
+		;;
+	i*86sol2)
+		cpu=$(echo "$1" | sed -e 's/86.*/86/')
+		vendor=pc
+		basic_os=solaris2
+		;;
+	j90 | j90-cray)
+		cpu=j90
+		vendor=cray
+		basic_os=${basic_os:-unicos}
+		;;
+	iris | iris4d)
+		cpu=mips
+		vendor=sgi
+		case $basic_os in
+		    irix*)
+			;;
+		    *)
+			basic_os=irix4
+			;;
+		esac
+		;;
+	miniframe)
+		cpu=m68000
+		vendor=convergent
+		;;
+	*mint | mint[0-9]* | *MiNT | *MiNT[0-9]*)
+		cpu=m68k
+		vendor=atari
+		basic_os=mint
+		;;
+	news-3600 | risc-news)
+		cpu=mips
+		vendor=sony
+		basic_os=newsos
+		;;
+	next | m*-next)
+		cpu=m68k
+		vendor=next
+		case $basic_os in
+		    openstep*)
+		        ;;
+		    nextstep*)
+			;;
+		    ns2*)
+		      basic_os=nextstep2
+			;;
+		    *)
+		      basic_os=nextstep3
+			;;
+		esac
+		;;
+	np1)
+		cpu=np1
+		vendor=gould
+		;;
+	op50n-* | op60c-*)
+		cpu=hppa1.1
+		vendor=oki
+		basic_os=proelf
+		;;
+	pa-hitachi)
+		cpu=hppa1.1
+		vendor=hitachi
+		basic_os=hiuxwe2
+		;;
+	pbd)
+		cpu=sparc
+		vendor=tti
+		;;
+	pbb)
+		cpu=m68k
+		vendor=tti
+		;;
+	pc532)
+		cpu=ns32k
+		vendor=pc532
+		;;
+	pn)
+		cpu=pn
+		vendor=gould
+		;;
+	power)
+		cpu=power
+		vendor=ibm
+		;;
+	ps2)
+		cpu=i386
+		vendor=ibm
+		;;
+	rm[46]00)
+		cpu=mips
+		vendor=siemens
+		;;
+	rtpc | rtpc-*)
+		cpu=romp
+		vendor=ibm
+		;;
+	sde)
+		cpu=mipsisa32
+		vendor=sde
+		basic_os=${basic_os:-elf}
+		;;
+	simso-wrs)
+		cpu=sparclite
+		vendor=wrs
+		basic_os=vxworks
+		;;
+	tower | tower-32)
+		cpu=m68k
+		vendor=ncr
+		;;
+	vpp*|vx|vx-*)
+		cpu=f301
+		vendor=fujitsu
+		;;
+	w65)
+		cpu=w65
+		vendor=wdc
+		;;
+	w89k-*)
+		cpu=hppa1.1
+		vendor=winbond
+		basic_os=proelf
+		;;
+	none)
+		cpu=none
+		vendor=none
+		;;
+	leon|leon[3-9])
+		cpu=sparc
+		vendor=$basic_machine
+		;;
+	leon-*|leon[3-9]-*)
+		cpu=sparc
+		vendor=$(echo "$basic_machine" | sed 's/-.*//')
+		;;
+
+	*-*)
+		# shellcheck disable=SC2162
+		IFS="-" read cpu vendor <&2
+				exit 1
+				;;
+		esac
+		;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $vendor in
+	digital*)
+		vendor=dec
+		;;
+	commodore*)
+		vendor=cbm
+		;;
+	*)
+		;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if test x$basic_os != x
+then
+
+# First recognize some ad-hoc caes, or perhaps split kernel-os, or else just
+# set os.
+case $basic_os in
+	gnu/linux*)
+		kernel=linux
+		os=$(echo $basic_os | sed -e 's|gnu/linux|gnu|')
+		;;
+	os2-emx)
+		kernel=os2
+		os=$(echo $basic_os | sed -e 's|os2-emx|emx|')
+		;;
+	nto-qnx*)
+		kernel=nto
+		os=$(echo $basic_os | sed -e 's|nto-qnx|qnx|')
+		;;
+	*-*)
+		# shellcheck disable=SC2162
+		IFS="-" read kernel os <&2
+		exit 1
+		;;
+esac
+
+# As a final step for OS-related things, validate the OS-kernel combination
+# (given a valid OS), if there is a kernel.
+case $kernel-$os in
+	linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* | linux-musl* | linux-uclibc* )
+		;;
+	uclinux-uclibc* )
+		;;
+	-dietlibc* | -newlib* | -musl* | -uclibc* )
+		# These are just libc implementations, not actual OSes, and thus
+		# require a kernel.
+		echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2
+		exit 1
+		;;
+	kfreebsd*-gnu* | kopensolaris*-gnu*)
+		;;
+	nto-qnx*)
+		;;
+	os2-emx)
+		;;
+	*-eabi* | *-gnueabi*)
+		;;
+	-*)
+		# Blank kernel with real OS is always fine.
+		;;
+	*-*)
+		echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2
+		exit 1
+		;;
+esac
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer.  We pick the logical manufacturer.
+case $vendor in
+	unknown)
+		case $cpu-$os in
+			*-riscix*)
+				vendor=acorn
+				;;
+			*-sunos*)
+				vendor=sun
+				;;
+			*-cnk* | *-aix*)
+				vendor=ibm
+				;;
+			*-beos*)
+				vendor=be
+				;;
+			*-hpux*)
+				vendor=hp
+				;;
+			*-mpeix*)
+				vendor=hp
+				;;
+			*-hiux*)
+				vendor=hitachi
+				;;
+			*-unos*)
+				vendor=crds
+				;;
+			*-dgux*)
+				vendor=dg
+				;;
+			*-luna*)
+				vendor=omron
+				;;
+			*-genix*)
+				vendor=ns
+				;;
+			*-clix*)
+				vendor=intergraph
+				;;
+			*-mvs* | *-opened*)
+				vendor=ibm
+				;;
+			*-os400*)
+				vendor=ibm
+				;;
+			s390-* | s390x-*)
+				vendor=ibm
+				;;
+			*-ptx*)
+				vendor=sequent
+				;;
+			*-tpf*)
+				vendor=ibm
+				;;
+			*-vxsim* | *-vxworks* | *-windiss*)
+				vendor=wrs
+				;;
+			*-aux*)
+				vendor=apple
+				;;
+			*-hms*)
+				vendor=hitachi
+				;;
+			*-mpw* | *-macos*)
+				vendor=apple
+				;;
+			*-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*)
+				vendor=atari
+				;;
+			*-vos*)
+				vendor=stratus
+				;;
+		esac
+		;;
+esac
+
+echo "$cpu-$vendor-${kernel:+$kernel-}$os"
+exit
+
+# Local variables:
+# eval: (add-hook 'before-save-hook 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/src/jri/tools/getsp.class b/src/jri/tools/getsp.class
new file mode 100644
index 0000000..3bc25c8
Binary files /dev/null and b/src/jri/tools/getsp.class differ
diff --git a/jri/tools/getsp.java b/src/jri/tools/getsp.java
similarity index 63%
rename from jri/tools/getsp.java
rename to src/jri/tools/getsp.java
index 76b293d..d261929 100644
--- a/jri/tools/getsp.java
+++ b/src/jri/tools/getsp.java
@@ -25,6 +25,25 @@ public static void main(String[] args) {
 		    i++;
 		}
 		if (r!=null) System.out.println(r);
+	    } else
+	    if (args[0].equals("-minver")) {
+		boolean meets = false;
+		String jv = System.getProperty("java.version");
+		if (jv.startsWith("1."))
+		    jv = jv.substring(2);
+		try {
+		    int i = 0;
+		    while (i < jv.length() && jv.charAt(i) >= '0' && jv.charAt(i) < '9')
+			i++;
+		    jv = jv.substring(0, i);
+		    if (args.length > 1) {
+			int req = Integer.parseInt(args[1]);
+			int cv  = Integer.parseInt(jv);
+			meets = cv >= req;
+		    }
+		} catch (Exception e) {
+		}
+		System.out.println(meets ? "yes" : "no");
 	    } else
 		System.out.println(System.getProperty(args[0]));
 	}
diff --git a/jri/tools/install-sh b/src/jri/tools/install-sh
similarity index 54%
rename from jri/tools/install-sh
rename to src/jri/tools/install-sh
index 377bb86..ec298b5 100755
--- a/jri/tools/install-sh
+++ b/src/jri/tools/install-sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2011-11-20.07; # UTC
+scriptversion=2020-11-14.01; # UTC
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -41,19 +41,15 @@ scriptversion=2011-11-20.07; # UTC
 # This script is compatible with the BSD install script, but was written
 # from scratch.
 
+tab='	'
 nl='
 '
-IFS=" ""	$nl"
+IFS=" $tab$nl"
 
-# set DOITPROG to echo to test this script
+# Set DOITPROG to "echo" to test this script.
 
-# Don't use :- since 4.3BSD and earlier shells don't like it.
 doit=${DOITPROG-}
-if test -z "$doit"; then
-  doit_exec=exec
-else
-  doit_exec=$doit
-fi
+doit_exec=${doit:-exec}
 
 # Put in absolute file names if you don't have them in your path;
 # or use environment vars.
@@ -68,22 +64,16 @@ mvprog=${MVPROG-mv}
 rmprog=${RMPROG-rm}
 stripprog=${STRIPPROG-strip}
 
-posix_glob='?'
-initialize_posix_glob='
-  test "$posix_glob" != "?" || {
-    if (set -f) 2>/dev/null; then
-      posix_glob=
-    else
-      posix_glob=:
-    fi
-  }
-'
-
 posix_mkdir=
 
 # Desired mode of installed file.
 mode=0755
 
+# Create dirs (including intermediate dirs) using mode 755.
+# This is like GNU 'install' as of coreutils 8.32 (2020).
+mkdir_umask=22
+
+backupsuffix=
 chgrpcmd=
 chmodcmd=$chmodprog
 chowncmd=
@@ -97,7 +87,7 @@ dir_arg=
 dst_arg=
 
 copy_on_change=false
-no_target_directory=
+is_target_a_directory=possibly
 
 usage="\
 Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
@@ -114,18 +104,28 @@ Options:
      --version  display version info and exit.
 
   -c            (ignored)
-  -C            install only if different (preserve the last data modification time)
+  -C            install only if different (preserve data modification time)
   -d            create directories instead of installing files.
   -g GROUP      $chgrpprog installed files to GROUP.
   -m MODE       $chmodprog installed files to MODE.
   -o USER       $chownprog installed files to USER.
+  -p            pass -p to $cpprog.
   -s            $stripprog installed files.
+  -S SUFFIX     attempt to back up existing files, with suffix SUFFIX.
   -t DIRECTORY  install into DIRECTORY.
   -T            report an error if DSTFILE is a directory.
 
 Environment variables override the default commands:
   CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
   RMPROG STRIPPROG
+
+By default, rm is invoked with -f; when overridden with RMPROG,
+it's up to you to specify -f if you want it.
+
+If -S is not specified, no backups are attempted.
+
+Email bug reports to bug-automake@gnu.org.
+Automake home page: https://www.gnu.org/software/automake/
 "
 
 while test $# -ne 0; do
@@ -137,46 +137,62 @@ while test $# -ne 0; do
     -d) dir_arg=true;;
 
     -g) chgrpcmd="$chgrpprog $2"
-	shift;;
+        shift;;
 
     --help) echo "$usage"; exit $?;;
 
     -m) mode=$2
-	case $mode in
-	  *' '* | *'	'* | *'
-'*	  | *'*'* | *'?'* | *'['*)
-	    echo "$0: invalid mode: $mode" >&2
-	    exit 1;;
-	esac
-	shift;;
+        case $mode in
+          *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
+            echo "$0: invalid mode: $mode" >&2
+            exit 1;;
+        esac
+        shift;;
 
     -o) chowncmd="$chownprog $2"
-	shift;;
+        shift;;
+
+    -p) cpprog="$cpprog -p";;
 
     -s) stripcmd=$stripprog;;
 
-    -t) dst_arg=$2
-	# Protect names problematic for 'test' and other utilities.
-	case $dst_arg in
-	  -* | [=\(\)!]) dst_arg=./$dst_arg;;
-	esac
-	shift;;
+    -S) backupsuffix="$2"
+        shift;;
 
-    -T) no_target_directory=true;;
+    -t)
+        is_target_a_directory=always
+        dst_arg=$2
+        # Protect names problematic for 'test' and other utilities.
+        case $dst_arg in
+          -* | [=\(\)!]) dst_arg=./$dst_arg;;
+        esac
+        shift;;
+
+    -T) is_target_a_directory=never;;
 
     --version) echo "$0 $scriptversion"; exit $?;;
 
-    --)	shift
-	break;;
+    --) shift
+        break;;
 
-    -*)	echo "$0: invalid option: $1" >&2
-	exit 1;;
+    -*) echo "$0: invalid option: $1" >&2
+        exit 1;;
 
     *)  break;;
   esac
   shift
 done
 
+# We allow the use of options -d and -T together, by making -d
+# take the precedence; this is for compatibility with GNU install.
+
+if test -n "$dir_arg"; then
+  if test -n "$dst_arg"; then
+    echo "$0: target directory not allowed when installing a directory." >&2
+    exit 1
+  fi
+fi
+
 if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
   # When -d is used, all remaining arguments are directories to create.
   # When -t is used, the destination is already specified.
@@ -207,6 +223,15 @@ if test $# -eq 0; then
   exit 0
 fi
 
+if test -z "$dir_arg"; then
+  if test $# -gt 1 || test "$is_target_a_directory" = always; then
+    if test ! -d "$dst_arg"; then
+      echo "$0: $dst_arg: Is not a directory." >&2
+      exit 1
+    fi
+  fi
+fi
+
 if test -z "$dir_arg"; then
   do_exit='(exit $ret); exit $ret'
   trap "ret=129; $do_exit" 1
@@ -223,16 +248,16 @@ if test -z "$dir_arg"; then
 
     *[0-7])
       if test -z "$stripcmd"; then
-	u_plus_rw=
+        u_plus_rw=
       else
-	u_plus_rw='% 200'
+        u_plus_rw='% 200'
       fi
       cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
     *)
       if test -z "$stripcmd"; then
-	u_plus_rw=
+        u_plus_rw=
       else
-	u_plus_rw=,u+rw
+        u_plus_rw=,u+rw
       fi
       cp_umask=$mode$u_plus_rw;;
   esac
@@ -250,6 +275,10 @@ do
     dstdir=$dst
     test -d "$dstdir"
     dstdir_status=$?
+    # Don't chown directories that already exist.
+    if test $dstdir_status = 0; then
+      chowncmd=""
+    fi
   else
 
     # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
@@ -266,178 +295,148 @@ do
     fi
     dst=$dst_arg
 
-    # If destination is a directory, append the input filename; won't work
-    # if double slashes aren't ignored.
+    # If destination is a directory, append the input filename.
     if test -d "$dst"; then
-      if test -n "$no_target_directory"; then
-	echo "$0: $dst_arg: Is a directory" >&2
-	exit 1
+      if test "$is_target_a_directory" = never; then
+        echo "$0: $dst_arg: Is a directory" >&2
+        exit 1
       fi
       dstdir=$dst
-      dst=$dstdir/`basename "$src"`
+      dstbase=`basename "$src"`
+      case $dst in
+	*/) dst=$dst$dstbase;;
+	*)  dst=$dst/$dstbase;;
+      esac
       dstdir_status=0
     else
-      # Prefer dirname, but fall back on a substitute if dirname fails.
-      dstdir=`
-	(dirname "$dst") 2>/dev/null ||
-	expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	     X"$dst" : 'X\(//\)[^/]' \| \
-	     X"$dst" : 'X\(//\)$' \| \
-	     X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
-	echo X"$dst" |
-	    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-		   s//\1/
-		   q
-		 }
-		 /^X\(\/\/\)[^/].*/{
-		   s//\1/
-		   q
-		 }
-		 /^X\(\/\/\)$/{
-		   s//\1/
-		   q
-		 }
-		 /^X\(\/\).*/{
-		   s//\1/
-		   q
-		 }
-		 s/.*/./; q'
-      `
-
+      dstdir=`dirname "$dst"`
       test -d "$dstdir"
       dstdir_status=$?
     fi
   fi
 
+  case $dstdir in
+    */) dstdirslash=$dstdir;;
+    *)  dstdirslash=$dstdir/;;
+  esac
+
   obsolete_mkdir_used=false
 
   if test $dstdir_status != 0; then
     case $posix_mkdir in
       '')
-	# Create intermediate dirs using mode 755 as modified by the umask.
-	# This is like FreeBSD 'install' as of 1997-10-28.
-	umask=`umask`
-	case $stripcmd.$umask in
-	  # Optimize common cases.
-	  *[2367][2367]) mkdir_umask=$umask;;
-	  .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
-
-	  *[0-7])
-	    mkdir_umask=`expr $umask + 22 \
-	      - $umask % 100 % 40 + $umask % 20 \
-	      - $umask % 10 % 4 + $umask % 2
-	    `;;
-	  *) mkdir_umask=$umask,go-w;;
-	esac
-
-	# With -d, create the new directory with the user-specified mode.
-	# Otherwise, rely on $mkdir_umask.
-	if test -n "$dir_arg"; then
-	  mkdir_mode=-m$mode
+        # With -d, create the new directory with the user-specified mode.
+        # Otherwise, rely on $mkdir_umask.
+        if test -n "$dir_arg"; then
+          mkdir_mode=-m$mode
+        else
+          mkdir_mode=
+        fi
+
+        posix_mkdir=false
+	# The $RANDOM variable is not portable (e.g., dash).  Use it
+	# here however when possible just to lower collision chance.
+	tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+
+	trap '
+	  ret=$?
+	  rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null
+	  exit $ret
+	' 0
+
+	# Because "mkdir -p" follows existing symlinks and we likely work
+	# directly in world-writeable /tmp, make sure that the '$tmpdir'
+	# directory is successfully created first before we actually test
+	# 'mkdir -p'.
+	if (umask $mkdir_umask &&
+	    $mkdirprog $mkdir_mode "$tmpdir" &&
+	    exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
+	then
+	  if test -z "$dir_arg" || {
+	       # Check for POSIX incompatibilities with -m.
+	       # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+	       # other-writable bit of parent directory when it shouldn't.
+	       # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+	       test_tmpdir="$tmpdir/a"
+	       ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
+	       case $ls_ld_tmpdir in
+		 d????-?r-*) different_mode=700;;
+		 d????-?--*) different_mode=755;;
+		 *) false;;
+	       esac &&
+	       $mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
+		 ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
+		 test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+	       }
+	     }
+	  then posix_mkdir=:
+	  fi
+	  rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
 	else
-	  mkdir_mode=
+	  # Remove any dirs left behind by ancient mkdir implementations.
+	  rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
 	fi
-
-	posix_mkdir=false
-	case $umask in
-	  *[123567][0-7][0-7])
-	    # POSIX mkdir -p sets u+wx bits regardless of umask, which
-	    # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
-	    ;;
-	  *)
-	    tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
-	    trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
-
-	    if (umask $mkdir_umask &&
-		exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
-	    then
-	      if test -z "$dir_arg" || {
-		   # Check for POSIX incompatibilities with -m.
-		   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
-		   # other-writable bit of parent directory when it shouldn't.
-		   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
-		   ls_ld_tmpdir=`ls -ld "$tmpdir"`
-		   case $ls_ld_tmpdir in
-		     d????-?r-*) different_mode=700;;
-		     d????-?--*) different_mode=755;;
-		     *) false;;
-		   esac &&
-		   $mkdirprog -m$different_mode -p -- "$tmpdir" && {
-		     ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
-		     test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
-		   }
-		 }
-	      then posix_mkdir=:
-	      fi
-	      rmdir "$tmpdir/d" "$tmpdir"
-	    else
-	      # Remove any dirs left behind by ancient mkdir implementations.
-	      rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
-	    fi
-	    trap '' 0;;
-	esac;;
+	trap '' 0;;
     esac
 
     if
       $posix_mkdir && (
-	umask $mkdir_umask &&
-	$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+        umask $mkdir_umask &&
+        $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
       )
     then :
     else
 
-      # The umask is ridiculous, or mkdir does not conform to POSIX,
+      # mkdir does not conform to POSIX,
       # or it failed possibly due to a race condition.  Create the
       # directory the slow way, step by step, checking for races as we go.
 
       case $dstdir in
-	/*) prefix='/';;
-	[-=\(\)!]*) prefix='./';;
-	*)  prefix='';;
+        /*) prefix='/';;
+        [-=\(\)!]*) prefix='./';;
+        *)  prefix='';;
       esac
 
-      eval "$initialize_posix_glob"
-
       oIFS=$IFS
       IFS=/
-      $posix_glob set -f
+      set -f
       set fnord $dstdir
       shift
-      $posix_glob set +f
+      set +f
       IFS=$oIFS
 
       prefixes=
 
       for d
       do
-	test X"$d" = X && continue
-
-	prefix=$prefix$d
-	if test -d "$prefix"; then
-	  prefixes=
-	else
-	  if $posix_mkdir; then
-	    (umask=$mkdir_umask &&
-	     $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
-	    # Don't fail if two instances are running concurrently.
-	    test -d "$prefix" || exit 1
-	  else
-	    case $prefix in
-	      *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
-	      *) qprefix=$prefix;;
-	    esac
-	    prefixes="$prefixes '$qprefix'"
-	  fi
-	fi
-	prefix=$prefix/
+        test X"$d" = X && continue
+
+        prefix=$prefix$d
+        if test -d "$prefix"; then
+          prefixes=
+        else
+          if $posix_mkdir; then
+            (umask $mkdir_umask &&
+             $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+            # Don't fail if two instances are running concurrently.
+            test -d "$prefix" || exit 1
+          else
+            case $prefix in
+              *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+              *) qprefix=$prefix;;
+            esac
+            prefixes="$prefixes '$qprefix'"
+          fi
+        fi
+        prefix=$prefix/
       done
 
       if test -n "$prefixes"; then
-	# Don't fail if two instances are running concurrently.
-	(umask $mkdir_umask &&
-	 eval "\$doit_exec \$mkdirprog $prefixes") ||
-	  test -d "$dstdir" || exit 1
-	obsolete_mkdir_used=true
+        # Don't fail if two instances are running concurrently.
+        (umask $mkdir_umask &&
+         eval "\$doit_exec \$mkdirprog $prefixes") ||
+          test -d "$dstdir" || exit 1
+        obsolete_mkdir_used=true
       fi
     fi
   fi
@@ -450,14 +449,25 @@ do
   else
 
     # Make a couple of temp file names in the proper directory.
-    dsttmp=$dstdir/_inst.$$_
-    rmtmp=$dstdir/_rm.$$_
+    dsttmp=${dstdirslash}_inst.$$_
+    rmtmp=${dstdirslash}_rm.$$_
 
     # Trap to clean up those temp files at exit.
     trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
 
     # Copy the file name to the temp name.
-    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+    (umask $cp_umask &&
+     { test -z "$stripcmd" || {
+	 # Create $dsttmp read-write so that cp doesn't create it read-only,
+	 # which would cause strip to fail.
+	 if test -z "$doit"; then
+	   : >"$dsttmp" # No need to fork-exec 'touch'.
+	 else
+	   $doit touch "$dsttmp"
+	 fi
+       }
+     } &&
+     $doit_exec $cpprog "$src" "$dsttmp") &&
 
     # and set any options; do chmod last to preserve setuid bits.
     #
@@ -472,20 +482,24 @@ do
 
     # If -C, don't bother to copy if it wouldn't change the file.
     if $copy_on_change &&
-       old=`LC_ALL=C ls -dlL "$dst"	2>/dev/null` &&
-       new=`LC_ALL=C ls -dlL "$dsttmp"	2>/dev/null` &&
-
-       eval "$initialize_posix_glob" &&
-       $posix_glob set -f &&
+       old=`LC_ALL=C ls -dlL "$dst"     2>/dev/null` &&
+       new=`LC_ALL=C ls -dlL "$dsttmp"  2>/dev/null` &&
+       set -f &&
        set X $old && old=:$2:$4:$5:$6 &&
        set X $new && new=:$2:$4:$5:$6 &&
-       $posix_glob set +f &&
-
+       set +f &&
        test "$old" = "$new" &&
        $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
     then
       rm -f "$dsttmp"
     else
+      # If $backupsuffix is set, and the file being installed
+      # already exists, attempt a backup.  Don't worry if it fails,
+      # e.g., if mv doesn't support -f.
+      if test -n "$backupsuffix" && test -f "$dst"; then
+        $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null
+      fi
+
       # Rename the file to the real destination.
       $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
 
@@ -493,24 +507,24 @@ do
       # to itself, or perhaps because mv is so ancient that it does not
       # support -f.
       {
-	# Now remove or move aside any old file at destination location.
-	# We try this two ways since rm can't unlink itself on some
-	# systems and the destination file might be busy for other
-	# reasons.  In this case, the final cleanup might fail but the new
-	# file should still install successfully.
-	{
-	  test ! -f "$dst" ||
-	  $doit $rmcmd -f "$dst" 2>/dev/null ||
-	  { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
-	    { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
-	  } ||
-	  { echo "$0: cannot unlink or rename $dst" >&2
-	    (exit 1); exit 1
-	  }
-	} &&
-
-	# Now rename the file to the real destination.
-	$doit $mvcmd "$dsttmp" "$dst"
+        # Now remove or move aside any old file at destination location.
+        # We try this two ways since rm can't unlink itself on some
+        # systems and the destination file might be busy for other
+        # reasons.  In this case, the final cleanup might fail but the new
+        # file should still install successfully.
+        {
+          test ! -f "$dst" ||
+          $doit $rmcmd "$dst" 2>/dev/null ||
+          { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+            { $doit $rmcmd "$rmtmp" 2>/dev/null; :; }
+          } ||
+          { echo "$0: cannot unlink or rename $dst" >&2
+            (exit 1); exit 1
+          }
+        } &&
+
+        # Now rename the file to the real destination.
+        $doit $mvcmd "$dsttmp" "$dst"
       }
     fi || exit 1
 
@@ -519,9 +533,9 @@ do
 done
 
 # Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
+# time-stamp-time-zone: "UTC0"
 # time-stamp-end: "; # UTC"
 # End:
diff --git a/src/jri/tools/mkinstalldirs b/src/jri/tools/mkinstalldirs
new file mode 100755
index 0000000..c364f3d
--- /dev/null
+++ b/src/jri/tools/mkinstalldirs
@@ -0,0 +1,162 @@
+#! /bin/sh
+# mkinstalldirs --- make directory hierarchy
+
+scriptversion=2020-07-26.22; # UTC
+
+# Original author: Noah Friedman 
+# Created: 1993-05-16
+# Public domain.
+#
+# This file is maintained in Automake, please report
+# bugs to  or send patches to
+# .
+
+nl='
+'
+IFS=" ""	$nl"
+errstatus=0
+dirmode=
+
+usage="\
+Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
+
+Create each directory DIR (with mode MODE, if specified), including all
+leading file name components.
+
+Report bugs to ."
+
+# process command line arguments
+while test $# -gt 0 ; do
+  case $1 in
+    -h | --help | --h*)         # -h for help
+      echo "$usage"
+      exit $?
+      ;;
+    -m)                         # -m PERM arg
+      shift
+      test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
+      dirmode=$1
+      shift
+      ;;
+    --version)
+      echo "$0 $scriptversion"
+      exit $?
+      ;;
+    --)                         # stop option processing
+      shift
+      break
+      ;;
+    -*)                         # unknown option
+      echo "$usage" 1>&2
+      exit 1
+      ;;
+    *)                          # first non-opt arg
+      break
+      ;;
+  esac
+done
+
+for file
+do
+  if test -d "$file"; then
+    shift
+  else
+    break
+  fi
+done
+
+case $# in
+  0) exit 0 ;;
+esac
+
+# Solaris 8's mkdir -p isn't thread-safe.  If you mkdir -p a/b and
+# mkdir -p a/c at the same time, both will detect that a is missing,
+# one will create a, then the other will try to create a and die with
+# a "File exists" error.  This is a problem when calling mkinstalldirs
+# from a parallel make.  We use --version in the probe to restrict
+# ourselves to GNU mkdir, which is thread-safe.
+case $dirmode in
+  '')
+    if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+      echo "mkdir -p -- $*"
+      exec mkdir -p -- "$@"
+    else
+      # On NextStep and OpenStep, the 'mkdir' command does not
+      # recognize any option.  It will interpret all options as
+      # directories to create, and then abort because '.' already
+      # exists.
+      test -d ./-p && rmdir ./-p
+      test -d ./--version && rmdir ./--version
+    fi
+    ;;
+  *)
+    if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 &&
+       test ! -d ./--version; then
+      echo "umask 22"
+      umask 22
+      echo "mkdir -m $dirmode -p -- $*"
+      exec mkdir -m "$dirmode" -p -- "$@"
+    else
+      # Clean up after NextStep and OpenStep mkdir.
+      for d in ./-m ./-p ./--version "./$dirmode";
+      do
+        test -d $d && rmdir $d
+      done
+    fi
+    ;;
+esac
+
+echo "umask 22"
+umask 22
+
+for file
+do
+  case $file in
+    /*) pathcomp=/ ;;
+    *)  pathcomp= ;;
+  esac
+  oIFS=$IFS
+  IFS=/
+  set fnord $file
+  shift
+  IFS=$oIFS
+
+  for d
+  do
+    test "x$d" = x && continue
+
+    pathcomp=$pathcomp$d
+    case $pathcomp in
+      -*) pathcomp=./$pathcomp ;;
+    esac
+
+    if test ! -d "$pathcomp"; then
+      echo "mkdir $pathcomp"
+
+      mkdir "$pathcomp" || lasterr=$?
+
+      if test ! -d "$pathcomp"; then
+	errstatus=$lasterr
+      fi
+    fi
+
+    pathcomp=$pathcomp/
+  done
+
+  if test ! -z "$dirmode"; then
+    echo "chmod $dirmode $file"
+    chmod "$dirmode" "$file" || errstatus=$?
+  fi
+done
+
+exit $errstatus
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'before-save-hook 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC0"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/jri/version b/src/jri/version
similarity index 100%
rename from jri/version
rename to src/jri/version
diff --git a/src/jri_glue.c b/src/jri_glue.c
index c3e74d4..4228ca0 100644
--- a/src/jri_glue.c
+++ b/src/jri_glue.c
@@ -2,7 +2,7 @@
 #include 
 #include "rJava.h"
 
-/* creates a reference to an R object on the Java side 
+/* creates a reference to an R object on the Java side
    1) lock down the object in R
    2) call new Rengine(eng,robj) {or any other class such as REXPReference for REngine API}
  */
@@ -13,7 +13,7 @@ REPC SEXP PushToREXP(SEXP clname, SEXP eng, SEXP engCl, SEXP robj, SEXP doConv)
   int convert = (doConv == R_NilValue) ? -1 : asInteger(doConv);
   JNIEnv *env=getJNIEnv();
   const char *cName;
-  
+
   if (!isString(clname) || LENGTH(clname)!=1) error("invalid class name");
   if (!isString(engCl) || LENGTH(engCl)!=1) error("invalid engine class name");
   if (TYPEOF(eng)!=EXTPTRSXP) error("invalid engine object");
@@ -21,7 +21,7 @@ REPC SEXP PushToREXP(SEXP clname, SEXP eng, SEXP engCl, SEXP robj, SEXP doConv)
   sig[127]=0;
   cName = CHAR(STRING_ELT(clname,0));
   jpar[0].l = (jobject)EXTPTR_PTR(eng);
-  jpar[1].j = (jlong) robj;
+  jpar[1].j = (jlong) (size_t) robj;
   if (convert == -1)
     snprintf(sig,127,"(L%s;J)V",CHAR(STRING_ELT(engCl,0)));
   else {
@@ -31,7 +31,7 @@ REPC SEXP PushToREXP(SEXP clname, SEXP eng, SEXP engCl, SEXP robj, SEXP doConv)
   o = createObject(env, cName, sig, jpar, 1, 0);
   if (!o) error("Unable to create Java object");
   return j2SEXP(env, o, 1);
-  /* ok, some thoughts on mem mgmt - j2SEXP registers a finalizer. But I believe that is ok, because the pushed reference is useless until it is passed as an argument to some Java method. And then, it will have another reference which will prevent the Java side from being collected. The R-side reference may be gone, but that's ok, because it's the Java finalizer that needs to clean up the pushed R object and for that it doesn't need the proxy object at all. This is the reason why RReleaseREXP uses EXTPTR - all the Java finalizaer has to do is to call RReleaseREXP(self). For that it can create a fresh proxy object containing the REXP. But here comes he crux - this proxy cannot again create a reference - it must be plain pass-through, so this part needs to be verified.
+  /* ok, some thoughts on mem mgmt - j2SEXP registers a finalizer. But I believe that is ok, because the pushed reference is useless until it is passed as an argument to some Java method. And then, it will have another reference which will prevent the Java side from being collected. The R-side reference may be gone, but that's ok, because it's the Java finalizer that needs to clean up the pushed R object and for that it doesn't need the proxy object at all. This is the reason why RReleaseREXP uses EXTPTR - all the Java finalizer has to do is to call RReleaseREXP(self). For that it can create a fresh proxy object containing the REXP. But here comes he crux - this proxy cannot again create a reference - it must be plain pass-through, so this part needs to be verified.
 
 Note: as of REngine API the references assume protected objects and use rniRelease to clean up, so RReleaseREXP won't be called and is not needed. That is good, because RReleaseREXP assumes JRI objects whereas REngine will create REXPReference (no xp there). However, if we ever change that REXPReference assumption we will be in trouble.
  */
@@ -56,5 +56,3 @@ REPC SEXP RReleaseREXP(SEXP ptr) {
   }
   return R_NilValue;
 }
-
-    
diff --git a/src/jvm-w32/findjava.c b/src/jvm-w32/findjava.c
index 8335411..d64c306 100644
--- a/src/jvm-w32/findjava.c
+++ b/src/jvm-w32/findjava.c
@@ -11,6 +11,21 @@ int main(int argc, char **argv) {
   HKEY root=HKEY_LOCAL_MACHINE;
   char *javakey="Software\\JavaSoft\\Java Runtime Environment";
 
+  if (argc>1 && argv[1][0]=='-' && argv[1][1]=='R') {
+    if (getenv("R_HOME")) {
+      strcpy(RegStrBuf,getenv("R_HOME"));
+    } else {
+      javakey="Software\\R-core\\R"; s=32767;
+      if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,javakey,0,KEY_QUERY_VALUE,&k)!=ERROR_SUCCESS ||
+	  RegQueryValueEx(k,"InstallPath",0,&t,RegStrBuf,&s)!=ERROR_SUCCESS) {
+	if (RegOpenKeyEx(HKEY_CURRENT_USER,javakey,0,KEY_QUERY_VALUE,&k)!=ERROR_SUCCESS ||
+	    RegQueryValueEx(k,"InstallPath",0,&t,RegStrBuf,&s)!=ERROR_SUCCESS) {
+	  fprintf(stderr, "ERROR*> R - can't open registry keys.\n");
+	  return -1;
+	}
+      }
+    }
+  } else
   /* JAVA_HOME can override our detection - but we still post-process it */
   if (getenv("JAVA_HOME")) {
     strcpy(RegStrBuf,getenv("JAVA_HOME"));
@@ -19,15 +34,23 @@ int main(int argc, char **argv) {
 #ifdef FINDJRE
     if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,javakey,0,KEY_QUERY_VALUE,&k)!=ERROR_SUCCESS ||
 	RegQueryValueEx(k,"CurrentVersion",0,&t,RegStrBuf,&s)!=ERROR_SUCCESS) {
+	javakey="Software\\JavaSoft\\JRE"; s=32767;
+	if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,javakey,0,KEY_QUERY_VALUE,&k)!=ERROR_SUCCESS ||
+	    RegQueryValueEx(k,"CurrentVersion",0,&t,RegStrBuf,&s)!=ERROR_SUCCESS) {
 #endif
-      javakey="Software\\JavaSoft\\Java Development Kit"; s=32767;
-      if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,javakey,0,KEY_QUERY_VALUE,&k)!=ERROR_SUCCESS ||
-	  RegQueryValueEx(k,"CurrentVersion",0,&t,RegStrBuf,&s)!=ERROR_SUCCESS) {
-	fprintf(stderr, "ERROR*> JavaSoft\\{JRE|JDK} can't open registry keys.\n");
-	/* MessageBox(wh, "Can't find Sun's Java runtime.\nPlease install Sun's J2SE JRE or JDK 1.4.2 or later (see http://java.sun.com/).","Can't find Sun's Java",MB_OK|MB_ICONERROR); */
-	return -1;
-      }
+	    javakey="Software\\JavaSoft\\Java Development Kit"; s=32767;
+	    if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,javakey,0,KEY_QUERY_VALUE,&k)!=ERROR_SUCCESS ||
+		RegQueryValueEx(k,"CurrentVersion",0,&t,RegStrBuf,&s)!=ERROR_SUCCESS) {
+		javakey="Software\\JavaSoft\\JDK"; s=32767;
+		if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,javakey,0,KEY_QUERY_VALUE,&k)!=ERROR_SUCCESS ||
+		    RegQueryValueEx(k,"CurrentVersion",0,&t,RegStrBuf,&s)!=ERROR_SUCCESS) {
+		    fprintf(stderr, "ERROR*> JavaSoft\\{JRE|JDK} can't open registry keys.\n");
+		    /* MessageBox(wh, "Can't find Sun's Java runtime.\nPlease install Sun's J2SE JRE or JDK 1.4.2 or later (see http://java.sun.com/).","Can't find Sun's Java",MB_OK|MB_ICONERROR); */
+		    return -1;
+		}
+	    }
 #ifdef FINDJRE
+	}
     }
 #endif
     RegCloseKey(k); s=32767;
diff --git a/src/loader.c b/src/loader.c
index f1c08eb..6c00839 100644
--- a/src/loader.c
+++ b/src/loader.c
@@ -31,7 +31,7 @@ REPC SEXP RJava_set_class_loader(SEXP ldr) {
   return R_NilValue;
 }
 
-REPC SEXP RJava_primary_class_loader() {
+REPC SEXP RJava_primary_class_loader(void) {
   JNIEnv *env=getJNIEnv();
   jclass cl = (*env)->FindClass(env, "RJavaClassLoader");
   _dbg(Rprintf("RJava_primary_class_loader, cl = %x\n", (int) cl));
diff --git a/src/otables.c b/src/otables.c
index 216db95..531aa79 100644
--- a/src/otables.c
+++ b/src/otables.c
@@ -8,45 +8,45 @@
 /**
  * Returns the R_UnboundValue
  */
-HIDE SEXP R_getUnboundValue() {
+HIDE SEXP R_getUnboundValue(void) {
     return(R_UnboundValue);
 }
 
 /**
  * @param name name of a java class
  * @param canCache Can R cache this object
- * @param tb 
+ * @param tb
  * @return TRUE if the a class called name exists in on of the packages
  */
 /* not actually used by R */
 HIDE Rboolean rJavaLookupTable_exists(const char * const name, Rboolean *canCache, R_ObjectTable *tb){
 
 #ifdef LOOKUP_DEBUG
- Rprintf( "  >> rJavaLookupTable_exists\n" ); 
+ Rprintf( "  >> rJavaLookupTable_exists\n" );
 #endif
-	
+
  if(tb->active == FALSE)
     return(FALSE);
 
  tb->active = FALSE;
  Rboolean val = classNameLookupExists( tb, name );
  tb->active = TRUE;
- 
+
  return( val );
 }
 
 /**
- * Returns a new jclassName object if the class exists or the 
+ * Returns a new jclassName object if the class exists or the
  * unbound value if it does not
  *
  * @param name class name
- * @param canCache ?? 
+ * @param canCache ??
  * @param tb lookup table
  */
 SEXP rJavaLookupTable_get(const char * const name, Rboolean *canCache, R_ObjectTable *tb){
 
 #ifdef LOOKUP_DEBUG
- Rprintf( "  >> rJavaLookupTable_get\n" ); 
+ Rprintf( "  >> rJavaLookupTable_get\n" );
 #endif
 
  SEXP val;
@@ -57,7 +57,7 @@ SEXP rJavaLookupTable_get(const char * const name, Rboolean *canCache, R_ObjectT
  val = PROTECT( classNameLookup( tb, name ) );
  tb->active = TRUE;
 
- UNPROTECT(1); /* val */ 
+ UNPROTECT(1); /* val */
  return(val);
 }
 
@@ -66,23 +66,23 @@ SEXP rJavaLookupTable_get(const char * const name, Rboolean *canCache, R_ObjectT
  */
 int rJavaLookupTable_remove(const char * const name,  R_ObjectTable *tb){
 #ifdef LOOKUP_DEBUG
- Rprintf( "  >> rJavaLookupTable_remove( %s) \n", name ); 
+ Rprintf( "  >> rJavaLookupTable_remove( %s) \n", name );
 #endif
 	error( "cannot remove from java package" ) ;
 	return 0;
 }
 
 /**
- * Indicates if R can cahe the variable name. 
- * Currently allways return FALSE
+ * Indicates if R can cache the variable name.
+ * Currently always return FALSE
  *
  * @param name name of the class
  * @param tb lookup table
- * @return allways FALSE (for now)
- */ 
+ * @return always FALSE (for now)
+ */
 HIDE Rboolean rJavaLookupTable_canCache(const char * const name, R_ObjectTable *tb){
 #ifdef LOOKUP_DEBUG
- Rprintf( "  >> rJavaLookupTable_canCache\n" ); 
+ Rprintf( "  >> rJavaLookupTable_canCache\n" );
 #endif
 	return( FALSE );
 }
@@ -92,34 +92,34 @@ HIDE Rboolean rJavaLookupTable_canCache(const char * const name, R_ObjectTable *
  */
 HIDE SEXP rJavaLookupTable_assign(const char * const name, SEXP value, R_ObjectTable *tb){
 #ifdef LOOKUP_DEBUG
- Rprintf( "  >> rJavaLookupTable_assign( %s ) \n", name ); 
+ Rprintf( "  >> rJavaLookupTable_assign( %s ) \n", name );
 #endif
     error("can't assign to java package lookup");
     return R_NilValue;
 }
 
 /**
- * Returns the list of classes known to be included in the 
+ * Returns the list of classes known to be included in the
  * packages. Currently returns NULL
  *
  * @param tb lookup table
- */ 
+ */
 HIDE SEXP rJavaLookupTable_objects(R_ObjectTable *tb) {
 #ifdef LOOKUP_DEBUG
- Rprintf( "  >> rJavaLookupTable_objects\n" ); 
+ Rprintf( "  >> rJavaLookupTable_objects\n" );
 #endif
-	
+
 	tb->active = FALSE;
-	SEXP res = PROTECT( getKnownClasses( tb ) ) ; 
+	SEXP res = PROTECT( getKnownClasses( tb ) ) ;
 	tb->active = TRUE;
 	UNPROTECT(1); /* res */
-	return( res ); 
+	return( res );
 }
 
 
 REPC SEXP newRJavaLookupTable(SEXP importer){
 #ifdef LOOKUP_DEBUG
- Rprintf( "\n" ); 
+ Rprintf( "\n" );
 #endif
 
  R_ObjectTable *tb;
@@ -128,12 +128,12 @@ REPC SEXP newRJavaLookupTable(SEXP importer){
   tb = (R_ObjectTable *) malloc(sizeof(R_ObjectTable));
   if(!tb)
       error( "cannot allocate space for an internal R object table" );
-  
+
   tb->type = RJAVA_LOOKUP ; /* FIXME: not sure what this should be */
   tb->cachedNames = NULL;
-  
-  R_PreserveObject(importer); 
-  tb->privateData = importer; 
+
+  R_PreserveObject(importer);
+  tb->privateData = importer;
 
   tb->exists = rJavaLookupTable_exists;
   tb->get = rJavaLookupTable_get;
@@ -152,7 +152,7 @@ REPC SEXP newRJavaLookupTable(SEXP importer){
   UNPROTECT(2);
 
 #ifdef LOOKUP_DEBUG
- Rprintf( "\n" ); 
+ Rprintf( "\n" );
 #endif
   return(val);
 }
@@ -160,38 +160,38 @@ REPC SEXP newRJavaLookupTable(SEXP importer){
 
 HIDE jobject getImporterReference(R_ObjectTable *tb ){
 	jobject res = (jobject)EXTPTR_PTR( GET_SLOT( (SEXP)(tb->privateData), install( "jobj" ) ) );
-	
+
 #ifdef LOOKUP_DEBUG
-	Rprintf( "  >> getImporterReference : [%d]\n", res ); 
+	Rprintf( "  >> getImporterReference : [%d]\n", res );
 #endif
 	return res ;
 }
 
 HIDE SEXP getKnownClasses( R_ObjectTable *tb ){
 #ifdef LOOKUP_DEBUG
- Rprintf( "  >> getKnownClasses\n" ); 
+ Rprintf( "  >> getKnownClasses\n" );
 #endif
-	jobject importer = getImporterReference(tb); 
-	
+	jobject importer = getImporterReference(tb);
+
 	JNIEnv *env=getJNIEnv();
 	jarray a = (jarray) (*env)->CallObjectMethod(env, importer, mid_RJavaImport_getKnownClasses ) ;
 	SEXP res = PROTECT( getStringArrayCont( a ) ) ;
-	
+
 #ifdef LOOKUP_DEBUG
- Rprintf( "    %d known classes\n", LENGTH(res) ); 
+ Rprintf( "    %d known classes\n", LENGTH(res) );
 #endif
-	
-	UNPROTECT(1); 
+
+	UNPROTECT(1);
 	return res ;
 }
 
 HIDE SEXP classNameLookup( R_ObjectTable *tb, const char * const name ){
 #ifdef LOOKUP_DEBUG
- Rprintf( " >> classNameLookup\n" ); 
+ Rprintf( " >> classNameLookup\n" );
 #endif
 	JNIEnv *env=getJNIEnv();
-	
-	jobject importer = getImporterReference(tb); 
+
+	jobject importer = getImporterReference(tb);
 
 	jobject clazz = newString(env, name ) ;
 	jstring s ; /* Class */
@@ -200,42 +200,41 @@ HIDE SEXP classNameLookup( R_ObjectTable *tb, const char * const name ){
 	int np ;
 	if( !s ){
 		res = R_getUnboundValue() ;
-		np = 0; 
+		np = 0;
 	} else{
 		PROTECT( res = new_jclassName( env, s ) );
-		np = 1; 
+		np = 1;
 	}
 
 	releaseObject(env, clazz);
 	releaseObject(env, s);
-    
-	if( np ) UNPROTECT(1); 
+
+	if( np ) UNPROTECT(1);
 #ifdef LOOKUP_DEBUG
- Rprintf( "\n" ); 
+ Rprintf( "\n" );
 #endif
-	return res ; 
+	return res ;
 }
 
 HIDE Rboolean classNameLookupExists(R_ObjectTable *tb, const char * const name ){
 #ifdef LOOKUP_DEBUG
- Rprintf( " classNameLookupExists\n" ); 
+ Rprintf( " classNameLookupExists\n" );
 #endif
-	
+
 	JNIEnv *env=getJNIEnv();
-	
-	jobject importer = getImporterReference(tb); 
+
+	jobject importer = getImporterReference(tb);
 	jobject clazz = newString(env, name ) ;
-	
+
 	jboolean s ; /* Class */
-	s = (jboolean) (*env)->CallBooleanMethod(env, importer, 
+	s = (jboolean) (*env)->CallBooleanMethod(env, importer,
 		mid_RJavaImport_exists , clazz ) ;
-	Rboolean res = (s) ? TRUE : FALSE; 
+	Rboolean res = (s) ? TRUE : FALSE;
 
 #ifdef LOOKUP_DEBUG
- Rprintf( "    exists( %s ) = %d \n", name, res ); 
+ Rprintf( "    exists( %s ) = %d \n", name, res );
 #endif
-	
+
 	releaseObject(env, clazz);
     return res ;
 }
-
diff --git a/src/rJava.c b/src/rJava.c
index 9843a21..33bd33d 100644
--- a/src/rJava.c
+++ b/src/rJava.c
@@ -5,84 +5,30 @@
 #include 
 #include 
 
-/* determine whether eenv chache should be used (has no effect if JNI_CACHE is not set) */
+/* determine whether eenv cache should be used (has no effect if JNI_CACHE is not set) */
 int use_eenv = 1;
 
 /* cached environment. Do NOT use directly! Always use getJNIEnv()! */
 JNIEnv *eenv;
 
-/* -- hack to get at the current call from C code using contexts */
-#if ( R_VERSION >= R_Version(1, 7, 0) )
-#include 
-
-/* stuff we need to pull for Windows... */
-#ifdef WIN32
-/* this is from gnuwin32/fixed/h/psignal.h */
-#ifndef _SIGSET_T_
-#define _SIGSET_T_
-typedef int sigset_t;
-#endif  /* Not _SIGSET_T_ */
-typedef struct
-{    
-  jmp_buf jmpbuf;     /* Calling environment.  */  
-  int mask_was_saved;       /* Saved the signal mask?  */                   
-  sigset_t saved_mask;      /* Saved signal mask.  */                       
-} sigjmp_buf[1];
-/* we need to set HAVE_POSIX_SETJMP since we don't have config.h on Win */
-#ifndef HAVE_POSIX_SETJMP
-#define HAVE_POSIX_SETJMP
-#endif
-#endif
-
-#ifdef HAVE_POSIX_SETJMP
-#define JMP_BUF sigjmp_buf
-#else
-#define JMP_BUF jmp_buf
-#endif
-
-#ifndef CTXT_BUILTIN
-#define CTXT_BUILTIN 64
-#endif
-
-typedef struct RCNTXT { /* this RCNTXT structure is only partial since we need to get at "call" - it is safe form R 1.7.0 on */
-	struct RCNTXT *nextcontext; /* The next context up the chain <<-- we use this one to skip the .Call/.External call frame */
-	int callflag;               /* The context "type" <<<-- we use this one to skip the .Call/.External call frame */
-	JMP_BUF cjmpbuf;            /* C stack and register information */
-	int cstacktop;              /* Top of the pointer protection stack */
-	int evaldepth;              /* evaluation depth at inception */
-	SEXP promargs;              /* Promises supplied to closure */
-	SEXP callfun;               /* The closure called */
-	SEXP sysparent;             /* environment the closure was called from */
-	SEXP call;                  /* The call that effected this context <<<--- we pass this one to the condition */
-	SEXP cloenv;                /* The environment */
-} RCNTXT;
-
-#ifndef LibExtern
-#define LibExtern extern
-#endif
-
-LibExtern RCNTXT* R_GlobalContext;
-
-static SEXP getCurrentCall() {
-	RCNTXT *ctx = R_GlobalContext;
-	/* skip the .External/.Call context to get at the underlying call */
-	if (ctx->nextcontext && (ctx->callflag & CTXT_BUILTIN))
-		ctx = ctx->nextcontext;
-	/* skip .jcheck */
-	if (TYPEOF(ctx->call) == LANGSXP && CAR(ctx->call) == install(".jcheck") && ctx->nextcontext)
-		ctx = ctx->nextcontext;		
-	return ctx->call;
-}
-#else
-static SEXP getCurrentCall() {
-	return R_NilValue;
+static SEXP getCurrentCall(void) {
+    SEXP cexp, sys_calls = PROTECT(install("sys.calls"));
+    cexp = PROTECT(lang1(sys_calls));
+    SEXP cl = eval(cexp, R_GetCurrentEnv());
+    UNPROTECT(2);
+    /* find the last call */
+    if (TYPEOF(cl) != LISTSXP) return R_NilValue;
+    while (cl != R_NilValue) {
+	if (CDR(cl) == R_NilValue && CAR(cl) != R_NilValue)
+	    return CAR(cl);
+	cl = CDR(cl);
+    }
+    return R_NilValue; /* (LENGTH(cl) > 0) ? VECTOR_ELT(cl, 0) : R_NilValue; */
 }
-#endif
-/* -- end of hack */
 
 /** throw an exception using R condition code.
  *  @param msg - message string
- *  @param jobj - jobjRef object of the exception 
+ *  @param jobj - jobjRef object of the exception
  *  @param clazzes - simple name of all the classes in the inheritance tree of the exception plus "error" and "condition"
  */
 HIDE void throwR(SEXP msg, SEXP jobj, SEXP clazzes) {
@@ -94,17 +40,17 @@ HIDE void throwR(SEXP msg, SEXP jobj, SEXP clazzes) {
 	SET_STRING_ELT(names, 0, mkChar("message"));
 	SET_STRING_ELT(names, 1, mkChar("call"));
 	SET_STRING_ELT(names, 2, mkChar("jobj"));
-	
+
 	setAttrib(cond, R_NamesSymbol, names);
 	setAttrib(cond, R_ClassSymbol, clazzes);
-	UNPROTECT(2); /* clazzes, names */
-	eval(LCONS(install("stop"), CONS(cond, R_NilValue)), R_GlobalEnv);
-	UNPROTECT(1); /* cond */
+	UNPROTECT(1); /* names */
+	eval(PROTECT(LCONS(install("stop"), PROTECT(CONS(cond, R_NilValue)))), R_GlobalEnv);
+	UNPROTECT(3); /* cond + eval-pars */
 }
 
 /* check for exceptions and throw them to R level */
 HIDE void ckx(JNIEnv *env) {
-	SEXP xr, xobj, msg = 0, xclass = 0; /* note: we don't bother counting protections becasue we never return */
+	SEXP xr, xobj, msg = 0, xclass = 0; /* note: we don't bother counting protections because we never return */
 	jthrowable x = 0;
 	if (env && !(x = (*env)->ExceptionOccurred(env))) return;
 	if (!env) {
@@ -115,14 +61,18 @@ HIDE void ckx(JNIEnv *env) {
 		return;
 	}
 	/* env is valid and an exception occurred */
-	/* we create the jobj first, because the exception may in theory disappear after being cleared, 
+	/* we create the jobj first, because the exception may in theory disappear after being cleared,
 	   yet this can be (also in theory) risky as it uses further JNI calls ... */
-	xobj = j2SEXP(env, x, 0);
+	xobj = PROTECT(j2SEXP(env, x, 0));
+	if (!rj_RJavaTools_Class) {
+	    REprintf("ERROR: Java exception occurred during rJava bootstrap - see stderr for Java stack trace.\n");
+	    (*env)->ExceptionDescribe(env);
+	}
 	(*env)->ExceptionClear(env);
-	
+
 	/* grab the list of class names (without package path) */
-	SEXP clazzes = PROTECT( getSimpleClassNames_asSEXP( (jobject)x, (jboolean)1 ) ) ;
-	
+	SEXP clazzes = PROTECT( rj_RJavaTools_Class ? getSimpleClassNames_asSEXP( (jobject)x, (jboolean)1 ) : R_NilValue );
+
 	/* ok, now this is a critical part that we do manually to avoid recursion */
 	{
 		jclass cls = (*env)->GetObjectClass(env, x);
@@ -143,14 +93,14 @@ HIDE void ckx(JNIEnv *env) {
 			cname = (jstring) (*env)->CallObjectMethod(env, cls, mid_getName);
 			if (cname) {
 				const char *c = (*env)->GetStringUTFChars(env, cname, 0);
-				if (c) {                          
+				if (c) {
 					/* convert full class name to JNI notation */
 					char *cn = strdup(c), *d = cn;
 					while (*d) { if (*d == '.') *d = '/'; d++; }
-					xclass = mkString(cn);
+					xclass = PROTECT(mkString(cn));
 					free(cn);
 					(*env)->ReleaseStringUTFChars(env, cname, c);
-				}		
+				}
 				(*env)->DeleteLocalRef(env, cname);
 			}
 			if ((*env)->ExceptionOccurred(env))
@@ -164,15 +114,20 @@ HIDE void ckx(JNIEnv *env) {
 	(*env)->DeleteLocalRef(env, x);
 
 	/* construct the jobjRef */
-	xr = PROTECT(NEW_OBJECT(MAKE_CLASS("jobjRef")));
+	xr = PROTECT(NEW_OBJECT(PROTECT(MAKE_CLASS("jobjRef"))));
+	if (!xclass) xclass = PROTECT(mkString("java/lang/Throwable"));
 	if (inherits(xr, "jobjRef")) {
-		SET_SLOT(xr, install("jclass"), xclass ? xclass : mkString("java/lang/Throwable"));
+		SET_SLOT(xr, install("jclass"), xclass);
 		SET_SLOT(xr, install("jobj"), xobj);
 	}
-	
+
 	/* and off to R .. (we're keeping xr and clazzes protected) */
 	throwR(msg, xr, clazzes);
-	/* throwR never returns so don't even bother ... */
+	/* should not return, but just in case ... */
+
+	/* protect stack: xobj, clz, msg, xcl, xr + mk_class */
+	/* (it may confuse the UP checker since the order does vary by path, but the count is the same) */
+	UNPROTECT(6);
 }
 
 /* clear any pending exceptions */
@@ -182,14 +137,14 @@ HIDE void clx(JNIEnv *env) {
 }
 
 #ifdef JNI_CACHE
-HIDE JNIEnv *getJNIEnvSafe();
-HIDE JNIEnv *getJNIEnv() {
+HIDE JNIEnv *getJNIEnvSafe(void);
+HIDE JNIEnv *getJNIEnv(void) {
   return (use_eenv)?eenv:getJNIEnvSafe();
 }
 
-HIDE JNIEnv *getJNIEnvSafe()
+HIDE JNIEnv *getJNIEnvSafe(void)
 #else
-HIDE JNIEnv *getJNIEnv()
+HIDE JNIEnv *getJNIEnv(void)
 #endif
   {
     JNIEnv *env;
@@ -211,9 +166,7 @@ HIDE JNIEnv *getJNIEnv()
       error("AttachCurrentThread failed! (result:%d)", (int)res); return 0;
     }
     if (env && !eenv) eenv=env;
-    
-    /* if (eenv!=env)
-        fprintf(stderr, "Warning! eenv=%x, but env=%x - different environments encountered!\n", eenv, env); */
+
     return env;
 }
 
diff --git a/src/rJava.h b/src/rJava.h
index 1c8d7c4..40f846f 100644
--- a/src/rJava.h
+++ b/src/rJava.h
@@ -1,12 +1,12 @@
 #ifndef __RJAVA_H__
 #define __RJAVA_H__
 
-#define RJAVA_VER 0x000909 /* rJava v0.9-9 */
+#define RJAVA_VER 0x010012 /* rJava v1.0-18 */
 
 /* important changes between versions:
    3.0  - adds compiler
    2.0
-   1.0
+   1.0  - custom package class loaders
    0.9  - rectangular arrays, flattening, import
           (really introduced in later 0.8 versions but they broke
 	   the API compatibility so 0.9 attempts to fix that)
@@ -25,7 +25,29 @@
 #include 
 
 #include 
+#include 
+#if (R_VERSION >= R_Version(4,6,0))
+#include 
+#else
 #include 
+#endif
+
+/* R API compatibility re-mapping */
+#if (R_VERSION >= R_Version(2,0,0))
+/* EXTPTR */
+#ifdef  EXTPTR_PTR
+#undef  EXTPTR_PTR
+#endif
+#define EXTPTR_PTR(X) R_ExternalPtrAddr(X)
+#ifdef  EXTPTR_PROT
+#undef  EXTPTR_PROT
+#endif
+#define EXTPTR_PROT(X) R_ExternalPtrProtected(X)
+#ifdef  EXTPTR_TAG
+#undef  EXTPTR_TAG
+#endif
+#define EXTPTR_TAG(X) R_ExternalPtrTag(X)
+#endif
 
 /* flags used in function declarations:
    HIDE - hidden (used internally in rJava only)
@@ -59,6 +81,21 @@
 
 #include "config.h"
 
+/* R 4.0.1 broke EXTPTR_PTR ABI so re-map it to safety at the small expense of speed */
+#ifdef  EXTPTR_PTR
+#undef  EXTPTR_PTR
+#endif
+#define EXTPTR_PTR(X) R_ExternalPtrAddr(X)
+/* PROT/TAG are safe so far, but just to make sure ... */
+#ifdef  EXTPTR_PROT
+#undef  EXTPTR_PROT
+#endif
+#define EXTPTR_PROT(X) R_ExternalPtrProtected(X)
+#ifdef  EXTPTR_TAG
+#undef  EXTPTR_TAG
+#endif
+#define EXTPTR_TAG(X) R_ExternalPtrTag(X)
+
 #ifdef MEMPROF
 #include 
 #include 
@@ -82,7 +119,7 @@ void rjprintf(char *fmt, ...); /* in Rglue.c */
 #ifdef RJ_PROFILE
 #define profStart() profilerTime=time_ms()
 #define _prof(X) X
-long time_ms(); /* those are acutally in Rglue.c */
+long time_ms(void); /* those are acutally in Rglue.c */
 void profReport(char *fmt, ...);
 #else
 #define profStart()
@@ -97,14 +134,17 @@ void profReport(char *fmt, ...);
 #define END_RJAVA_CALL };
 #endif
 
-/* define mkCharUTF8 in a compatible fashion */
+/* define mkCharUTF8 in a compatible fashion
+   NOTE: those should NOT be used anymore since native
+   Java strings use UTF-16 so use only in cases where UTF8 is required */
 #if R_VERSION < R_Version(2,7,0)
 #define mkCharUTF8(X) mkChar(X)
 #define CHAR_UTF8(X) CHAR(X)
 #else
-#define mkCharUTF8(X) mkCharCE(X, CE_UTF8)
+#define mkCharUTF8(X) rj_mkCharUTF8(X)
 #define CHAR_UTF8(X) rj_char_utf8(X)
-extern const char *rj_char_utf8(SEXP);
+extern SEXP rj_mkCharUTF8(const char *); /* rjstring.c */
+extern const char *rj_char_utf8(SEXP);   /* Rglue.c */
 #endif
 
 /* signatures are stored in a local buffer if they fit. Only if they don't fit a heap buffer is allocated and used. */
@@ -120,7 +160,7 @@ extern int RJava_has_control;
 /* in rJava.c */
 extern JNIEnv *eenv; /* should NOT be used since not thread-safe; use getJNIEnv instead */
 
-HIDE JNIEnv* getJNIEnv();
+HIDE JNIEnv* getJNIEnv(void);
 HIDE void ckx(JNIEnv *env);
 HIDE void clx(JNIEnv *env);
 
@@ -133,6 +173,14 @@ REPC SEXP RgetSimpleClassNames( SEXP, SEXP );
 extern JavaVM *jvm;
 extern int rJava_initialized;
 
+#define JVM_STATE_NONE      0  /* no JVM */
+#define JVM_STATE_CREATED   1  /* JVM was created by us */
+#define JVM_STATE_ATTACHED  2  /* we attached to another JVM */
+#define JVM_STATE_DEAD      4  /* set when Java exit handler was called */
+#define JVM_STATE_DESTROYED 8  /* JVM was destroyed */
+
+extern int rJava_JVM_state;
+
 extern int java_is_dead;
 
 extern jclass javaStringClass;
@@ -164,7 +212,7 @@ HIDE void init_rJava(void);
 
 REPC SEXP newRJavaLookupTable(SEXP) ;
 
-HIDE SEXP R_getUnboundValue() ;
+HIDE SEXP R_getUnboundValue(void) ;
 HIDE SEXP rJavaLookupTable_objects(R_ObjectTable *) ;
 HIDE SEXP rJavaLookupTable_assign(const char * const, SEXP, R_ObjectTable * ) ;
 HIDE Rboolean rJavaLookupTable_canCache(const char * const, R_ObjectTable *) ;
@@ -201,6 +249,7 @@ HIDE jdoubleArray newDoubleArray(JNIEnv *env, double *cont, int len);
 HIDE jintArray newIntArray(JNIEnv *env, int *cont, int len);
 HIDE jbooleanArray newBooleanArrayI(JNIEnv *env, int *cont, int len);
 HIDE jstring newString(JNIEnv *env, const char *cont);
+HIDE jstring newString16(JNIEnv *env, const jchar *cont, jsize len);
 HIDE jcharArray newCharArrayI(JNIEnv *env, int *cont, int len);
 HIDE jshortArray newShortArrayI(JNIEnv *env, int *cont, int len);
 HIDE jfloatArray newFloatArrayD(JNIEnv *env, double *cont, int len);
@@ -221,7 +270,7 @@ HIDE int initClassLoader(JNIEnv *env, jobject cl);
 HIDE void deserializeSEXP(SEXP o);
 
 /* this is a hook for de-serialization */
-#define jverify(X) if (EXTPTR_PROT(X) != R_NilValue) deserializeSEXP(X)
+#define jverify(X) if (X && TYPEOF(X) == EXTPTRSXP && EXTPTR_PROT(X) != R_NilValue) deserializeSEXP(X)
 
 #define IS_JOBJREF(obj) ( inherits(obj, "jobjRef") || inherits(obj, "jarrayRef") || inherits(obj,"jrectRef") )
 #define IS_JARRAYREF(obj) ( inherits(obj, "jobjRef") || inherits(obj, "jarrayRef") || inherits(obj, "jrectRef") )
diff --git a/src/registration.c b/src/registration.c
new file mode 100644
index 0000000..bdad36d
--- /dev/null
+++ b/src/registration.c
@@ -0,0 +1,25 @@
+#include 
+#include 
+
+/* only to avoid NOTEs from broken checks,
+   never called */
+int dummy__(void) {
+    return R_registerRoutines(0, 0, 0, 0, 0);
+}
+
+static DllInfo *dll;
+
+/* registration is done in R code, so it has
+   to have a way to disable dynamic symbols when done */
+SEXP useDynamicSymbols(SEXP sDo) {
+    if (dll) {
+	R_useDynamicSymbols(dll, asInteger(sDo));
+	return ScalarLogical(1);
+    }
+    return ScalarLogical(0);
+}
+
+/* record our dll so we can call useDynamicSymbols() later */
+void R_init_rJava(DllInfo *dll_) {
+    dll = dll_;
+}
diff --git a/src/rjstring.c b/src/rjstring.c
new file mode 100644
index 0000000..6fce28b
--- /dev/null
+++ b/src/rjstring.c
@@ -0,0 +1,231 @@
+#include "rjstring.h"
+
+#include 
+#include 
+#include 
+#include 
+
+#ifdef WIN32
+/* -- currently unused - was used to mimick reEnc()
+   extern unsigned int localeCP; 
+   static char cpbuf[16]; */
+#endif
+static jchar js_zero[2] = { 0, 0 };
+static jchar js_buf[128];
+
+/* if len = -1 then c is assumed to be NUL terminated */
+int rj_char_utf16(const char *c, int len, jchar **buf, const char *ifrom, int can_error) {
+    void *ih;
+    const char *ce = (len < 0) ? strchr(c, 0) : (c + len);
+    if (ce == c) {
+	buf[0] = js_zero;
+	return 0;
+    }
+    size_t osize = sizeof(jchar) * (ce - c + 1), isize = ce - c;
+    jchar *js = buf[0] = (osize < sizeof(js_buf)) ? js_buf : (jchar*) R_alloc(sizeof(jchar), ce - c + 1);
+    char *dst = (char*) js;
+    int end_test = 1, is_le = (((char*)&end_test)[0] == 1) ? 1 : 0;
+    if (!ifrom) ifrom = "";
+
+#ifdef DEBUG_ENCODING
+    fprintf(stderr, "rJava.rj_char_utf16_native:");
+    { const char *c0 = c; while (*c0) fprintf(stderr, " %02x", (int)((unsigned char)*(c0++))); }
+    fprintf(stderr, "\n");
+#endif
+
+    ih = Riconv_open(is_le ? "UTF-16LE" : "UTF-16BE", ifrom);
+    if (ih == (void *)(-1)) {
+	if (can_error)
+	    Rf_error("Unable to start conversion to UTF-16");
+	return -1;
+    }
+    while (c < ce) {
+	size_t res = Riconv(ih, &c, &isize, &dst, &osize);
+	/* this should never happen since we allocated far more than needed */
+	if (res == -1 && errno == E2BIG) {
+	    if (can_error)
+		Rf_error("Conversion to UTF-16 failed due to unexpectedly large buffer requirements.");
+	    return -1;
+	} else if(res == -1 && (errno == EILSEQ || errno == EINVAL)) { /* invalid char */
+	    if (is_le) {
+		*(dst++) = '?';
+		*(dst++) = 0;
+	    } else {
+		*(dst++) = 0;
+		*(dst++) = '?';
+	    }
+	    osize -= 2;
+	    c++;
+	    isize--;
+	}
+    }
+    Riconv_close(ih);
+#ifdef DEBUG_ENCODING
+    { const jchar *j = js; while (j < (const jchar*)dst) fprintf(stderr, " %04x", (unsigned int)*(j++)); }
+    fprintf(stderr, "\n");
+#endif
+    return dst - (char*) js;
+}
+
+/* returns string from a CHARSXP making sure that the result is in UTF-16.
+   the buffer is owned by the function and may be static, so copy after use.
+
+   Returns the length of the resulting string or -1 on error (if
+   can_error is 0).
+ */
+static int rj_CHARSXP_utf16_(SEXP s, jchar **buf, int can_error) {
+    cetype_t ce_in = getCharCE(s);
+    const char *ifrom = "", *c = CHAR(s), *ce = strchr(c, 0);
+    if (ce == c) {
+	buf[0] = js_zero;
+	return 0;
+    }
+
+    switch (ce_in) {
+#ifdef WIN32
+    case CE_NATIVE:
+/* reEnc uses this, but translateCharUtf8 uses "" so let's go with ""
+	sprintf(cpbuf, "CP%d", localeCP);
+	ifrom = cpbuf;
+*/
+	break;
+    case CE_LATIN1: ifrom = "CP1252"; break;
+#else
+    case CE_NATIVE: break; /* is already "" */
+    case CE_LATIN1: ifrom = "latin1"; break;
+#endif
+    default:
+	ifrom = "UTF-8"; break;
+    }
+
+    return rj_char_utf16(c, ce - c, buf, ifrom, can_error);
+}
+
+int rj_rchar_utf16(SEXP s, jchar **buf) { return rj_CHARSXP_utf16_(s, buf, 1); }
+int rj_rchar_utf16_noerr(SEXP s, jchar **buf) { return rj_CHARSXP_utf16_(s, buf, 0); }
+
+/* FIXME: we should probably deprecate this as well and use UTF-16 instead.
+   The only reason not to is that we would have to fully implement
+   a full UTF-16 -> UTF-8 conversion including surrogate pairs ... */
+
+/* Java returns *modified* UTF-8 which is incompatible with UTF-8,
+   so we have to detect the illegal surrgoate pairs and convert them */
+SEXP rj_mkCharUTF8_(const char *src, int can_error) {
+    const unsigned char *s = (const unsigned char*) src;
+    const unsigned char *c = (const unsigned char*) s;
+    /* check if the string contains any surrogate pairs, i.e.
+       Unicode in the range 0xD800-0xDFFF
+       We want this to be fast since in 99.99% of cases it will
+       be false */
+    while (*c) {
+	if (c[0] == 0xED &&
+	    (c[1] & 0xE0) == 0xA0)
+	    break;
+	c++;
+    }
+    if (*c) { /* yes, we have to convert them */
+	SEXP res;
+	const unsigned char *e = (const unsigned char*) strchr((const char*)s, 0); /* find the end for size */
+	unsigned char *dst = 0, *d, sbuf[64];
+	if (!e) /* should never occur */
+	    return mkChar("");
+	/* we use static buffer for small strings and dynamic alloc for large */
+	if (e - s >= sizeof(sbuf)) {
+	    /* allocate temp buffer since our input is const */
+	    d = dst = (unsigned char *) malloc(e - s + 1);
+	    if (!dst) {
+		if (can_error)
+		    Rf_error("Cannot allocate memory for surrogate pair conversion");
+		return 0;
+	    }
+	} else
+	    d = (unsigned char *)sbuf;
+	if (c - s > 0) {
+	    memcpy(d, s, c - s);
+	    d += c - s;
+	}
+	while (*c) {
+	    unsigned int u1, u;
+	    *(d++) = *(c++);
+	    /* start of a sequence ? */
+	    if ((c[-1] & 0xC0) != 0xC0)
+		continue;
+	    if ((c[-1] & 0xE0) == 0xC0)  { /* 2-byte, not a surrogate pair */
+		if ((c[0] & 0xC0) != 0x80) {
+		    if (dst) free(dst);
+		    if (can_error)
+			Rf_error("illegal 2-byte sequence in Java string");
+		    return 0;
+		}
+		*(d++) = *(c++);
+		continue;
+	    }
+	    if ((c[-1] & 0xF0) != 0xE0) { /* must be 3-byte */
+		if (dst) free(dst);
+		if (can_error)
+		    Rf_error("illegal multi-byte seqeunce in Java string (>3-byte)");
+		return 0;
+	    }
+	    if (((c[0] & 0xC0) != 0x80 ||
+		 (c[1] & 0xC0) != 0x80)) {
+		if (dst) free(dst);
+		if (can_error)
+		    Rf_error("illegal 3-byte sequence in Java string");
+		return 0;
+	    }
+	    u1 = ((((unsigned int)c[-1]) & 0x0F) << 12) |
+		 ((((unsigned int)c[0]) & 0x3F) << 6) |
+		 (((unsigned int)c[1]) & 0x3F);
+	    if (u1 < 0xD800 || u1 > 0xDBFF) { /* not a surrogate pair -> regular copy */
+		*(d++) = *(c++);
+		*(d++) = *(c++);
+		continue;
+	    }
+	    if (u1 >= 0xDC00 && u1 <= 0xDFFF) { /* low surrogate pair ? */
+		if (dst) free(dst);
+		if (can_error)
+		    Rf_error("illegal sequence in Java string: low surrogate pair without a high one");
+		return 0;
+	    }
+	    c += 2; /* move to the low pair */
+	    if (c[0] != 0xED ||
+		(c[1] & 0xF0) != 0xB0 ||
+		(c[2] & 0xC0) != 0x80) {
+		if (dst) free(dst);
+		if (can_error)
+		    Rf_error("illegal sequence in Java string: high surrogate pair not followed by low one");
+		return 0;
+	    }
+	    /* the actually encoded unicode character */
+	    u = ((((unsigned int)c[1]) & 0x0F) << 6) |
+		(((unsigned int)c[2]) & 0x3F);
+	    u |= (u1 & 0x03FF) << 10;
+	    u += 0x10000;
+	    c += 3;
+	    /* it must be <= 0x10FFFF by design (each surrogate has 10 bits) */
+	    d[-1]  = (unsigned char) (((u >> 18) & 0x0F) | 0xF0);
+	    *(d++) = (unsigned char) (((u >> 12) & 0x3F) | 0x80);
+	    *(d++) = (unsigned char) (((u >> 6) & 0x3F) | 0x80);
+	    *(d++) = (unsigned char) ((u & 0x3F) | 0x80);
+	}
+	res = mkCharLenCE((const char*) (dst ? dst : sbuf), dst ? (d - dst) : (d - sbuf), CE_UTF8);
+	if (dst) free(dst);
+	return res;
+    }
+    return mkCharLenCE(src, c - s, CE_UTF8);
+}
+
+SEXP rj_mkCharUTF8(const char *src) { return rj_mkCharUTF8_(src, 0); }
+SEXP rj_mkCharUTF8_noerr(const char *src) { return rj_mkCharUTF8_(src, 1); }
+
+jstring rj_newJavaString(JNIEnv *env, SEXP sChar) {
+    jchar *s;
+    int len = rj_rchar_utf16(sChar, &s);
+    return (*env)->NewString(env, s, (len + 1) >> 1);
+}
+
+jstring rj_newNativeJavaString(JNIEnv *env, const char *str, int len) {
+    jchar *s;
+    int rlen = rj_char_utf16(str, len, &s, "", 0);
+    return (rlen < 0) ? 0 : (*env)->NewString(env, s, (rlen + 1) >> 1);
+}
diff --git a/src/rjstring.h b/src/rjstring.h
new file mode 100644
index 0000000..6fd24a1
--- /dev/null
+++ b/src/rjstring.h
@@ -0,0 +1,25 @@
+#ifndef RJ_STRING_H__
+#define RJ_STRING_H__
+
+#include          /* for jchar */
+#include   /* for SEXP */
+
+/* --- API --- */
+
+/* Returns static content for short strings so don't re-use.
+   For dynamic strings uses R_alloc */
+int rj_char_utf16(const char *c, int len, jchar **buf, const char *ifrom, int can_error);
+
+/* wrappers for above to use with CHARSXP to detect proper ifrom */
+int rj_rchar_utf16(SEXP s, jchar **buf);
+int rj_rchar_utf16_noerr(SEXP s, jchar **buf);
+
+/* return jstring, but do NOT check exceptions */
+jstring rj_newJavaString(JNIEnv *env, SEXP sChar);
+jstring rj_newNativeJavaString(JNIEnv *env, const char *str, int len);
+
+/* takes modified UTF-8 from Java, creates CHARSXP with valid UTF8 */
+SEXP rj_mkCharUTF8(const char *src);
+SEXP rj_mkCharUTF8_noerr(const char *src);
+
+#endif
diff --git a/src/tools.c b/src/tools.c
index 3b27c11..5ee2670 100644
--- a/src/tools.c
+++ b/src/tools.c
@@ -27,7 +27,9 @@ REPE SEXP RgetStringValue(SEXP par) {
   c=(*env)->GetStringUTFChars(env, s, 0);
   if (!c)
     error("cannot retrieve string content");
-  r = mkString(c);
+  r = PROTECT(allocVector(STRSXP, 1));
+  SET_STRING_ELT(r, 0, mkCharUTF8(c));
+  UNPROTECT(1);
   (*env)->ReleaseStringUTFChars(env, s, c);
   _prof(profReport("RgetStringValue:"));
   return r;
@@ -104,7 +106,7 @@ REPC SEXP RidenticalRef(SEXP ref1, SEXP ref2) {
 }
 
 /** create a NULL external reference */
-REPC SEXP RgetNullReference() {
+REPC SEXP RgetNullReference(void) {
   return R_MakeExternalPtr(0, R_NilValue, R_NilValue);
 }
 
@@ -126,7 +128,7 @@ REPC SEXP RisAssignableFrom(SEXP cl1, SEXP cl2) {
   return r;
 }
 
-REPC SEXP RJava_checkJVM() {
+REPC SEXP RJava_checkJVM(void) {
   SEXP r = allocVector(LGLSXP, 1);
   LOGICAL(r)[0] = 0;
   if (!jvm || !getJNIEnv()) return r;
@@ -136,7 +138,7 @@ REPC SEXP RJava_checkJVM() {
 
 extern int rJava_initialized; /* in callJNI.c */
 
-REPC SEXP RJava_needs_init() {
+REPC SEXP RJava_needs_init(void) {
   SEXP r = allocVector(LGLSXP, 1);
   LOGICAL(r)[0] = rJava_initialized?0:1;
   return r;
diff --git a/tests/old/Leaks.class b/tests/old/Leaks.class
new file mode 100644
index 0000000..89c7359
Binary files /dev/null and b/tests/old/Leaks.class differ
diff --git a/tests/Leaks.java b/tests/old/Leaks.java
similarity index 100%
rename from tests/Leaks.java
rename to tests/old/Leaks.java
diff --git a/tests/Makefile b/tests/old/Makefile
similarity index 100%
rename from tests/Makefile
rename to tests/old/Makefile
diff --git a/tests/old/Types.class b/tests/old/Types.class
new file mode 100644
index 0000000..282b1b8
Binary files /dev/null and b/tests/old/Types.class differ
diff --git a/tests/Types.java b/tests/old/Types.java
similarity index 100%
rename from tests/Types.java
rename to tests/old/Types.java
diff --git a/tests/leaks.R b/tests/old/leaks.R
similarity index 80%
rename from tests/leaks.R
rename to tests/old/leaks.R
index cae4bb4..a38c7e4 100644
--- a/tests/leaks.R
+++ b/tests/old/leaks.R
@@ -6,9 +6,9 @@ gc()
 .i <- 1:10000
 ..s <- .s
 ..i <- .i
-cat(.jcall("Leaks","S","reportMem"),"\n")
+cat("=== Initial state:\n", .jcall("Leaks","S","reportMem"), "\n")
 cat(" - create unassigned objects\n")
-for (i in 1:400) .jnew("Leaks", .i, .s)
+for (i in 1:100) .jnew("Leaks", .i, .s)
 cat(.jcall("Leaks","S","reportMem"),"\n")
 cat(" running R gc\n")
 gc()
@@ -16,7 +16,7 @@ cat(" running java GC\n")
 cat(.jcall("Leaks","S","reportMem"),"\n")
 cat(" - static pass thorugh parameters\n")
 for (i in 1:800) {
-  if (i==400) { cat('   (forcing R gc)\n'); gc() }
+  if (i %% 160 == 0) { cat('   (forcing R gc)\n'); gc() }
   .i <- .jcall("Leaks", "[I", "passI", .i)
   .s <- .jcall("Leaks", "[S", "passS", .s)
 }
@@ -33,10 +33,12 @@ if (!isTRUE(all.equal(.i, ..i)))
 cat(" - dynamic storage\n")
 l <- .jnew("Leaks", .i, .s)
 for (i in 1:800) {
-  .i <- .jcall("Leaks", "[I", "passI", .i)
-  .s <- .jcall("Leaks", "[S", "passS", .s)
+  if (i %% 160 == 0) { cat('   (forcing R gc)\n'); gc() }
+  .i <- .jcall(l, "[I", "replaceI", .i)
+  .s <- .jcall(l, "[S", "replaceS", .s)
 }
 cat(.jcall("Leaks","S","reportMem"),"\n")
+rm(l)
 cat(" running R gc\n")
 gc()
 cat(.jcall("Leaks","S","reportMem"),"\n")
diff --git a/tests/types.R b/tests/old/types.R
similarity index 100%
rename from tests/types.R
rename to tests/old/types.R
diff --git a/getsp.class b/tools/getsp.class
similarity index 100%
rename from getsp.class
rename to tools/getsp.class
diff --git a/getsp.java b/tools/getsp.java
similarity index 100%
rename from getsp.java
rename to tools/getsp.java
diff --git a/install-sh b/tools/install-sh
similarity index 100%
rename from install-sh
rename to tools/install-sh