Inconsistency w.r.t. defining the same symbol more than once

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

 



Hello!

This is with Autoconf 2.59.


Consider the following:

configure.ac
#v+
AC_INIT([foo], [1])
AC_DEFINE([FOO], [0])
AC_DEFINE([FOO], [1])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
#v-

Makefile.in
#v+
DEFS = @DEFS@
#v-

#v+
$ autoconf
$ ./configure
configure: creating ./config.status
config.status: creating Makefile
$ cat Makefile
DEFS = -DPACKAGE_NAME=\"foo\" -DPACKAGE_TARNAME=\"foo\" -DPACKAGE_VERSION=\"1\" -DPACKAGE_STRING=\"foo\ 1\" -DPACKAGE_BUGREPORT=\"\" -DFOO=0 -DFOO=1
#v-

When used with GCC, this will obviously result in ``warning: "FOO"
redefined'' and the _last_ definition (i.e. `FOO=1') will be used.


Now.

configure.ac
#v+
AC_INIT([foo], [1])
AC_DEFINE([FOO], [0], [FOO 0])
AC_DEFINE([FOO], [1], [FOO 1])
AC_CONFIG_HEADER([config.h])
AC_OUTPUT
#v-

#v+
$ autoconf
$ autoheader
$ ./configure
configure: creating ./config.status
config.status: creating config.h
$ grep FOO config.h
/* FOO 1 */
#define FOO 0
#v-

The _first_ definition (i.e. `FOO=0') will be used.  And the commentary
from the _last_ one.


In both cases I would have expected that a subsequent `AC_DEFINE' on the
same symbol would simply override the previous definition, like in a
variable assignment.

What is the expected outcome?  The manual doesn't tell me.


Regards,
 Thomas

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux