For PR libgcj/5103:

* include/jvm.h (__GCJ_JNI_IMPL__): Define.
	* include/config.h.in: Rebuilt.
	* configure: Rebuilt.
	* configure.in: Define JV_HAVE_INTTYPES_H if inttypes.h found.
	Added comment for HAVE_DLOPEN to avoid autoheader error.
	* gcj/libgcj-config.h.in (JV_HAVE_INTTYPES_H): Added.
	* include/jni.h: Include <gcj/libgcj-config.h>.  Don't include
	CNI-specific headers if we are compiling ordinary JNI code with a
	C++ compiler.  Include <inttypes.h> and JNIWeakRef.h when
	appropriate.
	* jni.cc: Don't include JNIWeakRef.h.

From-SVN: r48082
This commit is contained in:
Tom Tromey 2001-12-16 22:33:02 +00:00 committed by Tom Tromey
parent 68940f3f3c
commit 04942eac9b
8 changed files with 493 additions and 316 deletions

View File

@ -1,5 +1,19 @@
2001-12-16 Tom Tromey <tromey@redhat.com>
For PR libgcj/5103:
* include/jvm.h (__GCJ_JNI_IMPL__): Define.
* include/config.h.in: Rebuilt.
* configure: Rebuilt.
* configure.in: Define JV_HAVE_INTTYPES_H if inttypes.h found.
Added comment for HAVE_DLOPEN to avoid autoheader error.
* gcj/libgcj-config.h.in (JV_HAVE_INTTYPES_H): Added.
* include/jni.h: Include <gcj/libgcj-config.h>. Don't include
CNI-specific headers if we are compiling ordinary JNI code with a
C++ compiler. Include <inttypes.h> and JNIWeakRef.h when
appropriate.
* jni.cc: Don't include JNIWeakRef.h.
(__GCJ_JNI_IMPL__): Don't define.
For PR java/5088:
* java/lang/natClassLoader.cc (_Jv_InitNewClassFields): New
function.

651
libjava/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -567,7 +567,8 @@ else
AC_MSG_ERROR([memcpy is required])
fi
AC_CHECK_LIB(dl, dlopen, [AC_DEFINE(HAVE_DLOPEN)])
AC_CHECK_LIB(dl, dlopen, [
AC_DEFINE(HAVE_DLOPEN, 1, [Define if dlopen is available])])
# Some library-finding code we stole from Tcl.
#--------------------------------------------------------------------
@ -727,10 +728,14 @@ CFLAGS="$save_CFLAGS"
dnl We check for sys/filio.h because Solaris 2.5 defines FIONREAD there.
dnl On that system, sys/ioctl.h will not include sys/filio.h unless
dnl BSD_COMP is defined; just including sys/filio.h is simpler.
AC_CHECK_HEADERS(unistd.h bstring.h sys/time.h sys/types.h fcntl.h sys/ioctl.h sys/filio.h sys/stat.h sys/select.h sys/socket.h netinet/in.h arpa/inet.h netdb.h pwd.h sys/config.h inttypes.h stdint.h langinfo.h locale.h)
AC_CHECK_HEADERS(unistd.h bstring.h sys/time.h sys/types.h fcntl.h sys/ioctl.h sys/filio.h sys/stat.h sys/select.h sys/socket.h netinet/in.h arpa/inet.h netdb.h pwd.h sys/config.h stdint.h langinfo.h locale.h)
dnl We avoid AC_HEADER_DIRENT since we really only care about dirent.h
dnl for now. If you change this, you also must update natFile.cc.
AC_CHECK_HEADERS(dirent.h)
AC_CHECK_HEADERS(inttypes.h, [
AC_DEFINE(HAVE_INTTYPES_H, 1, [Define if <inttypes.h> is available])
AC_DEFINE(JV_HAVE_INTTYPES_H, 1, [Define if <inttypes.h> is available])
])
AC_CHECK_TYPE([ssize_t], [int])

View File

@ -3,3 +3,6 @@
/* Define if hash synchronization is in use. */
#undef JV_HASH_SYNCHRONIZATION
/* Define if <inttypes.h> is available. */
#undef JV_HAVE_INTTYPES_H

View File

@ -148,8 +148,6 @@
/* Define if you have dladdr() */
#undef HAVE_DLADDR
/* Define if yo have dlopen(). */
#undef HAVE_DLOPEN
/* Define if getuid() and friends are missing. */
#undef NO_GETUID
@ -394,3 +392,12 @@
/* Define if struct hostent_data is defined in netdb.h */
#undef HAVE_STRUCT_HOSTENT_DATA
/* Define if dlopen is available */
#undef HAVE_DLOPEN
/* Define if <inttypes.h> is available */
#undef HAVE_INTTYPES_H
/* Define if <inttypes.h> is available */
#undef JV_HAVE_INTTYPES_H

View File

@ -14,14 +14,21 @@ details. */
#ifndef __GCJ_JNI_H__
#define __GCJ_JNI_H__
#include <gcj/libgcj-config.h>
#include <stdarg.h>
#define _Jv_va_list va_list
#ifdef __cplusplus
#ifdef __GCJ_JNI_IMPL__
/* This is wrong, because it pollutes the name-space too much! */
/* If __GCJ_JNI_IMPL__ is defined, then we assume that we're building
libgcj itself, and we include headers which taint the namespace
more than is acceptable for the ordinary JNI user. */
#include <gcj/javaprims.h>
#include <gcj/array.h>
#include <gnu/gcj/runtime/JNIWeakRef.h>
typedef gnu::gcj::runtime::JNIWeakRef *jweak;
typedef struct _Jv_JNIEnv JNIEnv;
typedef struct _Jv_JavaVM JavaVM;
@ -29,8 +36,12 @@ typedef struct _Jv_JavaVM JavaVM;
#define JNI_TRUE true
#define JNI_FALSE false
#else /* __cplusplus */
#else /* __GCJ_JNI_IMPL__ */
# ifdef __GNUC__
/* If we're using gcc, we can use a platform-independent scheme to get
the right integer types. */
typedef int jbyte __attribute__((__mode__(__QI__)));
typedef int jshort __attribute__((__mode__(__HI__)));
typedef int jint __attribute__((__mode__(__SI__)));
@ -41,11 +52,85 @@ typedef float jfloat;
typedef double jdouble;
typedef jint jsize;
# else /* __GNUC__ */
# ifdef JV_HAVE_INTTYPES_H
/* If <inttypes.h> is available, we use it. */
# include <inttypes.h>
typedef int8_t jbyte;
typedef int16_t jshort;
typedef int32_t jint;
typedef int64_t jlong;
typedef float jfloat;
typedef double jdouble;
typedef jint jsize;
typedef int8_t jboolean;
typedef uint16_t jchar;
# else /* JV_HAVE_INTTYPES_H */
/* For now, we require either gcc or <inttypes.h>. If we did more
work at configure time we could get around this, but right now it
doesn't seem worth it. */
# error jni.h not ported to this platform
# endif /* JV_HAVE_INTTYPES_H */
# endif /* __GNUC__ */
# ifdef __cplusplus
/* Define dummy classes and then define the JNI types as pointers. */
struct __jobject {};
struct __jclass : __jobject {};
struct __jstring : __jobject {};
struct __jthrowable : __jobject {};
struct __jweak : __jobject {};
struct __jarray : __jobject {};
struct __jobjectArray : __jarray {};
struct __jbyteArray : __jarray {};
struct __jshortArray : __jarray {};
struct __jintArray : __jarray {};
struct __jlongArray : __jarray {};
struct __jbooleanArray : __jarray {};
struct __jcharArray : __jarray {};
struct __jfloatArray : __jarray {};
struct __jdoubleArray : __jarray {};
typedef __jobject *jobject;
typedef __jclass *jclass;
typedef __jstring *jstring;
typedef __jthrowable *jthrowable;
typedef __jweak *jweak;
typedef __jarray *jarray;
typedef __jobjectArray *jobjectArray;
typedef __jbyteArray *jbyteArray;
typedef __jshortArray *jshortArray;
typedef __jintArray *jintArray;
typedef __jlongArray *jlongArray;
typedef __jbooleanArray *jbooleanArray;
typedef __jcharArray *jcharArray;
typedef __jfloatArray *jfloatArray;
typedef __jdoubleArray *jdoubleArray;
#define JNI_TRUE true
#define JNI_FALSE false
typedef struct _Jv_JNIEnv JNIEnv;
typedef struct _Jv_JavaVM JavaVM;
# else /* __cplusplus */
/* For C, simply define the class types as generic pointers. */
typedef void *jobject;
typedef jobject jclass;
typedef jobject jstring;
typedef jobject jarray;
typedef jobject jthrowable;
typedef jobject jweak;
typedef jobject jarray;
typedef jobject jobjectArray;
typedef jobject jbyteArray;
typedef jobject jshortArray;
@ -56,20 +141,19 @@ typedef jobject jcharArray;
typedef jobject jfloatArray;
typedef jobject jdoubleArray;
/* Dummy defines. */
typedef void *jfieldID;
typedef void *jmethodID;
#define JNI_TRUE 1
#define JNI_FALSE 0
typedef const struct JNINativeInterface *JNIEnv;
typedef const struct JNIInvokeInterface *JavaVM;
#define JNI_TRUE 1
#define JNI_FALSE 0
# endif /* __cplusplus */
#endif /* __cplusplus */
/* Dummy defines. */
typedef void *jfieldID;
typedef void *jmethodID;
/* FIXME: this is wrong. */
typedef jobject jweak;
#endif /* __GCJ_JNI_IMPL__ */
/* Version numbers. */
#define JNI_VERSION_1_1 0x00010001
@ -558,7 +642,7 @@ public:
/* The method table. */
struct JNINativeInterface *p;
/* FIXME: this is really ugly. */
/* This is ugly, but we must live with it. */
#ifndef __GCJ_JNI_IMPL__
private:
#endif

View File

@ -11,6 +11,12 @@ details. */
#ifndef __JAVA_JVM_H__
#define __JAVA_JVM_H__
// Define this before including jni.h.
// jni.h is included by jvmpi.h, which might be included. We define
// this unconditionally because it is convenient and it lets other
// files include jni.h without difficulty.
#define __GCJ_JNI_IMPL__
#include <gcj/javaprims.h>
#include <java-assert.h>
@ -358,6 +364,7 @@ bool _Jv_VerifyIdentifier (_Jv_Utf8Const *);
bool _Jv_ClassNameSamePackage (_Jv_Utf8Const *name1, _Jv_Utf8Const *name2);
#ifdef ENABLE_JVMPI
#include "jvmpi.h"
extern void (*_Jv_JVMPI_Notify_OBJECT_ALLOC) (JVMPI_Event *event);

View File

@ -13,9 +13,6 @@ details. */
#include <stddef.h>
#include <string.h>
// Define this before including jni.h.
#define __GCJ_JNI_IMPL__
#include <gcj/cni.h>
#include <jvm.h>
#include <java-assert.h>
@ -41,7 +38,6 @@ details. */
#include <java/lang/Integer.h>
#include <java/lang/ThreadGroup.h>
#include <java/lang/Thread.h>
#include <gnu/gcj/runtime/JNIWeakRef.h>
#include <gcj/method.h>
#include <gcj/field.h>