From 7823aef89057df7cad2b8b20a0f37846c9a510f9 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Nagai Date: Mon, 4 Aug 2014 19:15:39 +0900 Subject: [PATCH 001/240] do R_ProcessEvents in rniIdle if Windows --- jri/src/Rengine.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jri/src/Rengine.c b/jri/src/Rengine.c index d1e5a9b..4a053de 100644 --- a/jri/src/Rengine.c +++ b/jri/src/Rengine.c @@ -318,7 +318,9 @@ JNIEXPORT jint JNICALL Java_org_rosuda_JRI_Rengine_rniExpType JNIEXPORT void JNICALL Java_org_rosuda_JRI_Rengine_rniIdle (JNIEnv *env, jobject this) { -#ifndef Win32 +#ifdef Win32 + if(!UserBreak)R_ProcessEvents(); +#else R_runHandlers(R_InputHandlers, R_checkActivity(0, 1)); #endif } From 7f95fe025163762ce538ab324d4831d21dd581c8 Mon Sep 17 00:00:00 2001 From: Michael Sannella x268 Date: Thu, 4 Aug 2016 14:00:47 -0700 Subject: [PATCH 002/240] change .C -> .Call when calling RJavaCheckExceptions --- R/call.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/call.R b/R/call.R index 36c2e18..7833305 100644 --- a/R/call.R +++ b/R/call.R @@ -323,7 +323,7 @@ is.jnull <- function(x) { 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 - .C(RJavaCheckExceptions, silent, FALSE, PACKAGE = "rJava") + .Call(RJavaCheckExceptions, silent) if (!silent && is.jnull(a)) stop("class not found") a } From 702fb06acd1bd28e2e87ffdaddd81a16bb25c109 Mon Sep 17 00:00:00 2001 From: Russell Pierce Date: Sun, 25 Dec 2016 14:24:03 -0600 Subject: [PATCH 003/240] Correct Typo for Value --- man/loader.Rd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/loader.Rd b/man/loader.Rd index e50e8f6..f7a8e4a 100644 --- a/man/loader.Rd +++ b/man/loader.Rd @@ -20,7 +20,7 @@ class path} } \value{ - \code{.jclassPath} returns a charactger vector listing the class path sequence. + \code{.jclassPath} returns a character vector listing the class path sequence. } %\details{ % From 683004de3559d1b67ae4a98ab9b15ef0d3ee9113 Mon Sep 17 00:00:00 2001 From: Russell Pierce Date: Sun, 25 Dec 2016 14:27:26 -0600 Subject: [PATCH 004/240] Another Typo Correction --- man/jpackage.Rd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/jpackage.Rd b/man/jpackage.Rd index a1b162e..29daddf 100644 --- a/man/jpackage.Rd +++ b/man/jpackage.Rd @@ -19,7 +19,7 @@ \item{jars}{Java archives in the \code{java} directory of the package that should be added to the class path. The paths must be relative to package's \code{java} directory. A special value of - \code{'*'} adds all \code{.jar} files form the \code{java} the + \code{'*'} adds all \code{.jar} files from the \code{java} the directory.} \item{morePaths}{vector listing any additional entries that should be added to the class path.} From 415513eb638984589bb46983e2363c7422233900 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 30 Jan 2017 11:28:20 -0500 Subject: [PATCH 005/240] add optional class.loader= arg to .jnew() --- R/call.R | 4 ++-- man/jnew.Rd | 7 ++++++- src/Rglue.c | 25 +++++++++++++++++++------ src/callJNI.c | 15 +++++++++------ src/fields.c | 4 ++-- src/init.c | 4 ++-- src/jri_glue.c | 2 +- src/rJava.h | 4 ++-- 8 files changed, 43 insertions(+), 22 deletions(-) diff --git a/R/call.R b/R/call.R index 36c2e18..8a032aa 100644 --- a/R/call.R +++ b/R/call.R @@ -5,12 +5,12 @@ ## $Id$ # create a new object -.jnew <- function(class, ..., check=TRUE, silent=!check) { +.jnew <- function(class, ..., check=TRUE, silent=!check, class.loader=NULL) { class <- gsub("\\.", "/", as.character(class)) # allow non-JNI specifiation # TODO: should this do "S" > "java/lang/String", ... like .jcall if (check) .jcheck(silent=TRUE) - o<-.External(RcreateObject, class, ..., silent=silent) + o<-.External(RcreateObject, class, ..., silent=silent, class.loader=class.loader) if (check) .jcheck(silent=silent) if (is.null(o)) { if (!silent) { diff --git a/man/jnew.Rd b/man/jnew.Rd index 71f13ce..d599012 100644 --- a/man/jnew.Rd +++ b/man/jnew.Rd @@ -7,7 +7,7 @@ \code{.jnew} create a new Java object. } \usage{ -.jnew(class, ..., check=TRUE, silent=!check) +.jnew(class, ..., check=TRUE, silent=!check, class.loader=NULL) } \arguments{ \item{class}{fully qualified class name in JNI notation (e.g. \code{"java/lang/String"}).} @@ -29,6 +29,11 @@ \code{check=FALSE, silent=FALSE} is usually not a meaningful combination. } + \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.} } \value{ Returns the reference (\code{jobjRef}) to the newly created object or diff --git a/src/Rglue.c b/src/Rglue.c index a055e40..2246680 100644 --- a/src/Rglue.c +++ b/src/Rglue.c @@ -453,7 +453,7 @@ REPE SEXP RcallMethod(SEXP par) { } #endif if (clnam) - cls = findClass(env, clnam); + cls = findClass(env, clnam, oClassLoader); else cls = objectClass(env,o); if (!cls) @@ -686,7 +686,7 @@ REPE SEXP RcreateObject(SEXP par) { sig_buffer_t sig; jvalue jpar[maxJavaPars]; jobject tmpo[maxJavaPars+1]; - jobject o; + jobject o, loader = 0; JNIEnv *env=getJNIEnv(); if (TYPEOF(p)!=LISTSXP) { @@ -712,12 +712,25 @@ REPE SEXP RcreateObject(SEXP par) { if (TAG(p) && isSymbol(TAG(p))) { if (TAG(p)==install("silent") && isLogical(CAR(p)) && LENGTH(CAR(p))==1) silent=LOGICAL(CAR(p))[0]; + + /* class.loader */ + if (TAG(p)==install("class.loader")) { + SEXP e = CAR(p); + if (TYPEOF(e) == S4SXP && IS_JOBJREF(e)) { + SEXP sref = GET_SLOT(e, install("jobj")); + if (sref && TYPEOF(sref) == EXTPTRSXP) { + jverify(sref); + loader = (jobject)EXTPTR_PTR(sref); + } + } else if (e != R_NilValue) + Rf_error("invalid class.loader"); + } } - p=CDR(p); + p = CDR(p); } - + if (!loader) loader = oClassLoader; BEGIN_RJAVA_CALL - o = createObject(env, class, sig.sig, jpar, silent); + o = createObject(env, class, sig.sig, jpar, silent, loader); END_RJAVA_CALL done_sigbuf(&sig); Rfreejpars(env, tmpo); @@ -953,7 +966,7 @@ REPC SEXP RcreateArray(SEXP ar, SEXP cl) { if (TYPEOF(cl)==STRSXP && LENGTH(cl)>0) { const char *cname = CHAR_UTF8(STRING_ELT(cl, 0)); if (cname) { - ac = findClass(env, cname); + ac = findClass(env, cname, oClassLoader); if (!ac) error("Cannot find class %s.", cname); if (strlen(cname)<253) { diff --git a/src/callJNI.c b/src/callJNI.c index 7d26bb6..24b6d8f 100644 --- a/src/callJNI.c +++ b/src/callJNI.c @@ -40,8 +40,10 @@ HIDE void* errJNI(const char *err, ...) { return 0; } -HIDE jclass findClass(JNIEnv *env, const char *cName) { - if (clClassLoader) { +/* loader: if NULL does NOT use any custom loader but uses system FindClass, + otherwise Class.forName(..., true, loader) if user first and system only as fall-back */ +HIDE jclass findClass(JNIEnv *env, const char *cName, jobject loader) { + if (loader) { char cn[128], *c=cn; jobject cns; jclass cl; @@ -51,9 +53,9 @@ HIDE jclass findClass(JNIEnv *env, const char *cName) { cns = newString(env, cn); if (!cns) error("unable to create Java string from '%s'", cn); #ifdef DEBUG_CL - printf("findClass(\"%s\") [with rJava loader]\n", cn); + printf("findClass(\"%s\") [with %s loader]\n", cn, (loader && loader == oClassLoader) ? "rJava" : "custom"); #endif - cl = (jclass) (*env)->CallStaticObjectMethod(env, javaClassClass, mid_forName, cns, (jboolean) 1, oClassLoader); + cl = (jclass) (*env)->CallStaticObjectMethod(env, javaClassClass, mid_forName, cns, (jboolean) 1, loader); #if RJAVA_LEGACY clx(env); #endif @@ -80,13 +82,14 @@ HIDE jclass findClass(JNIEnv *env, const char *cName) { } } -HIDE jobject createObject(JNIEnv *env, const char *class, const char *sig, jvalue *par, int silent) { +/* loader: if NULL, uses oClassLoader (rJava class loader) */ +HIDE jobject createObject(JNIEnv *env, const char *class, const char *sig, jvalue *par, int silent, jobject loader) { /* va_list ap; */ jmethodID mid; jclass cls; jobject o; - cls=findClass(env, class); + cls=findClass(env, class, loader ? loader : oClassLoader); if (!cls) return silent?0:errJNI("createObject.FindClass %s failed",class); mid=(*env)->GetMethodID(env, cls, "", sig); if (!mid) { diff --git a/src/fields.c b/src/fields.c index b90215f..8bfdd0c 100644 --- a/src/fields.c +++ b/src/fields.c @@ -104,7 +104,7 @@ REPC SEXP RgetField(SEXP obj, SEXP sig, SEXP name, SEXP trueclass) { else { char *c = clnam; while(*c) { if (*c=='/') *c='.'; c++; } - cls = findClass(env, clnam); + cls = findClass(env, clnam, oClassLoader); free(clnam); if (!cls) { error("cannot find class %s", CHAR(STRING_ELT(obj, 0))); @@ -302,7 +302,7 @@ REPC SEXP RsetField(SEXP ref, SEXP name, SEXP value) { else { char *c = clnam; while(*c) { if (*c=='/') *c='.'; c++; } - cls = findClass(env, clnam); + cls = findClass(env, clnam, oClassLoader); if (!cls) { error("cannot find class %s", CHAR(STRING_ELT(obj, 0))); } diff --git a/src/init.c b/src/init.c index 24fe750..a00ed9f 100644 --- a/src/init.c +++ b/src/init.c @@ -385,14 +385,14 @@ REPC SEXP initRJavaTools(){ /* classes */ /* RJavaTools class */ - c= findClass( env, "RJavaTools" ) ; + 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" ) ; + 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"); diff --git a/src/jri_glue.c b/src/jri_glue.c index c680736..c3e74d4 100644 --- a/src/jri_glue.c +++ b/src/jri_glue.c @@ -28,7 +28,7 @@ REPC SEXP PushToREXP(SEXP clname, SEXP eng, SEXP engCl, SEXP robj, SEXP doConv) snprintf(sig,127,"(L%s;JZ)V",CHAR(STRING_ELT(engCl,0))); jpar[2].z = (jboolean) convert; } - o = createObject(env, cName, sig, jpar, 1); + 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. diff --git a/src/rJava.h b/src/rJava.h index 8d75da4..1c8d7c4 100644 --- a/src/rJava.h +++ b/src/rJava.h @@ -193,8 +193,8 @@ HIDE SEXP new_jclassName(JNIEnv *, jobject/*Class*/ ) ; HIDE jstring callToString(JNIEnv *env, jobject o); /* in callJNI */ -HIDE jobject createObject(JNIEnv *env, const char *class, const char *sig, jvalue *par, int silent); -HIDE jclass findClass(JNIEnv *env, const char *class); +HIDE jobject createObject(JNIEnv *env, const char *class, const char *sig, jvalue *par, int silent, jobject loader); +HIDE jclass findClass(JNIEnv *env, const char *class, jobject loader); HIDE jclass objectClass(JNIEnv *env, jobject o); HIDE jdoubleArray newDoubleArray(JNIEnv *env, double *cont, int len); From d3b8836706c38994f09110a51e37a39a387afc0f Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 30 Jan 2017 11:29:37 -0500 Subject: [PATCH 006/240] update NEWS --- NEWS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS b/NEWS index 1a67bd3..1b30d46 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,9 @@ is so broken that it cannot even be tested - reportedly the case with Docker (see #63). + o add optional class.loader= argument to .jnew() which allows to + use a custom loader in special cases. + 0.9-8 2016-01-06 o Work around a bug on Oracle's Java on OS X by pre-loading jli From 7cff6c228aaa8e51e30e406874144b1db6e4f4ea Mon Sep 17 00:00:00 2001 From: Tomas Kalibera Date: Wed, 19 Apr 2017 12:22:18 +0200 Subject: [PATCH 007/240] Workaround to prevent Oracle JVM from shrinking R stack on Linux. --- src/init.c | 273 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 270 insertions(+), 3 deletions(-) diff --git a/src/init.c b/src/init.c index a00ed9f..fddf94b 100644 --- a/src/init.c +++ b/src/init.c @@ -254,9 +254,8 @@ HIDE void init_rJava(void) { rJava_initialized = 1; } -/** RinitJVM(classpath) - initializes JVM with the specified class path */ -REP SEXP RinitJVM(SEXP par) + +static SEXP RinitJVM_real(SEXP par) { const char *c=0; SEXP e=CADR(par); @@ -366,6 +365,274 @@ REP SEXP RinitJVM(SEXP par) return e; } +/* This is a workaround for another workaround in Oracle JVM. On Linux, the + JVM would insert protected guard pages into the C stack of the R process + that initializes the JVM, thus effectively reducing the stack size. + Worse yet, R does not find out about this and fails to detect infinite + recursion. Without the workaround, this code crashes R after .jinit() is called + + x <- 1; f <- function() { x <<- x + 1 ; print(x) ; f() } ; tryCatch(f(), error=function(e) x) + + and various packages fail/segfault unpredictably as they reach the stack + limit. + + This workaround in rJava can detect the reduction of the R stack and can + adjust R_CStack* variables so that the detection of infinite recursion + still works. Moreover, the workaround in rJava can prevent significant + shrinking of the stack by allocating at least 2M from the C stack before + initializing the JVM. This makes the JVM think that the current thread + is actually not the initial thread (os::Linux::is_initial_thread() + returns false), because is_initial_thread will run outside what the JVM + assumes is the stack for the initial thread (the JVM caps the stack to + 2M). Consequently, the JVM will not install guard pages. The stack size + limit is implemented in os::Linux::capture_initial_stack (the limit 4M on + Itanium which is ignored here by rJava and 2M on other Linux systems) and + 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 also guard pages + also based on the setting of -Xss. +*/ + +#undef JVM_STACK_WORKAROUND +#if defined(linux) || defined(__linux__) || defined(__linux) +#define JVM_STACK_WORKAROUND +#endif + +#ifdef JVM_STACK_WORKAROUND + +#include + + /* unfortunately this needs (write!) access to R internals */ +extern uintptr_t R_CStackLimit; +extern uintptr_t R_CStackStart; +extern int R_CStackDir; + +#include +#include +#include +#include +#include +#include + +/* + Find a new limit for the C stack, within the existing limit. Looks for + the first address in the stack area that is not accessible to the current + process. This code could easily be made to work on different Unix + systems, not just on Linux, but it does not seem necessary at the moment. + + limit is the first address not to access + 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 + + returns NULL in case of error, limit when no new limit is found, + a new limit when found +*/ +static void* findBound(char *from, char *limit, int dir) +{ + int pipefd[2]; + pid_t cpid; + /* any positive size could be used, using page size is a heuristic */ + size_t psize = sysconf(_SC_PAGESIZE); + char buf[psize]; + + if (pipe(pipefd) == -1) + return NULL; /* error */ + + cpid = fork(); + if (cpid == -1) + return NULL; /* error */ + + if (cpid == 0) { + /* child process, reads from the pipe */ + close(pipefd[1]); + + while (read(pipefd[0], &buf, psize) > 0); + _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 + 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. + */ + close(pipefd[0]); + int failed = 0; + + for(;(limit - from) * dir > 0; from += dir * psize) + if (write(pipefd[1], from, psize) == -1) { + if (errno == EFAULT) { + /* now proceed byte by byte */ + for(from -= dir * psize; from != limit; from += dir) + if (write(pipefd[1], from, 1) == -1) { + if (errno != EFAULT) + failed = 1; + break; + } + } else + failed = 1; + break; + } + + close(pipefd[1]); + wait(NULL); + return failed ? NULL : from; + } +} + +/* Add certain amount of padding to the C stack before invoking RinitJVM. + The recursion turned out more reliable in face of compiler optimizations + 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]; + /* 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); + else + return RinitJVM_with_padding(par, padding, dummy); +} + +/* Run RinitJVM with the Java stack workaround */ +static SEXP RinitJVM_jsw(SEXP par) { + + /* One can disable the workaround using environment variable + RJAVA_JVM_STACK_WORKAROUND + + this support exists for diagnostics and as a way to disable the + workaround without re-compiling rJava. In normal cases it only makes + sense to use the default value of 3. + */ + + #define JSW_DISABLED 0 + #define JSW_DETECT 1 + #define JSW_ADJUST 2 + #define JSW_PREVENT 3 + + #define JSW_PADDING 2*1024*1024 + #define JSW_CHECK_BOUND 16*1024*1024 + + /* 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; + char *vval = getenv("RJAVA_JVM_STACK_WORKAROUND"); + if (vval != NULL) + val = atoi(vval); + if (val < 0 || val > 3) + error("Invalid value for RJAVA_JVM_STACK_WORKAROUND"); + + if (val == JSW_DISABLED) + return RinitJVM_real(par); + + /* Figure out the original stack limit */ + uintptr_t rlimsize = 0; + + struct rlimit rlim; + if (getrlimit(RLIMIT_STACK, &rlim) == 0) { + rlim_t lim = rlim.rlim_cur; + if (lim != RLIM_INFINITY) + rlimsize = (uintptr_t)lim; + } + + if (rlimsize == 0 && R_CStackLimit != -1) + /* getrlimit should work on linux, so this should only happen + when stack size is unlimited */ + rlimsize = (uintptr_t) (R_CStackLimit / 0.95); + + if (rlimsize == 0 || rlimsize > JSW_CHECK_BOUND) + /* use a reasonable limit when looking for guard pages when + stack size is unlimited or very large */ + rlimsize = JSW_CHECK_BOUND; + + void *maxBound = (void *)((intptr_t)R_CStackStart - (intptr_t)R_CStackDir*rlimsize); + void *oldBound = findBound((void*)R_CStackStart, maxBound, -R_CStackDir); + + /* it is expected that newBound < maxBound, because not all of the "rlim" + stack is accessible even before JVM initialization */ + + intptr_t padding = 0; + if (val >= JSW_PREVENT) { + int dummy; + intptr_t usage = R_CStackDir * (R_CStackStart - (uintptr_t)&dummy); + usage += JSW_PADDING + 512; /* 512 is a buffer for C recursive calls */ + if(R_CStackLimit == -1 || usage < ((intptr_t) R_CStackLimit)) + padding = JSW_PADDING; + } + + char dummy[1]; + /* reduce the risk that dummy will be optimized out */ + dummy[0] = (char) (uintptr_t) &dummy; + SEXP ans = PROTECT(RinitJVM_with_padding(par, padding, dummy)); + + if (val >= JSW_DETECT) { + + void *newBound = findBound((void*)R_CStackStart, oldBound, -R_CStackDir); + if (oldBound == newBound) { + /* No guard pages inserted, keep the original stack size. + This includes the case when the original stack size was + unlimited. */ + UNPROTECT(1); /* ans */ + return ans; + } + + intptr_t oldb = (intptr_t)oldBound; + intptr_t newb = (intptr_t)newBound; + intptr_t lim = ((intptr_t)R_CStackStart - newb) * R_CStackDir; + uintptr_t newlim = (uintptr_t) (lim * 0.95); + + uintptr_t oldlim = R_CStackLimit; + if (val >= JSW_ADJUST) + R_CStackLimit = newlim; + + /* Only report when the loss is big. There will always be some bytes + lost because even with the original setting of R_CStackLimit before + initializing the JVM, one cannot access all bytes of stack. */ + + int bigloss = 0; + if (oldlim == -1) { + /* 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); + bigloss = 1; + } else { + unsigned lost = (unsigned) (oldlim - newlim); + if (lost > oldlim * 0.01) { + REprintf("Rjava.init.warning: lost %u bytes of stack after JVM" + " initialization.\n", lost); + bigloss = 1; + } + } + + if (bigloss) { + if (val >= JSW_PREVENT && padding == 0) + REprintf("Rjava.init.warning: re-try with increased" + " stack size via ulimit -s to allow for a work-around.\n"); + if (val < JSW_ADJUST) + REprintf("Rjava.init.warning: R may crash in recursive calls.\n"); + } + } + + UNPROTECT(1); /* ans */ + return ans; +} + +#endif /* JVM_STACK_WORKAROUND */ + +/** RinitJVM(classpath) + initializes JVM with the specified class path */ +REP SEXP RinitJVM(SEXP par) { + +#ifndef JVM_STACK_WORKAROUND + return RinitJVM_real(par); +#else + return RinitJVM_jsw(par); +#endif +} + REP void doneJVM() { (*jvm)->DestroyJavaVM(jvm); jvm = 0; From f18c22c3b848696b765747306e7778ecf269f298 Mon Sep 17 00:00:00 2001 From: Tomas Kalibera Date: Wed, 19 Apr 2017 15:06:28 +0200 Subject: [PATCH 008/240] Fixed bug in searching for protected page. Added debug messages. --- src/init.c | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/src/init.c b/src/init.c index fddf94b..4f86a2e 100644 --- a/src/init.c +++ b/src/init.c @@ -462,7 +462,7 @@ static void* findBound(char *from, char *limit, int dir) if (write(pipefd[1], from, psize) == -1) { if (errno == EFAULT) { /* now proceed byte by byte */ - for(from -= dir * psize; from != limit; from += dir) + for(; from != limit; from += dir) if (write(pipefd[1], from, 1) == -1) { if (errno != EFAULT) failed = 1; @@ -524,6 +524,8 @@ static SEXP RinitJVM_jsw(SEXP par) { if (val < 0 || val > 3) error("Invalid value for RJAVA_JVM_STACK_WORKAROUND"); + _dbg(rjprintf("JSW workaround: (level %d)\n", val)); + if (val == JSW_DISABLED) return RinitJVM_real(par); @@ -533,22 +535,37 @@ static SEXP RinitJVM_jsw(SEXP par) { struct rlimit rlim; if (getrlimit(RLIMIT_STACK, &rlim) == 0) { rlim_t lim = rlim.rlim_cur; - if (lim != RLIM_INFINITY) + if (lim != RLIM_INFINITY) { rlimsize = (uintptr_t)lim; + _dbg(rjprintf(" RLIMIT_STACK (rlimsize) %lu\n", + (unsigned long) rlimsize)); + } else { + _dbg(rjprintf(" RLIMIT_STACK unlimited\n")); + } } - if (rlimsize == 0 && R_CStackLimit != -1) + if (rlimsize == 0 && R_CStackLimit != -1) { /* getrlimit should work on linux, so this should only happen when stack size is unlimited */ rlimsize = (uintptr_t) (R_CStackLimit / 0.95); + _dbg(rjprintf(" expanded R_CStackLimit (rlimsize) %lu\n", + (unsigned long) rlimsize)); + } - if (rlimsize == 0 || rlimsize > JSW_CHECK_BOUND) + if (rlimsize == 0 || rlimsize > JSW_CHECK_BOUND) { /* use a reasonable limit when looking for guard pages when stack size is unlimited or very large */ rlimsize = JSW_CHECK_BOUND; + _dbg(rjprintf(" hardcoded rlimsize %lu\n", + (unsigned long) rlimsize)); + } + _dbg(rjprintf(" R_CStackStart %p\n", R_CStackStart)); + _dbg(rjprintf(" R_CStackLimit %lu\n", (unsigned long)R_CStackLimit)); void *maxBound = (void *)((intptr_t)R_CStackStart - (intptr_t)R_CStackDir*rlimsize); void *oldBound = findBound((void*)R_CStackStart, maxBound, -R_CStackDir); + _dbg(rjprintf(" maxBound %p\n", maxBound)); + _dbg(rjprintf(" oldBound %p\n", oldBound)); /* it is expected that newBound < maxBound, because not all of the "rlim" stack is accessible even before JVM initialization */ @@ -566,10 +583,12 @@ static SEXP RinitJVM_jsw(SEXP par) { /* reduce the risk that dummy will be optimized out */ dummy[0] = (char) (uintptr_t) &dummy; SEXP ans = PROTECT(RinitJVM_with_padding(par, padding, dummy)); + _dbg(rjprintf("JSW workaround (ctd): (level %d)\n", val)); if (val >= JSW_DETECT) { void *newBound = findBound((void*)R_CStackStart, oldBound, -R_CStackDir); + _dbg(rjprintf(" newBound %p\n", newBound)); if (oldBound == newBound) { /* No guard pages inserted, keep the original stack size. This includes the case when the original stack size was @@ -584,8 +603,10 @@ static SEXP RinitJVM_jsw(SEXP par) { uintptr_t newlim = (uintptr_t) (lim * 0.95); uintptr_t oldlim = R_CStackLimit; - if (val >= JSW_ADJUST) + if (val >= JSW_ADJUST) { R_CStackLimit = newlim; + _dbg(rjprintf(" new R_CStackLimit %lu\n", (unsigned long)R_CStackLimit)); + } /* Only report when the loss is big. There will always be some bytes lost because even with the original setting of R_CStackLimit before From 0d9e244e6ba8627b6d2d339181a2185758bc6d26 Mon Sep 17 00:00:00 2001 From: Tomas Kalibera Date: Thu, 20 Apr 2017 15:09:17 +0200 Subject: [PATCH 009/240] Comments. Simplified and fixed code looking for protected memory. --- src/init.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/src/init.c b/src/init.c index 4f86a2e..c7e98b7 100644 --- a/src/init.c +++ b/src/init.c @@ -412,6 +412,7 @@ extern int R_CStackDir; #include #include #include +#include /* Find a new limit for the C stack, within the existing limit. Looks for @@ -427,15 +428,22 @@ extern int R_CStackDir; returns NULL in case of error, limit when no new limit is found, a new limit when found + + returns NULL when from == limit */ + +volatile int globald = 0; static void* findBound(char *from, char *limit, int dir) { int pipefd[2]; pid_t cpid; /* any positive size could be used, using page size is a heuristic */ - size_t psize = sysconf(_SC_PAGESIZE); + int psize = (int) sysconf(_SC_PAGESIZE); char buf[psize]; + if ((dir==-1 && from<=limit) || (dir == 1 && from>=limit)) + return NULL; + if (pipe(pipefd) == -1) return NULL; /* error */ @@ -457,17 +465,18 @@ static void* findBound(char *from, char *limit, int dir) */ close(pipefd[0]); int failed = 0; + intmax_t diff = imaxabs(from-limit); + int step = (diff < psize) ? diff : psize; + + for(; (dir == -1) ? (from-step+1 >= limit) : (from+step-1 <= limit) + ; from += dir * step) - for(;(limit - from) * dir > 0; from += dir * psize) - if (write(pipefd[1], from, psize) == -1) { + if (write(pipefd[1], (dir == -1) ? (from-step+1) : from, step) == -1) { if (errno == EFAULT) { - /* now proceed byte by byte */ - for(; from != limit; from += dir) - if (write(pipefd[1], from, 1) == -1) { - if (errno != EFAULT) - failed = 1; - break; - } + if (step > 1) { + step = 1; /* now proceed byte by byte */ + continue; + } /* otherwise we are done */ } else failed = 1; break; @@ -568,7 +577,8 @@ static SEXP RinitJVM_jsw(SEXP par) { _dbg(rjprintf(" oldBound %p\n", oldBound)); /* it is expected that newBound < maxBound, because not all of the "rlim" - stack is accessible even before JVM initialization */ + stack is accessible even before JVM initialization, which can be e.g. + because of imprecise detection of the stack start */ intptr_t padding = 0; if (val >= JSW_PREVENT) { @@ -597,7 +607,6 @@ static SEXP RinitJVM_jsw(SEXP par) { return ans; } - intptr_t oldb = (intptr_t)oldBound; intptr_t newb = (intptr_t)newBound; intptr_t lim = ((intptr_t)R_CStackStart - newb) * R_CStackDir; uintptr_t newlim = (uintptr_t) (lim * 0.95); @@ -610,7 +619,8 @@ static SEXP RinitJVM_jsw(SEXP par) { /* Only report when the loss is big. There will always be some bytes lost because even with the original setting of R_CStackLimit before - initializing the JVM, one cannot access all bytes of stack. */ + initializing the JVM, one cannot access all bytes of stack + (e.g. because of imprecise detection of the stack start). */ int bigloss = 0; if (oldlim == -1) { From 6ee3045d9b7bb7b3cf4a557f225aa00ddeaf5ae5 Mon Sep 17 00:00:00 2001 From: Tomas Kalibera Date: Fri, 12 May 2017 11:47:45 +0200 Subject: [PATCH 010/240] Fixed comments (new version of R-devel detects stack start precisely on Linux). --- src/init.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/init.c b/src/init.c index c7e98b7..2a1db4d 100644 --- a/src/init.c +++ b/src/init.c @@ -388,8 +388,8 @@ static SEXP RinitJVM_real(SEXP par) limit is implemented in os::Linux::capture_initial_stack (the limit 4M on Itanium which is ignored here by rJava and 2M on other Linux systems) and 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 also guard pages - also based on the setting of -Xss. + present in JVM 9. Moreover, on Linux the JVM inserts guard pages also + based on the setting of -Xss. */ #undef JVM_STACK_WORKAROUND @@ -577,8 +577,8 @@ static SEXP RinitJVM_jsw(SEXP par) { _dbg(rjprintf(" oldBound %p\n", oldBound)); /* it is expected that newBound < maxBound, because not all of the "rlim" - stack is accessible even before JVM initialization, which can be e.g. - because of imprecise detection of the stack start */ + stack may be accessible even before JVM initialization, which can be e.g. + because of an imprecise detection of the stack start */ intptr_t padding = 0; if (val >= JSW_PREVENT) { @@ -617,9 +617,9 @@ static SEXP RinitJVM_jsw(SEXP par) { _dbg(rjprintf(" new R_CStackLimit %lu\n", (unsigned long)R_CStackLimit)); } - /* Only report when the loss is big. There will always be some bytes + /* Only report when the loss is big. There may be some bytes lost because even with the original setting of R_CStackLimit before - initializing the JVM, one cannot access all bytes of stack + initializing the JVM, one may not be able to access all bytes of stack (e.g. because of imprecise detection of the stack start). */ int bigloss = 0; From b9cbcf6c9203b4296de4a09ead94314f56d2a62f Mon Sep 17 00:00:00 2001 From: Tomas Kalibera Date: Fri, 12 May 2017 13:02:16 +0200 Subject: [PATCH 011/240] Fixed to work also with precise stack start detection. --- src/init.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/init.c b/src/init.c index 2a1db4d..b882df1 100644 --- a/src/init.c +++ b/src/init.c @@ -420,6 +420,7 @@ extern int R_CStackDir; process. This code could easily be made to work on different Unix systems, not just on Linux, but it does not seem necessary at the moment. + from is the first address to access limit is the first address not to access bound is the new first address not to access dir is 1 (stack grows up) or -1 (stack grows down, the usual) @@ -464,24 +465,32 @@ static void* findBound(char *from, char *limit, int dir) it is re-tried byte-by-byte for the last buffer not read successfully. */ close(pipefd[0]); - int failed = 0; intmax_t diff = imaxabs(from-limit); int step = (diff < psize) ? diff : psize; + int failed = 0; + int reached_fault = 0; + char *origfrom = from; + /* start search at bigger granularity for performance */ for(; (dir == -1) ? (from-step+1 >= limit) : (from+step-1 <= limit) ; from += dir * step) if (write(pipefd[1], (dir == -1) ? (from-step+1) : from, step) == -1) { - if (errno == EFAULT) { - if (step > 1) { - step = 1; /* now proceed byte by byte */ - continue; - } /* otherwise we are done */ - } else + if (errno == EFAULT) + reached_fault = 1; + else failed = 1; break; } + /* finetune with step 1 */ + if (reached_fault && step > 1 && origfrom != from) + for(from -= dir * step; from != limit ; from += dir) + if (write(pipefd[1], from, 1) == -1) { + if (errno != EFAULT) + failed = 1; + break; + } close(pipefd[1]); wait(NULL); return failed ? NULL : from; @@ -572,7 +581,7 @@ static SEXP RinitJVM_jsw(SEXP par) { _dbg(rjprintf(" R_CStackStart %p\n", R_CStackStart)); _dbg(rjprintf(" R_CStackLimit %lu\n", (unsigned long)R_CStackLimit)); void *maxBound = (void *)((intptr_t)R_CStackStart - (intptr_t)R_CStackDir*rlimsize); - void *oldBound = findBound((void*)R_CStackStart, maxBound, -R_CStackDir); + void *oldBound = findBound((void*)R_CStackStart - R_CStackDir, maxBound, -R_CStackDir); _dbg(rjprintf(" maxBound %p\n", maxBound)); _dbg(rjprintf(" oldBound %p\n", oldBound)); @@ -597,7 +606,7 @@ static SEXP RinitJVM_jsw(SEXP par) { if (val >= JSW_DETECT) { - void *newBound = findBound((void*)R_CStackStart, oldBound, -R_CStackDir); + void *newBound = findBound((void*)R_CStackStart - R_CStackDir, oldBound, -R_CStackDir); _dbg(rjprintf(" newBound %p\n", newBound)); if (oldBound == newBound) { /* No guard pages inserted, keep the original stack size. From 87f5d7465b05c563ae118d8cfa7ae18ac23e8948 Mon Sep 17 00:00:00 2001 From: Tomas Kalibera Date: Sun, 2 Jul 2017 21:18:16 +0200 Subject: [PATCH 012/240] Avoid pointer arithmetic on void as it is a GNU extension we do not really need. --- src/init.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/init.c b/src/init.c index b882df1..091a29e 100644 --- a/src/init.c +++ b/src/init.c @@ -434,7 +434,7 @@ extern int R_CStackDir; */ volatile int globald = 0; -static void* findBound(char *from, char *limit, int dir) +static char* findBound(char *from, char *limit, int dir) { int pipefd[2]; pid_t cpid; @@ -580,8 +580,8 @@ static SEXP RinitJVM_jsw(SEXP par) { _dbg(rjprintf(" R_CStackStart %p\n", R_CStackStart)); _dbg(rjprintf(" R_CStackLimit %lu\n", (unsigned long)R_CStackLimit)); - void *maxBound = (void *)((intptr_t)R_CStackStart - (intptr_t)R_CStackDir*rlimsize); - void *oldBound = findBound((void*)R_CStackStart - R_CStackDir, maxBound, -R_CStackDir); + char *maxBound = (char *)((intptr_t)R_CStackStart - (intptr_t)R_CStackDir*rlimsize); + char *oldBound = findBound((char*)R_CStackStart - R_CStackDir, maxBound, -R_CStackDir); _dbg(rjprintf(" maxBound %p\n", maxBound)); _dbg(rjprintf(" oldBound %p\n", oldBound)); @@ -606,7 +606,7 @@ static SEXP RinitJVM_jsw(SEXP par) { if (val >= JSW_DETECT) { - void *newBound = findBound((void*)R_CStackStart - R_CStackDir, oldBound, -R_CStackDir); + char *newBound = findBound((char*)R_CStackStart - R_CStackDir, oldBound, -R_CStackDir); _dbg(rjprintf(" newBound %p\n", newBound)); if (oldBound == newBound) { /* No guard pages inserted, keep the original stack size. From e7f5c41fbd0b94981845430050a75d4b747f33e0 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 11 Oct 2017 15:45:35 -0400 Subject: [PATCH 013/240] Win: look in JDK/JRE registry as used by Java 1.9 (#120) --- R/windows/FirstLib.R | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/R/windows/FirstLib.R b/R/windows/FirstLib.R index 391d06e..09694b4 100755 --- a/R/windows/FirstLib.R +++ b/R/windows/FirstLib.R @@ -5,8 +5,12 @@ function(libname, pkgname) { if(!nchar(javahome)) { ## JAVA_HOME was not set explicitly find.java <- function() { for (root in c("HLM", "HCU")) - for(key in c("Software\\JavaSoft\\Java Runtime Environment", - "Software\\JavaSoft\\Java Development Kit")) { + for(key in c( + "Software\\JavaSoft\\JRE", + "Software\\JavaSoft\\JDK", + "Software\\JavaSoft\\Java Runtime Environment", + "Software\\JavaSoft\\Java Development Kit" + )) { hive <- try(utils::readRegistry(key, root, 2), silent=TRUE) if (!inherits(hive, "try-error")) return(hive) } From 992828b6ddac2b905e95c4cd41d427f00eb960e7 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 11 Oct 2017 16:03:06 -0400 Subject: [PATCH 014/240] bump minimal version to 1.6 since Oracle Java 1.9 breaks on anything earlier - there is not real reason for this, so revert this particular commit to build for older versions on more compatible JDKs --- jri/Makefile.all | 2 +- jri/src/Makefile.all | 4 ++-- src/java/Makefile | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/jri/Makefile.all b/jri/Makefile.all index 22f3665..ad56e5e 100644 --- a/jri/Makefile.all +++ b/jri/Makefile.all @@ -11,7 +11,7 @@ EX_JAVA=$(wildcard examples/*.java) EX_CLASS=$(EX_JAVA:%.java=%.class) -JFLAGS+=-target 1.4 -source 1.4 +JFLAGS+=-target 1.6 -source 1.6 TARGETS=src/JRI.jar $(JRILIB) $(EX_CLASS) diff --git a/jri/src/Makefile.all b/jri/src/Makefile.all index 97b1251..3e9c66f 100644 --- a/jri/src/Makefile.all +++ b/jri/src/Makefile.all @@ -4,8 +4,8 @@ JRI_JSRC=$(wildcard ../*.java) TARGETS=$(JNIPREFIX)jri$(JNISO) JRI.jar -# we need to force JDK 1.4 for compatibility -JFLAGS+=-target 1.4 -source 1.4 +# we need to force JDK 1.4 for compatibility (or 1.6 for J9) +JFLAGS+=-target 1.6 -source 1.6 all: $(TARGETS) diff --git a/src/java/Makefile b/src/java/Makefile index 4ca5f18..4ac3e6a 100644 --- a/src/java/Makefile +++ b/src/java/Makefile @@ -1,5 +1,5 @@ JAVA_SRC=$(wildcard *.java) -JFLAGS=-source 1.2 -target 1.2 +JFLAGS=-source 1.6 -target 1.6 JAVAC=javac JAVA=java JAVADOC=javadoc From 2d1b69169ae95937e00af7899a44da464880d4d1 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 11 Oct 2017 16:31:50 -0400 Subject: [PATCH 015/240] update NEWS --- NEWS | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 1b30d46..6ca4238 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,7 @@ NEWS/ChangeLog for rJava -------------------------- -0.9-9 (under development) +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 with Docker (see #63). @@ -9,6 +9,19 @@ o add optional class.loader= argument to .jnew() which allows to use a custom loader in special cases. + o change target to 1.6 and higher since Java 1.9 breaks when asked + to compile anything older than that. There is no technical reason, + 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 Add a work-around for a bug in Oracle Java on Linux which causes + segfaults due to stack truncation. (#102) + + o Work around a change in registry location on Windows for Oracle + Java 1.9. (#120) + 0.9-8 2016-01-06 o Work around a bug on Oracle's Java on OS X by pre-loading jli From e14a6aab9815703e94209399a1638cad529ea441 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 11 Oct 2017 16:33:37 -0400 Subject: [PATCH 016/240] update to latest REngine (essentially also jsut the target version change) --- jri/REngine | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jri/REngine b/jri/REngine index a74e184..7181bbc 160000 --- a/jri/REngine +++ b/jri/REngine @@ -1 +1 @@ -Subproject commit a74e184c051c2d2e850430cd2d0526656d3a6c48 +Subproject commit 7181bbc28b1feb73fb8c891a55028ee03ade371f From 64573aef976d5384c76d7378c18f0637129412c4 Mon Sep 17 00:00:00 2001 From: Tomas Kalibera Date: Thu, 12 Oct 2017 10:28:18 +0200 Subject: [PATCH 017/240] Expand NEWS entry for jvm stack truncation workaround on Linux. --- NEWS | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 6ca4238..7fd913a 100644 --- a/NEWS +++ b/NEWS @@ -16,8 +16,16 @@ o Process events on Widnows 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) From 1c95cff8cdd71cbff6a3f01dc0935a3d892461f7 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 30 Mar 2018 14:28:54 -0400 Subject: [PATCH 018/240] bump to rJava 0.9-10 --- src/rJava.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rJava.h b/src/rJava.h index 1c8d7c4..7d8c094 100644 --- a/src/rJava.h +++ b/src/rJava.h @@ -1,7 +1,7 @@ #ifndef __RJAVA_H__ #define __RJAVA_H__ -#define RJAVA_VER 0x000909 /* rJava v0.9-9 */ +#define RJAVA_VER 0x00090a /* rJava v0.9-10 */ /* important changes between versions: 3.0 - adds compiler From 7558bfd61aacd03329991ced356fc452258f5807 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 4 Apr 2018 09:40:41 -0400 Subject: [PATCH 019/240] deal with Java 10's lack of javah --- jri/Makefile.all | 2 -- jri/Makefile.in | 1 + jri/configure | 51 +++++++++++++++++++++++++++++++++++++++++++- jri/configure.ac | 39 ++++++++++++++++++++++++++++++++- jri/src/Makefile.all | 5 +---- jri/src/Makefile.in | 1 + 6 files changed, 91 insertions(+), 8 deletions(-) diff --git a/jri/Makefile.all b/jri/Makefile.all index ad56e5e..febd146 100644 --- a/jri/Makefile.all +++ b/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) diff --git a/jri/Makefile.in b/jri/Makefile.in index 7ccbfca..8d806d1 100644 --- a/jri/Makefile.in +++ b/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/configure b/jri/configure index 501cd32..526473e 100755 --- a/jri/configure +++ b/jri/configure @@ -595,6 +595,7 @@ CPICF JNIPREFIX JNISO JNILD +JFLAGS JAVA_CFLAGS JAVA_INC JAVA_LIBS @@ -3429,10 +3430,41 @@ done fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Java version" >&5 +$as_echo_n "checking Java version... " >&6; } +JVER=`"$JAVA" -version 2>&1 | sed -n 's:^java version "::p' | sed 's:".*::'` +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $JVER" >&5 +$as_echo "$JVER" >&6; } + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $JAVAH actually works" >&5 +$as_echo_n "checking whether $JAVAH actually works... " >&6; } +if "$JAVAH" -version >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "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 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether javah was replaced by javac -h" >&5 +$as_echo_n "checking whether javah was replaced by javac -h... " >&6; } + if echo "$JVER" | grep '^1[0-9]' >/dev/null; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ## create headres in the compile step instead + JFLAGS=' -h .' + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "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,6 +3472,22 @@ 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for target flags" >&5 +$as_echo_n "checking for target flags... " >&6; } +## set JFLAGS target -- depends on the JDK version +if echo $JFLAGS | grep '[-]target' >/dev/null; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: user-supplied: $JFLAGS" >&5 +$as_echo "user-supplied: $JFLAGS" >&6; } +else + if echo $JVER | grep '^1\.' >/dev/null; then + JFLAGS="$JFLAGS -target 1.4 -source 1.4" + else + JFLAGS="$JFLAGS -target 1.6 -source 1.6" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JFLAGS" >&5 +$as_echo "$JFLAGS" >&6; } +fi + ## this is where our test-class lives getsp_cp=tools @@ -3858,6 +3906,7 @@ CFLAGS=${origCFLAGS} + ac_config_files="$ac_config_files src/Makefile" diff --git a/jri/configure.ac b/jri/configure.ac index fa8085b..502a2ab 100644 --- a/jri/configure.ac +++ b/jri/configure.ac @@ -107,10 +107,33 @@ 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:^java version "::p' | sed 's:".*::'` +AC_MSG_RESULT([$JVER]) + +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 echo "$JVER" | grep '^1@<:@0-9@:>@' >/dev/null; 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 +141,19 @@ 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 echo $JVER | grep '^1\.' >/dev/null; then + JFLAGS="$JFLAGS -target 1.4 -source 1.4" + else + JFLAGS="$JFLAGS -target 1.6 -source 1.6" + fi + AC_MSG_RESULT([$JFLAGS]) +fi + ## this is where our test-class lives getsp_cp=tools @@ -327,6 +363,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/src/Makefile.all b/jri/src/Makefile.all index 3e9c66f..b8c79f5 100644 --- a/jri/src/Makefile.all +++ b/jri/src/Makefile.all @@ -4,9 +4,6 @@ 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) @@ -14,7 +11,7 @@ JRI.jar: $(JRI_JSRC) $(JNIPREFIX)jri$(JNISO) $(JAR) fc $@ org $(JNIPREFIX)jri$(JNISO) org_rosuda_JRI_Rengine.h: org/rosuda/JRI/Rengine.class - $(JAVAH) -d . -classpath . org.rosuda.JRI.Rengine + if [ -n "$(JAVAH)" ]; then $(JAVAH) -d . -classpath . org.rosuda.JRI.Rengine; fi Rcallbacks.o: Rcallbacks.c Rcallbacks.h globals.h org_rosuda_JRI_Rengine.h $(CC) -c -o $@ $< $(CFLAGS) $(CPICF) $(JAVAINC) $(RINC) diff --git a/jri/src/Makefile.in b/jri/src/Makefile.in index ec91aae..f916892 100644 --- a/jri/src/Makefile.in +++ b/jri/src/Makefile.in @@ -14,6 +14,7 @@ JAVAC=@JAVAC@ JAVAH=@JAVAH@ JAVAINC=@JAVA_INC@ JAR=@JAR@ +JFLAGS=@JFLAGS@ RINC=@RINC@ -I@R_INCLUDE_DIR@ RLD=@RLD@ From c0553e066f354be4660a87550de7346e8436e33d Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 4 Apr 2018 09:42:28 -0400 Subject: [PATCH 020/240] bump to JRI 0.5-6 --- jri/src/jri.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jri/src/jri.h b/jri/src/jri.h index 05dae0f..33f6796 100644 --- a/jri/src/jri.h +++ b/jri/src/jri.h @@ -9,7 +9,7 @@ /* 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 0x0506 /* JRI v0.5-6 */ #define JRI_API 0x010a /* API-version 1.10 */ #ifdef __cplusplus From 90897dff88515052634ae413dd62769a16e7d50d Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 4 Apr 2018 10:19:15 -0400 Subject: [PATCH 021/240] also pre-load libjvm so it works even if Oracle's binary doesn't have a valid ID path --- R/zzz.R.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/R/zzz.R.in b/R/zzz.R.in index eb8aba7..667aadb 100644 --- a/R/zzz.R.in +++ b/R/zzz.R.in @@ -10,8 +10,10 @@ 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"))) + if (file.exists(jvm <- file.path(jh, "lib/server/libjvm.dylib"))) { + dyn.load(jvm, FALSE) ## pre-load libjvm because Oracle's version have broken ID-paths so they cannot be localized Sys.setenv(DYLD_LIBRARY_PATH=paste0(file.path(jh, "lib/server"), dlp)) + } } } library.dynam("rJava", pkgname, libname) From 32777d3a30437a04b2ba1266ae93a2354a250b8c Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 23 Apr 2018 00:58:36 -0400 Subject: [PATCH 022/240] don't require JAVAH anymore as JDK 10+ doesn't supply it (closes #141) --- configure | 2 +- configure.ac | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index b3b95f1..20aad33 100755 --- a/configure +++ b/configure @@ -3703,7 +3703,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 diff --git a/configure.ac b/configure.ac index d7dfb89..ac2fc41 100644 --- a/configure.ac +++ b/configure.ac @@ -176,7 +176,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 From 59672737321ae84cbedfe76bd350c73a02ca4e0f Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 14 May 2018 20:41:10 +0000 Subject: [PATCH 023/240] detect JDKs that don't call themselves Java (such as openjdk) - closes #146 --- jri/configure | 21 +++++++++++++++++++-- jri/configure.ac | 6 +++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/jri/configure b/jri/configure index 526473e..93d884a 100755 --- a/jri/configure +++ b/jri/configure @@ -646,6 +646,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -716,6 +717,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -968,6 +970,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=* \ @@ -1105,7 +1116,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. @@ -1258,6 +1269,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] @@ -3432,10 +3444,15 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking Java version" >&5 $as_echo_n "checking Java version... " >&6; } -JVER=`"$JAVA" -version 2>&1 | sed -n 's:^java version "::p' | sed 's:".*::'` +JVER=`"$JAVA" -version 2>&1 | sed -n 's:^.* version "::p' | sed 's:".*::'` { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JVER" >&5 $as_echo "$JVER" >&6; } +if test -z "$JVER"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: **** Cannot detect Java version - the java -version output is unknown! ****" >&5 +$as_echo "$as_me: WARNING: **** Cannot detect Java version - the java -version output is unknown! ****" >&2;} +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $JAVAH actually works" >&5 $as_echo_n "checking whether $JAVAH actually works... " >&6; } if "$JAVAH" -version >/dev/null 2>&1; then diff --git a/jri/configure.ac b/jri/configure.ac index 502a2ab..b38e2cd 100644 --- a/jri/configure.ac +++ b/jri/configure.ac @@ -108,9 +108,13 @@ AC_PATH_PROGS(JAR,jar,,${JAVA_PATH}) fi AC_MSG_CHECKING([Java version]) -JVER=`"$JAVA" -version 2>&1 | sed -n 's:^java version "::p' | sed 's:".*::'` +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! ****]) +fi + AC_MSG_CHECKING([whether $JAVAH actually works]) if "$JAVAH" -version >/dev/null 2>&1; then AC_MSG_RESULT([yes]) From 32e2fd7fa956fb317eb985443c69744b39782116 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 14 May 2018 16:48:08 -0400 Subject: [PATCH 024/240] Remove rosuda mailing list --- README.md | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 3bf875f..cecb86a 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,7 @@ 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](http://rforge.net) for details. ### Installation @@ -22,12 +21,10 @@ When checking out the sources, you *must* use 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. +since the checkout is not the actual R package but a source to +generate one (which involves compilation of Java code). -### Mailing list and bug reports - -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. +### Bug reports +Please use [rJava GitHub issues page](https://github.com/s-u/rJava/issues) to +report bugs. From e758a4d0e30f9ebb0d40adfcb36da591ba7ce56a Mon Sep 17 00:00:00 2001 From: Tomas Kalibera Date: Wed, 29 Aug 2018 15:19:32 +0200 Subject: [PATCH 025/240] Use Oracle Java 10 option to disable primordial thread guard pages. --- src/init.c | 81 ++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 67 insertions(+), 14 deletions(-) diff --git a/src/init.c b/src/init.c index 091a29e..3131995 100644 --- a/src/init.c +++ b/src/init.c @@ -91,7 +91,13 @@ static void JNICALL exit_hook(int status) { #include #endif -static int initJVM(const char *user_classpath, int opts, char **optv, int hooks) { +/* 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; jint res; char *classpath; @@ -106,14 +112,28 @@ static int initJVM(const char *user_classpath, int opts, char **optv, int hooks) error("JNI 1.2 or higher is required"); 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 + if (disableGuardPages) return -2; +#else + 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 */ + } +#endif /* 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); @@ -138,11 +158,18 @@ static int initJVM(const char *user_classpath, int opts, char **optv, int hooks) vm_options[propNum].optionString = "exit"; vm_options[propNum++].extraInfo = exit_hook; } + if (disableGuardPages) { + vm_options[propNum++].optionString = "-XX:+UnlockExperimentalVMOptions"; + vm_options[propNum++].optionString = "-XX:+DisablePrimordialThreadGuardPages"; + } vm_args.nOptions = propNum; /* Create the Java VM */ res = JNI_CreateJavaVM(&jvm,(void **)&eenv, &vm_args); + if (disableGuardPages && (res != 0 || !eenv)) + return -2; /* perhaps this VM does not allow disabling guard pages */ + if (res != 0) error("Cannot create Java virtual machine (%d)", res); if (!eenv) @@ -176,7 +203,7 @@ static void *initJVMthread(void *classpath) jclass c; JNIEnv *lenv; - thInitResult=initJVM((char*)classpath, jvm_opts, jvm_optv, default_hooks); + thInitResult=initJVM((char*)classpath, jvm_opts, jvm_optv, default_hooks, 0); if (thInitResult) return 0; init_rJava(); @@ -254,8 +281,11 @@ 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); @@ -352,7 +382,13 @@ static SEXP RinitJVM_real(SEXP par) 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 +426,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 @@ -507,7 +548,7 @@ static SEXP RinitJVM_with_padding(SEXP par, intptr_t padding, char *last) { 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); } @@ -527,6 +568,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 +576,29 @@ 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)); + 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; @@ -667,7 +720,7 @@ 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 From 4dc000b4daf65a2690419962c028a74e3ead697b Mon Sep 17 00:00:00 2001 From: Dominik Ernst Date: Tue, 13 Nov 2018 13:52:10 +0100 Subject: [PATCH 026/240] fix HAVE_XRS detection --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index ac2fc41..23cc4ec 100644 --- a/configure.ac +++ b/configure.ac @@ -235,7 +235,7 @@ 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 From 0e55a0605942970d15f5fcdade661a6070c2b6a5 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 25 Mar 2019 17:37:24 -0400 Subject: [PATCH 027/240] bump version to 0.9-11 --- src/rJava.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rJava.h b/src/rJava.h index 7d8c094..073dd9d 100644 --- a/src/rJava.h +++ b/src/rJava.h @@ -1,7 +1,7 @@ #ifndef __RJAVA_H__ #define __RJAVA_H__ -#define RJAVA_VER 0x00090a /* rJava v0.9-10 */ +#define RJAVA_VER 0x00090b /* rJava v0.9-11 */ /* important changes between versions: 3.0 - adds compiler From 8309a3f38c855855b50a65d01b26f22a695e9102 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 25 Mar 2019 17:39:06 -0400 Subject: [PATCH 028/240] minor cleanup of autoconf tests; detect major Java version and bump -target to 1.8 from 12 on (closes #174) --- configure | 58 ++++++++++++++++++++++++++++++++++++++++++++---- configure.ac | 32 +++++++++++++++++--------- jri/configure | 31 ++++++++++++++++++++++---- jri/configure.ac | 39 ++++++++++++++++++++++---------- 4 files changed, 130 insertions(+), 30 deletions(-) diff --git a/configure b/configure index 20aad33..88358f1 100755 --- a/configure +++ b/configure @@ -664,6 +664,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -742,6 +743,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -994,6 +996,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=* \ @@ -1131,7 +1142,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. @@ -1284,6 +1295,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] @@ -2205,6 +2217,12 @@ 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' @@ -3581,6 +3599,7 @@ 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 : can_inline=yes @@ -3770,7 +3789,7 @@ fi $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 +if test x"$has_xrs" = xyes; then $as_echo "#define HAVE_XRS 1" >>confdefs.h @@ -3802,8 +3821,8 @@ fi rm -f core conftest.err conftest.$ac_objext \ 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; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether JNI programs run" >&5 +$as_echo_n "checking whether JNI programs run... " >&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; } @@ -3811,6 +3830,36 @@ else 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 : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + 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 +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +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;} +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 +/* end confdefs.h. */ + #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; @@ -3828,6 +3877,7 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ 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; } diff --git a/configure.ac b/configure.ac index 23cc4ec..8ee172b 100644 --- a/configure.ac +++ b/configure.ac @@ -89,6 +89,7 @@ AC_ARG_ENABLE([callbacks], # Checks for programs. +AC_LANG(C) AC_PROG_CC # Checks for libraries. @@ -104,13 +105,14 @@ AC_HEADER_TIME AC_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 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]) @@ -240,31 +242,41 @@ if test x"$has_xrs" = xyes; then fi 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)]) diff --git a/jri/configure b/jri/configure index 93d884a..d6ba56a 100755 --- a/jri/configure +++ b/jri/configure @@ -2065,6 +2065,12 @@ 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' @@ -3451,6 +3457,17 @@ $as_echo "$JVER" >&6; } if test -z "$JVER"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: **** Cannot detect Java version - the java -version output is unknown! ****" >&5 $as_echo "$as_me: WARNING: **** Cannot detect Java version - the java -version output is unknown! ****" >&2;} +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking Java compatibility version (integer)" >&5 +$as_echo_n "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 '^[0-9]\.' >/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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JMVER" >&5 +$as_echo "$JMVER" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $JAVAH actually works" >&5 @@ -3469,7 +3486,7 @@ have_all_java=yes if test -z "$JAVAH"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether javah was replaced by javac -h" >&5 $as_echo_n "checking whether javah was replaced by javac -h... " >&6; } - if echo "$JVER" | grep '^1[0-9]' >/dev/null; then + if test "$JMVER" -gt 9; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } ## create headres in the compile step instead @@ -3496,10 +3513,14 @@ if echo $JFLAGS | grep '[-]target' >/dev/null; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: user-supplied: $JFLAGS" >&5 $as_echo "user-supplied: $JFLAGS" >&6; } else - if echo $JVER | grep '^1\.' >/dev/null; then + if test "$JMVER" -lt 9; then JFLAGS="$JFLAGS -target 1.4 -source 1.4" else - JFLAGS="$JFLAGS -target 1.6 -source 1.6" + 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JFLAGS" >&5 $as_echo "$JFLAGS" >&6; } @@ -3779,7 +3800,9 @@ 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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "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 fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext diff --git a/jri/configure.ac b/jri/configure.ac index b38e2cd..0ce28e9 100644 --- a/jri/configure.ac +++ b/jri/configure.ac @@ -63,6 +63,7 @@ AC_SUBST(R_SHARE_DIR) AC_SUBST(R_DOC_DIR) AC_SUBST(R_INCLUDE_DIR) +AC_LANG(C) AC_PROG_CC AC_HEADER_STDC @@ -113,6 +114,15 @@ 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 '^[[0-9]]\.' >/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 + AC_MSG_RESULT([$JMVER]) fi AC_MSG_CHECKING([whether $JAVAH actually works]) @@ -127,7 +137,7 @@ 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 echo "$JVER" | grep '^1@<:@0-9@:>@' >/dev/null; then + if test "$JMVER" -gt 9; then AC_MSG_RESULT([yes]) ## create headres in the compile step instead JFLAGS=' -h .' @@ -150,10 +160,14 @@ AC_MSG_CHECKING([for target flags]) if echo $JFLAGS | grep '[[-]]target' >/dev/null; then AC_MSG_RESULT([user-supplied: $JFLAGS]) else - if echo $JVER | grep '^1\.' >/dev/null; then + if test "$JMVER" -lt 9; then JFLAGS="$JFLAGS -target 1.4 -source 1.4" else - JFLAGS="$JFLAGS -target 1.6 -source 1.6" + 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 @@ -260,27 +274,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([[ @@ -335,25 +350,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)]) From 66ce395581fa2e62e9280b704d505e980ff66c7b Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Tue, 26 Mar 2019 17:04:14 -0400 Subject: [PATCH 029/240] define JNI_VERSION_10 in case it doesn't exist --- src/init.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/init.c b/src/init.c index 3131995..98a0a98 100644 --- a/src/init.c +++ b/src/init.c @@ -118,16 +118,18 @@ static int initJVM(const char *user_classpath, int opts, char **optv, int hooks, /* quick pre-check whether there is a chance that primordial thread guard pages may be disabled */ #ifndef JNI_VERSION_10 - if (disableGuardPages) return -2; -#else + /* 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 */ } -#endif - + /* leave room for class.path, and optional jni args */ total_num_properties = 8 + opts; From 99893039283db55a40a33a5bb03c1eaa6267b664 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Tue, 26 Mar 2019 18:25:59 -0400 Subject: [PATCH 030/240] avoid a crash when Java exception is raised during rJava initialization (see also #175) --- src/rJava.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/rJava.c b/src/rJava.c index 9843a21..ac6dbbc 100644 --- a/src/rJava.c +++ b/src/rJava.c @@ -118,10 +118,14 @@ HIDE void ckx(JNIEnv *env) { /* 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); + if (!rj_RJavaTools_Class) { + REprintf("ERROR: Java exception occurred during rJava bootstrap:\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 = rj_RJavaTools_Class ? PROTECT( getSimpleClassNames_asSEXP( (jobject)x, (jboolean)1 ) ) : R_NilValue; /* ok, now this is a critical part that we do manually to avoid recursion */ { From 7c5f7601c9ddd381e1d99da9676b77cbba938f1d Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 27 Mar 2019 10:47:53 -0400 Subject: [PATCH 031/240] don't fail on Windows if JavaHome is present in the registry but RuntimeLib is not (closes #163) --- R/windows/FirstLib.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/windows/FirstLib.R b/R/windows/FirstLib.R index 09694b4..d5d0dc6 100755 --- a/R/windows/FirstLib.R +++ b/R/windows/FirstLib.R @@ -23,7 +23,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") From ab177a1d46c9cfb0405703c738f5634cd2f0eb68 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 27 Mar 2019 11:30:05 -0400 Subject: [PATCH 032/240] remove run-time LD_LIBRARY_PATH falback as it wasn't ever working anyway (closes #129) --- R/zzz.R.in | 1 - 1 file changed, 1 deletion(-) diff --git a/R/zzz.R.in b/R/zzz.R.in index 667aadb..2b8dc94 100644 --- a/R/zzz.R.in +++ b/R/zzz.R.in @@ -1,5 +1,4 @@ .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")) { From c4200e013cf435506a23fd2f73d838e4f362a523 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 27 Mar 2019 11:49:00 -0400 Subject: [PATCH 033/240] update findjava.exe to also detect newer form of JDK/JRE registry entries --- jri/src/win32/findjava.c | 24 ++++++++++++++++-------- src/jvm-w32/findjava.c | 37 ++++++++++++++++++++++++++++++------- 2 files changed, 46 insertions(+), 15 deletions(-) diff --git a/jri/src/win32/findjava.c b/jri/src/win32/findjava.c index 6c84158..d64c306 100644 --- a/jri/src/win32/findjava.c +++ b/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/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; From 60bb76b43bf7c06c469c84132df3aefd29b648e4 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 27 Mar 2019 14:03:10 -0400 Subject: [PATCH 034/240] Windows: auto-detect the absence of javah and use java -h . instead --- jri/Makevars.win | 1 - jri/configure.win | 8 ++++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/jri/Makevars.win b/jri/Makevars.win index 24a7a15..64047b5 100644 --- a/jri/Makevars.win +++ b/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/configure.win b/jri/configure.win index 40ed696..48da174 100644 --- a/jri/configure.win +++ b/jri/configure.win @@ -35,6 +35,14 @@ 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' + echo 'JFLAGS=-h .' >> src/Makefile.wconf +fi + echo "Creating Makefiles ..." cp Makefile.win Makefile cp src/Makefile.win src/Makefile From 10ba3750d8026a914c06935568ac181119c983f3 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 27 Mar 2019 14:32:37 -0400 Subject: [PATCH 035/240] disable JSW woraroud if attaching to existing JVM (closes #130) --- src/init.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/init.c b/src/init.c index 98a0a98..5ce5f66 100644 --- a/src/init.c +++ b/src/init.c @@ -589,6 +589,17 @@ static SEXP RinitJVM_jsw(SEXP par) { _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); From b93b13006ac1a417c0314b0a62ab92b5a1446e97 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 27 Mar 2019 16:07:23 -0400 Subject: [PATCH 036/240] silence false-positive warnings --- jri/src/Rinit.c | 1 + jri/src/jri.c | 4 ++-- jri/src/jri.h | 14 +++++--------- src/jri_glue.c | 2 +- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/jri/src/Rinit.c b/jri/src/Rinit.c index 9caf7d4..da1547f 100644 --- a/jri/src/Rinit.c +++ b/jri/src/Rinit.c @@ -101,6 +101,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 */ diff --git a/jri/src/jri.c b/jri/src/jri.c index 3913c07..f4b3926 100644 --- a/jri/src/jri.c +++ b/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/jri/src/jri.h index 33f6796..ffae8a1 100644 --- a/jri/src/jri.h +++ b/jri/src/jri.h @@ -15,15 +15,11 @@ #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_glue.c b/src/jri_glue.c index c3e74d4..85eab0d 100644 --- a/src/jri_glue.c +++ b/src/jri_glue.c @@ -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 { From 06ec62eb5dda8b78077148e4dd1e489688e5f82e Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 27 Mar 2019 16:08:48 -0400 Subject: [PATCH 037/240] fix omegahat URL --- man/javaImport.Rd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/javaImport.Rd b/man/javaImport.Rd index cdee869..0a1c321 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{http://www.omegahat.net/RObjectTables/} } \author{ Romain Francois From 656173fdc36b912d7f11079f034a49b453d5a27a Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 27 Mar 2019 16:39:48 -0400 Subject: [PATCH 038/240] update NEWS --- NEWS | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/NEWS b/NEWS index 7fd913a..efea9ee 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,45 @@ NEWS/ChangeLog for rJava -------------------------- +************* Java 12 has broken JNI support and cannot be used! It has +** WARNING ** has been reported and will likely be fixed in future +************* versions of Java, but for now do NOT upgrade to Java 12! + (see #175 for details) + + +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) + + o Windows: fix build if javah.exe is missing (#157) + + o Windows: fix build if javah.exe is missing (#157) + + +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 From 447d28e890c05975a8a32163b59adc203ed20880 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 27 Mar 2019 16:54:15 -0400 Subject: [PATCH 039/240] add Java 12 warning if we encounter and exception during bootstrap --- src/rJava.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/rJava.c b/src/rJava.c index ac6dbbc..d8e83a7 100644 --- a/src/rJava.c +++ b/src/rJava.c @@ -119,7 +119,8 @@ HIDE void ckx(JNIEnv *env) { yet this can be (also in theory) risky as it uses further JNI calls ... */ xobj = j2SEXP(env, x, 0); if (!rj_RJavaTools_Class) { - REprintf("ERROR: Java exception occurred during rJava bootstrap:\n"); + /* temporary warning due the JDK 12 breakage */ + REprintf("WARNING: Initial Java 12 release has broken JNI support and does NOT work. Use stable Java 11 (or watch for 12u if avaiable).\nERROR: Java exception occurred during rJava bootstrap - see stderr for Java stack trace.\n"); (*env)->ExceptionDescribe(env); } (*env)->ExceptionClear(env); From 43ff22b72580d0b4c53c18770bb65594f032e89a Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 27 Mar 2019 23:20:48 -0400 Subject: [PATCH 040/240] bump version to 0.9-12 --- src/rJava.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rJava.h b/src/rJava.h index 073dd9d..355de03 100644 --- a/src/rJava.h +++ b/src/rJava.h @@ -1,7 +1,7 @@ #ifndef __RJAVA_H__ #define __RJAVA_H__ -#define RJAVA_VER 0x00090b /* rJava v0.9-11 */ +#define RJAVA_VER 0x00090c /* rJava v0.9-12 */ /* important changes between versions: 3.0 - adds compiler From 49ab90342274b071bc8a91377afe7c88edbcbd50 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 27 Mar 2019 23:21:08 -0400 Subject: [PATCH 041/240] do not mangle class name for static .jfield() calls since it breaks non-loader lookup --- src/fields.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/fields.c b/src/fields.c index 8bfdd0c..b0e93e5 100644 --- a/src/fields.c +++ b/src/fields.c @@ -103,7 +103,6 @@ REPC SEXP RgetField(SEXP obj, SEXP sig, SEXP name, SEXP trueclass) { cls = objectClass(env, o); else { char *c = clnam; - while(*c) { if (*c=='/') *c='.'; c++; } cls = findClass(env, clnam, oClassLoader); free(clnam); if (!cls) { From 6c82332ab6efec277761377a34a2eacf398e192c Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 27 Mar 2019 23:21:26 -0400 Subject: [PATCH 042/240] use .jfield() instead of reflection in bootstrap so we can defer the death on Java 12 (helps with #175 at least in .jinit()) --- R/jinit.R | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/R/jinit.R b/R/jinit.R index fef2d75..4b9ba93 100644 --- a/R/jinit.R +++ b/R/jinit.R @@ -85,21 +85,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") From 53740b94416a3e469bacfe0a5339778ed3d7b072 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Thu, 28 Mar 2019 10:11:09 -0400 Subject: [PATCH 043/240] update NEWS --- NEWS | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index efea9ee..b4f42bd 100644 --- a/NEWS +++ b/NEWS @@ -1,10 +1,13 @@ NEWS/ChangeLog for rJava -------------------------- -************* Java 12 has broken JNI support and cannot be used! It has -** WARNING ** has been reported and will likely be fixed in future -************* versions of Java, but for now do NOT upgrade to Java 12! - (see #175 for details) +0.9-12 (under development) + o fix a bug in .jfield() which prevented accessing static fields + if rJava class loader was not present yet (only affected + initialization). + + o modify boostrap to avoid reflection calls which are broken in + Java 12 (see #175 and https://bugs.openjdk.java.net/browse/JDK-8221530). 0.9-11 2019-03-27 From 64c6601e6d6594097852e583927acebc6ef27571 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Thu, 11 Apr 2019 15:00:36 -0400 Subject: [PATCH 044/240] use eval(sys.calls(), R_GetCurrentEnv()) in R 3.6.0 and higher instead of context hacks --- src/rJava.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/rJava.c b/src/rJava.c index d8e83a7..deef799 100644 --- a/src/rJava.c +++ b/src/rJava.c @@ -12,7 +12,24 @@ int use_eenv = 1; JNIEnv *eenv; /* -- hack to get at the current call from C code using contexts */ -#if ( R_VERSION >= R_Version(1, 7, 0) ) +#if ( R_VERSION >= R_Version(3, 6, 0) ) + +static SEXP getCurrentCall() { + 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; */ +} + +#elif ( R_VERSION >= R_Version(1, 7, 0) ) #include /* stuff we need to pull for Windows... */ From 0c5526d4f2917575c1a1646691fff858a1fb0b8d Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Thu, 11 Apr 2019 16:07:24 -0400 Subject: [PATCH 045/240] cleanup NEWS --- NEWS | 4 ---- 1 file changed, 4 deletions(-) diff --git a/NEWS b/NEWS index b4f42bd..dc77fda 100644 --- a/NEWS +++ b/NEWS @@ -28,10 +28,6 @@ o Windows: don't fail if `RuntimeLib` registry entry is missing (#163) - o Windows: fix build if javah.exe is missing (#157) - - o Windows: fix build if javah.exe is missing (#157) - 0.9-10 2018-05-29 o support builds with JDKs that are missing javah (#141) From 53accf829a81383acc142a55ba4d462e321aca06 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Tue, 30 Apr 2019 14:13:58 -0400 Subject: [PATCH 046/240] add .jgc() - closes #180 --- NEWS | 2 ++ R/gc.R | 4 ++++ man/jgc.Rd | 25 +++++++++++++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 R/gc.R create mode 100644 man/jgc.Rd diff --git a/NEWS b/NEWS index dc77fda..b6b7c5d 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,8 @@ o modify boostrap 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) + 0.9-11 2019-03-27 o fix segfault if en exception is thrown during rJava initialization 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/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} From a4f5c6cf6ecb9182b1cb16bc8ea01f42d49de252 Mon Sep 17 00:00:00 2001 From: Peter Meissner Date: Thu, 27 Feb 2020 07:14:24 +0100 Subject: [PATCH 047/240] typo --- jri/Rengine.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jri/Rengine.java b/jri/Rengine.java index a846132..8c75caf 100644 --- a/jri/Rengine.java +++ b/jri/Rengine.java @@ -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 */ From 7e91fdb8ff111822810a4335c3f69755e744f049 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Sat, 21 Mar 2020 14:26:07 +1300 Subject: [PATCH 048/240] add --enable-dynload option and re-work JVM detection on macOS --- NEWS | 13 +++++++++ R/zzz.R.in | 70 +++++++++++++++++++++++++++++++++++-------------- configure | 55 +++++++++++++++++++++++++++++--------- configure.ac | 22 ++++++++++++++++ src/Makevars.in | 2 +- 5 files changed, 129 insertions(+), 33 deletions(-) diff --git a/NEWS b/NEWS index b6b7c5d..33a38cf 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,19 @@ -------------------------- 0.9-12 (under development) + 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/libsexec/java_home (if JAVA_HOME is not set) + Find ${JAVA_HOME}[/jre]/lib/server/libjvm.{so|dylib} + If not found, Java cannot be loaded. + o fix a bug in .jfield() which prevented accessing static fields if rJava class loader was not present yet (only affected initialization). diff --git a/R/zzz.R.in b/R/zzz.R.in index 2b8dc94..93d0643 100644 --- a/R/zzz.R.in +++ b/R/zzz.R.in @@ -1,21 +1,53 @@ .onLoad <- function(libname, pkgname) { - ## 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(jvm <- file.path(jh, "lib/server/libjvm.dylib"))) { - dyn.load(jvm, FALSE) ## pre-load libjvm because Oracle's version have broken ID-paths so they cannot be localized - 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/configure b/configure index 88358f1..a60f15f 100755 --- a/configure +++ b/configure @@ -634,6 +634,8 @@ JAVA_CPPFLAGS JAVA_LIBS WANT_JRI_FALSE WANT_JRI_TRUE +USE_DYNLOAD_FALSE +USE_DYNLOAD_TRUE EGREP GREP CPP @@ -664,7 +666,6 @@ infodir docdir oldincludedir includedir -runstatedir localstatedir sharedstatedir sysconfdir @@ -692,6 +693,7 @@ enable_jni_cache enable_jri enable_headless enable_Xrs +enable_dynload enable_debug enable_mem_profile enable_callbacks @@ -743,7 +745,6 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' -runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -996,15 +997,6 @@ 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=* \ @@ -1142,7 +1134,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 runstatedir + libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1295,7 +1287,6 @@ 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] @@ -1343,6 +1334,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. @@ -2188,6 +2180,15 @@ else fi +## enable dynloaded JVM +# Check whether --enable-dynload was given. +if test "${enable_dynload+set}" = set; then : + enableval=$enable_dynload; want_dynload="${enableval}" +else + want_dynload=auto +fi + + ## enable debug flags # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then : @@ -3795,6 +3796,30 @@ $as_echo "#define HAVE_XRS 1" >>confdefs.h 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether JVM will be loaded dynamically" >&5 +$as_echo_n "checking whether JVM will be loaded dynamically... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${use_dynload}" >&5 +$as_echo "${use_dynload}" >&6; } + if test "x${use_dynload}" = xyes; then + USE_DYNLOAD_TRUE= + USE_DYNLOAD_FALSE='#' +else + USE_DYNLOAD_TRUE='#' + USE_DYNLOAD_FALSE= +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; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4161,6 +4186,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 diff --git a/configure.ac b/configure.ac index 8ee172b..d374296 100644 --- a/configure.ac +++ b/configure.ac @@ -66,6 +66,13 @@ AC_ARG_ENABLE([Xrs], [want_xrs="${enableval}"], [want_xrs=auto]) +## enable dynloaded JVM +AC_ARG_ENABLE([dynload], +[AC_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], @@ -241,6 +248,21 @@ 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([[ #include diff --git a/src/Makevars.in b/src/Makevars.in index e87396c..e911ddc 100644 --- a/src/Makevars.in +++ b/src/Makevars.in @@ -1,6 +1,6 @@ # 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 From 2f8ea8d190751974d423343c98ac61c3e06ff535 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Sat, 21 Mar 2020 14:32:07 +1300 Subject: [PATCH 049/240] remove R CMD config CPP from jri --- jri/configure | 18 +++--------------- jri/configure.ac | 4 ++-- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/jri/configure b/jri/configure index d6ba56a..5d05dbc 100755 --- a/jri/configure +++ b/jri/configure @@ -646,7 +646,6 @@ infodir docdir oldincludedir includedir -runstatedir localstatedir sharedstatedir sysconfdir @@ -717,7 +716,6 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' -runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -970,15 +968,6 @@ 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=* \ @@ -1116,7 +1105,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 runstatedir + libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1269,7 +1258,6 @@ 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] @@ -2017,10 +2005,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 diff --git a/jri/configure.ac b/jri/configure.ac index 0ce28e9..4ee4e4f 100644 --- a/jri/configure.ac +++ b/jri/configure.ac @@ -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 From d5ea7e7b8d4aa9c5b616483088ee52076fa23057 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Sat, 21 Mar 2020 15:28:27 +1300 Subject: [PATCH 050/240] convert class names to JNI notation when constructing method signatures (closes #81) --- src/Rglue.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Rglue.c b/src/Rglue.c index 2246680..09b941a 100644 --- a/src/Rglue.c +++ b/src/Rglue.c @@ -198,6 +198,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; @@ -375,9 +387,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; From 0865c5d3f0a56e83fdbfaf7ea93a825c5db1449a Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Sat, 21 Mar 2020 15:29:11 +1300 Subject: [PATCH 051/240] update NEWS --- NEWS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS b/NEWS index 33a38cf..5a64f75 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,9 @@ Find ${JAVA_HOME}[/jre]/lib/server/libjvm.{so|dylib} If not found, Java cannot be loaded. + 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). From ea7d5fe64a2e29005d5a95b2902527eac8ed1d17 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 23 Mar 2020 12:42:10 +1300 Subject: [PATCH 052/240] move old tests in preparation for real tests --- tests/{ => old}/Leaks.java | 0 tests/{ => old}/Makefile | 0 tests/{ => old}/Types.java | 0 tests/{ => old}/leaks.R | 0 tests/{ => old}/types.R | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename tests/{ => old}/Leaks.java (100%) rename tests/{ => old}/Makefile (100%) rename tests/{ => old}/Types.java (100%) rename tests/{ => old}/leaks.R (100%) rename tests/{ => old}/types.R (100%) 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/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 100% rename from tests/leaks.R rename to tests/old/leaks.R 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 From 15d9a94a6dd114baf9a2835ae104982fd25d89cd Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 23 Mar 2020 12:42:40 +1300 Subject: [PATCH 053/240] fix how .jfields() and .jmethods() gets and filters output - it is now an actual regexp (closes #212 and #213) --- R/reflection.R | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/R/reflection.R b/R/reflection.R index c8f9ef6..fa8e39c 100644 --- a/R/reflection.R +++ b/R/reflection.R @@ -7,12 +7,11 @@ .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)) 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) { @@ -191,9 +190,12 @@ .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)) 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){ From d959d8797075c98bd554371316ed2ac867817ecf Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 23 Mar 2020 12:45:51 +1300 Subject: [PATCH 054/240] update docs --- man/jreflection.Rd | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/man/jreflection.Rd b/man/jreflection.Rd index 7d3b060..5af01e1 100644 --- a/man/jreflection.Rd +++ b/man/jreflection.Rd @@ -20,8 +20,7 @@ \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).} @@ -29,13 +28,15 @@ \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{ From 33f82d2992e7c24a7a46fb83bc22406d22df1732 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 23 Mar 2020 12:50:09 +1300 Subject: [PATCH 055/240] update NEWS --- NEWS | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/NEWS b/NEWS index 5a64f75..6f3b068 100644 --- a/NEWS +++ b/NEWS @@ -27,6 +27,12 @@ o added .jgc() to run JVM garbage collector (#180) + o fix filtered .jfields() to return actual values (#213) + + o .jfields() and .methods() 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 From 6e1176964e5b7e7cd1fe411375788b24551a68c1 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 23 Mar 2020 13:15:53 +1300 Subject: [PATCH 056/240] win32: check validity of JAVA_HOME and ignore if not valid (closes #209) --- R/windows/FirstLib.R | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/R/windows/FirstLib.R b/R/windows/FirstLib.R index d5d0dc6..99c84f0 100755 --- a/R/windows/FirstLib.R +++ b/R/windows/FirstLib.R @@ -2,7 +2,13 @@ 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)) { + message("java.home option: ", getOption("java.home")) + message("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( From 16d0164c765c801c534419e47893fea45c5e40d5 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 23 Mar 2020 13:16:04 +1300 Subject: [PATCH 057/240] update NEWS --- NEWS | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 6f3b068..e4e3204 100644 --- a/NEWS +++ b/NEWS @@ -11,10 +11,16 @@ The default initialization uses the following order to find JVM at run-time: - use JAVA_HOME (typically set by R CMD javareconf) - - call /usr/libsexec/java_home (if JAVA_HOME is not set) + - 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), 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) @@ -29,7 +35,7 @@ o fix filtered .jfields() to return actual values (#213) - o .jfields() and .methods() now correctly filter results even for + 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'. From 43df77fc65b35628f8b25554975bc4bcbff062eb Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 23 Mar 2020 14:02:36 +1300 Subject: [PATCH 058/240] update NEWS --- NEWS | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index e4e3204..74bafa9 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,7 @@ NEWS/ChangeLog for rJava -------------------------- -0.9-12 (under development) +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, @@ -18,8 +18,8 @@ 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), it is assumed to be "" - and thus the search continues in the registry. + 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) From 4001a98e01475530f48501edb2022f91996f9aaf Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Sun, 17 May 2020 09:32:29 +1200 Subject: [PATCH 059/240] bump version to 0.9-13 --- src/rJava.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rJava.h b/src/rJava.h index 355de03..23a8143 100644 --- a/src/rJava.h +++ b/src/rJava.h @@ -1,7 +1,7 @@ #ifndef __RJAVA_H__ #define __RJAVA_H__ -#define RJAVA_VER 0x00090c /* rJava v0.9-12 */ +#define RJAVA_VER 0x00090d /* rJava v0.9-13 */ /* important changes between versions: 3.0 - adds compiler From 6a055e090bf64234194413874463182d5098116e Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 20 May 2020 08:54:07 +1200 Subject: [PATCH 060/240] register missing native entry points (closes #221) --- R/call.R | 6 +++--- R/import.R | 4 +--- R/jfirst.R | 4 ++-- R/jinit.R | 4 ++-- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/R/call.R b/R/call.R index 9ffcc20..a1733a4 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 ) ) } 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..71f25a4 100644 --- a/R/jfirst.R +++ b/R/jfirst.R @@ -21,9 +21,9 @@ "RgetLongArrayCont", "RgetNullReference", "RgetObjectArrayCont", "RgetShortArrayCont", "RgetStringArrayCont", "RidenticalRef", "RisAssignableFrom", "RpollException", "RsetField", "RthrowException", - "javaObjectCache", + "javaObjectCache", "initRJavaTools", "newRJavaLookupTable", # .External - "RcreateObject", "RgetStringValue", "RinitJVM", "RtoString", + "RcreateObject", "RgetStringValue", "RinitJVM", "RtoString", "RcallMethod", # .C "RclearException", "RuseJNICache" ) diff --git a/R/jinit.R b/R/jinit.R index 4b9ba93..f560d16 100644 --- a/R/jinit.R +++ b/R/jinit.R @@ -157,9 +157,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") ) From 10a6962bf92434d2bb6ec7e4fa8539be3d0e41a9 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 20 May 2020 08:57:43 +1200 Subject: [PATCH 061/240] update NEWS --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index 74bafa9..9ef2b22 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,10 @@ NEWS/ChangeLog for rJava -------------------------- +0.9-13 (under development) + o add missing C entry points to the symbol cache. (#221) + + 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 From f1e362e0e1c49f05c6c99b64a2ec1fa5a3866ab4 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 20 May 2020 09:29:45 +1200 Subject: [PATCH 062/240] silence message NOTE since this is used only in the warning() path --- R/windows/FirstLib.R | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/R/windows/FirstLib.R b/R/windows/FirstLib.R index 99c84f0..2c0da98 100755 --- a/R/windows/FirstLib.R +++ b/R/windows/FirstLib.R @@ -1,10 +1,12 @@ +.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 (nzchar(javahome) && !dir.exists(javahome)) { - message("java.home option: ", getOption("java.home")) - message("JAVA_HOME environment variable: ", Sys.getenv("JAVA_HOME")) + .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 <- "" } From 685ab515d47d2876f2a438e5ae32b64c42230ed9 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 20 May 2020 09:33:58 +1200 Subject: [PATCH 063/240] disable dynamic symbol lookup to rat out any unregistered legacy symbols --- R/jfirst.R | 9 +++++++-- src/registration.c | 25 +++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 src/registration.c diff --git a/R/jfirst.R b/R/jfirst.R index 71f25a4..9bebc3d 100644 --- a/R/jfirst.R +++ b/R/jfirst.R @@ -19,9 +19,9 @@ "RcreateArray", "RgetBoolArrayCont", "RgetByteArrayCont", "RgetCharArrayCont", "RgetDoubleArrayCont", "RgetField", "RgetFloatArrayCont", "RgetIntArrayCont", "RgetLongArrayCont", "RgetNullReference", "RgetObjectArrayCont", - "RgetShortArrayCont", "RgetStringArrayCont", "RidenticalRef", + "RgetShortArrayCont", "RgetStringArrayCont", "RidenticalRef", "RgetSimpleClassNames", "RisAssignableFrom", "RpollException", "RsetField", "RthrowException", - "javaObjectCache", "initRJavaTools", "newRJavaLookupTable", + "javaObjectCache", "initRJavaTools", "newRJavaLookupTable", "useDynamicSymbols", # .External "RcreateObject", "RgetStringValue", "RinitJVM", "RtoString", "RcallMethod", # .C @@ -34,6 +34,11 @@ 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) diff --git a/src/registration.c b/src/registration.c new file mode 100644 index 0000000..38f2302 --- /dev/null +++ b/src/registration.c @@ -0,0 +1,25 @@ +#include +#include + +/* only to avoid NOTEs from broken checks, + never called */ +int dummy__() { + 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_; +} From 508d049d8639d6c3370d1fd9253ca054e43c413a Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 20 May 2020 09:34:33 +1200 Subject: [PATCH 064/240] test suite was using one more unregistered call --- man/java-tools.Rd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 ) ) } From bb5a78c6b9ba7ef8b34eba94cc139e699cf3dc05 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 20 May 2020 09:46:24 +1200 Subject: [PATCH 065/240] remove supporting files from top level into tools --- configure | 62 +++++++++++++++---------------- configure.ac | 5 ++- mkdist | 10 ++--- getsp.class => tools/getsp.class | Bin getsp.java => tools/getsp.java | 0 install-sh => tools/install-sh | 0 6 files changed, 39 insertions(+), 38 deletions(-) rename getsp.class => tools/getsp.class (100%) rename getsp.java => tools/getsp.java (100%) rename install-sh => tools/install-sh (100%) diff --git a/configure b/configure index a60f15f..4858bc3 100755 --- a/configure +++ b/configure @@ -2116,6 +2116,35 @@ 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. + + # find R home and set CC/CFLAGS : ${R_HOME=`R RHOME`} @@ -3764,7 +3793,7 @@ 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 +if "$JAVA" -classpath tools getsp; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else @@ -3777,7 +3806,7 @@ 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 + if "$JAVA" -Xrs -classpath tools getsp; then has_xrs=yes else has_xrs=no @@ -4035,35 +4064,6 @@ $as_echo "yes" >&6; } 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" diff --git a/configure.ac b/configure.ac index d374296..a943dc0 100644 --- a/configure.ac +++ b/configure.ac @@ -2,6 +2,7 @@ AC_INIT(rJava, 0.8, Simon.Urbanek@r-project.org) AC_CONFIG_SRCDIR([src/rJava.c]) AC_CONFIG_HEADER([src/config.h]) +AC_CONFIG_AUX_DIR([tools]) # find R home and set CC/CFLAGS : ${R_HOME=`R RHOME`} @@ -224,7 +225,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) @@ -234,7 +235,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 diff --git a/mkdist b/mkdist index 9466475..c3ce7d0 100644 --- a/mkdist +++ b/mkdist @@ -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 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,12 +60,12 @@ 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 ..." 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 From d1192ef209f5de2f05d8d77b164f8848c85508af Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 20 May 2020 09:51:04 +1200 Subject: [PATCH 066/240] remove from the final tar ball --- NEWS | 3 +++ mkdist | 1 + 2 files changed, 4 insertions(+) diff --git a/NEWS b/NEWS index 9ef2b22..609d800 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,9 @@ 0.9-13 (under development) 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 diff --git a/mkdist b/mkdist index c3ce7d0..79e346f 100644 --- a/mkdist +++ b/mkdist @@ -193,6 +193,7 @@ echo "Creating package ..." cd .. rm -f `find rJava -name ._\*` rm -rf rJava/.git rJava/jri/REngine/.git +rm -f version R CMD build rJava cd ${SWD} cp /tmp/rJava_${VER}.tar.gz .. From 21930e538945ccd0a9c6ff89bb07a98f54215200 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 20 May 2020 10:00:15 +1200 Subject: [PATCH 067/240] CRAN tests dont-test sections so convert .jmemprof error into a message --- man/jmemprof.Rd | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/man/jmemprof.Rd b/man/jmemprof.Rd index 9f0857b..35f8658 100644 --- a/man/jmemprof.Rd +++ b/man/jmemprof.Rd @@ -40,8 +40,9 @@ 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} From 8f62c2824dc626b4f8261a6e1c541472e1f00558 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 20 May 2020 10:04:33 +1200 Subject: [PATCH 068/240] fix `version` removal --- mkdist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkdist b/mkdist index 79e346f..b5f2b8b 100644 --- a/mkdist +++ b/mkdist @@ -193,7 +193,7 @@ echo "Creating package ..." cd .. rm -f `find rJava -name ._\*` rm -rf rJava/.git rJava/jri/REngine/.git -rm -f version +rm -f rJava/version R CMD build rJava cd ${SWD} cp /tmp/rJava_${VER}.tar.gz .. From 99d78ff4e36b3f6b64939718f857236b6fd84f6a Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Thu, 2 Jul 2020 23:08:04 +0000 Subject: [PATCH 069/240] add -Xss2m to java parameters unless -Xss is already specified to guaranee minimal stack size (#224) --- src/init.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/init.c b/src/init.c index 5ce5f66..9c2ee4b 100644 --- a/src/init.c +++ b/src/init.c @@ -98,7 +98,7 @@ static void JNICALL exit_hook(int status) { 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; + int total_num_properties, propNum = 0, add_Xss = 1; jint res; char *classpath; @@ -146,9 +146,15 @@ static int initJVM(const char *user_classpath, int opts, char **optv, int hooks, /* vm_options[propNum++].optionString = "-verbose:class,jni"; */ if (optv) { - int i=0; - while (i Date: Thu, 2 Jul 2020 23:08:13 +0000 Subject: [PATCH 070/240] update NEWS --- NEWS | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/NEWS b/NEWS index 609d800..647f9d8 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,12 @@ -------------------------- 0.9-13 (under development) + 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 add missing C entry points to the symbol cache. (#221) o disable dynamic symbol lookup to catch any (inadvertent) use of From fabbe99b211e326b5b660c83344a71cae30155ce Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Thu, 2 Jul 2020 23:08:21 +0000 Subject: [PATCH 071/240] don't use LENGTH() on S4 objects in debug mode --- src/Rglue.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Rglue.c b/src/Rglue.c index 09b941a..ee75c7d 100644 --- a/src/Rglue.c +++ b/src/Rglue.c @@ -357,7 +357,8 @@ 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 (IS_JOBJREF(e)) { jobject o=(jobject)0; const char *jc=0; From ac524c72930dce31a77b89b66d6c11cad349656b Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 6 Jul 2020 13:31:03 +1200 Subject: [PATCH 072/240] re-define EXTPTR_xx macros to avoid ABI breakage in R 4.0.1 --- src/Rglue.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Rglue.c b/src/Rglue.c index ee75c7d..c5585f8 100644 --- a/src/Rglue.c +++ b/src/Rglue.c @@ -5,6 +5,22 @@ #include #include +/* 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) + #include /* max supported # of parameters to Java methdos */ @@ -163,7 +179,7 @@ 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 */ From ec6e26832e142ddb6149d414f6b4e0bcffecdec9 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 6 Jul 2020 13:36:38 +1200 Subject: [PATCH 073/240] modify error on JRI failure to mention --disable-jri --- NEWS | 5 ++++- jri/configure | 5 ++++- jri/configure.ac | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 647f9d8..3a33096 100644 --- a/NEWS +++ b/NEWS @@ -1,13 +1,16 @@ NEWS/ChangeLog for rJava -------------------------- -0.9-13 (under development) +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 diff --git a/jri/configure b/jri/configure index 5d05dbc..f95fabb 100755 --- a/jri/configure +++ b/jri/configure @@ -3680,7 +3680,10 @@ $as_echo "$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 + 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 fi diff --git a/jri/configure.ac b/jri/configure.ac index 4ee4e4f..c2ad72f 100644 --- a/jri/configure.ac +++ b/jri/configure.ac @@ -238,7 +238,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. +]) ]) ]) ]) From 2f14b3aed04e58aabc67ef6cff74655e5a452b5d Mon Sep 17 00:00:00 2001 From: Valentino Pinna Date: Fri, 7 Aug 2020 15:27:01 +0200 Subject: [PATCH 074/240] Fixed "yield" usage --- jri/Rengine.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jri/Rengine.java b/jri/Rengine.java index a846132..7a819ea 100644 --- a/jri/Rengine.java +++ b/jri/Rengine.java @@ -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. From b2abf0ba3442ea446846b15a4522abc9f54652ad Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 25 Sep 2020 08:12:21 +1200 Subject: [PATCH 075/240] bump version to 0.9-14 --- src/rJava.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rJava.h b/src/rJava.h index 23a8143..16cd88a 100644 --- a/src/rJava.h +++ b/src/rJava.h @@ -1,7 +1,7 @@ #ifndef __RJAVA_H__ #define __RJAVA_H__ -#define RJAVA_VER 0x00090d /* rJava v0.9-13 */ +#define RJAVA_VER 0x00090e /* rJava v0.9-14 */ /* important changes between versions: 3.0 - adds compiler From 887578facab8ef77f79ee1fa0176f0905689aff0 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 25 Sep 2020 08:12:51 +1200 Subject: [PATCH 076/240] fix detection of major Java version --- jri/configure | 4 ++-- jri/configure.ac | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/jri/configure b/jri/configure index f95fabb..4c28a3c 100755 --- a/jri/configure +++ b/jri/configure @@ -3449,8 +3449,8 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking Java compatibility version (integer)" >&5 $as_echo_n "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 '^[0-9]\.' >/dev/null; then ## old style 1.X - JMVER=`echo $JVER | sed 's:..::' | sed 's:\..*::'` + 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 diff --git a/jri/configure.ac b/jri/configure.ac index c2ad72f..2632b9b 100644 --- a/jri/configure.ac +++ b/jri/configure.ac @@ -117,8 +117,8 @@ if test -z "$JVER"; then 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 '^[[0-9]]\.' >/dev/null; then ## old style 1.X - JMVER=`echo $JVER | sed 's:..::' | sed 's:\..*::'` + 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 From 1dc3aa0e9c68005b9a69bb6100ed9ea86a1f7332 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 25 Sep 2020 08:13:11 +1200 Subject: [PATCH 077/240] update NEWS --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index 3a33096..1971533 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,10 @@ NEWS/ChangeLog for rJava -------------------------- +0.9-14 (under development) + o JRI: fixed detection of the major Java version + + 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 From 651e712115ae60d2a9a5e2c00ce187b260eaca7f Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 25 Sep 2020 08:18:45 +1200 Subject: [PATCH 078/240] strip -.* suffix from major versions (#236) --- jri/configure | 2 ++ jri/configure.ac | 2 ++ 2 files changed, 4 insertions(+) diff --git a/jri/configure b/jri/configure index 4c28a3c..46b92af 100755 --- a/jri/configure +++ b/jri/configure @@ -3454,6 +3454,8 @@ $as_echo_n "checking Java compatibility version (integer)... " >&6; } else ## new stype omitting the major version JMVER=`echo $JVER | sed 's:\..*::'` fi + ## strip -.* for versions like 13-ea + JMVER=`echo $JMVER | sed 's:-.*::'` { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JMVER" >&5 $as_echo "$JMVER" >&6; } fi diff --git a/jri/configure.ac b/jri/configure.ac index 2632b9b..a50c0ae 100644 --- a/jri/configure.ac +++ b/jri/configure.ac @@ -122,6 +122,8 @@ else 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 From 503739f7d7f4ad7e4895d5aac316d0df13693d99 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 25 Sep 2020 08:20:54 +1200 Subject: [PATCH 079/240] update NEWS --- NEWS | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 1971533..9e4a674 100644 --- a/NEWS +++ b/NEWS @@ -2,7 +2,9 @@ -------------------------- 0.9-14 (under development) - o JRI: fixed detection of the major Java version + o JRI: fixed detection of the major Java version (#239) + + o JRI: support Java major versions with suffixes like 13-ea (#236) 0.9-13 2020-07-06 From b2d76e3380ed1fcacb345563e7c74e2151297de3 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Thu, 5 Nov 2020 10:20:16 +1300 Subject: [PATCH 080/240] add -minver to getsp for Java version checks --- jri/tools/getsp.class | Bin 1356 -> 1659 bytes jri/tools/getsp.java | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/jri/tools/getsp.class b/jri/tools/getsp.class index 76e0581bad8caef90cb4deb6e3c233054694d885..3bc25c864c9b0dc07eb97d83b2c03cfefe0018c7 100644 GIT binary patch literal 1659 zcma)6J#ZUU5dNO-PIr>dwtTi6gpqMb;z)`t*-lW1EE{4c0VVPe*ulgGl9T)_E74!> zP8kdgGt5xYP^B!lNzQpoYZj2Pu}M>qy^-(FfRymMngu$v>!pl zgvkmsqhVIVi{krB8qR8%6U%vF&iQd37gW5g;S~)z6&F=pV(@0mwX!qIAVp)ZGsyGx zP0rAlFW2~Dvs&QRs#&OzN3NRX8pBX@BY)kzWu_`-t(01Eta7b1Ee`ru>P@T2FO&t? zU*eA4ND82i!+4HC8F#qtsL1PBz@myJ9m{x?kgMdLoH}`G>5_`qbgW=ifGg#K&EOf& zGxUonNpe`GwUca^&bE%rpp3m@owRwwv`nXN=~%-XI<8<{#|GYHU`e9;Z?1FAtu0R2 zxA3-(tGGt6Q3iFqTCUv^eiH=--Aze*yId#Dp2?(+A~r=_u3}3^35yH^Phy{cr^p+Q z3zl}cU|y?}47Uml!6(3_!gXGB4!AlsWbhU1Rg%J2>0~I{rO3I1$98OoSE+6FCdCVN z@a1}HnL6T7Om0@EA9FnDCboNafQ zh_1J|ZCYoEo*d1^=1HR6EZFYIh(XHbVqIgHjRvo6G9><2)=oo7s^-)mmvS)LJu<)9 zG%M7d1FAbMnU1Z~Fxrl3IrdsvNH_rMM0Pvf$}F&x7ftqJPMLV}+F@5lGqyYam{tQnW4 z3{M-_oQu5(lXhx(3#Tao}^pTHX*_+eE0F|%V(R2 zU>dhIyszPmhO-*ZX((v8py8^91r?W7e5#_N;+l%S1YL!{lzm*GXjdJps1yT`}L(liM%ATZWf9D=SXG^7qY0LKEq`Z#k7RR18d4 z1)|dpx7L<(=(Iz2DK8K^?|N=H$6l2E`;I`O?0fCd_QGYm(cxOZ{CVAJg)UKn;i~I7 zH#^Om6D--a2Gz-aI@h0BU}r<}aqK1w9IE|i6`vcoljvECWjTc*Is&dKQS?jESWIc(~VRUhha!(Q8scIY%&bHnjg zWkRKCyB^P(-ywk^Swz0=kc1ujfq>eQ-D=Pv-tN@ey;CWmh5mL<^?_{v{0fdC&RZmZ z1C(xJmh*>z@OT+@qW@*L@K1L0A^y%rW=*AwvF~C0j0rQ=#ettB7U^Lx%zhex`i=I?IQUQgO*BPv!La;EGUn$mP#r=AdyQE zO=>^lb}kvEe6Sc#DfbFdD{e-a>pOg8#eRYH9Em$qPjTo8Myz-jqg_~!F)2|i)`v|& zc#8jReKGcBL@>#tSKnH(EgU2dtH*-^sjx~(imU}n9M^G(V}yNCFpemWa85x*8XBgE zo@0kfd`vFzRVnkKxrSkOa0GRX!i9+j#_$C_zd{mUV*=mc0Dgmo->Lfphw&$4{l$p? p;wa{rX@H-Q?^1scsNo$V9?d?%@J?B=9w=VB@b2N`p7WJ$= '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])); } From 9a8677709189deea10375b9c59b5759c54c660cb Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Thu, 5 Nov 2020 10:21:26 +1300 Subject: [PATCH 081/240] use -source/-target if Java version is at least 1.8 (see #241) --- jri/configure.win | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/jri/configure.win b/jri/configure.win index 48da174..757ca49 100644 --- a/jri/configure.win +++ b/jri/configure.win @@ -40,7 +40,15 @@ if [ -e "$JAVA_HOME/bin/javah.exe" ]; then ## does the JDK have javah? 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' - echo 'JFLAGS=-h .' >> src/Makefile.wconf + ## 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 ..." From a55bb15284a93c83ce4c27c46478e57449524a3b Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Thu, 5 Nov 2020 10:23:50 +1300 Subject: [PATCH 082/240] update NEWS --- NEWS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS b/NEWS index 9e4a674..95b1f9c 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,9 @@ 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) + 0.9-13 2020-07-06 o increase default JVM stack size by adding -Xss2m to JVM parameters From 8e14d60a1ad00f6b9080c5f07b00e7ae88553a9b Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Tue, 15 Dec 2020 12:02:18 +1300 Subject: [PATCH 083/240] do not hard-code -framework JavaVM but rely on JAVA_LIBS instead (fixes #248) --- jri/configure.ac | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/jri/configure.ac b/jri/configure.ac index a50c0ae..8e46089 100644 --- a/jri/configure.ac +++ b/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 @@ -215,8 +215,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]) @@ -319,7 +321,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 From b9f3f591ac60da4a624087526d3a3b63ee5d0601 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Tue, 15 Dec 2020 12:02:42 +1300 Subject: [PATCH 084/240] update jri/configure --- jri/configure | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/jri/configure b/jri/configure index 46b92af..0c1b8df 100755 --- a/jri/configure +++ b/jri/configure @@ -3582,8 +3582,10 @@ $as_echo "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 ;; *) @@ -3839,7 +3841,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 From 143f985a077066121918224d8c899de597bb9c90 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Tue, 15 Dec 2020 12:02:53 +1300 Subject: [PATCH 085/240] update NEWS --- NEWS | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/NEWS b/NEWS index 95b1f9c..1164c21 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,11 @@ 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 From 5657c14d0277c1c8bfdde14875e3685ae5a7a9f1 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Thu, 4 Feb 2021 13:24:49 +1300 Subject: [PATCH 086/240] catch up with REngine --- jri/REngine | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jri/REngine b/jri/REngine index 7181bbc..68b0147 160000 --- a/jri/REngine +++ b/jri/REngine @@ -1 +1 @@ -Subproject commit 7181bbc28b1feb73fb8c891a55028ee03ade371f +Subproject commit 68b0147275919401084a9e1ebf6b576547a49931 From 1fd8baa29fa56f7754f7b1ee7b2964dec6fd87db Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Thu, 4 Feb 2021 13:25:17 +1300 Subject: [PATCH 087/240] update NEWS --- NEWS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 1164c21..9c50032 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,7 @@ NEWS/ChangeLog for rJava -------------------------- -0.9-14 (under development) +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) From 9a51646220101d0bd031f30b2bb2c0e3a86ee05a Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Thu, 4 Feb 2021 13:28:39 +1300 Subject: [PATCH 088/240] remove .github from distribution --- mkdist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkdist b/mkdist index b5f2b8b..1fe0733 100644 --- a/mkdist +++ b/mkdist @@ -192,7 +192,7 @@ fi echo "Creating package ..." cd .. rm -f `find rJava -name ._\*` -rm -rf rJava/.git rJava/jri/REngine/.git +rm -rf rJava/.git* rJava/jri/REngine/.git* rm -f rJava/version R CMD build rJava cd ${SWD} From 39e35ddff1d3f865ac3b71a243eede893b43fa73 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 7 Apr 2021 13:39:57 +1200 Subject: [PATCH 089/240] bump version to 1.0-1 --- src/rJava.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rJava.h b/src/rJava.h index 16cd88a..1ab19a7 100644 --- a/src/rJava.h +++ b/src/rJava.h @@ -1,12 +1,12 @@ #ifndef __RJAVA_H__ #define __RJAVA_H__ -#define RJAVA_VER 0x00090e /* rJava v0.9-14 */ +#define RJAVA_VER 0x010001 /* rJava v1.0-1 */ /* 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) From 79579e4bb87b617636655a23a5c1a8c3cbddfdf6 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 16 Dec 2020 10:57:25 +1300 Subject: [PATCH 090/240] add parent loader argument to the constructor --- src/java/RJavaClassLoader.java | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/java/RJavaClassLoader.java b/src/java/RJavaClassLoader.java index 16b6b5f..1ce9003 100644 --- a/src/java/RJavaClassLoader.java +++ b/src/java/RJavaClassLoader.java @@ -201,23 +201,37 @@ public static RJavaClassLoader getPrimaryLoader() { // {{{ constructor /** * Constructor. The first time an RJavaClassLoader is created, it is - * cached as the primary loader. + * cached as the primary loader. * * @param path path of the rJava package * @param libpath lib sub directory of the rJava package */ public RJavaClassLoader(String path, String libpath) { - super(new URL[] {}); + this(path, libpath, null); + } + + /** + * Constructor. The first time an RJavaClassLoader is created, it is + * cached as the primary loader. + * + * @param path path of the rJava package + * @param libpath lib sub directory of the rJava package + * @param parent parent loader if we should fall back upstream or NULL + */ + public RJavaClassLoader(String path, String libpath, RJavaClassLoader parent) { + super(new URL[] {}, parent); + // respect rJava.debug level String rjd = System.getProperty("rJava.debug"); if (rjd != null && rjd.length() > 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 +392,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; From 107b492495da1a93c8c0c5a468f628e080f2cbcb Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 16 Dec 2020 10:59:40 +1300 Subject: [PATCH 091/240] add support for custom class loaders, add own.loader= option to .jpackage() such that packages can use their own class loaders to avoid conflicts (see #250) --- R/loader.R | 97 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 57 insertions(+), 40 deletions(-) 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) } From 44509a1775a4c222d6e7fbbc130583a9a79551bf Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 16 Dec 2020 11:20:08 +1300 Subject: [PATCH 092/240] add class.loader argument to higher-level functions as well --- R/J.R | 7 ++++--- R/call.R | 10 +++++----- R/reflection.R | 24 ++++++++++++------------ 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/R/J.R b/R/J.R index e4044c9..de95913 100644 --- a/R/J.R +++ b/R/J.R @@ -1,11 +1,12 @@ setClass("jclassName", representation(name="character", jobj="jobjRef")) -jclassName <- function(class){ + +jclassName <- function(class, class.loader=.rJava.class.loader) { 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) } @@ -32,4 +33,4 @@ setMethod("show", c(object="jclassName"), function(object) invisible(show(paste( 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() == 1L && 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 a1733a4..ed80467 100644 --- a/R/call.R +++ b/R/call.R @@ -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) 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) diff --git a/R/reflection.R b/R/reflection.R index fa8e39c..1b28b7e 100644 --- a/R/reflection.R +++ b/R/reflection.R @@ -78,13 +78,13 @@ ### 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")) cl <- .jcall(o, "Ljava/lang/Class;", "getClass") else - cl <- .jfindClass(o) + cl <- .jfindClass(o, class.loader=class.loader) if (is.null(cl)) stop("Cannot find class of the object.") @@ -125,7 +125,7 @@ ### 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, ...) { +.J <- function(class, ..., class.loader=.rJava.class.loader) { # allow non-JNI specifiation class <- gsub("\\.","/",class) @@ -137,7 +137,7 @@ # use RJavaTools to find create the object o <- .jcall("RJavaTools", "Ljava/lang/Object;", - "newInstance", .jfindClass(class), + "newInstance", .jfindClass(class, class.loader=class.loader), .jarray(p,"java/lang/Object", dispatch = FALSE ), .jarray(pc,"java/lang/Class", dispatch = FALSE ), evalString = FALSE, evalArray = FALSE, use.true.class = TRUE ) @@ -187,8 +187,8 @@ #! } ### 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 (length(name)) { n <- sapply(f, function(o) .jcall(o, "S", "getName")) @@ -220,20 +220,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) } From 08316ad52ff7de1a4662a43121350b1f0cfee3a0 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 16 Dec 2020 13:09:07 +1300 Subject: [PATCH 093/240] few more places to add class.loader argument --- R/reflection.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/R/reflection.R b/R/reflection.R index 1b28b7e..eea83b4 100644 --- a/R/reflection.R +++ b/R/reflection.R @@ -4,8 +4,8 @@ ### 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 (length(name)) { n <- sapply(ms, function(o) .jcall(o, "S", "getName")) @@ -14,8 +14,8 @@ 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"))) From 6ac8c02c7bc8f74eec30b8f50d737752b633ba53 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 16 Dec 2020 13:09:24 +1300 Subject: [PATCH 094/240] update documentation --- man/J.Rd | 4 +++- man/jnew.Rd | 6 +++--- man/jpackage.Rd | 44 ++++++++++++++++++++++++++++++++++++++++--- man/jreflection.Rd | 12 +++++++----- man/loader.Rd | 47 +++++++++++++++++++++++++++++++++++++--------- 5 files changed, 92 insertions(+), 21 deletions(-) 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/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/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/jreflection.Rd b/man/jreflection.Rd index 5af01e1..e524a72 100644 --- a/man/jreflection.Rd +++ b/man/jreflection.Rd @@ -13,9 +13,9 @@ \code{.jfields} returns a character vector with all fileds (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 @@ -24,6 +24,8 @@ \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 @@ -44,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/loader.Rd b/man/loader.Rd index f7a8e4a..1c22b3b 100644 --- a/man/loader.Rd +++ b/man/loader.Rd @@ -1,8 +1,9 @@ \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 @@ -12,22 +13,50 @@ 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/") From 14dfe2d75843c4539b2fb9fb6987eb30df48ff67 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 16 Dec 2020 14:27:15 +1300 Subject: [PATCH 095/240] fix class loader pass-through --- R/call.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/call.R b/R/call.R index ed80467..d56af60 100644 --- a/R/call.R +++ b/R/call.R @@ -333,7 +333,7 @@ is.jnull <- function(x) { .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, class.loader) 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) From 2e8b16567eff01f5f5caf3b768ca2f9d17472433 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 16 Dec 2020 14:28:57 +1300 Subject: [PATCH 096/240] use the class object in .J/new if we can to avoid extra look-ups (and class loader issues) --- R/J.R | 4 ++-- R/reflection.R | 14 ++++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/R/J.R b/R/J.R index de95913..db22099 100644 --- a/R/J.R +++ b/R/J.R @@ -12,7 +12,7 @@ jclassName <- function(class, class.loader=.rJava.class.loader) { } setGeneric("new") -setMethod("new", signature(Class="jclassName"), function(Class, ...) .J(Class@name, ...)) +setMethod("new", signature(Class="jclassName"), function(Class, ...) .J(Class, ...)) setMethod("$", c(x="jclassName"), function(x, name) { if( name == "class" ){ @@ -33,4 +33,4 @@ setMethod("show", c(object="jclassName"), function(object) invisible(show(paste( setMethod("as.character", c(x="jclassName"), function(x, ...) x@name) ## the magic `J' -J<-function(class, method, ..., class.loader=.rJava.class.loader) if (nargs() == 1L && missing(method)) jclassName(class, class.loader=class.loader) else .jrcall(class, method, ..., class.loader=class.loader) +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/reflection.R b/R/reflection.R index eea83b4..6a4de0a 100644 --- a/R/reflection.R +++ b/R/reflection.R @@ -126,9 +126,15 @@ ### the objects and the constructor parameters ### This is to .jnew what .jrcall is to .jcall .J <- function(class, ..., class.loader=.rJava.class.loader) { - # allow non-JNI specifiation - class <- gsub("\\.","/",class) - + ## 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(...) @@ -137,7 +143,7 @@ # use RJavaTools to find create the object o <- .jcall("RJavaTools", "Ljava/lang/Object;", - "newInstance", .jfindClass(class, class.loader=class.loader), + "newInstance", class, .jarray(p,"java/lang/Object", dispatch = FALSE ), .jarray(pc,"java/lang/Class", dispatch = FALSE ), evalString = FALSE, evalArray = FALSE, use.true.class = TRUE ) From 577d684e059434ddf7145afb81097818357469d3 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 16 Dec 2020 16:27:53 +1300 Subject: [PATCH 097/240] add support to fields to handle jclassName objects without lookup --- R/J.R | 6 +- R/call.R | 3 +- R/reflection.R | 7 ++- src/fields.c | 163 ++++++++++++++++++++++++++----------------------- 4 files changed, 97 insertions(+), 82 deletions(-) diff --git a/R/J.R b/R/J.R index db22099..4d4061e 100644 --- a/R/J.R +++ b/R/J.R @@ -18,9 +18,9 @@ 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) @@ -28,7 +28,7 @@ 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) diff --git a/R/call.R b/R/call.R index d56af60..81caf12 100644 --- a/R/call.R +++ b/R/call.R @@ -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/reflection.R b/R/reflection.R index 6a4de0a..471352e 100644 --- a/R/reflection.R +++ b/R/reflection.R @@ -68,6 +68,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") } @@ -81,11 +82,13 @@ .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 (is(o, "jclassName")) + cl <- o@jobj + else if (is(o, "jobjRef")) cl <- .jcall(o, "Ljava/lang/Class;", "getClass") else cl <- .jfindClass(o, class.loader=class.loader) - if (is.null(cl)) + 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 diff --git a/src/fields.c b/src/fields.c index b0e93e5..8c44afa 100644 --- a/src/fields.c +++ b/src/fields.c @@ -32,6 +32,73 @@ static char *classToJNI(const char *cl) { return jc; } +/* 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; + + /* jclassName is the result of J("class.name") and has the class object in jobj slot */ + if (inherits(obj, "jclassName")) { + obj = GET_SLOT(obj, install("jobj")); + jverify(obj); /* twice wrapped: className has @jobj slot which in turn contains jobjRef to the class */ + obj = GET_SLOT(obj, install("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 */ + char *c = clnam; + 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 */ @@ -77,57 +144,30 @@ REPC SEXP RgetField(SEXP obj, SEXP sig, SEXP name, SEXP trueclass) { char *clnam = 0, *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; - 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)); @@ -146,7 +186,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); } @@ -157,7 +197,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; } @@ -167,7 +207,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; } @@ -177,7 +217,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; } @@ -187,7 +227,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; } @@ -197,7 +237,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; } @@ -207,7 +247,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; } @@ -217,7 +257,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; } @@ -227,7 +267,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; } @@ -238,7 +278,7 @@ 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); @@ -254,7 +294,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"); @@ -268,44 +308,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 @@ -325,7 +338,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); @@ -369,13 +382,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); } done_sigbuf(&sig); - releaseObject(env, cls); + if (cls_local) releaseObject(env, cls); if (otr) releaseObject(env, otr); return ref; } From 59f8f3915fb5d93c8f51da361e8273113cc997c7 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 16 Dec 2020 16:28:06 +1300 Subject: [PATCH 098/240] update NEWS --- NEWS | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/NEWS b/NEWS index 9c50032..d6704ca 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,24 @@ NEWS/ChangeLog for rJava -------------------------- +1.0-1 (under development) + 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. + + 0.9-14 2021-02-04 o JRI: fixed detection of the major Java version (#239) From 2328f777d557b12ba5bfbd3657075afc132b0fad Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Thu, 17 Dec 2020 13:15:08 +1300 Subject: [PATCH 099/240] take null in parent loader as the system loader --- src/java/RJavaClassLoader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/java/RJavaClassLoader.java b/src/java/RJavaClassLoader.java index 1ce9003..861c18e 100644 --- a/src/java/RJavaClassLoader.java +++ b/src/java/RJavaClassLoader.java @@ -219,7 +219,7 @@ public RJavaClassLoader(String path, String libpath) { * @param parent parent loader if we should fall back upstream or NULL */ public RJavaClassLoader(String path, String libpath, RJavaClassLoader parent) { - super(new URL[] {}, parent); + super(new URL[] {}, (parent == null) ? ClassLoader.getSystemClassLoader() : parent); // respect rJava.debug level String rjd = System.getProperty("rJava.debug"); From 8533aff09fe5331246d184dbc8b87d27d1b9268d Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Thu, 17 Dec 2020 13:30:15 +1300 Subject: [PATCH 100/240] Allow jclassName object to be interpreted as class objects in reflection calls --- R/reflection.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/reflection.R b/R/reflection.R index 471352e..3031192 100644 --- a/R/reflection.R +++ b/R/reflection.R @@ -42,7 +42,8 @@ # 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 + if (is(a, "jobjRef")) a + else if (is(a, "jclassName")) a@jobj else if (is.null(a)) .jnull() else { cm <- match(class(a)[1], names(.class.to.jclass)) if (!any(is.na(cm))) { From e6f3a51de016d9bfe1be2f4e9f161884d66fa89e Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Thu, 17 Dec 2020 13:31:01 +1300 Subject: [PATCH 101/240] add a FIXME note to jclassName methods since we may want to think about how we allow those to be used --- R/J.R | 3 +++ 1 file changed, 3 insertions(+) diff --git a/R/J.R b/R/J.R index 4d4061e..6df8af5 100644 --- a/R/J.R +++ b/R/J.R @@ -14,6 +14,9 @@ jclassName <- function(class, class.loader=.rJava.class.loader) { setGeneric("new") 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 From dbe983152589d37e3f6c28217343a4fa30d050ef Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Thu, 17 Dec 2020 13:32:20 +1300 Subject: [PATCH 102/240] treat jclassName objects in .jcall() as the contained class object --- src/Rglue.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Rglue.c b/src/Rglue.c index c5585f8..5849bbb 100644 --- a/src/Rglue.c +++ b/src/Rglue.c @@ -375,6 +375,10 @@ static int Rpar2jvalue(JNIEnv *env, SEXP par, jvalue *jpar, sig_buffer_t *sig, i } else if (TYPEOF(e)==VECSXP || TYPEOF(e)==S4SXP) { 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; From 373fd34c6e98bc2a66523b2cda8a863ae6384175 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 7 Apr 2021 14:18:29 +1200 Subject: [PATCH 103/240] require R 3.6.0+, remove R internals hack and change to LGPL --- DESCRIPTION | 4 +-- src/rJava.c | 71 ----------------------------------------------------- 2 files changed, 2 insertions(+), 73 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 96dd453..e70cfc6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -3,9 +3,9 @@ Version: (populated by mkdist!) Title: Low-Level R to Java Interface Author: Simon Urbanek Maintainer: Simon Urbanek -Depends: R (>= 2.5.0), methods +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 +License: LGPL-2.1 URL: http://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/src/rJava.c b/src/rJava.c index deef799..6f0368e 100644 --- a/src/rJava.c +++ b/src/rJava.c @@ -11,9 +11,6 @@ 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(3, 6, 0) ) - static SEXP getCurrentCall() { SEXP cexp, sys_calls = PROTECT(install("sys.calls")); cexp = PROTECT(lang1(sys_calls)); @@ -29,74 +26,6 @@ static SEXP getCurrentCall() { return R_NilValue; /* (LENGTH(cl) > 0) ? VECTOR_ELT(cl, 0) : R_NilValue; */ } -#elif ( 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; -} -#endif -/* -- end of hack */ - /** throw an exception using R condition code. * @param msg - message string * @param jobj - jobjRef object of the exception From 4aed525810dc40bebfc58110c506c47d094c069e Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 7 Apr 2021 14:56:53 +1200 Subject: [PATCH 104/240] add GH workflow to check --- .github/workflows/check.yaml | 47 ++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/check.yaml diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml new file mode 100644 index 0000000..008bc07 --- /dev/null +++ b/.github/workflows/check.yaml @@ -0,0 +1,47 @@ +on: [push, pull_request] + +name: check + +jobs: + check: + runs-on: ${{ matrix.os }} + + name: ${{ matrix.os }} (${{ matrix.r }}) + + strategy: + fail-fast: false + matrix: + os: [ 'windows-latest', 'macOS-10.15', 'ubuntu-20.04' ] + r: [ 'release' ] + java: [ 8, 11 ] + + steps: + - uses: actions/checkout@v1 + + - uses: r-lib/actions/setup-r@master + with: + r-version: ${{ matrix.r }} + + - uses: actions/setup-java@v1 + with: + java-version: ${{ matrix.java }} + + - name: Build + run: "sh mkdist" + + - name: Info + run: "bash -c 'java -version && which java && echo $PATH && echo $JAVA_HOME'" + + - 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" + + - name: R CMD check + run: "bash -c 'R CMD check --no-multiarch --no-manual ../rJava_*.tar.gz'" + + - name: Upload check results + if: failure() + uses: actions/upload-artifact@master + with: + name: ${{ runner.os }}-r${{ matrix.r }}-j${{ matrix.java }}-results + path: rJava.Rcheck From 1ebbee90e5a2726f5d04cb4d4d49db47e016c116 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 7 Apr 2021 14:57:04 +1200 Subject: [PATCH 105/240] add .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b25c15b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*~ From 24be5544f7adaa7669c8c0833b6d47cfac4094f9 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 7 Apr 2021 15:04:39 +1200 Subject: [PATCH 106/240] Need Xvfb and/or NOAWT --- .github/workflows/check.yaml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 008bc07..5e9fda0 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -6,7 +6,7 @@ jobs: check: runs-on: ${{ matrix.os }} - name: ${{ matrix.os }} (${{ matrix.r }}) + name: ${{ matrix.os }}, R ${{ matrix.r }}, Java ${{ matrix.java }} strategy: fail-fast: false @@ -36,9 +36,18 @@ jobs: 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" - - name: R CMD check + - name: R CMD check (Windows) + if: runner.os == 'Windows' run: "bash -c 'R CMD check --no-multiarch --no-manual ../rJava_*.tar.gz'" + - name: R CMD check (Linux) + if: runner.os == 'Linux' + run: "bash -c 'xvfb-run R CMD check --no-manual ../rJava_*.tar.gz'" + + - name: R CMD check (macOS) + if: runner.os == 'macOS' + run: "bash -c 'NOAWT=1 R CMD check --no-manual ../rJava_*.tar.gz'" + - name: Upload check results if: failure() uses: actions/upload-artifact@master From e3f0b452ff174b7d7d0e8d77d25e743d8ca5d4ca Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 7 Apr 2021 15:17:30 +1200 Subject: [PATCH 107/240] silence IPC warnings --- jri/src/rjava.c | 19 +++++++++---------- jri/src/rjava.h | 3 +-- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/jri/src/rjava.c b/jri/src/rjava.c index c66f52f..373d984 100644 --- a/jri/src/rjava.c +++ b/jri/src/rjava.c @@ -19,24 +19,23 @@ int RJava_request_lock() { if (rjctrl && *rjctrl) return 2; buf[0] = IPCC_LOCK_REQUEST; - write(ipcout, buf, sizeof(ptrlong)); + if (write(ipcout, buf, sizeof(ptrlong)) < sizeof(ptrlong)) return 0; n = read(resin, buf, sizeof(ptrlong)); - return (n > 0 && buf[0] == IPCC_LOCK_GRANTED) ? 1 : 0; + return (n == sizeof(ptrlong) && 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; + return (write(ipcout, buf, sizeof(ptrlong)) == sizeof(ptrlong)) ? 1 : 0; } -void RJava_request_callback(callbackfn *fn, void *data) { +int 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); + return (write(ipcout, buf, sizeof(ptrlong) * 3) == sizeof(ptrlong) * 3) ? 1 : 0; } void RJava_setup(int _in, int _out) { @@ -48,9 +47,9 @@ void RJava_setup(int _in, int _out) { 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]; + 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/jri/src/rjava.h index ba6c84d..19fd1b3 100644 --- a/jri/src/rjava.h +++ b/jri/src/rjava.h @@ -12,9 +12,8 @@ int RJava_request_lock(); int RJava_clear_lock(); -/* void RJava_request_callback(callbackfn *fn, void *data); */ +/* int RJava_request_callback(callbackfn *fn, void *data); */ void RJava_setup(int _in, int _out); void RJava_init_ctrl(); #endif - From 51ea3050ceb5edbe19655b630522dfebf201d237 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 7 Apr 2021 15:19:57 +1200 Subject: [PATCH 108/240] (GHA) show install log --- .github/workflows/check.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 5e9fda0..7bbf2a7 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -48,6 +48,9 @@ jobs: if: runner.os == 'macOS' run: "bash -c 'NOAWT=1 R CMD check --no-manual ../rJava_*.tar.gz'" + - name: Show install log + run: "bash -c 'if [ -e rJava.Rcheck/00install.out ]; then cat rJava.Rcheck/00install.out; fi'" + - name: Upload check results if: failure() uses: actions/upload-artifact@master From e39927505ea005f26e524acb98e8b873ab67a0a3 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 7 Apr 2021 15:25:56 +1200 Subject: [PATCH 109/240] Update README.md --- README.md | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index cecb86a..eaec1d0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,9 @@ # 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) @@ -6,12 +11,18 @@ Please visit the [main rJava project page on RForge.net](http://rforge.net) for ### 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",,"http://rforge.net") + install.packages("rJava", repos="http://rforge.net") -in R. The RForge.net repository is updated automatically on each -commit. On OS X you may need to add `type='source'`. +The RForge.net repository is updated automatically on each +commit. On macOS/Windows you may need to add `type='source'`. ### Sources @@ -20,8 +31,8 @@ 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 actual R package but a source to +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 From 93679f2da33ec2dc91f98da5cdbe3d7bd57996d7 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 7 Apr 2021 15:54:27 +1200 Subject: [PATCH 110/240] fixed typos and stray spaces (resolved conflicts of #189) --- NEWS | 108 ++++++++++++++++++++--------------------- jri/Rengine.java | 80 +++++++++++++++---------------- jri/configure | 3 +- jri/configure.ac | 6 +-- man/accessOp.Rd | 10 ++-- man/jarray.Rd | 8 ++-- man/jcall.Rd | 20 ++++---- man/jcastToArray.Rd | 6 +-- man/jcheck.Rd | 8 ++-- man/jfield.Rd | 4 +- man/jfloat.Rd | 4 +- man/jmemprof.Rd | 4 +- man/jnull.Rd | 2 +- man/jrectRef-class.Rd | 28 +++++------ man/jreflection.Rd | 2 +- man/jserialize.Rd | 2 +- man/loader.Rd | 2 +- man/toJava.Rd | 2 +- src/Rglue.c | 68 +++++++++++++------------- src/fields.c | 10 ++-- src/init.c | 89 +++++++++++++++++----------------- src/jri_glue.c | 8 ++-- src/otables.c | 109 +++++++++++++++++++++--------------------- src/rJava.c | 24 +++++----- 24 files changed, 301 insertions(+), 306 deletions(-) diff --git a/NEWS b/NEWS index d6704ca..0ace125 100644 --- a/NEWS +++ b/NEWS @@ -76,7 +76,7 @@ if rJava class loader was not present yet (only affected initialization). - o modify boostrap to avoid reflection calls which are broken in + 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) @@ -103,7 +103,7 @@ 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) @@ -130,7 +130,7 @@ 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 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 @@ -192,17 +192,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_... @@ -229,16 +229,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 @@ -256,7 +256,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 @@ -272,7 +272,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) @@ -335,12 +335,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, @@ -361,71 +361,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 @@ -473,7 +473,7 @@ 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) @@ -534,7 +534,7 @@ o Add support for short Java type - o Add support for convertors + o Add support for converters o Fix R-devel compatibility issues @@ -556,7 +556,7 @@ 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 @@ -574,7 +574,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 @@ -645,7 +645,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 diff --git a/jri/Rengine.java b/jri/Rengine.java index 6220081..cce2d83 100644 --- a/jri/Rengine.java +++ b/jri/Rengine.java @@ -2,18 +2,18 @@ import java.lang.*; -/** 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 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"); @@ -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 @@ -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 @@ -559,7 +559,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 +592,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 +607,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 +619,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 +662,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/configure b/jri/configure
index 0c1b8df..8688f81 100755
--- a/jri/configure
+++ b/jri/configure
@@ -3237,7 +3237,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}"
@@ -5229,4 +5229,3 @@ 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;}
 fi
-
diff --git a/jri/configure.ac b/jri/configure.ac
index 8e46089..323d1a3 100644
--- a/jri/configure.ac
+++ b/jri/configure.ac
@@ -85,7 +85,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}"
@@ -188,7 +188,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
@@ -200,7 +200,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
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/jcall.Rd b/man/jcall.Rd
index b8e801b..824780c 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{
       \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..9fb781d 100644
--- a/man/jfloat.Rd
+++ b/man/jfloat.Rd
@@ -47,10 +47,10 @@
   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
+  \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.
-  
+
   \code{jchar} is strictly experimental and may be based on
   \code{character} vectors in the future.
 }
diff --git a/man/jmemprof.Rd b/man/jmemprof.Rd
index 35f8658..19ccce0 100644
--- a/man/jmemprof.Rd
+++ b/man/jmemprof.Rd
@@ -26,14 +26,14 @@
 
   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
diff --git a/man/jnull.Rd b/man/jnull.Rd
index 2f316f7..1836101 100644
--- a/man/jnull.Rd
+++ b/man/jnull.Rd
@@ -28,7 +28,7 @@ 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.
 
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 e524a72..5b874d5 100644
--- a/man/jreflection.Rd
+++ b/man/jreflection.Rd
@@ -10,7 +10,7 @@
   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, class.loader=.rJava.class.loader)
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 1c22b3b..30f6b83 100644
--- a/man/loader.Rd
+++ b/man/loader.Rd
@@ -9,7 +9,7 @@
   \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{
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/src/Rglue.c b/src/Rglue.c
index 5849bbb..b45dba8 100644
--- a/src/Rglue.c
+++ b/src/Rglue.c
@@ -23,7 +23,7 @@
 
 #include 
 
-/* max supported # of parameters to Java methdos */
+/* max supported # of parameters to Java methods */
 #ifndef maxJavaPars
 #define maxJavaPars 32
 #endif
@@ -42,7 +42,7 @@ REPC SEXP RJava_has_jri_cb() {
   LOGICAL(r)[0] = 0;
 #endif
   return r;
-} 
+}
 
 /* debugging output (enable with -DRJ_DEBUG) */
 #ifdef RJ_DEBUG
@@ -131,7 +131,7 @@ SEXP j2SEXP(JNIEnv *env, jobject o, int releaseLocal) {
       releaseObject(env, o);
     o=go;
   }
-  
+
   {
     SEXP xp = R_MakeExternalPtr(o, R_NilValue, R_NilValue);
 
@@ -163,7 +163,7 @@ const char *rj_char_utf8(SEXP s) {
 #endif
 
 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();
@@ -190,7 +190,7 @@ HIDE void deserializeSEXP(SEXP o) {
 	}
 	releaseObject(env, ser);
       }
-    }    
+    }
   }
 }
 
@@ -234,7 +234,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);
 }
 
@@ -256,7 +256,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)));
@@ -463,10 +463,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);
@@ -498,7 +498,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);
@@ -506,7 +506,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");
@@ -551,7 +551,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
@@ -586,7 +586,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):
@@ -599,7 +599,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):
@@ -673,7 +673,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;
 }
 
@@ -684,7 +684,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);
@@ -781,7 +781,7 @@ END_RJAVA_CALL
     }
   }
 #endif
-  
+
   return j2SEXP(env, o, 1);
 }
 
@@ -829,7 +829,7 @@ HIDE SEXP new_jobjRef(JNIEnv *env, jobject o, const char *klass) {
   return oo;
 }
 
-/** 
+/**
  * creates a new jclassName object. similar to what the jclassName
  * function does in the R side
  *
@@ -850,9 +850,9 @@ HIDE SEXP new_jclassName(JNIEnv *env, jobject/*Class*/ cl ) {
 /** 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) {
@@ -861,7 +861,7 @@ 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 = PROTECT( mkString(cn ) );
 	releaseObject(env, r);
 	UNPROTECT(1); /* res */
 	return res;
@@ -885,7 +885,7 @@ static SEXP new_jarrayRef(JNIEnv *env, jobject a, const char *sig) {
 /**
  * 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
@@ -902,7 +902,7 @@ static SEXP new_jrectRef(JNIEnv *env, jobject a, const char *sig, SEXP dim ) {
   SET_SLOT(oo, install("jclass"), mkString(sig));
   SET_SLOT(oo, install("jsig"), mkString(sig));
   SET_SLOT(oo, install("dimension"), dim);
-  
+
   UNPROTECT(1); /* oo */
   return oo;
 }
@@ -910,17 +910,17 @@ static SEXP new_jrectRef(JNIEnv *env, jobject a, const char *sig, SEXP dim ) {
 /* 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));
@@ -929,7 +929,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");
@@ -985,12 +985,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++;
 	}
@@ -1067,7 +1067,7 @@ END_RJAVA_CALL
 REP void RclearException() {
   JNIEnv *env=getJNIEnv();
 BEGIN_RJAVA_CALL
-  (*env)->ExceptionClear(env);  
+  (*env)->ExceptionClear(env);
 END_RJAVA_CALL
 }
 
@@ -1094,7 +1094,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);
@@ -1102,7 +1102,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
diff --git a/src/fields.c b/src/fields.c
index 8c44afa..a6a88b3 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';
@@ -173,7 +173,7 @@ REPC SEXP RgetField(SEXP obj, SEXP sig, SEXP name, SEXP trueclass) {
     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);
@@ -283,7 +283,7 @@ REPC SEXP RgetField(SEXP obj, SEXP sig, SEXP name, SEXP trueclass) {
       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);
@@ -326,7 +326,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) {
@@ -385,7 +385,7 @@ REPC SEXP RsetField(SEXP ref, SEXP name, SEXP value) {
     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);
   if (cls_local) releaseObject(env, cls);
diff --git a/src/init.c b/src/init.c
index 9c2ee4b..3760fde 100644
--- a/src/init.c
+++ b/src/init.c
@@ -40,10 +40,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
 
@@ -101,16 +101,16 @@ static int initJVM(const char *user_classpath, int opts, char **optv, int hooks,
   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? */
@@ -132,19 +132,19 @@ static int initJVM(const char *user_classpath, int opts, char **optv, int hooks,
 
   /* leave room for class.path, and optional jni args */
   total_num_properties = 8 + opts;
-    
+
   vm_options = (JavaVMOption *) calloc(total_num_properties, sizeof(JavaVMOption));
   vm_args.options = vm_options;
   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;   
-  
+
+  vm_options[propNum++].optionString = classpath;
+
   /*   print JNI-related messages */
   /* vm_options[propNum++].optionString = "-verbose:class,jni"; */
-  
+
   if (optv) {
     int i = 0;
     while (i < opts) {
@@ -177,14 +177,14 @@ static int initJVM(const char *user_classpath, int opts, char **optv, int hooks,
 
   /* Create the Java VM */
   res = JNI_CreateJavaVM(&jvm,(void **)&eenv, &vm_args);
-  
+
   if (disableGuardPages && (res != 0 || !eenv))
     return -2; /* perhaps this VM does not allow disabling guard pages */
 
   if (res != 0)
     error("Cannot create Java virtual machine (%d)", res);
   if (!eenv)
-    error("Cannot obtain JVM environemnt");
+    error("Cannot obtain JVM environment");
 
 #if defined(_WIN64) || defined(_WIN32)
   _setmode(0, _O_TEXT);
@@ -246,8 +246,8 @@ HIDE void init_rJava(void) {
   jclass c;
   JNIEnv *env = getJNIEnv();
   if (!env) return; /* initJVMfailed, so we cannot proceed */
-  
-  /* get global classes. we make the references explicitely global (although unloading of String/Object is more than unlikely) */
+
+  /* get global classes. we make the references explicitly global (although unloading of String/Object is more than unlikely) */
   c=(*env)->FindClass(env, "java/lang/String");
   if (!c) error("unable to find the basic String class");
   javaStringClass=(*env)->NewGlobalRef(env, c);
@@ -274,17 +274,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");
@@ -303,10 +303,10 @@ static SEXP RinitJVM_real(SEXP par, int disableGuardPages)
   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));
 
@@ -346,7 +346,7 @@ static SEXP RinitJVM_real(SEXP par, int disableGuardPages)
   }
   if (jvm_opts)
       jvm_optv[jvm_opts] = 0;
-  
+
   r=JNI_GetCreatedJavaVMs(jvms, 32, &vms);
   if (r) {
     Rf_error("JNI_GetCreatedJavaVMs returned %d\n", r);
@@ -477,7 +477,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
@@ -512,7 +512,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.
     */
@@ -758,52 +758,51 @@ REP void doneJVM() {
  * 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(){
 
 	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/jri_glue.c b/src/jri_glue.c
index 85eab0d..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");
@@ -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/otables.c b/src/otables.c
index 216db95..4e23a38 100644
--- a/src/otables.c
+++ b/src/otables.c
@@ -15,38 +15,38 @@ HIDE SEXP R_getUnboundValue() {
 /**
  * @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 6f0368e..aabe975 100644
--- a/src/rJava.c
+++ b/src/rJava.c
@@ -5,7 +5,7 @@
 #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()! */
@@ -28,7 +28,7 @@ static SEXP getCurrentCall() {
 
 /** 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) {
@@ -40,7 +40,7 @@ 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 */
@@ -50,7 +50,7 @@ HIDE void throwR(SEXP msg, SEXP jobj, SEXP clazzes) {
 
 /* 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) {
@@ -61,19 +61,19 @@ 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);
 	if (!rj_RJavaTools_Class) {
 	    /* temporary warning due the JDK 12 breakage */
-	    REprintf("WARNING: Initial Java 12 release has broken JNI support and does NOT work. Use stable Java 11 (or watch for 12u if avaiable).\nERROR: Java exception occurred during rJava bootstrap - see stderr for Java stack trace.\n");
+	    REprintf("WARNING: Initial Java 12 release has broken JNI support and does NOT work. Use stable Java 11 (or watch for 12u if available).\nERROR: 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 = rj_RJavaTools_Class ? PROTECT( 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);
@@ -94,14 +94,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);
 					free(cn);
 					(*env)->ReleaseStringUTFChars(env, cname, c);
-				}		
+				}
 				(*env)->DeleteLocalRef(env, cname);
 			}
 			if ((*env)->ExceptionOccurred(env))
@@ -120,7 +120,7 @@ HIDE void ckx(JNIEnv *env) {
 		SET_SLOT(xr, install("jclass"), xclass ? xclass : mkString("java/lang/Throwable"));
 		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 ... */
@@ -162,7 +162,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;

From a1fb04bbf02aaa5f7737f890b0605485a5467ade Mon Sep 17 00:00:00 2001
From: Simon Urbanek 
Date: Wed, 7 Apr 2021 15:57:12 +1200
Subject: [PATCH 111/240] fix JavaDoc error

---
 src/java/RJavaClassLoader.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/java/RJavaClassLoader.java b/src/java/RJavaClassLoader.java
index 861c18e..ec85455 100644
--- a/src/java/RJavaClassLoader.java
+++ b/src/java/RJavaClassLoader.java
@@ -574,14 +574,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

From ed8773d553b9c0f8692e2ac57f58eaa262405bec Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 7 Apr 2021 17:45:35 +1200 Subject: [PATCH 112/240] remove warning about Java 12, hopefully users don't use it --- src/rJava.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/rJava.c b/src/rJava.c index aabe975..c8ad140 100644 --- a/src/rJava.c +++ b/src/rJava.c @@ -65,8 +65,7 @@ HIDE void ckx(JNIEnv *env) { yet this can be (also in theory) risky as it uses further JNI calls ... */ xobj = j2SEXP(env, x, 0); if (!rj_RJavaTools_Class) { - /* temporary warning due the JDK 12 breakage */ - REprintf("WARNING: Initial Java 12 release has broken JNI support and does NOT work. Use stable Java 11 (or watch for 12u if available).\nERROR: Java exception occurred during rJava bootstrap - see stderr for Java stack trace.\n"); + REprintf("ERROR: Java exception occurred during rJava bootstrap - see stderr for Java stack trace.\n"); (*env)->ExceptionDescribe(env); } (*env)->ExceptionClear(env); From baa25df4f558d84935250e99a26984e0f0f3f8c3 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 9 Apr 2021 13:05:07 +1200 Subject: [PATCH 113/240] J(): call .jinit() automatically if needed --- R/J.R | 1 + R/reflection.R | 1 + 2 files changed, 2 insertions(+) diff --git a/R/J.R b/R/J.R index 6df8af5..a6c89e1 100644 --- a/R/J.R +++ b/R/J.R @@ -1,6 +1,7 @@ setClass("jclassName", representation(name="character", jobj="jobjRef")) 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 ) diff --git a/R/reflection.R b/R/reflection.R index 3031192..e19307d 100644 --- a/R/reflection.R +++ b/R/reflection.R @@ -83,6 +83,7 @@ .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 (.need.init()) .jinit() if (is(o, "jclassName")) cl <- o@jobj else if (is(o, "jobjRef")) From 6e77ea41ee290e7102fe1c851c550c70c02a2627 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 9 Apr 2021 13:05:18 +1200 Subject: [PATCH 114/240] update NEWS --- NEWS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS b/NEWS index 0ace125..3195b44 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,9 @@ 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. + 0.9-14 2021-02-04 o JRI: fixed detection of the major Java version (#239) From 534ae222649b7a9c943896b524b5a7aca6599a1b Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 9 Apr 2021 13:50:47 +1200 Subject: [PATCH 115/240] support .jchar("foo") via toCharArray() call --- R/0classes.R | 11 ++++++++--- man/jfloat.Rd | 19 ++++++++++++++----- 2 files changed, 22 insertions(+), 8 deletions(-) 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/man/jfloat.Rd b/man/jfloat.Rd index 9fb781d..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) @@ -48,11 +50,18 @@ 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 to Java. Note - that byte arrays are natively passed as RAW vectors, not as - \code{.jbyte} arrays. + 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 may be based on - \code{character} vectors in the future. + \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}} From 87df51fc81181e000f9a506b1f4adc9ae5e23db1 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 9 Apr 2021 13:54:16 +1200 Subject: [PATCH 116/240] update NEWS --- NEWS | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/NEWS b/NEWS index 3195b44..a8c125f 100644 --- a/NEWS +++ b/NEWS @@ -14,13 +14,18 @@ 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. + 0.9-14 2021-02-04 o JRI: fixed detection of the major Java version (#239) From 3967d87c48c54a3b730a24be4340844f91199dcd Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 9 Apr 2021 14:06:55 +1200 Subject: [PATCH 117/240] recognise raw vectors in J() API (closes #260) --- R/reflection.R | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/R/reflection.R b/R/reflection.R index e19307d..7ae2394 100644 --- a/R/reflection.R +++ b/R/reflection.R @@ -44,7 +44,9 @@ ._java_valid_object <- function(a) { if (is(a, "jobjRef")) a else if (is(a, "jclassName")) a@jobj - else if (is.null(a)) .jnull() else { + else if (is.null(a)) .jnull() + else if (is.raw(a)) .jarray(a, dispatch=FALSE) ## raw is always [B + else { cm <- match(class(a)[1], names(.class.to.jclass)) if (!any(is.na(cm))) { if (length(a) == 1) { @@ -53,7 +55,7 @@ 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.") } } } From 0b1e4a85fb6e5e3f15f45191a2c7d2458388e87b Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 9 Apr 2021 14:07:46 +1200 Subject: [PATCH 118/240] update NEWS --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index a8c125f..9c75134 100644 --- a/NEWS +++ b/NEWS @@ -26,6 +26,8 @@ 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) From 90c952e6ed3cea3c7a0659c56852849fe8cd1140 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 12 Apr 2021 17:07:15 +1200 Subject: [PATCH 119/240] update NEWS --- NEWS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 9c75134..b0c16ac 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,7 @@ NEWS/ChangeLog for rJava -------------------------- -1.0-1 (under development) +1.0-1 2020-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 From e40b124eb7df9b9b24c00d15d3a9ff2c7afb0927 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Tue, 13 Apr 2021 11:16:34 +1200 Subject: [PATCH 120/240] bump version to 1.0-2 --- src/rJava.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rJava.h b/src/rJava.h index 1ab19a7..d93b876 100644 --- a/src/rJava.h +++ b/src/rJava.h @@ -1,7 +1,7 @@ #ifndef __RJAVA_H__ #define __RJAVA_H__ -#define RJAVA_VER 0x010001 /* rJava v1.0-1 */ +#define RJAVA_VER 0x010002 /* rJava v1.0-2 */ /* important changes between versions: 3.0 - adds compiler From 57922df5501a7fe2c449b25eabe83e3ababb2565 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Tue, 13 Apr 2021 14:42:45 +1200 Subject: [PATCH 121/240] convert UTF-16 surrogate paris from Java to UTF-8 (addresses one part of #51) --- src/Rglue.c | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++-- src/rJava.h | 2 +- src/tools.c | 4 ++- 3 files changed, 100 insertions(+), 4 deletions(-) diff --git a/src/Rglue.c b/src/Rglue.c index b45dba8..3e1d828 100644 --- a/src/Rglue.c +++ b/src/Rglue.c @@ -157,9 +157,103 @@ 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 */ 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 */ + 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 */ } + +/* Java returns *modified* UTF-8 which is incompatible with UTF-8, + so we have to detect the illegal surrgoate pairs and convert them */ +SEXP mkCharUTF8(const char *src) { + 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) + Rf_error("Cannot allocate memory for surrogate pair conversion"); + } 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); + Rf_error("illegal 2-byte sequence in Java string"); + } + *(d++) = *(c++); + continue; + } + if ((c[-1] & 0xF0) != 0xE0) { /* must be 3-byte */ + if (dst) free(dst); + Rf_error("illegal multi-byte seqeunce in Java string (>3-byte)"); + } + if (((c[0] & 0xC0) != 0x80 || + (c[1] & 0xC0) != 0x80)) { + if (dst) free(dst); + Rf_error("illegal 3-byte sequence in Java string"); + } + 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); + Rf_error("illegal sequence in Java string: low surrogate pair without a high one"); + } + c += 2; /* move to the low pair */ + if (c[0] != 0xED || + (c[1] & 0xF0) != 0xB0 || + (c[2] & 0xC0) != 0x80) { + if (dst) free(dst); + Rf_error("illegal sequence in Java string: high surrogate pair not followed by low one"); + } + /* 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); +} + #endif HIDE void deserializeSEXP(SEXP o) { diff --git a/src/rJava.h b/src/rJava.h index d93b876..dd813d4 100644 --- a/src/rJava.h +++ b/src/rJava.h @@ -102,8 +102,8 @@ void profReport(char *fmt, ...); #define mkCharUTF8(X) mkChar(X) #define CHAR_UTF8(X) CHAR(X) #else -#define mkCharUTF8(X) mkCharCE(X, CE_UTF8) #define CHAR_UTF8(X) rj_char_utf8(X) +extern SEXP mkCharUTF8(const char *); extern const char *rj_char_utf8(SEXP); #endif diff --git a/src/tools.c b/src/tools.c index 3b27c11..8d84012 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; From 370f8ad186782e12a5dc8f034364a894a5359e3e Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Thu, 15 Apr 2021 12:45:33 +1200 Subject: [PATCH 122/240] add newString16() JNI API to create strings from UTF-16 --- src/callJNI.c | 6 ++++++ src/rJava.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/callJNI.c b/src/callJNI.c index 24b6d8f..7b26c35 100644 --- a/src/callJNI.c +++ b/src/callJNI.c @@ -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/rJava.h b/src/rJava.h index dd813d4..6dbdcb5 100644 --- a/src/rJava.h +++ b/src/rJava.h @@ -201,6 +201,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); From 73dc631170eaeaf8a0b1924222a31ab90b5820c9 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Thu, 15 Apr 2021 13:11:16 +1200 Subject: [PATCH 123/240] minor fixes --- src/Rglue.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 68 insertions(+), 4 deletions(-) diff --git a/src/Rglue.c b/src/Rglue.c index 3e1d828..9d71565 100644 --- a/src/Rglue.c +++ b/src/Rglue.c @@ -4,6 +4,8 @@ #include #include #include +#include +#include /* R 4.0.1 broke EXTPTR_PTR ABI so re-map it to safety at the small expense of speed */ @@ -155,11 +157,67 @@ 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 */ const char *rj_char_utf8(SEXP s) { 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 */ } +#ifdef WIN32 +extern unsigned int localeCP; +static char cpbuf[16]; +#endif +static jchar js_zero[2] = { 0, 0 }; +static jchar js_buf[128]; +/* 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 */ +int rj_char_utf16(SEXP s, jchar **buf) { + void *ih; + 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; + } + 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; + + switch (ce_in) { +#ifdef WIN32 + case CE_NATIVE: + sprintf(cpbuf, "CP%d", localeCP); + ifrom = cpbuf; + break; + case CE_LATIN1: ifrom = "CP1252"; break; +#else + case CE_LATIN1: ifrom = "latin1"; break; +#endif + default: + ifrom = "UTF-8"; break; + } + + ih = Riconv_open(((char*)&end_test)[0] == 1 ? "UTF-16LE" : "UTF-16BE", ifrom); + if(ih == (void *)(-1)) + Rf_error("Unable to start conversion to UTF-16"); + 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) + Rf_error("Conversion to UTF-16 failed due to unexpectedly large buffer requirements."); + else if(res == -1 && (errno == EILSEQ || errno == EINVAL)) { /* invalid char */ + *(dst++) = '?'; + *(dst++) = 0; + osize -= 2; + c++; + isize--; + } + } + Riconv_close(ih); + return dst - (char*) js; +} + /* Java returns *modified* UTF-8 which is incompatible with UTF-8, so we have to detect the illegal surrgoate pairs and convert them */ SEXP mkCharUTF8(const char *src) { @@ -256,6 +314,12 @@ SEXP mkCharUTF8(const char *src) { #endif +static jstring newJavaString(JNIEnv *env, SEXP sChar) { + jchar *s; + size_t len = rj_char_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)); SEXP s = EXTPTR_PROT(o); @@ -360,7 +424,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; @@ -376,7 +440,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); @@ -1058,7 +1122,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); } From b1db73d05117cc4454505a922509d70296031724 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Thu, 15 Apr 2021 14:16:57 +1200 Subject: [PATCH 124/240] Add pre-compiled test classes --- tests/old/Leaks.class | Bin 0 -> 1442 bytes tests/old/Types.class | Bin 0 -> 2078 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 tests/old/Leaks.class create mode 100644 tests/old/Types.class diff --git a/tests/old/Leaks.class b/tests/old/Leaks.class new file mode 100644 index 0000000000000000000000000000000000000000..89c73593e2ced17470f69cad17ca8b8943e2a9c5 GIT binary patch literal 1442 zcma)6X-^YT6g{td%RpI5Wf3VVFfA2CTmd%_kX^-?7(NZ&7FJBz304{{`~dzJAg^NOdyTvIC^nQg_$UBCvXRMRk)|Z{U{zJ z5W{o~vud4F$$1qXhRMKR2rB<5hQ~2HiQ%cbTZm#Yif01C6bS6Da#IoL+1)ra-WgLR z!#bGSact8%m=lQ1o0jQ366n)+S6ftM-w1>j%llFwxnWvzt9raA?bpU$iJ8!Wban)K z^=u2I_n6H?e9R?g%af8(kOb&@i~80a=O_|HIHAiFJ~1j4(nQ>K`+xYh_YP&jp6YDY-QWol*a-oJ=@Bt#7?DrvKW0Yug*?#Z3zs5O~p7Ye8zV;7z z%qe?>7~uz#<_8dfQ08+dl>b~4+zsL~;}Gv=SP|r!%$-5xCQcE^xpaV~xr<@`PC3ZB3FLjsX}@**7lhYyHAHwto6lgFXON-$BhYAR95?tE=@~1j zM@_!u!=v92dwYg>ccO+iQfa)}WeOd~HFS1&dC7LQ@AeDSzK8o7Qgub1&7*8P#KW=<(x2g4 zKIpS=^%}EW%LjjekNpe&510F!uujv1$@(rc*|TTQOup~$fB*aozyiKZVgesI7{|xr zJ`wk+xX;9W9wi7H->OG4s>QBz6;4#a&St|hK5 z?vA)aad*Xa;y8-qo(1cKwo9wiR%s2|8coxxv=(iH)~0RJ_GlH_K5gAXcB@_csl`drkNsBX;F<-c$*MFdl_sCkBvYD9N|Q!uawts#rMW|Fxz%YMuULr8&EK+MuO00* zEu^+uo#yuayY;5OQ>!0xCZc^Z5JWY~q}t~WoS8_o5W96h=7^}VKEkehb#BCfiaMA^ktIOk#t z(=N_q#>LaP;9?ffxR}Gd3lA5m_~?#{8C-I)B)=}mif3i*qAYt(mOU>kuHd4J%d+eR zT(S@~8(K&|e%u@NcC&GeY5sX8_^-^u5)sTS(P1K`m`F7yQjm$%WFlpmNM$Bc7o#JB zOr$y!sm(;nGm+9wq*4>9(?p6kk&+n;RKmNVe~F_LM3@09-XE|$y9ec^AM_CM(v2Q$ zFJnLIA=(cyFNb&!4nwjB*UJv~FyduXJ*0mngN2vrJtR$T^O_y%N%5xh)HBJ;o}nI( z-zDm~N-Yjv!L?HzlSTz#|Ax%NfGuWb75#F6EOR7^qu%d`g`p9WzKRtBeLPLDFa#Iz-Y9YzCx?H)|fM@FQdY+4~RWa`bk9EJGfy|4>dCI!w|nyc3WL z(2$P(#5hPg!qIks98@|IhNeh*1Mdc;fzsm7A<{H4?*+&~rEVCSA?Zz21JXcg>6Z|x z)cQ_<98{VPLq`dHAGc0PZ?gzpl3np8qyQ(S{>oB*c@|{U%SU^Nd4-tN-dIA4uINYs zmWG}vy)0~U6j^d5(|#_q0Xg^}*kzmVF+_wn-o@xd7um@!a^)`adAo~DA=*V@EZ)Uf zG0{b_l#qh4%$eI-11o>)oA(w$ Date: Thu, 15 Apr 2021 14:27:22 +1200 Subject: [PATCH 125/240] update NEWS --- NEWS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/NEWS b/NEWS index b0c16ac..8fde2e4 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,13 @@ NEWS/ChangeLog for rJava -------------------------- +1.0-2 (under development) + 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 + + 1.0-1 2020-04-12 o New feature: support for custom class loaders. It is strongly recommended that package authors that use rJava in their From c76e58bae44faa934d30f6532553ae578a6ba791 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Thu, 15 Apr 2021 14:27:41 +1200 Subject: [PATCH 126/240] fix the leaks test --- tests/old/leaks.R | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/old/leaks.R b/tests/old/leaks.R index cae4bb4..a38c7e4 100644 --- a/tests/old/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") From aebb7006ddb8377ac0c55d258200a6494e5fc470 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Thu, 15 Apr 2021 14:44:54 +1200 Subject: [PATCH 127/240] adjust to the inconsistency between Win and unix R API for callbacks --- jri/src/Rcallbacks.h | 7 ++++++- jri/src/Rinit.c | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/jri/src/Rcallbacks.h b/jri/src/Rcallbacks.h index 9bd75a8..365ca85 100644 --- a/jri/src/Rcallbacks.h +++ b/jri/src/Rcallbacks.h @@ -12,8 +12,13 @@ #else #define RCCONST const #endif +#ifdef WIN32 +#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); diff --git a/jri/src/Rinit.c b/jri/src/Rinit.c index da1547f..2341c5b 100644 --- a/jri/src/Rinit.c +++ b/jri/src/Rinit.c @@ -161,7 +161,7 @@ void myCallBack() #define CANCEL 0 #endif -int myYesNoCancel(char *s) +int myYesNoCancel(RCCONST char *s) { char ss[128]; unsigned char a[3]; From 30eafe70c78702f73c3bbc8c6717d58657aedd3e Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Thu, 15 Apr 2021 14:50:43 +1200 Subject: [PATCH 128/240] also include Rcallbacks.c --- jri/src/Rcallbacks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jri/src/Rcallbacks.c b/jri/src/Rcallbacks.c index fccb688..a4e0130 100644 --- a/jri/src/Rcallbacks.c +++ b/jri/src/Rcallbacks.c @@ -62,7 +62,7 @@ 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; jmethodID mid; From d2a1e1a843b9690d4a3f669a809effc7be52c7f4 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Thu, 15 Apr 2021 15:17:45 +1200 Subject: [PATCH 129/240] update NEWS --- NEWS | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 8fde2e4..1fd5bb4 100644 --- a/NEWS +++ b/NEWS @@ -1,12 +1,15 @@ NEWS/ChangeLog for rJava -------------------------- -1.0-2 (under development) +1.0-2 2020-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 2020-04-12 o New feature: support for custom class loaders. It is strongly From f3b1b34fd65f93761c488be1e33f3b8343fb4c78 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Thu, 15 Apr 2021 15:20:44 +1200 Subject: [PATCH 130/240] fix dates in the NEWS file --- NEWS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 1fd5bb4..234be0f 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,7 @@ NEWS/ChangeLog for rJava -------------------------- -1.0-2 2020-04-15 +1.0-2 2021-04-15 o convert UTF-16 surrogate pairs to UTF-8 when retrieving strings from Java to R (#51) @@ -11,7 +11,7 @@ different types on Windows and unix. -1.0-1 2020-04-12 +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 From 637f8c359c1b49ca5b7a2474d12c18e8bae91e17 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 16 Apr 2021 21:39:49 +1200 Subject: [PATCH 131/240] bump version to 1.0-3 --- src/rJava.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rJava.h b/src/rJava.h index 6dbdcb5..2f4824d 100644 --- a/src/rJava.h +++ b/src/rJava.h @@ -1,7 +1,7 @@ #ifndef __RJAVA_H__ #define __RJAVA_H__ -#define RJAVA_VER 0x010002 /* rJava v1.0-2 */ +#define RJAVA_VER 0x010003 /* rJava v1.0-3 */ /* important changes between versions: 3.0 - adds compiler From 52964c2562e2c0baa34ade54880637ab87f7605b Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 16 Apr 2021 21:40:48 +1200 Subject: [PATCH 132/240] update references to Java docs to current 1.8 links --- man/with.Rd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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()} From 64eca340f2f3d66a02df11b27db1f1d66a9a9d6c Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 16 Apr 2021 21:42:50 +1200 Subject: [PATCH 133/240] update NEWS --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index 234be0f..2baff9c 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,10 @@ NEWS/ChangeLog for rJava -------------------------- +1.0-3 + o update URLs referring 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) From e6b495d1ee85a869d29986f0777d8126f7931927 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 16 Apr 2021 21:43:34 +1200 Subject: [PATCH 134/240] minor typo --- NEWS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 2baff9c..6f9ac1b 100644 --- a/NEWS +++ b/NEWS @@ -2,7 +2,7 @@ -------------------------- 1.0-3 - o update URLs referring Java docs to current 1.8 website + o update URLs referring to Java docs to current 1.8 website 1.0-2 2021-04-15 From 571cd482e4503543504c14283b545382a48f0382 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Thu, 29 Apr 2021 02:13:24 +0000 Subject: [PATCH 135/240] bump version to 1.0-4 --- src/rJava.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rJava.h b/src/rJava.h index 2f4824d..f2157fa 100644 --- a/src/rJava.h +++ b/src/rJava.h @@ -1,7 +1,7 @@ #ifndef __RJAVA_H__ #define __RJAVA_H__ -#define RJAVA_VER 0x010003 /* rJava v1.0-3 */ +#define RJAVA_VER 0x010004 /* rJava v1.0-4 */ /* important changes between versions: 3.0 - adds compiler From a9ec2ea1274a08c5ce15c2ee497d6e5918b834de Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Thu, 29 Apr 2021 02:14:33 +0000 Subject: [PATCH 136/240] make sure jverify() is has a valid EXTPTR to work on --- src/rJava.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rJava.h b/src/rJava.h index f2157fa..a3f9062 100644 --- a/src/rJava.h +++ b/src/rJava.h @@ -222,7 +222,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") ) From a518a50038ab0ddfa5445b04529e690a2d3da49b Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Thu, 29 Apr 2021 02:15:20 +0000 Subject: [PATCH 137/240] minor: cache jobj in inputToClass --- src/fields.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/fields.c b/src/fields.c index a6a88b3..0329aad 100644 --- a/src/fields.c +++ b/src/fields.c @@ -32,6 +32,8 @@ 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. @@ -47,11 +49,14 @@ static jclass inputToClass(JNIEnv *env, SEXP obj, jobject *jobj, int *is_local) 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, install("jobj")); + 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, install("jobj")); + obj = GET_SLOT(obj, R_Sym_jobj); jverify(obj); cls = (jclass)EXTPTR_PTR(obj); #ifdef RJ_DEBUG From 00e59a8f7ce5157ac39a520d02fb5dd4446bcf66 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Thu, 29 Apr 2021 02:18:21 +0000 Subject: [PATCH 138/240] update NEWS --- NEWS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/NEWS b/NEWS index 6f9ac1b..2f392fe 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,13 @@ NEWS/ChangeLog for rJava -------------------------- +1.0-4 + 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 o update URLs referring to Java docs to current 1.8 website From aac64ae8a9498439d3ac9daafc27f6d868175f03 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 3 Sep 2021 12:16:46 +1200 Subject: [PATCH 139/240] Add troubleshooting guide --- README.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/README.md b/README.md index eaec1d0..f0b6204 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,8 @@ version with The RForge.net repository is updated automatically on each commit. On macOS/Windows 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 When checking out the sources, you *must* use @@ -39,3 +41,40 @@ generate one (which involves compilation of Java code). Please use [rJava GitHub issues page](https://github.com/s-u/rJava/issues) to report bugs. + +## 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. 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. Most commonly used distributions are [adoptium.net](https://adoptium.net) (Intel-based Macs only), [Azul Zulu](https://www.azul.com/downloads/) (includes Apple silicon). Please note that on Apple silicon (M1+) based Macs you will need latest R-4.1.1-patched from https://mac.R-project.org 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 settinbgs, 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. + +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. + +If you are installing rJava from sources, make sure you have a full JDK installed and all 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-4.tar.gz +tar fxz rJava_1.0-4.tar.gz +R CMD INSTALL rJava +## on failure check rJava/config.log +``` From 79d95afc37f0766099b34d171a76b004b34991d6 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 3 Sep 2021 12:23:50 +1200 Subject: [PATCH 140/240] fix RForge link and minor typos --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f0b6204..3f5cdda 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ 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. ### Installation @@ -48,7 +48,7 @@ Rule #1: do __not__ set `JAVA_HOME` unless you are an expert. rJava attempts to ### 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. Most common mistake is to use 64-bit R but only have 32-bit Java installed. +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. Teh 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. @@ -60,7 +60,7 @@ When installing from a zip or tar ball, put your Java installation in `/Library/ 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 settinbgs, 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. +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 @@ -70,7 +70,7 @@ Also note that `sudo` may change environment variables, so if you need to run wi 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. -If you are installing rJava from sources, make sure you have a full JDK installed and all 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.: +If you are installing rJava from sources, make sure you have a 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-4.tar.gz From d9264aee43087cf44498f9d3cdcf4ba7f86c9c96 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 17 Sep 2021 11:50:30 +1200 Subject: [PATCH 141/240] bump version to 1.0-5 --- src/rJava.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rJava.h b/src/rJava.h index a3f9062..7e2ea26 100644 --- a/src/rJava.h +++ b/src/rJava.h @@ -1,7 +1,7 @@ #ifndef __RJAVA_H__ #define __RJAVA_H__ -#define RJAVA_VER 0x010004 /* rJava v1.0-4 */ +#define RJAVA_VER 0x010005 /* rJava v1.0-5 */ /* important changes between versions: 3.0 - adds compiler From d5909dfd8c5ac7e6eac43e579c136226716fb7c5 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 17 Sep 2021 11:50:58 +1200 Subject: [PATCH 142/240] implicit cloning no longer works in JDK-17 --- src/java/DummyPoint.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); + } } From 8be7a8acc45fb1f64a069c7d817ee4a3cd766a0b Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 17 Sep 2021 11:51:15 +1200 Subject: [PATCH 143/240] access overrides no longer work in JDK-17, expect more fall out in user code --- src/java/RJavaArrayTools.java | 38 +++++++++++++++++++++++------------ src/java/RJavaTools.java | 24 +++++++++++++++++----- src/java/RJavaTools_Test.java | 3 ++- 3 files changed, 46 insertions(+), 19 deletions(-) diff --git a/src/java/RJavaArrayTools.java b/src/java/RJavaArrayTools.java index 6f1098a..3ac89b5 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 Date: Fri, 17 Sep 2021 11:59:11 +1200 Subject: [PATCH 144/240] update NEWS --- NEWS | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/NEWS b/NEWS index 2f392fe..ee45468 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,18 @@ NEWS/ChangeLog for rJava -------------------------- +1.0-5 (under development) + 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 o make jverify() check the object type before checking for serialization content. This fixes possible segfaults, From 0c4024c70f78c025b4166defecaca3e6f48ba5e8 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 1 Oct 2021 18:18:43 +1300 Subject: [PATCH 145/240] Update README - Adoptium now has arm64 as well --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3f5cdda..2ef3e03 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ rJava determines the Java location from the registry, so make sure you use the o ### macOS -On modern macOS versions Apple no longer supplies Java, so it must be downloaded from 3rd parties. Most commonly used distributions are [adoptium.net](https://adoptium.net) (Intel-based Macs only), [Azul Zulu](https://www.azul.com/downloads/) (includes Apple silicon). Please note that on Apple silicon (M1+) based Macs you will need latest R-4.1.1-patched from https://mac.R-project.org or else you will get `trap R` errors when loading Java (see [#267](https://github.com/s-u/rJava/issues/267) for details). +On modern macOS versions Apple no longer supplies Java, so it must be downloaded from 3rd parties. Probably the most commonly used distribution 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 latest R-4.1.1-patched from https://mac.R-project.org 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`. From cf7a0f3d36f3326a690cfa6880b2819bae1970bc Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 3 Nov 2021 13:07:40 +1300 Subject: [PATCH 146/240] bump version to 1.0-6 --- src/rJava.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rJava.h b/src/rJava.h index 7e2ea26..3e70311 100644 --- a/src/rJava.h +++ b/src/rJava.h @@ -1,7 +1,7 @@ #ifndef __RJAVA_H__ #define __RJAVA_H__ -#define RJAVA_VER 0x010005 /* rJava v1.0-5 */ +#define RJAVA_VER 0x010006 /* rJava v1.0-6 */ /* important changes between versions: 3.0 - adds compiler From 8c954eac1379ce88bfc63a1244fd528c99e5c295 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 3 Nov 2021 13:10:41 +1300 Subject: [PATCH 147/240] remove obsolete autoconf macros --- configure.ac | 35 ++++++++++++----------------------- jri/configure.ac | 2 +- 2 files changed, 13 insertions(+), 24 deletions(-) diff --git a/configure.ac b/configure.ac index a943dc0..79a175f 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ # 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 @@ -24,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@:>@])], @@ -34,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 @@ -47,51 +45,44 @@ 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], -[AC_HELP_STRING([--enable-dynload], - [load JVM dynamically (without linking). @<:@auto@:>@])], +[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]) @@ -103,15 +94,13 @@ 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([[ static inline int foo(int a, int b); diff --git a/jri/configure.ac b/jri/configure.ac index 323d1a3..8354f9f 100644 --- a/jri/configure.ac +++ b/jri/configure.ac @@ -65,7 +65,7 @@ AC_SUBST(R_INCLUDE_DIR) AC_LANG(C) AC_PROG_CC -AC_HEADER_STDC + ## RUN_JAVA(variable for the result, parameters) ## ---------- From fdd0b139fbf4f8bcf452bc010ac8ef22f94e3306 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 12 Nov 2021 17:36:05 +1300 Subject: [PATCH 148/240] bump JRI version to 0.5-7 --- jri/src/jri.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jri/src/jri.h b/jri/src/jri.h index ffae8a1..81e485a 100644 --- a/jri/src/jri.h +++ b/jri/src/jri.h @@ -2,6 +2,9 @@ #define __JRI_H__ #include +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include #include @@ -9,7 +12,7 @@ /* the viewpoint is from R, i.e. "get" means "Java->R" whereas "put" means "R->Java" */ -#define JRI_VERSION 0x0506 /* JRI v0.5-6 */ +#define JRI_VERSION 0x0507 /* JRI v0.5-7 */ #define JRI_API 0x010a /* API-version 1.10 */ #ifdef __cplusplus From ced5a66c3d0ab94af6f6973ceb47049409650f11 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 12 Nov 2021 17:36:42 +1300 Subject: [PATCH 149/240] include config.h for autoconf-based targets --- jri/src/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jri/src/Makefile.in b/jri/src/Makefile.in index f916892..db85903 100644 --- a/jri/src/Makefile.in +++ b/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@ From 27527bb3c336ae8bf3789f8c923dad433d8a3382 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 12 Nov 2021 17:37:34 +1300 Subject: [PATCH 150/240] add JRI_CPPFLAGS and JRI_LIBS allowing custom flag overrides --- jri/src/Makefile.all | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/jri/src/Makefile.all b/jri/src/Makefile.all index b8c79f5..081a9b2 100644 --- a/jri/src/Makefile.all +++ b/jri/src/Makefile.all @@ -1,5 +1,7 @@ # 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 @@ -7,38 +9,38 @@ TARGETS=$(JNIPREFIX)jri$(JNISO) JRI.jar all: $(TARGETS) JRI.jar: $(JRI_JSRC) $(JNIPREFIX)jri$(JNISO) - $(JAVAC) $(JFLAGS) -d . $(JRI_JSRC) + $(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 org_rosuda_JRI_Rengine.h - $(CC) -c -o $@ $< $(CFLAGS) $(CPICF) $(JAVAINC) $(RINC) + $(CC) -c -o $@ $< $(CFLAGS) $(CPICF) $(JAVAINC) $(RINC) $(JRI_CPPFLAGS) Rinit.o: Rinit.c Rinit.h Rcallbacks.h - $(CC) -c -o $@ $< $(CFLAGS) $(CPICF) $(RINC) + $(CC) -c -o $@ $< $(CFLAGS) $(CPICF) $(RINC) $(JRI_CPPFLAGS) globals.o: globals.c globals.h - $(CC) -c -o $@ $< $(CFLAGS) $(CPICF) $(JAVAINC) + $(CC) -c -o $@ $< $(CFLAGS) $(CPICF) $(JAVAINC) $(JRI_CPPFLAGS) rjava.o: rjava.c rjava.h - $(CC) -c -o $@ $< $(CFLAGS) $(CPICF) $(JAVAINC) + $(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) + $(CC) -c -o $@ Rengine.c $(CFLAGS) $(CPICF) $(JAVAINC) $(RINC) $(JRI_CPPFLAGS) jri.o: jri.c - $(CC) -c -o $@ jri.c $(CFLAGS) $(CPICF) $(JAVAINC) $(RINC) + $(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 $(JRIDEPS) - $(CC) -o $@ $^ $(LDFLAGS) $(JNILD) $(RLD) + $(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) -d . $^ + $(JAVAC) $(JFLAGS) $(JRI_JFLAGS) -d . $^ clean: rm -rf $(TARGETS) org *.o *~ org_rosuda_JRI_Rengine.h *$(JNISO) *.class *~ From ba13d4b4bea89bc2e5121e1351b7026b23e5bf53 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 12 Nov 2021 17:38:17 +1300 Subject: [PATCH 151/240] add checks for header files needed by R_ext/eventloop.h --- jri/configure.ac | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jri/configure.ac b/jri/configure.ac index 8354f9f..3e56081 100644 --- a/jri/configure.ac +++ b/jri/configure.ac @@ -66,6 +66,9 @@ AC_SUBST(R_INCLUDE_DIR) AC_LANG(C) AC_PROG_CC +## 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) ## ---------- From 250d6b56241c86fb046e6053040aa7feef6bbdb8 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 12 Nov 2021 17:39:51 +1300 Subject: [PATCH 152/240] update artifacts --- jri/configure | 2836 ++++++++++++++++++++++++------------------- jri/src/config.h.in | 40 +- 2 files changed, 1647 insertions(+), 1229 deletions(-) diff --git a/jri/configure b/jri/configure index 8688f81..52b313d 100755 --- a/jri/configure +++ b/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.71 for JRI 0.3. # # Report bugs to . # # -# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, +# Inc. # # # This configure script is free software; the Free Software Foundation @@ -16,14 +17,16 @@ # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +as_nop=: +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 +else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -33,46 +36,46 @@ 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,8 +92,12 @@ 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 @@ -109,30 +109,10 @@ 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. @@ -154,20 +134,22 @@ 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 +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="as_nop=: +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 +else \$as_nop case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( @@ -187,42 +169,52 @@ 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 +else \$as_nop exitcode=1; echo positional parameters were not saved. 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 +else $as_nop as_have_required=no 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 +else $as_nop 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 +222,21 @@ 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 $as_nop + 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 +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 @@ -255,18 +254,19 @@ 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 +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 @@ -294,6 +294,7 @@ as_fn_unset () } as_unset=as_fn_unset + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -311,6 +312,14 @@ as_fn_exit () as_fn_set_status $1 exit $1 } # as_fn_exit +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop # as_fn_mkdir_p # ------------- @@ -325,7 +334,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 +343,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,12 +382,13 @@ 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 +else $as_nop as_fn_append () { eval $1=\$$1\$2 @@ -390,18 +400,27 @@ 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 +else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- @@ -413,9 +432,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 +461,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 @@ -486,7 +505,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 +519,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 +536,13 @@ 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 @@ -586,6 +616,38 @@ PACKAGE_BUGREPORT='simon.urbanek@r-project.org' PACKAGE_URL='' ac_unique_file="src/jri.h" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_STDIO_H +# include +#endif +#ifdef HAVE_STDLIB_H +# include +#endif +#ifdef HAVE_STRING_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_header_c_list= ac_subst_vars='LTLIBOBJS LIBOBJS DEFFLAGS @@ -605,9 +667,6 @@ JAR JAVAH JAVAC JAVA_PROG -EGREP -GREP -CPP OBJEXT EXEEXT ac_ct_CC @@ -646,6 +705,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -676,8 +736,7 @@ CC CFLAGS LDFLAGS LIBS -CPPFLAGS -CPP' +CPPFLAGS' # Initialize some variables set by options. @@ -716,6 +775,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -745,8 +805,6 @@ do *) ac_optarg=yes ;; esac - # Accept the important Cygnus configure options, so we can diagnose typos. - case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; @@ -787,9 +845,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # 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" @@ -813,9 +871,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" @@ -968,6 +1026,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=* \ @@ -1017,9 +1084,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" @@ -1033,9 +1100,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" @@ -1079,9 +1146,9 @@ Try \`$0 --help' for more information" *) # 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}" ;; @@ -1097,7 +1164,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 @@ -1105,7 +1172,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. @@ -1161,7 +1228,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 @@ -1258,6 +1325,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] @@ -1295,7 +1363,6 @@ 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 it to find libraries and programs with nonstandard names/locations. @@ -1316,9 +1383,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/ ;; @@ -1346,7 +1413,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 @@ -1354,7 +1422,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 @@ -1364,9 +1432,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.71 -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1383,14 +1451,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 @@ -1398,14 +1466,15 @@ $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 $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1415,47 +1484,90 @@ fi } # 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 - if { { ac_try="$ac_cpp 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 $as_nop + 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 $as_nop + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +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 + 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 $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_retval=1 + 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_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 @@ -1465,25 +1577,26 @@ 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 $as_nop + 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 @@ -1493,60 +1606,34 @@ fi 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.71. Invocation command line was - $ $0 $@ + $ $0$ac_configure_args_raw _ACEOF exec 5>>config.log @@ -1579,8 +1666,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 @@ -1615,7 +1706,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'" ;; @@ -1650,11 +1741,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 @@ -1665,8 +1758,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) ;; #( @@ -1690,7 +1783,7 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; ) echo - $as_echo "## ----------------- ## + printf "%s\n" "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo @@ -1698,14 +1791,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 @@ -1713,15 +1806,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 @@ -1729,8 +1822,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 && @@ -1744,63 +1837,48 @@ 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; } fi @@ -1810,19 +1888,434 @@ 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 (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 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 + +#include +extern int puts (const char *); +extern int printf (const char *, ...); +extern int dprintf (int, const char *, ...); +extern void *malloc (size_t); + +// 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) +{ + // See if C++-style comments work. + // 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; + + // 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 $as_nop + as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$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. +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 @@ -1833,12 +2326,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=: ;; ,);; *) @@ -1847,24 +2340,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 @@ -1874,11 +2367,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. ## @@ -1894,56 +2388,32 @@ 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 + # 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 $as_nop 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 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;; @@ -1962,21 +2432,22 @@ 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 +{ 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 $as_nop 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 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;; @@ -2059,6 +2530,15 @@ 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' @@ -2067,11 +2547,12 @@ 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 +{ 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 $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -2079,11 +2560,15 @@ 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 @@ -2094,11 +2579,11 @@ fi 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 @@ -2107,11 +2592,12 @@ 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 +{ 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 $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -2119,11 +2605,15 @@ 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 @@ -2134,11 +2624,11 @@ fi 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 @@ -2146,8 +2636,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 @@ -2160,11 +2650,12 @@ 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 +{ 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 $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -2172,11 +2663,15 @@ 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 @@ -2187,11 +2682,11 @@ fi 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 @@ -2200,11 +2695,12 @@ 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 +{ 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 $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -2213,15 +2709,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 @@ -2237,18 +2737,18 @@ 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 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 @@ -2259,11 +2759,12 @@ 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 +{ 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 $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -2271,11 +2772,15 @@ 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 @@ -2286,11 +2791,11 @@ fi 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 @@ -2303,11 +2808,12 @@ 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 +{ 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 $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -2315,11 +2821,15 @@ 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 @@ -2330,11 +2840,11 @@ fi 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 @@ -2346,34 +2856,138 @@ 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 $as_nop + 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 +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 $as_nop + 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 +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; } # 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 @@ -2383,7 +2997,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 @@ -2391,7 +3005,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; @@ -2403,9 +3017,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.*" @@ -2426,11 +3040,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_link_default") 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 : # 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, @@ -2447,7 +3062,7 @@ 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 @@ -2463,44 +3078,46 @@ do done test "$ac_cv_exeext" = no && ac_cv_exeext= -else +else $as_nop ac_file='' 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; } -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; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +fi +{ 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 : + 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 @@ -2514,15 +3131,15 @@ 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 $as_nop + { { 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; } 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 @@ -2531,7 +3148,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main () +main (void) { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; @@ -2543,8 +3160,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 @@ -2552,10 +3169,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 @@ -2563,39 +3180,40 @@ $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. + { { 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 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 +{ 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 $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; @@ -2609,11 +3227,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 @@ -2622,31 +3241,32 @@ $as_echo "$ac_try_echo"; } >&5 break;; esac done -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + 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; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext 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 +{ 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 $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { #ifndef __GNUC__ choke me @@ -2656,29 +3276,33 @@ 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 +else $as_nop ac_compiler_gnu=no 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 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 +{ 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 $as_nop ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no @@ -2687,57 +3311,60 @@ 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 +else $as_nop 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 +else $as_nop 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 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 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_c_werror_flag=$ac_save_c_werror_flag 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 @@ -2752,232 +3379,144 @@ 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 $as_nop + 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 - -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 - - -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 +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 $as_nop + 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 $as_nop + { 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" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 + ac_prog_cc_stdc=c11 +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 $as_nop + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error +$ac_c_conftest_c99_program _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue +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 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 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_cv_prog_cc_c99" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + 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 $as_nop + { 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" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 + ac_prog_cc_stdc=c99 +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 $as_nop + 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 : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP +rm -f conftest.$ac_ext +CC=$ac_save_CC 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 +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 $as_nop + 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 $as_nop + { 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" 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 + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 + ac_prog_cc_stdc=c89 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 @@ -2987,245 +3526,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 @@ -3257,11 +3605,12 @@ 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 +{ 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 $as_nop case $JAVA_PROG in [\\/]* | ?:[\\/]*) ac_cv_path_JAVA_PROG="$JAVA_PROG" # Let the user override the test with a path. @@ -3271,11 +3620,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 @@ -3287,11 +3640,11 @@ 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 @@ -3303,11 +3656,12 @@ 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 +{ 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 $as_nop case $JAVAC in [\\/]* | ?:[\\/]*) ac_cv_path_JAVAC="$JAVAC" # Let the user override the test with a path. @@ -3317,11 +3671,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 @@ -3333,11 +3691,11 @@ 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 @@ -3348,11 +3706,12 @@ 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 +{ 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 $as_nop case $JAVAH in [\\/]* | ?:[\\/]*) ac_cv_path_JAVAH="$JAVAH" # Let the user override the test with a path. @@ -3362,11 +3721,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 @@ -3378,11 +3741,11 @@ 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 @@ -3393,11 +3756,12 @@ 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 +{ 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 $as_nop case $JAR in [\\/]* | ?:[\\/]*) ac_cv_path_JAR="$JAR" # Let the user override the test with a path. @@ -3407,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_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 @@ -3423,11 +3791,11 @@ 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 @@ -3436,18 +3804,18 @@ done fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Java version" >&5 -$as_echo_n "checking Java version... " >&6; } +{ 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:".*::'` -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $JVER" >&5 -$as_echo "$JVER" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $JVER" >&5 +printf "%s\n" "$JVER" >&6; } if test -z "$JVER"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: **** Cannot detect Java version - the java -version output is unknown! ****" >&5 -$as_echo "$as_me: WARNING: **** Cannot detect Java version - the java -version output is unknown! ****" >&2;} + { 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 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking Java compatibility version (integer)" >&5 -$as_echo_n "checking Java compatibility version (integer)... " >&6; } + { 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:\..*::'` @@ -3456,34 +3824,34 @@ $as_echo_n "checking Java compatibility version (integer)... " >&6; } fi ## strip -.* for versions like 13-ea JMVER=`echo $JMVER | sed 's:-.*::'` - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JMVER" >&5 -$as_echo "$JMVER" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $JMVER" >&5 +printf "%s\n" "$JMVER" >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $JAVAH actually works" >&5 -$as_echo_n "checking whether $JAVAH actually works... " >&6; } +{ 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 - { $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; } JAVAH= fi have_all_java=yes ## Java 1.10 has no javah anymore -- it uses javac -h . instaead if test -z "$JAVAH"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether javah was replaced by javac -h" >&5 -$as_echo_n "checking whether javah was replaced by javac -h... " >&6; } + { 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 - { $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; } ## create headres in the compile step instead JFLAGS=' -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; } have_all_java=no; fi fi @@ -3496,12 +3864,12 @@ 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 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for target flags" >&5 -$as_echo_n "checking for target flags... " >&6; } +{ 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 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: user-supplied: $JFLAGS" >&5 -$as_echo "user-supplied: $JFLAGS" >&6; } + { 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" @@ -3512,15 +3880,15 @@ else JFLAGS="$JFLAGS -target 1.8 -source 1.8" fi fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JFLAGS" >&5 -$as_echo "$JFLAGS" >&6; } + { 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 @@ -3550,11 +3918,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 @@ -3573,12 +3941,12 @@ $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*) @@ -3619,17 +3987,18 @@ $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 +as_ac_File=`printf "%s\n" "ac_cv_file_${JAVA_HOME}/include/jni.h" | $as_tr_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 $as_nop 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 @@ -3639,17 +4008,19 @@ else fi 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 +else $as_nop + as_ac_File=`printf "%s\n" "ac_cv_file_${JAVA_HOME}/jni.h" | $as_tr_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 $as_nop 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 @@ -3659,17 +4030,19 @@ else fi 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 +else $as_nop + as_ac_File=`printf "%s\n" "ac_cv_file_${JAVA_HOME}/../include/jni.h" | $as_tr_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 $as_nop 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 @@ -3679,11 +4052,12 @@ else fi 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 +else $as_nop 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. @@ -3707,12 +4081,13 @@ 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 +as_ac_File=`printf "%s\n" "ac_cv_file_${JNI_H}/$mddir/jni_md.h" | $as_tr_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 $as_nop 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 @@ -3722,9 +4097,10 @@ else fi 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 @@ -3739,8 +4115,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}" @@ -3749,8 +4125,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. */ @@ -3761,26 +4137,28 @@ 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 +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 $as_nop as_fn_error $? "Cannot compile a simple JNI program. See config.log for details." "$LINENO" 5 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 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -3791,12 +4169,13 @@ 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_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +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 $as_nop + { 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 fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -3804,14 +4183,15 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ 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 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -3821,10 +4201,11 @@ 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 +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 $as_nop 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 fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -3876,8 +4257,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. */ @@ -3889,18 +4270,19 @@ 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 $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } 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. */ @@ -3911,15 +4293,16 @@ 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 $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } 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} @@ -3978,8 +4361,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) ;; #( @@ -4009,15 +4392,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 @@ -4031,8 +4414,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 @@ -4049,7 +4432,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" @@ -4065,8 +4448,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 @@ -4089,14 +4472,16 @@ 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 : +as_nop=: +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 +else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -4106,46 +4491,46 @@ 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 || @@ -4154,13 +4539,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 #(( @@ -4169,8 +4547,12 @@ 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 @@ -4182,30 +4564,10 @@ 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] @@ -4218,13 +4580,14 @@ 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 + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -4251,18 +4614,20 @@ 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 +else $as_nop as_fn_append () { eval $1=\$$1\$2 @@ -4274,12 +4639,13 @@ 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 +else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` @@ -4310,7 +4676,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 @@ -4332,6 +4698,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*) @@ -4345,6 +4715,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 @@ -4386,7 +4762,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" @@ -4395,7 +4771,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 @@ -4458,7 +4834,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.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -4516,14 +4892,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.71, with options \\"\$ac_cs_config\\" -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -4560,15 +4938,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'" @@ -4576,7 +4954,7 @@ 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;; @@ -4585,7 +4963,7 @@ do 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=: ;; @@ -4613,7 +4991,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 "\$@" @@ -4627,7 +5005,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 @@ -4655,8 +5033,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 @@ -4992,7 +5370,7 @@ do esac || 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 @@ -5000,17 +5378,17 @@ do # 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 @@ -5027,7 +5405,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 @@ -5051,9 +5429,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/ ;; @@ -5106,8 +5484,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=' @@ -5149,9 +5527,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" @@ -5167,20 +5545,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 @@ -5226,6 +5604,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/src/config.h.in b/jri/src/config.h.in index 260ad1d..d1c4686 100644 --- a/jri/src/config.h.in +++ b/jri/src/config.h.in @@ -1,5 +1,38 @@ /* 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 @@ -12,8 +45,13 @@ /* 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 you have the ANSI C header files. */ +/* Define to 1 if all of the C90 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 From 460e295665c96c072de0a1ef624ea2393e8dbe67 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 12 Nov 2021 18:14:40 +1300 Subject: [PATCH 153/240] update NEWS --- NEWS | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index ee45468..21b5b3e 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,17 @@ NEWS/ChangeLog for rJava -------------------------- -1.0-5 (under development) +1.0-6 (under development) + 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) + + +1.0-5 2021-09-24 o allow access modifications to fail on JDK-17 == Important note to Java developers: @@ -13,14 +23,14 @@ important in your application or write a Java wrapper that exposes the necessary fields/methods as public. -1.0-4 +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 +1.0-3 2021-04-16 o update URLs referring to Java docs to current 1.8 website From 481080596405735a245a0d346f789042325b7837 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Thu, 9 Dec 2021 16:03:08 +1300 Subject: [PATCH 154/240] update jri/tools to automake-1.16 --- jri/tools/config.guess | 1074 +++++++++------- jri/tools/config.sub | 2596 ++++++++++++++++++++------------------- jri/tools/install-sh | 422 ++++--- jri/tools/mkinstalldirs | 191 ++- 4 files changed, 2275 insertions(+), 2008 deletions(-) diff --git a/jri/tools/config.guess b/jri/tools/config.guess index b79252d..0fc11ed 100755 --- a/jri/tools/config.guess +++ b/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/jri/tools/config.sub b/jri/tools/config.sub index 9633db7..c874b7a 100755 --- a/jri/tools/config.sub +++ b/jri/tools/config.sub @@ -1,8 +1,8 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright 1992-2013 Free Software Foundation, Inc. +# Copyright 1992-2020 Free Software Foundation, Inc. -timestamp='2013-08-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-08-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 @@ -25,7 +25,7 @@ timestamp='2013-08-10' # of the GNU General Public License, version 3 ("GPLv3"). -# Please send patches with a ChangeLog entry to config-patches@gnu.org. +# Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -33,7 +33,7 @@ timestamp='2013-08-10' # 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 +# 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 @@ -50,15 +50,14 @@ timestamp='2013-08-10' # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. -me=`echo "$0" | sed -e 's,.*/,,'` +me=$(echo "$0" | sed -e 's,.*/,,') usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS +Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. -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 @@ -68,7 +67,7 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -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." @@ -90,12 +89,12 @@ while test $# -gt 0 ; do - ) # Use stdin as input. break ;; -* ) - echo "$me: invalid option $1$help" + echo "$me: invalid option $1$help" >&2 exit 1 ;; *local*) # First pass through any local machine types. - echo $1 + echo "$1" exit ;; * ) @@ -111,1209 +110,1167 @@ case $# in 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 +# Split fields of configuration type +# shellcheck disable=SC2162 +IFS="-" read field1 field2 field3 field4 <&2 + exit 1 ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + *-*-*-*) + basic_machine=$field1-$field2 + basic_os=$field3-$field4 ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` + *-*-*) + # 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 ;; - -psos*) - os=-psos + *-*) + # 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 ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint + *) + # 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 aliases for certain CPU-COMPANY combinations. +# Decode 1-component or ad-hoc basic machines 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 + # 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 ;; - - strongarm | thumb | xscale) - basic_machine=arm-unknown + op50n) + cpu=hppa1.1 + vendor=oki ;; - xgate) - basic_machine=$basic_machine-unknown - os=-none + op60c) + cpu=hppa1.1 + vendor=oki ;; - xscaleeb) - basic_machine=armeb-unknown + ibm*) + cpu=i370 + vendor=ibm ;; - - xscaleel) - basic_machine=armel-unknown + orion105) + cpu=clipper + vendor=highlevel ;; - - # 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 + mac | mpw | mac-mpw) + cpu=m68k + vendor=apple ;; - # 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 + 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. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att + cpu=m68000 + vendor=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 + cpu=we32k + vendor=att ;; 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 + cpu=powerpc + vendor=ibm + basic_os=cnk ;; decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 + cpu=pdp10 + vendor=dec + basic_os=tops10 ;; decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 + cpu=pdp10 + vendor=dec + basic_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 + cpu=m68k + vendor=motorola ;; - 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 + dpx2*) + cpu=m68k + vendor=bull + basic_os=sysv3 ;; encore | umax | mmax) - basic_machine=ns32k-encore + cpu=ns32k + vendor=encore ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose + elxsi) + cpu=elxsi + vendor=elxsi + basic_os=${basic_os:-bsd} ;; fx2800) - basic_machine=i860-alliant + cpu=i860 + vendor=alliant ;; genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 + cpu=ns32k + vendor=ns ;; 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 + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp + cpu=hppa1.0 + vendor=hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp + cpu=m68000 + vendor=hp ;; hp9k3[2-9][0-9]) - basic_machine=m68k-hp + cpu=m68k + vendor=hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp + cpu=hppa1.0 + vendor=hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp + cpu=hppa1.1 + vendor=hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-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 - basic_machine=hppa1.1-hp + cpu=hppa1.1 + vendor=hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp + cpu=hppa1.1 + vendor=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 + cpu=hppa1.0 + vendor=hp ;; i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 + cpu=$(echo "$1" | sed -e 's/86.*/86/') + vendor=pc + basic_os=sysv32 ;; i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 + cpu=$(echo "$1" | sed -e 's/86.*/86/') + vendor=pc + basic_os=sysv4 ;; i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv + cpu=$(echo "$1" | sed -e 's/86.*/86/') + vendor=pc + basic_os=sysv ;; i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach + cpu=$(echo "$1" | sed -e 's/86.*/86/') + vendor=pc + basic_os=solaris2 ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta + j90 | j90-cray) + cpu=j90 + vendor=cray + basic_os=${basic_os:-unicos} ;; iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) + cpu=mips + vendor=sgi + case $basic_os in + irix*) ;; *) - os=-irix4 + basic_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 + cpu=m68000 + vendor=convergent ;; - 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 + *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) + cpu=m68k + vendor=atari + basic_os=mint ;; 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* ) + cpu=mips + vendor=sony + basic_os=newsos + ;; + next | m*-next) + cpu=m68k + vendor=next + case $basic_os in + openstep*) + ;; + nextstep*) ;; - -ns2*) - os=-nextstep2 + ns2*) + basic_os=nextstep2 ;; *) - os=-nextstep3 + basic_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 + cpu=np1 + vendor=gould ;; 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 + cpu=hppa1.1 + vendor=oki + basic_os=proelf ;; 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 + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 ;; pbd) - basic_machine=sparc-tti + cpu=sparc + vendor=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 + cpu=m68k + vendor=tti ;; - 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/^[^-]*-//'` + pc532) + cpu=ns32k + vendor=pc532 ;; 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/^[^-]*-//'` + cpu=pn + vendor=gould ;; - 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/^[^-]*-//'` + power) + cpu=power + vendor=ibm ;; 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 + cpu=i386 + vendor=ibm ;; rm[46]00) - basic_machine=mips-siemens + cpu=mips + vendor=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 + cpu=romp + vendor=ibm ;; - sb1) - basic_machine=mipsisa64sb1-unknown + sde) + cpu=mipsisa32 + vendor=sde + basic_os=${basic_os:-elf} ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown + simso-wrs) + cpu=sparclite + vendor=wrs + basic_os=vxworks ;; - sde) - basic_machine=mipsisa32-sde - os=-elf + tower | tower-32) + cpu=m68k + vendor=ncr ;; - sei) - basic_machine=mips-sei - os=-seiux + vpp*|vx|vx-*) + cpu=f301 + vendor=fujitsu ;; - sequent) - basic_machine=i386-sequent + w65) + cpu=w65 + vendor=wdc ;; - sh) - basic_machine=sh-hitachi - os=-hms + w89k-*) + cpu=hppa1.1 + vendor=winbond + basic_os=proelf ;; - sh5el) - basic_machine=sh5le-unknown + none) + cpu=none + vendor=none ;; - sh64) - basic_machine=sh64-unknown + leon|leon[3-9]) + cpu=sparc + vendor=$basic_machine ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks + leon-*|leon[3-9]-*) + cpu=sparc + vendor=$(echo "$basic_machine" | sed 's/-.*//') ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 + + *-*) + # shellcheck disable=SC2162 + IFS="-" read cpu vendor <&2 - exit 1 + # Recognize the canonical CPU types that are allowed with any + # company name. + case $cpu in + 1750a | 580 \ + | a29k \ + | aarch64 | aarch64_be \ + | abacus \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \ + | alphapca5[67] | alpha64pca5[67] \ + | am33_2.0 \ + | amdgcn \ + | arc | arceb \ + | arm | arm[lb]e | arme[lb] | armv* \ + | avr | avr32 \ + | asmjs \ + | ba \ + | be32 | be64 \ + | bfin | bpf | bs2000 \ + | c[123]* | c30 | [cjt]90 | c4x \ + | c8051 | clipper | craynv | csky | cydra \ + | d10v | d30v | dlx | dsp16xx \ + | e2k | elxsi | epiphany \ + | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \ + | h8300 | h8500 \ + | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | hexagon \ + | i370 | i*86 | i860 | i960 | ia16 | ia64 \ + | ip2k | iq2000 \ + | k1om \ + | le32 | le64 \ + | lm32 \ + | m32c | m32r | m32rle \ + | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ + | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \ + | m88110 | m88k | maxq | mb | mcore | mep | metag \ + | microblaze | microblazeel \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64eb | mips64el \ + | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa32r6 | mipsisa32r6el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64r6 | mipsisa64r6el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipsr5900 | mipsr5900el \ + | mipstx39 | mipstx39el \ + | mmix \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nds32 | nds32le | nds32be \ + | nfp \ + | nios | nios2 | nios2eb | nios2el \ + | none | np1 | ns16k | ns32k | nvptx \ + | open8 \ + | or1k* \ + | or32 \ + | orion \ + | picochip \ + | pdp10 | pdp11 | pj | pjl | pn | power \ + | powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \ + | pru \ + | pyramid \ + | riscv | riscv32 | riscv64 \ + | rl78 | romp | rs6000 | rx \ + | s390 | s390x \ + | score \ + | sh | shl \ + | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \ + | sh[1234]e[lb] | sh[12345][lb]e | sh[23]ele | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \ + | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \ + | spu \ + | tahoe \ + | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \ + | tron \ + | ubicom32 \ + | v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \ + | vax \ + | visium \ + | w65 \ + | wasm32 | wasm64 \ + | we32k \ + | x86 | x86_64 | xc16x | xgate | xps100 \ + | xstormy16 | xtensa* \ + | ymp \ + | z8k | z80) + ;; + + *) + echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2 + exit 1 + ;; + esac ;; esac # Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` +case $vendor in + digital*) + vendor=dec ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + commodore*) + vendor=cbm ;; *) ;; @@ -1321,200 +1278,213 @@ esac # Decode manufacturer-specific aliases for certain operating systems. -if [ x"$os" != x"" ] +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 + # No normalization, but not necessarily accepted, that comes below. ;; esac + else # Here we handle the default operating systems that come with various machines. @@ -1527,264 +1497,356 @@ else # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. -case $basic_machine in +kernel= +case $cpu-$vendor in score-*) - os=-elf + os=elf ;; spu-*) - os=-elf + os=elf ;; *-acorn) - os=-riscix1.2 + os=riscix1.2 ;; arm*-rebel) - os=-linux + kernel=linux + os=gnu ;; arm*-semi) - os=-aout + os=aout ;; c4x-* | tic4x-*) - os=-coff + os=coff ;; c8051-*) - os=-elf + os=elf + ;; + clipper-intergraph) + os=clix ;; hexagon-*) - os=-elf + os=elf ;; tic54x-*) - os=-coff + os=coff ;; tic55x-*) - os=-coff + os=coff ;; tic6x-*) - os=-coff + os=coff ;; # This must come before the *-dec entry. pdp10-*) - os=-tops20 + os=tops20 ;; pdp11-*) - os=-none + os=none ;; *-dec | vax-*) - os=-ultrix4.2 + os=ultrix4.2 ;; m68*-apollo) - os=-domain + os=domain ;; i386-sun) - os=-sunos4.0.2 + os=sunos4.0.2 ;; m68000-sun) - os=-sunos3 + os=sunos3 ;; m68*-cisco) - os=-aout + os=aout ;; mep-*) - os=-elf + os=elf ;; mips*-cisco) - os=-elf + os=elf ;; mips*-*) - os=-elf - ;; - or1k-*) - os=-elf + os=elf ;; or32-*) - os=-coff + os=coff ;; *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 + os=sysv3 ;; sparc-* | *-sun) - os=-sunos4.1.1 + os=sunos4.1.1 ;; - *-be) - os=-beos + pru-*) + os=elf ;; - *-haiku) - os=-haiku + *-be) + os=beos ;; *-ibm) - os=-aix + os=aix ;; *-knuth) - os=-mmixware + os=mmixware ;; *-wec) - os=-proelf + os=proelf ;; *-winbond) - os=-proelf + os=proelf ;; *-oki) - os=-proelf + os=proelf ;; *-hp) - os=-hpux + os=hpux ;; *-hitachi) - os=-hiux + os=hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv + os=sysv ;; *-cbm) - os=-amigaos + os=amigaos ;; *-dg) - os=-dgux + os=dgux ;; *-dolphin) - os=-sysv3 + os=sysv3 ;; m68k-ccur) - os=-rtu + os=rtu ;; m88k-omron*) - os=-luna + os=luna ;; - *-next ) - os=-nextstep + *-next) + os=nextstep ;; *-sequent) - os=-ptx + os=ptx ;; *-crds) - os=-unos + os=unos ;; *-ns) - os=-genix + os=genix ;; i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 + os=mvs ;; *-gould) - os=-sysv + os=sysv ;; *-highlevel) - os=-bsd + os=bsd ;; *-encore) - os=-bsd + os=bsd ;; *-sgi) - os=-irix + os=irix ;; *-siemens) - os=-sysv4 + os=sysv4 ;; *-masscomp) - os=-rtu + os=rtu ;; f30[01]-fujitsu | f700-fujitsu) - os=-uxpv + os=uxpv ;; *-rom68k) - os=-coff + os=coff ;; *-*bug) - os=-coff + os=coff ;; *-apple) - os=-macos + os=macos ;; *-atari*) - os=-mint + os=mint + ;; + *-wrs) + os=vxworks ;; *) - os=-none + os=none ;; esac + fi +# Now, validate our (potentially fixed-up) OS. +case $os in + # Sometimes we do "kernel-abi", so those need to count as OSes. + musl* | newlib* | uclibc*) + ;; + # Likewise for "kernel-libc" + eabi | eabihf | gnueabi | gnueabihf) + ;; + # Now accept the basic system types. + # The portable systems comes first. + # Each alternative MUST end in a * to match a version number. + gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ + | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \ + | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ + | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \ + | hiux* | abug | nacl* | netware* | windows* \ + | os9* | macos* | osx* | ios* \ + | mpw* | magic* | mmixware* | mon960* | lnews* \ + | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ + | aos* | aros* | cloudabi* | sortix* | twizzler* \ + | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ + | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ + | mirbsd* | netbsd* | dicos* | openedition* | ose* \ + | bitrig* | openbsd* | solidbsd* | libertybsd* | os108* \ + | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \ + | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ + | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ + | udi* | lites* | ieee* | go32* | aux* | hcos* \ + | chorusrdb* | cegcc* | glidix* \ + | cygwin* | msys* | pe* | moss* | proelf* | rtems* \ + | midipix* | mingw32* | mingw64* | mint* \ + | uxpv* | beos* | mpeix* | udk* | moxiebox* \ + | interix* | uwin* | mks* | rhapsody* | darwin* \ + | openstep* | oskit* | conix* | pw32* | nonstopux* \ + | storm-chaos* | tops10* | tenex* | tops20* | its* \ + | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \ + | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \ + | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ + | skyos* | haiku* | rdos* | toppers* | drops* | es* \ + | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ + | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ + | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx*) + ;; + # This one is extra strict with allowed versions + sco3.2v2 | sco3.2v[4-9]* | sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + ;; + none) + ;; + *) + echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&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. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) +case $vendor in + unknown) + case $cpu-$os in + *-riscix*) vendor=acorn ;; - -sunos*) + *-sunos*) vendor=sun ;; - -cnk*|-aix*) + *-cnk* | *-aix*) vendor=ibm ;; - -beos*) + *-beos*) vendor=be ;; - -hpux*) + *-hpux*) vendor=hp ;; - -mpeix*) + *-mpeix*) vendor=hp ;; - -hiux*) + *-hiux*) vendor=hitachi ;; - -unos*) + *-unos*) vendor=crds ;; - -dgux*) + *-dgux*) vendor=dg ;; - -luna*) + *-luna*) vendor=omron ;; - -genix*) + *-genix*) vendor=ns ;; - -mvs* | -opened*) + *-clix*) + vendor=intergraph + ;; + *-mvs* | *-opened*) + vendor=ibm + ;; + *-os400*) vendor=ibm ;; - -os400*) + s390-* | s390x-*) vendor=ibm ;; - -ptx*) + *-ptx*) vendor=sequent ;; - -tpf*) + *-tpf*) vendor=ibm ;; - -vxsim* | -vxworks* | -windiss*) + *-vxsim* | *-vxworks* | *-windiss*) vendor=wrs ;; - -aux*) + *-aux*) vendor=apple ;; - -hms*) + *-hms*) vendor=hitachi ;; - -mpw* | -macos*) + *-mpw* | *-macos*) vendor=apple ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) vendor=atari ;; - -vos*) + *-vos*) vendor=stratus ;; esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac -echo $basic_machine$os +echo "$cpu-$vendor-${kernel:+$kernel-}$os" exit # 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/jri/tools/install-sh b/jri/tools/install-sh index 377bb86..ec298b5 100755 --- a/jri/tools/install-sh +++ b/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/jri/tools/mkinstalldirs b/jri/tools/mkinstalldirs index 8ab885e..c364f3d 100755 --- a/jri/tools/mkinstalldirs +++ b/jri/tools/mkinstalldirs @@ -1,29 +1,59 @@ #! /bin/sh # mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman -# Created: 1993-05-16 -# Public domain +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="" +dirmode= usage="\ -Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." +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}" 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 + 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 @@ -36,64 +66,97 @@ do done case $# in -0) exit 0 ;; + 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 -- . 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 ;; + '') + 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 - 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 + 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: 3 +# 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: -# mkinstalldirs ends here From 8c45c7a3057462b37a3cb564993f4c4a259b11d2 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 10 Dec 2021 11:56:25 +1300 Subject: [PATCH 155/240] update NEWS --- NEWS | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 21b5b3e..af3bf70 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,7 @@ NEWS/ChangeLog for rJava -------------------------- -1.0-6 (under development) +1.0-6 2021-12-10 o remove obsolete autoconf macros o JRI 0.5-7 changes: @@ -9,6 +9,7 @@ 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 @@ -23,6 +24,7 @@ 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, From 5a6a95eaac02fb11ee166a25ead761b1476544db Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Sat, 22 Jan 2022 17:07:29 +1300 Subject: [PATCH 156/240] bump version to 1.0-7 --- src/rJava.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rJava.h b/src/rJava.h index 3e70311..9e5bf78 100644 --- a/src/rJava.h +++ b/src/rJava.h @@ -1,7 +1,7 @@ #ifndef __RJAVA_H__ #define __RJAVA_H__ -#define RJAVA_VER 0x010006 /* rJava v1.0-6 */ +#define RJAVA_VER 0x010007 /* rJava v1.0-7 */ /* important changes between versions: 3.0 - adds compiler From 5a2685f5657681a594bbc9a866c481a07afa8d70 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Sat, 22 Jan 2022 17:15:10 +1300 Subject: [PATCH 157/240] fix R-to-Java string conversion to handle CE_NATIVE correctly (#228); add DEBUG_ENCODING define support --- src/Rglue.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/Rglue.c b/src/Rglue.c index 9d71565..c2ce7f4 100644 --- a/src/Rglue.c +++ b/src/Rglue.c @@ -160,6 +160,11 @@ SEXP j2SEXP(JNIEnv *env, jobject o, int releaseLocal) { /* 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 */ const char *rj_char_utf8(SEXP s) { +#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 */ } @@ -184,20 +189,32 @@ int rj_char_utf16(SEXP s, jchar **buf) { char *dst = (char*) js; int end_test = 1; +#ifdef DEBUG_ENCODING + fprintf(stderr, "rJava.rj_char_utf16, CE=%d:", (int)ce_in); + { const char *c0 = c; while (*c0) fprintf(stderr, " %02x", (int)((unsigned char)*(c0++))); } + fprintf(stderr, "\n"); +#endif + 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; } +#ifdef DEBUG_ENCODING + fprintf(stderr, " '%s' -> UTF-16: ", ifrom); +#endif ih = Riconv_open(((char*)&end_test)[0] == 1 ? "UTF-16LE" : "UTF-16BE", ifrom); if(ih == (void *)(-1)) Rf_error("Unable to start conversion to UTF-16"); @@ -215,6 +232,10 @@ int rj_char_utf16(SEXP s, jchar **buf) { } } 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; } From 7f57cd9f7bf09c37ab1a89606227c1cc420b0546 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Sat, 22 Jan 2022 17:15:18 +1300 Subject: [PATCH 158/240] update NEWS --- NEWS | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/NEWS b/NEWS index af3bf70..1d546c5 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,16 @@ NEWS/ChangeLog for rJava -------------------------- +1.0-7 + 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 from R to Java. + + 1.0-6 2021-12-10 o remove obsolete autoconf macros From fa19e1cd856bb6bd53910d2c12abf6bbad6be015 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Sat, 22 Jan 2022 19:30:59 +1300 Subject: [PATCH 159/240] re-factor string conversions to rjstring.c --- src/Rglue.c | 173 +----------------------------------- src/rJava.h | 9 +- src/rjstring.c | 231 +++++++++++++++++++++++++++++++++++++++++++++++++ src/rjstring.h | 25 ++++++ 4 files changed, 266 insertions(+), 172 deletions(-) create mode 100644 src/rjstring.c create mode 100644 src/rjstring.h diff --git a/src/Rglue.c b/src/Rglue.c index c2ce7f4..f009c00 100644 --- a/src/Rglue.c +++ b/src/Rglue.c @@ -6,6 +6,7 @@ #include #include #include +#include "rjstring.h" /* R 4.0.1 broke EXTPTR_PTR ABI so re-map it to safety at the small expense of speed */ @@ -156,9 +157,9 @@ 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 - NOTE: this should NOT be used to create Java strings as they require UTF-16 natively */ + 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) { #ifdef DEBUG_ENCODING fprintf(stderr, "rJava.rj_char_utf8, CE=%d: \"%s\"\n", (int)Rf_getCharCE(s), CHAR(s)); @@ -168,176 +169,10 @@ const char *rj_char_utf8(SEXP s) { 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 */ } -#ifdef WIN32 -extern unsigned int localeCP; -static char cpbuf[16]; -#endif -static jchar js_zero[2] = { 0, 0 }; -static jchar js_buf[128]; -/* 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 */ -int rj_char_utf16(SEXP s, jchar **buf) { - void *ih; - 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; - } - 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; - -#ifdef DEBUG_ENCODING - fprintf(stderr, "rJava.rj_char_utf16, CE=%d:", (int)ce_in); - { const char *c0 = c; while (*c0) fprintf(stderr, " %02x", (int)((unsigned char)*(c0++))); } - fprintf(stderr, "\n"); -#endif - - 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; - } - -#ifdef DEBUG_ENCODING - fprintf(stderr, " '%s' -> UTF-16: ", ifrom); -#endif - ih = Riconv_open(((char*)&end_test)[0] == 1 ? "UTF-16LE" : "UTF-16BE", ifrom); - if(ih == (void *)(-1)) - Rf_error("Unable to start conversion to UTF-16"); - 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) - Rf_error("Conversion to UTF-16 failed due to unexpectedly large buffer requirements."); - else if(res == -1 && (errno == EILSEQ || errno == EINVAL)) { /* invalid char */ - *(dst++) = '?'; - *(dst++) = 0; - 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; -} - -/* Java returns *modified* UTF-8 which is incompatible with UTF-8, - so we have to detect the illegal surrgoate pairs and convert them */ -SEXP mkCharUTF8(const char *src) { - 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) - Rf_error("Cannot allocate memory for surrogate pair conversion"); - } 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); - Rf_error("illegal 2-byte sequence in Java string"); - } - *(d++) = *(c++); - continue; - } - if ((c[-1] & 0xF0) != 0xE0) { /* must be 3-byte */ - if (dst) free(dst); - Rf_error("illegal multi-byte seqeunce in Java string (>3-byte)"); - } - if (((c[0] & 0xC0) != 0x80 || - (c[1] & 0xC0) != 0x80)) { - if (dst) free(dst); - Rf_error("illegal 3-byte sequence in Java string"); - } - 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); - Rf_error("illegal sequence in Java string: low surrogate pair without a high one"); - } - c += 2; /* move to the low pair */ - if (c[0] != 0xED || - (c[1] & 0xF0) != 0xB0 || - (c[2] & 0xC0) != 0x80) { - if (dst) free(dst); - Rf_error("illegal sequence in Java string: high surrogate pair not followed by low one"); - } - /* 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); -} - -#endif static jstring newJavaString(JNIEnv *env, SEXP sChar) { jchar *s; - size_t len = rj_char_utf16(sChar, &s); + size_t len = rj_rchar_utf16(sChar, &s); return newString16(env, s, (len + 1) >> 1); } diff --git a/src/rJava.h b/src/rJava.h index 9e5bf78..b4c4c8f 100644 --- a/src/rJava.h +++ b/src/rJava.h @@ -97,14 +97,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) rj_mkCharUTF8(X) #define CHAR_UTF8(X) rj_char_utf8(X) -extern SEXP mkCharUTF8(const char *); -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. */ 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 From 4ad98c2cd0f888516ba541b5bde2bcfdf2f2d9ad Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Sat, 22 Jan 2022 19:31:33 +1300 Subject: [PATCH 160/240] add rjstring to JRI --- jri/src/rjstring.c | 1 + jri/src/rjstring.h | 1 + 2 files changed, 2 insertions(+) create mode 120000 jri/src/rjstring.c create mode 120000 jri/src/rjstring.h diff --git a/jri/src/rjstring.c b/jri/src/rjstring.c new file mode 120000 index 0000000..9c7a9d2 --- /dev/null +++ b/jri/src/rjstring.c @@ -0,0 +1 @@ +../../src/rjstring.c \ No newline at end of file diff --git a/jri/src/rjstring.h b/jri/src/rjstring.h new file mode 120000 index 0000000..448d452 --- /dev/null +++ b/jri/src/rjstring.h @@ -0,0 +1 @@ +../../src/rjstring.h \ No newline at end of file From 73495bbe0fdc30877d1be2cbd79f524c3e02379a Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Sat, 22 Jan 2022 19:32:41 +1300 Subject: [PATCH 161/240] JRI: convert to/from native encoding in Read/WriteConsole (#24) --- jri/src/Makefile.all | 7 +++- jri/src/Rcallbacks.c | 95 +++++++++++++++++++++++++++++--------------- 2 files changed, 67 insertions(+), 35 deletions(-) diff --git a/jri/src/Makefile.all b/jri/src/Makefile.all index 081a9b2..16b7851 100644 --- a/jri/src/Makefile.all +++ b/jri/src/Makefile.all @@ -15,7 +15,10 @@ JRI.jar: $(JRI_JSRC) $(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 org_rosuda_JRI_Rengine.h +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 @@ -33,7 +36,7 @@ Rengine.o: Rengine.c org_rosuda_JRI_Rengine.h globals.h Rcallbacks.h Rinit.h 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 $(JRIDEPS) +$(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: diff --git a/jri/src/Rcallbacks.c b/jri/src/Rcallbacks.c index a4e0130..39f0e3c 100644 --- a/jri/src/Rcallbacks.c +++ b/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 @@ -64,12 +65,15 @@ JNIEnv *checkEnvironment() 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 +81,46 @@ int Re_ReadConsole(RCCONST char *prompt, RCSIGN char *buf, int len, int addtohis #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 +140,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) */ From 9c77b6e7eb5b8d0371ff07b3546a95ddee31674d Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Sat, 22 Jan 2022 21:40:10 +1300 Subject: [PATCH 162/240] copy instead of symlink because of Windows --- jri/src/rjstring.c | 232 ++++++++++++++++++++++++++++++++++++++++++++- jri/src/rjstring.h | 26 ++++- 2 files changed, 256 insertions(+), 2 deletions(-) mode change 120000 => 100644 jri/src/rjstring.c mode change 120000 => 100644 jri/src/rjstring.h diff --git a/jri/src/rjstring.c b/jri/src/rjstring.c deleted file mode 120000 index 9c7a9d2..0000000 --- a/jri/src/rjstring.c +++ /dev/null @@ -1 +0,0 @@ -../../src/rjstring.c \ No newline at end of file diff --git a/jri/src/rjstring.c b/jri/src/rjstring.c new file mode 100644 index 0000000..6fce28b --- /dev/null +++ b/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/jri/src/rjstring.h b/jri/src/rjstring.h deleted file mode 120000 index 448d452..0000000 --- a/jri/src/rjstring.h +++ /dev/null @@ -1 +0,0 @@ -../../src/rjstring.h \ No newline at end of file diff --git a/jri/src/rjstring.h b/jri/src/rjstring.h new file mode 100644 index 0000000..6fd24a1 --- /dev/null +++ b/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 From 05129e5f734dea500e14d706c0bd833c4aa83d63 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 24 Jan 2022 10:37:51 +1300 Subject: [PATCH 163/240] update NEWS --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index 1d546c5..3916943 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,10 @@ conversion routines will output debugging information when strings are converted from R to 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. + 1.0-6 2021-12-10 o remove obsolete autoconf macros From da875397b86283ab98bb1ce315e7bca06582d23c Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 24 Jan 2022 11:05:35 +1300 Subject: [PATCH 164/240] prevent parallel build of JRI since it doesn't work (#182) --- jri/Makefile.all | 1 + jri/src/Makefile.all | 1 + 2 files changed, 2 insertions(+) diff --git a/jri/Makefile.all b/jri/Makefile.all index febd146..2774eeb 100644 --- a/jri/Makefile.all +++ b/jri/Makefile.all @@ -43,3 +43,4 @@ doc: $(JRI_JDOCSRC) .PHONY: clean all examples doc +.NOTPARALLEL: diff --git a/jri/src/Makefile.all b/jri/src/Makefile.all index 16b7851..3146350 100644 --- a/jri/src/Makefile.all +++ b/jri/src/Makefile.all @@ -50,3 +50,4 @@ clean: .PHONY: clean all +.NOTPARALLEL: From 9498f60fbb3b853ad3ecc95d093823d70abe9cde Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 24 Jan 2022 11:36:43 +1300 Subject: [PATCH 165/240] replace deprecated constructors like new Double(double) with valueOf --- jri/RFactor.java | 4 ++-- src/java/RJavaArrayTools.java | 6 +++--- src/java/RJavaArrayTools_Test.java | 8 ++++---- src/java/RJavaClassLoader.java | 1 - src/java/RJavaComparator.java | 4 ++-- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/jri/RFactor.java b/jri/RFactor.java index a217f8a..71342aa 100644 --- a/jri/RFactor.java +++ b/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 Date: Mon, 24 Jan 2022 11:38:43 +1300 Subject: [PATCH 166/240] update NEWS --- NEWS | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 3916943..96a7409 100644 --- a/NEWS +++ b/NEWS @@ -8,12 +8,15 @@ o debugging: if DEBUG_ENCODING C macro is defined string conversion routines will output debugging information - when strings are converted from R to Java. + 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. + 1.0-6 2021-12-10 o remove obsolete autoconf macros From 838f19e92e648b538fe7fbb55047193afb9e5910 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 24 Jan 2022 11:47:42 +1300 Subject: [PATCH 167/240] update REngine --- jri/REngine | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jri/REngine b/jri/REngine index 68b0147..d6f5c84 160000 --- a/jri/REngine +++ b/jri/REngine @@ -1 +1 @@ -Subproject commit 68b0147275919401084a9e1ebf6b576547a49931 +Subproject commit d6f5c84bd7af9a2207673d495cad9b82d459effb From e016ef9d3f4162fd83c13ae08ced12e1dcc135d4 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 29 Apr 2022 11:29:39 +1200 Subject: [PATCH 168/240] work around a crash in RStudio on Windows UCRT (#296) --- R/jinit.R | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/R/jinit.R b/R/jinit.R index f560d16..4fd7255 100644 --- a/R/jinit.R +++ b/R/jinit.R @@ -51,6 +51,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() From 4d2e942d525da49b2078fb1f033ecfe200e69572 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 29 Apr 2022 11:30:27 +1200 Subject: [PATCH 169/240] update NEWS --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index 96a7409..e99a299 100644 --- a/NEWS +++ b/NEWS @@ -17,6 +17,8 @@ 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) + 1.0-6 2021-12-10 o remove obsolete autoconf macros From 7ff70e592e68ace70b6b38c66d8a778dbe039057 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 29 Apr 2022 12:00:18 +1200 Subject: [PATCH 170/240] Fix typos and minor changes in README --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 2ef3e03..0c743ad 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ 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](https://rforge.net/rJava) 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 @@ -19,7 +19,7 @@ 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="http://rforge.net") + install.packages("rJava", repos="https://rforge.net") The RForge.net repository is updated automatically on each commit. On macOS/Windows you may need to add `type='source'`. @@ -40,7 +40,7 @@ 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. +report bugs, but read the following documentation and search previous issues before you do so. ## Troubleshooting @@ -48,13 +48,13 @@ Rule #1: do __not__ set `JAVA_HOME` unless you are an expert. rJava attempts to ### 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. Teh most common mistake is to use 64-bit R but only have 32-bit Java installed. +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 distribution 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 latest R-4.1.1-patched from https://mac.R-project.org or else you will get `trap R` errors when loading Java (see [#267](https://github.com/s-u/rJava/issues/267) for details). +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`. @@ -70,11 +70,11 @@ Also note that `sudo` may change environment variables, so if you need to run wi 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. -If you are installing rJava from sources, make sure you have a 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.: +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-4.tar.gz -tar fxz rJava_1.0-4.tar.gz +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 ``` From a63e7d7d3b2c22e2eb6fce2365314c71b6bf7b82 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 29 Apr 2022 13:17:39 +1200 Subject: [PATCH 171/240] add .jvmState(), closes #259 --- NEWS | 2 ++ R/jfirst.R | 1 + R/jinit.R | 2 ++ man/jinit.Rd | 32 +++++++++++++++++++++++++++++++- src/Rglue.c | 21 +++++++++++++++++++++ src/init.c | 21 ++++++++++++++++++++- src/rJava.h | 8 ++++++++ 7 files changed, 85 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index e99a299..8b90ea9 100644 --- a/NEWS +++ b/NEWS @@ -19,6 +19,8 @@ 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 diff --git a/R/jfirst.R b/R/jfirst.R index 9bebc3d..faa8dbd 100644 --- a/R/jfirst.R +++ b/R/jfirst.R @@ -22,6 +22,7 @@ "RgetShortArrayCont", "RgetStringArrayCont", "RidenticalRef", "RgetSimpleClassNames", "RisAssignableFrom", "RpollException", "RsetField", "RthrowException", "javaObjectCache", "initRJavaTools", "newRJavaLookupTable", "useDynamicSymbols", + "RgetJVMstate", # .External "RcreateObject", "RgetStringValue", "RinitJVM", "RtoString", "RcallMethod", # .C diff --git a/R/jinit.R b/R/jinit.R index 4fd7255..e622edc 100644 --- a/R/jinit.R +++ b/R/jinit.R @@ -230,3 +230,5 @@ } # if #rcp>0 invisible(.jcall("java/lang/System","S","getProperty","java.class.path")) } + +.jvmState <- function() .Call(RgetJVMstate) diff --git a/man/jinit.Rd b/man/jinit.Rd index 075f521..3ff89a1 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) +.jvmState() } \arguments{ \item{classpath}{Any additional classes to include in the Java class @@ -33,6 +37,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,7 +77,18 @@ 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}. } \seealso{ \code{\link{.jpackage}} @@ -69,6 +98,7 @@ silent = FALSE, force.init = FALSE) ## set heap size limit to 512MB (see java -X) and ## use "myClasses.jar" as the class path .jinit(classpath="myClasses.jar", parameters="-Xmx512m") +.jvmState() } } \keyword{interface} diff --git a/src/Rglue.c b/src/Rglue.c index f009c00..52f4035 100644 --- a/src/Rglue.c +++ b/src/Rglue.c @@ -1124,3 +1124,24 @@ END_RJAVA_CALL INTEGER(res)[0]=tr; return res; } + +extern int existingJVMs(); /* init.c */ + +REPC SEXP RgetJVMstate() { + 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/init.c b/src/init.c index 3760fde..6805d71 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; @@ -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,6 +89,12 @@ static void JNICALL exit_hook(int status) { exit(status); } +int existingJVMs() { + 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 @@ -186,6 +196,7 @@ static int initJVM(const char *user_classpath, int opts, char **optv, int hooks, if (!eenv) error("Cannot obtain JVM environment"); + rJava_JVM_state = JVM_STATE_CREATED; #if defined(_WIN64) || defined(_WIN32) _setmode(0, _O_TEXT); #endif @@ -217,6 +228,8 @@ static void *initJVMthread(void *classpath) thInitResult=initJVM((char*)classpath, jvm_opts, jvm_optv, default_hooks, 0); if (thInitResult) return 0; + rJava_JVM_state = JVM_STATE_CREATED; + init_rJava(); lenv = eenv; /* we make a local copy before unlocking just in case @@ -357,7 +370,10 @@ static SEXP RinitJVM_real(SEXP par, int disableGuardPages) 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; } } @@ -389,6 +405,8 @@ static SEXP RinitJVM_real(SEXP par, int disableGuardPages) _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 @@ -752,6 +770,7 @@ REP void doneJVM() { (*jvm)->DestroyJavaVM(jvm); jvm = 0; eenv = 0; + rJava_JVM_state = JVM_STATE_DESTROYED; } /** diff --git a/src/rJava.h b/src/rJava.h index b4c4c8f..c896b16 100644 --- a/src/rJava.h +++ b/src/rJava.h @@ -136,6 +136,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; From 034f1d751b7eec6842ec76f187d1912904fb1252 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 30 Dec 2022 17:34:48 +1300 Subject: [PATCH 172/240] bump version to 1.0-8 --- src/rJava.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rJava.h b/src/rJava.h index c896b16..3e14582 100644 --- a/src/rJava.h +++ b/src/rJava.h @@ -1,7 +1,7 @@ #ifndef __RJAVA_H__ #define __RJAVA_H__ -#define RJAVA_VER 0x010007 /* rJava v1.0-7 */ +#define RJAVA_VER 0x010008 /* rJava v1.0-8 */ /* important changes between versions: 3.0 - adds compiler From 503a4b7f67800fce07827fef81b5d55ed0a4123f Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 30 Dec 2022 17:40:39 +1300 Subject: [PATCH 173/240] try to prevent TCO in gcc sabotaging stack detection (#300) --- src/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/init.c b/src/init.c index 6805d71..c150231 100644 --- a/src/init.c +++ b/src/init.c @@ -572,14 +572,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, 0); else - return RinitJVM_with_padding(par, padding, dummy); + return RinitJVM_with_padding(par, padding, (char*) dummy); } /* Run RinitJVM with the Java stack workaround */ From a51dc7829f44719f9abd17e7866c73f4b110d578 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 30 Dec 2022 17:59:16 +1300 Subject: [PATCH 174/240] Replace r-lib action so the check works --- .github/workflows/check.yaml | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 7bbf2a7..fe85bb5 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -11,30 +11,37 @@ jobs: strategy: fail-fast: false matrix: - os: [ 'windows-latest', 'macOS-10.15', 'ubuntu-20.04' ] + os: [ 'windows-2022', 'macOS-10.15', 'ubuntu-20.04' ] r: [ 'release' ] java: [ 8, 11 ] steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - - uses: r-lib/actions/setup-r@master + - name: Install R + uses: s-u/R-actions/install@v1 with: r-version: ${{ matrix.r }} + tools: base - uses: actions/setup-java@v1 with: java-version: ${{ matrix.java }} - name: Build - run: "sh mkdist" - - - name: Info - run: "bash -c 'java -version && which java && echo $PATH && echo $JAVA_HOME'" + run: | + sh mkdist + java -version && which java && echo $PATH && echo $JAVA_HOME + shell: bash - 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" + 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 - name: R CMD check (Windows) if: runner.os == 'Windows' From 6d362c1e804d85f699e61742e103df0b8634c489 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 30 Dec 2022 18:07:29 +1300 Subject: [PATCH 175/240] Update NEWS --- NEWS | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 8b90ea9..f05146a 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,13 @@ NEWS/ChangeLog for rJava -------------------------- -1.0-7 +1.0-8 + 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) From f8b2cfbea63fec1a65a5eda742fe6560728b96c3 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Tue, 28 Nov 2023 11:33:13 +1300 Subject: [PATCH 176/240] bump version to 1.0-9 --- src/rJava.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rJava.h b/src/rJava.h index 3e14582..196421f 100644 --- a/src/rJava.h +++ b/src/rJava.h @@ -1,7 +1,7 @@ #ifndef __RJAVA_H__ #define __RJAVA_H__ -#define RJAVA_VER 0x010008 /* rJava v1.0-8 */ +#define RJAVA_VER 0x010009 /* rJava v1.0-9 */ /* important changes between versions: 3.0 - adds compiler From a677b023e888682964c16aae06bc9a896cb435aa Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Tue, 28 Nov 2023 11:44:20 +1300 Subject: [PATCH 177/240] replace () with (void) in C decls --- jri/src/Rcallbacks.c | 8 ++++---- jri/src/Rcallbacks.h | 6 +++--- jri/src/Rinit.c | 10 +++++----- jri/src/Rinit.h | 2 +- jri/src/rjava.c | 6 +++--- jri/src/rjava.h | 6 +++--- src/Rglue.c | 12 ++++++------ src/init.c | 6 +++--- src/loader.c | 2 +- src/otables.c | 2 +- src/rJava.c | 10 +++++----- src/rJava.h | 6 +++--- src/registration.c | 2 +- src/tools.c | 6 +++--- 14 files changed, 42 insertions(+), 42 deletions(-) diff --git a/jri/src/Rcallbacks.c b/jri/src/Rcallbacks.c index 39f0e3c..12f2597 100644 --- a/jri/src/Rcallbacks.c +++ b/jri/src/Rcallbacks.c @@ -37,7 +37,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; @@ -170,12 +170,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); @@ -192,7 +192,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/jri/src/Rcallbacks.h index 365ca85..dcb3eae 100644 --- a/jri/src/Rcallbacks.h +++ b/jri/src/Rcallbacks.h @@ -22,9 +22,9 @@ int Re_ReadConsole(RCCONST char *prompt, RCSIGN char *buf, int len, int addtohi 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/jri/src/Rinit.c b/jri/src/Rinit.c index 2341c5b..4a43208 100644 --- a/jri/src/Rinit.c +++ b/jri/src/Rinit.c @@ -85,7 +85,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; } @@ -137,16 +137,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 */ } @@ -284,7 +284,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/jri/src/Rinit.h index b3cc2f0..9963da5 100644 --- a/jri/src/Rinit.h +++ b/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/jri/src/rjava.c b/jri/src/rjava.c index 373d984..7573e3b 100644 --- a/jri/src/rjava.c +++ b/jri/src/rjava.c @@ -13,7 +13,7 @@ int *rjctrl = 0; typedef void(callbackfn)(void *); -int RJava_request_lock() { +int RJava_request_lock(void) { ptrlong buf[4]; int n; if (rjctrl && *rjctrl) return 2; @@ -24,7 +24,7 @@ int RJava_request_lock() { return (n == sizeof(ptrlong) && buf[0] == IPCC_LOCK_GRANTED) ? 1 : 0; } -int RJava_clear_lock() { +int RJava_clear_lock(void) { ptrlong buf[4]; buf[0] = IPCC_CLEAR_LOCK; return (write(ipcout, buf, sizeof(ptrlong)) == sizeof(ptrlong)) ? 1 : 0; @@ -44,7 +44,7 @@ void RJava_setup(int _in, int _out) { resin = _in; } -void RJava_init_ctrl() { +void RJava_init_ctrl(void) { ptrlong buf[4]; buf[0] = IPCC_CONTROL_ADDR; if (write(ipcout, buf, sizeof(ptrlong)) == sizeof(ptrlong) && diff --git a/jri/src/rjava.h b/jri/src/rjava.h index 19fd1b3..8fca0e8 100644 --- a/jri/src/rjava.h +++ b/jri/src/rjava.h @@ -10,10 +10,10 @@ #define IPCC_CALL_REQUEST 4 /* pars: */ #define IPCC_CONTROL_ADDR 5 /* ipc: request, res: */ -int RJava_request_lock(); -int RJava_clear_lock(); +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/Rglue.c b/src/Rglue.c index 52f4035..ba02513 100644 --- a/src/Rglue.c +++ b/src/Rglue.c @@ -37,7 +37,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; @@ -65,7 +65,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 @@ -1067,7 +1067,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 @@ -1078,7 +1078,7 @@ END_RJAVA_CALL } /** clear any pending exceptions */ -REP void RclearException() { +REP void RclearException(void) { JNIEnv *env=getJNIEnv(); BEGIN_RJAVA_CALL (*env)->ExceptionClear(env); @@ -1125,9 +1125,9 @@ END_RJAVA_CALL return res; } -extern int existingJVMs(); /* init.c */ +extern int existingJVMs(void); /* init.c */ -REPC SEXP RgetJVMstate() { +REPC SEXP RgetJVMstate(void) { const char *names[] = { "initialized", "state", "" }; SEXP res = PROTECT(Rf_mkNamed(VECSXP, names)); const char *st = "unknown"; diff --git a/src/init.c b/src/init.c index c150231..44c1d1e 100644 --- a/src/init.c +++ b/src/init.c @@ -89,7 +89,7 @@ static void JNICALL exit_hook(int status) { exit(status); } -int existingJVMs() { +int existingJVMs(void) { jsize vms = 0; JavaVM *jvms[32]; return (JNI_GetCreatedJavaVMs(jvms, 32, &vms) >= 0) ? vms : 0; @@ -766,7 +766,7 @@ REP SEXP RinitJVM(SEXP par) { #endif } -REP void doneJVM() { +REP void doneJVM(void) { (*jvm)->DestroyJavaVM(jvm); jvm = 0; eenv = 0; @@ -778,7 +778,7 @@ REP void doneJVM() { * 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; 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 4e23a38..531aa79 100644 --- a/src/otables.c +++ b/src/otables.c @@ -8,7 +8,7 @@ /** * Returns the R_UnboundValue */ -HIDE SEXP R_getUnboundValue() { +HIDE SEXP R_getUnboundValue(void) { return(R_UnboundValue); } diff --git a/src/rJava.c b/src/rJava.c index c8ad140..294f0f2 100644 --- a/src/rJava.c +++ b/src/rJava.c @@ -11,7 +11,7 @@ int use_eenv = 1; /* cached environment. Do NOT use directly! Always use getJNIEnv()! */ JNIEnv *eenv; -static SEXP getCurrentCall() { +static SEXP getCurrentCall(void) { SEXP cexp, sys_calls = PROTECT(install("sys.calls")); cexp = PROTECT(lang1(sys_calls)); SEXP cl = eval(cexp, R_GetCurrentEnv()); @@ -132,14 +132,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; diff --git a/src/rJava.h b/src/rJava.h index 196421f..c1953ad 100644 --- a/src/rJava.h +++ b/src/rJava.h @@ -82,7 +82,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() @@ -123,7 +123,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); @@ -175,7 +175,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 *) ; diff --git a/src/registration.c b/src/registration.c index 38f2302..bdad36d 100644 --- a/src/registration.c +++ b/src/registration.c @@ -3,7 +3,7 @@ /* only to avoid NOTEs from broken checks, never called */ -int dummy__() { +int dummy__(void) { return R_registerRoutines(0, 0, 0, 0, 0); } diff --git a/src/tools.c b/src/tools.c index 8d84012..5ee2670 100644 --- a/src/tools.c +++ b/src/tools.c @@ -106,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); } @@ -128,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; @@ -138,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; From b4f5e89703372607df2cf45adbb34f8e383cd5f3 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Tue, 28 Nov 2023 11:49:27 +1300 Subject: [PATCH 178/240] remove unused variables --- src/fields.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/fields.c b/src/fields.c index 0329aad..a78f2af 100644 --- a/src/fields.c +++ b/src/fields.c @@ -88,7 +88,6 @@ static jclass inputToClass(JNIEnv *env, SEXP obj, jobject *jobj, int *is_local) if (o) cls = objectClass(env, o); else { /* this should be rare since is doesn't provide a way to specify the class loader */ - char *c = clnam; cls = findClass(env, clnam, oClassLoader); free(clnam); if (!cls) { @@ -146,7 +145,7 @@ 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), cls_local = 0; From 5f7c3e857cee0b1a2481ebaa2655966ffb8804e0 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Tue, 28 Nov 2023 11:50:30 +1300 Subject: [PATCH 179/240] remove new_jrectRef as unused --- src/Rglue.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Rglue.c b/src/Rglue.c index ba02513..45bbcd4 100644 --- a/src/Rglue.c +++ b/src/Rglue.c @@ -896,6 +896,7 @@ static SEXP new_jarrayRef(JNIEnv *env, jobject a, const char *sig) { return oo; } +#if 0 /* FIXME: no longer used */ /** * Creates a reference to a rectangular java array. * @@ -920,6 +921,7 @@ static SEXP new_jrectRef(JNIEnv *env, jobject a, const char *sig, SEXP dim ) { UNPROTECT(1); /* oo */ return oo; } +#endif /* this does not take care of multi dimensional arrays properly */ From 43431b08acbe05ced87ee0a381d4dce68431b000 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Tue, 28 Nov 2023 11:50:44 +1300 Subject: [PATCH 180/240] update NEWS --- NEWS | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index f05146a..8b851c9 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,11 @@ NEWS/ChangeLog for rJava -------------------------- -1.0-8 +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) From ba188d25e9a73bb486af8f89dd0771d32e0cc4a7 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Tue, 28 Nov 2023 12:29:51 +1300 Subject: [PATCH 181/240] replace sprintf with snprintf --- jri/src/Rinit.c | 8 ++++---- src/init.c | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/jri/src/Rinit.c b/jri/src/Rinit.c index 4a43208..04c142b 100644 --- a/jri/src/Rinit.c +++ b/jri/src/Rinit.c @@ -166,7 +166,7 @@ int myYesNoCancel(RCCONST char *s) char ss[128]; unsigned char a[3]; - sprintf(ss, "%s [y/n/c]: ", s); + snprintf(ss, sizeof(ss)-1, "%s [y/n/c]: ", s); Re_ReadConsole(ss, a, 3, 0); switch (a[0]) { case 'y': @@ -197,11 +197,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; @@ -228,7 +228,7 @@ 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); + snprintf(rhb, sizeof(rhb)-1, "R_HOME=%s",RHome); putenv(rhb); } /* on Win32 this should set R_Home (in R_SetParams) as well */ diff --git a/src/init.c b/src/init.c index 44c1d1e..d2d4236 100644 --- a/src/init.c +++ b/src/init.c @@ -148,7 +148,9 @@ static int initJVM(const char *user_classpath, int opts, char **optv, int hooks, 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); + 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; From 00e8579067bf0bc813f59f55e84b41679a4e403a Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 29 Nov 2023 15:03:35 +1300 Subject: [PATCH 182/240] bump version to 1.0-10 --- src/rJava.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rJava.h b/src/rJava.h index c1953ad..63cf0b0 100644 --- a/src/rJava.h +++ b/src/rJava.h @@ -1,7 +1,7 @@ #ifndef __RJAVA_H__ #define __RJAVA_H__ -#define RJAVA_VER 0x010009 /* rJava v1.0-9 */ +#define RJAVA_VER 0x01000a /* rJava v1.0-10 */ /* important changes between versions: 3.0 - adds compiler From fb6730e677adbd9036035d96d6618087e392346f Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 29 Nov 2023 15:12:22 +1300 Subject: [PATCH 183/240] fix error format --- src/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/init.c b/src/init.c index d2d4236..e11bc1b 100644 --- a/src/init.c +++ b/src/init.c @@ -731,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); From 77399f0a0627501e5a79f2bd199777ae1a3e752b Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 29 Nov 2023 15:13:11 +1300 Subject: [PATCH 184/240] documentation fixes --- man/javaImport.Rd | 2 +- man/jcall.Rd | 2 +- man/jnull.Rd | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/man/javaImport.Rd b/man/javaImport.Rd index 0a1c321..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.net/RObjectTables/} + \url{https://www.omegahat.net/RObjectTables/} } \author{ Romain Francois diff --git a/man/jcall.Rd b/man/jcall.Rd index 824780c..4f311b7 100644 --- a/man/jcall.Rd +++ b/man/jcall.Rd @@ -39,7 +39,7 @@ \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 similar effect as using \code{synchronize} in diff --git a/man/jnull.Rd b/man/jnull.Rd index 1836101..0831b04 100644 --- a/man/jnull.Rd +++ b/man/jnull.Rd @@ -34,8 +34,8 @@ is.jnull(x) 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 From b40125c63527e8633ca8b07382ed129c24a1a526 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Thu, 30 Nov 2023 11:43:53 +1300 Subject: [PATCH 185/240] update NEWS --- NEWS | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index 8b851c9..54808d1 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,12 @@ NEWS/ChangeLog for rJava -------------------------- +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 @@ -522,6 +528,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 @@ -547,6 +554,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) @@ -555,6 +563,7 @@ o added lib.loc parameter to .jpackage() + 0.6-2 2009-01-26 o fix --enable-debug to really enable debug code @@ -563,8 +572,6 @@ 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 @@ -638,8 +645,6 @@ -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 properly released, thanks to Erik van Barneveld for @@ -822,9 +827,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 From f9aac11d33f27abbc2d6c1633f25aeb4ceaf1b67 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 1 Dec 2023 11:06:01 +1300 Subject: [PATCH 186/240] fix callJNI error/warning calls --- src/callJNI.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/callJNI.c b/src/callJNI.c index 7b26c35..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); From 46b3ff0c719c22de25b39613efdabbf970f187a8 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 1 Dec 2023 11:06:15 +1300 Subject: [PATCH 187/240] add internal docs --- man/rJava-internal.Rd | 80 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 man/rJava-internal.Rd diff --git a/man/rJava-internal.Rd b/man/rJava-internal.Rd new file mode 100644 index 0000000..b1c9c23 --- /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.convertor}{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} From 1f1d4f612fbec29011a5e0b72c4177b3a892ff11 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 8 Dec 2023 16:04:20 +1300 Subject: [PATCH 188/240] bump verison to 1.0-11 --- src/rJava.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rJava.h b/src/rJava.h index 63cf0b0..6f731f3 100644 --- a/src/rJava.h +++ b/src/rJava.h @@ -1,7 +1,7 @@ #ifndef __RJAVA_H__ #define __RJAVA_H__ -#define RJAVA_VER 0x01000a /* rJava v1.0-10 */ +#define RJAVA_VER 0x01000b /* rJava v1.0-11 */ /* important changes between versions: 3.0 - adds compiler From 82f938ddc257fa8a6e5d1a775c5bfcce075d9dca Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 8 Dec 2023 17:00:34 +1300 Subject: [PATCH 189/240] dispatch on S3 superclasses in reflection API native type conversion (#317) --- R/reflection.R | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/R/reflection.R b/R/reflection.R index 7ae2394..3876307 100644 --- a/R/reflection.R +++ b/R/reflection.R @@ -22,15 +22,19 @@ } ### 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", @@ -47,12 +51,15 @@ else if (is.null(a)) .jnull() else if (is.raw(a)) .jarray(a, dispatch=FALSE) ## raw is always [B else { - cm <- match(class(a)[1], names(.class.to.jclass)) - if (!any(is.na(cm))) { - if (length(a) == 1) { + ## 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 `", class(a)[1] ,"' is ambiguous or not supported.") From a7d9d20d9a92609c2ad38c1bb025932e81dbfd7c Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 8 Dec 2023 17:08:08 +1300 Subject: [PATCH 190/240] remove JavaDoc in dist due to security issues (#303) --- mkdist | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mkdist b/mkdist index 1fe0733..6da35ff 100644 --- a/mkdist +++ b/mkdist @@ -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 From 56973123e820b019f93cb59edb0ef0ed7d001082 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 8 Dec 2023 17:13:25 +1300 Subject: [PATCH 191/240] update NEWS --- NEWS | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/NEWS b/NEWS index 54808d1..54b172d 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,19 @@ NEWS/ChangeLog for rJava -------------------------- +1.0-11 + 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. + + 1.0-10 2023-11-30 o minor documentation fixes From 7fd5769edcf79696326281b5c6ea2c9fe7762bfd Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 8 Dec 2023 18:01:55 +1300 Subject: [PATCH 192/240] fix RJavaArrayIterator.java to work with more than two dimensions correctly (#5) --- src/java/RJavaArrayIterator.java | 1 + 1 file changed, 1 insertion(+) 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; } } From 2b5aa501654bb25605a14029c132d3bc50462a48 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 8 Dec 2023 18:04:37 +1300 Subject: [PATCH 193/240] update NEWS --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index 54b172d..3d976b3 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,10 @@ 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) + 1.0-10 2023-11-30 o minor documentation fixes From f10d64dd97c9eb81c97999c72a4bd99442b047ad Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Sat, 9 Dec 2023 12:09:19 +1300 Subject: [PATCH 194/240] fix IGNORE env var typo in configure.win (closes #304) --- configure.win | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From a92d95cf4985b318c7b498c456b6b060e11f5542 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Sat, 9 Dec 2023 12:10:22 +1300 Subject: [PATCH 195/240] update NEWS --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index 3d976b3..36fbe9e 100644 --- a/NEWS +++ b/NEWS @@ -17,6 +17,8 @@ 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 From 225be3c99ae2e2f287a02259cc6df6e73bcb0e91 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Sun, 9 Apr 2023 21:17:52 +0200 Subject: [PATCH 196/240] configure: Avoid implicit int in inline keyword check This prevents the check from going wrong with future compilers which do not support implicit ints. --- configure | 2 +- configure.ac | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 4858bc3..41dd6c9 100755 --- a/configure +++ b/configure @@ -3624,7 +3624,7 @@ 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); diff --git a/configure.ac b/configure.ac index 79a175f..14090b7 100644 --- a/configure.ac +++ b/configure.ac @@ -104,7 +104,7 @@ AS_MESSAGE([checking whether ${CC} supports static inline...]) can_inline=no 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); From ce7954582523083db183970f0b03808e35fdbe75 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 26 Jan 2024 11:22:33 +1300 Subject: [PATCH 197/240] fix typo --- man/rJava-internal.Rd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/rJava-internal.Rd b/man/rJava-internal.Rd index b1c9c23..c6439ed 100644 --- a/man/rJava-internal.Rd +++ b/man/rJava-internal.Rd @@ -71,7 +71,7 @@ \item{simplify}{logical} \item{java.class}{string, class name} \item{fn}{convertor function} - \item{r.convertor}{string, R class} + \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} From 9d2a16a1573719ec1f32d207509033c66c14d56a Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 26 Jan 2024 11:23:29 +1300 Subject: [PATCH 198/240] adapt to changed Win32 API in R 4.2.0 --- NEWS | 7 ++++++- jri/src/Rcallbacks.h | 3 ++- jri/src/Rinit.c | 23 ++++++++++++++++++----- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index 36fbe9e..1215e0d 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,12 @@ NEWS/ChangeLog for rJava -------------------------- -1.0-11 +1.0-12 + 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 diff --git a/jri/src/Rcallbacks.h b/jri/src/Rcallbacks.h index dcb3eae..a244e7d 100644 --- a/jri/src/Rcallbacks.h +++ b/jri/src/Rcallbacks.h @@ -12,7 +12,8 @@ #else #define RCCONST const #endif -#ifdef WIN32 +/* 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 diff --git a/jri/src/Rinit.c b/jri/src/Rinit.c index 04c142b..b6f75c9 100644 --- a/jri/src/Rinit.c +++ b/jri/src/Rinit.c @@ -163,10 +163,17 @@ void myCallBack(void) int myYesNoCancel(RCCONST char *s) { - char ss[128]; - unsigned char a[3]; - - snprintf(ss, sizeof(ss)-1, "%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': @@ -228,7 +235,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; } - snprintf(rhb, sizeof(rhb)-1, "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 */ From e0628b8c0d454cf06bf48509e7abba716eba58dc Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 26 Jan 2024 11:24:09 +1300 Subject: [PATCH 199/240] force output type --- src/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/init.c b/src/init.c index e11bc1b..d44d92d 100644 --- a/src/init.c +++ b/src/init.c @@ -194,7 +194,7 @@ static int initJVM(const char *user_classpath, int opts, char **optv, int hooks, return -2; /* perhaps this VM does not allow disabling guard pages */ if (res != 0) - error("Cannot create Java virtual machine (%d)", res); + error("Cannot create Java virtual machine (JNI_CreateJavaVM returned %ld)", (long int) res); if (!eenv) error("Cannot obtain JVM environment"); From 12ba0c4eb4376faf256608ce73178b839fcba993 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 26 Jan 2024 11:25:15 +1300 Subject: [PATCH 200/240] update NEWS --- NEWS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 1215e0d..969574a 100644 --- a/NEWS +++ b/NEWS @@ -1,9 +1,9 @@ NEWS/ChangeLog for rJava -------------------------- -1.0-12 +1.0-12 2024-01-26 o Win32: minor changes to adapt to (undocumented) API changes in - R 4.2.0. + R 4.2.0. o Win32: warn if R_HOME path is too long. From cf6b51e699c34e83bde0b2f82d4553ed92dfaa34 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 8 Mar 2024 09:14:59 +1300 Subject: [PATCH 201/240] Update GitHub action --- .github/workflows/check.yaml | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index fe85bb5..6b150ce 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -11,15 +11,15 @@ jobs: strategy: fail-fast: false matrix: - os: [ 'windows-2022', 'macOS-10.15', 'ubuntu-20.04' ] + os: [ 'windows-2022', 'macOS-13', 'macOS-14', 'ubuntu-22.04' ] r: [ 'release' ] java: [ 8, 11 ] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install R - uses: s-u/R-actions/install@v1 + uses: s-u/R-actions/install@v2 with: r-version: ${{ matrix.r }} tools: base @@ -43,24 +43,4 @@ jobs: sudo bash reconf.sh shell: bash - - name: R CMD check (Windows) - if: runner.os == 'Windows' - run: "bash -c 'R CMD check --no-multiarch --no-manual ../rJava_*.tar.gz'" - - - name: R CMD check (Linux) - if: runner.os == 'Linux' - run: "bash -c 'xvfb-run R CMD check --no-manual ../rJava_*.tar.gz'" - - - name: R CMD check (macOS) - if: runner.os == 'macOS' - run: "bash -c 'NOAWT=1 R CMD check --no-manual ../rJava_*.tar.gz'" - - - name: Show install log - run: "bash -c 'if [ -e rJava.Rcheck/00install.out ]; then cat rJava.Rcheck/00install.out; fi'" - - - name: Upload check results - if: failure() - uses: actions/upload-artifact@master - with: - name: ${{ runner.os }}-r${{ matrix.r }}-j${{ matrix.java }}-results - path: rJava.Rcheck + - uses: s-u/R-actions/pkg-check@v2 From d58548c08ead76bd93e4c3c7f3ef474d6e7b341f Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 8 Mar 2024 09:21:58 +1300 Subject: [PATCH 202/240] GitHub action: run mkdist in pkg-check --- .github/workflows/check.yaml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 6b150ce..d757d7d 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -28,12 +28,6 @@ jobs: with: java-version: ${{ matrix.java }} - - name: Build - run: | - sh mkdist - java -version && which java && echo $PATH && echo $JAVA_HOME - shell: bash - - name: Setup R Java support if: runner.os != 'Windows' run: | @@ -44,3 +38,5 @@ jobs: shell: bash - uses: s-u/R-actions/pkg-check@v2 + with: + build-script: sh mkdist From 345223d53c201c342a9af49577295810fa5d7105 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 8 Mar 2024 09:35:15 +1300 Subject: [PATCH 203/240] GHA: update setup-java to work on arm64 and set NOAWT --- .github/workflows/check.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index d757d7d..a8efccd 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -5,6 +5,8 @@ name: check jobs: check: runs-on: ${{ matrix.os }} + env: + NOAWT: 1 name: ${{ matrix.os }}, R ${{ matrix.r }}, Java ${{ matrix.java }} @@ -24,8 +26,9 @@ jobs: r-version: ${{ matrix.r }} tools: base - - uses: actions/setup-java@v1 + - uses: actions/setup-java@v4 with: + distribution: 'zulu' java-version: ${{ matrix.java }} - name: Setup R Java support From f05bb59a6a3459ae8743bbb00178d6d234deba7c Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 12 May 2025 08:24:14 +1200 Subject: [PATCH 204/240] bump verison to 1.0-13 --- src/rJava.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rJava.h b/src/rJava.h index 6f731f3..bcdfb9a 100644 --- a/src/rJava.h +++ b/src/rJava.h @@ -1,7 +1,7 @@ #ifndef __RJAVA_H__ #define __RJAVA_H__ -#define RJAVA_VER 0x01000b /* rJava v1.0-11 */ +#define RJAVA_VER 0x01000d /* rJava v1.0-13 */ /* important changes between versions: 3.0 - adds compiler From f02bb4fe3f666fc169afde06a484e5071bb30e98 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 12 May 2025 09:10:57 +1200 Subject: [PATCH 205/240] don't change java.parameters option, but set defaults in .jinit instead (closes #341) --- R/jfirst.R | 4 ---- R/jinit.R | 17 ++++++++++++++++- man/jinit.Rd | 17 +++++++++++------ 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/R/jfirst.R b/R/jfirst.R index faa8dbd..8f40142 100644 --- a/R/jfirst.R +++ b/R/jfirst.R @@ -46,10 +46,6 @@ 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 e622edc..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 diff --git a/man/jinit.Rd b/man/jinit.Rd index 3ff89a1..4f9d88d 100644 --- a/man/jinit.Rd +++ b/man/jinit.Rd @@ -11,8 +11,8 @@ \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{ @@ -25,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 @@ -89,15 +92,17 @@ silent = FALSE, force.init = FALSE) 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() } } From ef046ea7698ff0ae9a701fe48eceb4ee54befc3f Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 12 May 2025 09:12:28 +1200 Subject: [PATCH 206/240] update NEWS --- NEWS | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/NEWS b/NEWS index 969574a..1ae534f 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,18 @@ NEWS/ChangeLog for rJava -------------------------- +1.0-13 + 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. From 8c9618e4149fe1ebfb48c43f55cb5d0d4904e6c3 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 19 Jan 2026 08:40:51 +1300 Subject: [PATCH 207/240] bump version to 1.0-14 --- src/rJava.h | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/rJava.h b/src/rJava.h index bcdfb9a..6c50085 100644 --- a/src/rJava.h +++ b/src/rJava.h @@ -1,7 +1,7 @@ #ifndef __RJAVA_H__ #define __RJAVA_H__ -#define RJAVA_VER 0x01000d /* rJava v1.0-13 */ +#define RJAVA_VER 0x01000e /* rJava v1.0-14 */ /* important changes between versions: 3.0 - adds compiler @@ -27,6 +27,25 @@ #include #include +#include + +/* 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) From 57f2c5045ebabbf1eabba9a47cbfc32c004549ad Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 19 Jan 2026 08:43:49 +1300 Subject: [PATCH 208/240] update NEWS --- NEWS | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 1ae534f..1848f35 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,11 @@ NEWS/ChangeLog for rJava -------------------------- -1.0-13 +1.0-14 2026-01-19 + o adjust to renamed R API + + +1.0-13 2024-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) From 5b69017423899ef333ef2d2b340587d37456c8d1 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 19 Jan 2026 08:52:29 +1300 Subject: [PATCH 209/240] GHA: update available runners --- .github/workflows/check.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index a8efccd..58a2cde 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -13,8 +13,8 @@ jobs: strategy: fail-fast: false matrix: - os: [ 'windows-2022', 'macOS-13', 'macOS-14', 'ubuntu-22.04' ] - r: [ 'release' ] + os: [ macos-14, macos-15-intel, windows-2022, ubuntu-22.04, ubuntu-24.04 ] + r: [ devel ] java: [ 8, 11 ] steps: @@ -40,6 +40,6 @@ jobs: sudo bash reconf.sh shell: bash - - uses: s-u/R-actions/pkg-check@v2 + - uses: s-u/R-actions/pkg-check@master with: build-script: sh mkdist From 7988863a0498f6acb490fa81d4e823f0954eb0ab Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 19 Jan 2026 11:48:50 +1300 Subject: [PATCH 210/240] add R deps missing on ubuntu-24.04 runners --- .github/workflows/check.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 58a2cde..350d708 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -43,3 +43,4 @@ jobs: - uses: s-u/R-actions/pkg-check@master with: build-script: sh mkdist + debian-deps: libpcre2-dev liblzma-dev libbz2-dev libdeflate-dev From 92e3905745579f0a135187a7202109b7b77dda29 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 19 Jan 2026 11:58:42 +1300 Subject: [PATCH 211/240] add EXTPTR compatibility re-maps --- src/rJava.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/rJava.h b/src/rJava.h index 6c50085..e0f1883 100644 --- a/src/rJava.h +++ b/src/rJava.h @@ -78,6 +78,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 From 9d912e2633787e1c5aff2e4bc4bd15e8e0c025ce Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 19 Jan 2026 12:00:11 +1300 Subject: [PATCH 212/240] add protection fixes --- src/Rglue.c | 78 ++++++++++++++++++++++------------------------------- src/rJava.c | 25 +++++++++-------- 2 files changed, 46 insertions(+), 57 deletions(-) diff --git a/src/Rglue.c b/src/Rglue.c index 45bbcd4..c76da2f 100644 --- a/src/Rglue.c +++ b/src/Rglue.c @@ -7,23 +7,6 @@ #include #include #include "rjstring.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) - #include /* max supported # of parameters to Java methods */ @@ -197,7 +180,7 @@ HIDE void deserializeSEXP(SEXP o) { /* 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); } } } @@ -259,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 */ @@ -432,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); @@ -453,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); @@ -717,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; } @@ -832,14 +823,13 @@ 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; } @@ -851,13 +841,12 @@ 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; } @@ -875,24 +864,22 @@ 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; } @@ -908,17 +895,16 @@ 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 @@ -1092,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) diff --git a/src/rJava.c b/src/rJava.c index 294f0f2..33bd33d 100644 --- a/src/rJava.c +++ b/src/rJava.c @@ -43,9 +43,9 @@ HIDE void throwR(SEXP msg, SEXP jobj, SEXP clazzes) { 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 */ @@ -63,7 +63,7 @@ HIDE void ckx(JNIEnv *env) { /* env is valid and an exception occurred */ /* 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); @@ -71,7 +71,7 @@ HIDE void ckx(JNIEnv *env) { (*env)->ExceptionClear(env); /* grab the list of class names (without package path) */ - SEXP clazzes = rj_RJavaTools_Class ? PROTECT( getSimpleClassNames_asSEXP( (jobject)x, (jboolean)1 ) ) : R_NilValue; + 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 */ { @@ -97,7 +97,7 @@ HIDE void ckx(JNIEnv *env) { /* 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); } @@ -114,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 */ @@ -162,8 +167,6 @@ HIDE JNIEnv *getJNIEnv(void) } if (env && !eenv) eenv=env; - /* if (eenv!=env) - fprintf(stderr, "Warning! eenv=%x, but env=%x - different environments encountered!\n", eenv, env); */ return env; } From 63a8eef254beaebb3e0348df7b091e0822a60578 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 19 Jan 2026 12:01:23 +1300 Subject: [PATCH 213/240] modenrize DESCRIPTION --- DESCRIPTION | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index e70cfc6..1b7c4aa 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,9 @@ Package: rJava Version: (populated by mkdist!) Title: Low-Level R to Java Interface -Author: Simon Urbanek -Maintainer: Simon Urbanek +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: LGPL-2.1 From 72baf513c176d9058a504aa684972fa5b0dad092 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 19 Jan 2026 12:01:33 +1300 Subject: [PATCH 214/240] update NEWS --- NEWS | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 1848f35..47ed0b2 100644 --- a/NEWS +++ b/NEWS @@ -2,10 +2,14 @@ -------------------------- 1.0-14 2026-01-19 - o adjust to renamed R API + o Minor changes to replace EXTPTR macros with API calls globally. + o Added Authors@R and ORCID. -1.0-13 2024-05-12 + 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) From 4afc2b2c92a6436afcee3aeee01e5c3f1e401759 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 19 Jan 2026 13:14:57 +1300 Subject: [PATCH 215/240] use new ObjectTable.h in R 4.6.0+ --- src/rJava.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/rJava.h b/src/rJava.h index e0f1883..45a5c22 100644 --- a/src/rJava.h +++ b/src/rJava.h @@ -25,9 +25,12 @@ #include #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)) From d5a9526ac185a08a4af810732726adc082672e75 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 19 Jan 2026 13:17:50 +1300 Subject: [PATCH 216/240] bump version to 1.0-15 --- src/rJava.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rJava.h b/src/rJava.h index 45a5c22..c0ca8c7 100644 --- a/src/rJava.h +++ b/src/rJava.h @@ -1,7 +1,7 @@ #ifndef __RJAVA_H__ #define __RJAVA_H__ -#define RJAVA_VER 0x01000e /* rJava v1.0-14 */ +#define RJAVA_VER 0x01000f /* rJava v1.0-15 */ /* important changes between versions: 3.0 - adds compiler From d03e1cad65ec6f899c767d0121b14d31aba01d46 Mon Sep 17 00:00:00 2001 From: Valentino Pinna Date: Wed, 12 Nov 2025 14:49:39 +0100 Subject: [PATCH 217/240] Fix #345. Allow J() convenience call on all versions of Java 6+ --- src/java/RJavaTools.java | 158 ++++++++++++++++++++++++++++++--------- 1 file changed, 124 insertions(+), 34 deletions(-) diff --git a/src/java/RJavaTools.java b/src/java/RJavaTools.java index 3b52c85..6890b56 100644 --- a/src/java/RJavaTools.java +++ b/src/java/RJavaTools.java @@ -17,13 +17,20 @@ // You should have received a copy of the GNU General Public License // along with rJava. If not, see . -import java.lang.reflect.Method ; -import java.lang.reflect.Field ; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodHandles.Lookup; +import java.lang.reflect.AccessibleObject; import java.lang.reflect.Constructor ; +import java.lang.reflect.Executable; +import java.lang.reflect.Field ; import java.lang.reflect.InvocationTargetException ; -import java.lang.reflect.Modifier ; import java.lang.reflect.Member ; - +import java.lang.reflect.Method ; +import java.lang.reflect.Modifier ; +import java.util.ArrayDeque; +import java.util.Arrays; +import java.util.Deque; +import java.util.HashSet; import java.util.Vector ; @@ -35,6 +42,23 @@ */ public class RJavaTools { + /* dual path for Java 8 and 9+ to check actual accessibility */ + private static final Method CAN_ACCESS; + /* Java 8 accessibility checker */ + private static final Lookup LOOKUP = MethodHandles.publicLookup(); + + static { + Method canAccess = null; + try { + canAccess = Executable.class.getMethod("canAccess", Object.class); + } catch (NoSuchMethodException e) { + // Java 8- + } catch (SecurityException e) { + // Java 8- + } + CAN_ACCESS = canAccess; + } + /** * Returns an inner class of the class with the given simple name * @@ -328,7 +352,97 @@ public static boolean hasMethod(Object o, String name) { return classHasMethod(o.getClass(), name, false); } + /** + * Tests whether a given executable is accessible without actually calling {@link AccessibleObject#isAccessible()} which is unreliable. + * + * @param executable the given method/constructor + * @param o the target object + * @return true if the method can be accessed from RJavaTools + */ + public static boolean canAccess(Executable executable, Object o){ + try { + if (CAN_ACCESS != null) { + /* Java 9+ path */ + return (boolean) (Boolean) CAN_ACCESS.invoke(executable, o); + } else { + /* Java 8 path */ + if (executable instanceof Method) + LOOKUP.unreflect((Method) executable); + else + LOOKUP.unreflectConstructor((Constructor) executable); + return true; + } + } catch (Exception e) { + return false; + } + } + /** + * Resolves a bridge method to the override one + * @param bridgeMethod the potentially bridge method + * @return a method that isn't a bridge method + */ + public static Method resolveBridge(Method bridgeMethod) { + // accounts for bridge methods which may have slightly different parameters + Method best = null; + if (bridgeMethod.isBridge()) { + Class[] bridgeParams = bridgeMethod.getParameterTypes(); + // look for non-bridge methods in the same class that accepts wider parameters + nextMethod: + for (Method method: bridgeMethod.getDeclaringClass().getDeclaredMethods()) { + if (!method.isBridge() && !method.isSynthetic() && method.getName().equals(bridgeMethod.getName()) + && method.getParameterCount() == bridgeMethod.getParameterCount()) { + Class[] testParams = method.getParameterTypes(); + // Bridge params should be supertypes of target params (erasure widening). + for (int i = 0; i < testParams.length; i++) { + if (!testParams[i].isAssignableFrom(bridgeParams[i])) continue nextMethod; + } + if (bridgeMethod.getReturnType().isAssignableFrom(method.getReturnType()) && (best == null || isMoreSpecific(method, best))) best = method; + } + } + } + + return best == null ? bridgeMethod : best; + } + + /** + * Finds a mathod that accepts the given instance and is accessible from RJavaTools class. + *

Avoids calling isAccessible/setAccessible that fails on Java 17+ + * + * @param method The most specific, possibly non-accessible, method + * @param target the instance upon which the method is being invoked (null for static) + * @return + */ + public static Method findAccessible(Method method, Object target) { + if (canAccess(method, target)) return method; + + Deque> supers = new ArrayDeque>(); + HashSet> visited = new HashSet>(); + supers.add(target.getClass()); + + while (!supers.isEmpty()) { + Class c = supers.pop(); + if (visited.add(c)) { + Method superMethod; + try { + // first update the method to be non-bridge + method = resolveBridge(method); + superMethod = c.getMethod(method.getName(), method.getParameterTypes()); + /* if an accessible executable is found stop here */ + if (canAccess(superMethod, target)) return superMethod; + if (!c.isInterface() && !c.isArray()) supers.add(c.getSuperclass()); + if (!c.isArray()) supers.addAll(Arrays.asList(c.getInterfaces())); + } catch (NoSuchMethodException e1) { + /* executable not found in current class (and any of its ancestors) */ + } catch (SecurityException e1) { + /* executable not found in current class (and any of its ancestors) */ + } + } + } + + /* No accessible executable found, fail later on invoke/newInstance */ + return method; + } /** * Object creator. Find the best constructor based on the parameter classes @@ -343,25 +457,12 @@ public static Object newInstance( Class o_clazz, Object[] args, Class[] clazzes Constructor cons = getConstructor( o_clazz, clazzes, is_null ); - /* enforcing accessibility (workaround for bug 128) */ - boolean access = cons.isAccessible(); - 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{ o = cons.newInstance( args ) ; } catch( InvocationTargetException e){ /* the target exception is much more useful than the reflection wrapper */ - throw e.getTargetException() ; - } finally{ - if (!access) - cons.setAccessible( access ); + throw e.getCause() ; } return o; } @@ -377,32 +478,21 @@ static boolean[] arg_is_null(Object[] args){ /** * Invoke a method of a given class - *

First the appropriate method is resolved by getMethod and - * then invokes the method + *

First the appropriate method is resolved by getMethod. + *

Then, if the method is not accessible, tries to find an accessible equivalent. + *

Finally it invokes the method */ public static Object invokeMethod( Class o_clazz, Object o, String name, Object[] args, Class[] clazzes) throws Throwable { Method m = getMethod( o_clazz, name, clazzes, arg_is_null(args) ); - - /* enforcing accessibility (workaround for bug 128) */ - 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 ... */ - } - } + m = findAccessible(m, o); Object out; try{ out = m.invoke( o, args ) ; } catch( InvocationTargetException e){ /* the target exception is much more useful than the reflection wrapper */ - throw e.getTargetException() ; - } finally{ - if (!access) - m.setAccessible( access ); + throw e.getCause() ; } return out ; } From e28ebb6d3f95587576b8ae51cfd5a69574e4d494 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 19 Jan 2026 13:39:15 +1300 Subject: [PATCH 218/240] move jri to src/jri --- .gitmodules | 2 +- configure.ac | 2 +- mkdist | 44 +++++++++--------- src/Makevars.in | 10 ++-- {jri => src/jri}/LGPL.txt | 0 {jri => src/jri}/LICENSE | 0 {jri => src/jri}/Makefile.all | 0 {jri => src/jri}/Makefile.in | 0 {jri => src/jri}/Makefile.win | 0 {jri => src/jri}/Makevars.win | 0 {jri => src/jri}/Mutex.java | 0 {jri => src/jri}/NEWS | 0 {jri => src/jri}/RBool.java | 0 {jri => src/jri}/RConsoleOutputStream.java | 0 {jri => src/jri}/README | 0 {jri => src/jri}/REXP.java | 0 {jri => src/jri}/REngine | 0 {jri => src/jri}/RFactor.java | 0 {jri => src/jri}/RList.java | 0 {jri => src/jri}/RMainLoopCallbacks.java | 0 {jri => src/jri}/RVector.java | 0 {jri => src/jri}/Rengine.java | 0 {jri => src/jri}/bootstrap/Boot.java | 0 .../jri}/bootstrap/DelegatedClassLoader.java | 0 .../bootstrap/DelegatedURLClassLoader.java | 0 {jri => src/jri}/bootstrap/JRIBootstrap.c | 0 {jri => src/jri}/bootstrap/JRIBootstrap.h | 0 {jri => src/jri}/bootstrap/JRIBootstrap.java | 0 .../jri}/bootstrap/JRIClassLoader.java | 0 {jri => src/jri}/bootstrap/Makefile | 0 {jri => src/jri}/bootstrap/mft | 0 {jri => src/jri}/configure | 0 {jri => src/jri}/configure.ac | 0 {jri => src/jri}/configure.win | 0 {jri => src/jri}/examples/rtest.java | 0 {jri => src/jri}/examples/rtest2.java | 0 {jri => src/jri}/mkdist | 0 {jri => src/jri}/package-info.java | 0 {jri => src/jri}/run.in | 0 {jri => src/jri}/src/Makefile.all | 0 {jri => src/jri}/src/Makefile.in | 0 {jri => src/jri}/src/Makefile.win | 0 {jri => src/jri}/src/Rcallbacks.c | 0 {jri => src/jri}/src/Rcallbacks.h | 0 {jri => src/jri}/src/Rdecl.h | 0 {jri => src/jri}/src/Rengine.c | 0 {jri => src/jri}/src/Rinit.c | 0 {jri => src/jri}/src/Rinit.h | 0 {jri => src/jri}/src/config.h.in | 0 {jri => src/jri}/src/globals.c | 0 {jri => src/jri}/src/globals.h | 0 {jri => src/jri}/src/h2ic | 0 {jri => src/jri}/src/jri.c | 0 {jri => src/jri}/src/jri.h | 0 {jri => src/jri}/src/rjava.c | 0 {jri => src/jri}/src/rjava.h | 0 {jri => src/jri}/src/rjstring.c | 0 {jri => src/jri}/src/rjstring.h | 0 {jri => src/jri}/src/win32/Makefile | 0 {jri => src/jri}/src/win32/findjava.c | 0 {jri => src/jri}/src/win32/jvm.def | 0 {jri => src/jri}/src/win32/jvm64.def | 0 {jri => src/jri}/tools/config.guess | 0 {jri => src/jri}/tools/config.sub | 0 {jri => src/jri}/tools/getsp.class | Bin {jri => src/jri}/tools/getsp.java | 0 {jri => src/jri}/tools/install-sh | 0 {jri => src/jri}/tools/mkinstalldirs | 0 {jri => src/jri}/version | 0 69 files changed, 29 insertions(+), 29 deletions(-) rename {jri => src/jri}/LGPL.txt (100%) rename {jri => src/jri}/LICENSE (100%) rename {jri => src/jri}/Makefile.all (100%) rename {jri => src/jri}/Makefile.in (100%) rename {jri => src/jri}/Makefile.win (100%) rename {jri => src/jri}/Makevars.win (100%) rename {jri => src/jri}/Mutex.java (100%) rename {jri => src/jri}/NEWS (100%) rename {jri => src/jri}/RBool.java (100%) rename {jri => src/jri}/RConsoleOutputStream.java (100%) rename {jri => src/jri}/README (100%) rename {jri => src/jri}/REXP.java (100%) rename {jri => src/jri}/REngine (100%) rename {jri => src/jri}/RFactor.java (100%) rename {jri => src/jri}/RList.java (100%) rename {jri => src/jri}/RMainLoopCallbacks.java (100%) rename {jri => src/jri}/RVector.java (100%) rename {jri => src/jri}/Rengine.java (100%) rename {jri => src/jri}/bootstrap/Boot.java (100%) rename {jri => src/jri}/bootstrap/DelegatedClassLoader.java (100%) rename {jri => src/jri}/bootstrap/DelegatedURLClassLoader.java (100%) rename {jri => src/jri}/bootstrap/JRIBootstrap.c (100%) rename {jri => src/jri}/bootstrap/JRIBootstrap.h (100%) rename {jri => src/jri}/bootstrap/JRIBootstrap.java (100%) rename {jri => src/jri}/bootstrap/JRIClassLoader.java (100%) rename {jri => src/jri}/bootstrap/Makefile (100%) rename {jri => src/jri}/bootstrap/mft (100%) rename {jri => src/jri}/configure (100%) rename {jri => src/jri}/configure.ac (100%) rename {jri => src/jri}/configure.win (100%) rename {jri => src/jri}/examples/rtest.java (100%) rename {jri => src/jri}/examples/rtest2.java (100%) rename {jri => src/jri}/mkdist (100%) rename {jri => src/jri}/package-info.java (100%) rename {jri => src/jri}/run.in (100%) rename {jri => src/jri}/src/Makefile.all (100%) rename {jri => src/jri}/src/Makefile.in (100%) rename {jri => src/jri}/src/Makefile.win (100%) rename {jri => src/jri}/src/Rcallbacks.c (100%) rename {jri => src/jri}/src/Rcallbacks.h (100%) rename {jri => src/jri}/src/Rdecl.h (100%) rename {jri => src/jri}/src/Rengine.c (100%) rename {jri => src/jri}/src/Rinit.c (100%) rename {jri => src/jri}/src/Rinit.h (100%) rename {jri => src/jri}/src/config.h.in (100%) rename {jri => src/jri}/src/globals.c (100%) rename {jri => src/jri}/src/globals.h (100%) rename {jri => src/jri}/src/h2ic (100%) rename {jri => src/jri}/src/jri.c (100%) rename {jri => src/jri}/src/jri.h (100%) rename {jri => src/jri}/src/rjava.c (100%) rename {jri => src/jri}/src/rjava.h (100%) rename {jri => src/jri}/src/rjstring.c (100%) rename {jri => src/jri}/src/rjstring.h (100%) rename {jri => src/jri}/src/win32/Makefile (100%) rename {jri => src/jri}/src/win32/findjava.c (100%) rename {jri => src/jri}/src/win32/jvm.def (100%) rename {jri => src/jri}/src/win32/jvm64.def (100%) rename {jri => src/jri}/tools/config.guess (100%) rename {jri => src/jri}/tools/config.sub (100%) rename {jri => src/jri}/tools/getsp.class (100%) rename {jri => src/jri}/tools/getsp.java (100%) rename {jri => src/jri}/tools/install-sh (100%) rename {jri => src/jri}/tools/mkinstalldirs (100%) rename {jri => src/jri}/version (100%) 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/configure.ac b/configure.ac index 14090b7..afcb9be 100644 --- a/configure.ac +++ b/configure.ac @@ -382,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/mkdist b/mkdist index 6da35ff..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 tools/install-sh jri/configure + rm -f configure tools/install-sh src/jri/configure fi if [ -e /tmp/rJava/configure ]; then @@ -72,9 +72,9 @@ 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 @@ -169,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 @@ -193,7 +193,7 @@ 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} diff --git a/src/Makevars.in b/src/Makevars.in index e911ddc..f59c622 100644 --- a/src/Makevars.in +++ b/src/Makevars.in @@ -5,13 +5,13 @@ 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/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 100% rename from jri/Makefile.all rename to src/jri/Makefile.all diff --git a/jri/Makefile.in b/src/jri/Makefile.in similarity index 100% rename from jri/Makefile.in rename to src/jri/Makefile.in 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 100% rename from jri/Makevars.win rename to src/jri/Makevars.win 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/jri/REngine b/src/jri/REngine similarity index 100% rename from jri/REngine rename to src/jri/REngine diff --git a/jri/RFactor.java b/src/jri/RFactor.java similarity index 100% rename from jri/RFactor.java rename to src/jri/RFactor.java diff --git a/jri/RList.java b/src/jri/RList.java similarity index 100% rename from jri/RList.java rename to src/jri/RList.java diff --git a/jri/RMainLoopCallbacks.java b/src/jri/RMainLoopCallbacks.java similarity index 100% rename from jri/RMainLoopCallbacks.java rename to src/jri/RMainLoopCallbacks.java diff --git a/jri/RVector.java b/src/jri/RVector.java similarity index 100% rename from jri/RVector.java rename to src/jri/RVector.java diff --git a/jri/Rengine.java b/src/jri/Rengine.java similarity index 100% rename from jri/Rengine.java rename to src/jri/Rengine.java 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 100% rename from jri/configure rename to src/jri/configure diff --git a/jri/configure.ac b/src/jri/configure.ac similarity index 100% rename from jri/configure.ac rename to src/jri/configure.ac diff --git a/jri/configure.win b/src/jri/configure.win similarity index 100% rename from jri/configure.win rename to src/jri/configure.win 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/jri/src/Makefile.all b/src/jri/src/Makefile.all similarity index 100% rename from jri/src/Makefile.all rename to src/jri/src/Makefile.all diff --git a/jri/src/Makefile.in b/src/jri/src/Makefile.in similarity index 100% rename from jri/src/Makefile.in rename to src/jri/src/Makefile.in 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 100% rename from jri/src/Rcallbacks.c rename to src/jri/src/Rcallbacks.c diff --git a/jri/src/Rcallbacks.h b/src/jri/src/Rcallbacks.h similarity index 100% rename from jri/src/Rcallbacks.h rename to src/jri/src/Rcallbacks.h diff --git a/jri/src/Rdecl.h b/src/jri/src/Rdecl.h similarity index 100% rename from jri/src/Rdecl.h rename to src/jri/src/Rdecl.h diff --git a/jri/src/Rengine.c b/src/jri/src/Rengine.c similarity index 100% rename from jri/src/Rengine.c rename to src/jri/src/Rengine.c diff --git a/jri/src/Rinit.c b/src/jri/src/Rinit.c similarity index 100% rename from jri/src/Rinit.c rename to src/jri/src/Rinit.c diff --git a/jri/src/Rinit.h b/src/jri/src/Rinit.h similarity index 100% rename from jri/src/Rinit.h rename to src/jri/src/Rinit.h diff --git a/jri/src/config.h.in b/src/jri/src/config.h.in similarity index 100% rename from jri/src/config.h.in rename to src/jri/src/config.h.in 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 100% rename from jri/src/jri.c rename to src/jri/src/jri.c diff --git a/jri/src/jri.h b/src/jri/src/jri.h similarity index 100% rename from jri/src/jri.h rename to src/jri/src/jri.h diff --git a/jri/src/rjava.c b/src/jri/src/rjava.c similarity index 100% rename from jri/src/rjava.c rename to src/jri/src/rjava.c diff --git a/jri/src/rjava.h b/src/jri/src/rjava.h similarity index 100% rename from jri/src/rjava.h rename to src/jri/src/rjava.h diff --git a/jri/src/rjstring.c b/src/jri/src/rjstring.c similarity index 100% rename from jri/src/rjstring.c rename to src/jri/src/rjstring.c diff --git a/jri/src/rjstring.h b/src/jri/src/rjstring.h similarity index 100% rename from jri/src/rjstring.h rename to src/jri/src/rjstring.h 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 100% rename from jri/src/win32/findjava.c rename to src/jri/src/win32/findjava.c 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 100% rename from jri/tools/config.guess rename to src/jri/tools/config.guess diff --git a/jri/tools/config.sub b/src/jri/tools/config.sub similarity index 100% rename from jri/tools/config.sub rename to src/jri/tools/config.sub diff --git a/jri/tools/getsp.class b/src/jri/tools/getsp.class similarity index 100% rename from jri/tools/getsp.class rename to src/jri/tools/getsp.class diff --git a/jri/tools/getsp.java b/src/jri/tools/getsp.java similarity index 100% rename from jri/tools/getsp.java rename to src/jri/tools/getsp.java diff --git a/jri/tools/install-sh b/src/jri/tools/install-sh similarity index 100% rename from jri/tools/install-sh rename to src/jri/tools/install-sh diff --git a/jri/tools/mkinstalldirs b/src/jri/tools/mkinstalldirs similarity index 100% rename from jri/tools/mkinstalldirs rename to src/jri/tools/mkinstalldirs diff --git a/jri/version b/src/jri/version similarity index 100% rename from jri/version rename to src/jri/version From 371c0360bcbd82b6a0455d87d043f1c9cef0b606 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 19 Jan 2026 13:39:55 +1300 Subject: [PATCH 219/240] update autoconf artifacts --- configure | 3501 +++++++++++++++++++++------------------ src/config.h.in | 19 +- src/jri/configure | 695 ++++---- src/jri/src/config.h.in | 2 +- 4 files changed, 2238 insertions(+), 1979 deletions(-) diff --git a/configure b/configure index 41dd6c9..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" @@ -842,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" @@ -997,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=* \ @@ -1046,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" @@ -1062,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" @@ -1092,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" ;; *=*) @@ -1101,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}" ;; @@ -1126,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 @@ -1134,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. @@ -1151,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 @@ -1190,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 @@ -1219,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)` @@ -1247,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]... @@ -1261,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 @@ -1273,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. @@ -1287,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] @@ -1349,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 . @@ -1370,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/ ;; @@ -1400,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 @@ -1408,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 @@ -1418,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 @@ -1437,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 @@ -1452,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 # ------------------------------------------------------- @@ -1646,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 @@ -1702,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 # ----------------------- @@ -1722,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 @@ -1737,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 @@ -1761,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 @@ -1801,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 @@ -1837,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'" ;; @@ -1872,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 @@ -1887,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) ;; #( @@ -1912,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 @@ -1920,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 @@ -1935,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 @@ -1951,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 && @@ -1966,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 @@ -2032,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 @@ -2096,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. ## @@ -2116,34 +2377,6 @@ 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. - # find R home and set CC/CFLAGS @@ -2166,82 +2399,100 @@ 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+set}" = set; then : +if test ${enable_dynload+y} +then : enableval=$enable_dynload; want_dynload="${enableval}" -else - want_dynload=auto +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 @@ -2253,6 +2504,15 @@ 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' @@ -2261,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 @@ -2301,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 @@ -2340,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 @@ -2354,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 @@ -2394,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 @@ -2407,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 @@ -2431,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 @@ -2453,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 @@ -2497,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 @@ -2540,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 @@ -2577,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 @@ -2585,7 +2987,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; @@ -2597,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.*" @@ -2620,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. @@ -2641,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. @@ -2657,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 @@ -2708,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 @@ -2725,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; ; @@ -2737,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 @@ -2746,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 @@ -2757,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) { ; @@ -2803,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 @@ -2816,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 @@ -2850,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" @@ -2881,558 +3303,244 @@ 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 () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -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 -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -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 - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -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" +int +main (void) +{ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : -{ $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 +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. */ -#include -#include -#include -#include int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_g=yes +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 ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag ;; +esac +fi +{ 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 + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi else - ac_cv_header_stdc=no + if test "$GCC" = yes; then + CFLAGS="-O2" + 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 @@ -3444,7 +3552,7 @@ else #endif int -main () +main (void) { int s; wait (&s); @@ -3453,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 @@ -3522,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 */ @@ -3550,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; @@ -3566,59 +3696,27 @@ 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. */ @@ -3631,29 +3729,31 @@ int main(void) { } _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); @@ -3662,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 @@ -3702,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 @@ -3728,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}' @@ -3773,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}" @@ -3791,37 +3975,37 @@ 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; } +{ 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 - { $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; } 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; } + { 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; } +{ 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 @@ -3836,10 +4020,10 @@ fi if test x"$use_dynload" != xyes; then use_dynload=no fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether JVM will be loaded dynamically" >&5 -$as_echo_n "checking whether JVM will be loaded dynamically... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${use_dynload}" >&5 -$as_echo "${use_dynload}" >&6; } +{ 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='#' @@ -3849,8 +4033,8 @@ else 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; } +{ 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. */ @@ -3862,26 +4046,29 @@ 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 whether JNI programs run" >&5 -$as_echo_n "checking whether JNI programs run... " >&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 @@ -3892,26 +4079,30 @@ 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 $? "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 +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 + 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 @@ -3920,23 +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 @@ -3948,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 @@ -3983,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 @@ -4047,30 +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 -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" @@ -4087,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 @@ -4104,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) ;; #( @@ -4118,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 | @@ -4135,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 @@ -4157,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 @@ -4175,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" @@ -4199,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 @@ -4223,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 || @@ -4288,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 #(( @@ -4303,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] @@ -4352,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 @@ -4385,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... @@ -4408,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 @@ -4444,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 @@ -4466,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*) @@ -4479,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 @@ -4490,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 @@ -4520,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" @@ -4529,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 @@ -4573,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 @@ -4592,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 @@ -4623,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. @@ -4650,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." @@ -4694,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'" @@ -4710,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 ;; @@ -4747,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 "\$@" @@ -4761,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 @@ -4778,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 @@ -4788,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 @@ -4797,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= @@ -4821,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 @@ -4979,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. @@ -5095,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 @@ -5117,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 @@ -5160,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 @@ -5184,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/ ;; @@ -5239,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=' @@ -5253,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 @@ -5282,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" @@ -5300,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 @@ -5393,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 @@ -5403,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" @@ -5424,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/ ;; @@ -5464,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 @@ -5487,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\"" || @@ -5499,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/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/jri/configure b/src/jri/configure index 52b313d..30bd7a8 100755 --- a/src/jri/configure +++ b/src/jri/configure @@ -1,11 +1,11 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for JRI 0.3. +# Generated by GNU Autoconf 2.72 for JRI 0.3. # # Report bugs to . # # -# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, +# Copyright (C) 1992-1996, 1998-2017, 2020-2023 Free Software Foundation, # Inc. # # @@ -17,7 +17,6 @@ # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -as_nop=: if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh @@ -26,12 +25,13 @@ then : # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else $as_nop - 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 @@ -103,7 +103,7 @@ 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 @@ -133,15 +133,14 @@ 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'. +# 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="as_nop=: -if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 + as_bourne_compatible="if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh NULLCMD=: @@ -149,12 +148,13 @@ then : # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST -else \$as_nop - 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 " @@ -172,8 +172,9 @@ as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ) then : -else \$as_nop - 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)) @@ -186,14 +187,15 @@ test -x / || exit 1" if (eval "$as_required") 2>/dev/null then : as_have_required=yes -else $as_nop - 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 : -else $as_nop - 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 @@ -226,12 +228,13 @@ IFS=$as_save_IFS if $as_found then : -else $as_nop - if { test -f "$SHELL" || test -f "$SHELL.exe"; } && +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 +fi ;; +esac fi @@ -253,7 +256,7 @@ 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'. +# out after a failed 'exec'. printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi @@ -273,7 +276,8 @@ $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} @@ -312,14 +316,6 @@ as_fn_exit () as_fn_set_status $1 exit $1 } # as_fn_exit -# as_fn_nop -# --------- -# Do nothing but, unlike ":", preserve the value of $?. -as_fn_nop () -{ - return $? -} -as_nop=as_fn_nop # as_fn_mkdir_p # ------------- @@ -388,11 +384,12 @@ then : { eval $1+=\$2 }' -else $as_nop - as_fn_append () +else case e in #( + e) as_fn_append () { eval $1=\$$1\$2 - } + } ;; +esac fi # as_fn_append # as_fn_arith ARG... @@ -406,21 +403,14 @@ then : { as_val=$(( $* )) }' -else $as_nop - as_fn_arith () +else case e in #( + e) as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` - } + } ;; +esac fi # as_fn_arith -# as_fn_nop -# --------- -# Do nothing but, unlike ":", preserve the value of $?. -as_fn_nop () -{ - return $? -} -as_nop=as_fn_nop # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- @@ -494,6 +484,8 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits /[$]LINENO/= ' <$as_myself | sed ' + t clear + :clear s/[$]LINENO.*/&-/ t lineno b @@ -542,7 +534,6 @@ esac 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 @@ -554,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 @@ -581,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=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -871,7 +864,7 @@ 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=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1084,7 +1077,7 @@ 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=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1100,7 +1093,7 @@ 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=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1130,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" ;; *=*) @@ -1139,7 +1132,7 @@ 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 ;; @@ -1189,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 @@ -1257,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)` @@ -1285,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]... @@ -1299,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 @@ -1311,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. @@ -1364,7 +1357,7 @@ Some influential environment variables: CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory -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 . @@ -1432,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.71 +generated by GNU Autoconf 2.72 -Copyright (C) 2021 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 @@ -1473,11 +1466,12 @@ printf "%s\n" "$ac_try_echo"; } >&5 } && test -s conftest.$ac_objext then : ac_retval=0 -else $as_nop - printf "%s\n" "$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 @@ -1496,8 +1490,8 @@ printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> @@ -1505,10 +1499,12 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$3=yes" -else $as_nop - eval "$3=no" +else case e in #( + e) eval "$3=no" ;; +esac fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +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 @@ -1548,11 +1544,12 @@ printf "%s\n" "$ac_try_echo"; } >&5 } then : ac_retval=0 -else $as_nop - printf "%s\n" "$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 @@ -1594,12 +1591,13 @@ printf "%s\n" "$ac_try_echo"; } >&5 test $ac_status = 0; }; } then : ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: program exited with status $ac_status" >&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 @@ -1631,7 +1629,7 @@ 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.71. Invocation command line was +generated by GNU Autoconf 2.72. Invocation command line was $ $0$ac_configure_args_raw @@ -1877,10 +1875,10 @@ esac printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ - || { { 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: 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 @@ -1916,9 +1914,7 @@ 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 (p, i) - char **p; - int i; +static char *e (char **p, int i) { return p[i]; } @@ -1932,6 +1928,21 @@ static char *f (char * (*g) (char **, int), char **p, ...) 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 @@ -1959,16 +1970,19 @@ 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? +/* 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 @@ -2018,7 +2032,6 @@ typedef const char *ccp; static inline int test_restrict (ccp restrict text) { - // See if C++-style comments work. // Iterate through items via the restricted pointer. // Also check for declarations in for loops. for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) @@ -2084,6 +2097,8 @@ ac_c_conftest_c99_main=' 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 = { @@ -2105,7 +2120,7 @@ ac_c_conftest_c99_main=' # Test code for whether the C compiler supports C11 (global declarations) ac_c_conftest_c11_globals=' -// Does the compiler advertise C11 conformance? +/* Does the compiler advertise C11 conformance? */ #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L # error "Compiler does not advertise C11 conformance" #endif @@ -2297,8 +2312,9 @@ IFS=$as_save_IFS if $as_found then : -else $as_nop - as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 +else case e in #( + e) as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 ;; +esac fi @@ -2326,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,) - { 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;} + { 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;} + { 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=: ;; ,);; *) @@ -2340,18 +2356,18 @@ printf "%s\n" "$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 - { 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;} + { 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;} + { 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;} + { 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. @@ -2367,11 +2383,11 @@ printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} fi done if $ac_cache_corrupted; then - { 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: 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' + as_fn_error $? "run '${MAKE-make} distclean' and/or 'rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## @@ -2402,15 +2418,16 @@ printf %s "checking build system type... " >&6; } if test ${ac_cv_build+y} then : printf %s "(cached) " >&6 -else $as_nop - ac_build_alias=$build_alias +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"` 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 - + ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 printf "%s\n" "$ac_cv_build" >&6; } @@ -2437,14 +2454,15 @@ printf %s "checking host system type... " >&6; } if test ${ac_cv_host+y} then : printf %s "(cached) " >&6 -else $as_nop - if test "x$host_alias" = x; then +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 fi - + ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 printf "%s\n" "$ac_cv_host" >&6; } @@ -2552,8 +2570,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 -else $as_nop - if test -n "$CC"; then +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 @@ -2575,7 +2593,8 @@ done done IFS=$as_save_IFS -fi +fi ;; +esac fi CC=$ac_cv_prog_CC if test -n "$CC"; then @@ -2597,8 +2616,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_CC"; then +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 @@ -2620,7 +2639,8 @@ 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 @@ -2655,8 +2675,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 -else $as_nop - if test -n "$CC"; then +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 @@ -2678,7 +2698,8 @@ done done IFS=$as_save_IFS -fi +fi ;; +esac fi CC=$ac_cv_prog_CC if test -n "$CC"; then @@ -2700,8 +2721,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 -else $as_nop - if test -n "$CC"; then +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 @@ -2740,7 +2761,8 @@ if test $ac_prog_rejected = yes; then 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 @@ -2764,8 +2786,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 -else $as_nop - if test -n "$CC"; then +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 @@ -2787,7 +2809,8 @@ done done IFS=$as_save_IFS -fi +fi ;; +esac fi CC=$ac_cv_prog_CC if test -n "$CC"; then @@ -2813,8 +2836,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_CC"; then +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 @@ -2836,7 +2859,8 @@ 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 @@ -2874,8 +2898,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 -else $as_nop - if test -n "$CC"; then +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 @@ -2897,7 +2921,8 @@ done done IFS=$as_save_IFS -fi +fi ;; +esac fi CC=$ac_cv_prog_CC if test -n "$CC"; then @@ -2919,8 +2944,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_CC"; then +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 @@ -2942,7 +2967,8 @@ 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 @@ -2971,10 +2997,10 @@ 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;} +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. printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 @@ -3046,8 +3072,8 @@ printf "%s\n" "$ac_try_echo"; } >&5 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' + # 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. @@ -3067,7 +3093,7 @@ do 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. @@ -3078,8 +3104,9 @@ do done test "$ac_cv_exeext" = no && ac_cv_exeext= -else $as_nop - ac_file='' +else case e in #( + e) ac_file='' ;; +esac fi if test -z "$ac_file" then : @@ -3088,13 +3115,14 @@ printf "%s\n" "no" >&6; } printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&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: 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_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "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 { 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; } @@ -3118,10 +3146,10 @@ printf "%s\n" "$ac_try_echo"; } >&5 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'. + # 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 @@ -3131,11 +3159,12 @@ for ac_file in conftest.exe conftest conftest.*; do * ) break;; esac done -else $as_nop - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 @@ -3151,6 +3180,8 @@ int main (void) { FILE *f = fopen ("conftest.out", "w"); + if (!f) + return 1; return ferror (f) || fclose (f) != 0; ; @@ -3190,26 +3221,27 @@ printf "%s\n" "$ac_try_echo"; } >&5 if test "$cross_compiling" = maybe; then cross_compiling=yes else - { { 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: 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; } +If you meant to cross compile, use '--host'. +See 'config.log' for more details" "$LINENO" 5; } fi fi fi { 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 { 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 $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -3241,16 +3273,18 @@ then : break;; esac done -else $as_nop - printf "%s\n" "$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 -{ { 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: 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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 printf "%s\n" "$ac_cv_objext" >&6; } @@ -3261,8 +3295,8 @@ printf %s "checking whether the compiler supports GNU C... " >&6; } if test ${ac_cv_c_compiler_gnu+y} then : printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -3279,12 +3313,14 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_compiler_gnu=yes -else $as_nop - ac_compiler_gnu=no +else case e in #( + e) ac_compiler_gnu=no ;; +esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu - + ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } @@ -3302,8 +3338,8 @@ printf %s "checking whether $CC accepts -g... " >&6; } if test ${ac_cv_prog_cc_g+y} then : printf %s "(cached) " >&6 -else $as_nop - ac_save_c_werror_flag=$ac_c_werror_flag +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" @@ -3321,8 +3357,8 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes -else $as_nop - CFLAGS="" +else case e in #( + e) CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -3337,8 +3373,8 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : -else $as_nop - 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. */ @@ -3355,12 +3391,15 @@ if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam 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.beam 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.beam conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag + ac_c_werror_flag=$ac_save_c_werror_flag ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 printf "%s\n" "$ac_cv_prog_cc_g" >&6; } @@ -3387,8 +3426,8 @@ 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 $as_nop - ac_cv_prog_cc_c11=no +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. */ @@ -3405,25 +3444,28 @@ 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 $as_nop - if test "x$ac_cv_prog_cc_c11" = x +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 $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +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" + CC="$CC $ac_cv_prog_cc_c11" ;; +esac fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 - ac_prog_cc_stdc=c11 + ac_prog_cc_stdc=c11 ;; +esac fi fi if test x$ac_prog_cc_stdc = xno @@ -3433,8 +3475,8 @@ 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 $as_nop - ac_cv_prog_cc_c99=no +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. */ @@ -3451,25 +3493,28 @@ 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 +CC=$ac_save_CC ;; +esac fi 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 $as_nop - if test "x$ac_cv_prog_cc_c99" = x +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 $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +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" + CC="$CC $ac_cv_prog_cc_c99" ;; +esac fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 - ac_prog_cc_stdc=c99 + ac_prog_cc_stdc=c99 ;; +esac fi fi if test x$ac_prog_cc_stdc = xno @@ -3479,8 +3524,8 @@ 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 $as_nop - ac_cv_prog_cc_c89=no +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. */ @@ -3497,25 +3542,28 @@ 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 +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 $as_nop - if test "x$ac_cv_prog_cc_c89" = x +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 $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +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" + CC="$CC $ac_cv_prog_cc_c89" ;; +esac fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 - ac_prog_cc_stdc=c89 + ac_prog_cc_stdc=c89 ;; +esac fi fi @@ -3610,8 +3658,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_path_JAVA_PROG+y} then : printf %s "(cached) " >&6 -else $as_nop - case $JAVA_PROG in +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. ;; @@ -3636,6 +3684,7 @@ done IFS=$as_save_IFS ;; +esac ;; esac fi JAVA_PROG=$ac_cv_path_JAVA_PROG @@ -3661,8 +3710,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_path_JAVAC+y} then : printf %s "(cached) " >&6 -else $as_nop - case $JAVAC in +else case e in #( + e) case $JAVAC in [\\/]* | ?:[\\/]*) ac_cv_path_JAVAC="$JAVAC" # Let the user override the test with a path. ;; @@ -3687,6 +3736,7 @@ done IFS=$as_save_IFS ;; +esac ;; esac fi JAVAC=$ac_cv_path_JAVAC @@ -3711,8 +3761,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_path_JAVAH+y} then : printf %s "(cached) " >&6 -else $as_nop - case $JAVAH in +else case e in #( + e) case $JAVAH in [\\/]* | ?:[\\/]*) ac_cv_path_JAVAH="$JAVAH" # Let the user override the test with a path. ;; @@ -3737,6 +3787,7 @@ done IFS=$as_save_IFS ;; +esac ;; esac fi JAVAH=$ac_cv_path_JAVAH @@ -3761,8 +3812,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_path_JAR+y} then : printf %s "(cached) " >&6 -else $as_nop - case $JAR in +else case e in #( + e) case $JAR in [\\/]* | ?:[\\/]*) ac_cv_path_JAR="$JAR" # Let the user override the test with a path. ;; @@ -3787,6 +3838,7 @@ done IFS=$as_save_IFS ;; +esac ;; esac fi JAR=$ac_cv_path_JAR @@ -3992,20 +4044,21 @@ 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=`printf "%s\n" "ac_cv_file_${JAVA_HOME}/include/jni.h" | $as_tr_sh` +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 $as_nop - test "$cross_compiling" = yes && +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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 @@ -4013,21 +4066,22 @@ printf "%s\n" "$ac_res" >&6; } if eval test \"x\$"$as_ac_File"\" = x"yes" then : JNI_H="${JAVA_HOME}/include" -else $as_nop - as_ac_File=`printf "%s\n" "ac_cv_file_${JAVA_HOME}/jni.h" | $as_tr_sh` +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 $as_nop - test "$cross_compiling" = yes && +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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 @@ -4035,21 +4089,22 @@ printf "%s\n" "$ac_res" >&6; } if eval test \"x\$"$as_ac_File"\" = x"yes" then : JNI_H="${JAVA_HOME}" -else $as_nop - as_ac_File=`printf "%s\n" "ac_cv_file_${JAVA_HOME}/../include/jni.h" | $as_tr_sh` +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 $as_nop - test "$cross_compiling" = yes && +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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 @@ -4057,18 +4112,21 @@ printf "%s\n" "$ac_res" >&6; } if eval test \"x\$"$as_ac_File"\" = x"yes" then : JNI_H="${JAVA_HOME}/../include" -else $as_nop - as_fn_error $? "Cannot compile JNI programs, check jri/config.log for details. +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 @@ -4081,20 +4139,21 @@ 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=`printf "%s\n" "ac_cv_file_${JNI_H}/$mddir/jni_md.h" | $as_tr_sh` +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 $as_nop - test "$cross_compiling" = yes && +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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 @@ -4141,8 +4200,9 @@ 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 $as_nop - as_fn_error $? "Cannot compile a simple JNI program. See config.log for details." "$LINENO" 5 +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 conftest.beam \ conftest$ac_exeext conftest.$ac_ext @@ -4154,12 +4214,12 @@ export LD_LIBRARY_PATH 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;} + { { 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 $as_nop - 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 @@ -4173,13 +4233,15 @@ 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 $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +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 + 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 @@ -4187,12 +4249,12 @@ fi 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;} + { { 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 $as_nop - 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 @@ -4205,11 +4267,13 @@ 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 $as_nop - 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 +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 @@ -4275,9 +4339,10 @@ then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } DEFFLAGS="${DEFFLAGS} -DRIF_HAS_CSTACK" -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "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.beam conftest.$ac_ext @@ -4298,9 +4363,10 @@ then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } DEFFLAGS="${DEFFLAGS} -DRIF_HAS_RSIGHAND" -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "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.beam conftest.$ac_ext @@ -4344,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 @@ -4375,14 +4441,14 @@ printf "%s\n" "$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 | @@ -4472,7 +4538,6 @@ cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -as_nop=: if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh @@ -4481,12 +4546,13 @@ then : # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else $as_nop - 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 @@ -4558,7 +4624,7 @@ 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 @@ -4587,7 +4653,6 @@ as_fn_error () } # as_fn_error - # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -4627,11 +4692,12 @@ then : { eval $1+=\$2 }' -else $as_nop - as_fn_append () +else case e in #( + e) as_fn_append () { eval $1=\$$1\$2 - } + } ;; +esac fi # as_fn_append # as_fn_arith ARG... @@ -4645,11 +4711,12 @@ then : { as_val=$(( $* )) }' -else $as_nop - as_fn_arith () +else case e in #( + e) as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` - } + } ;; +esac fi # as_fn_arith @@ -4732,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 @@ -4815,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 @@ -4834,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.71. Invocation command line was +generated by GNU Autoconf 2.72. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -4865,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. @@ -4898,10 +4967,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ JRI config.status 0.3 -configured by $0, generated by GNU Autoconf 2.71, +configured by $0, generated by GNU Autoconf 2.72, with options \\"\$ac_cs_config\\" -Copyright (C) 2021 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." @@ -4960,8 +5029,8 @@ do 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 ) printf "%s\n" "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ @@ -4969,8 +5038,8 @@ Try \`$0 --help' for more information.";; 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 ;; @@ -5023,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 @@ -5042,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= @@ -5066,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 @@ -5224,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. @@ -5340,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 @@ -5362,19 +5431,19 @@ 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=`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 '` @@ -5498,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 @@ -5527,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"; } && - { printf "%s\n" "$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 -printf "%s\n" "$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" diff --git a/src/jri/src/config.h.in b/src/jri/src/config.h.in index d1c4686..cdedc70 100644 --- a/src/jri/src/config.h.in +++ b/src/jri/src/config.h.in @@ -51,7 +51,7 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION -/* Define to 1 if all of the C90 standard headers exist (not just the ones +/* 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 From fcf28eceac80fb149c3737e1e911605f25b8042d Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 19 Jan 2026 13:46:19 +1300 Subject: [PATCH 220/240] update NEWS --- NEWS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/NEWS b/NEWS index 47ed0b2..8754ad9 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,13 @@ NEWS/ChangeLog for rJava -------------------------- +1.0-15 + o Avoid access issues in Java 17+ (thanks to Valentino Pinna!) + when using reflection API: J() (#345) + + o Move JRI sources to src/jri to avoid the top level warning. + + 1.0-14 2026-01-19 o Minor changes to replace EXTPTR macros with API calls globally. From 0d054a4622051baf3894c78a8975abc17de33116 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Mon, 19 Jan 2026 14:57:52 +1300 Subject: [PATCH 221/240] autodetect lowest possible target --- src/java/Makefile | 5 ++++- src/jri/REngine | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) 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/jri/REngine b/src/jri/REngine index d6f5c84..4455acb 160000 --- a/src/jri/REngine +++ b/src/jri/REngine @@ -1 +1 @@ -Subproject commit d6f5c84bd7af9a2207673d495cad9b82d459effb +Subproject commit 4455acba2ec859bc3e51df285e54ff40d823271d From 30dae398aeacfe4f90579d4012faf75090888032 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 11 Mar 2026 15:01:42 +1300 Subject: [PATCH 222/240] Revert d03e1ca (#345) which causes rev.dep. failure --- src/java/RJavaTools.java | 158 +++++++++------------------------------ 1 file changed, 34 insertions(+), 124 deletions(-) diff --git a/src/java/RJavaTools.java b/src/java/RJavaTools.java index 6890b56..3b52c85 100644 --- a/src/java/RJavaTools.java +++ b/src/java/RJavaTools.java @@ -17,20 +17,13 @@ // You should have received a copy of the GNU General Public License // along with rJava. If not, see . -import java.lang.invoke.MethodHandles; -import java.lang.invoke.MethodHandles.Lookup; -import java.lang.reflect.AccessibleObject; -import java.lang.reflect.Constructor ; -import java.lang.reflect.Executable; +import java.lang.reflect.Method ; import java.lang.reflect.Field ; +import java.lang.reflect.Constructor ; import java.lang.reflect.InvocationTargetException ; -import java.lang.reflect.Member ; -import java.lang.reflect.Method ; import java.lang.reflect.Modifier ; -import java.util.ArrayDeque; -import java.util.Arrays; -import java.util.Deque; -import java.util.HashSet; +import java.lang.reflect.Member ; + import java.util.Vector ; @@ -42,23 +35,6 @@ */ public class RJavaTools { - /* dual path for Java 8 and 9+ to check actual accessibility */ - private static final Method CAN_ACCESS; - /* Java 8 accessibility checker */ - private static final Lookup LOOKUP = MethodHandles.publicLookup(); - - static { - Method canAccess = null; - try { - canAccess = Executable.class.getMethod("canAccess", Object.class); - } catch (NoSuchMethodException e) { - // Java 8- - } catch (SecurityException e) { - // Java 8- - } - CAN_ACCESS = canAccess; - } - /** * Returns an inner class of the class with the given simple name * @@ -352,97 +328,7 @@ public static boolean hasMethod(Object o, String name) { return classHasMethod(o.getClass(), name, false); } - /** - * Tests whether a given executable is accessible without actually calling {@link AccessibleObject#isAccessible()} which is unreliable. - * - * @param executable the given method/constructor - * @param o the target object - * @return true if the method can be accessed from RJavaTools - */ - public static boolean canAccess(Executable executable, Object o){ - try { - if (CAN_ACCESS != null) { - /* Java 9+ path */ - return (boolean) (Boolean) CAN_ACCESS.invoke(executable, o); - } else { - /* Java 8 path */ - if (executable instanceof Method) - LOOKUP.unreflect((Method) executable); - else - LOOKUP.unreflectConstructor((Constructor) executable); - return true; - } - } catch (Exception e) { - return false; - } - } - /** - * Resolves a bridge method to the override one - * @param bridgeMethod the potentially bridge method - * @return a method that isn't a bridge method - */ - public static Method resolveBridge(Method bridgeMethod) { - // accounts for bridge methods which may have slightly different parameters - Method best = null; - if (bridgeMethod.isBridge()) { - Class[] bridgeParams = bridgeMethod.getParameterTypes(); - // look for non-bridge methods in the same class that accepts wider parameters - nextMethod: - for (Method method: bridgeMethod.getDeclaringClass().getDeclaredMethods()) { - if (!method.isBridge() && !method.isSynthetic() && method.getName().equals(bridgeMethod.getName()) - && method.getParameterCount() == bridgeMethod.getParameterCount()) { - Class[] testParams = method.getParameterTypes(); - // Bridge params should be supertypes of target params (erasure widening). - for (int i = 0; i < testParams.length; i++) { - if (!testParams[i].isAssignableFrom(bridgeParams[i])) continue nextMethod; - } - if (bridgeMethod.getReturnType().isAssignableFrom(method.getReturnType()) && (best == null || isMoreSpecific(method, best))) best = method; - } - } - } - - return best == null ? bridgeMethod : best; - } - - /** - * Finds a mathod that accepts the given instance and is accessible from RJavaTools class. - *

Avoids calling isAccessible/setAccessible that fails on Java 17+ - * - * @param method The most specific, possibly non-accessible, method - * @param target the instance upon which the method is being invoked (null for static) - * @return - */ - public static Method findAccessible(Method method, Object target) { - if (canAccess(method, target)) return method; - - Deque> supers = new ArrayDeque>(); - HashSet> visited = new HashSet>(); - supers.add(target.getClass()); - - while (!supers.isEmpty()) { - Class c = supers.pop(); - if (visited.add(c)) { - Method superMethod; - try { - // first update the method to be non-bridge - method = resolveBridge(method); - superMethod = c.getMethod(method.getName(), method.getParameterTypes()); - /* if an accessible executable is found stop here */ - if (canAccess(superMethod, target)) return superMethod; - if (!c.isInterface() && !c.isArray()) supers.add(c.getSuperclass()); - if (!c.isArray()) supers.addAll(Arrays.asList(c.getInterfaces())); - } catch (NoSuchMethodException e1) { - /* executable not found in current class (and any of its ancestors) */ - } catch (SecurityException e1) { - /* executable not found in current class (and any of its ancestors) */ - } - } - } - - /* No accessible executable found, fail later on invoke/newInstance */ - return method; - } /** * Object creator. Find the best constructor based on the parameter classes @@ -457,12 +343,25 @@ public static Object newInstance( Class o_clazz, Object[] args, Class[] clazzes Constructor cons = getConstructor( o_clazz, clazzes, is_null ); + /* enforcing accessibility (workaround for bug 128) */ + boolean access = cons.isAccessible(); + 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{ o = cons.newInstance( args ) ; } catch( InvocationTargetException e){ /* the target exception is much more useful than the reflection wrapper */ - throw e.getCause() ; + throw e.getTargetException() ; + } finally{ + if (!access) + cons.setAccessible( access ); } return o; } @@ -478,21 +377,32 @@ static boolean[] arg_is_null(Object[] args){ /** * Invoke a method of a given class - *

First the appropriate method is resolved by getMethod. - *

Then, if the method is not accessible, tries to find an accessible equivalent. - *

Finally it invokes the method + *

First the appropriate method is resolved by getMethod and + * then invokes the method */ public static Object invokeMethod( Class o_clazz, Object o, String name, Object[] args, Class[] clazzes) throws Throwable { Method m = getMethod( o_clazz, name, clazzes, arg_is_null(args) ); - m = findAccessible(m, o); + + /* enforcing accessibility (workaround for bug 128) */ + 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{ out = m.invoke( o, args ) ; } catch( InvocationTargetException e){ /* the target exception is much more useful than the reflection wrapper */ - throw e.getCause() ; + throw e.getTargetException() ; + } finally{ + if (!access) + m.setAccessible( access ); } return out ; } From 0565536bab7061ab430812bc5f0af4c6acff8a57 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 11 Mar 2026 15:03:33 +1300 Subject: [PATCH 223/240] remove #345 from NEWS since it had to be reverted --- NEWS | 3 --- 1 file changed, 3 deletions(-) diff --git a/NEWS b/NEWS index 8754ad9..112c9ed 100644 --- a/NEWS +++ b/NEWS @@ -2,9 +2,6 @@ -------------------------- 1.0-15 - o Avoid access issues in Java 17+ (thanks to Valentino Pinna!) - when using reflection API: J() (#345) - o Move JRI sources to src/jri to avoid the top level warning. From 99383ecbef3cac2f263ea3b818843a0f37024874 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 6 Mar 2026 16:01:33 +1300 Subject: [PATCH 224/240] add compatibility re-maps for EXTPTR_PTR and ENCLOS in JRI --- src/jri/src/Rengine.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/jri/src/Rengine.c b/src/jri/src/Rengine.c index 4a053de..d298bdd 100644 --- a/src/jri/src/Rengine.c +++ b/src/jri/src/Rengine.c @@ -21,6 +21,22 @@ 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(2,5,0)) +#ifdef ENCLOS +#undef ENCLOS +#endif +#define ENCLOS(X) R_ParentEnv(X) +#endif + #include "Rcallbacks.h" #include "Rinit.h" #include "globals.h" From ea984515fc6bbb7e8abbe909f745e91d2545128c Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 11 Mar 2026 15:11:41 +1300 Subject: [PATCH 225/240] update NEWS --- NEWS | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 112c9ed..4e92a6c 100644 --- a/NEWS +++ b/NEWS @@ -1,9 +1,11 @@ NEWS/ChangeLog for rJava -------------------------- -1.0-15 +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. From dba309d9fdcb8c6a27688c214a811c7d54fed09c Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Sun, 15 Mar 2026 14:52:56 +1300 Subject: [PATCH 226/240] bump version to 1.0-16 --- src/rJava.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rJava.h b/src/rJava.h index c0ca8c7..d342050 100644 --- a/src/rJava.h +++ b/src/rJava.h @@ -1,7 +1,7 @@ #ifndef __RJAVA_H__ #define __RJAVA_H__ -#define RJAVA_VER 0x01000f /* rJava v1.0-15 */ +#define RJAVA_VER 0x010010 /* rJava v1.0-16 */ /* important changes between versions: 3.0 - adds compiler From c8f3318388e71ea3c99f989d00eb2c2f47c736d4 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Sun, 15 Mar 2026 14:53:18 +1300 Subject: [PATCH 227/240] use https in URL --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 1b7c4aa..df0cdf2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -7,6 +7,6 @@ Authors@R: person("Simon", "Urbanek", role=c("aut","cre","cph"), email="Simon.Ur 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: LGPL-2.1 -URL: http://www.rforge.net/rJava/ +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 From 4ed4e8d47317513a27a2a24aec12e53b5fdaa2a0 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Sun, 15 Mar 2026 15:26:32 +1300 Subject: [PATCH 228/240] use R_getAttribNames() in R 4.6.0+ --- src/jri/src/Rengine.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/jri/src/Rengine.c b/src/jri/src/Rengine.c index d298bdd..ada9015 100644 --- a/src/jri/src/Rengine.c +++ b/src/jri/src/Rengine.c @@ -410,19 +410,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) { @@ -434,6 +448,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_rosuda_JRI_Rengine_rniGetAttrNames ac++; ah = CDR(ah); } +#endif return sa; } @@ -444,8 +459,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 From 3ce684e34c3d9ec97b614d973c751f03ddd1cdbf Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Sun, 15 Mar 2026 16:05:20 +1300 Subject: [PATCH 229/240] work-around removal of R_lsInternal() --- src/jri/src/Rengine.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/jri/src/Rengine.c b/src/jri/src/Rengine.c index ada9015..225a919 100644 --- a/src/jri/src/Rengine.c +++ b/src/jri/src/Rengine.c @@ -232,7 +232,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 @@ -247,7 +247,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 From 1350753e4538c2f51da5b69ad6008ba11aeccf30 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Sun, 15 Mar 2026 16:08:49 +1300 Subject: [PATCH 230/240] protext exps during rniEval for safety --- src/jri/Rengine.java | 11 ++++++++++- src/jri/src/Rengine.c | 9 +++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/jri/Rengine.java b/src/jri/Rengine.java index cce2d83..f84fe41 100644 --- a/src/jri/Rengine.java +++ b/src/jri/Rengine.java @@ -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; } diff --git a/src/jri/src/Rengine.c b/src/jri/src/Rengine.c index 225a919..ebee989 100644 --- a/src/jri/src/Rengine.c +++ b/src/jri/src/Rengine.c @@ -156,6 +156,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); @@ -163,12 +164,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; From 5b2ce656a648b91b5e41dca33481669af337b6ca Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Sun, 15 Mar 2026 16:12:14 +1300 Subject: [PATCH 231/240] update NEWS --- NEWS | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/NEWS b/NEWS index 4e92a6c..3ab7d16 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,12 @@ NEWS/ChangeLog for rJava -------------------------- +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. From 204df24b62f9b42e1fc5b87fc7461d4a2e69bce6 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 20 Mar 2026 08:22:45 +1300 Subject: [PATCH 232/240] bump to 1.0-17 --- src/rJava.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rJava.h b/src/rJava.h index d342050..d0d988b 100644 --- a/src/rJava.h +++ b/src/rJava.h @@ -1,7 +1,7 @@ #ifndef __RJAVA_H__ #define __RJAVA_H__ -#define RJAVA_VER 0x010010 /* rJava v1.0-16 */ +#define RJAVA_VER 0x010011 /* rJava v1.0-17 */ /* important changes between versions: 3.0 - adds compiler From 29949648d625883cbbf5ddb332f39bfae5b16e84 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 20 Mar 2026 08:24:33 +1300 Subject: [PATCH 233/240] replace Rf_findVar with R_getVar in R 4.5.0+ --- src/jri/src/Rengine.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/jri/src/Rengine.c b/src/jri/src/Rengine.c index ebee989..44771f3 100644 --- a/src/jri/src/Rengine.c +++ b/src/jri/src/Rengine.c @@ -37,6 +37,13 @@ LibExtern int R_interrupts_pending; #define ENCLOS(X) R_ParentEnv(X) #endif +#if (R_VERSION >= R_Version(4,5,0)) +#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" From ccac308ab0750041682464ce4e0b9c37e07f95b2 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Fri, 20 Mar 2026 08:25:23 +1300 Subject: [PATCH 234/240] update NEWS --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index 3ab7d16..62b10ce 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,10 @@ NEWS/ChangeLog for rJava -------------------------- +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 From 80a6a802e0b19480f3f8f0bc159ca01a8e3cd305 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 8 Apr 2026 08:12:54 +1200 Subject: [PATCH 235/240] bump version to 1.0-18 --- src/rJava.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rJava.h b/src/rJava.h index d0d988b..40f846f 100644 --- a/src/rJava.h +++ b/src/rJava.h @@ -1,7 +1,7 @@ #ifndef __RJAVA_H__ #define __RJAVA_H__ -#define RJAVA_VER 0x010011 /* rJava v1.0-17 */ +#define RJAVA_VER 0x010012 /* rJava v1.0-18 */ /* important changes between versions: 3.0 - adds compiler From 6268a75c3dce26625f3f12c2db8808553d2a7421 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 8 Apr 2026 10:29:05 +1200 Subject: [PATCH 236/240] fix regression breaking JRI in R <4.5.0 --- src/jri/src/Rengine.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/jri/src/Rengine.c b/src/jri/src/Rengine.c index 44771f3..f58f8f5 100644 --- a/src/jri/src/Rengine.c +++ b/src/jri/src/Rengine.c @@ -30,14 +30,12 @@ LibExtern int R_interrupts_pending; #define EXTPTR_PTR(X) R_ExternalPtrAddr(X) #endif -#if (R_VERSION >= R_Version(2,5,0)) +#if (R_VERSION >= R_Version(4,5,0)) #ifdef ENCLOS #undef ENCLOS #endif #define ENCLOS(X) R_ParentEnv(X) -#endif -#if (R_VERSION >= R_Version(4,5,0)) #ifdef Rf_findVar #undef Rf_findVar #endif From 54bfb36263a886236747fb098a79e0883b0475be Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 8 Apr 2026 10:30:57 +1200 Subject: [PATCH 237/240] use decls from Rinterface.h and Rembedded.h when available --- src/jri/src/Rdecl.h | 19 ++++++++++++++++--- src/jri/src/Rinit.c | 5 +---- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/jri/src/Rdecl.h b/src/jri/src/Rdecl.h index 48910f2..a21ddef 100644 --- a/src/jri/src/Rdecl.h +++ b/src/jri/src/Rdecl.h @@ -2,11 +2,24 @@ #define __RDECL_H__ /* declarations from R internals or other include files */ -/* last update: R 2.4.0 */ +/* 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 */ + +/* this one is still left over */ void Rf_checkArity(SEXP, SEXP); /* include/Defn.h */ -int Rf_initialize_R(int ac, char **av); /* include/Rembedded.h */ -#endif +#endif /* __RDECL_H__ */ diff --git a/src/jri/src/Rinit.c b/src/jri/src/Rinit.c index b6f75c9..05d815d 100644 --- a/src/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; From 1325462636d32e75a477c5bba95c9c6a7cc050da Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 8 Apr 2026 10:33:48 +1200 Subject: [PATCH 238/240] update NEWS --- NEWS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/NEWS b/NEWS index 62b10ce..25d3751 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,13 @@ 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 From 5b7810efecca8f96177c19a52a26e511af75e626 Mon Sep 17 00:00:00 2001 From: Simon Urbanek Date: Wed, 8 Apr 2026 11:22:28 +1200 Subject: [PATCH 239/240] move ancient checkArity decl from Rdecl.h to Rcallbacks.c --- src/jri/src/Rcallbacks.c | 3 ++- src/jri/src/Rdecl.h | 3 --- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/jri/src/Rcallbacks.c b/src/jri/src/Rcallbacks.c index 12f2597..1337e22 100644 --- a/src/jri/src/Rcallbacks.c +++ b/src/jri/src/Rcallbacks.c @@ -26,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 diff --git a/src/jri/src/Rdecl.h b/src/jri/src/Rdecl.h index a21ddef..abe9913 100644 --- a/src/jri/src/Rdecl.h +++ b/src/jri/src/Rdecl.h @@ -19,7 +19,4 @@ 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 */ -/* this one is still left over */ -void Rf_checkArity(SEXP, SEXP); /* include/Defn.h */ - #endif /* __RDECL_H__ */ From ac746bfa63268847c24494f8854f49d45324891d Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Sun, 8 Feb 2026 13:18:03 -0800 Subject: [PATCH 240/240] Drop ancient check for utils::.DollarNames --- NAMESPACE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)