From 2ca77b8a4a88516415a4d5f591efc8efae93020f Mon Sep 17 00:00:00 2001 From: Mark Cave-Ayland Date: Sat, 14 Jan 2012 00:49:14 +0000 Subject: [PATCH] Switch NLS build to use the in-built ENABLE_NLS define rather than USE_NLS. The key concept here is that we eliminate all logic from the Makefile and put it in the build system (e.g. configure). By having the logic at this higher layer, we make it much easier to transition to another build system in future such as CMake. git-svn-id: http://svn.osgeo.org/postgis/trunk@8808 b70326c6-7e19-0410-871a-916f4a2858ee --- configure.ac | 4 ++++ loader/Makefile.in | 8 +------- loader/pgsql2shp-core.h | 10 ---------- loader/shp2pgsql-cli.c | 6 ++++-- loader/shp2pgsql-core.c | 2 ++ loader/shp2pgsql-core.h | 11 ----------- loader/shp2pgsql-gui.c | 10 ++++++---- loader/shpcommon.h | 10 ++++++++++ postgis_config.h.in | 3 +++ 9 files changed, 30 insertions(+), 34 deletions(-) diff --git a/configure.ac b/configure.ac index faa69dceb..75002d3be 100644 --- a/configure.ac +++ b/configure.ac @@ -376,6 +376,10 @@ PGSQL_MANDIR=`$PGCONFIG --mandir` AC_SUBST([PGSQL_DOCDIR]) AC_SUBST([PGSQL_MANDIR]) +dnl Extract the locale directory +PGSQL_LOCALEDIR=`$PGCONFIG --localedir` +AC_DEFINE_UNQUOTED([PGSQL_LOCALEDIR], ["$PGSQL_LOCALEDIR"], [Location of PostgreSQL locale directory]) + dnl Extract the executable directory PGSQL_BINDIR=`$PGCONFIG --bindir` diff --git a/loader/Makefile.in b/loader/Makefile.in index acd4a2bf3..f658cb259 100644 --- a/loader/Makefile.in +++ b/loader/Makefile.in @@ -53,13 +53,7 @@ GTK_WIN32_RES = @GTK_WIN32_RES@ # GetText includes and libraries GETTEXT_CFLAGS = @GETTEXT_CFLAGS@ GETTEXT_LDFLAGS = @GETTEXT_LDFLAGS@ @LIBINTL@ -nls_build = @USE_NLS@ -ifdef nls_build - localedir = $(shell $(PG_CONFIG) --localedir) - CFLAGS += -DUSE_NLS - CFLAGS += -DLOCALEDIR=\"$(localedir)\" - LANGUAGES = fr -endif +LANGUAGES = fr # Built out CFLAGS with ICONV and GETTEXT CFLAGS += $(GETTEXT_CFLAGS) $(ICONV_CFLAGS) diff --git a/loader/pgsql2shp-core.h b/loader/pgsql2shp-core.h index 2119364fc..8f5dfe757 100644 --- a/loader/pgsql2shp-core.h +++ b/loader/pgsql2shp-core.h @@ -12,16 +12,6 @@ * **********************************************************************/ -/* For internationalization */ -#ifdef USE_NLS -#include -#include -#define _(String) gettext(String) -#define PACKAGE "shp2pgsql" -#else -#define _(String) String -#endif - #include #include #include diff --git a/loader/shp2pgsql-cli.c b/loader/shp2pgsql-cli.c index b81f29a4c..f65b13dbb 100644 --- a/loader/shp2pgsql-cli.c +++ b/loader/shp2pgsql-cli.c @@ -13,6 +13,8 @@ * **********************************************************************/ +#include "../postgis_config.h" + #include "shp2pgsql-core.h" #include "../liblwgeom/liblwgeom.h" /* for SRID_UNKNOWN */ @@ -68,9 +70,9 @@ main (int argc, char **argv) int c; int ret, i; -#ifdef USE_NLS +#ifdef ENABLE_NLS setlocale (LC_ALL, ""); - bindtextdomain (PACKAGE, LOCALEDIR); + bindtextdomain (PACKAGE, PGSQL_LOCALEDIR); textdomain (PACKAGE); #endif diff --git a/loader/shp2pgsql-core.c b/loader/shp2pgsql-core.c index 26b5e0063..31704c558 100644 --- a/loader/shp2pgsql-core.c +++ b/loader/shp2pgsql-core.c @@ -13,6 +13,8 @@ * **********************************************************************/ +#include "../postgis_config.h" + #include "shp2pgsql-core.h" #include "../liblwgeom/liblwgeom.h" /* for lw_vasprintf */ #include "../liblwgeom/lwgeom_log.h" /* for LWDEBUG macros */ diff --git a/loader/shp2pgsql-core.h b/loader/shp2pgsql-core.h index b51629912..6efc072e4 100644 --- a/loader/shp2pgsql-core.h +++ b/loader/shp2pgsql-core.h @@ -12,16 +12,6 @@ * **********************************************************************/ -/* For internationalization */ -#ifdef USE_NLS -#include -#include -#define _(String) gettext(String) -#define PACKAGE "shp2pgsql" -#else -#define _(String) String -#endif - /* Standard headers */ #include #include @@ -39,7 +29,6 @@ #include "../liblwgeom/stringbuffer.h" -#include "../postgis_config.h" #define RCSID "$Id$" diff --git a/loader/shp2pgsql-gui.c b/loader/shp2pgsql-gui.c index 9d7cd30d8..abe49409b 100644 --- a/loader/shp2pgsql-gui.c +++ b/loader/shp2pgsql-gui.c @@ -14,6 +14,8 @@ * **********************************************************************/ +#include "../postgis_config.h" + #include #include #include @@ -2276,10 +2278,10 @@ main(int argc, char *argv[]) { int c; -#ifdef USE_NLS - setlocale (LC_ALL, ""); - bindtextdomain (PACKAGE, LOCALEDIR); - textdomain (PACKAGE); +#ifdef ENABLE_NLS + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, PGSQL_LOCALEDIR); + textdomain (PACKAGE); #endif /* Parse command line options and set configuration */ diff --git a/loader/shpcommon.h b/loader/shpcommon.h index f5b34f9de..16a023904 100644 --- a/loader/shpcommon.h +++ b/loader/shpcommon.h @@ -13,6 +13,16 @@ #ifndef SHPCOMMON_H #define SHPCOMMON_H +/* For internationalization */ +#ifdef ENABLE_NLS +#include +#include +#define _(String) gettext(String) +#define PACKAGE "shp2pgsql" +#else +#define _(String) String +#endif + typedef struct shp_connection_state { /* PgSQL username to log in with */ diff --git a/postgis_config.h.in b/postgis_config.h.in index 48a0e720e..f7762214d 100644 --- a/postgis_config.h.in +++ b/postgis_config.h.in @@ -95,6 +95,9 @@ */ #undef LT_OBJDIR +/* Location of PostgreSQL locale directory */ +#undef PGSQL_LOCALEDIR + /* Enable caching of bounding box within geometries */ #undef POSTGIS_AUTOCACHE_BBOX -- 2.40.0