libgo: Try to fix use of <ustat.h> for Solaris and older GNU/Linux.

From-SVN: r184828
This commit is contained in:
Ian Lance Taylor 2012-03-02 21:07:52 +00:00
parent b5ea803681
commit 2aeaf0fb26
4 changed files with 53 additions and 3 deletions

View File

@ -196,7 +196,7 @@
/* Define to 1 if you have the `unshare' function. */ /* Define to 1 if you have the `unshare' function. */
#undef HAVE_UNSHARE #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 #undef HAVE_USTAT_H
/* Define to 1 if you have the <utime.h> header file. */ /* Define to 1 if you have the <utime.h> header file. */

32
libgo/configure vendored
View File

@ -14508,7 +14508,7 @@ no)
;; ;;
esac 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 : do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` 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" ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@ -14542,6 +14542,36 @@ fi
done 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 if test "$ac_cv_header_sys_mman_h" = yes; then
HAVE_SYS_MMAN_H_TRUE= HAVE_SYS_MMAN_H_TRUE=
HAVE_SYS_MMAN_H_FALSE='#' HAVE_SYS_MMAN_H_FALSE='#'

View File

@ -453,7 +453,7 @@ no)
;; ;;
esac 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], [], [], AC_CHECK_HEADERS([linux/filter.h linux/netlink.h linux/rtnetlink.h], [], [],
[#ifdef HAVE_SYS_SOCKET_H [#ifdef HAVE_SYS_SOCKET_H
@ -461,6 +461,21 @@ AC_CHECK_HEADERS([linux/filter.h linux/netlink.h linux/rtnetlink.h], [], [],
#endif #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) AM_CONDITIONAL(HAVE_SYS_MMAN_H, test "$ac_cv_header_sys_mman_h" = yes)
AC_CHECK_FUNCS(strerror_r strsignal wait4 mincore setenv) AC_CHECK_FUNCS(strerror_r strsignal wait4 mincore setenv)

View File

@ -895,6 +895,11 @@ grep '^type _ustat ' gen-sysinfo.go | \
-e 's/f_fname/Fname/' \ -e 's/f_fname/Fname/' \
-e 's/f_fpack/Fpack/' \ -e 's/f_fpack/Fpack/' \
>> ${OUT} >> ${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. # The utimbuf struct.
grep '^type _utimbuf ' gen-sysinfo.go | \ grep '^type _utimbuf ' gen-sysinfo.go | \