From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7838 invoked by alias); 4 Sep 2009 10:36:58 -0000 Received: (qmail 7830 invoked by uid 22791); 4 Sep 2009 10:36:57 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-ew0-f226.google.com (HELO mail-ew0-f226.google.com) (209.85.219.226) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 04 Sep 2009 10:36:49 +0000 Received: by ewy26 with SMTP id 26so708801ewy.29 for ; Fri, 04 Sep 2009 03:36:46 -0700 (PDT) Received: by 10.216.7.81 with SMTP id 59mr832216weo.219.1252060606476; Fri, 04 Sep 2009 03:36:46 -0700 (PDT) Received: from yakj.usersys.redhat.com (nat-pool-brq.redhat.com [62.40.79.66]) by mx.google.com with ESMTPS id i6sm2789759gve.7.2009.09.04.03.36.44 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 04 Sep 2009 03:36:45 -0700 (PDT) Message-ID: <4AA0EDBB.6020606@gnu.org> Date: Fri, 04 Sep 2009 10:36:00 -0000 From: Paolo Bonzini User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.1) Gecko/20090814 Fedora/3.0-2.6.b3.fc11 Lightning/1.0pre Thunderbird/3.0b3 MIME-Version: 1.0 To: Richard Guenther CC: Kai Tietz , GCC Patches , Richard Henderson , Ralf Wildenhues Subject: Re: [patch]: Add check for stdint header References: <90baa01f0909021518w469a8991ga54bacf8f7df68f9@mail.gmail.com> <84fc9c000909030355r6843e245j5f5290b021d4ec0e@mail.gmail.com> <90baa01f0909030405q77ba38b0ibb0eebc8c3b560a4@mail.gmail.com> <84fc9c000909030409u2fc11f7fs5c9d4fe60dd7c6a1@mail.gmail.com> <90baa01f0909040049k36a03c4s5ae3a65d3d9153d0@mail.gmail.com> <84fc9c000909040257r44566fc7ra3ff886701d57edd@mail.gmail.com> In-Reply-To: <84fc9c000909040257r44566fc7ra3ff886701d57edd@mail.gmail.com> Content-Type: multipart/mixed; boundary="------------050600020204080503030204" Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2009-09/txt/msg00349.txt.bz2 This is a multi-part message in MIME format. --------------050600020204080503030204 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 969 > I suppose the explicit check for stdint.h is not necessary and you need to > cover for the case where inttypes.h provides the required definition. See > the autoconf manual which says > > -- Macro: AC_TYPE_INTPTR_T > If `stdint.h' or `inttypes.h' defines the type `intptr_t', define > `HAVE_INTPTR_T'. Otherwise, define `intptr_t' to a signed integer > type wide enough to hold a pointer, if such a type exists. > > I don't know what the canonical header inclusion case to use would be > though. Maybe Ralf knows. Since we now use Autoconf 2.64, you could also try the attached rewritten stdint.m4. stdint.m4 | 510 ++++-------------------------------------------------- 1 file changed, 39 insertions(+), 471 deletions(-) :-) You can use GCC_STDINT_TYPES (new in this version) instead of GCC_HEADER_STDINT since GCC does not need int_leastNN_t and int_fastNN_t. Bonus points for using GCC_STDINT_TYPES elsewhere in the tree. Paolo --------------050600020204080503030204 Content-Type: text/plain; name="stdint.m4" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="stdint.m4" Content-length: 2584 AC_DEFUN([GCC_STDINT_TYPES], [AC_REQUIRE([AC_TYPE_INT8_T]) AC_REQUIRE([AC_TYPE_INT16_T]) AC_REQUIRE([AC_TYPE_INT32_T]) AC_REQUIRE([AC_TYPE_INT64_T]) AC_REQUIRE([AC_TYPE_INTMAX_T]) AC_REQUIRE([AC_TYPE_INTPTR_T]) AC_REQUIRE([AC_TYPE_UINT8_T]) AC_REQUIRE([AC_TYPE_UINT16_T]) AC_REQUIRE([AC_TYPE_UINT32_T]) AC_REQUIRE([AC_TYPE_UINT64_T]) AC_REQUIRE([AC_TYPE_UINTMAX_T]) AC_REQUIRE([AC_TYPE_UINTPTR_T])]) AC_DEFUN([GCC_HEADER_STDINT], [AC_REQUIRE([GCC_STDINT_TYPES]) AC_CHECK_TYPES([int_least32_t, int_fast32_t],,,[#include #ifdef HAVE_STDINT_H #include #endif #ifdef HAVE_INTTYPES_H #include #endif]) # ----------------- Summarize what we found so far m4_define([_GCC_STDINT_H], m4_ifval($1, $1, _stdint.h)) m4_if(m4_bmatch(m4_quote(_GCC_STDINT_H), /stdint\.h$, bad, /inttypes\.h$, bad, ok), bad, [m4_fatal([cannot overwrite _GCC_STDINT_H])]) # ----------------- done all checks, emit header ------------- AC_CONFIG_COMMANDS(_GCC_STDINT_H, [ cat *//' >> tmp-stdint.h < #ifdef HAVE_STDINT_H #include #endif #ifdef HAVE_INTTYPES_H #include #endif EOF if test "$ac_cv_type_int_least32_t" != yes; then sed 's/^ *//' >> tmp-stdint.h < 1. dnl Fix when strange machines are reported. sed 's/^ *//' >> tmp-stdint.h < tmp-stdint.h if test -r ]_GCC_STDINT_H[ && cmp -s tmp-stdint.h ]_GCC_STDINT_H[; then rm -f tmp-stdint.h else mv -f tmp-stdint.h ]_GCC_STDINT_H[ fi ], [ ac_cv_type_int_least32_t="$ac_cv_type_int_least32_t" ac_cv_type_int_fast32_t="$ac_cv_type_int_fast32_t" ]) ]) --------------050600020204080503030204--