This is a discussion on Re: [HACKERS] Duplicate definition of LOCALEDIR within the Pgsql Patches forums, part of the PostgreSQL category; --> Tom Lane wrote: > Martijn van Oosterhout <kleptog@svana.org> writes: > > The odd thing is that there are two ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Tom Lane wrote: > Martijn van Oosterhout <kleptog@svana.org> writes: > > The odd thing is that there are two paths defined, $localedir and > > $exp_localedir, which are not the same and pg_config.h gets one and > > pg_config_paths.h gets the other. > > It looks to me like $localedir is literally "${prefix}/share/locale", > while exp_localedir has the full path (ie, the expanded contents of > $prefix). Better be careful about assuming they are redundant. > > The correct solution to this might be to rename the downstream > variables to make it clearer what's what. The pg_config_paths.h file was added by me to give files access to configure paths, in part to allow relocation of install files. Looking at LOCALEDIR in the two include files, I realize one uses prefix while another optionally uses $ac_default_prefix, but if LOCALEDIR were different in the two cases, "NONE" would be prepended to one of them. I have attached a patch that removes the LOCALEDIR from pg_config.h, and changed fe-misc.c to make use of the pg_config_paths.h define. I think this is appropriate only for CVS HEAD. We have not seen warnings about the two defines only because they are always define the same. -- Bruce Momjian http://candle.pha.pa.us EnterpriseDB http://www.enterprisedb.com + If your life is a hard drive, Christ can be your backup. + Index: configure ================================================== ================= RCS file: /cvsroot/pgsql/configure,v retrieving revision 1.492 diff -c -c -r1.492 configure *** configure 29 Apr 2006 20:47:29 -0000 1.492 --- configure 23 May 2006 01:20:32 -0000 *************** *** 22083,22099 **** # Note: share/locale is always the default, independent of $datadir localedir='${prefix}/share/locale' - if test x"$prefix" = x"NONE"; then - exp_localedir="$ac_default_prefix/share/locale" - else - exp_localedir="$prefix/share/locale" - fi - - - - cat >>confdefs.h <<_ACEOF - #define LOCALEDIR "$exp_localedir" - _ACEOF fi --- 22083,22088 ---- Index: config/programs.m4 ================================================== ================= RCS file: /cvsroot/pgsql/config/programs.m4,v retrieving revision 1.19 diff -c -c -r1.19 programs.m4 *** config/programs.m4 4 Dec 2005 03:52:28 -0000 1.19 --- config/programs.m4 23 May 2006 01:20:32 -0000 *************** *** 164,178 **** # Note: share/locale is always the default, independent of $datadir localedir='${prefix}/share/locale' - if test x"$prefix" = x"NONE"; then - exp_localedir="$ac_default_prefix/share/locale" - else - exp_localedir="$prefix/share/locale" - fi - AC_SUBST(localedir) - AC_DEFINE_UNQUOTED(LOCALEDIR, ["$exp_localedir"], - [Define to the location of locale files.]) ])# PGAC_CHECK_GETTEXT --- 164,170 ---- Index: src/include/pg_config.h.in ================================================== ================= RCS file: /cvsroot/pgsql/src/include/pg_config.h.in,v retrieving revision 1.96 diff -c -c -r1.96 pg_config.h.in *** src/include/pg_config.h.in 29 Apr 2006 20:47:31 -0000 1.96 --- src/include/pg_config.h.in 23 May 2006 01:20:37 -0000 *************** *** 531,539 **** /* Define to build with Kerberos 5 support. (--with-krb5) */ #undef KRB5 - /* Define to the location of locale files. */ - #undef LOCALEDIR - /* Define as the maximum alignment requirement of any C data type. */ #undef MAXIMUM_ALIGNOF --- 531,536 ---- Index: src/interfaces/libpq/fe-misc.c ================================================== ================= RCS file: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v retrieving revision 1.126 diff -c -c -r1.126 fe-misc.c *** src/interfaces/libpq/fe-misc.c 18 May 2006 18:19:47 -0000 1.126 --- src/interfaces/libpq/fe-misc.c 23 May 2006 01:20:45 -0000 *************** *** 60,65 **** --- 60,66 ---- #include "libpq-int.h" #include "pqsignal.h" #include "mb/pg_wchar.h" + #include "pg_config_paths.h" static int pqPutMsgBytes(const void *buf, size_t len, PGconn *conn); ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq |
| ||||
| Patch applied, autoconf and autoheader run. --------------------------------------------------------------------------- Bruce Momjian wrote: > Tom Lane wrote: > > Martijn van Oosterhout <kleptog@svana.org> writes: > > > The odd thing is that there are two paths defined, $localedir and > > > $exp_localedir, which are not the same and pg_config.h gets one and > > > pg_config_paths.h gets the other. > > > > It looks to me like $localedir is literally "${prefix}/share/locale", > > while exp_localedir has the full path (ie, the expanded contents of > > $prefix). Better be careful about assuming they are redundant. > > > > The correct solution to this might be to rename the downstream > > variables to make it clearer what's what. > > The pg_config_paths.h file was added by me to give files access to > configure paths, in part to allow relocation of install files. > > Looking at LOCALEDIR in the two include files, I realize one uses prefix > while another optionally uses $ac_default_prefix, but if LOCALEDIR were > different in the two cases, "NONE" would be prepended to one of them. > > I have attached a patch that removes the LOCALEDIR from pg_config.h, and > changed fe-misc.c to make use of the pg_config_paths.h define. I think > this is appropriate only for CVS HEAD. > > We have not seen warnings about the two defines only because they are > always define the same. > > -- > Bruce Momjian http://candle.pha.pa.us > EnterpriseDB http://www.enterprisedb.com > > + If your life is a hard drive, Christ can be your backup. + > Index: configure > ================================================== ================= > RCS file: /cvsroot/pgsql/configure,v > retrieving revision 1.492 > diff -c -c -r1.492 configure > *** configure 29 Apr 2006 20:47:29 -0000 1.492 > --- configure 23 May 2006 01:20:32 -0000 > *************** > *** 22083,22099 **** > > # Note: share/locale is always the default, independent of $datadir > localedir='${prefix}/share/locale' > - if test x"$prefix" = x"NONE"; then > - exp_localedir="$ac_default_prefix/share/locale" > - else > - exp_localedir="$prefix/share/locale" > - fi > - > - > - > - cat >>confdefs.h <<_ACEOF > - #define LOCALEDIR "$exp_localedir" > - _ACEOF > > > fi > --- 22083,22088 ---- > Index: config/programs.m4 > ================================================== ================= > RCS file: /cvsroot/pgsql/config/programs.m4,v > retrieving revision 1.19 > diff -c -c -r1.19 programs.m4 > *** config/programs.m4 4 Dec 2005 03:52:28 -0000 1.19 > --- config/programs.m4 23 May 2006 01:20:32 -0000 > *************** > *** 164,178 **** > > # Note: share/locale is always the default, independent of $datadir > localedir='${prefix}/share/locale' > - if test x"$prefix" = x"NONE"; then > - exp_localedir="$ac_default_prefix/share/locale" > - else > - exp_localedir="$prefix/share/locale" > - fi > - > AC_SUBST(localedir) > - AC_DEFINE_UNQUOTED(LOCALEDIR, ["$exp_localedir"], > - [Define to the location of locale files.]) > ])# PGAC_CHECK_GETTEXT > > > --- 164,170 ---- > Index: src/include/pg_config.h.in > ================================================== ================= > RCS file: /cvsroot/pgsql/src/include/pg_config.h.in,v > retrieving revision 1.96 > diff -c -c -r1.96 pg_config.h.in > *** src/include/pg_config.h.in 29 Apr 2006 20:47:31 -0000 1.96 > --- src/include/pg_config.h.in 23 May 2006 01:20:37 -0000 > *************** > *** 531,539 **** > /* Define to build with Kerberos 5 support. (--with-krb5) */ > #undef KRB5 > > - /* Define to the location of locale files. */ > - #undef LOCALEDIR > - > /* Define as the maximum alignment requirement of any C data type. */ > #undef MAXIMUM_ALIGNOF > > --- 531,536 ---- > Index: src/interfaces/libpq/fe-misc.c > ================================================== ================= > RCS file: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v > retrieving revision 1.126 > diff -c -c -r1.126 fe-misc.c > *** src/interfaces/libpq/fe-misc.c 18 May 2006 18:19:47 -0000 1.126 > --- src/interfaces/libpq/fe-misc.c 23 May 2006 01:20:45 -0000 > *************** > *** 60,65 **** > --- 60,66 ---- > #include "libpq-int.h" > #include "pqsignal.h" > #include "mb/pg_wchar.h" > + #include "pg_config_paths.h" > > > static int pqPutMsgBytes(const void *buf, size_t len, PGconn *conn); > > ---------------------------(end of broadcast)--------------------------- > TIP 3: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq -- Bruce Momjian http://candle.pha.pa.us EnterpriseDB http://www.enterprisedb.com + If your life is a hard drive, Christ can be your backup. + ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster |