[Top][All Lists]

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

Re: stdbool macro, take 2

From: Paul Eggert
Subject: Re: stdbool macro, take 2
Date: Thu, 8 Nov 2001 11:04:41 -0800 (PST)

> From: Paolo Bonzini <address@hidden>
> Date: Thu, 8 Nov 2001 12:01:07 +0100 (CET)

> > Surely the output file should be removed before the test is run; it
> > should also be removed if config.status is run.

> I think it would suffice to remove it in config.status and in make
> distclean.

No, because you can run 'configure' without running 'make distclean'.
If a stdbool.h is left over from an earlier build, 'configure' will
include it instead of including the system stdbool.h.  This is not the
right thing to do, as the earlier build might have invoked 'configure'
with different options.  So AC_HEADER_STDBOOL should remove any
preexisting stdbool.h before doing any tests that depend on stdbool.h.

> > Also, the shell var STDBOOL_H doesn't seem right: shouldn't it have a
> > reserved prefix? And I don't see how it's propagated from configure
> > to config.status.
> STDBOOL_H was intended to be used in the makefiles (for example for
> address@hidden@).

I don't see why this would be needed.  `make distclean' can just
remove stdbool.h unconditionally.

> This time I just put stdbool.h in STDBOOL_H (without any path) and
> config.status will contain the path and file name (computed in
> ac_stdbool_h).  STDBOOL_H is substituted and passed through the
> INIT-CMDS, and also used by config.status to decide whether to
> create stdbool.h.

That all makes sense; I'm just puzzled about the spelling of the name
STDBOOL_H.  Can't you use ac_cv_header_stdbool_h for this purpose?  I
see no precedent for a shell var name like STDBOOL_H.  And the name
isn't documented.

Please see the node 'Cache Variable Names' in the Autoconf manual for
some of the coding conventions.

> address@hidden AC_HEADER_STDBOOL (@var{path})

@var{path} -> @var{directory}

> address@hidden HEADER_STDBOOL
> address@hidden STAT_MACROS_BROKEN

There's no reason to index STAT_MACROS_BROKEN here.

> +If @file{stdbool.h} is absent or does not work correctly, create a
> +file @address@hidden/stdbool.h} (default @file{./stdbool.h})
> +that does work. This macro invokes @code{AC_CONFIG_COMMANDS} so it
> +is an instantiating macro; see @ref{Configuration Actions}.

Please append the following text:

If you use this macro, you should also add
@address@hidden/stdbool.h} to the list of files you remove in
@code{distclean} targets.

> +#if !defined false || !true || !defined bool
> +int a2[-1];
> +#else
> +bool a1[false || !true ? -1 : 1];
> +#endif

The code is simpler and clearer if written this way, and works just as well:

bool a1[false || !true ? -1 : 1];
#if !defined false || !true || !defined bool
int a2[-1];

> +  m4_if([$2], , ac_stdbool_h=stdbool.h, ac_stdbool_h=[$2]/stdbool.h)

I would use the name 'ac_file' rather than 'ac_stdbool_h' here; that
seems to be the style.  Also, this line can be further simplified as

ac_file=m4_default([$2], .)/stdbool.h

> +/* ISO C 99 <stdbool.h> for platforms that lack it.  */
> +/* 7.16. Boolean type and values */
> +/* Written by Bruno Haible <address@hidden>, 2001. */

The generated file should contain a copyright notice; otherwise the
file is not free.  I suggest appending the following text here:

/* Copyright (C) 2001 Free Software Foundation, Inc.
   Copying and distribution of this stdbool.h file, with or without
   modification, are permitted provided the copyright notice and this
   notice are preserved.  */

One last thing: you need to sign papers for Autoconf for us to accept
this contribution, as it's nontrivial.  I'll send you the forms if you
don't have them already.

reply via email to

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