[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Macros to check for global variables
From: |
Paul Eggert |
Subject: |
Re: Macros to check for global variables |
Date: |
Thu, 30 May 2002 01:01:14 -0700 (PDT) |
> From: Peter Eisentraut <address@hidden>
> Date: Wed, 29 May 2002 18:37:18 +0200 (CEST)
>
> Following up to a thread last month, I have revised my set of macros that
> check for global variables. You must supply the complete declaration of
> the variable, e.g.,
>
> AC_CHECK_VAR(int timezone)
>
> and the code figures out the name of the variable with some regular
> expressions. This handles arrays and function pointers as well, e.g.,
>
> AC_CHECK_VAR([[char sys_siglist[]]])
> AC_CHECK_VAR(char (*testptr)(int,int))
>
> The exact REs could be debated,
That's an understatement. How about if we just make everybody's life
simpler and pull the variable name out as a separate argument? That
way, you don't need to worry about the REs at all. The "declaration"
can be arbitrary code (perhaps a series of declarations), and the
"variable" can just be a tag name that says "yup, we can declare all
this stuff and it links". I suppose that it would really be just a
shorthand for AC_CACHE....AC_TRY_LINK, which is OK if it's
sufficiently useful.
Also, what about Thomas Dickey's comment that the test does not
distinguish between variables and functions that happen to link? See:
http://mail.gnu.org/pipermail/autoconf/2002-April/012972.html