aboutsummaryrefslogtreecommitdiff
path: root/libgo
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2012-03-02 21:07:52 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2012-03-02 21:07:52 +0000
commit2aeaf0fb26f98ca166fb55afd952da3dc739582b (patch)
tree4022d4e8fde18e8c78b0a4a1568f900976d4341a /libgo
parentb5ea803681b2f3bafc6be6f2f805c52dab7ceb2b (diff)
downloadgcc-2aeaf0fb26f98ca166fb55afd952da3dc739582b.zip
gcc-2aeaf0fb26f98ca166fb55afd952da3dc739582b.tar.gz
gcc-2aeaf0fb26f98ca166fb55afd952da3dc739582b.tar.bz2
libgo: Try to fix use of <ustat.h> for Solaris and older GNU/Linux.
From-SVN: r184828
Diffstat (limited to 'libgo')
-rw-r--r--libgo/config.h.in2
-rwxr-xr-xlibgo/configure32
-rw-r--r--libgo/configure.ac17
-rwxr-xr-xlibgo/mksysinfo.sh5
4 files changed, 53 insertions, 3 deletions
diff --git a/libgo/config.h.in b/libgo/config.h.in
index 22f2969..ccb79e1 100644
--- a/libgo/config.h.in
+++ b/libgo/config.h.in
@@ -196,7 +196,7 @@
/* Define to 1 if you have the `unshare' function. */
#undef HAVE_UNSHARE
-/* Define to 1 if you have the <ustat.h> header file. */
+/* Define to 1 if you have the <ustat.h> header file and it works. */
#undef HAVE_USTAT_H
/* Define to 1 if you have the <utime.h> header file. */
diff --git a/libgo/configure b/libgo/configure
index 6a4fb91..128629f 100755
--- a/libgo/configure
+++ b/libgo/configure
@@ -14508,7 +14508,7 @@ no)
;;
esac
-for ac_header in sys/mman.h syscall.h sys/epoll.h sys/ptrace.h sys/syscall.h sys/user.h sys/utsname.h sys/select.h sys/socket.h net/if.h sys/prctl.h sys/mount.h sys/vfs.h sys/statfs.h sys/timex.h sys/sysinfo.h ustat.h utime.h linux/reboot.h
+for ac_header in sys/mman.h syscall.h sys/epoll.h sys/ptrace.h sys/syscall.h sys/user.h sys/utsname.h sys/select.h sys/socket.h net/if.h sys/prctl.h sys/mount.h sys/vfs.h sys/statfs.h sys/timex.h sys/sysinfo.h utime.h linux/reboot.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@@ -14542,6 +14542,36 @@ fi
done
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether <ustat.h> can be used" >&5
+$as_echo_n "checking whether <ustat.h> can be used... " >&6; }
+if test "${libgo_cv_c_ustat_h+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <sys/types.h>
+#ifdef HAVE_LINUX_FILTER_H
+#include <linux/filter.h>
+#endif
+#include <ustat.h>
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ libgo_cv_c_ustat_h=yes
+else
+ libgo_cv_c_ustat_h=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgo_cv_c_ustat_h" >&5
+$as_echo "$libgo_cv_c_ustat_h" >&6; }
+if test $libgo_cv_c_ustat_h = yes; then
+
+$as_echo "#define HAVE_USTAT_H 1" >>confdefs.h
+
+fi
+
if test "$ac_cv_header_sys_mman_h" = yes; then
HAVE_SYS_MMAN_H_TRUE=
HAVE_SYS_MMAN_H_FALSE='#'
diff --git a/libgo/configure.ac b/libgo/configure.ac
index f2e23a6..8100c1c 100644
--- a/libgo/configure.ac
+++ b/libgo/configure.ac
@@ -453,7 +453,7 @@ no)
;;
esac
-AC_CHECK_HEADERS(sys/mman.h syscall.h sys/epoll.h sys/ptrace.h sys/syscall.h sys/user.h sys/utsname.h sys/select.h sys/socket.h net/if.h sys/prctl.h sys/mount.h sys/vfs.h sys/statfs.h sys/timex.h sys/sysinfo.h ustat.h utime.h linux/reboot.h)
+AC_CHECK_HEADERS(sys/mman.h syscall.h sys/epoll.h sys/ptrace.h sys/syscall.h sys/user.h sys/utsname.h sys/select.h sys/socket.h net/if.h sys/prctl.h sys/mount.h sys/vfs.h sys/statfs.h sys/timex.h sys/sysinfo.h utime.h linux/reboot.h)
AC_CHECK_HEADERS([linux/filter.h linux/netlink.h linux/rtnetlink.h], [], [],
[#ifdef HAVE_SYS_SOCKET_H
@@ -461,6 +461,21 @@ AC_CHECK_HEADERS([linux/filter.h linux/netlink.h linux/rtnetlink.h], [], [],
#endif
])
+AC_CACHE_CHECK([whether <ustat.h> can be used],
+[libgo_cv_c_ustat_h],
+AC_COMPILE_IFELSE(
+[AC_LANG_SOURCE([
+#include <sys/types.h>
+#ifdef HAVE_LINUX_FILTER_H
+#include <linux/filter.h>
+#endif
+#include <ustat.h>
+])], [libgo_cv_c_ustat_h=yes], [libgo_cv_c_ustat_h=no]))
+if test $libgo_cv_c_ustat_h = yes; then
+ AC_DEFINE(HAVE_USTAT_H, 1,
+ [Define to 1 if you have the <ustat.h> header file and it works.])
+fi
+
AM_CONDITIONAL(HAVE_SYS_MMAN_H, test "$ac_cv_header_sys_mman_h" = yes)
AC_CHECK_FUNCS(strerror_r strsignal wait4 mincore setenv)
diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh
index 09d0784..e5f3066 100755
--- a/libgo/mksysinfo.sh
+++ b/libgo/mksysinfo.sh
@@ -895,6 +895,11 @@ grep '^type _ustat ' gen-sysinfo.go | \
-e 's/f_fname/Fname/' \
-e 's/f_fpack/Fpack/' \
>> ${OUT}
+# Force it to be defined, as on some older GNU/Linux systems the
+# header file fails when using with <linux/filter.h>.
+if ! grep 'type _ustat ' gen-sysinfo.go >/dev/null 2>&1; then
+ echo 'type Ustat_t struct { Tfree int32; Tinoe uint64; Fname [5+1]int8; Fpack [5+1]int8; }' >> ${OUT}
+fi
# The utimbuf struct.
grep '^type _utimbuf ' gen-sysinfo.go | \