+2000-08-02 Akim Demaille <akim@epita.fr>
+
+ Release Automake from being a substitute to Autoconf.
+
+ * acspecific.m4 (_AC_HEADER_TIOCGWINSZ_IN_TERMIOS_H,
+ _AC_HEADER_TIOCGWINSZ_IN_SYS_IOCTL, AC_HEADER_TIOCGWINSZ,
+ AC_SYS_POSIX_TERMIOS): New macros from both Automake and the
+ fileutils.
+
2000-08-02 Akim Demaille <akim@epita.fr>
* aclang.m4 (_AC_PROG_CC_G, _AC_PROG_CXX_G): Recent changes
])# AC_HEADER_TIME
+# _AC_HEADER_TIOCGWINSZ_IN_TERMIOS_H
+# ----------------------------------
+define([_AC_HEADER_TIOCGWINSZ_IN_TERMIOS_H],
+[AC_CACHE_CHECK([whether termios.h defines TIOCGWINSZ],
+ ac_cv_sys_tiocgwinsz_in_termios_h,
+[AC_EGREP_CPP([yes],
+ [#include <sys/types.h>
+#include <termios.h>
+#ifdef TIOCGWINSZ
+ yes
+#endif
+],
+ ac_cv_sys_tiocgwinsz_in_termios_h=yes)])
+])# _AC_HEADER_TIOCGWINSZ_IN_TERMIOS_H
+
+
+# _AC_HEADER_TIOCGWINSZ_IN_SYS_IOCTL
+# ----------------------------------
+define([_AC_HEADER_TIOCGWINSZ_IN_SYS_IOCTL],
+[AC_CACHE_CHECK([whether sys/ioctl.h defines TIOCGWINSZ],
+ ac_cv_sys_tiocgwinsz_in_sys_ioctl_h,
+[AC_EGREP_CPP([yes],
+ [#include <sys/types.h>
+#include <sys/ioctl.h>
+#ifdef TIOCGWINSZ
+ yes
+#endif
+],
+ ac_cv_sys_tiocgwinsz_in_sys_ioctl_h=yes)])
+])# _AC_HEADER_TIOCGWINSZ_IN_SYS_IOCTL
-# A few obsolete macros.
+# AC_HEADER_TIOCGWINSZ
+# --------------------
+# Look for a header that defines TIOCGWINSZ.
+# FIXME: Is this the proper name? Is this the proper implementation?
+# I need more help.
+AC_DEFUN([AC_HEADER_TIOCGWINSZ],
+[AC_REQUIRE([AC_SYS_POSIX_TERMIOS])dnl
+if test $ac_cv_sys_posix_termios = yes; then
+ _AC_HEADER_TIOCGWINSZ_IN_TERMIOS_H
+fi
+if test $ac_cv_sys_tiocgwinsz_in_termios_h != yes; then
+ _AC_HEADER_TIOCGWINSZ_IN_SYS_IOCTL
+ if test $ac_cv_sys_tiocgwinsz_in_sys_ioctl_h = yes; then
+ AC_DEFINE(GWINSZ_IN_SYS_IOCTL,1,
+ [Define if `TIOCGWINSZ' requires <sys/ioctl.h>])
+ fi
+fi
+])# AC_HEADER_TIOCGWINSZ
+
+# AU::AC_UNISTD_H
+# ---------------
AU_DEFUN([AC_UNISTD_H],
[AC_CHECK_HEADERS(unistd.h)])
])# AC_SYS_RESTARTABLE_SYSCALLS
+# AC_SYS_POSIX_TERMIOS
+# --------------------
+AC_DEFUN([AC_SYS_POSIX_TERMIOS],
+[AC_CACHE_CHECK([POSIX termios], ac_cv_sys_posix_termios,
+[AC_TRY_LINK([#include <sys/types.h>
+#include <unistd.h>
+@%:@include <termios.h>],
+ [/* SunOS 4.0.3 has termios.h but not the library calls. */
+ tcgetattr(0, 0);],
+ ac_cv_sys_posix_termios=yes,
+ ac_cv_sys_posix_termios=no)])
+])# AC_SYS_POSIX_TERMIOS
+
## --------------------- ##
Amdahl UTS and Motorola System V/88.
@end defmac
-@defmac AC_HEADER_TIME
-@maindex HEADER_TIME
-@cvindex TIME_WITH_SYS_TIME
-If a program may include both @file{time.h} and @file{sys/time.h},
-define @code{TIME_WITH_SYS_TIME}. On some older systems,
-@file{sys/time.h} includes @file{time.h}, but @file{time.h} is not
-protected against multiple inclusion, so programs should not explicitly
-include both files. This macro is useful in programs that use, for
-example, @code{struct timeval} or @code{struct timezone} as well as
-@code{struct tm}. It is best used in conjunction with
-@code{HAVE_SYS_TIME_H}, which can be checked for using
-@code{AC_CHECK_HEADERS(sys/time.h)}.
-
-@example
-@group
-#if TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-# include <sys/time.h>
-# else
-# include <time.h>
-# endif
-#endif
-@end group
-@end example
-@end defmac
-
-
@defmac AC_HEADER_STDC
@maindex HEADER_STDC
@end group
@end example
+@defmac AC_HEADER_TIME
+@maindex HEADER_TIME
+@cvindex TIME_WITH_SYS_TIME
+If a program may include both @file{time.h} and @file{sys/time.h},
+define @code{TIME_WITH_SYS_TIME}. On some older systems,
+@file{sys/time.h} includes @file{time.h}, but @file{time.h} is not
+protected against multiple inclusion, so programs should not explicitly
+include both files. This macro is useful in programs that use, for
+example, @code{struct timeval} or @code{struct timezone} as well as
+@code{struct tm}. It is best used in conjunction with
+@code{HAVE_SYS_TIME_H}, which can be checked for using
+@code{AC_CHECK_HEADERS(sys/time.h)}.
+
+@example
+@group
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+@end group
+@end example
+@end defmac
+
+
+@defmac AC_HEADER_TIOCGWINSZ
+@maindex HEADER_TIOCGWINSZ
+@cvindex GWINSZ_IN_SYS_IOCTL
+@c FIXME: I need clarifications from Jim.
+If the use of @code{TIOCGWINSZ} requires @file{<sys/ioctl.h>}, then
+define @code{GWINSZ_IN_SYS_IOCTL}. Otherwise @code{TIOCGWINSZ} can be
+found in @file{<termios.h>}.
+
+Use:
+
+@example
+@group
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if GWINSZ_IN_SYS_IOCTL
+# include <sys/ioctl.h>
+#endif
+@end group
+@end example
+@end defmac
@node Generic Headers, , Particular Headers, Header Files
@subsection Generic Header Checks
@code{HAVE_LONG_FILE_NAMES}.
@end defmac
+@defmac AC_SYS_POSIX_TERMIOS
+@maindex SYS_POSIX_TERMIOS
+@cindex POSIX termios headers
+@cindex termios POSIX headers
+Check to see if POSIX termios headers and functions are available on the
+system. If so, set the shell variable @code{am_cv_sys_posix_termios} to
+@samp{yes}. If not, set the variable to @samp{no}.
+@end defmac
+
@defmac AC_SYS_RESTARTABLE_SYSCALLS
@maindex SYS_RESTARTABLE_SYSCALLS
@cvindex HAVE_RESTARTABLE_SYSCALLS
])# AC_HEADER_TIME
+# _AC_HEADER_TIOCGWINSZ_IN_TERMIOS_H
+# ----------------------------------
+define([_AC_HEADER_TIOCGWINSZ_IN_TERMIOS_H],
+[AC_CACHE_CHECK([whether termios.h defines TIOCGWINSZ],
+ ac_cv_sys_tiocgwinsz_in_termios_h,
+[AC_EGREP_CPP([yes],
+ [#include <sys/types.h>
+#include <termios.h>
+#ifdef TIOCGWINSZ
+ yes
+#endif
+],
+ ac_cv_sys_tiocgwinsz_in_termios_h=yes)])
+])# _AC_HEADER_TIOCGWINSZ_IN_TERMIOS_H
+
+
+# _AC_HEADER_TIOCGWINSZ_IN_SYS_IOCTL
+# ----------------------------------
+define([_AC_HEADER_TIOCGWINSZ_IN_SYS_IOCTL],
+[AC_CACHE_CHECK([whether sys/ioctl.h defines TIOCGWINSZ],
+ ac_cv_sys_tiocgwinsz_in_sys_ioctl_h,
+[AC_EGREP_CPP([yes],
+ [#include <sys/types.h>
+#include <sys/ioctl.h>
+#ifdef TIOCGWINSZ
+ yes
+#endif
+],
+ ac_cv_sys_tiocgwinsz_in_sys_ioctl_h=yes)])
+])# _AC_HEADER_TIOCGWINSZ_IN_SYS_IOCTL
-# A few obsolete macros.
+# AC_HEADER_TIOCGWINSZ
+# --------------------
+# Look for a header that defines TIOCGWINSZ.
+# FIXME: Is this the proper name? Is this the proper implementation?
+# I need more help.
+AC_DEFUN([AC_HEADER_TIOCGWINSZ],
+[AC_REQUIRE([AC_SYS_POSIX_TERMIOS])dnl
+if test $ac_cv_sys_posix_termios = yes; then
+ _AC_HEADER_TIOCGWINSZ_IN_TERMIOS_H
+fi
+if test $ac_cv_sys_tiocgwinsz_in_termios_h != yes; then
+ _AC_HEADER_TIOCGWINSZ_IN_SYS_IOCTL
+ if test $ac_cv_sys_tiocgwinsz_in_sys_ioctl_h = yes; then
+ AC_DEFINE(GWINSZ_IN_SYS_IOCTL,1,
+ [Define if `TIOCGWINSZ' requires <sys/ioctl.h>])
+ fi
+fi
+])# AC_HEADER_TIOCGWINSZ
+
+# AU::AC_UNISTD_H
+# ---------------
AU_DEFUN([AC_UNISTD_H],
[AC_CHECK_HEADERS(unistd.h)])
])# AC_SYS_RESTARTABLE_SYSCALLS
+# AC_SYS_POSIX_TERMIOS
+# --------------------
+AC_DEFUN([AC_SYS_POSIX_TERMIOS],
+[AC_CACHE_CHECK([POSIX termios], ac_cv_sys_posix_termios,
+[AC_TRY_LINK([#include <sys/types.h>
+#include <unistd.h>
+@%:@include <termios.h>],
+ [/* SunOS 4.0.3 has termios.h but not the library calls. */
+ tcgetattr(0, 0);],
+ ac_cv_sys_posix_termios=yes,
+ ac_cv_sys_posix_termios=no)])
+])# AC_SYS_POSIX_TERMIOS
+
## --------------------- ##