]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2009-01-01 Yves Blusseau <yves.blusseau@zetam.org>
authorYves Blusseau <blusseau@zetam.org>
Fri, 1 Jan 2010 20:32:30 +0000 (21:32 +0100)
committerYves Blusseau <blusseau@zetam.org>
Fri, 1 Jan 2010 20:32:30 +0000 (21:32 +0100)
* configure.ac: check external intl library
* Makefile.in: add compiler and linker flags to properly compile with
intl library
* include/grub/i18n.h: add a check to disable NLS
* util/misc.c (grub_util_init_nls): new function
* include/grub/util/misc.h: likewise
* util/elf/grub-mkimage.c: use the new function below to initialize NLS
* util/grub-editenv.c: likewise
* util/grub-emu.c: likewise
* util/grub-fstest.c: likewise
* util/grub-mkdevicemap.c: likewise
* util/grub-mkfont.c: likewise
* util/grub-mkrelpath.c: likewise
* util/grub-probe.c: likewise
* util/i386/pc/grub-mkimage.c: likewise
* util/i386/pc/grub-setup.c: likewise
* util/sparc64/ieee1275/grub-mkimage.c: likewise
* util/sparc64/ieee1275/grub-ofpathname.c: likewise
* util/sparc64/ieee1275/grub-setup.c: likewise
* util/mkisofs/mkisofs.h: add a check to disable NLS
* util/mkisofs/mkisofs.c: likewise

20 files changed:
Makefile.in
configure.ac
include/grub/i18n.h
include/grub/util/misc.h
util/elf/grub-mkimage.c
util/grub-editenv.c
util/grub-emu.c
util/grub-fstest.c
util/grub-mkdevicemap.c
util/grub-mkfont.c
util/grub-mkrelpath.c
util/grub-probe.c
util/i386/pc/grub-mkimage.c
util/i386/pc/grub-setup.c
util/misc.c
util/mkisofs/mkisofs.c
util/mkisofs/mkisofs.h
util/sparc64/ieee1275/grub-mkimage.c
util/sparc64/ieee1275/grub-ofpathname.c
util/sparc64/ieee1275/grub-setup.c

index 46b380cd5f0de83fb504f045017f94d3ade8cf7e..927db2cee3a40417508e6946d5c27921aa153e5c 100644 (file)
@@ -1,6 +1,6 @@
 # -*- makefile -*-
 #
-# Copyright (C) 1994,1995,1996,1997,1998,1999,2000,2001,2002,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
+# Copyright (C) 1994,1995,1996,1997,1998,1999,2000,2001,2002,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
 #
 # This Makefile.in is free software; the author
 # gives unlimited permission to copy and/or distribute it,
@@ -41,6 +41,9 @@ includedir = @includedir@
 pkgdatadir = $(datadir)/`echo @PACKAGE_TARNAME@ | sed '$(transform)'`
 pkglibdir =  $(libdir)/`echo @PACKAGE_TARNAME@/$(target_cpu)-$(platform) | sed '$(transform)'`
 
+# Internationalization library.
+LIBINTL = @LIBINTL@
+
 XGETTEXT = @XGETTEXT@
 MSGMERGE = @MSGMERGE@
 MSGFMT = @MSGFMT@
@@ -72,10 +75,12 @@ MKDIR_P = @MKDIR_P@
 
 mkinstalldirs = $(srcdir)/mkinstalldirs
 
+LIBS = @LIBS@ $(LIBINTL)
+
 CC = @CC@
 CFLAGS = @CFLAGS@
 ASFLAGS = @ASFLAGS@
-LDFLAGS = @LDFLAGS@
+LDFLAGS = @LDFLAGS@ $(LIBS)
 CPPFLAGS = @CPPFLAGS@ -I$(builddir) -I$(builddir)/include -I$(srcdir)/gnulib -I$(srcdir)/include -Wall -W \
         -DGRUB_LIBDIR=\"$(pkglibdir)\" -DLOCALEDIR=\"$(localedir)\"
 TARGET_CC = @TARGET_CC@
index 3cac421e8e5d60500881e67cd6a35c0c4d3f5262..4b5b5dd5a0271f564b9e7808d167caa5e5d738e2 100644 (file)
@@ -1,6 +1,6 @@
 # Process this file with autoconf to produce a configure script.
 
-# Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009  Free Software Foundation, Inc.
+# Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010  Free Software Foundation, Inc.
 #
 # This configure.ac is free software; the author
 # gives unlimited permission to copy and/or distribute it,
@@ -178,7 +178,7 @@ AC_PROG_CC
 test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
 
 AC_GNU_SOURCE
-AM_GNU_GETTEXT
+AM_GNU_GETTEXT([external])
 AC_SYS_LARGEFILE
 
 # Identify characteristics of the host architecture.
index f6f4687443e07517dbba674f9cecca43c80678d4..4d4a0b7bdbef22e66ca49866180696a2d779ce98 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2009  Free Software Foundation, Inc.
+ *  Copyright (C) 2009,2010  Free Software Foundation, Inc.
  *
  *  GRUB is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
 #ifndef        GRUB_I18N_H
 #define        GRUB_I18N_H     1
 
-#ifdef GRUB_UTIL
-# include <locale.h>
-# include <libintl.h>
-# define _(str) gettext(str)
-#else
-# define _(str) grub_gettext(str)
+#include <config.h>
+#include <grub/symbol.h>
 
 const char *EXPORT_FUNC(grub_gettext_dummy) (const char *s);
 extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s);
 
-#endif
+/* NLS can be disabled through the configure --disable-nls option.  */
+#if ENABLE_NLS
+
+# ifdef GRUB_UTIL
+
+#  include <locale.h>
+#  include <libintl.h>
+
+# endif /* GRUB_UTIL */
+
+#else /* ! ENABLE_NLS */
+
+/* Disabled NLS.
+   The casts to 'const char *' serve the purpose of producing warnings
+   for invalid uses of the value returned from these functions.
+   On pre-ANSI systems without 'const', the config.h file is supposed to
+   contain "#define const".  */
+# ifdef GRUB_UTIL
+#  define gettext(Msgid) ((const char *) (Msgid))
+# else
+#  define grub_gettext(str) ((const char *) (str))
+# endif /* GRUB_UTIL */
+
+#endif /* ENABLE_NLS */
+
+#ifdef GRUB_UTIL
+# define _(str) gettext(str)
+#else
+# define _(str) grub_gettext(str)
+#endif /* GRUB_UTIL */
 
 #define N_(str) str
 
index 09108547c45f96e4e97c487f0f7063fd73f45a33..373fff8bb317c9d58a2d559d043e26aeeee7a8c9 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2002,2003,2005,2006,2007,2008,2009  Free Software Foundation, Inc.
+ *  Copyright (C) 2002,2003,2005,2006,2007,2008,2009,2010  Free Software Foundation, Inc.
  *
  *  GRUB is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -88,4 +88,6 @@ grub_int64_t grub_util_get_disk_size (char *name);
 
 char *make_system_path_relative_to_its_root (const char *path);
 
+void grub_util_init_nls (void);
+
 #endif /* ! GRUB_UTIL_MISC_HEADER */
index 5750543adee4b8f3debabf9c4af13c1d33f2b4fe..6ba8b1ae235b07299f66d74a8e60f9d11ff4f9f8 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2004,2005,2006,2007,2008,2009  Free Software Foundation, Inc.
+ *  Copyright (C) 2004,2005,2006,2007,2008,2009,2010  Free Software Foundation, Inc.
  *
  *  GRUB is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -361,9 +361,8 @@ main (int argc, char *argv[])
   int chrp = 0;
 
   set_program_name (argv[0]);
-  setlocale (LC_ALL, "");
-  bindtextdomain (PACKAGE, LOCALEDIR);
-  textdomain (PACKAGE);
+
+  grub_util_init_nls ();
 
   while (1)
     {
index 68fb23b158b3dd258941a2ef6a1c1f036967874d..b6b7315492274ced0d37362442517f997f1f33ca 100644 (file)
@@ -1,7 +1,7 @@
 /* grub-editenv.c - tool to edit environment block.  */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2008,2009 Free Software Foundation, Inc.
+ *  Copyright (C) 2008,2009,2010 Free Software Foundation, Inc.
  *
  *  GRUB is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -256,9 +256,8 @@ main (int argc, char *argv[])
   char *command;
 
   set_program_name (argv[0]);
-  setlocale (LC_ALL, "");
-  bindtextdomain (PACKAGE, LOCALEDIR);
-  textdomain (PACKAGE);
+
+  grub_util_init_nls ();
 
   /* Check for options.  */
   while (1)
index e65c8585e550ec18ce0ab01627b72e51c6b3e3a5..3f2acaaec12a0b11b8ecfa1f0e653ee2edd450ab 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2003,2004,2005,2006,2007,2008,2009  Free Software Foundation, Inc.
+ *  Copyright (C) 2003,2004,2005,2006,2007,2008,2009,2010  Free Software Foundation, Inc.
  *
  *  GRUB is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -159,9 +159,8 @@ main (int argc, char *argv[])
   int opt;
 
   set_program_name (argv[0]);
-  setlocale (LC_ALL, "");
-  bindtextdomain (PACKAGE, LOCALEDIR);
-  textdomain (PACKAGE);
+
+  grub_util_init_nls ();
 
   while ((opt = getopt_long (argc, argv, "r:d:m:vH:hV", options, 0)) != -1)
     switch (opt)
index fa54fe41492bd58e7c58fe2ef747f5d6af4758fb..586dda0f985b7a4c1bfe6227bce1f687afdbdbfe 100644 (file)
@@ -1,7 +1,7 @@
 /* grub-fstest.c - debug tool for filesystem driver */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2008,2009 Free Software Foundation, Inc.
+ *  Copyright (C) 2008,2009,2010 Free Software Foundation, Inc.
  *
  *  GRUB is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -384,9 +384,8 @@ main (int argc, char *argv[])
   int i, cmd, num_opts, image_index, num_disks = 1;
 
   set_program_name (argv[0]);
-  setlocale (LC_ALL, "");
-  bindtextdomain (PACKAGE, LOCALEDIR);
-  textdomain (PACKAGE);
+
+  grub_util_init_nls ();
 
   /* Find the first non option entry.  */
   for (num_opts = 1; num_opts < argc; num_opts++)
index 2b69f905e6718397e6898c9924471b7e848d2d56..b4febbb8dba476b3de9d4b4ae05b5d35195e4722 100644 (file)
@@ -1,7 +1,7 @@
 /* grub-mkdevicemap.c - make a device map file automatically */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2007,2008,2009 Free Software Foundation, Inc.
+ *  Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2007,2008,2009,2010 Free Software Foundation, Inc.
  *
  *  GRUB is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -112,9 +112,8 @@ main (int argc, char *argv[])
   int floppy_disks = 1;
 
   set_program_name (argv[0]);
-  setlocale (LC_ALL, "");
-  bindtextdomain (PACKAGE, LOCALEDIR);
-  textdomain (PACKAGE);
+
+  grub_util_init_nls ();
 
   /* Check for options.  */
   while (1)
index 9775e080319d580c795f0a92a461effa594374ef..a358ba5b085da084c43342aae828fa101a3200cf 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2009 Free Software Foundation, Inc.
+ *  Copyright (C) 2009,2010 Free Software Foundation, Inc.
  *
  *  GRUB is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -476,9 +476,8 @@ main (int argc, char *argv[])
   memset (&font_info, 0, sizeof (font_info));
 
   set_program_name (argv[0]);
-  setlocale (LC_ALL, "");
-  bindtextdomain (PACKAGE, LOCALEDIR);
-  textdomain (PACKAGE);
+
+  grub_util_init_nls ();
 
   /* Check for options.  */
   while (1)
index 956e52ed7dc168a8c7d88fd49c25b40cf6588b43..62e400814a9bc765e439bdc65156b2e0fa893053 100644 (file)
@@ -1,7 +1,7 @@
 /* grub-mkrelpath.c - make a system path relative to its root */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2009 Free Software Foundation, Inc.
+ *  Copyright (C) 2009,2010 Free Software Foundation, Inc.
  *
  *  GRUB is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -56,9 +56,8 @@ main (int argc, char *argv[])
   char *argument, *relpath;
 
   set_program_name (argv[0]);
-  setlocale (LC_ALL, "");
-  bindtextdomain (PACKAGE, LOCALEDIR);
-  textdomain (PACKAGE);
+
+  grub_util_init_nls ();
 
   /* Check for options.  */
   while (1)
index ebf5142d4e748b8194361e43a113c4aa3b507772..4ba8a98e53d157f8a08b02a2d260db053876b9cc 100644 (file)
@@ -1,7 +1,7 @@
 /* grub-probe.c - probe device information for a given path */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2005,2006,2007,2008,2009  Free Software Foundation, Inc.
+ *  Copyright (C) 2005,2006,2007,2008,2009,2010  Free Software Foundation, Inc.
  *
  *  GRUB is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -338,9 +338,8 @@ main (int argc, char *argv[])
   char *argument;
 
   set_program_name (argv[0]);
-  setlocale (LC_ALL, "");
-  bindtextdomain (PACKAGE, LOCALEDIR);
-  textdomain (PACKAGE);
+
+  grub_util_init_nls ();
 
   /* Check for options.  */
   while (1)
index 3c2cb7549b0d9f095551cb1499b5f7a5e79ed520..aaa1a13dbc7cebfb5c78ede1769c3368517d8df1 100644 (file)
@@ -1,7 +1,7 @@
 /* grub-mkimage.c - make a bootable image */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009  Free Software Foundation, Inc.
+ *  Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010  Free Software Foundation, Inc.
  *
  *  GRUB is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -351,9 +351,8 @@ main (int argc, char *argv[])
   FILE *fp = stdout;
 
   set_program_name (argv[0]);
-  setlocale (LC_ALL, "");
-  bindtextdomain (PACKAGE, LOCALEDIR);
-  textdomain (PACKAGE);
+
+  grub_util_init_nls ();
 
   while (1)
     {
index c2b9b9268627b12d88557c79f72c230980ece687..5a1cbb27a0ecb51a8fde4df623c45fcbb559f3da 100644 (file)
@@ -1,7 +1,7 @@
 /* grub-setup.c - make GRUB usable */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009  Free Software Foundation, Inc.
+ *  Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010  Free Software Foundation, Inc.
  *
  *  GRUB is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -641,9 +641,8 @@ main (int argc, char *argv[])
   int must_embed = 0, force = 0, fs_probe = 1;
 
   set_program_name (argv[0]);
-  setlocale (LC_ALL, "");
-  bindtextdomain (PACKAGE, LOCALEDIR);
-  textdomain (PACKAGE);
+
+  grub_util_init_nls ();
 
   /* Check for options.  */
   while (1)
index 6aa92fb643b8ca2c7dafc3206cf4a1962611ec3c..d8aa041bebd5ee1f9ea75e9d6e31e24095c46226 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2002,2003,2005,2006,2007,2008,2009  Free Software Foundation, Inc.
+ *  Copyright (C) 2002,2003,2005,2006,2007,2008,2009,2010  Free Software Foundation, Inc.
  *
  *  GRUB is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -38,6 +38,7 @@
 #include <grub/mm.h>
 #include <grub/term.h>
 #include <grub/time.h>
+#include <grub/i18n.h>
 
 #include "progname.h"
 
@@ -566,3 +567,13 @@ make_system_path_relative_to_its_root (const char *path)
 
   return buf3;
 }
+
+void
+grub_util_init_nls (void)
+{
+#if ENABLE_NLS
+  setlocale (LC_ALL, "");
+  bindtextdomain (PACKAGE, LOCALEDIR);
+  textdomain (PACKAGE);
+#endif /* ENABLE_NLS */
+}
index 8e99d5c18e39849a6b5dd651f3371e8d71ef78a1..dffe4f703ac9fe1040ef35eb1472991256485c7e 100644 (file)
@@ -6,7 +6,7 @@
 
    Copyright 1993 Yggdrasil Computing, Incorporated
 
-   Copyright (C) 2009  Free Software Foundation, Inc.
+   Copyright (C) 2009,2010  Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -645,9 +645,11 @@ int FDECL2(main, int, argc, char **, argv){
   char *log_file = 0;
 
   set_program_name (argv[0]);
+#if ENABLE_NLS
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
+#endif /* ENABLE_NLS */
 
   if (argc < 2)
     usage();
index 79ae50251c72fbc1b234d1be6b8f8eb7920b0a9b..482db6ceb41e60a49a884b5d0699f0fa6caa440a 100644 (file)
@@ -5,7 +5,7 @@
 
    Copyright 1993 Yggdrasil Computing, Incorporated
 
-   Copyright (C) 2009  Free Software Foundation, Inc.
+   Copyright (C) 2009,2010  Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 #include <prototyp.h>
 #include <sys/stat.h>
 
-#include <locale.h>
-#include <libintl.h>
+#if ENABLE_NLS
+
+#  include <locale.h>
+#  include <libintl.h>
+
+#else /* ! ENABLE_NLS */
+
+/* Disabled NLS.
+   The casts to 'const char *' serve the purpose of producing warnings
+   for invalid uses of the value returned from these functions.
+   On pre-ANSI systems without 'const', the config.h file is supposed to
+   contain "#define const".  */
+#  define gettext(Msgid) ((const char *) (Msgid))
+#endif /* ENABLE_NLS */
+
 #define _(str) gettext(str)
 #define N_(str) str
 
index d756586af9eb5580d6f1ac5dfe1cca6211bfd23b..b79bbeb412ed3987a76beb1d17073ad7a9d24b97 100644 (file)
@@ -1,7 +1,7 @@
 /* grub-mkimage.c - make a bootable image */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2008,2009  Free Software Foundation, Inc.
+ *  Copyright (C) 2008,2009,2010  Free Software Foundation, Inc.
  *
  *  GRUB is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -222,9 +222,8 @@ main (int argc, char *argv[])
   FILE *fp = stdout;
 
   set_program_name (argv[0]);
-  setlocale (LC_ALL, "");
-  bindtextdomain (PACKAGE, LOCALEDIR);
-  textdomain (PACKAGE);
+
+  grub_util_init_ls ();
 
   while (1)
     {
index 166ce4cbe9347f993f8b6ecae5f60658ff560eba..3ac6fce8bd7fa69e0af097dd0e1c929c464a4a4f 100644 (file)
@@ -1,7 +1,7 @@
 /* grub-ofpathname.c - Find OpenBOOT path for a given device */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2009  Free Software Foundation, Inc.
+ *  Copyright (C) 2009,2010  Free Software Foundation, Inc.
  *
  *  GRUB is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -29,9 +29,8 @@ int main(int argc, char **argv)
   char *of_path;
 
   set_program_name (argv[0]);
-  setlocale (LC_ALL, "");
-  bindtextdomain (PACKAGE, LOCALEDIR);
-  textdomain (PACKAGE);
+
+  grub_util_init_nls ();
 
   if (argc != 2)
     {
index ade1bd595c27c8758b9066f81ba22f2d111a6706..9d8e675625335662312c2a11a61d0a9f02f93d34 100644 (file)
@@ -1,7 +1,7 @@
 /* grub-setup.c - make GRUB usable */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009  Free Software Foundation, Inc.
+ *  Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010  Free Software Foundation, Inc.
  *
  *  GRUB is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -620,9 +620,8 @@ main (int argc, char *argv[])
   struct grub_setup_info ginfo;
 
   set_program_name (argv[0]);
-  setlocale (LC_ALL, "");
-  bindtextdomain (PACKAGE, LOCALEDIR);
-  textdomain (PACKAGE);
+
+  grub_util_init_nls ();
 
   init_info (&ginfo);
   if (!parse_options (&ginfo, argc, argv))