autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fix for AC_HEADER_MAJOR for glibc + non-gcc


From: Akim Demaille
Subject: Re: Fix for AC_HEADER_MAJOR for glibc + non-gcc
Date: 10 Oct 2001 15:14:03 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence)

Hi Pavel,

Thanks for the patch.  This is the kind of patch which I would really
love to see approved by Jim or Paul.  Also, please, do not hesitate to
create new entries in the `function portability' sections.  It's a
pity the code is more documented than the documentation itself.

| Hello!
| I'm experimenting with lcc and TenDRA (non-gcc compilers) on GNU/Linux.
| They basically work, but Autoconf is very "pessimistic" about their
| abilities.  It would be nice to improve their support, so that gcc-isms
| can be easily found without using other OS'es and non-free compilers.
| That's the first thing I found.
| 
| Glibc-2.2.4 defines makedev as an array for compilers other than gcc:
| 
|    The problem here is that compilers other than GCC probably don't
|    have the `long long' type and so `dev_t' is actually an array.
| ...
| #  define makedev(major, minor) { ((((unsigned int) (major)) << 8) \
|                                    | ((unsigned int) (minor))), 0 }
| 
| Obviously, "return" is invalid before the array.  What is supposed to work
| is something like:
| 
| dev_t d = makedev(0, 0);
| return major(d) + minor(d);
| 
| This also checks that major() and minor() are defined.  It should be save
| to assume that dev_t is defined if makedev() is defined.
| 
| ChangeLog:
|       * lib/autoconf/headers.m4 (AC_HEADER_MAJOR): Use makedev() in the
|       variable declaration because it may be an array initializer.
|       Check that major() and minor() work with sys/types.h.
| 
| ---------------------------
| --- lib/autoconf/headers.m4
| +++ lib/autoconf/headers.m4
| @@ -250,11 +250,15 @@
| 
|  # AC_HEADER_MAJOR
|  # ---------------
| +# glibc defines makedev as an array if long long is not supported.
| +# Be careful to use makedev in the variable declaration.
|  AC_DEFUN([AC_HEADER_MAJOR],
|  [AC_CACHE_CHECK(whether sys/types.h defines makedev,
|                  ac_cv_header_sys_types_h_makedev,
|  [AC_LINK_IFELSE([AC_LANG_PROGRAM(address@hidden:@include <sys/types.h>]],
| -                                 [[return makedev(0, 0);]])],
| +                                 [[dev_t d = makedev(0, 0);
| +return major(d) + minor(d);
| +]])],
|                  [ac_cv_header_sys_types_h_makedev=yes],
|                  [ac_cv_header_sys_types_h_makedev=no])
|  ])
| ---------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]