Commit 2c60951b authored by tromey's avatar tromey
Browse files

Initial revision

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@26263 138bc75d-0d04-0410-961f-82ee72b054a4
parent 1135eed2
This diff is collapsed.
This diff is collapsed.
March 2, 1999
The libgcj library is licensed under the terms of the GNU Library
General Public License.
You should have received a copy of the GNU Library General Public
License along with libjava; see the file COPYING.LIB. If not, write
to the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
This diff is collapsed.
This diff is collapsed.
/* Name of this package. */
#undef PACKAGE
/* Version number of this package. */
#undef VERSION
/* Define this if you want runtime debugging enabled. */
#undef DEBUG
/* Define if using POSIX threads that have the mutexattr functions. */
#undef HAVE_PTHREAD_MUTEXATTR_INIT
/* Define this if you prefer size over speed for java.lang.Character. */
#undef COMPACT_CHARACTER
/* Define if you have memcpy. */
#undef HAVE_MEMCPY
/* Define if you have memmove. */
#undef HAVE_MEMMOVE
/* Define if you have strerror. */
#undef HAVE_STRERROR
/* Define if you have fsync. */
#undef HAVE_FSYNC
/* Define if you have sleep. */
#undef HAVE_SLEEP
/* Define if you have __int32_t and __uint32_t. */
#undef HAVE_INT32_DEFINED
/* Define if you're running eCos. */
#undef ECOS
/* */
#undef HAVE_LOCALTIME
/* */
#undef HAVE_MKTIME
/* Define if using POSIX threads on Linux. */
#undef LINUX_THREADS
/* Define if you have the `ctime_r' function. */
#undef HAVE_CTIME_R
/* Define if you have the `gmtime_r' function. */
#undef HAVE_GMTIME_R
/* Define if you have the `localtime_r' function. */
#undef HAVE_LOCALTIME_R
/* Define if inet6 structures are defined in netinet/in.h. */
#undef HAVE_INET6
/* Define it socklen_t typedef is in sys/socket.h. */
#undef HAVE_SOCKLEN_T
/* Define if Boehm GC in use. */
#undef HAVE_BOEHM_GC
/* Define if gethostname is declared in <unistd.h>. */
#undef HAVE_GETHOSTNAME_DECL
/* Define if gethostbyname_r returns `int'. */
#undef GETHOSTBYNAME_R_RETURNS_INT
/* Define if gethostbyaddr_r returns `int'. */
#undef GETHOSTBYADDR_R_RETURNS_INT
/* Define if struct tm has tm_gmtoff field. */
#undef STRUCT_TM_HAS_GMTOFF
/* Define if global `timezone' exists. */
#undef HAVE_TIMEZONE
/* Define if you have the appropriate function. */
#undef HAVE_ACCESS
#undef HAVE_STAT
#undef HAVE_MKDIR
#undef HAVE_RENAME
#undef HAVE_RMDIR
#undef HAVE_UNLINK
#undef HAVE_REALPATH
#undef HAVE_READDIR_R
#undef HAVE_GETHOSTBYNAME_R
#undef HAVE_GETHOSTBYADDR_R
# FIXME: We temporarily define our own version of AC_PROG_CC. This is
# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
# are probably using a cross compiler, which will not be able to fully
# link an executable. This should really be fixed in autoconf
# itself.
AC_DEFUN(LIBGCJ_CONFIGURE,
[
dnl Default to --enable-multilib
AC_ARG_ENABLE(multilib,
[ --enable-multilib build many library versions (default)],
[case "${enableval}" in
yes) multilib=yes ;;
no) multilib=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
esac], [multilib=yes])dnl
dnl We may get other options which we dont document:
dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
if test "[$]{srcdir}" = "."; then
if test "[$]{with_target_subdir}" != "."; then
libgcj_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
else
libgcj_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
fi
else
libgcj_basedir="[$]{srcdir}/$1"
fi
AC_SUBST(libgcj_basedir)
AC_CANONICAL_HOST
dnl Still use "libjava" here to placate dejagnu.
AM_INIT_AUTOMAKE(libjava, 0.0.7)
# FIXME: We temporarily define our own version of AC_PROG_CC. This is
# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
# are probably using a cross compiler, which will not be able to fully
# link an executable. This should really be fixed in autoconf
# itself.
AC_DEFUN(LIB_AC_PROG_CC,
[AC_BEFORE([$0], [AC_PROG_CPP])dnl
AC_CHECK_PROG(CC, gcc, gcc)
if test -z "$CC"; then
AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
fi
AC_PROG_CC_GNU
if test $ac_cv_prog_gcc = yes; then
GCC=yes
dnl Check whether -g works, even if CFLAGS is set, in case the package
dnl plays around with CFLAGS (such as to build both debugging and
dnl normal versions of a library), tasteless as that idea is.
ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
AC_PROG_CC_G
if test "$ac_test_CFLAGS" = set; then
CFLAGS="$ac_save_CFLAGS"
elif test $ac_cv_prog_cc_g = yes; then
CFLAGS="-g -O2"
else
CFLAGS="-O2"
fi
else
GCC=
test "${CFLAGS+set}" = set || CFLAGS="-g"
fi
])
LIB_AC_PROG_CC
# Likewise for AC_PROG_CXX.
AC_DEFUN(LIB_AC_PROG_CXX,
[AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
test -z "$CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
AC_PROG_CXX_GNU
if test $ac_cv_prog_gxx = yes; then
GXX=yes
dnl Check whether -g works, even if CXXFLAGS is set, in case the package
dnl plays around with CXXFLAGS (such as to build both debugging and
dnl normal versions of a library), tasteless as that idea is.
ac_test_CXXFLAGS="${CXXFLAGS+set}"
ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS=
AC_PROG_CXX_G
if test "$ac_test_CXXFLAGS" = set; then
CXXFLAGS="$ac_save_CXXFLAGS"
elif test $ac_cv_prog_cxx_g = yes; then
CXXFLAGS="-g -O2"
else
CXXFLAGS="-O2"
fi
else
GXX=
test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
fi
])
LIB_AC_PROG_CXX
# AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD). If we dont
# run it explicitly here, it will be run implicitly before
# LIBGCJ_CONFIGURE, which doesn't work because that means that it will
# be run before AC_CANONICAL_HOST.
AC_CANONICAL_BUILD
AC_CHECK_TOOL(AS, as)
AC_CHECK_TOOL(AR, ar)
AC_CHECK_TOOL(RANLIB, ranlib, :)
AC_PROG_INSTALL
AM_MAINTAINER_MODE
# We need AC_EXEEXT to keep automake happy in cygnus mode. However,
# at least currently, we never actually build a program, so we never
# need to use $(EXEEXT). Moreover, the test for EXEEXT normally
# fails, because we are probably configuring with a cross compiler
# which cant create executables. So we include AC_EXEEXT to keep
# automake happy, but we dont execute it, since we dont care about
# the result.
if false; then
AC_EXEEXT
fi
# configure.host sets the following important variables
# libgcj_cflags - host specific C compiler flags
# libgcj_cxxflags - host specific C++ compiler flags
# libgcj_javaflags - host specific Java compiler flags
libgcj_cflags=
libgcj_cxxflags=
libgcj_javaflags=
. [$]{libgcj_basedir}/configure.host
case [$]{libgcj_basedir} in
/* | [A-Za-z]:[/\\]*) libgcj_flagbasedir=[$]{libgcj_basedir} ;;
*) libgcj_flagbasedir='[$](top_builddir)/'[$]{libgcj_basedir} ;;
esac
LIBGCJ_CFLAGS="[$]{libgcj_cflags}"
LIBGCJ_CXXFLAGS="[$]{libgcj_cxxflags}"
LIBGCJ_JAVAFLAGS="[$]{libgcj_javaflags}"
AC_SUBST(LIBGCJ_CFLAGS)
AC_SUBST(LIBGCJ_CXXFLAGS)
AC_SUBST(LIBGCJ_JAVAFLAGS)
])dnl
dnl aclocal.m4 generated automatically by aclocal 1.4
dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
dnl PARTICULAR PURPOSE.
# FIXME: We temporarily define our own version of AC_PROG_CC. This is
# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
# are probably using a cross compiler, which will not be able to fully
# link an executable. This should really be fixed in autoconf
# itself.
AC_DEFUN(LIBGCJ_CONFIGURE,
[
dnl Default to --enable-multilib
AC_ARG_ENABLE(multilib,
[ --enable-multilib build many library versions (default)],
[case "${enableval}" in
yes) multilib=yes ;;
no) multilib=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
esac], [multilib=yes])dnl
dnl We may get other options which we dont document:
dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
if test "[$]{srcdir}" = "."; then
if test "[$]{with_target_subdir}" != "."; then
libgcj_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
else
libgcj_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
fi
else
libgcj_basedir="[$]{srcdir}/$1"
fi
AC_SUBST(libgcj_basedir)
AC_CANONICAL_HOST
dnl Still use "libjava" here to placate dejagnu.
AM_INIT_AUTOMAKE(libjava, 0.0.7)
# FIXME: We temporarily define our own version of AC_PROG_CC. This is
# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
# are probably using a cross compiler, which will not be able to fully
# link an executable. This should really be fixed in autoconf
# itself.
AC_DEFUN(LIB_AC_PROG_CC,
[AC_BEFORE([$0], [AC_PROG_CPP])dnl
AC_CHECK_PROG(CC, gcc, gcc)
if test -z "$CC"; then
AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
fi
AC_PROG_CC_GNU
if test $ac_cv_prog_gcc = yes; then
GCC=yes
dnl Check whether -g works, even if CFLAGS is set, in case the package
dnl plays around with CFLAGS (such as to build both debugging and
dnl normal versions of a library), tasteless as that idea is.
ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
AC_PROG_CC_G
if test "$ac_test_CFLAGS" = set; then
CFLAGS="$ac_save_CFLAGS"
elif test $ac_cv_prog_cc_g = yes; then
CFLAGS="-g -O2"
else
CFLAGS="-O2"
fi
else
GCC=
test "${CFLAGS+set}" = set || CFLAGS="-g"
fi
])
LIB_AC_PROG_CC
# Likewise for AC_PROG_CXX.
AC_DEFUN(LIB_AC_PROG_CXX,
[AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
test -z "$CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
AC_PROG_CXX_GNU
if test $ac_cv_prog_gxx = yes; then
GXX=yes
dnl Check whether -g works, even if CXXFLAGS is set, in case the package
dnl plays around with CXXFLAGS (such as to build both debugging and
dnl normal versions of a library), tasteless as that idea is.
ac_test_CXXFLAGS="${CXXFLAGS+set}"
ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS=
AC_PROG_CXX_G
if test "$ac_test_CXXFLAGS" = set; then
CXXFLAGS="$ac_save_CXXFLAGS"
elif test $ac_cv_prog_cxx_g = yes; then
CXXFLAGS="-g -O2"
else
CXXFLAGS="-O2"
fi
else
GXX=
test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
fi
])
LIB_AC_PROG_CXX
# AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD). If we dont
# run it explicitly here, it will be run implicitly before
# LIBGCJ_CONFIGURE, which doesn't work because that means that it will
# be run before AC_CANONICAL_HOST.
AC_CANONICAL_BUILD
AC_CHECK_TOOL(AS, as)
AC_CHECK_TOOL(AR, ar)
AC_CHECK_TOOL(RANLIB, ranlib, :)
AC_PROG_INSTALL
AM_MAINTAINER_MODE
# We need AC_EXEEXT to keep automake happy in cygnus mode. However,
# at least currently, we never actually build a program, so we never
# need to use $(EXEEXT). Moreover, the test for EXEEXT normally
# fails, because we are probably configuring with a cross compiler
# which cant create executables. So we include AC_EXEEXT to keep
# automake happy, but we dont execute it, since we dont care about
# the result.
if false; then
AC_EXEEXT
fi
# configure.host sets the following important variables
# libgcj_cflags - host specific C compiler flags
# libgcj_cxxflags - host specific C++ compiler flags
# libgcj_javaflags - host specific Java compiler flags
libgcj_cflags=
libgcj_cxxflags=
libgcj_javaflags=
. [$]{libgcj_basedir}/configure.host
case [$]{libgcj_basedir} in
/* | [A-Za-z]:[/\\]*) libgcj_flagbasedir=[$]{libgcj_basedir} ;;
*) libgcj_flagbasedir='[$](top_builddir)/'[$]{libgcj_basedir} ;;
esac
LIBGCJ_CFLAGS="[$]{libgcj_cflags}"
LIBGCJ_CXXFLAGS="[$]{libgcj_cxxflags}"
LIBGCJ_JAVAFLAGS="[$]{libgcj_javaflags}"
AC_SUBST(LIBGCJ_CFLAGS)
AC_SUBST(LIBGCJ_CXXFLAGS)
AC_SUBST(LIBGCJ_JAVAFLAGS)
])dnl
# Do all the work for Automake. This macro actually does too much --
# some checks are only needed if your package does certain things.
# But this isn't really a big deal.
# serial 1
dnl Usage:
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
AC_DEFUN(AM_INIT_AUTOMAKE,
[AC_REQUIRE([AC_PROG_INSTALL])
PACKAGE=[$1]
AC_SUBST(PACKAGE)
VERSION=[$2]
AC_SUBST(VERSION)
dnl test to see if srcdir already configured
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi
ifelse([$3],,
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
AC_REQUIRE([AM_SANITY_CHECK])
AC_REQUIRE([AC_ARG_PROGRAM])
dnl FIXME This is truly gross.
missing_dir=`cd $ac_aux_dir && pwd`
AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
AC_REQUIRE([AC_PROG_MAKE_SET])])
#
# Check to make sure that the build environment is sane.
#
AC_DEFUN(AM_SANITY_CHECK,
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
echo timestamp > conftestfile
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
if test "[$]*" = "X"; then
# -L didn't work.
set X `ls -t $srcdir/configure conftestfile`
fi
if test "[$]*" != "X $srcdir/configure conftestfile" \
&& test "[$]*" != "X conftestfile $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
test "[$]2" = conftestfile
)
then
# Ok.
:
else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
rm -f conftest*
AC_MSG_RESULT(yes)])
dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
dnl The program must properly implement --version.
AC_DEFUN(AM_MISSING_PROG,
[AC_MSG_CHECKING(for working $2)
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
if ($2 --version) < /dev/null > /dev/null 2>&1; then
$1=$2
AC_MSG_RESULT(found)
else
$1="$3/missing $2"
AC_MSG_RESULT(missing)
fi
AC_SUBST($1)])
# Add --enable-maintainer-mode option to configure.
# From Jim Meyering
# serial 1
AC_DEFUN(AM_MAINTAINER_MODE,
[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
dnl maintainer-mode is disabled by default
AC_ARG_ENABLE(maintainer-mode,
[ --enable-maintainer-mode enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer],
USE_MAINTAINER_MODE=$enableval,
USE_MAINTAINER_MODE=no)
AC_MSG_RESULT($USE_MAINTAINER_MODE)
AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
MAINT=$MAINTAINER_MODE_TRUE
AC_SUBST(MAINT)dnl
]
)
# Define a conditional.
AC_DEFUN(AM_CONDITIONAL,
[AC_SUBST($1_TRUE)
AC_SUBST($1_FALSE)
if $2; then
$1_TRUE=
$1_FALSE='#'
else
$1_TRUE='#'
$1_FALSE=
fi])
# Like AC_CONFIG_HEADER, but automatically create stamp file.
AC_DEFUN(AM_CONFIG_HEADER,
[AC_PREREQ([2.12])
AC_CONFIG_HEADER([$1])
dnl When config.status generates a header, we must update the stamp-h file.
dnl This file resides in the same directory as the config header
dnl that is generated. We must strip everything past the first ":",
dnl and everything past the last "/".
AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
<<am_indx=1
for am_file in <<$1>>; do
case " <<$>>CONFIG_HEADERS " in
*" <<$>>am_file "*<<)>>
echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
;;
esac
am_indx=`expr "<<$>>am_indx" + 1`
done<<>>dnl>>)
changequote([,]))])
// boehm.cc - interface between libjava and Boehm GC.
/* Copyright (C) 1998, 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
#include <config.h>
#include <stdio.h>
#include <cni.h>
#include <java/lang/Class.h>
#include <jvm.h>
#include <java-field.h>
// We need to include gc_priv.h. However, it tries to include
// config.h if it hasn't already been included. So we force the
// inclusion of the Boehm config.h.
extern "C"
{
#include <boehm-config.h>
#include <gc_priv.h>
#include <gc_mark.h>
// These aren't declared in any Boehm GC header.
void GC_finalize_all (void);
ptr_t GC_debug_generic_malloc (size_t size, int k, GC_EXTRA_PARAMS);
};
// FIXME: this should probably be defined in some GC header.
#ifdef GC_DEBUG
# define GC_GENERIC_MALLOC(Size, Type) \
GC_debug_generic_malloc (Size, Type, GC_EXTRAS)
#else
# define GC_GENERIC_MALLOC(Size, Type) GC_generic_malloc (Size, Type)
#endif
// We must check for plausibility ourselves.
#define MAYBE_MARK(Obj, Top, Limit, Source, Exit) \
if ((ptr_t) (Obj) >= GC_least_plausible_heap_addr \
&& (ptr_t) (Obj) <= GC_greatest_plausible_heap_addr) \
PUSH_CONTENTS (Obj, Top, Limit, Source, Exit)
#define ObjectClass _CL_Q34java4lang6Object
extern java::lang::Class ObjectClass;
#define ClassClass _CL_Q34java4lang5Class
extern java::lang::Class ClassClass;
// Nonzero if this module has been initialized.
static int initialized = 0;
// `kind' index used when allocating Java objects.
static int obj_kind_x;
// `kind' index used when allocating Java arrays.
static int array_kind_x;
// Freelist used for Java objects.
static ptr_t *obj_free_list;
// Freelist used for Java arrays.
static ptr_t *array_free_list;
// This is called by the GC during the mark phase. It marks a Java
// object. We use `void *' arguments and return, and not what the
// Boehm GC wants, to avoid pollution in our headers.
void *
_Jv_MarkObj (void *addr, void *msp, void *msl, void * /*env*/)
{
mse *mark_stack_ptr = (mse *) msp;
mse *mark_stack_limit = (mse *) msl;
jobject obj = (jobject) addr;
_Jv_VTable *dt = *(_Jv_VTable **) addr;
// We check this in case a GC occurs before the vtbl is set. FIXME:
// should use allocation lock while initializing object.
if (! dt)
return mark_stack_ptr;
jclass klass = dt->clas;
// Every object has a sync_info pointer.
word w = (word) obj->sync_info;
MAYBE_MARK (w, mark_stack_ptr, mark_stack_limit, obj, o1label);
// Mark the object's class.
w = (word) klass;
MAYBE_MARK (w, mark_stack_ptr, mark_stack_limit, obj, o2label);
if (klass == &ClassClass)
{
jclass c = (jclass) addr;
w = (word) c->next;
MAYBE_MARK (w, mark_stack_ptr, mark_stack_limit, c, c2label);
w = (word) c->name;
MAYBE_MARK (w, mark_stack_ptr, mark_stack_limit, c, c3label);
w = (word) c->superclass;
MAYBE_MARK (w, mark_stack_ptr, mark_stack_limit, c, c4label);
for (int i = 0; i < c->constants.size; ++i)
{
w = (word) c->constants.data[i];
MAYBE_MARK (w, mark_stack_ptr, mark_stack_limit, c, c5label);
}
// If the class is an array, then the methods field holds a
// pointer to the element class. If the class is primitive,
// then the methods field holds a pointer to the array class.
w = (word) c->methods;
MAYBE_MARK (w, mark_stack_ptr, mark_stack_limit, c, c6label);
if (! c->isArray() && ! c->isPrimitive())
{
// Scan each method in the cases where `methods' really
// points to a methods structure.
for (int i = 0; i < c->method_count; ++i)
{
w = (word) c->methods[i].name;
MAYBE_MARK (w, mark_stack_ptr, mark_stack_limit, c,
cm1label);
w = (word) c->methods[i].signature;
MAYBE_MARK (w, mark_stack_ptr, mark_stack_limit, c,
cm2label);
// FIXME: `ncode' entry?
}
}
// Mark all the fields.
w = (word) c->fields;
MAYBE_MARK (w, mark_stack_ptr, mark_stack_limit, c, c8label);
for (int i = 0; i < c->field_count; ++i)
{
#ifndef COMPACT_FIELDS
w = (word) c->fields[i].name;
MAYBE_MARK (w, mark_stack_ptr, mark_stack_limit, c, c8alabel);
#endif
w = (word) c->fields[i].type;
MAYBE_MARK (w, mark_stack_ptr, mark_stack_limit, c, c8blabel);
}
w = (word) c->vtable;
MAYBE_MARK (w, mark_stack_ptr, mark_stack_limit, c, c9label);
w = (word) c->interfaces;
MAYBE_MARK (w, mark_stack_ptr, mark_stack_limit, c, cAlabel);
for (int i = 0; i < c->interface_count; ++i)
{
w = (word) c->interfaces[i];
MAYBE_MARK (w, mark_stack_ptr, mark_stack_limit, c, cClabel);
}
w = (word) c->loader;
MAYBE_MARK (w, mark_stack_ptr, mark_stack_limit, c, cBlabel);
}
else
{
// NOTE: each class only holds information about the class
// itself. So we must do the marking for the entire inheritance
// tree in order to mark all fields. FIXME: what about
// interfaces? We skip Object here, because Object only has a
// sync_info, and we handled that earlier.
// Note: occasionally `klass' can be null. For instance, this
// can happen if a GC occurs between the point where an object
// is allocated and where the vtbl slot is set.
while (klass && klass != &ObjectClass)
{
jfieldID field = JvGetFirstInstanceField (klass);
jint max = JvNumInstanceFields (klass);
for (int i = 0; i < max; ++i)
{
if (JvFieldIsRef (field))
{
jobject val = JvGetObjectField (obj, field);
w = (word) val;
MAYBE_MARK (w, mark_stack_ptr, mark_stack_limit,
obj, elabel);
}
field = field->getNextInstanceField ();
}
klass = klass->getSuperclass();
}
}
return mark_stack_ptr;
}
// This is called by the GC during the mark phase. It marks a Java
// array (of objects). We use `void *' arguments and return, and not
// what the Boehm GC wants, to avoid pollution in our headers.
void *
_Jv_MarkArray (void *addr, void *msp, void *msl, void * /*env*/)
{
mse *mark_stack_ptr = (mse *) msp;
mse *mark_stack_limit = (mse *) msl;
jobjectArray array = (jobjectArray) addr;
_Jv_VTable *dt = *(_Jv_VTable **) addr;
// We check this in case a GC occurs before the vtbl is set. FIXME:
// should use allocation lock while initializing object.
if (! dt)
return mark_stack_ptr;
jclass klass = dt->clas;
// Every object has a sync_info pointer.
word w = (word) array->sync_info;
MAYBE_MARK (w, mark_stack_ptr, mark_stack_limit, array, e1label);
// Mark the object's class.
w = (word) klass;
MAYBE_MARK (w, mark_stack_ptr, mark_stack_limit, obj, o2label);
for (int i = 0; i < JvGetArrayLength (array); ++i)
{
jobject obj = elements (array)[i];
w = (word) obj;
MAYBE_MARK (w, mark_stack_ptr, mark_stack_limit, array, e2label);
}
return mark_stack_ptr;
}
// Allocate space for a new Java object. FIXME: this might be the
// wrong interface; we might prefer to pass in the object type as
// well. It isn't important for this collector, but it might be for
// other collectors.
void *
_Jv_AllocObj (jsize size)
{
return GC_GENERIC_MALLOC (size, obj_kind_x);
}
// Allocate space for a new Java array. FIXME: again, this might be
// the wrong interface.
void *
_Jv_AllocArray (jsize size)
{
return GC_GENERIC_MALLOC (size, array_kind_x);
}
// Allocate some space that is known to be pointer-free.
void *
_Jv_AllocBytes (jsize size)
{
return GC_GENERIC_MALLOC (size, PTRFREE);
}
static void
call_finalizer (GC_PTR obj, GC_PTR client_data)
{
_Jv_FinalizerFunc *fn = (_Jv_FinalizerFunc *) client_data;
jobject jobj = (jobject) obj;
(*fn) (jobj);
}
void
_Jv_RegisterFinalizer (void *object, _Jv_FinalizerFunc *meth)
{
GC_REGISTER_FINALIZER_NO_ORDER (object, call_finalizer, meth,
NULL, NULL);
}
void
_Jv_RunFinalizers (void)
{
GC_invoke_finalizers ();
}
void
_Jv_RunAllFinalizers (void)
{
GC_finalize_all ();
}
void
_Jv_RunGC (void)
{
GC_gcollect ();
}
long
_Jv_GCTotalMemory (void)
{
return GC_get_heap_size ();
}
/* Sum size of each hblk. */
static void
sum_blocks (struct hblk *h, word arg)
{
long *sump = (long *) arg;
/* This evil computation is from boehm-gc/checksums.c. */
hdr *hhdr = HDR (h);
int bytes = WORDS_TO_BYTES (hhdr->hb_sz);
bytes += HDR_BYTES + HBLKSIZE - 1;
bytes &= ~ (HBLKSIZE - 1);
*sump += bytes;
}
/* This turns out to be expensive to implement. For now, we don't
care. We could make it less expensive, perhaps, but that would
require some changes to the collector. */
long
_Jv_GCFreeMemory (void)
{
long sum = 0;
GC_apply_to_all_blocks (sum_blocks, &sum);
return sum;
}
void
_Jv_InitGC (void)
{
int proc;
DCL_LOCK_STATE;
DISABLE_SIGNALS ();
LOCK ();
if (initialized)
{
UNLOCK ();
ENABLE_SIGNALS ();
return;
}
initialized = 1;
// Set up state for marking and allocation of Java objects.
obj_free_list = (ptr_t *) GC_generic_malloc_inner ((MAXOBJSZ + 1)
* sizeof (ptr_t),
PTRFREE);
memset (obj_free_list, 0, (MAXOBJSZ + 1) * sizeof (ptr_t));
proc = GC_n_mark_procs++;
GC_mark_procs[proc] = (mark_proc) _Jv_MarkObj;
obj_kind_x = GC_n_kinds++;
GC_obj_kinds[obj_kind_x].ok_freelist = obj_free_list;
GC_obj_kinds[obj_kind_x].ok_reclaim_list = 0;
GC_obj_kinds[obj_kind_x].ok_descriptor = MAKE_PROC (proc, 0);
GC_obj_kinds[obj_kind_x].ok_relocate_descr = FALSE;
GC_obj_kinds[obj_kind_x].ok_init = TRUE;
// Set up state for marking and allocation of arrays of Java
// objects.
array_free_list = (ptr_t *) GC_generic_malloc_inner ((MAXOBJSZ + 1)
* sizeof (ptr_t),
PTRFREE);
memset (array_free_list, 0, (MAXOBJSZ + 1) * sizeof (ptr_t));
proc = GC_n_mark_procs++;
GC_mark_procs[proc] = (mark_proc) _Jv_MarkArray;
array_kind_x = GC_n_kinds++;
GC_obj_kinds[array_kind_x].ok_freelist = array_free_list;
GC_obj_kinds[array_kind_x].ok_reclaim_list = 0;
GC_obj_kinds[array_kind_x].ok_descriptor = MAKE_PROC (proc, 0);
GC_obj_kinds[array_kind_x].ok_relocate_descr = FALSE;
GC_obj_kinds[array_kind_x].ok_init = TRUE;
UNLOCK ();
ENABLE_SIGNALS ();
}
This diff is collapsed.
# classes.pl - A perl program to generate most of the contents of
# javaprims.h automatically.
# Copyright (C) 1998, 1999 Cygnus Solutions
#
# This file is part of libjava.
#
# This software is copyrighted work licensed under the terms of the
# Libjava License. Please consult the file "LIBJAVA_LICENSE" for
# details.
# Usage: cd <top-srcdir> ; perl classes.pl.
# Can also be run from the `include' directory; this lets us
# more easily insert the output into javaprims.h (which is where it goes).
use DirHandle;
if (-d 'java')
{
# Ok here.
}
elsif (-d '../java')
{
chdir ('..');
}
else
{
die "couldn't find java directory\n";
}
&scan ('java', 2);
exit 0;
sub scan
{
local ($dir, $indent) = @_;
local (@subdirs) = ();
local (@classes) = ();
local ($d) = new DirHandle $dir;
local (*JFILE);
local ($name);
if (defined $d)
{
while (defined ($name = $d->read))
{
next if $name eq 'CVS';
next if $name eq '.';
next if $name eq '..';
if ($dir eq 'java'
&& $name ne 'lang'
&& $name ne 'util'
&& $name ne 'io')
{
# We only generate decls for java.lang, java.io, and
# java.util.
next;
}
if (-d ($dir . '/' . $name))
{
push (@subdirs, $name);
next;
}
next unless $name =~ /\.java$/;
open (FILE, "< $dir/$name");
while (<FILE>)
{
# NOTE: we don't skip `/*' comments.
s,//.*$,,;
# For now assume that class names start with upper
# case letter.
next unless /(class|interface) ([A-Z][A-Za-z0-9]+)/;
push (@classes, $2);
}
close (FILE);
}
undef $d;
}
local ($spaces) = ' ' x $indent;
local ($classname);
($classname = $dir) =~ s/^.*\///;
print $spaces, "namespace ", $classname, "\n";
print $spaces, "{\n";
foreach (sort @classes)
{
print $spaces, " class ", $_, ";\n";
}
print "\n" if scalar @classes > 0 && scalar @subdirs > 0;
local ($first) = 1;
foreach (sort @subdirs)
{
print "\n" unless $first;
$first = 0;
&scan ("$dir/$_", $indent + 2);
}
print $spaces, "};\n";
}
This diff is collapsed.
# configure.host
# This shell script handles all host based configuration for libgcj.
# It sets various shell variables based on the the host and the
# configuration options. You can modify this shell script without
# needing to rerun autoconf.
# This shell script should be invoked as
# . configure.host
# If it encounters an error, it will exit with a message.
# It uses the following shell variables:
# host The configuration host
# host_cpu The configuration host CPU
# target_optspace --enable-target-optspace ("yes", "no", "")
# It sets the following shell variables:
# libgcj_cflags Special CFLAGS to use when building
# libgcj_cxxflags Special CXXFLAGS to use when building
# libgcj_javaflags Special JAVAFLAGS to use when building
libgcj_flags=
libgcj_cflags=
libgcj_cxxflags=
libgcj_javaflags=
case "${target_optspace}:${host}" in
yes:*)
libgcj_flags="${libgcj_flags} -Os"
;;
:m32r-* | :d10v-* | :d30v-*)
libgcj_flags="${libgcj_flags} -Os"
;;
no:* | :*)
# Nothing.
;;
esac
AM_RUNTESTFLAGS=
# Set any host dependent compiler flags.
# THIS TABLE IS SORTED. KEEP IT THAT WAY.
echo "$target"
case "${host}" in
mips-tx39-*|mipstx39-unknown-*)
libgcj_flags="${libgcj_flags} -G 0"
LDFLAGS="$LDFLAGS -Tjmr3904dram.ld"
AM_RUNTESTFLAGS="--target_board=jmr3904-sim"
;;
i686-*|i586-*)
libgcj_flags="${libgcj_flags} -ffloat-store"
;;
*)
;;
esac
libgcj_cflags="${libgcj_cflags} ${libgcj_flags}"
libgcj_cxxflags="${libgcj_cxxflags} ${libgcj_flags}"
libgcj_javaflags="${libgcj_javaflags} ${libgcj_flags}"
dnl Process this with autoconf to create configure
AC_INIT(java/lang/System.java)
dnl Can't be done in LIBGCJ_CONFIGURE because that confuses automake.
AC_CONFIG_AUX_DIR(..)
AC_CANONICAL_SYSTEM
dnl We use these options to decide which functions to include.
AC_ARG_WITH(target-subdir,
[ --with-target-subdir=SUBDIR Configuring in a subdirectory])
AC_ARG_WITH(cross-host,
[ --with-cross-host=HOST Configuring with a cross compiler])
LIBGCJ_CONFIGURE(.)
AM_CONFIG_HEADER(include/config.h)
if test -z "$with_target_subdir" || test "$with_target_subdir" = "."; then
COMPPATH=.
else
COMPPATH=..
fi
AC_SUBST(COMPPATH)
dnl The -no-testsuite modules omit the test subdir.
AM_CONDITIONAL(TESTSUBDIR, test -d $srcdir/testsuite)
dnl See whether the user prefers size or speed for Character.
dnl The default is size.
AC_ARG_ENABLE(fast-character,
[ --enable-fast-character Prefer speed over size for Character],
# Nothing
, AC_DEFINE(COMPACT_CHARACTER))
dnl See if the user has requested runtime debugging.
AC_ARG_ENABLE(libgcj-debug,
[ --enable-libgcj-debug Enable runtime debugging code],
if test "$enable_libgcj_debug" = yes; then
AC_DEFINE(DEBUG)
fi)
dnl If the target is an eCos system, use the appropriate eCos
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"
)
case "$TARGET_ECOS" in
no)
FILE_DESCRIPTOR=natFileDescriptorPosix.cc
;;
*)
FILE_DESCRIPTOR=natFileDescriptorEcos.cc
AC_DEFINE(ECOS)
;;
esac
AC_EGREP_HEADER(__uint32_t, sys/types.h, AC_DEFINE(HAVE_INT32_DEFINED))
AC_EGREP_HEADER(__uint32_t, sys/config.h, AC_DEFINE(HAVE_INT32_DEFINED))
dnl These may not be defined in a non-ANS conformant embedded system.
dnl FIXME: Should these case a runtime exception in that case?
AC_EGREP_HEADER(mktime, time.h, AC_DEFINE(HAVE_MKTIME))
AC_EGREP_HEADER(localtime, time.h, AC_DEFINE(HAVE_LOCALTIME))
dnl Create the subdirectory for natFileDescriptor.cc, or the attempt
dnl to create the link will fail.
test -d java || mkdir java
test -d java/io || mkdir java/io
AC_LINK_FILES(java/io/$FILE_DESCRIPTOR, java/io/natFileDescriptor.cc)
dnl Allow the GC to be disabled. Can be useful when debugging.
AC_MSG_CHECKING([for garbage collector to use])
AC_ARG_ENABLE(java-gc,
changequote(<<,>>)dnl
<< --enable-java-gc=TYPE choose garbage collector [boehm]>>,
changequote([,])
GC=$enableval,
GC=boehm)
GCLIBS=
GCINCS=
GCDEPS=
GCOBJS=
case "$GC" in
boehm)
AC_MSG_RESULT(boehm)
GCLIBS='-L$(top_builddir)/../boehm-gc -lgcjgc'
GCDEPS='$(top_builddir)/../boehm-gc/libgcjgc.a'
GCINCS='-I$(top_srcdir)/../boehm-gc -I$(top_builddir)/../boehm-gc'
dnl We also want to pick up some cpp flags required when including
dnl boehm-config.h. Yuck.
GCINCS="$GCINCS `cat ../boehm-gc/boehm-cflags`"
GCOBJS=boehm.o
GCHDR=boehm-gc.h
dnl The POSIX thread support needs to know this.
AC_DEFINE(HAVE_BOEHM_GC)
;;
no)
AC_MSG_RESULT(none)
GCOBJS=nogc.o
GCHDR=no-gc.h
;;
*)
AC_MSG_ERROR(unrecognized collector \"$GC\")
;;
esac
AC_SUBST(GCLIBS)
AC_SUBST(GCINCS)
AC_SUBST(GCDEPS)
AC_SUBST(GCOBJS)
AC_LINK_FILES(include/$GCHDR, include/java-gc.h)
dnl Note that this code is kept in sync with similar code in gcc/configure.in.
dnl In particular both packages must make the same decision about which
dnl thread package to use.
AC_MSG_CHECKING([for threads package to use])
AC_ARG_ENABLE(threads, [ --enable-threads=TYPE choose threading package],
THREADS=$enableval,
dnl FIXME: figure out native threads to use here.
THREADS=no)
if test "$THREADS" = yes; then
case "$host" in
*-*-vxworks*)
THREADS=vxworks
;;
*-*-linux*)
# FIXME: this isn't correct in all cases.
THREADS=posix
;;
*-*-win*)
THREADS=win32
;;
*-*-irix*)
THREADS=irix
;;
*-*-solaris*)
# FIXME: for now, choose POSIX, because we implement that.
# Later, choose solaris threads.
THREADS=posix
;;
*)
# For now.
THREADS=none
;;
esac
fi
case "$THREADS" in
no | none | single)
THREADS=none
;;
posix | pthreads)
THREADS=posix
case "$host" in
*-*-linux*)
AC_DEFINE(LINUX_THREADS)
;;
esac
;;
qt)
;;
decosf1 | irix | mach | os2 | solaris | win32 | dce | vxworks)
AC_MSG_ERROR(thread package $THREADS not yet supported)
;;
*)
AC_MSG_ERROR($THREADS is an unknown thread package)
;;
esac
AC_MSG_RESULT($THREADS)
THREADLIBS=
THREADINCS=
THREADDEPS=
THREADOBJS=
THREADH=
case "$THREADS" in
posix)
THREADLIBS=-lpthread
THREADOBJS=posix-threads.o
THREADH=posix-threads.h
# MIT pthreads doesn't seem to have the mutexattr functions.
# But for now we don't check for it. We just assume you aren't
# using MIT pthreads.
AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_INIT)
;;
qt)
THREADLIBS='-L$(top_builddir)/../qthreads -lgcjcoop'
THREADOBJS=quick-threads.o
THREADINCS='-I$(top_srcdir)/../qthreads'
THREADH=quick-threads.h
THREADDEPS='$(top_builddir)/../qthreads/libgcjcoop.a'
;;
none)
THREADOBJS=no-threads.o
THREADH=no-threads.h
;;
esac
AC_LINK_FILES(include/$THREADH, include/java-threads.h)
AC_SUBST(THREADLIBS)
AC_SUBST(THREADINCS)
AC_SUBST(THREADDEPS)
AC_SUBST(THREADOBJS)
AM_CONDITIONAL(USING_GCC, test "$GCC" = yes)
CANADIAN=no
NULL_TARGET=no
# Find eh-common.h and support headers. If we're in the tree with
# gcc, then look there. Otherwise look in compat-include. If all else
# fails, just hope the user has set things up somehow.
if test -r $srcdir/../gcc/eh-common.h; then
EH_COMMON_INCLUDE='-I$(top_srcdir)/../gcc -I$(top_srcdir)/../include'
else
if test -d $srcdir/../compat-include; then
EH_COMMON_INCLUDE='-I$(top_srcdir)/../compat-include'
else
EH_COMMON_INCLUDE=
fi
fi
if test -n "${with_cross_host}"; then
# We are being configured with a cross compiler. AC_REPLACE_FUNCS
# may not work correctly, because the compiler may not be able to
# link executables.
# We assume newlib. This lets us hard-code the functions we know
# we'll have.
AC_DEFINE(HAVE_MEMMOVE)
AC_DEFINE(HAVE_MEMCPY)
AC_DEFINE(HAVE_STRERROR)
AC_DEFINE(HAVE_CTIME_R)
AC_DEFINE(HAVE_GMTIME_R)
AC_DEFINE(HAVE_LOCALTIME_R)
dnl This is only for POSIX threads.
AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_INIT)
dnl We also assume we are using gcc, which provides alloca.
AC_DEFINE(HAVE_ALLOCA)
# If Canadian cross, then don't pick up tools from the build
# directory.
if test "$build" != "$with_cross_host"; then
CANADIAN=yes
EH_COMMON_INCLUDE=
fi
else
# Some POSIX thread systems don't have pthread_mutexattr_settype.
# E.g., Solaris.
AC_CHECK_FUNCS(strerror ioctl select open fsync sleep)
AC_CHECK_FUNCS(ctime_r ctime, break)
AC_CHECK_FUNCS(gmtime_r localtime_r readdir_r getpwuid_r)
AC_CHECK_FUNCS(access stat mkdir rename rmdir unlink realpath)
AC_CHECK_FUNCS(inet_aton inet_addr, break)
AC_CHECK_FUNCS(inet_pton uname)
AC_CHECK_FUNCS(gethostbyname_r, [
AC_DEFINE(HAVE_GETHOSTBYNAME_R)
# There are two different kinds of gethostbyname_r.
# We look for the one that returns `int'.
# Hopefully this check is robust enough.
AC_EGREP_HEADER(int.*gethostbyname_r, netdb.h, [
AC_DEFINE(GETHOSTBYNAME_R_RETURNS_INT)])])
AC_CHECK_FUNCS(gethostbyaddr_r, [
AC_DEFINE(HAVE_GETHOSTBYADDR_R)
# There are two different kinds of gethostbyaddr_r.
# We look for the one that returns `int'.
# Hopefully this check is robust enough.
AC_EGREP_HEADER(int.*gethostbyaddr_r, netdb.h, [
AC_DEFINE(GETHOSTBYADDR_R_RETURNS_INT)])])
AC_CHECK_FUNCS(gethostname, [
AC_DEFINE(HAVE_GETHOSTNAME)
AC_EGREP_HEADER(gethostname, unistd.h, [
AC_DEFINE(HAVE_GETHOSTNAME_DECL)])])
# Look for these functions in the thread library.
save_LIBS="$LIBS"
LIBS="$LIBS $THREADLIBS"
AC_CHECK_FUNCS(pthread_mutexattr_settype pthread_mutexattr_setkind_np sched_yield)
LIBS="$save_LIBS"
# We require a way to get the time.
time_found=no
AC_CHECK_FUNCS(gettimeofday time ftime, time_found=yes)
if test "$time_found" = no; then
AC_MSG_ERROR([no function found to get the time])
fi
# We require memmove.
memmove_found=no
AC_CHECK_FUNCS(memmove, memmove_found=yes)
if test "$memmove_found" = no; then
AC_MSG_ERROR([memmove is required])
fi
# We require memcpy.
memcpy_found=no
AC_CHECK_FUNCS(memcpy, memcpy_found=yes)
if test "$memcpy_found" = no; then
AC_MSG_ERROR([memcpy is required])
fi
test -d "$libgcj_basedir/../gcc/java" || {
CANADIAN=yes
NULL_TARGET=yes
}
fi
AM_CONDITIONAL(CANADIAN, test "$CANADIAN" = yes)
AM_CONDITIONAL(NULL_TARGET, test "$NULL_TARGET" = yes)
AM_CONDITIONAL(NATIVE, test "$CANADIAN" = no || test "$NULL_TARGET" = yes)
AC_SUBST(EH_COMMON_INCLUDE)
AC_SUBST(AM_RUNTESTFLAGS)
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 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)
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_MSG_CHECKING([whether struct sockaddr_in6 is in netinet/in.h])
AC_TRY_COMPILE([#include <netinet/in.h>], [struct sockaddr_in6 addr6;],
[AC_DEFINE(HAVE_INET6)
AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)])
AC_MSG_CHECKING([for socklen_t in sys/socket.h])
AC_TRY_COMPILE([#include <sys/socket.h>], [socklen_t x = 5;],
[AC_DEFINE(HAVE_SOCKLEN_T)
AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)])
AC_MSG_CHECKING([for tm_gmtoff in struct tm])
AC_TRY_COMPILE([#include <time.h>], [struct tm tim; tim.tm_gmtoff = 0;],
[AC_DEFINE(STRUCT_TM_HAS_GMTOFF)
AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
AC_MSG_CHECKING([for global timezone variable])
dnl FIXME: we don't want a link check here because that won't work
dnl when cross-compiling. So instead we make an assumption that
dnl the header file will mention timezone if it exists.
AC_TRY_COMPILE([#include <time.h>], [long z2 = timezone;],
[AC_DEFINE(HAVE_TIMEZONE)
AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)])])
AC_FUNC_ALLOCA
AC_CHECK_PROGS(PERL, perl, false)
if test "${multilib}" = "yes"; then
multilib_arg="--enable-multilib"
else
multilib_arg=
fi
here=`pwd`
AC_SUBST(here)
AC_OUTPUT(Makefile testsuite/Makefile,
[if test -n "$CONFIG_FILES"; then
ac_file=Makefile . ${libgcj_basedir}/../config-ml.in
fi],
srcdir=${srcdir}
host=${host}
target=${target}
with_multisubdir=${with_multisubdir}
ac_configure_args="${multilib_arg} ${ac_configure_args}"
CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
libgcj_basedir=${libgcj_basedir}
CC="${CC}"
CXX="${CXX}"
)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* Copyright (C) 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package gnu.gcj.convert;
public class Input_8859_1 extends BytesToUnicode
{
public String getName() { return "8859_1"; }
public int read (char[] outbuffer, int outpos, int outlength)
{
int origpos = outpos;
// Make sure fields of this are in registers.
int inpos = this.inpos;
byte[] inbuffer = this.inbuffer;
int inavail = this.inlength - inpos;
int outavail = outlength - outpos;
if (outavail > inavail)
outavail = inavail;
while (--outavail >= 0)
{
outbuffer[outpos++] = (char) (inbuffer[inpos++] & 0xFF);
}
this.inpos = inpos;
return outpos - origpos;
}
}
/* Copyright (C) 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package gnu.gcj.convert;
public class Input_EUCJIS extends BytesToUnicode
{
public String getName() { return "EUCJIS"; }
int codeset = 0;
int first_byte;
public native int read (char[] outbuffer, int outpos, int outlength);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment