]> granicus.if.org Git - yasm/commitdiff
Do intl more correctly. nointl/libintl.h is unnecessary; it can be detected
authorPeter Johnson <peter@tortall.net>
Sun, 2 Dec 2001 06:40:17 +0000 (06:40 -0000)
committerPeter Johnson <peter@tortall.net>
Sun, 2 Dec 2001 06:40:17 +0000 (06:40 -0000)
in util.h by the ENABLE_NLS define.  Fix Mkfiles to reflect.  Actually enable
if available in main().

svn path=/trunk/yasm/; revision=372

Makefile.am
Mkfiles/Makefile.dj
Mkfiles/Makefile.flat
Mkfiles/Makefile.vc
frontends/yasm/yasm.c
libyasm/util.h
nointl/libintl.h [deleted file]
src/main.c
src/util.h
util.h

index ed6e0eec7ee6ae10c8f9f37f29b86f47379732c2..fcafeae50b1320e14b3505f003d10add9fab5bc2 100644 (file)
@@ -3,7 +3,6 @@
 SUBDIRS = check intl src po doc tests
 EXTRA_DIST = config/install-sh config/missing config/mkinstalldirs \
        config/config.guess config/config.sub COPYING.LIB-2.0 \
-       nointl/libintl.h \
        Mkfiles/Makefile.flat \
        Mkfiles/Makefile.dj Mkfiles/config.h.dj \
        Mkfiles/Makefile.vc Mkfiles/config.h.vc
index df17d15e5cfed7521b09b70a889d4be8454a3a23..9e270f7b2e6e37241d60472a69d723f20ef5613a 100644 (file)
@@ -10,7 +10,7 @@
 #  copy Mkfiles/config.h.dj config.h
 #  make -fMkfiles/Makefile.dj
 
-CFLAGS=-DHAVE_CONFIG_H -I. -Isrc -Isrc/arch/x86 -Inointl
+CFLAGS=-DHAVE_CONFIG_H -I. -Isrc -Isrc/arch/x86
 CC=gcc
 
 all: src/yasm
index 0f8b9713be952970423547d2e550a26346f3844d..ed0d051d227014b8285bfdb20883e11fa55948a0 100644 (file)
@@ -16,7 +16,7 @@
 # This file should be customized to particular platforms by changing CC and
 #  CFLAGS appropriately, along with writing a config.h for the platform.
 
-CFLAGS=-DHAVE_CONFIG_H -I. -Isrc -Isrc/arch/x86 -Inointl
+CFLAGS=-DHAVE_CONFIG_H -I. -Isrc -Isrc/arch/x86
 CC=gcc
 BISON=bison
 FLEX=flex
index 5c454a9d7df8f2596cc70b81e9dcf1894c20016c..4cd48a789de401926e1ad28956644c8f9216e99e 100644 (file)
@@ -10,7 +10,7 @@
 #  copy Mkfiles/config.h.vc config.h\r
 #  nmake -fMkfiles/Makefile.vc\r
 \r
-CFLAGS=/DHAVE_CONFIG_H /I. /Isrc /Isrc/arch/x86 /Inointl\r
+CFLAGS=/DHAVE_CONFIG_H /I. /Isrc /Isrc/arch/x86\r
 CC=cl\r
 \r
 all: src\yasm.exe\r
index ef560eae7a9350e87c983db97ff369880044d7df..95947581692dc7c7c5b869a818aab6e5fa48229a 100644 (file)
 # include <assert.h>
 #endif
 
-#ifdef gettext_noop
-#define N_(String)     gettext_noop(String)
-#else
-#define N_(String)     (String)
-#endif
-
 #include "bitvect.h"
 
 #include "globals.h"
@@ -102,6 +96,14 @@ main(int argc, char *argv[])
 {
     sectionhead *sections;
 
+#if defined(HAVE_SETLOCALE) && defined(HAVE_LC_MESSAGES)
+    setlocale(LC_MESSAGES, "");
+#endif
+#if defined(LOCALEDIR)
+    bindtextdomain(PACKAGE, LOCALEDIR);
+#endif
+    textdomain(PACKAGE);
+
     if (parse_cmdline(argc, argv, options, countof(options, opt_option)))
        return EXIT_FAILURE;
 
index fb4e0d50fd75b54ccd4ed933315e3695d6f563b0..a722c57b44c8f362271c2a02e722e23af85235f4 100644 (file)
 
 #if defined(lint)
 /*@dependent@*/ const char *gettext(const char *s);
+#define _(String)      gettext(String)
 #else
-#include <libintl.h>
+# ifdef HAVE_LOCALE_H
+#  include <locale.h>
+# endif
+
+# ifdef ENABLE_NLS
+#  include <libintl.h>
+#  define _(String)    gettext(String)
+# else
+#  define gettext(Msgid)    (Msgid)
+#  define dgettext(Domainname, Msgid)  (Msgid)
+#  define dcgettext(Domainname, Msgid, Category)    (Msgid)
+#  define textdomain(Domainname)               while (0) /* nothing */
+#  define bindtextdomain(Domainname, Dirname)  while (0) /* nothing */
+#  define _(String)    (String)
+# endif
+#endif
+
+#ifdef gettext_noop
+# define N_(String)    gettext_noop(String)
+#else
+# define N_(String)    (String)
 #endif
-#define _(String)      gettext(String)
 
 #if !defined(HAVE_MERGESORT) || defined(lint)
 int mergesort(void *base, size_t nmemb, size_t size,
diff --git a/nointl/libintl.h b/nointl/libintl.h
deleted file mode 100644 (file)
index ced2e23..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $IdPath$
- * Dummy libintl.h for use on platforms that don't have it.
- */
-#define gettext(x)     x
-#define gettext_noop(x)        x
index ef560eae7a9350e87c983db97ff369880044d7df..95947581692dc7c7c5b869a818aab6e5fa48229a 100644 (file)
 # include <assert.h>
 #endif
 
-#ifdef gettext_noop
-#define N_(String)     gettext_noop(String)
-#else
-#define N_(String)     (String)
-#endif
-
 #include "bitvect.h"
 
 #include "globals.h"
@@ -102,6 +96,14 @@ main(int argc, char *argv[])
 {
     sectionhead *sections;
 
+#if defined(HAVE_SETLOCALE) && defined(HAVE_LC_MESSAGES)
+    setlocale(LC_MESSAGES, "");
+#endif
+#if defined(LOCALEDIR)
+    bindtextdomain(PACKAGE, LOCALEDIR);
+#endif
+    textdomain(PACKAGE);
+
     if (parse_cmdline(argc, argv, options, countof(options, opt_option)))
        return EXIT_FAILURE;
 
index fb4e0d50fd75b54ccd4ed933315e3695d6f563b0..a722c57b44c8f362271c2a02e722e23af85235f4 100644 (file)
 
 #if defined(lint)
 /*@dependent@*/ const char *gettext(const char *s);
+#define _(String)      gettext(String)
 #else
-#include <libintl.h>
+# ifdef HAVE_LOCALE_H
+#  include <locale.h>
+# endif
+
+# ifdef ENABLE_NLS
+#  include <libintl.h>
+#  define _(String)    gettext(String)
+# else
+#  define gettext(Msgid)    (Msgid)
+#  define dgettext(Domainname, Msgid)  (Msgid)
+#  define dcgettext(Domainname, Msgid, Category)    (Msgid)
+#  define textdomain(Domainname)               while (0) /* nothing */
+#  define bindtextdomain(Domainname, Dirname)  while (0) /* nothing */
+#  define _(String)    (String)
+# endif
+#endif
+
+#ifdef gettext_noop
+# define N_(String)    gettext_noop(String)
+#else
+# define N_(String)    (String)
 #endif
-#define _(String)      gettext(String)
 
 #if !defined(HAVE_MERGESORT) || defined(lint)
 int mergesort(void *base, size_t nmemb, size_t size,
diff --git a/util.h b/util.h
index fb4e0d50fd75b54ccd4ed933315e3695d6f563b0..a722c57b44c8f362271c2a02e722e23af85235f4 100644 (file)
--- a/util.h
+++ b/util.h
 
 #if defined(lint)
 /*@dependent@*/ const char *gettext(const char *s);
+#define _(String)      gettext(String)
 #else
-#include <libintl.h>
+# ifdef HAVE_LOCALE_H
+#  include <locale.h>
+# endif
+
+# ifdef ENABLE_NLS
+#  include <libintl.h>
+#  define _(String)    gettext(String)
+# else
+#  define gettext(Msgid)    (Msgid)
+#  define dgettext(Domainname, Msgid)  (Msgid)
+#  define dcgettext(Domainname, Msgid, Category)    (Msgid)
+#  define textdomain(Domainname)               while (0) /* nothing */
+#  define bindtextdomain(Domainname, Dirname)  while (0) /* nothing */
+#  define _(String)    (String)
+# endif
+#endif
+
+#ifdef gettext_noop
+# define N_(String)    gettext_noop(String)
+#else
+# define N_(String)    (String)
 #endif
-#define _(String)      gettext(String)
 
 #if !defined(HAVE_MERGESORT) || defined(lint)
 int mergesort(void *base, size_t nmemb, size_t size,