]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* acgeneral.m4 (_AC_CHECK_TYPE_BUILTIN_P): Add `off_t' and
authorAkim Demaille <akim@epita.fr>
Mon, 24 Jul 2000 06:54:53 +0000 (06:54 +0000)
committerAkim Demaille <akim@epita.fr>
Mon, 24 Jul 2000 06:54:53 +0000 (06:54 +0000)
`size_t' which are often used too.
Fix a bug which prevents recognition of `bool' and `char'.
(_AC_CHECK_TYPE_MAYBE_TYPE_P): New macro.
(AC_CHECK_TYPE): Use it.

ChangeLog
acgeneral.m4
doc/autoconf.texi
lib/autoconf/general.m4

index 82f7a525fddcaa51435a416b62a4bab35778de73..85da98ee674f9977f3376f5a2d60604fc9419f38 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2000-07-24  Akim Demaille  <akim@epita.fr>
+
+       * acgeneral.m4 (_AC_CHECK_TYPE_BUILTIN_P): Add `off_t' and
+       `size_t' which are often used too.
+       Fix a bug which prevents recognition of `bool' and `char'.
+       (_AC_CHECK_TYPE_MAYBE_TYPE_P): New macro.
+       (AC_CHECK_TYPE): Use it.
+
 2000-07-19  Peter Eisentraut  <peter_e@gmx.net>
 
        * Makefile.am: Remove INSTALL.txt by maintainer-clean target.
index 5b26dd77221fbdda6a5b436652875a62e4807308..cbc4766a78a5db8345d60254727f698b97af1431 100644 (file)
@@ -3744,16 +3744,28 @@ define([_AC_CHECK_TYPE_OLD],
 ])# _AC_CHECK_TYPE_OLD
 
 
-# _AC_CHECK_TYPE_BUILTIN_P(STRING)
-# --------------------------------
+# _AC_CHECK_TYPE_REPLACEMENT_TYPE_P(STRING)
+# -----------------------------------------
 # Return `1' if STRING seems to be a builtin C/C++ type, i.e., if it
 # starts with `_Bool', `bool', `char', `double', `float', `int',
 # `long', `short', `signed', or `unsigned' followed by characters
 # that are defining types.
-define([_AC_CHECK_TYPE_BUILTIN_P],
-[ifelse(regexp([$1], [^\(_Bool\|bool|\char\|double\|float\|int\|long\|short\|\(un\)?signed\)\([_a-zA-Z0-9() *]\|\[\|\]\)*$]),
+# Because many people have used `off_t' and `size_t' too, they are added
+# for better common-useward backward compatibility.
+define([_AC_CHECK_TYPE_REPLACEMENT_TYPE_P],
+[ifelse(regexp([$1],
+               [^\(_Bool\|bool\|char\|double\|float\|int\|long\|short\|\(un\)?signed\|size_t\|off_t\)\([_a-zA-Z0-9() *]\|\[\|\]\)*$]),
+       0, 1, 0)dnl
+])# _AC_CHECK_TYPE_REPLACEMENT_TYPE_P
+
+
+# _AC_CHECK_TYPE_MAYBE_TYPE_P(STRING)
+# -----------------------------------
+# Return `1' if STRING looks like a C/C++ type.
+define([_AC_CHECK_TYPE_MAYBE_TYPE_P],
+[ifelse(regexp([$1], [^[_a-zA-Z0-9 ]+\([_a-zA-Z0-9() *]\|\[\|\]\)*$]),
        0, 1, 0)dnl
-])# _AC_CHECK_TYPE_BUILTIN_P
+])# _AC_CHECK_TYPE_MAYBE_TYPE_P
 
 
 # AC_CHECK_TYPE(TYPE, DEFAULT)
@@ -3764,15 +3776,20 @@ define([_AC_CHECK_TYPE_BUILTIN_P],
 # -------------------------------------------------------
 #
 # Dispatch respectively to _AC_CHECK_TYPE_OLD or _AC_CHECK_TYPE_NEW.
-# 1. More than two arguments     => NEW
-# 2. $2 seems to be builtin type => OLD
-# 3. $2 seems to be a type       => NEW plus a warning
-# 4. default                     => NEW
+# 1. More than two arguments         => NEW
+# 2. $2 seems to be replacement type => OLD
+#    See _AC_CHECK_TYPE_REPLACEMENT_TYPE_P for `replacement type'.
+# 3. $2 seems to be a type           => NEW plus a warning
+# 4. default                         => NEW
 AC_DEFUN([AC_CHECK_TYPE],
-[ifelse($#, 3, [_AC_CHECK_TYPE_NEW($@)],
-        $#, 4, [_AC_CHECK_TYPE_NEW($@)],
-        _AC_CHECK_TYPE_BUILTIN_P([$2]), 1, [_AC_CHECK_TYPE_OLD($@)],
-        regexp([$2], [^[_a-zA-Z0-9 ]+\([_a-zA-Z0-9() *]\|\[\|\]\)*$]), 0, [m4_warn([$0: assuming `$2' is not a type])_AC_CHECK_TYPE_NEW($@)],
+[ifelse($#, 3,
+           [_AC_CHECK_TYPE_NEW($@)],
+        $#, 4,
+           [_AC_CHECK_TYPE_NEW($@)],
+        _AC_CHECK_TYPE_REPLACEMENT_TYPE_P([$2]), 1,
+           [_AC_CHECK_TYPE_OLD($@)],
+        _AC_CHECK_TYPE_MAYBE_TYPE_P([$2]), 1,
+           [m4_warn([$0: assuming `$2' is not a type])_AC_CHECK_TYPE_NEW($@)],
         [_AC_CHECK_TYPE_NEW($@)])[]dnl
 ])# AC_CHECK_TYPE
 
index fd6dece32eb15f3bba4f6682ded14edcfc0cfe5a..5d931746c615aad59a43c6576f99399224008e43 100644 (file)
@@ -3778,9 +3778,8 @@ AC_CHECK_TYPES([unsigned long long, uintmax_t])
 Autoconf, up to 2.13, used to provide to another version of
 @code{AC_CHECK_TYPE}, broken by design.  In order to keep backward
 compatibility, a simple heuristics, quite safe but not totally, is
-implemented.  In case of doubt, the reader is strongly encouraged to
-read the documentation of the former @code{AC_CHECK_TYPE}, see
-@ref{Obsolete Macros}.
+implemented.  In case of doubt, read the documentation of the former
+@code{AC_CHECK_TYPE}, see @ref{Obsolete Macros}.
 
 
 @node Compilers and Preprocessors, C Compiler Characteristics, Types, Existing Tests
@@ -7863,11 +7862,12 @@ The user is encouraged to explicitly use either
 
 @defmac AC_CHECK_TYPE (@var{type}, @var{default})
 @maindex CHECK_TYPE
-Autoconf, up to 2.13, used to provide to this version of
-@code{AC_CHECK_TYPE}, broken by design.  First, although it is a member
-of the @code{CHECK} clan, singular sub-family, it does more than just
-checking.  Second, missing types are not typedef'd, they are defined,
-which can lead to incompatible code in the case of pointer types.
+Autoconf, up to 2.13, used to provide this version of
+@code{AC_CHECK_TYPE} deprecated because of it flaws.  Firstly, although
+it is a member of the @code{CHECK} clan, singular sub-family, it does
+more than just checking.  Second, missing types are not
+@code{typedef}'d, they are @code{#define}'d, which can lead to
+incompatible code in the case of pointer types.
 
 This use of @code{AC_CHECK_TYPE} is obsolete and discouraged, see
 @ref{Generic Types}, for the description of the current macro.
@@ -7875,43 +7875,39 @@ This use of @code{AC_CHECK_TYPE} is obsolete and discouraged, see
 If the type @var{type} is not defined, define it to be the C (or C++)
 builtin type @var{default}; e.g., @samp{short} or @samp{unsigned}.
 
-This macro is equivalent to
+This macro is equivalent to:
+
 @example
 AC_CHECK_TYPE([@var{type}],
               [AC_DEFINE([@var{type}], [@var{default}],
                          [Define to `@var{default}' if <sys/types.h>
                           does not define.])])
 @end example
+
 In order to keep backward compatibility, the two versions of
 @code{AC_CHECK_TYPE} are implemented, selected by a simple heuristics:
-@itemize @bullet
-@item
-if there are three or four arguments, the modern version is used;
 
+@enumerate
 @item
-if the second argument is a C or C++ @strong{builtin} type, then the
-obsolete version is used;
+If there are three or four arguments, the modern version is used.
 
 @item
-if the second argument is spelled with the alphabet of valid C and C++
-types, the user is warned and the modern version is used;
+If the second argument is a C or C++ @emph{builtin} type, then the
+obsolete version is used.  Because many people have used @samp{off_t}
+and @samp{size_t} as replacement types, they are recognized too.
 
 @item
-otherwise, the modern version is used.
-@end itemize
+If the second argument is spelled with the alphabet of valid C and C++
+types, the user is warned and the modern version is used.
 
-@noindent
-In particular, the following code, which was invalid but functional:
-
-@example
-AC_CHECK_TYPE(loff_t, off_t)
-@end example
+@item
+Otherwise, the modern version is used.
+@end enumerate
 
 @noindent
-will be improperly branched to the modern implementation.  You are
-encouraged either to use a valid builtin type, or to use the equivalent
-modern code (see above), or better yet, to use @code{AC_CHECK_TYPES}
-together with
+You are encouraged either to use a valid builtin type, or to use the
+equivalent modern code (see above), or better yet, to use
+@code{AC_CHECK_TYPES} together with
 
 @example
 #if !HAVE_LOFF_T
index 5b26dd77221fbdda6a5b436652875a62e4807308..cbc4766a78a5db8345d60254727f698b97af1431 100644 (file)
@@ -3744,16 +3744,28 @@ define([_AC_CHECK_TYPE_OLD],
 ])# _AC_CHECK_TYPE_OLD
 
 
-# _AC_CHECK_TYPE_BUILTIN_P(STRING)
-# --------------------------------
+# _AC_CHECK_TYPE_REPLACEMENT_TYPE_P(STRING)
+# -----------------------------------------
 # Return `1' if STRING seems to be a builtin C/C++ type, i.e., if it
 # starts with `_Bool', `bool', `char', `double', `float', `int',
 # `long', `short', `signed', or `unsigned' followed by characters
 # that are defining types.
-define([_AC_CHECK_TYPE_BUILTIN_P],
-[ifelse(regexp([$1], [^\(_Bool\|bool|\char\|double\|float\|int\|long\|short\|\(un\)?signed\)\([_a-zA-Z0-9() *]\|\[\|\]\)*$]),
+# Because many people have used `off_t' and `size_t' too, they are added
+# for better common-useward backward compatibility.
+define([_AC_CHECK_TYPE_REPLACEMENT_TYPE_P],
+[ifelse(regexp([$1],
+               [^\(_Bool\|bool\|char\|double\|float\|int\|long\|short\|\(un\)?signed\|size_t\|off_t\)\([_a-zA-Z0-9() *]\|\[\|\]\)*$]),
+       0, 1, 0)dnl
+])# _AC_CHECK_TYPE_REPLACEMENT_TYPE_P
+
+
+# _AC_CHECK_TYPE_MAYBE_TYPE_P(STRING)
+# -----------------------------------
+# Return `1' if STRING looks like a C/C++ type.
+define([_AC_CHECK_TYPE_MAYBE_TYPE_P],
+[ifelse(regexp([$1], [^[_a-zA-Z0-9 ]+\([_a-zA-Z0-9() *]\|\[\|\]\)*$]),
        0, 1, 0)dnl
-])# _AC_CHECK_TYPE_BUILTIN_P
+])# _AC_CHECK_TYPE_MAYBE_TYPE_P
 
 
 # AC_CHECK_TYPE(TYPE, DEFAULT)
@@ -3764,15 +3776,20 @@ define([_AC_CHECK_TYPE_BUILTIN_P],
 # -------------------------------------------------------
 #
 # Dispatch respectively to _AC_CHECK_TYPE_OLD or _AC_CHECK_TYPE_NEW.
-# 1. More than two arguments     => NEW
-# 2. $2 seems to be builtin type => OLD
-# 3. $2 seems to be a type       => NEW plus a warning
-# 4. default                     => NEW
+# 1. More than two arguments         => NEW
+# 2. $2 seems to be replacement type => OLD
+#    See _AC_CHECK_TYPE_REPLACEMENT_TYPE_P for `replacement type'.
+# 3. $2 seems to be a type           => NEW plus a warning
+# 4. default                         => NEW
 AC_DEFUN([AC_CHECK_TYPE],
-[ifelse($#, 3, [_AC_CHECK_TYPE_NEW($@)],
-        $#, 4, [_AC_CHECK_TYPE_NEW($@)],
-        _AC_CHECK_TYPE_BUILTIN_P([$2]), 1, [_AC_CHECK_TYPE_OLD($@)],
-        regexp([$2], [^[_a-zA-Z0-9 ]+\([_a-zA-Z0-9() *]\|\[\|\]\)*$]), 0, [m4_warn([$0: assuming `$2' is not a type])_AC_CHECK_TYPE_NEW($@)],
+[ifelse($#, 3,
+           [_AC_CHECK_TYPE_NEW($@)],
+        $#, 4,
+           [_AC_CHECK_TYPE_NEW($@)],
+        _AC_CHECK_TYPE_REPLACEMENT_TYPE_P([$2]), 1,
+           [_AC_CHECK_TYPE_OLD($@)],
+        _AC_CHECK_TYPE_MAYBE_TYPE_P([$2]), 1,
+           [m4_warn([$0: assuming `$2' is not a type])_AC_CHECK_TYPE_NEW($@)],
         [_AC_CHECK_TYPE_NEW($@)])[]dnl
 ])# AC_CHECK_TYPE