autoconf
[Top][All Lists]
Advanced

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

Re: Proposal for macros to check for global variables (again)


From: Peter Eisentraut
Subject: Re: Proposal for macros to check for global variables (again)
Date: Thu, 11 Apr 2002 15:03:11 -0400 (EDT)

Paul Eggert writes:

> > From: Peter Eisentraut <address@hidden>
> > Date: Thu, 11 Apr 2002 12:55:51 -0400 (EDT)
> >
> > # AC_LANG_VAR_LINK_TRY(C)(VARIABLE)
> > # ---------------------------------
> > m4_define([AC_LANG_VAR_LINK_TRY(C)],
> > [AC_LANG_PROGRAM(
> > [#include <assert.h>
>
> Why include <assert.h>.

Must have been left over from the FUNC macro.  Not sure why it was there.

> > extern int $1;
>
> This repeats a longstanding problem we've had with AC_CHECK_FUNC.  It
> declares the variable to be 'int' even though it might be some other
> type, and that violates the C standard.  The macro args should specify
> the type of the variable, along with any other info needed to declare
> it (e.g. type qualifiers).

Right, that was my first thought.  It seemed kind of weird to make it
inconsistent with the FUNC family though.

> Also, can you please give an example where this macro would be useful?
> Why can't you use AC_CHECK_DECL?

You could ask that question about AC_CHECK_FUNC, too.  The reasons are,
the variable might not be declared anywhere or where you are looking for
it (e.g., optind on hosts without unistd.h), or it might be declared and
you don't have the right libraries.  To be sure, you must link.

-- 
Peter Eisentraut   address@hidden




reply via email to

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