Duplicate definition of LOCALEDIR

Started by Peter Eisentrautover 19 years ago5 messages
#1Peter Eisentraut
peter_e@gmx.net

LOCALEDIR is defined in

src/port/pg_config_paths.h
src/include/pg_config.h

but one of them should be enough. (May be dependent on --enable-nls.) Which
one should be removed?

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

#2Martijn van Oosterhout
kleptog@svana.org
In reply to: Peter Eisentraut (#1)
Re: Duplicate definition of LOCALEDIR

On Mon, May 22, 2006 at 12:17:33PM +0200, Peter Eisentraut wrote:

LOCALEDIR is defined in

src/port/pg_config_paths.h
src/include/pg_config.h

but one of them should be enough. (May be dependent on --enable-nls.) Which
one should be removed?

I'd suggest the version in pg_config. Both are ultimatly generated by
configure, but LOCALEDIR is the only directory definition that appears
in pg_config.h.

The fix is simple: remove the AC_DEFINE_UNQUOTED(LOCALEDIR, ...) from
programs/config.h. localedir is still defined.

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.

Have a nice day,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/

Show quoted text

From each according to his ability. To each according to his ability to litigate.

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Martijn van Oosterhout (#2)
Re: Duplicate definition of LOCALEDIR

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.

regards, tom lane

#4Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Tom Lane (#3)
1 attachment(s)
Re: [HACKERS] Duplicate definition of LOCALEDIR

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. +

Attachments:

/pgpatches/localetext/plainDownload
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);
#5Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Bruce Momjian (#4)
Re: [HACKERS] Duplicate definition of LOCALEDIR

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. +