dnl Process this file with autoconf to produce a configure script.
-AC_PREREQ(2.5)dnl
+AC_PREREQ(2.3)dnl
AC_INIT(Makefile.in)
AC_PROG_CC
-AC_PROG_INSTALL
# Put a plausible default for CC_FOR_BUILD in Makefile.
AC_C_CROSS
AC_CONFIG_HEADER(config.h:config.in)
+AC_STRUCT_ST_BLKSIZE
+AC_STRUCT_ST_BLOCKS
+AC_STRUCT_ST_RDEV
+AC_STRUCT_TIMEZONE
+
+AC_TYPE_GETGROUPS
+AC_TYPE_MODE_T
+AC_TYPE_OFF_T
+AC_TYPE_PID_T
+AC_TYPE_SIGNAL
+AC_TYPE_SIZE_T
+AC_TYPE_UID_T
+
+AC_CHECK_FUNCS(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/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)
+AC_HEADER_DIRENT
+
+dnl Figure out what type of termio/termios support there is
+sim_termio=""
+AC_MSG_CHECKING(for struct termios)
+AC_CACHE_VAL(ac_cv_termios_struct,
+[AC_TRY_COMPILE([#include <sys/types.h>
+#include <sys/termios.h>],
+[static struct termios x;
+ x.c_iflag = 0;
+ x.c_oflag = 0;
+ x.c_cflag = 0;
+ x.c_lflag = 0;
+ x.c_cc[NCCS] = 0;],
+ac_cv_termios_struct=yes, ac_cv_termios_struct=no)])
+AC_MSG_RESULT($ac_cv_termios_struct)
+if test $ac_cv_termios_struct = yes; then
+ sim_termio="$sim_termio -DHAVE_TERMIOS_STRUCTURE"
+fi
+
+if test "$ac_cv_termios_struct" = "yes"; then
+ AC_MSG_CHECKING(for c_line field in struct termios)
+ AC_CACHE_VAL(ac_cv_termios_cline,
+ [AC_TRY_COMPILE([#include <sys/types.h>
+#include <sys/termios.h>],
+[static struct termios x; x.c_line = 0;],
+ ac_cv_termios_cline=yes, ac_cv_termios_cline=no)])
+
+ AC_MSG_RESULT($ac_cv_termios_cline)
+ if test $ac_cv_termios_cline = yes; then
+ sim_termio="$sim_termio -DHAVE_TERMIOS_CLINE"
+ fi
+else
+ ac_cv_termios_cline=no
+fi
+
+if test "$ac_cv_termios_struct" != "yes"; then
+ AC_MSG_CHECKING(for struct termio)
+ AC_CACHE_VAL(ac_cv_termio_struct,
+ [AC_TRY_COMPILE([#include <sys/types.h>
+#include <sys/termio.h>],
+[static struct termio x;
+ x.c_iflag = 0;
+ x.c_oflag = 0;
+ x.c_cflag = 0;
+ x.c_lflag = 0;
+ x.c_cc[NCC] = 0;],
+ac_cv_termio_struct=yes, ac_cv_termio_struct=no)])
+ AC_MSG_RESULT($ac_cv_termio_struct)
+ if test $ac_cv_termio_struct = yes; then
+ sim_termio="$sim_termio -DHAVE_TERMIO_STRUCTURE"
+ fi
+else
+ ac_cv_termio_struct=no
+fi
+
+if test "$ac_cv_termio_struct" = "yes"; then
+ AC_MSG_CHECKING(for c_line field in struct termio)
+ AC_CACHE_VAL(ac_cv_termio_cline,
+ [AC_TRY_COMPILE([#include <sys/types.h>
+#include <sys/termio.h>],
+[static struct termio x; x.c_line = 0;],
+ ac_cv_termio_cline=yes, ac_cv_termio_cline=no)])
+
+ AC_MSG_RESULT($ac_cv_termio_cline)
+ if test $ac_cv_termio_cline = yes; then
+ sim_termio="$sim_termio -DHAVE_TERMIO_CLINE"
+ fi
+else
+ ac_cv_termio_cline=no
+fi
+
AC_SUBST(CC_FOR_BUILD)
AC_SUBST(CFLAGS)
AC_SUBST(HDEFINES)
AC_SUBST(sim_default_model)
AC_SUBST(sim_model_issue)
AC_SUBST(sim_stdio)
-
-AC_STRUCT_ST_BLKSIZE
-AC_STRUCT_ST_BLOCKS
-AC_STRUCT_ST_RDEV
-AC_STRUCT_TIMEZONE
-
-AC_TYPE_GETGROUPS
-AC_TYPE_MODE_T
-AC_TYPE_OFF_T
-AC_TYPE_PID_T
-AC_TYPE_SIGNAL
-AC_TYPE_SIZE_T
-AC_TYPE_UID_T
-
-AC_CHECK_FUNCS(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/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)
-AC_HEADER_DIRENT
+AC_SUBST(sim_termio)
AC_OUTPUT(Makefile,
[case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac])