[antlr-interest] Problem with autotools while using antlr3 C runtime

金杰 hellojinjie at gmail.com
Sat Oct 15 07:22:41 PDT 2011


Thank you for your answer.
@kirby.bohling
when we use no-define, PACKAGE and VERSION will not be #define'd in config.h
, other PACKAGE_* variables will still be #define'd, so it's not that way.

@Jim
Don't you think that it is better not to distribute the antlr3config.h along
with include files?
the apache portable runtime (apr) also use autotools, http://apr.apache.org/
apr also generate a config file
 AC_CONFIG_HEADER(include/arch/unix/apr_private.h)
but when we install this library using "make install", the config file
apr_private.h is not included in the include files.
personally speaking, the generated config file should be private, that is to
say, we should include the generated config file in *.c source, not *.h
headers

thank you again.

BTW, I wrote a tutorial about antlr3 C runtime, this is very simple and
crude. it is in chinese
http://hellojinjie.iteye.com/admin/blogs/1197529

On Tue, Oct 11, 2011 at 11:35 PM, Jim Idle <jimi at temporal-wave.com> wrote:

> Yeah, I think that we can probably do that as the C runtime does not
> reference those defines. Ideally, you should not encounter a need to
> include
> config.h from two separate non-sub-packages.
>
> Jim
>
> > -----Original Message-----
> > From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> > bounces at antlr.org] On Behalf Of Kirby Bohling
> > Sent: Tuesday, October 11, 2011 7:01 AM
> > To: 金杰
> > Cc: antlr-interest at antlr.org
> > Subject: Re: [antlr-interest] Problem with autotools while using antlr3
> > C runtime
> >
> > Use no-define in the configure.ac file.
> >
> > AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
> >
> > See:
> > http://gcc.gnu.org/svn/gcc/branches/cilkplus/libstdc++-v3/configure.ac
> > or
> > http://www.delorie.com/gnu/docs/automake/automake_24.html
> >
> > I think this is a sign you or the other package are using the config.h
> > file wrong, but that's a different discussion.  At least that's my
> > guess, I haven't tried it.
> >
> > Kirby
> >
> >
> > On Tue, Oct 11, 2011 at 3:36 AM, 金杰 <hellojinjie at gmail.com> wrote:
> > > Hi All,
> > >
> > > the antlr3 C runtime is build with autotools.
> > > the autotools generate a header antlr3config.h, this header has
> > > defined: #define PACKAGE "libantlr3c"
> > >
> > > my project is also build with autotools, there is a header config.h,
> > > which
> > > define: #define PACKAGE "polaris"
> > > when I compile my code, there is an error:
> > >
> > > In file included from /opt/antlr3c/include/antlr3defs.h:246,
> > >                 from /opt/antlr3c/include/antlr3.h:33,
> > >                 from PolarisAdmin.cc:13:
> > > /opt/antlr3c/include/antlr3config.h:96:1: error: "PACKAGE" redefined
> > >
> > > the error indicate that  "PACKAGE" has redefined.
> > >
> > > is it a bug?  (:
> > > how can I avoid this error?
> > >
> > > thank you in advance.
> > > --
> > > hellojinjie
> > >
> > > List: http://www.antlr.org/mailman/listinfo/antlr-interest
> > > Unsubscribe:
> > > http://www.antlr.org/mailman/options/antlr-interest/your-email-
> > address
> > >
> >
> > List: http://www.antlr.org/mailman/listinfo/antlr-interest
> > Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> > email-address
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>



-- 
金杰


More information about the antlr-interest mailing list