All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] compilation with external intl library
@ 2009-12-30 10:23 Yves Blusseau
  2010-01-01 12:00 ` Robert Millan
  0 siblings, 1 reply; 4+ messages in thread
From: Yves Blusseau @ 2009-12-30 10:23 UTC (permalink / raw)
  To: The development of GRUB 2

[-- Attachment #1: Type: text/plain, Size: 902 bytes --]

Hi,

this is the patch to "fix" compilation with external intl library. It fix the #28356 bug (http://savannah.gnu.org/bugs/?28356).

I follow strictly the guideline of gettext, and now we can compile grub with external intl library.

Some enhancements;
	- We can disable NLS (Native Language Support) with the --disable-nls configure flag.
	- We can choose where the external intl library is with the --with-libintl-prefix configure flag.

Under linux the gettext macro detect that the gettext function is in libc and so don't add any flags (like before).
On other platform like Mac OSX, the macro add the proper compile and link flags (ex: -lintl -liconv -lc  -Wl,-framework -Wl,CoreFoundation in OSX)

Best Regards,
Yves Blusseau

PS: if it ok i'll commit this patch and will add another one to make on error if the intl library can't be use and show alternative to compile grub.


[-- Attachment #2: intl.patch --]
[-- Type: application/octet-stream, Size: 31455 bytes --]

------------------------------------------------------------
revno: 2002
committer: Yves Blusseau  <blusseau@zetam.org>
branch nick: mainline
timestamp: Wed 2009-12-30 11:08:12 +0100
message:
  2009-12-30  Yves Blusseau  <yves.blusseau@zetam.org>
  
      * configure.ac: check external intl library
      * Makefile.in: add compiler and linker flags to properly compile with
      intl library
      * config.rpath: new file used by gettext m4 macros
      * include/grub/i18n.h: add a check to disable NLS
      * util/elf/grub-mkimage.c: likewise
      * 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: use the new i18n.h header
      * util/mkisofs/mkisofs.c: fix a warning about a bad cast
diff:
=== modified file 'ChangeLog'
--- ChangeLog	2009-12-28 18:11:59 +0000
+++ ChangeLog	2009-12-30 10:08:12 +0000
@@ -1,3 +1,26 @@
+2009-12-30  Yves Blusseau  <yves.blusseau@zetam.org>
+
+	* configure.ac: check external intl library
+	* Makefile.in: add compiler and linker flags to properly compile with
+	intl library
+	* config.rpath: new file used by gettext m4 macros
+	* include/grub/i18n.h: add a check to disable NLS
+	* util/elf/grub-mkimage.c: likewise
+	* 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: use the new i18n.h header
+	* util/mkisofs/mkisofs.c: fix a warning about a bad cast
+
 2009-12-28  Carles Pina i Estany  <carles@pina.cat>
 
 	* normal/misc.c (grub_normal_print_device_info): Add spaces and double

=== modified file 'Makefile.in'
--- Makefile.in	2009-12-21 22:06:04 +0000
+++ Makefile.in	2009-12-30 10:08:12 +0000
@@ -41,6 +41,9 @@
 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 @@
 
 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@

=== added file 'config.rpath'
--- config.rpath	1970-01-01 00:00:00 +0000
+++ config.rpath	2009-12-30 10:08:12 +0000
@@ -0,0 +1,666 @@
+#! /bin/sh
+# Output a system dependent set of variables, describing how to set the
+# run time search path of shared libraries in an executable.
+#
+#   Copyright 1996-2007 Free Software Foundation, Inc.
+#   Taken from GNU libtool, 2001
+#   Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+#   This file is free software; the Free Software Foundation gives
+#   unlimited permission to copy and/or distribute it, with or without
+#   modifications, as long as this notice is preserved.
+#
+# The first argument passed to this file is the canonical host specification,
+#    CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or
+#    CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
+# should be set by the caller.
+#
+# The set of defined variables is at the end of this script.
+
+# Known limitations:
+# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
+#   than 256 bytes, otherwise the compiler driver will dump core. The only
+#   known workaround is to choose shorter directory names for the build
+#   directory and/or the installation directory.
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+shrext=.so
+
+host="$1"
+host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+# Code taken from libtool.m4's _LT_CC_BASENAME.
+
+for cc_temp in $CC""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
+
+# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
+
+wl=
+if test "$GCC" = yes; then
+  wl='-Wl,'
+else
+  case "$host_os" in
+    aix*)
+      wl='-Wl,'
+      ;;
+    darwin*)
+      case $cc_basename in
+        xlc*)
+          wl='-Wl,'
+          ;;
+      esac
+      ;;
+    mingw* | cygwin* | pw32* | os2*)
+      ;;
+    hpux9* | hpux10* | hpux11*)
+      wl='-Wl,'
+      ;;
+    irix5* | irix6* | nonstopux*)
+      wl='-Wl,'
+      ;;
+    newsos6)
+      ;;
+    linux* | k*bsd*-gnu)
+      case $cc_basename in
+        icc* | ecc*)
+          wl='-Wl,'
+          ;;
+        pgcc | pgf77 | pgf90)
+          wl='-Wl,'
+          ;;
+        ccc*)
+          wl='-Wl,'
+          ;;
+        como)
+          wl='-lopt='
+          ;;
+        *)
+          case `$CC -V 2>&1 | sed 5q` in
+            *Sun\ C*)
+              wl='-Wl,'
+              ;;
+          esac
+          ;;
+      esac
+      ;;
+    osf3* | osf4* | osf5*)
+      wl='-Wl,'
+      ;;
+    rdos*)
+      ;;
+    solaris*)
+      wl='-Wl,'
+      ;;
+    sunos4*)
+      wl='-Qoption ld '
+      ;;
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      wl='-Wl,'
+      ;;
+    sysv4*MP*)
+      ;;
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      wl='-Wl,'
+      ;;
+    unicos*)
+      wl='-Wl,'
+      ;;
+    uts4*)
+      ;;
+  esac
+fi
+
+# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
+
+hardcode_libdir_flag_spec=
+hardcode_libdir_separator=
+hardcode_direct=no
+hardcode_minus_L=no
+
+case "$host_os" in
+  cygwin* | mingw* | pw32*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+esac
+
+ld_shlibs=yes
+if test "$with_gnu_ld" = yes; then
+  # Set some defaults for GNU ld with shared library support. These
+  # are reset later if shared libraries are not supported. Putting them
+  # here allows them to be overridden if necessary.
+  # Unlike libtool, we use -rpath here, not --rpath, since the documented
+  # option of GNU ld is called -rpath, not --rpath.
+  hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+  case "$host_os" in
+    aix3* | aix4* | aix5*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+        ld_shlibs=no
+      fi
+      ;;
+    amigaos*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+      # that the semantics of dynamic libraries on AmigaOS, at least up
+      # to version 4, is to share data among multiple programs linked
+      # with the same dynamic library.  Since this doesn't match the
+      # behavior of shared libraries on other platforms, we cannot use
+      # them.
+      ld_shlibs=no
+      ;;
+    beos*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    cygwin* | mingw* | pw32*)
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec='-L$libdir'
+      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    interix[3-9]*)
+      hardcode_direct=no
+      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+      ;;
+    gnu* | linux* | k*bsd*-gnu)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    netbsd*)
+      ;;
+    solaris*)
+      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+        ld_shlibs=no
+      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+          ld_shlibs=no
+          ;;
+        *)
+          if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+            hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+          else
+            ld_shlibs=no
+          fi
+          ;;
+      esac
+      ;;
+    sunos4*)
+      hardcode_direct=yes
+      ;;
+    *)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+  esac
+  if test "$ld_shlibs" = no; then
+    hardcode_libdir_flag_spec=
+  fi
+else
+  case "$host_os" in
+    aix3*)
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L=yes
+      if test "$GCC" = yes; then
+        # Neither direct hardcoding nor static linking is supported with a
+        # broken collect2.
+        hardcode_direct=unsupported
+      fi
+      ;;
+    aix4* | aix5*)
+      if test "$host_cpu" = ia64; then
+        # On IA64, the linker does run time linking by default, so we don't
+        # have to do anything special.
+        aix_use_runtimelinking=no
+      else
+        aix_use_runtimelinking=no
+        # Test if we are trying to use run time linking or normal
+        # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+        # need to do runtime linking.
+        case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+          for ld_flag in $LDFLAGS; do
+            if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+              aix_use_runtimelinking=yes
+              break
+            fi
+          done
+          ;;
+        esac
+      fi
+      hardcode_direct=yes
+      hardcode_libdir_separator=':'
+      if test "$GCC" = yes; then
+        case $host_os in aix4.[012]|aix4.[012].*)
+          collect2name=`${CC} -print-prog-name=collect2`
+          if test -f "$collect2name" && \
+            strings "$collect2name" | grep resolve_lib_name >/dev/null
+          then
+            # We have reworked collect2
+            :
+          else
+            # We have old collect2
+            hardcode_direct=unsupported
+            hardcode_minus_L=yes
+            hardcode_libdir_flag_spec='-L$libdir'
+            hardcode_libdir_separator=
+          fi
+          ;;
+        esac
+      fi
+      # Begin _LT_AC_SYS_LIBPATH_AIX.
+      echo 'int main () { return 0; }' > conftest.c
+      ${CC} ${LDFLAGS} conftest.c -o conftest
+      aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+      if test -z "$aix_libpath"; then
+        aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+      fi
+      if test -z "$aix_libpath"; then
+        aix_libpath="/usr/lib:/lib"
+      fi
+      rm -f conftest.c conftest
+      # End _LT_AC_SYS_LIBPATH_AIX.
+      if test "$aix_use_runtimelinking" = yes; then
+        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+      else
+        if test "$host_cpu" = ia64; then
+          hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+        else
+          hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+        fi
+      fi
+      ;;
+    amigaos*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      # see comment about different semantics on the GNU ld section
+      ld_shlibs=no
+      ;;
+    bsdi[45]*)
+      ;;
+    cygwin* | mingw* | pw32*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec=' '
+      libext=lib
+      ;;
+    darwin* | rhapsody*)
+      hardcode_direct=no
+      if test "$GCC" = yes ; then
+        :
+      else
+        case $cc_basename in
+          xlc*)
+            ;;
+          *)
+            ld_shlibs=no
+            ;;
+        esac
+      fi
+      ;;
+    dgux*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      ;;
+    freebsd1*)
+      ld_shlibs=no
+      ;;
+    freebsd2.2*)
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      ;;
+    freebsd2*)
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      ;;
+    freebsd* | dragonfly*)
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      ;;
+    hpux9*)
+      hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_direct=yes
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L=yes
+      ;;
+    hpux10*)
+      if test "$with_gnu_ld" = no; then
+        hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+        hardcode_libdir_separator=:
+        hardcode_direct=yes
+        # hardcode_minus_L: Not really in the search PATH,
+        # but as the default location of the library.
+        hardcode_minus_L=yes
+      fi
+      ;;
+    hpux11*)
+      if test "$with_gnu_ld" = no; then
+        hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+        hardcode_libdir_separator=:
+        case $host_cpu in
+          hppa*64*|ia64*)
+            hardcode_direct=no
+            ;;
+          *)
+            hardcode_direct=yes
+            # hardcode_minus_L: Not really in the search PATH,
+            # but as the default location of the library.
+            hardcode_minus_L=yes
+            ;;
+        esac
+      fi
+      ;;
+    irix5* | irix6* | nonstopux*)
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      ;;
+    netbsd*)
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      ;;
+    newsos6)
+      hardcode_direct=yes
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      ;;
+    openbsd*)
+      if test -f /usr/libexec/ld.so; then
+        hardcode_direct=yes
+        if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+          hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+        else
+          case "$host_os" in
+            openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+              hardcode_libdir_flag_spec='-R$libdir'
+              ;;
+            *)
+              hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+              ;;
+          esac
+        fi
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    os2*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      ;;
+    osf3*)
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      ;;
+    osf4* | osf5*)
+      if test "$GCC" = yes; then
+        hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      else
+        # Both cc and cxx compiler support -rpath directly
+        hardcode_libdir_flag_spec='-rpath $libdir'
+      fi
+      hardcode_libdir_separator=:
+      ;;
+    solaris*)
+      hardcode_libdir_flag_spec='-R$libdir'
+      ;;
+    sunos4*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      ;;
+    sysv4)
+      case $host_vendor in
+        sni)
+          hardcode_direct=yes # is this really true???
+          ;;
+        siemens)
+          hardcode_direct=no
+          ;;
+        motorola)
+          hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+          ;;
+      esac
+      ;;
+    sysv4.3*)
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+        ld_shlibs=yes
+      fi
+      ;;
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+      ;;
+    sysv5* | sco3.2v5* | sco5v6*)
+      hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+      hardcode_libdir_separator=':'
+      ;;
+    uts4*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      ;;
+    *)
+      ld_shlibs=no
+      ;;
+  esac
+fi
+
+# Check dynamic linker characteristics
+# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
+# Unlike libtool.m4, here we don't care about _all_ names of the library, but
+# only about the one the linker finds when passed -lNAME. This is the last
+# element of library_names_spec in libtool.m4, or possibly two of them if the
+# linker has special search rules.
+library_names_spec=      # the last element of library_names_spec in libtool.m4
+libname_spec='lib$name'
+case "$host_os" in
+  aix3*)
+    library_names_spec='$libname.a'
+    ;;
+  aix4* | aix5*)
+    library_names_spec='$libname$shrext'
+    ;;
+  amigaos*)
+    library_names_spec='$libname.a'
+    ;;
+  beos*)
+    library_names_spec='$libname$shrext'
+    ;;
+  bsdi[45]*)
+    library_names_spec='$libname$shrext'
+    ;;
+  cygwin* | mingw* | pw32*)
+    shrext=.dll
+    library_names_spec='$libname.dll.a $libname.lib'
+    ;;
+  darwin* | rhapsody*)
+    shrext=.dylib
+    library_names_spec='$libname$shrext'
+    ;;
+  dgux*)
+    library_names_spec='$libname$shrext'
+    ;;
+  freebsd1*)
+    ;;
+  freebsd* | dragonfly*)
+    case "$host_os" in
+      freebsd[123]*)
+        library_names_spec='$libname$shrext$versuffix' ;;
+      *)
+        library_names_spec='$libname$shrext' ;;
+    esac
+    ;;
+  gnu*)
+    library_names_spec='$libname$shrext'
+    ;;
+  hpux9* | hpux10* | hpux11*)
+    case $host_cpu in
+      ia64*)
+        shrext=.so
+        ;;
+      hppa*64*)
+        shrext=.sl
+        ;;
+      *)
+        shrext=.sl
+        ;;
+    esac
+    library_names_spec='$libname$shrext'
+    ;;
+  interix[3-9]*)
+    library_names_spec='$libname$shrext'
+    ;;
+  irix5* | irix6* | nonstopux*)
+    library_names_spec='$libname$shrext'
+    case "$host_os" in
+      irix5* | nonstopux*)
+        libsuff= shlibsuff=
+        ;;
+      *)
+        case $LD in
+          *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
+          *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
+          *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
+          *) libsuff= shlibsuff= ;;
+        esac
+        ;;
+    esac
+    ;;
+  linux*oldld* | linux*aout* | linux*coff*)
+    ;;
+  linux* | k*bsd*-gnu)
+    library_names_spec='$libname$shrext'
+    ;;
+  knetbsd*-gnu)
+    library_names_spec='$libname$shrext'
+    ;;
+  netbsd*)
+    library_names_spec='$libname$shrext'
+    ;;
+  newsos6)
+    library_names_spec='$libname$shrext'
+    ;;
+  nto-qnx*)
+    library_names_spec='$libname$shrext'
+    ;;
+  openbsd*)
+    library_names_spec='$libname$shrext$versuffix'
+    ;;
+  os2*)
+    libname_spec='$name'
+    shrext=.dll
+    library_names_spec='$libname.a'
+    ;;
+  osf3* | osf4* | osf5*)
+    library_names_spec='$libname$shrext'
+    ;;
+  rdos*)
+    ;;
+  solaris*)
+    library_names_spec='$libname$shrext'
+    ;;
+  sunos4*)
+    library_names_spec='$libname$shrext$versuffix'
+    ;;
+  sysv4 | sysv4.3*)
+    library_names_spec='$libname$shrext'
+    ;;
+  sysv4*MP*)
+    library_names_spec='$libname$shrext'
+    ;;
+  sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+    library_names_spec='$libname$shrext'
+    ;;
+  uts4*)
+    library_names_spec='$libname$shrext'
+    ;;
+esac
+
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
+shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
+escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
+escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
+escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
+
+LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
+
+# How to pass a linker flag through the compiler.
+wl="$escaped_wl"
+
+# Static library suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally "so").
+shlibext="$shlibext"
+
+# Format of library name prefix.
+libname_spec="$escaped_libname_spec"
+
+# Library names that the linker finds when passed -lNAME.
+library_names_spec="$escaped_library_names_spec"
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator="$hardcode_libdir_separator"
+
+# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct="$hardcode_direct"
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L="$hardcode_minus_L"
+
+EOF

=== modified file 'configure.ac'
--- configure.ac	2009-12-11 21:12:57 +0000
+++ configure.ac	2009-12-30 10:08:12 +0000
@@ -173,7 +173,7 @@
 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.

=== modified file 'include/grub/i18n.h'
--- include/grub/i18n.h	2009-11-24 21:42:14 +0000
+++ include/grub/i18n.h	2009-12-30 10:08:12 +0000
@@ -19,17 +19,39 @@
 #ifndef	GRUB_I18N_H
 #define	GRUB_I18N_H	1
 
+#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);
+
+/* 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".  */
+# define gettext(Msgid) ((const char *) (Msgid))
+# define grub_gettext(str) ((const char *) (str))
+
+#endif /* ENABLE_NLS */
+
 #ifdef GRUB_UTIL
-# include <locale.h>
-# include <libintl.h>
 # define _(str) gettext(str)
 #else
 # define _(str) grub_gettext(str)
-
-const char *EXPORT_FUNC(grub_gettext_dummy) (const char *s);
-extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s);
-
-#endif
+#endif /* GRUB_UTIL */
 
 #define N_(str) str
 

=== modified file 'util/elf/grub-mkimage.c'
--- util/elf/grub-mkimage.c	2009-11-25 23:10:02 +0000
+++ util/elf/grub-mkimage.c	2009-12-30 10:08:12 +0000
@@ -361,9 +361,13 @@
   int chrp = 0;
 
   set_program_name (argv[0]);
+
+/* NLS can be disabled through the configure --disable-nls option.  */
+#if ENABLE_NLS
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
+#endif /* ENABLE_NLS */
 
   while (1)
     {

=== modified file 'util/grub-editenv.c'
--- util/grub-editenv.c	2009-12-07 16:46:24 +0000
+++ util/grub-editenv.c	2009-12-30 10:08:12 +0000
@@ -256,9 +256,13 @@
   char *command;
 
   set_program_name (argv[0]);
+
+/* NLS can be disabled through the configure --disable-nls option.  */
+#if ENABLE_NLS
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
+#endif /* ENABLE_NLS */
 
   /* Check for options.  */
   while (1)

=== modified file 'util/grub-emu.c'
--- util/grub-emu.c	2009-11-25 23:10:02 +0000
+++ util/grub-emu.c	2009-12-30 10:08:12 +0000
@@ -159,9 +159,13 @@
   int opt;
 
   set_program_name (argv[0]);
+
+/* NLS can be disabled through the configure --disable-nls option.  */
+#if ENABLE_NLS
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
+#endif /* ENABLE_NLS */
 
   while ((opt = getopt_long (argc, argv, "r:d:m:vH:hV", options, 0)) != -1)
     switch (opt)

=== modified file 'util/grub-fstest.c'
--- util/grub-fstest.c	2009-12-10 13:39:54 +0000
+++ util/grub-fstest.c	2009-12-30 10:08:12 +0000
@@ -384,9 +384,13 @@
   int i, cmd, num_opts, image_index, num_disks = 1;
 
   set_program_name (argv[0]);
+
+/* NLS can be disabled through the configure --disable-nls option.  */
+#if ENABLE_NLS
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
+#endif /* ENABLE_NLS */
 
   /* Find the first non option entry.  */
   for (num_opts = 1; num_opts < argc; num_opts++)

=== modified file 'util/grub-mkdevicemap.c'
--- util/grub-mkdevicemap.c	2009-11-25 23:10:02 +0000
+++ util/grub-mkdevicemap.c	2009-12-30 10:08:12 +0000
@@ -112,9 +112,13 @@
   int floppy_disks = 1;
 
   set_program_name (argv[0]);
+
+/* NLS can be disabled through the configure --disable-nls option.  */
+#if ENABLE_NLS
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
+#endif /* ENABLE_NLS */
 
   /* Check for options.  */
   while (1)

=== modified file 'util/grub-mkfont.c'
--- util/grub-mkfont.c	2009-12-07 16:46:24 +0000
+++ util/grub-mkfont.c	2009-12-30 10:08:12 +0000
@@ -476,9 +476,13 @@
   memset (&font_info, 0, sizeof (font_info));
 
   set_program_name (argv[0]);
+
+/* NLS can be disabled through the configure --disable-nls option.  */
+#if ENABLE_NLS
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
+#endif /* ENABLE_NLS */
 
   /* Check for options.  */
   while (1)

=== modified file 'util/grub-mkrelpath.c'
--- util/grub-mkrelpath.c	2009-12-14 10:06:24 +0000
+++ util/grub-mkrelpath.c	2009-12-30 10:08:12 +0000
@@ -56,9 +56,13 @@
   char *argument, *relpath;
 
   set_program_name (argv[0]);
+
+/* NLS can be disabled through the configure --disable-nls option.  */
+#if ENABLE_NLS
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
+#endif /* ENABLE_NLS */
 
   /* Check for options.  */
   while (1)

=== modified file 'util/grub-probe.c'
--- util/grub-probe.c	2009-12-25 00:04:51 +0000
+++ util/grub-probe.c	2009-12-30 10:08:12 +0000
@@ -338,9 +338,13 @@
   char *argument;
 
   set_program_name (argv[0]);
+
+/* NLS can be disabled through the configure --disable-nls option.  */
+#if ENABLE_NLS
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
+#endif /* ENABLE_NLS */
 
   /* Check for options.  */
   while (1)

=== modified file 'util/i386/pc/grub-mkimage.c'
--- util/i386/pc/grub-mkimage.c	2009-12-23 16:41:32 +0000
+++ util/i386/pc/grub-mkimage.c	2009-12-30 10:08:12 +0000
@@ -351,9 +351,13 @@
   FILE *fp = stdout;
 
   set_program_name (argv[0]);
+
+/* NLS can be disabled through the configure --disable-nls option.  */
+#if ENABLE_NLS
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
+#endif /* ENABLE_NLS */
 
   while (1)
     {

=== modified file 'util/i386/pc/grub-setup.c'
--- util/i386/pc/grub-setup.c	2009-12-20 20:08:03 +0000
+++ util/i386/pc/grub-setup.c	2009-12-30 10:08:12 +0000
@@ -641,9 +641,13 @@
   int must_embed = 0, force = 0, fs_probe = 1;
 
   set_program_name (argv[0]);
+
+/* NLS can be disabled through the configure --disable-nls option.  */
+#if ENABLE_NLS
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
+#endif /* ENABLE_NLS */
 
   /* Check for options.  */
   while (1)

=== modified file 'util/mkisofs/mkisofs.c'
--- util/mkisofs/mkisofs.c	2009-12-23 16:41:32 +0000
+++ util/mkisofs/mkisofs.c	2009-12-30 10:08:12 +0000
@@ -490,7 +490,7 @@
 	  int comma;
 	  int len;
 	  unsigned int j;
-	  char *arg;
+	  const char *arg;
 
 	  printf ("  ");
 
@@ -645,9 +645,13 @@
   char *log_file = 0;
 
   set_program_name (argv[0]);
+
+/* NLS can be disabled through the configure --disable-nls option.  */
+#if ENABLE_NLS
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
+#endif /* ENABLE_NLS */
 
   if (argc < 2)
     usage();

=== modified file 'util/mkisofs/mkisofs.h'
--- util/mkisofs/mkisofs.h	2009-12-23 16:41:32 +0000
+++ util/mkisofs/mkisofs.h	2009-12-30 10:08:12 +0000
@@ -30,10 +30,7 @@
 #include <prototyp.h>
 #include <sys/stat.h>
 
-#include <locale.h>
-#include <libintl.h>
-#define _(str) gettext(str)
-#define N_(str) str
+#include "grub/i18n.h"
 
 /* This symbol is used to indicate that we do not have things like
    symlinks, devices, and so forth available.  Just files and dirs */

=== modified file 'util/sparc64/ieee1275/grub-mkimage.c'
--- util/sparc64/ieee1275/grub-mkimage.c	2009-12-03 11:18:56 +0000
+++ util/sparc64/ieee1275/grub-mkimage.c	2009-12-30 10:08:12 +0000
@@ -222,9 +222,13 @@
   FILE *fp = stdout;
 
   set_program_name (argv[0]);
+
+/* NLS can be disabled through the configure --disable-nls option.  */
+#if ENABLE_NLS
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
+#endif /* ENABLE_NLS */
 
   while (1)
     {

=== modified file 'util/sparc64/ieee1275/grub-ofpathname.c'
--- util/sparc64/ieee1275/grub-ofpathname.c	2009-12-03 11:18:56 +0000
+++ util/sparc64/ieee1275/grub-ofpathname.c	2009-12-30 10:08:12 +0000
@@ -29,9 +29,13 @@
   char *of_path;
 
   set_program_name (argv[0]);
+
+/* NLS can be disabled through the configure --disable-nls option.  */
+#if ENABLE_NLS
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
+#endif /* ENABLE_NLS */
 
   if (argc != 2)
     {

=== modified file 'util/sparc64/ieee1275/grub-setup.c'
--- util/sparc64/ieee1275/grub-setup.c	2009-12-03 11:18:56 +0000
+++ util/sparc64/ieee1275/grub-setup.c	2009-12-30 10:08:12 +0000
@@ -620,9 +620,13 @@
   struct grub_setup_info ginfo;
 
   set_program_name (argv[0]);
+
+/* NLS can be disabled through the configure --disable-nls option.  */
+#if ENABLE_NLS
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
+#endif /* ENABLE_NLS */
 
   init_info (&ginfo);
   if (!parse_options (&ginfo, argc, argv))

[-- Attachment #3: Type: text/plain, Size: 3 bytes --]

 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] Compilation with external intl library
@ 2009-12-31 16:54 Yves Blusseau
  0 siblings, 0 replies; 4+ messages in thread
From: Yves Blusseau @ 2009-12-31 16:54 UTC (permalink / raw)
  To: grub-devel

Hi,

this is the NEW patch to "fix" compilation with external intl library. It fix the #28356 bug (http://savannah.gnu.org/bugs/?28356).

I follow strictly the guideline of gettext, and now we can compile grub with external intl library.

Some enhancements;
    - We can disable NLS (Native Language Support) with the --disable-nls configure flag.
    - We can choose where the external intl library is with the --with-libintl-prefix configure flag.

Under linux the gettext macro detect that the gettext function is in libc and so don't add any flags (like before).
On other platform like Mac OSX, the macro add the proper compile and link flags (ex: -lintl -liconv -lc  -Wl,-framework -Wl,CoreFoundation in OSX)

Best Regards,
Yves Blusseau

PS: if it ok i'll commit this patch and will add another one to make on error if the intl library can't be use and show alternative to compile grub.

---

 ChangeLog.bad-cast                      |    6 
 ChangeLog.config.rpath                  |    5 
 ChangeLog.intl                          |   27 +
 Makefile.in                             |    7 
 conf/common.rmk                         |    2 
 config.rpath                            |  666 +++++++++++++++++++++++++++++++
 configure.ac                            |    2 
 include/grub/i18n.h                     |   36 +-
 include/grub/util/misc.h                |    2 
 util/grub-editenv.c                     |    5 
 util/grub-emu.c                         |    5 
 util/grub-fstest.c                      |    5 
 util/grub-probe.c                       |    5 
 util/i386/pc/grub-setup.c               |    5 
 util/misc.c                             |   11 +
 util/mkisofs/mkisofs.c                  |    7 
 util/mkisofs/mkisofs.h                  |    5 
 util/sparc64/ieee1275/grub-ofpathname.c |    5 
 util/sparc64/ieee1275/grub-setup.c      |    5 
 19 files changed, 773 insertions(+), 38 deletions(-)
 create mode 100644 ChangeLog.bad-cast
 create mode 100644 ChangeLog.config.rpath
 create mode 100644 ChangeLog.intl
 create mode 100644 config.rpath

-- 
Yves Blusseau



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] compilation with external intl library
  2009-12-30 10:23 [PATCH] compilation with external intl library Yves Blusseau
@ 2010-01-01 12:00 ` Robert Millan
  2010-01-01 12:35   ` Robert Millan
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Millan @ 2010-01-01 12:00 UTC (permalink / raw)
  To: The development of GNU GRUB

On Wed, Dec 30, 2009 at 11:23:38AM +0100, Yves Blusseau wrote:
> Hi,
> 
> this is the patch to "fix" compilation with external intl library. It fix the #28356 bug (http://savannah.gnu.org/bugs/?28356).
> 
> I follow strictly the guideline of gettext, and now we can compile grub with external intl library.
> 
> Some enhancements;
> 	- We can disable NLS (Native Language Support) with the --disable-nls configure flag.
> 	- We can choose where the external intl library is with the --with-libintl-prefix configure flag.
> 
> Under linux the gettext macro detect that the gettext function is in libc and so don't add any flags (like before).
> On other platform like Mac OSX, the macro add the proper compile and link flags (ex: -lintl -liconv -lc  -Wl,-framework -Wl,CoreFoundation in OSX)
> 
> Best Regards,
> Yves Blusseau
> 
> PS: if it ok i'll commit this patch and will add another one to make on error if the intl library can't be use and show alternative to compile grub.

Hi Yves,

Please can you adjust your mailer so that it marks text attachments as
text/plain?  It currently sets Content-Type: application/octet-stream which
makes it hard to send a context-reply with my mailer.

I had other comments, but in particular, config.rpath shouldn't be imported
statically.

Thanks!

-- 
Robert Millan

  "Be the change you want to see in the world" -- Gandhi



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] compilation with external intl library
  2010-01-01 12:00 ` Robert Millan
@ 2010-01-01 12:35   ` Robert Millan
  0 siblings, 0 replies; 4+ messages in thread
From: Robert Millan @ 2010-01-01 12:35 UTC (permalink / raw)
  To: The development of GNU GRUB

On Fri, Jan 01, 2010 at 01:00:10PM +0100, Robert Millan wrote:
> 
> Please can you adjust your mailer so that it marks text attachments as
> text/plain?  It currently sets Content-Type: application/octet-stream which
> makes it hard to send a context-reply with my mailer.

Oh, I notice you already did!  Sorry for bothering :-)

-- 
Robert Millan

  "Be the change you want to see in the world" -- Gandhi



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-01-01 12:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-30 10:23 [PATCH] compilation with external intl library Yves Blusseau
2010-01-01 12:00 ` Robert Millan
2010-01-01 12:35   ` Robert Millan
  -- strict thread matches above, loose matches on Subject: below --
2009-12-31 16:54 [PATCH] Compilation " Yves Blusseau

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.