Conflicts with autoconf macroses - Mailing list pgsql-bugs

From Olleg
Subject Conflicts with autoconf macroses
Date
Msg-id 3FCD9751.8010505@telecom.mipt.ru
Whole thread Raw
Responses Re: Conflicts with autoconf macroses  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Setting time zone commands
Next
From: Olleg
Date:
Subject: Autocomit off in psql don't work