From: Peter Johnson Date: Sun, 2 Dec 2001 06:40:17 +0000 (-0000) Subject: Do intl more correctly. nointl/libintl.h is unnecessary; it can be detected X-Git-Tag: v0.1.0~158 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3b496cdde785d6a2d9f80f5ba3feb1cc87cba12c;p=yasm Do intl more correctly. nointl/libintl.h is unnecessary; it can be detected in util.h by the ENABLE_NLS define. Fix Mkfiles to reflect. Actually enable if available in main(). svn path=/trunk/yasm/; revision=372 --- diff --git a/Makefile.am b/Makefile.am index ed6e0eec..fcafeae5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 diff --git a/Mkfiles/Makefile.dj b/Mkfiles/Makefile.dj index df17d15e..9e270f7b 100644 --- a/Mkfiles/Makefile.dj +++ b/Mkfiles/Makefile.dj @@ -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 diff --git a/Mkfiles/Makefile.flat b/Mkfiles/Makefile.flat index 0f8b9713..ed0d051d 100644 --- a/Mkfiles/Makefile.flat +++ b/Mkfiles/Makefile.flat @@ -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 diff --git a/Mkfiles/Makefile.vc b/Mkfiles/Makefile.vc index 5c454a9d..4cd48a78 100644 --- a/Mkfiles/Makefile.vc +++ b/Mkfiles/Makefile.vc @@ -10,7 +10,7 @@ # copy Mkfiles/config.h.vc config.h # nmake -fMkfiles/Makefile.vc -CFLAGS=/DHAVE_CONFIG_H /I. /Isrc /Isrc/arch/x86 /Inointl +CFLAGS=/DHAVE_CONFIG_H /I. /Isrc /Isrc/arch/x86 CC=cl all: src\yasm.exe diff --git a/frontends/yasm/yasm.c b/frontends/yasm/yasm.c index ef560eae..95947581 100644 --- a/frontends/yasm/yasm.c +++ b/frontends/yasm/yasm.c @@ -26,12 +26,6 @@ # include #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; diff --git a/libyasm/util.h b/libyasm/util.h index fb4e0d50..a722c57b 100644 --- a/libyasm/util.h +++ b/libyasm/util.h @@ -38,10 +38,30 @@ #if defined(lint) /*@dependent@*/ const char *gettext(const char *s); +#define _(String) gettext(String) #else -#include +# ifdef HAVE_LOCALE_H +# include +# endif + +# ifdef ENABLE_NLS +# include +# 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 index ced2e23c..00000000 --- a/nointl/libintl.h +++ /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 diff --git a/src/main.c b/src/main.c index ef560eae..95947581 100644 --- a/src/main.c +++ b/src/main.c @@ -26,12 +26,6 @@ # include #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; diff --git a/src/util.h b/src/util.h index fb4e0d50..a722c57b 100644 --- a/src/util.h +++ b/src/util.h @@ -38,10 +38,30 @@ #if defined(lint) /*@dependent@*/ const char *gettext(const char *s); +#define _(String) gettext(String) #else -#include +# ifdef HAVE_LOCALE_H +# include +# endif + +# ifdef ENABLE_NLS +# include +# 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 fb4e0d50..a722c57b 100644 --- a/util.h +++ b/util.h @@ -38,10 +38,30 @@ #if defined(lint) /*@dependent@*/ const char *gettext(const char *s); +#define _(String) gettext(String) #else -#include +# ifdef HAVE_LOCALE_H +# include +# endif + +# ifdef ENABLE_NLS +# include +# 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,