From 1f362c96c335d3dd6bf9baee8b5e672fcbba1814 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Fri, 24 Sep 2004 18:39:41 +0000 Subject: [PATCH] 2004-09-24 Ian Lance Taylor Committed by Andrew Cagney. * configure.in: Check for sys/mount.h, sys/vfs.h, sys/statfs.h. Check for struct statfs. * emul_netbsd.c: If not HAVE_STRUCT_STATFS, #undef HAVE_FSTATFS. * configure, config.in: Regenerate. --- sim/ppc/ChangeLog | 8 +++++ sim/ppc/config.in | 10 ++++++ sim/ppc/configure | 75 ++++++++++++++++++++++++++++++++++--------- sim/ppc/configure.in | 26 ++++++++++++++- sim/ppc/emul_netbsd.c | 8 +++++ 5 files changed, 111 insertions(+), 16 deletions(-) diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog index 4d5567990d6..066aa7568c9 100644 --- a/sim/ppc/ChangeLog +++ b/sim/ppc/ChangeLog @@ -1,3 +1,11 @@ +2004-09-24 Ian Lance Taylor + + Committed by Andrew Cagney. + * configure.in: Check for sys/mount.h, sys/vfs.h, sys/statfs.h. + Check for struct statfs. + * emul_netbsd.c: If not HAVE_STRUCT_STATFS, #undef HAVE_FSTATFS. + * configure, config.in: Regenerate. + 2004-08-05 Nathanael Nerode * Makefile.in (GDB_INCLUDES): Remove bogus reference to mmalloc. diff --git a/sim/ppc/config.in b/sim/ppc/config.in index c53a833c01c..53f67e6e73a 100644 --- a/sim/ppc/config.in +++ b/sim/ppc/config.in @@ -337,6 +337,9 @@ /* Define if you have the header file. */ #undef HAVE_SYS_STAT_H +/* Define if you have the header file. */ +#undef HAVE_SYS_STATFS_H + /* Define if you have the header file. */ #undef HAVE_SYS_TERMIO_H @@ -352,6 +355,9 @@ /* Define if you have the header file. */ #undef HAVE_SYS_TYPES_H +/* Define if you have the header file. */ +#undef HAVE_SYS_VFS_H + /* Define if you have the header file. */ #undef HAVE_TIME_H @@ -360,3 +366,7 @@ /* Define if you have the header file. */ #undef HAVE_VALUES_H + +/* Define if struct statfs is defined in */ +#undef HAVE_STRUCT_STATFS + diff --git a/sim/ppc/configure b/sim/ppc/configure index 51f50c522dc..c687e66e98e 100755 --- a/sim/ppc/configure +++ b/sim/ppc/configure @@ -4294,7 +4294,7 @@ fi done -for ac_hdr in fcntl.h stdlib.h string.h strings.h sys/ioctl.h sys/param.h sys/resource.h sys/stat.h sys/termio.h sys/termios.h sys/time.h sys/times.h sys/types.h time.h unistd.h +for ac_hdr in fcntl.h stdlib.h string.h strings.h sys/ioctl.h sys/mount.h sys/param.h sys/resource.h sys/stat.h sys/termio.h sys/termios.h sys/time.h sys/times.h sys/types.h time.h unistd.h sys/vfs.h sys/statfs.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 @@ -4609,9 +4609,54 @@ else ac_cv_termio_cline=no fi +echo $ac_n "checking for struct statfs""... $ac_c" 1>&6 +echo "configure:4614: checking for struct statfs" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_statfs'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#ifdef HAVE_SYS_MOUNT_H +#include +#endif +#ifdef HAVE_SYS_VFS_H +#include +#endif +#ifdef HAVE_SYS_STATFS_H +#include +#endif +int main() { +static struct statfs s; +; return 0; } +EOF +if { (eval echo configure:4638: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_statfs=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_statfs=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_statfs" 1>&6 +if test $ac_cv_struct_statfs = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_STRUCT_STATFS 1 +EOF + +fi + sim_devzero="" echo $ac_n "checking for /dev/zero""... $ac_c" 1>&6 -echo "configure:4615: checking for /dev/zero" >&5 +echo "configure:4660: checking for /dev/zero" >&5 if eval "test \"`echo '$''{'ac_cv_devzero'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4619,7 +4664,7 @@ else ac_cv_devzero=no else cat > conftest.$ac_ext < main () { @@ -4638,7 +4683,7 @@ main () { return 0; } EOF -if { (eval echo configure:4642: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4687: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_devzero=yes else @@ -4660,7 +4705,7 @@ else fi echo $ac_n "checking for common simulator directory""... $ac_c" 1>&6 -echo "configure:4664: checking for common simulator directory" >&5 +echo "configure:4709: checking for common simulator directory" >&5 if test -f "${srcdir}/../common/callback.c"; then echo "$ac_t""yes" 1>&6 sim_callback="callback.o targ-map.o" @@ -4672,7 +4717,7 @@ else fi echo $ac_n "checking for common simulator directory fpu implementation""... $ac_c" 1>&6 -echo "configure:4676: checking for common simulator directory fpu implementation" >&5 +echo "configure:4721: checking for common simulator directory fpu implementation" >&5 if test -f "${srcdir}/../common/sim-fpu.c"; then echo "$ac_t""yes" 1>&6 sim_fpu_cflags="-DHAVE_COMMON_FPU -I../common -I${srcdir}/../common" @@ -4684,12 +4729,12 @@ else fi echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:4688: checking for Cygwin environment" >&5 +echo "configure:4733: checking for Cygwin environment" >&5 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4749: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cygwin=yes else @@ -4717,19 +4762,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6 CYGWIN= test "$ac_cv_cygwin" = yes && CYGWIN=yes echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:4721: checking for mingw32 environment" >&5 +echo "configure:4766: checking for mingw32 environment" >&5 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4778: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mingw32=yes else @@ -4748,7 +4793,7 @@ test "$ac_cv_mingw32" = yes && MINGW32=yes echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:4752: checking for executable suffix" >&5 +echo "configure:4797: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4758,7 +4803,7 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:4762: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:4807: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in *.c | *.o | *.obj | *.ilk | *.pdb) ;; @@ -4787,7 +4832,7 @@ AR=${AR-ar} # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4791: checking for $ac_word" >&5 +echo "configure:4836: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else diff --git a/sim/ppc/configure.in b/sim/ppc/configure.in index 1f0693c25b6..7884a411bf4 100644 --- a/sim/ppc/configure.in +++ b/sim/ppc/configure.in @@ -585,7 +585,7 @@ AC_TYPE_UID_T AC_CHECK_FUNCS(access cfgetispeed cfgetospeed cfsetispeed cfsetospeed chdir chmod chown dup dup2 fchmod fchown fcntl fstat fstatfs getdirentries getegid geteuid getgid getpid getppid getrusage gettimeofday getuid ioctl kill link lseek lstat mkdir pipe readlink rmdir setreuid setregid stat sigprocmask stat symlink tcgetattr tcsetattr tcsendbreak tcdrain tcflush tcflow tcgetpgrp tcsetpgrp time umask unlink) -AC_CHECK_HEADERS(fcntl.h stdlib.h string.h strings.h sys/ioctl.h sys/param.h sys/resource.h sys/stat.h sys/termio.h sys/termios.h sys/time.h sys/times.h sys/types.h time.h unistd.h) +AC_CHECK_HEADERS(fcntl.h stdlib.h string.h strings.h sys/ioctl.h sys/mount.h sys/param.h sys/resource.h sys/stat.h sys/termio.h sys/termios.h sys/time.h sys/times.h sys/types.h time.h unistd.h sys/vfs.h sys/statfs.h) AC_HEADER_DIRENT dnl Figure out what type of termio/termios support there is @@ -658,6 +658,30 @@ else ac_cv_termio_cline=no fi +dnl Check for struct statfs +AC_MSG_CHECKING(for struct statfs) +AC_CACHE_VAL(ac_cv_struct_statfs, +[AC_TRY_COMPILE([#include +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#ifdef HAVE_SYS_MOUNT_H +#include +#endif +#ifdef HAVE_SYS_VFS_H +#include +#endif +#ifdef HAVE_SYS_STATFS_H +#include +#endif], +[static struct statfs s;], +ac_cv_struct_statfs=yes, ac_cv_struct_statfs=no)]) +AC_MSG_RESULT($ac_cv_struct_statfs) +if test $ac_cv_struct_statfs = yes; then + AC_DEFINE(HAVE_STRUCT_STATFS, 1, + [Define if struct statfs is defined in ]) +fi + dnl Figure out if /dev/zero exists or not sim_devzero="" AC_MSG_CHECKING(for /dev/zero) diff --git a/sim/ppc/emul_netbsd.c b/sim/ppc/emul_netbsd.c index 3ea03f635c4..18ca73befec 100644 --- a/sim/ppc/emul_netbsd.c +++ b/sim/ppc/emul_netbsd.c @@ -94,6 +94,14 @@ int getrusage(); #include #include extern int getdirentries(int fd, char *buf, int nbytes, long *basep); + +/* NetBSD post 2.0 has the statfs system call (if COMPAT_20), but does + not have struct statfs. In this case don't implement fstatfs. + FIXME: Should implement fstatvfs. */ +#ifndef HAVE_STRUCT_STATFS +#undef HAVE_FSTATFS +#endif + #else /* If this is not netbsd, don't allow fstatfs or getdirentries at this time */