diff options
author | Michael Meissner <gnu@the-meissners.org> | 1996-08-12 23:06:21 +0000 |
---|---|---|
committer | Michael Meissner <gnu@the-meissners.org> | 1996-08-12 23:06:21 +0000 |
commit | 9aecf50da5ff4a6f6ab62fccac0010bf9519b8b2 (patch) | |
tree | 4d5ef09a95ef28d5909de51be6618391f5dd2bd2 /sim/ppc/configure.in | |
parent | d9538961ccee460bce76d0e940a305c15eb171bf (diff) | |
download | gdb-9aecf50da5ff4a6f6ab62fccac0010bf9519b8b2.zip gdb-9aecf50da5ff4a6f6ab62fccac0010bf9519b8b2.tar.gz gdb-9aecf50da5ff4a6f6ab62fccac0010bf9519b8b2.tar.bz2 |
Test whether /dev/zero works before attemping to us it
Diffstat (limited to 'sim/ppc/configure.in')
-rw-r--r-- | sim/ppc/configure.in | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/sim/ppc/configure.in b/sim/ppc/configure.in index 1314a93..4924f78 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 <fcntl.h> +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]) |