Patch: embedded target fixes
Anthony Green
green@cygnus.com
Wed Feb 6 07:28:00 GMT 2002
There are four changes in here.
The DISABLE_MAIN_ARGS change was approved in November, but not checked
in.
The AC_COMPILE_CHECK_SIZEOF patch is new. This is what I did in
libffi as well.
The HAVE_OPENDIR patch is new, and is required for newlib targets.
The last change (ECOS) fixes something that broke when this part of
the configure file was rewritten.
Ok?
2002-02-06 Anthony Green <green@redhat.com>
* include/config.h.in: Rebuilt.
* acconfig.h: Add DISABLE_MAIN_ARGS.
* prims.cc (_Jv_RunMain): Use DISABLE_MAIN_ARGS.
* configure: Rebuilt.
* configure.in: Add --disable-main-args option. Test for
opendir function. Replace AC_CHECK_SIZEOF with
AC_COMPILE_CHECK_SIZEOF. Determine ECOS from PROCESS, which
is set in configure.host.
* java/io/natFile.cc (performList): Check HAVE_OPENDIR.
* aclocal.m4: Rebuilt.
* acinclude.m4: Add AC_COMPILE_CHECK_SIZEOF.
Index: acinclude.m4
===================================================================
RCS file: /cvs/gcc/gcc/libjava/acinclude.m4,v
retrieving revision 1.15
diff -c -r1.15 acinclude.m4
*** acinclude.m4 2002/02/01 21:16:05 1.15
--- acinclude.m4 2002/02/06 14:55:23
***************
*** 1,3 ****
--- 1,29 ----
+ AC_DEFUN([AC_COMPILE_CHECK_SIZEOF],
+ [changequote(<<, >>)dnl
+ dnl The name to #define.
+ define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
+ dnl The cache variable name.
+ define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl
+ changequote([, ])dnl
+ AC_MSG_CHECKING(size of $1)
+ AC_CACHE_VAL(AC_CV_NAME,
+ [for ac_size in 4 8 1 2 16 12 $2 ; do # List sizes in rough order of prevalence.
+ AC_TRY_COMPILE([#include "confdefs.h"
+ #include <sys/types.h>
+ $2
+ ], [switch (0) case 0: case (sizeof ($1) == $ac_size):;], AC_CV_NAME=$ac_size)
+ if test x$AC_CV_NAME != x ; then break; fi
+ done
+ ])
+ if test x$AC_CV_NAME = x ; then
+ AC_MSG_ERROR([cannot determine a size for $1])
+ fi
+ AC_MSG_RESULT($AC_CV_NAME)
+ AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The number of bytes in type $1])
+ undefine([AC_TYPE_NAME])dnl
+ undefine([AC_CV_NAME])dnl
+ ])
+
AC_DEFUN(LIBGCJ_CONFIGURE,
[
dnl Default to --enable-multilib
Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/libjava/configure.in,v
retrieving revision 1.109
diff -c -r1.109 configure.in
*** configure.in 2002/02/06 01:46:44 1.109
--- configure.in 2002/02/06 15:10:39
***************
*** 63,68 ****
--- 63,76 ----
AC_DEFINE(DISABLE_GETENV_PROPERTIES)
fi
+ dnl Whether we should use arguments to main()
+ if test -z "$enable_main_args"; then
+ enable_main_args=${enable_main_args_default-yes}
+ fi
+ if test "$enable_main_args" = no; then
+ AC_DEFINE(DISABLE_MAIN_ARGS)
+ fi
+
dnl Should we use hashtable-based synchronization?
dnl Currently works only for Linux X86/ia64
***************
*** 187,193 ****
dnl I/O routines.
dnl FIXME: this should not be a local option but a global target
dnl system; at present there is no eCos target.
! TARGET_ECOS="no"
AC_ARG_WITH(ecos,
[ --with-ecos enable runtime eCos target support],
TARGET_ECOS="$with_ecos"
--- 195,201 ----
dnl I/O routines.
dnl FIXME: this should not be a local option but a global target
dnl system; at present there is no eCos target.
! TARGET_ECOS=${PROCESS-"no"}
AC_ARG_WITH(ecos,
[ --with-ecos enable runtime eCos target support],
TARGET_ECOS="$with_ecos"
***************
*** 463,469 ****
fi
NATIVE=no
else
! AC_CHECK_FUNCS(strerror ioctl select fstat open fsync sleep)
AC_CHECK_FUNCS(gmtime_r localtime_r readdir_r getpwuid_r getcwd)
AC_CHECK_FUNCS(access stat mkdir rename rmdir unlink realpath utime chmod)
AC_CHECK_FUNCS(nl_langinfo setlocale)
--- 471,477 ----
fi
NATIVE=no
else
! AC_CHECK_FUNCS(strerror ioctl select fstat open fsync sleep opendir)
AC_CHECK_FUNCS(gmtime_r localtime_r readdir_r getpwuid_r getcwd)
AC_CHECK_FUNCS(access stat mkdir rename rmdir unlink realpath utime chmod)
AC_CHECK_FUNCS(nl_langinfo setlocale)
***************
*** 708,714 ****
CPPFLAGS=$GCJ_SAVE_CPPFLAGS
dnl FIXME: cross compilation
! AC_CHECK_SIZEOF(void *)
ZLIBS=
ZDEPS=
--- 716,722 ----
CPPFLAGS=$GCJ_SAVE_CPPFLAGS
dnl FIXME: cross compilation
! AC_COMPILE_CHECK_SIZEOF(void *)
ZLIBS=
ZDEPS=
Index: include/config.h.in
===================================================================
RCS file: /cvs/gcc/gcc/libjava/include/config.h.in,v
retrieving revision 1.36
diff -c -r1.36 config.h.in
*** config.h.in 2002/01/16 04:21:32 1.36
--- config.h.in 2002/02/06 15:09:25
***************
*** 151,156 ****
--- 151,159 ----
getenv("GCJ_PROPERTIES"). */
#undef DISABLE_GETENV_PROPERTIES
+ /* Define if we should ignore arguments to main(). */
+ #undef DISABLE_MAIN_ARGS
+
/* Define if you have /proc/self/exe */
#undef HAVE_PROC_SELF_EXE
***************
*** 158,164 ****
/* Define if you have dladdr() */
#undef HAVE_DLADDR
-
/* Define if getuid() and friends are missing. */
#undef NO_GETUID
--- 161,166 ----
***************
*** 171,179 ****
/* Define if you are using JVMPI. */
#undef ENABLE_JVMPI
- /* The number of bytes in a void *. */
- #undef SIZEOF_VOID_P
-
/* Define if you have the access function. */
#undef HAVE_ACCESS
--- 173,178 ----
***************
*** 252,257 ****
--- 251,259 ----
/* Define if you have the open function. */
#undef HAVE_OPEN
+ /* Define if you have the opendir function. */
+ #undef HAVE_OPENDIR
+
/* Define if you have the pipe function. */
#undef HAVE_PIPE
***************
*** 407,412 ****
--- 409,417 ----
/* Define if dlopen is available */
#undef HAVE_DLOPEN
+
+ /* The number of bytes in type void * */
+ #undef SIZEOF_VOID_P
/* Define if <inttypes.h> is available */
#undef HAVE_INTTYPES_H
Index: acconfig.h
===================================================================
RCS file: /cvs/gcc/gcc/libjava/acconfig.h,v
retrieving revision 1.21
diff -c -r1.21 acconfig.h
*** acconfig.h 2001/08/01 17:52:59 1.21
--- acconfig.h 2002/02/06 14:55:23
***************
*** 123,128 ****
--- 123,131 ----
getenv("GCJ_PROPERTIES"). */
#undef DISABLE_GETENV_PROPERTIES
+ /* Define if we should ignore arguments to main(). */
+ #undef DISABLE_MAIN_ARGS
+
/* Define if using setjmp/longjmp exceptions. */
#undef SJLJ_EXCEPTIONS
Index: prims.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/prims.cc,v
retrieving revision 1.68
diff -c -r1.68 prims.cc
*** prims.cc 2002/02/02 04:37:54 1.68
--- prims.cc 2002/02/06 14:55:29
***************
*** 1001,1013 ****
java::lang::Runtime *runtime = NULL;
#ifdef HAVE_PROC_SELF_EXE
char exec_name[20];
sprintf (exec_name, "/proc/%d/exe", getpid ());
_Jv_ThisExecutable (exec_name);
#else
_Jv_ThisExecutable (argv[0]);
! #endif
try
{
--- 1001,1018 ----
java::lang::Runtime *runtime = NULL;
+
+ #ifdef DISABLE_MAIN_ARGS
+ _Jv_ThisExecutable ("[Embedded App]");
+ #else
#ifdef HAVE_PROC_SELF_EXE
char exec_name[20];
sprintf (exec_name, "/proc/%d/exe", getpid ());
_Jv_ThisExecutable (exec_name);
#else
_Jv_ThisExecutable (argv[0]);
! #endif /* HAVE_PROC_SELF_EXE */
! #endif /* DISABLE_MAIN_ARGS */
try
{
***************
*** 1021,1027 ****
--- 1026,1036 ----
// for `main'; that way it will be set up if `main' is a JNI method.
runtime = java::lang::Runtime::getRuntime ();
+ #ifdef DISABLE_MAIN_ARGS
+ arg_vec = JvConvertArgv (0, 0);
+ #else
arg_vec = JvConvertArgv (argc - 1, argv + 1);
+ #endif
using namespace gnu::gcj::runtime;
if (klass)
Index: java/io/natFile.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/io/natFile.cc,v
retrieving revision 1.14
diff -c -r1.14 natFile.cc
*** natFile.cc 2002/02/02 07:45:50 1.14
--- natFile.cc 2002/02/06 14:55:30
***************
*** 131,137 ****
java::io::FileFilter *fileFilter,
java::lang::Class *result_type)
{
! #ifdef HAVE_DIRENT_H
char buf[MAXPATHLEN];
jsize total = JvGetStringUTFRegion (path, 0, path->length(), buf);
buf[total] = '\0';
--- 131,139 ----
java::io::FileFilter *fileFilter,
java::lang::Class *result_type)
{
! /* Some systems have dirent.h, but no directory reading functions like
! opendir. */
! #if defined(HAVE_DIRENT_H) && defined(HAVE_OPENDIR)
char buf[MAXPATHLEN];
jsize total = JvGetStringUTFRegion (path, 0, path->length(), buf);
buf[total] = '\0';
***************
*** 178,186 ****
jobjectArray ret = JvNewObjectArray (list->size(), result_type, NULL);
list->toArray(ret);
return ret;
! #else /* HAVE_DIRENT_H */
return NULL;
! #endif /* HAVE_DIRENT_H */
}
jboolean
--- 180,188 ----
jobjectArray ret = JvNewObjectArray (list->size(), result_type, NULL);
list->toArray(ret);
return ret;
! #else /* HAVE_DIRENT_H && HAVE_OPENDIR */
return NULL;
! #endif /* HAVE_DIRENT_H && HAVE_OPENDIR */
}
jboolean
--
Anthony Green Red Hat
Sunnyvale, California
More information about the Java-patches
mailing list