[patch] enable libjava on HP-UX PA

John David Anglin dave@hiauly1.hia.nrc.ca
Sat May 27 08:39:00 GMT 2006


> It does not work on HP-UX 10.20/11.00 and it also doesn't work yet on 
> hppa64-hp-hpux*. This is future work.

What's the problem with HP-UX 11.00?  I'm fairly certain that 11.00
should work similarly to 11.11 when configured with --enabled-threads=posix
although I haven't attempted such a build yet.  Test results for a build
without --enabled-threads=posix are here:
<http://gcc.gnu.org/ml/gcc-testresults/2006-05/msg01348.html>.

I had to make a few changes to avoid using reentrant functions as the
prototypes are only available when _REENTRANT is defined.

I don't think we want to use the reentrant versions when threads aren't
used as there are differences between the POSIX and DCE implementations.
So, using the reentrant versions wouldn't work under HP-UX 10.X without
additional configure checks and coding changes.

The change that I used is shown below.

It may be possible to build on HP-UX 10.X without thread support.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

Index: gnu/classpath/natSystemProperties.cc
===================================================================
--- gnu/classpath/natSystemProperties.cc	(revision 113941)
+++ gnu/classpath/natSystemProperties.cc	(working copy)
@@ -203,7 +203,7 @@
   uid_t user_id = getuid ();
   struct passwd *pwd_entry;
 
-#ifdef HAVE_GETPWUID_R
+#if defined(HAVE_GETPWUID_R) && defined(_REENTRANT)
   struct passwd pwd_r;
   size_t len_r = 200;
   char *buf_r = (char *) _Jv_AllocBytes (len_r);
Index: java/io/natFilePosix.cc
===================================================================
--- java/io/natFilePosix.cc	(revision 113941)
+++ java/io/natFilePosix.cc	(working copy)
@@ -215,7 +215,7 @@
 
   java::util::ArrayList *list = new java::util::ArrayList ();
   struct dirent *d;
-#ifdef HAVE_READDIR_R
+#if defined(HAVE_READDIR_R) && defined(_REENTRANT)
   int name_max = pathconf (buf, _PC_NAME_MAX);
   char dbuf[sizeof (struct dirent) + name_max + 1];
   while (readdir_r (dir, (struct dirent *) dbuf, &d) == 0 && d != NULL)
Index: java/util/natVMTimeZone.cc
===================================================================
--- java/util/natVMTimeZone.cc	(revision 113941)
+++ java/util/natVMTimeZone.cc	(working copy)
@@ -54,7 +54,7 @@
 java::util::VMTimeZone::getSystemTimeZoneId()
 {
   struct tm tim;
-#ifndef HAVE_LOCALTIME_R
+#if !defined(HAVE_LOCALTIME_R) || !defined(_REENTRANT)
   struct tm *lt_tim;
 #endif
 #ifdef HAVE_TM_ZONE
@@ -66,7 +66,7 @@
   char *tzid;
 
   time(&current_time);
-#ifdef HAVE_LOCALTIME_R
+#if defined(HAVE_LOCALTIME_R) && defined(_REENTRANT)
   localtime_r(&current_time, &tim);
 #else
   /* Fall back on non-thread safe localtime. */



More information about the Gcc-patches mailing list