@@ -1459,6 +1459,8 @@
libgo_la_SOURCES = $(runtime_files)
+libgo_la_LDFLAGS = $(PTHREAD_CFLAGS)
+
libgo_la_LIBADD = \
$(libgo_go_objs) $(LIBFFI) $(PTHREAD_LIBS) $(MATH_LIBS) $(NET_LIBS)
@@ -2512,7 +2514,7 @@
sysinfo.go: s-sysinfo; @true
s-sysinfo: $(srcdir)/mksysinfo.sh config.h
- CC="$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS)" $(SHELL) $(srcdir)/mksysinfo.sh
+ CC="$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(OSCFLAGS)" $(SHELL) $(srcdir)/mksysinfo.sh
$(SHELL) $(srcdir)/../move-if-change tmp-sysinfo.go sysinfo.go
$(STAMP) $@
@@ -229,6 +229,22 @@
fi
AC_SUBST(GO_DEBUG_PROC_REGS_OS_ARCH_FILE)
+dnl Some targets need special flags to build sysinfo.go.
+case "$target" in
+ *-*-solaris2.[[89]])
+ # Solaris 8/9 need this so struct msghdr gets the msg_control
+ # etc. fields in <sys/socket.h> (_XPG4_2).
+ OSCFLAGS='-D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D__EXTENSIONS__'
+ ;;
+ *-*-solaris2.1[[01]])
+ # Solaris 10+ needs this so struct msghdr gets the msg_control
+ # etc. fields in <sys/socket.h> (_XPG4_2). _XOPEN_SOURCE=500 as
+ # above doesn't work with C99.
+ OSCFLAGS='-D_XOPEN_SOURCE=600 -D__EXTENSIONS__'
+ ;;
+esac
+AC_SUBST(OSCFLAGS)
+
dnl Use -fsplit-stack when compiling C code if available.
AC_CACHE_CHECK([whether -fsplit-stack is supported],
[libgo_cv_c_split_stack_supported],
@@ -29,12 +29,6 @@
#define _LARGEFILE_SOURCE
#define _FILE_OFFSET_BITS 64
-#if defined(__sun__) && defined(__svr4__)
-/* Needed by Solaris header files. */
-#define _XOPEN_SOURCE 600
-#define __EXTENSIONS__
-#endif
-
#include <sys/types.h>
#include <dirent.h>
#include <errno.h>
@@ -96,7 +90,7 @@
sed -e 's/^\(const \)_\(E[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT}
# The O_xxx flags.
-grep '^const _\(O\|F\|FD\)_' gen-sysinfo.go | \
+egrep '^const _(O|F|FD)_' gen-sysinfo.go | \
sed -e 's/^\(const \)_\([^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT}
if ! grep '^const O_ASYNC' ${OUT} >/dev/null 2>&1; then
echo "const O_ASYNC = 0" >> ${OUT}
@@ -139,7 +133,7 @@
fi
# Networking constants.
-grep '^const _\(AF\|SOCK\|SOL\|SO\|IPPROTO\|TCP\|IP\|IPV6\)_' gen-sysinfo.go |
+egrep '^const _(AF|SOCK|SOL|SO|IPPROTO|TCP|IP|IPV6)_' gen-sysinfo.go |
sed -e 's/^\(const \)_\([^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT}
grep '^const _SOMAXCONN' gen-sysinfo.go |
sed -e 's/^\(const \)_\(SOMAXCONN[^= ]*\)\(.*\)$/\1\2 = _\2/' \
@@ -318,7 +312,8 @@
grep '^type _stat64 ' gen-sysinfo.go
else
grep '^type _stat ' gen-sysinfo.go
-fi | sed -e 's/type _stat\(64\)\?/type Stat_t/' \
+fi | sed -e 's/type _stat64/type Stat_t/' \
+ -e 's/type _stat/type Stat_t/' \
-e 's/st_dev/Dev/' \
-e 's/st_ino/Ino/g' \
-e 's/st_nlink/Nlink/' \
@@ -344,7 +339,8 @@
grep '^type _dirent64 ' gen-sysinfo.go
else
grep '^type _dirent ' gen-sysinfo.go
-fi | sed -e 's/type _dirent\(64\)\?/type Dirent/' \
+fi | sed -e 's/type _dirent64/type Dirent/' \
+ -e 's/type _dirent/type Dirent/' \
-e 's/d_name \[0+1\]/d_name [0+256]/' \
-e 's/d_name/Name/' \
-e 's/]int8/]byte/' \