Re: AC_TYPE_UINT8_T and co

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

 



On Wed, May 30, 2007 at 02:48:12PM +0200, Stepan Kasal wrote:
> And yes, it sounds inconsistent.  IMVHO the ac_cv_c_ prefix should be
> changed to ac_cv_type_ here.  What do others think?

I think that

- changing ac_cv_c_ to ac_cv_type_ and
- changing AC_CHECK_TYPES to test for ac_cv_type_ != no rather than = yes

would then make

AC_TYPE_INT64_T
AC_CHECK_TYPES([int64_t])

work as I would expect - if that is what it intended(!) In my ficticious
long long int exists, but not int64_t case:

AC_TYPE_INT64_T doesn't find int64_t, so #defines it to long long int, and
sets ac_cv_type_int64_t='long long int'.

AC_CHECK_TYPES does a AC_CACHE_CHECK for ac_cv_type_int64_t which
is not "no" so HAVE_INT64_T is defined, and I can happily use
#ifdef HAVE_INT64_T in my example.

How does that sound?


Cheers,

Patrick
Index: types.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/types.m4,v
retrieving revision 1.53
diff -u -r1.53 types.m4
--- types.m4	29 May 2007 11:46:30 -0000	1.53
+++ types.m4	30 May 2007 17:08:25 -0000
@@ -160,7 +160,7 @@
 	  return 0;])],
      [],
      [AS_VAR_SET([ac_Type], [yes])])])])
-AS_IF([test AS_VAR_GET([ac_Type]) = yes], [$2], [$3])[]dnl
+AS_IF([test AS_VAR_GET([ac_Type]) != no], [$2], [$3])[]dnl
 AS_VAR_POPDEF([ac_Type])dnl
 ])# _AC_CHECK_TYPE_NEW
 
@@ -612,8 +612,8 @@
 # -------------------
 AC_DEFUN([_AC_TYPE_INT],
 [
-  AC_CACHE_CHECK([for int$1_t], [ac_cv_c_int$1_t],
-    [ac_cv_c_int$1_t=no
+  AC_CACHE_CHECK([for int$1_t], [ac_cv_type_int$1_t],
+    [ac_cv_type_int$1_t=no
      for ac_type in 'int$1_t' 'int' 'long int' \
 	 'long long int' 'short int' 'signed char'; do
        AC_COMPILE_IFELSE(
@@ -627,14 +627,14 @@
 	         < ($ac_type) (((($ac_type) 1 << ($1 - 2)) - 1) * 2 + 2)]])],
 	    [],
 	    [AS_CASE([$ac_type], [int$1_t],
-	       [ac_cv_c_int$1_t=yes],
-	       [ac_cv_c_int$1_t=$ac_type])])])
-       test "$ac_cv_c_int$1_t" != no && break
+	       [ac_cv_type_int$1_t=yes],
+	       [ac_cv_type_int$1_t=$ac_type])])])
+       test "$ac_cv_type_int$1_t" != no && break
      done])
-  case $ac_cv_c_int$1_t in #(
+  case $ac_cv_type_int$1_t in #(
   no|yes) ;; #(
   *)
-    AC_DEFINE_UNQUOTED([int$1_t], [$ac_cv_c_int$1_t],
+    AC_DEFINE_UNQUOTED([int$1_t], [$ac_cv_type_int$1_t],
       [Define to the type of a signed integer type of width exactly $1 bits
        if such a type exists and the standard includes do not define it.]);;
   esac
@@ -644,8 +644,8 @@
 # ----------------------------
 AC_DEFUN([_AC_TYPE_UNSIGNED_INT],
 [
-  AC_CACHE_CHECK([for uint$1_t], [ac_cv_c_uint$1_t],
-    [ac_cv_c_uint$1_t=no
+  AC_CACHE_CHECK([for uint$1_t], [ac_cv_type_uint$1_t],
+    [ac_cv_type_uint$1_t=no
      for ac_type in 'uint$1_t' 'unsigned int' 'unsigned long int' \
 	 'unsigned long long int' 'unsigned short int' 'unsigned char'; do
        AC_COMPILE_IFELSE(
@@ -653,11 +653,11 @@
 	    [AC_INCLUDES_DEFAULT],
 	    [[($ac_type) -1 >> ($1 - 1) == 1]])],
 	 [AS_CASE([$ac_type], [uint$1_t],
-	    [ac_cv_c_uint$1_t=yes],
-	    [ac_cv_c_uint$1_t=$ac_type])])
-       test "$ac_cv_c_uint$1_t" != no && break
+	    [ac_cv_type_uint$1_t=yes],
+	    [ac_cv_type_uint$1_t=$ac_type])])
+       test "$ac_cv_type_uint$1_t" != no && break
      done])
-  case $ac_cv_c_uint$1_t in #(
+  case $ac_cv_type_uint$1_t in #(
   no|yes) ;; #(
   *)
     m4_bmatch([$1], [^\(8\|32\|64\)$],
@@ -666,7 +666,7 @@
 	  <sys/synch.h>, <pthread.h>, or <semaphore.h> is not used.
 	  If the typedef were allowed, the #define below would cause a
 	  syntax error.])])
-    AC_DEFINE_UNQUOTED([uint$1_t], [$ac_cv_c_uint$1_t],
+    AC_DEFINE_UNQUOTED([uint$1_t], [$ac_cv_type_uint$1_t],
       [Define to the type of an unsigned integer type of width exactly $1 bits
        if such a type exists and the standard includes do not define it.]);;
   esac
_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux