This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
3.4 PATCH: Fix libjava Tru64 UNIX V4.0F bootstrap failure with pthreads
- From: Rainer Orth <ro at TechFak dot Uni-Bielefeld dot DE>
- To: java-patches at gcc dot gnu dot org
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 4 Jul 2003 18:56:19 +0200 (MEST)
- Subject: 3.4 PATCH: Fix libjava Tru64 UNIX V4.0F bootstrap failure with pthreads
Trying to get mainline GCC to work with --enable-threads=posix on Tru64
UNIX, I ran into a bootstrap failure in libjava (V4.0F only):
There's only a prototype for usleep in the V4.0F <unistd.h> if
_XOPEN_SOURCE_EXTENDED || !_XOPEN_SOURCE
V5.1 changed that to
_XOPEN_SOURCE_EXTENDED || (_XOPEN_SOURCE && _OSF_SOURCE) || !_XOPEN_SOURCE
We cannot define _XOPEN_SOURCE_EXTENDED since this completely breaks the
tree due to conflicting declarations, and need _XOPEN_SOURCE for other
reasons. I therefore chose to check for a usleep declaration and provide
one if missing. The following patch implements this and allowed bootstrap
to complete.
Testsuite results are not so good, but this is due to principal problems
with this configuration, which I'll elaborate in a separate message.
Bootstrapped on alpha-dec-osf4.0f and alpha-dec-osf5.1 with
--enable-threads=posix.
Ok for mainline?
Rainer
-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University
Tue Jul 1 14:19:20 2003 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* configure.in: Check for usleep declaration.
* acconfig.h (HAVE_USLEEP_DECL): Provide template.
* configure: Regenerate.
* include/config.h.in: Likewise.
* include/posix.h [!HAVE_USLEEP_DECL]: Declare usleep.
Index: libjava/acconfig.h
===================================================================
RCS file: /cvs/gcc/gcc/libjava/acconfig.h,v
retrieving revision 1.26
diff -u -p -r1.26 acconfig.h
--- libjava/acconfig.h 29 Aug 2002 18:05:14 -0000 1.26
+++ libjava/acconfig.h 4 Jul 2003 15:09:02 -0000
@@ -83,6 +83,9 @@
/* Define if gethostbyaddr_r returns `int'. */
#undef GETHOSTBYADDR_R_RETURNS_INT
+/* Define if usleep is declared in <unistd.h>. */
+#undef HAVE_USLEEP_DECL
+
/* Define if struct tm has tm_gmtoff field. */
#undef STRUCT_TM_HAS_GMTOFF
Index: libjava/configure.in
===================================================================
RCS file: /cvs/gcc/gcc/libjava/configure.in,v
retrieving revision 1.157
diff -u -p -r1.157 configure.in
--- libjava/configure.in 17 Jun 2003 15:56:07 -0000 1.157
+++ libjava/configure.in 4 Jul 2003 15:09:08 -0000
@@ -678,6 +678,10 @@ else
AC_EGREP_HEADER(gethostname, unistd.h, [
AC_DEFINE(HAVE_GETHOSTNAME_DECL)])])
+ AC_CHECK_FUNCS(usleep, [
+ AC_EGREP_HEADER(usleep, unistd.h, [
+ AC_DEFINE(HAVE_USLEEP_DECL)])])
+
# Look for these functions in the thread library, but only bother
# if using POSIX threads.
if test "$THREADS" = posix; then
Index: libjava/include/posix.h
===================================================================
RCS file: /cvs/gcc/gcc/libjava/include/posix.h,v
retrieving revision 1.20
diff -u -p -r1.20 posix.h
--- libjava/include/posix.h 7 Jun 2003 14:30:32 -0000 1.20
+++ libjava/include/posix.h 4 Jul 2003 15:09:39 -0000
@@ -92,6 +92,10 @@ _Jv_platform_close_on_exec (jint fd)
#undef fcntl
#ifdef JV_HASH_SYNCHRONIZATION
+#ifndef HAVE_USLEEP_DECL
+extern "C" int usleep (useconds_t useconds);
+#endif /* not HAVE_USLEEP_DECL */
+
inline void
_Jv_platform_usleep (unsigned long usecs)
{