bug-autoconf
[Top][All Lists]
Advanced

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

Re: Suppressing warning AC_LANG_CONFTEST


From: Eric Blake
Subject: Re: Suppressing warning AC_LANG_CONFTEST
Date: Tue, 12 Oct 2010 14:44:28 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100921 Fedora/3.1.4-1.fc13 Mnenhy/0.8.3 Thunderbird/3.1.4

[please don't top-post on technical lists]

On 10/12/2010 02:34 PM, Ralph Castain wrote:
Sorry for delay - was out. Since the code is rather long, I have simply 
attached it here.

Appreciate your help!

You're welcome!


AC_DEFUN([EVENT_CHECK_ATTRIBUTES], [
  AC_LANG(C)
  AC_MSG_CHECKING(for __attribute__)

  AC_CACHE_VAL(_cv___attribute__, [
    AC_TRY_COMPILE(
      [#include <stdlib.h>
       /* Check for the longest available __attribute__ (since gcc-2.3) */
       struct foo {
           char a;
           int x[2] __attribute__ ((__packed__));
        };
      ],

Bingo. Just as the warning said, you are missing a call to AC_LANG_PROGRAM. Also, you have insufficient quoting - to get an array x[2], rather than a variable name x2, you need more [] quoting. You want to do:


AC_TRY_COMPILE(
  [AC_LANG_PROGRAM([[
    #include <stdlib.h>
    /* Check ... */
    struct foo {
      char a;
      int x[2] __attribute__ ((__packed__));
    };
  ]])],

and then on with the rest of your .m4 file.

      [],
      [_cv___attribute__=1],
      [_cv___attribute__=0],

Also, while you're at it, it might be nice to rename your cache variables to have a useful prefix, rather than being in the nameless prefix namespace.

    )

    if test "$_cv___attribute__" = "1" ; then
        AC_TRY_COMPILE(
          [#include <stdlib.h>

Rinse and repeat - another missing AC_LANG_PROGRAM.

  AC_DEFINE_UNQUOTED(HAVE_ATTRIBUTE, [$_cv___attribute__],
                     [Whether your compiler has __attribute__ or not])

Get in the habit of proper m4 quoting:

AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE], [$_cv__attribute__], ...

AC_DEFUN([IF_IFELSE], [
    AC_COMPILE_IFELSE([#if !( $1 )
#error "condition $1 not met"
choke me
#endif], [$2], [$3])])

Another case of missing AC_LANG_PROGRAM.

            [AC_TRY_LINK([
                    #include <stdio.h>

And another.

            AC_CACHE_CHECK([if $CC supports -xldscope],
                [_cv_cc_xldscope],
                [AC_TRY_LINK([
                        #include <stdio.h>

And another.

I think you can go from here on fixing this.

--
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org



reply via email to

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