autoconf-patches
[Top][All Lists]
Advanced

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

Fix for AC_HEADER_MAJOR for glibc + non-gcc


From: Pavel Roskin
Subject: Fix for AC_HEADER_MAJOR for glibc + non-gcc
Date: Sun, 30 Sep 2001 22:39:04 -0400 (EDT)

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])
 ])
---------------------------

-- 
Regards,
Pavel Roskin




reply via email to

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