This is the mail archive of the java-patches@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[Solaris 2] libposix4/librt fixes


I noticed two problems with the handling of sched_yield on Solaris 2.5.1:
if I configure libgcj 2.95 (or the current CVS trunk revision) with
--enable-threads=posix, linking a trivial hello.java fails since
sched_yield is undefined.  While libposix4 (or librt) is added to
THREADLIBS, libgcj.spec.in references THREADSPEC to get the host systems
idea of thread libraries.  Adding -lposix4 to the generated file allowed me
to at least link the program.  The resulting executable still SEGV's, as
it does if libgcj is configured without --enable-threads.

Besides, I now check for librt before libposix4: the former was introduced
in Solaris 7 as the preferred name for the latter (cf. librt(4) on Solaris
7).  This is completely unrelated to SPARC vs. x86 as the configure.in
comment suggests.

Currently, libjava from the trunk cannot work with gcj 2.95: libgcj.spec
requires -fuse-divide-subroutine on most platforms, which is only supported
in the trunk revisions of gcj.  Perhaps a prominent note about this should
be added somewhere.

	Rainer

-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University

Email: ro@TechFak.Uni-Bielefeld.DE


Mon Aug  9 18:33:38 1999  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>

	* configure.in (sched_yield): Try librt first, then libposix4.
	Add -lrt, -lposix4 to THREADSPEC.

Index: configure.in
===================================================================
RCS file: /cvs/java/libgcj/libjava/configure.in,v
retrieving revision 1.19
diff -u -p -r1.19 configure.in
--- configure.in	1999/08/08 14:06:20	1.19
+++ configure.in	1999/08/09 18:14:35
@@ -381,15 +382,17 @@ else
    LIBS="$LIBS $THREADLIBS"
    AC_CHECK_FUNCS(pthread_mutexattr_settype pthread_mutexattr_setkind_np)
 
-   # Look for sched_yield.  Sometimes it is in the posix4 library
-   # (Solaris) and sometimes in -lrt (x86 Solaris).
+   # Look for sched_yield.  Up to Solaris 2.6, it is in libposix4, since
+   # Solaris 7 the name librt is preferred.
    AC_CHECK_FUNCS(sched_yield, , [
-     AC_CHECK_LIB(posix4, sched_yield, [
+     AC_CHECK_LIB(rt, sched_yield, [
        AC_DEFINE(HAVE_SCHED_YIELD)
-       THREADLIBS="$THREADLIBS -lposix4"], [
-       AC_CHECK_LIB(rt, sched_yield, [
+       THREADLIBS="$THREADLIBS -lrt"
+       THREADSPECS="$THREADSPECS -lrt"], [
+       AC_CHECK_LIB(posix4, sched_yield, [
          AC_DEFINE(HAVE_SCHED_YIELD)
-	 THREADLIBS="$THREADLIBS -lrt"])])])
+	 THREADLIBS="$THREADLIBS -lposix4"
+         THREADSPECS="$THREADSPECS -lposix4"])])])
    LIBS="$save_LIBS"
 
    # We require a way to get the time.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]