From: Michael Meissner Date: Mon, 12 Aug 1996 23:06:21 +0000 (+0000) Subject: Test whether /dev/zero works before attemping to us it X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9aecf50da5ff4a6f6ab62fccac0010bf9519b8b2;p=binutils-gdb.git Test whether /dev/zero works before attemping to us it --- diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog index e67bdfe9957..add31b5ff58 100644 --- a/sim/ppc/ChangeLog +++ b/sim/ppc/ChangeLog @@ -1,3 +1,17 @@ +Mon Aug 12 18:42:37 1996 Michael Meissner + + * configure.in: Test whether /dev/zero works on the system, and if + it does, define HAVE_DEVZERO. + * configure: Regenerate. + + * emul_generic.c (emul_add_tree_hardware): Do not add /iobus/disk + if we don't have a working /dev/zero on the system. + + * emul_bugapi.c (emul_bugapi_init): If HAVE_DEVZERO is not + defined, don't add disk support. + (emul_bugapi_do_diskio): Ditto. + (emul_bugapi_instruction_call): Ditto. + Wed Aug 7 14:34:20 1996 Michael Meissner * emul_unix.c (HAVE_TCGETATTR): If HAVE_TERMIOS_STRUCTURE is not diff --git a/sim/ppc/Makefile.in b/sim/ppc/Makefile.in index 5ab3c221499..1d36f655f77 100644 --- a/sim/ppc/Makefile.in +++ b/sim/ppc/Makefile.in @@ -88,6 +88,7 @@ MODEL_CFLAGS = @sim_model@ @sim_default_model@ @sim_model_issue@ STDIO_CFLAGS = @sim_stdio@ TERMIO_CFLAGS = @sim_termio@ WARNING_CFLAGS = @sim_warnings@ +DEVZERO_CFLAGS = @sim_devzero@ CONFIG_CFLAGS = $(BSWAP_CFLAGS) \ $(ENDIAN_CFLAGS) \ $(REGPARM_CFLAGS) \ @@ -107,7 +108,8 @@ CONFIG_CFLAGS = $(BSWAP_CFLAGS) \ $(MONITOR_CFLAGS) \ $(MODEL_CFLAGS) \ $(STDIO_CFLAGS) \ - $(TERMIO_CFLAGS) + $(TERMIO_CFLAGS) \ + $(DEVZERO_CFLAGS) STD_CFLAGS = $(CFLAGS) $(INLINE_CFLAGS) $(CONFIG_CFLAGS) $(WARNING_CFLAGS) $(SIM_CFLAGS) $(HDEFINES) $(TDEFINES) $(INCLUDES) NOWARN_CFLAGS = $(CFLAGS) $(INLINE_CFLAGS) $(CONFIG_CFLAGS) $(SIM_CFLAGS) $(HDEFINES) $(TDEFINES) $(INCLUDES) diff --git a/sim/ppc/configure.in b/sim/ppc/configure.in index 1314a9340d0..4924f78b7f0 100644 --- a/sim/ppc/configure.in +++ b/sim/ppc/configure.in @@ -593,6 +593,33 @@ else ac_cv_termio_cline=no fi +dnl Figure out if /dev/zero exists or not +sim_devzero="" +AC_MSG_CHECKING(for /dev/zero) +AC_CACHE_VAL(ac_cv_devzero, +[AC_TRY_RUN([#include +main () { + char buf[2048]; + int i; + int fd = open ("/dev/zero", O_RDONLY); + if (fd < 0) + return 1; + for (i = 0; i < sizeof (buf); i++) + buf[i] = 1; + if (read (fd, buf, sizeof (buf)) != sizeof (buf)) + return 1; + for (i = 0; i < sizeof (buf); i++) + if (buf[i]) + return 1; + return 0; +}],[ac_cv_devzero=yes],[ac_cv_devzero=no],[ac_cv_devzero=no])]) +AC_MSG_RESULT($ac_cv_devzero) +if test $ac_cv_devzero = yes; then + sim_devzero="-DHAVE_DEVZERO" +else + sim_devzero="" +fi + AC_SUBST(CC_FOR_BUILD) AC_SUBST(CFLAGS) AC_SUBST(HDEFINES) @@ -637,6 +664,7 @@ AC_SUBST(sim_default_model) AC_SUBST(sim_model_issue) AC_SUBST(sim_stdio) AC_SUBST(sim_termio) +AC_SUBST(sim_devzero) AC_OUTPUT(Makefile, [case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac])