From 85715008c6750676ee4b54da59e020533ea9a816 Mon Sep 17 00:00:00 2001 From: David MacKenzie Date: Sat, 1 Oct 1994 23:13:28 +0000 Subject: [PATCH] undo typedef rename; add macro from paul eggert --- NEWS | 3 ++- TODO | 5 ----- acconfig.h | 3 +++ acgeneral.m4 | 4 ++-- acheaders | 1 + acspecific.m4 | 28 ++++++++++++++++++++++++---- autoconf.texi | 30 ++++++++++++++++++++++++++++-- doc/autoconf.texi | 30 ++++++++++++++++++++++++++++-- lib/autoconf/general.m4 | 4 ++-- lib/autoconf/specific.m4 | 28 ++++++++++++++++++++++++---- lib/autoscan/headers | 1 + 11 files changed, 115 insertions(+), 22 deletions(-) diff --git a/NEWS b/NEWS index e1faabf0..98d76aff 100644 --- a/NEWS +++ b/NEWS @@ -49,7 +49,7 @@ Major changes in release 2.0: * AC_ARG_PROGRAM, which uses the options --program-prefix, --program-suffix, and --program-transform-name to change the names of programs being installed. -* AC_CHECK_TYPEDEF, which checks whether sys/types.h defines a given type. +* AC_CHECK_TYPE, which checks whether sys/types.h defines a given type. * AC_CHECK_LIB, which checks for a particular function in a library. * AC_MSG_CHECKING and AC_MSG_RESULT to print test results, on a single line, whether or not the test succeeds. They obsolete AC_CHECKING and AC_VERBOSE. @@ -57,6 +57,7 @@ Major changes in release 2.0: * AC_FUNC_MEMCMP, to check whether memcmp is 8-bit clean. * AC_FUNC_STRFTIME, to find strftime even if it's in -lintl. * AC_FUNC_GETMNTENT, to find getmntent even if it's in -lsun or -lseq. +* AC_HEADER_SYS_WAIT, to check whether sys/wait.h is POSIX.1 compatible. ** Changed macros: * Many macros renamed systematically, but old names are accepted for diff --git a/TODO b/TODO index 294a9224..cdd17335 100644 --- a/TODO +++ b/TODO @@ -49,11 +49,6 @@ Things it might be nice to do someday: ------------------------------------------------------------------------------ -* Make autoconf diagnose giving too few or too many arguments to macros. -Maybe even use a scheme that supports naming the formals. - ------------------------------------------------------------------------------- - * Split up AC_SUBST substitutions using a loop to accomodate shells with severely limited here document sizes, if it turns out to be a problem. I'm not sure whether the limit is on lines or bytes; if bytes, it diff --git a/acconfig.h b/acconfig.h index a43655bb..801a8ac8 100644 --- a/acconfig.h +++ b/acconfig.h @@ -96,6 +96,9 @@ /* Define if you have the strftime function. */ #undef HAVE_STRFTIME +/* Define if you have that is POSIX.1 compatible. */ +#undef HAVE_SYS_WAIT_H + /* Define if your struct tm has tm_zone. */ #undef HAVE_TM_ZONE diff --git a/acgeneral.m4 b/acgeneral.m4 index 951e6070..17f47126 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -1449,8 +1449,8 @@ undefine([AC_CV_NAME])dnl dnl ### Checking for typedefs -dnl AC_CHECK_TYPEDEF(TYPE, DEFAULT) -AC_DEFUN(AC_CHECK_TYPEDEF, +dnl AC_CHECK_TYPE(TYPE, DEFAULT) +AC_DEFUN(AC_CHECK_TYPE, [AC_REQUIRE([AC_HEADER_STDC])dnl AC_MSG_CHECKING(for $1) AC_CACHE_VAL(ac_cv_type_$1, diff --git a/acheaders b/acheaders index 5b556804..0363a38a 100644 --- a/acheaders +++ b/acheaders @@ -10,6 +10,7 @@ stdlib.h AC_HEADER_STDC stddef.h AC_HEADER_STDC stdarg.h AC_HEADER_STDC float.h AC_HEADER_STDC +sys/wait.h AC_HEADER_SYS_WAIT X11/Xlib.h AC_PATH_X # Others. diff --git a/acspecific.m4 b/acspecific.m4 index 53553660..924e55cd 100644 --- a/acspecific.m4 +++ b/acspecific.m4 @@ -602,6 +602,26 @@ if test $ac_cv_decl_sys_siglist = yes; then fi ]) +AC_DEFUN(AC_HEADER_SYS_WAIT, +[AC_MSG_CHECKING([for sys/wait.h that is POSIX.1 compatible]) +AC_CACHE_VAL(ac_cv_header_sys_wait_h, +[AC_TRY_LINK([#include +#include +#ifndef WEXITSTATUS +#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) +#endif +#ifndef WIFEXITED +#define WIFEXITED(stat_val) (((stat_val) & 255) == 0) +#endif], [int s; +wait (&s); +s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;], +ac_cv_header_sys_wait_h=yes, ac_cv_header_sys_wait_h=no)])dnl +AC_MSG_RESULT($ac_cv_header_sys_wait_h) +if test $ac_cv_header_sys_wait_h = yes; then + AC_DEFINE(HAVE_SYS_WAIT_H) +fi +]) + dnl ### Checks for typedefs @@ -661,16 +681,16 @@ fi ]) AC_DEFUN(AC_TYPE_SIZE_T, -[AC_CHECK_TYPEDEF(size_t, unsigned)]) +[AC_CHECK_TYPE(size_t, unsigned)]) AC_DEFUN(AC_TYPE_PID_T, -[AC_CHECK_TYPEDEF(pid_t, int)]) +[AC_CHECK_TYPE(pid_t, int)]) AC_DEFUN(AC_TYPE_OFF_T, -[AC_CHECK_TYPEDEF(off_t, long)]) +[AC_CHECK_TYPE(off_t, long)]) AC_DEFUN(AC_TYPE_MODE_T, -[AC_CHECK_TYPEDEF(mode_t, int)]) +[AC_CHECK_TYPE(mode_t, int)]) dnl Note that identifiers starting with SIG are reserved by ANSI C. AC_DEFUN(AC_TYPE_SIGNAL, diff --git a/autoconf.texi b/autoconf.texi index 55f3d78a..3826ed32 100644 --- a/autoconf.texi +++ b/autoconf.texi @@ -2000,6 +2000,32 @@ for example, put it in @file{memchr.c} and use @samp{AC_REPLACE_FUNCS(memchr)}. @end defmac +@defmac AC_HEADER_SYS_WAIT +@maindex HEADER_SYS_WAIT +@cvindex HAVE_SYS_WAIT_H +If @file{sys/wait.h} exists and is compatible with POSIX.1, define +@code{HAVE_SYS_WAIT_H}. Incompatibility can occur if @file{sys/wait.h} +does not exist, or if it uses the old BSD @code{union wait} instead of +@code{int} to store a status value. If @file{sys/wait.h} is not POSIX.1 +compatible, then instead of including it, define the POSIX.1 macros with +their usual interpretations. Here is an example: + +@example +@group +#include +#if HAVE_SYS_WAIT_H +#include +#endif +#ifndef WEXITSTATUS +#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) +#endif +#ifndef WIFEXITED +#define WIFEXITED(stat_val) (((stat_val) & 255) == 0) +#endif +@end group +@end example +@end defmac + @defmac AC_MEMORY_H @maindex MEMORY_H @cvindex NEED_MEMORY_H @@ -2248,8 +2274,8 @@ If @code{uid_t} is not defined in @file{sys/types.h}, define This macro is used to check for typedefs not covered by the particular test macros. -@defmac AC_CHECK_TYPEDEF (@var{type}, @var{default}) -@maindex CHECK_TYPEDEF +@defmac AC_CHECK_TYPE (@var{type}, @var{default}) +@maindex CHECK_TYPE If the type @var{type} is not defined in @file{sys/types.h} or @file{stdlib.h} (if that is present), define it to be the C (or C++) builtin type @var{default}; e.g., @samp{short} or @samp{unsigned}. diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 55f3d78a..3826ed32 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -2000,6 +2000,32 @@ for example, put it in @file{memchr.c} and use @samp{AC_REPLACE_FUNCS(memchr)}. @end defmac +@defmac AC_HEADER_SYS_WAIT +@maindex HEADER_SYS_WAIT +@cvindex HAVE_SYS_WAIT_H +If @file{sys/wait.h} exists and is compatible with POSIX.1, define +@code{HAVE_SYS_WAIT_H}. Incompatibility can occur if @file{sys/wait.h} +does not exist, or if it uses the old BSD @code{union wait} instead of +@code{int} to store a status value. If @file{sys/wait.h} is not POSIX.1 +compatible, then instead of including it, define the POSIX.1 macros with +their usual interpretations. Here is an example: + +@example +@group +#include +#if HAVE_SYS_WAIT_H +#include +#endif +#ifndef WEXITSTATUS +#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) +#endif +#ifndef WIFEXITED +#define WIFEXITED(stat_val) (((stat_val) & 255) == 0) +#endif +@end group +@end example +@end defmac + @defmac AC_MEMORY_H @maindex MEMORY_H @cvindex NEED_MEMORY_H @@ -2248,8 +2274,8 @@ If @code{uid_t} is not defined in @file{sys/types.h}, define This macro is used to check for typedefs not covered by the particular test macros. -@defmac AC_CHECK_TYPEDEF (@var{type}, @var{default}) -@maindex CHECK_TYPEDEF +@defmac AC_CHECK_TYPE (@var{type}, @var{default}) +@maindex CHECK_TYPE If the type @var{type} is not defined in @file{sys/types.h} or @file{stdlib.h} (if that is present), define it to be the C (or C++) builtin type @var{default}; e.g., @samp{short} or @samp{unsigned}. diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index 951e6070..17f47126 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -1449,8 +1449,8 @@ undefine([AC_CV_NAME])dnl dnl ### Checking for typedefs -dnl AC_CHECK_TYPEDEF(TYPE, DEFAULT) -AC_DEFUN(AC_CHECK_TYPEDEF, +dnl AC_CHECK_TYPE(TYPE, DEFAULT) +AC_DEFUN(AC_CHECK_TYPE, [AC_REQUIRE([AC_HEADER_STDC])dnl AC_MSG_CHECKING(for $1) AC_CACHE_VAL(ac_cv_type_$1, diff --git a/lib/autoconf/specific.m4 b/lib/autoconf/specific.m4 index 53553660..924e55cd 100644 --- a/lib/autoconf/specific.m4 +++ b/lib/autoconf/specific.m4 @@ -602,6 +602,26 @@ if test $ac_cv_decl_sys_siglist = yes; then fi ]) +AC_DEFUN(AC_HEADER_SYS_WAIT, +[AC_MSG_CHECKING([for sys/wait.h that is POSIX.1 compatible]) +AC_CACHE_VAL(ac_cv_header_sys_wait_h, +[AC_TRY_LINK([#include +#include +#ifndef WEXITSTATUS +#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) +#endif +#ifndef WIFEXITED +#define WIFEXITED(stat_val) (((stat_val) & 255) == 0) +#endif], [int s; +wait (&s); +s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;], +ac_cv_header_sys_wait_h=yes, ac_cv_header_sys_wait_h=no)])dnl +AC_MSG_RESULT($ac_cv_header_sys_wait_h) +if test $ac_cv_header_sys_wait_h = yes; then + AC_DEFINE(HAVE_SYS_WAIT_H) +fi +]) + dnl ### Checks for typedefs @@ -661,16 +681,16 @@ fi ]) AC_DEFUN(AC_TYPE_SIZE_T, -[AC_CHECK_TYPEDEF(size_t, unsigned)]) +[AC_CHECK_TYPE(size_t, unsigned)]) AC_DEFUN(AC_TYPE_PID_T, -[AC_CHECK_TYPEDEF(pid_t, int)]) +[AC_CHECK_TYPE(pid_t, int)]) AC_DEFUN(AC_TYPE_OFF_T, -[AC_CHECK_TYPEDEF(off_t, long)]) +[AC_CHECK_TYPE(off_t, long)]) AC_DEFUN(AC_TYPE_MODE_T, -[AC_CHECK_TYPEDEF(mode_t, int)]) +[AC_CHECK_TYPE(mode_t, int)]) dnl Note that identifiers starting with SIG are reserved by ANSI C. AC_DEFUN(AC_TYPE_SIGNAL, diff --git a/lib/autoscan/headers b/lib/autoscan/headers index 5b556804..0363a38a 100644 --- a/lib/autoscan/headers +++ b/lib/autoscan/headers @@ -10,6 +10,7 @@ stdlib.h AC_HEADER_STDC stddef.h AC_HEADER_STDC stdarg.h AC_HEADER_STDC float.h AC_HEADER_STDC +sys/wait.h AC_HEADER_SYS_WAIT X11/Xlib.h AC_PATH_X # Others.