Patchwork libgo patch committed: Solaris portability patches

login
register
mail settings
Submitter Ian Taylor
Date Feb. 11, 2013, 7:03 p.m.
Message ID <mcrtxpi7jx1.fsf@google.com>
Download mbox | patch
Permalink /patch/219668/
State New
Headers show

Comments

Ian Taylor - Feb. 11, 2013, 7:03 p.m.
This patch from Rainer Orth in PR 56171 fixes some Solaris portability
problems in libgo.

* Check for nanosleep in -lrt.
* Pass $(LIBS) when testing so that the tests use -lrt as needed.
* Make sure that AF_LOCAL is defined.

Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian

Patch

diff -r 4466c8235d4a libgo/Makefile.am
--- a/libgo/Makefile.am	Sat Feb 09 21:58:14 2013 -0800
+++ b/libgo/Makefile.am	Mon Feb 11 10:56:06 2013 -0800
@@ -1997,7 +1997,7 @@ 
 CHECK = \
 	GC="$(GOC) $(GOCFLAGS) $($(subst /,_,$@)_GOCFLAGS) -L `${PWD_COMMAND}` -L `${PWD_COMMAND}`/.libs"; \
 	export GC; \
-	GOLIBS="$(MATH_LIBS) $(NET_LIBS)"; \
+	GOLIBS="$(MATH_LIBS) $(NET_LIBS) $(LIBS)"; \
 	export GOLIBS; \
 	RUNTESTFLAGS="$(RUNTESTFLAGS)"; \
 	export RUNTESTFLAGS; \
diff -r 4466c8235d4a libgo/configure.ac
--- a/libgo/configure.ac	Sat Feb 09 21:58:14 2013 -0800
+++ b/libgo/configure.ac	Mon Feb 11 10:56:06 2013 -0800
@@ -413,8 +413,9 @@ 
 AC_CHECK_LIB([pthread], [pthread_create], PTHREAD_LIBS=-lpthread)
 AC_SUBST(PTHREAD_LIBS)
 
-dnl Test if -lrt is required for sched_yield.
+dnl Test if -lrt is required for sched_yield and/or nanosleep.
 AC_SEARCH_LIBS([sched_yield], [rt])
+AC_SEARCH_LIBS([nanosleep], [rt])
 
 AC_C_BIGENDIAN
 
diff -r 4466c8235d4a libgo/mksysinfo.sh
--- a/libgo/mksysinfo.sh	Sat Feb 09 21:58:14 2013 -0800
+++ b/libgo/mksysinfo.sh	Mon Feb 11 10:56:06 2013 -0800
@@ -309,6 +309,13 @@ 
   fi
 done
 
+# The syscall package requires AF_LOCAL.
+if ! grep '^const AF_LOCAL ' ${OUT} >/dev/null 2>&1; then
+  if grep '^const AF_UNIX ' ${OUT} >/dev/null 2>&1; then
+    echo "const AF_LOCAL = AF_UNIX" >> ${OUT}
+  fi
+fi
+
 # pathconf constants.
 grep '^const __PC' gen-sysinfo.go |
   sed -e 's/^\(const \)__\(PC[^= ]*\)\(.*\)$/\1\2 = __\2/' >> ${OUT}