Re: Conflicts with autoconf macroses

Lists: pgsql-bugs
From: Olleg <olleg(at)telecom(dot)mipt(dot)ru>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Conflicts with autoconf macroses
Date: 2003-12-03 07:57:05
Message-ID: 3FCD9751.8010505@telecom.mipt.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

SuSE Linux 8.2 (i586)
PostgreSQL REL7_4_STABLE (cvs), 7.4
compiled with:
gcc (GCC) 3.3 20030226 (prerelease) (SuSE Linux)
flex version 2.5.4
bison (GNU Bison) 1.875
PostgreSQL config.status 7.4
configured by ./configure, generated by GNU Autoconf 2.53,
with options "'--prefix=/opt/pgsql' '--enable-integer-datetimes'
'--enable-thread-safety' '--disable-largefile' '--with-java'
'--with-pam' '--with-openss' '--with-gnu-ld'"

I develop postgresql module and use autoconf to perform some check and
configure. When I try to compile with PostgreSQL 7.4 I get ugly messages
like:

../config.h:56:1: warning: "PACKAGE_VERSION" redefined
In file included from /opt/pgsql/include/server/c.h:53,
from /opt/pgsql/include/server/postgres.h:48,
from pgat.h:8,
from pgat1.c:3:
/opt/pgsql/include/server/pg_config.h:571:1: warning: this is the
location of the previous definition

It's bug, autoconf headers may not be included in "library headers".

Workaround:

#include <postgres.h>

/* Undefine conflict macroses from pg_config.h included in postgres.h
and our config.h
*/
#undef PACKAGE_VERSION
#undef PACKAGE_TARNAME
#undef PACKAGE_STRING
#undef PACKAGE_NAME
#undef PACKAGE_BUGREPORT

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

--
Olleg


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Olleg <olleg(at)jane(dot)telecom(dot)mipt(dot)ru>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Conflicts with autoconf macroses
Date: 2003-12-03 15:55:18
Message-ID: 242.1070466918@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Olleg <olleg(at)jane(dot)telecom(dot)mipt(dot)ru> writes:
> It's bug, autoconf headers may not be included in "library headers".

If you think it's a bug you'd better complain to the autoconf people.
pg_config.h is generated entirely by autoconf tools.

regards, tom lane


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Olleg <olleg(at)jane(dot)telecom(dot)mipt(dot)ru>, <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Conflicts with autoconf macroses
Date: 2003-12-03 23:23:38
Message-ID: Pine.LNX.4.44.0312040021580.17299-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Tom Lane writes:

> Olleg <olleg(at)jane(dot)telecom(dot)mipt(dot)ru> writes:
> > It's bug, autoconf headers may not be included in "library headers".
>
> If you think it's a bug you'd better complain to the autoconf people.
> pg_config.h is generated entirely by autoconf tools.

Admittedly, you're not supposed to install the generated config.h files,
because of this kind of name conflict. There is a contributed macro that
automatically prefixes all macro names so they don't conflict. May be
worth checking out.

--
Peter Eisentraut peter_e(at)gmx(dot)net


From: Olleg <olleg(at)jane(dot)telecom(dot)mipt(dot)ru>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Conflicts with autoconf macroses
Date: 2003-12-04 09:02:39
Message-ID: 3FCEF82F.8080005@telecom.mipt.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Tom Lane wrote:
> Olleg <olleg(at)jane(dot)telecom(dot)mipt(dot)ru> writes:
>
>>It's bug, autoconf headers may not be included in "library headers".
>
>
> If you think it's a bug you'd better complain to the autoconf people.
> pg_config.h is generated entirely by autoconf tools.

The most libraries use autoheader, but don't generate such error.
Generation of pg_config.h is ok. The only mistake is include such
autoconf header in headers designed to use with external programs, spi
modules in this case. Autoconf header must be included in source
directly or included in headers for internal use only. And don't be
installed along with other library headers.


From: Olleg <olleg(at)telecom(dot)mipt(dot)ru>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Conflicts with autoconf macroses
Date: 2003-12-04 15:51:33
Message-ID: 3FCF5805.2080205@telecom.mipt.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Peter Eisentraut wrote:
> Tom Lane writes:
>
>
>>Olleg <olleg(at)jane(dot)telecom(dot)mipt(dot)ru> writes:
>>
>>>It's bug, autoconf headers may not be included in "library headers".
>>
>>If you think it's a bug you'd better complain to the autoconf people.
>>pg_config.h is generated entirely by autoconf tools.
>
> Admittedly, you're not supposed to install the generated config.h files,

I am working on a server module. I need postgresql.h. pg_config.h is
included in postgresql.h

> because of this kind of name conflict. There is a contributed macro that
> automatically prefixes all macro names so they don't conflict. May be
> worth checking out.

??? Please explain.

--
Olleg


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Olleg <olleg(at)telecom(dot)mipt(dot)ru>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Conflicts with autoconf macroses
Date: 2003-12-04 21:29:31
Message-ID: Pine.LNX.4.44.0312042229160.22753-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Olleg writes:

> > because of this kind of name conflict. There is a contributed macro that
> > automatically prefixes all macro names so they don't conflict. May be
> > worth checking out.
>
> ??? Please explain.

http://ac-archive.sourceforge.net/guidod/ax_prefix_config_h.html