Subject: Re: autoconf question
To: None <tech-pkg@NetBSD.org>
From: Bruce J.A. Nourish <bjan@bjan.freeshell.org>
List: tech-pkg
Date: 03/21/2004 09:37:28
On Sun, Mar 21, 2004 at 04:51:52PM +0100, Manuel Bouyer wrote:
> Hi,
> does anyone know how to check for a global variable with autoconf ?
> I need to patch a ./configure to check for
> extern char *__progname;
> 
> AC_CHECK_DECL() is not enouth because usually this isn't defined in any header.
> It seems that there isn't a AC_CHECK_VAR().

Maybe some variant of the following (untested, probably needs tweaking):

AC_DEFUN(AC_CHECK_PROGNAME,
[AC_CACHE_CHECK([for extern char *__progname],
cv_extern_char_progname,
[AC_TRY_LINK([char **p;], [extern char *__progname; p = &__progname;],
	cv_extern_char_progname=yes, cv_extern_char_progname=no)])
if test x"$cv_extern_char_progname" = xyes; then
  AC_DEFINE(HAVE_PROGNAME, 1, [Define if your system provides extern char *__progname])
fi])

-- 
Bruce J.A. Nourish <bjan@bjan.freeshell.org> http://bjan.freeshell.org
SDF Public Access UNIX System - http://sdf.lonestar.org