Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2003:
[Freeciv-Dev] Re: (PR#2873) 1.14.0 Xaw client crash
Home

[Freeciv-Dev] Re: (PR#2873) 1.14.0 Xaw client crash

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: stepan@xxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#2873) 1.14.0 Xaw client crash
From: "Jason Short via RT" <rt@xxxxxxxxxxxxxx>
Date: Sun, 26 Jan 2003 10:14:08 -0800
Reply-to: rt@xxxxxxxxxxxxxx

Stepan Roh via RT wrote:

> Quote (important part highlighted with >>><<<):
> 
> "In order to do its job, autoheader needs you to document all of the
> symbols that you might use; i.e., there must be at least one AC_DEFINE or
> one AC_DEFINE_UNQUOTED call with a third argument for each symbol (see
> section 7.1 Defining C Preprocessor Symbols). An additional constraint is
> that the first argument of AC_DEFINE must be a >>>literal<<<. Note that
> all symbols defined by Autoconf's builtin tests are already documented
> properly; you only need to document those that you define yourself."
> 
> I think it's obvious that you can't call AC_DEFINE with variable and
> expect autoheader to trace it. It would be hard work to do it actually and
> only with additional constraints (variable content may be based on runtime
> state in which case it can't be computed before running) or syntactic
> sugar.  AC_DEFINE works with variables (just add manually #undef
> HAVE_LIBXAW3D to end of config.h.in and run ./configure
> --enable-client=xaw3d and see that config.h contains #define HAVE_LIBXAW3D
> 1). So it is not bug and it can't be changed.

Read it again.  AC_DEFINE is not able to work with variables in the 
first position.  AC_DEFINE_UNQUOTED is.  It also says this under the 
node on AC_DEFINE/AC_DEFINE_UNQUOTED.

Since we use AC_DEFINE_UNQUOTED here, it *should* work.  But, well, it 
doesn't.

Note that all we really need to do is put AC_DEFINE(HAVE_LIBXAW3D, ...) 
*somewhere* in our autoconf code.  It doesn't actually have to be 
called.  Then we get autoheader to work and everything is great.

Alternately, we can hard-code the different values in FC_CHECK_X_LIB. 
Something like

if $ac_tr_lib = "HAVE_LIBXAW3D"; then
   AC_DEFINE_UNQUOTED(HAVE_LIBXAW3D, ...)
else if $ac_tr_lib = "HAVE_LIBXAW"; then
   ...
...
fi

Or we could put these values outside of the FC_CHECK_X_LIB call, i.e.

   FC_CHECK_X_LIB(Xaw3d, main,
                  AC_DEFINE_UNQUOTED(HAVE_LIBXAW3D, ...),
                  AC_MSG_ERROR(did not find Xaw3d library))

The question at this point is which is the least hack.  Seems to me the 
third method is (AFAICT this is what you are suggesting).

jason




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