From 8dcdfb3892ca09812246fea50ae56c2be2fbc154 Mon Sep 17 00:00:00 2001 From: ian Date: Thu, 10 Sep 2015 21:17:00 +0000 Subject: [PATCH] libgo: Use stat_atim.go on Solaris 12+ From Rainer Orth. Solaris 12 changes the stat_[amc]tim members of struct stat from timestruc_t to timespec_t for XPG7 compatiblity, thus breaking the libgo build. The following patch checks for this change and uses the common stat_atim.go if appropriate. Reviewed-on: https://go-review.googlesource.com/14495 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@227665 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/go/gofrontend/MERGE | 2 +- libgo/Makefile.am | 4 ++++ libgo/Makefile.in | 3 ++- libgo/configure | 32 ++++++++++++++++++++++++++++++-- libgo/configure.ac | 6 ++++++ 5 files changed, 43 insertions(+), 4 deletions(-) diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index ddf4637..3073489 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -7ba569544420d1de0eb607707ced6d23f8865186 +9bac6243d2252b2d043243d6ab1123ba7e90fa53 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/Makefile.am b/libgo/Makefile.am index 1676624..cd1c51d 100644 --- a/libgo/Makefile.am +++ b/libgo/Makefile.am @@ -880,7 +880,11 @@ endif endif if LIBGO_IS_SOLARIS +if HAVE_STAT_TIMESPEC +go_os_stat_file = go/os/stat_atim.go +else go_os_stat_file = go/os/stat_solaris.go +endif else if LIBGO_IS_LINUX go_os_stat_file = go/os/stat_atim.go diff --git a/libgo/Makefile.in b/libgo/Makefile.in index 7f0ee54..2eb6493 100644 --- a/libgo/Makefile.in +++ b/libgo/Makefile.in @@ -1107,6 +1107,8 @@ go_netgo_files = \ @LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_FALSE@go_os_cloexec_file = go/os/sys_unix.go @LIBGO_IS_DARWIN_TRUE@@LIBGO_IS_FREEBSD_FALSE@go_os_cloexec_file = go/os/sys_darwin.go @LIBGO_IS_FREEBSD_TRUE@go_os_cloexec_file = go/os/sys_freebsd.go +@HAVE_STAT_TIMESPEC_FALSE@@LIBGO_IS_SOLARIS_TRUE@go_os_stat_file = go/os/stat_solaris.go +@HAVE_STAT_TIMESPEC_TRUE@@LIBGO_IS_SOLARIS_TRUE@go_os_stat_file = go/os/stat_atim.go @LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_DRAGONFLY_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_FALSE@@LIBGO_IS_OPENBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_os_stat_file = go/os/stat.go @LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_DRAGONFLY_TRUE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_FALSE@@LIBGO_IS_OPENBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_os_stat_file = go/os/stat_dragonfly.go @LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_TRUE@@LIBGO_IS_OPENBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_os_stat_file = go/os/stat_atimespec.go @@ -1114,7 +1116,6 @@ go_netgo_files = \ @LIBGO_IS_DARWIN_TRUE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_OPENBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_os_stat_file = go/os/stat_atimespec.go @LIBGO_IS_LINUX_FALSE@@LIBGO_IS_OPENBSD_TRUE@@LIBGO_IS_SOLARIS_FALSE@go_os_stat_file = go/os/stat_atim.go @LIBGO_IS_LINUX_TRUE@@LIBGO_IS_SOLARIS_FALSE@go_os_stat_file = go/os/stat_atim.go -@LIBGO_IS_SOLARIS_TRUE@go_os_stat_file = go/os/stat_solaris.go @LIBGO_IS_LINUX_FALSE@go_os_pipe_file = go/os/pipe_bsd.go @LIBGO_IS_LINUX_TRUE@go_os_pipe_file = go/os/pipe_linux.go go_os_files = \ diff --git a/libgo/configure b/libgo/configure index 03d4e15..617fe15 100755 --- a/libgo/configure +++ b/libgo/configure @@ -602,6 +602,8 @@ ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS +HAVE_STAT_TIMESPEC_FALSE +HAVE_STAT_TIMESPEC_TRUE STRUCT_EPOLL_EVENT_FD_OFFSET SIZEOF_STRUCT_EPOLL_EVENT MATH_FLAG @@ -11118,7 +11120,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11121 "configure" +#line 11123 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11224,7 +11226,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11227 "configure" +#line 11229 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -15076,6 +15078,28 @@ $as_echo "$libgo_cv_c_epoll_event_fd_offset" >&6; } STRUCT_EPOLL_EVENT_FD_OFFSET=${libgo_cv_c_epoll_event_fd_offset} +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "timespec_t.*st_atim" >/dev/null 2>&1; then : + have_stat_timespec=yes +else + have_stat_timespec=no +fi +rm -f conftest* + + if test $have_stat_timespec = yes; then + HAVE_STAT_TIMESPEC_TRUE= + HAVE_STAT_TIMESPEC_FALSE='#' +else + HAVE_STAT_TIMESPEC_TRUE='#' + HAVE_STAT_TIMESPEC_FALSE= +fi + + ac_fn_c_check_type "$LINENO" "struct exception" "ac_cv_type_struct_exception" "#include " if test "x$ac_cv_type_struct_exception" = x""yes; then : @@ -15696,6 +15720,10 @@ if test -z "${HAVE_WAIT4_TRUE}" && test -z "${HAVE_WAIT4_FALSE}"; then as_fn_error "conditional \"HAVE_WAIT4\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${HAVE_STAT_TIMESPEC_TRUE}" && test -z "${HAVE_STAT_TIMESPEC_FALSE}"; then + as_fn_error "conditional \"HAVE_STAT_TIMESPEC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi : ${CONFIG_STATUS=./config.status} ac_write_fail=0 diff --git a/libgo/configure.ac b/libgo/configure.ac index 7c403a5..a175d46 100644 --- a/libgo/configure.ac +++ b/libgo/configure.ac @@ -645,6 +645,12 @@ AC_CACHE_CHECK([epoll_event data.fd offset], STRUCT_EPOLL_EVENT_FD_OFFSET=${libgo_cv_c_epoll_event_fd_offset} AC_SUBST(STRUCT_EPOLL_EVENT_FD_OFFSET) +dnl Check if uses timespec_t for st_?tim members. Introduced +dnl in Solaris 12 for XPG7 compatibility. +AC_EGREP_HEADER([timespec_t.*st_atim], [sys/stat.h], + [have_stat_timespec=yes], [have_stat_timespec=no]) +AM_CONDITIONAL(HAVE_STAT_TIMESPEC, test $have_stat_timespec = yes) + dnl See if struct exception is defined in . AC_CHECK_TYPE([struct exception], [libgo_has_struct_exception=yes], -- 2.7.4