There is a configuration parameter to influence how INCINTL gets set in config.intl.

--with-libintl-prefix[=DIR] search for libintl in DIR/include and DIR/lib

However, the configured value for INCINTL is not written to config.intl in binutils-2.22/intl/configure.

I am compiling on mingw-w64 on Windows 64-bit using libiconv and libintl built from gettext-0.18.1.


Here is the configure command line to reproduce the behavior:

binutils-2.22

./configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=$(cd ../install && pwd) --disable-shared --enable-static --enable-targets=x86_64-w64-mingw32,i686-w64-mingw32 --enable-ld=yes --enable-cloog-backend=isl --with-gmp=$(cd ../install && pwd) --with-mpc=$(cd ../install && pwd) --with-mpfr=$(cd ../install && pwd) --with-ppl=$(cd ../install && pwd) --with-cloog=$(cd ../install && pwd) --with-libiconv-prefix=$(cd ../install && pwd) --with-libintl-prefix=$(cd ../install && pwd)


binutils-2.22/intl

./configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=$(cd ../../install && pwd) --with-libiconv-prefix=$(cd ../../install && pwd) --with-libintl-prefix=$(cd ../../install && pwd)


The include library is found in $CPPFLAGS so INCINTL is not written to config.intl. binutils-2.22/bfd then can't find libintl.h.

binutils-2.22/intl/configure

            if test "X$additional_includedir" != "X"; then
                                                                                                    
            if test "X$additional_includedir" != "X/usr/include"; then
                haveit=
if test "X$additional_includedir" = "X/usr/local/include"; then
                  if test -n "$GCC"; then
                    case $host_os in
                      linux*) haveit=yes;;
                    esac
                  fi
                fi
                if test -z "$haveit"; then
// Changed line 6021
-                 for x in $CPPFLAGS $INCINTL; do
// to
+                 for x in $INCINTL; do

  acl_save_prefix="$prefix"
  prefix="$acl_final_prefix"


In the attached file, the other fixes to get binutils-2.22 to compile on mingw-w64 are:

(1) Same fix as https://trac.macports.org/ticket/26537 applied to binutils-2.22/gold/gold.h

+#ifdef setlocale
+// Someone in libintl world decided it was a good idea to define a "setlocale" macro.
+#undef setlocale
+#endif


(2) http://sourceware.org/bugzilla/show_bug.cgi?id=13292

(3) binutils-2.22/configure checks for the exact version of cloog 0.16.x. I have 0.17.0. Is changing this test from "!= 16" to ">= 16" safe?

(4) binutils-2.22/gold/descriptors.cc - compiler warning about 'fd' being an unused parameter treated as an error.

static inline void
set_close_on_exec(int fd)
{
// Mingw does not define F_SETFD.
#ifdef F_SETFD
  fcntl(fd, F_SETFD, FD_CLOEXEC);
#else
  (void)fd;
#endif
}



I'm also getting "narrowing conversion" warnings (treated as errors) trying to compile binutils-2.22/gold using gcc 4.7.

I found this config file which looks like one way to get rid of the warnings.

http://svn.openttd.org/trunk/config.lib

        if [ $cc_version -ge 43 ]; then
            # Use gnu++0x mode so static_assert() is available.
            # Don't use c++0x, it breaks mingw (with gcc 4.4.0).
            cxxflags="$cxxflags -std=gnu++0x"
        fi

        if [ $cc_version -ge 47 ]; then
            # Disable -Wnarrowing which gives many warnings, such as:
# warning: narrowing conversion of '...' from 'unsigned int' to 'int' inside { } [-Wnarrowing]
            # They are valid according to the C++ standard, but useless.
            cxxflags="$cxxflags -Wno-narrowing"
            # Disable bogus 'attempt to free a non-heap object' warning
            flags="$flags -Wno-free-nonheap-object"
        fi



x86_64-w64-mingw32-g++ -DHAVE_CONFIG_H -I. -I. -I./../include -I./../elfcpp -DLOCALEDIR="\"/c/work/ sources/install/share/locale\"" -DBINDIR="\"/c/work/sources/install/bin\"" -DTOOLBINDIR="\"/c/work/s ources/install/x86_64-w64-mingw32/bin\"" -I/c/work/sources/install/include -W -Wall -Wno-format -Werror -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -frandom-seed=dwarf_reader.o -g -O2 -MT dwarf_rea der.o -MD -MP -MF .deps/dwarf_reader.Tpo -c -o dwarf_reader.o dwarf_reader.cc dwarf_reader.cc: In instantiation of 'const unsigned char* gold::Sized_dwarf_line_info<size, big_end ian>::read_lines(const unsigned char*, unsigned int) [with int size = 32; bool big_endian = false]':

dwarf_reader.cc:925:7:   required from here
dwarf_reader.cc:495:56: error: narrowing conversion of 'lsm.gold::LineStateMachine::address' from 'u int64_t {aka long long unsigned int}' to 'off_t {aka long long int}' inside { } is ill-formed in C++
11 [-Werror=narrowing]
dwarf_reader.cc:495:56: error: narrowing conversion of 'lsm.gold::LineStateMachine::file_num' from '
int' to 'unsigned int' inside { } is ill-formed in C++11 [-Werror=narrowing]
dwarf_reader.cc: In instantiation of 'const unsigned char* gold::Sized_dwarf_line_info<size, big_end ian>::read_lines(const unsigned char*, unsigned int) [with int size = 32; bool big_endian = true]':
dwarf_reader.cc:930:7:   required from here
dwarf_reader.cc:495:56: error: narrowing conversion of 'lsm.gold::LineStateMachine::address' from 'u int64_t {aka long long unsigned int}' to 'off_t {aka long long int}' inside { } is ill-formed in C++
11 [-Werror=narrowing]
dwarf_reader.cc:495:56: error: narrowing conversion of 'lsm.gold::LineStateMachine::file_num' from '
int' to 'unsigned int' inside { } is ill-formed in C++11 [-Werror=narrowing]
dwarf_reader.cc: In instantiation of 'const unsigned char* gold::Sized_dwarf_line_info<size, big_end ian>::read_lines(const unsigned char*, unsigned int) [with int size = 64; bool big_endian = false]':

dwarf_reader.cc:935:7:   required from here
dwarf_reader.cc:495:56: error: narrowing conversion of 'lsm.gold::LineStateMachine::address' from 'u int64_t {aka long long unsigned int}' to 'off_t {aka long long int}' inside { } is ill-formed in C++
11 [-Werror=narrowing]
dwarf_reader.cc:495:56: error: narrowing conversion of 'lsm.gold::LineStateMachine::file_num' from '
int' to 'unsigned int' inside { } is ill-formed in C++11 [-Werror=narrowing]
dwarf_reader.cc: In instantiation of 'const unsigned char* gold::Sized_dwarf_line_info<size, big_end ian>::read_lines(const unsigned char*, unsigned int) [with int size = 64; bool big_endian = true]':
dwarf_reader.cc:940:7:   required from here
dwarf_reader.cc:495:56: error: narrowing conversion of 'lsm.gold::LineStateMachine::address' from 'u int64_t {aka long long unsigned int}' to 'off_t {aka long long int}' inside { } is ill-formed in C++
11 [-Werror=narrowing]
dwarf_reader.cc:495:56: error: narrowing conversion of 'lsm.gold::LineStateMachine::file_num' from '
int' to 'unsigned int' inside { } is ill-formed in C++11 [-Werror=narrowing]
cc1plus.exe: all warnings being treated as errors
diff -rup a/bfd/bfd-in.h b/bfd/bfd-in.h
--- a/bfd/bfd-in.h	2011-09-15 18:15:18 -0700
+++ b/bfd/bfd-in.h	2012-02-15 14:33:21 -0800
@@ -31,6 +31,7 @@ extern "C" {
 
 #include "ansidecl.h"
 #include "symcat.h"
+#include <sys/stat.h>
 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
 #ifndef SABER
 /* This hack is to avoid a problem with some strict ANSI C preprocessors.
@@ -301,8 +302,6 @@ typedef struct bfd_section *sec_ptr;
    && (sec)->sec_info_type != ELF_INFO_TYPE_MERGE		\
    && (sec)->sec_info_type != ELF_INFO_TYPE_JUST_SYMS)
 
-/* Forward define.  */
-struct stat;
 
 typedef enum bfd_print_symbol
 {
diff -rup a/bfd/bfd-in2.h b/bfd/bfd-in2.h
--- a/bfd/bfd-in2.h	2011-09-15 18:15:18 -0700
+++ b/bfd/bfd-in2.h	2012-02-15 14:33:48 -0800
@@ -38,6 +38,7 @@ extern "C" {
 
 #include "ansidecl.h"
 #include "symcat.h"
+#include <sys/stat.h>
 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
 #ifndef SABER
 /* This hack is to avoid a problem with some strict ANSI C preprocessors.
@@ -308,8 +309,6 @@ typedef struct bfd_section *sec_ptr;
    && (sec)->sec_info_type != ELF_INFO_TYPE_MERGE		\
    && (sec)->sec_info_type != ELF_INFO_TYPE_JUST_SYMS)
 
-/* Forward define.  */
-struct stat;
 
 typedef enum bfd_print_symbol
 {
diff -rup a/binutils/rename.c b/binutils/rename.c
--- a/binutils/rename.c	2009-09-02 00:22:32 -0700
+++ b/binutils/rename.c	2012-02-15 00:08:17 -0800
@@ -20,10 +20,11 @@
 
 #include "sysdep.h"
 #include "bfd.h"
-#include "bucomm.h"
 
 #include <sys/stat.h>
 
+#include "bucomm.h"
+
 #ifdef HAVE_GOOD_UTIME_H
 #include <utime.h>
 #else /* ! HAVE_GOOD_UTIME_H */
diff -rup a/configure b/configure
--- a/configure	2011-08-14 05:28:15 -0700
+++ b/configure	2012-02-15 02:13:00 -0800
@@ -5946,8 +5946,8 @@ int
 main ()
 {
 #if CLOOG_VERSION_MAJOR != 0 \
-    || CLOOG_VERSION_MINOR != 16 \
-    || CLOOG_VERSION_REVISION < 1
+    || CLOOG_VERSION_MINOR != 17 \
+    || CLOOG_VERSION_REVISION < 0
     choke me
    #endif
   ;
diff -rup a/gold/descriptors.cc b/gold/descriptors.cc
--- a/gold/descriptors.cc	2011-04-22 16:20:28 -0700
+++ b/gold/descriptors.cc	2012-02-15 18:39:49 -0800
@@ -50,6 +50,8 @@ set_close_on_exec(int fd)
 // Mingw does not define F_SETFD.
 #ifdef F_SETFD
   fcntl(fd, F_SETFD, FD_CLOEXEC);
+#else
+  (void)fd;
 #endif
 }
 
diff -rup a/gold/gold.h b/gold/gold.h
--- a/gold/gold.h	2011-06-07 21:43:28 -0700
+++ b/gold/gold.h	2012-02-15 18:36:11 -0800
@@ -48,6 +48,10 @@
 
 #ifdef ENABLE_NLS
 # include <libintl.h>
+# ifdef setlocale 
+   // Someone in libintl world decided it was a good idea to define a "setlocale" macro. 
+#  undef setlocale 
+# endif
 # define _(String) gettext (String)
 # ifdef gettext_noop
 #  define N_(String) gettext_noop (String)
diff -rup a/intl/configure b/intl/configure
--- a/intl/configure	2010-09-27 13:22:53 -0700
+++ b/intl/configure	2012-02-15 17:42:16 -0800
@@ -5216,8 +5216,8 @@ fi
                 ;;
             esac
             if test "X$additional_includedir" != "X"; then
-                                                                                                                if test "X$additional_includedir" != "X/usr/include"; then
                 haveit=
+			if test "X$additional_includedir" != "X/usr/include"; then
                 if test "X$additional_includedir" = "X/usr/local/include"; then
                   if test -n "$GCC"; then
                     case $host_os in
@@ -5429,7 +5429,6 @@ done
 
 
           am_save_CPPFLAGS="$CPPFLAGS"
-
   for element in $INCICONV; do
     haveit=
     for x in $CPPFLAGS; do
@@ -6000,16 +5999,16 @@ fi
                                                 LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir -l$name"
               fi
             fi
-                        additional_includedir=
-            case "$found_dir" in
+			additional_includedir=
+			case "$found_dir" in
               */lib | */lib/)
                 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
                 additional_includedir="$basedir/include"
                 ;;
             esac
             if test "X$additional_includedir" != "X"; then
-                                                                                                                if test "X$additional_includedir" != "X/usr/include"; then
                 haveit=
+			if test "X$additional_includedir" != "X/usr/include"; then
                 if test "X$additional_includedir" = "X/usr/local/include"; then
                   if test -n "$GCC"; then
                     case $host_os in
@@ -6018,7 +6017,7 @@ fi
                   fi
                 fi
                 if test -z "$haveit"; then
-                  for x in $CPPFLAGS $INCINTL; do
+                  for x in $INCINTL; do
 
   acl_save_prefix="$prefix"
   prefix="$acl_final_prefix"
@@ -6027,14 +6026,13 @@ fi
   eval x=\"$x\"
   exec_prefix="$acl_save_exec_prefix"
   prefix="$acl_save_prefix"
-
                     if test "X$x" = "X-I$additional_includedir"; then
                       haveit=yes
                       break
                     fi
                   done
                   if test -z "$haveit"; then
-                    if test -d "$additional_includedir"; then
+				  if test -d "$additional_includedir"; then
                                             INCINTL="${INCINTL}${INCINTL:+ }-I$additional_includedir"
                     fi
                   fi
@@ -6249,7 +6247,6 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_gnugettext1_libintl" >&5
 $as_echo "$gt_cv_func_gnugettext1_libintl" >&6; }
         fi
-
                                         if test "$gt_cv_func_gnugettext1_libc" = "yes" \
            || { test "$gt_cv_func_gnugettext1_libintl" = "yes" \
                 && test "$PACKAGE" != gettext-runtime \
@@ -6261,7 +6258,6 @@ $as_echo "$gt_cv_func_gnugettext1_libint
           INCINTL=
         fi
 
-
         if test "$gt_use_preinstalled_gnugettext" != "yes"; then
                               nls_cv_use_gnu_gettext=yes
         fi
@@ -6566,7 +6562,7 @@ fi
 
 
 LIBINTL_DEP=
-INCINTL=
+#INCINTL=
 case $USE_INCLUDED_LIBINTL in
   yes)
     LIBINTL=`echo $LIBINTL | sed 's,${top_builddir},&/..,' `
diff -rup a/intl/configure.ac b/intl/configure.ac
--- a/intl/configure.ac	2009-08-24 12:12:54 -0700
+++ b/intl/configure.ac	2012-02-15 17:04:37 -0800
@@ -37,7 +37,7 @@ AC_SUBST(LIBINTL_DEP)
 AC_SUBST(INCINTL)
 
 LIBINTL_DEP=
-INCINTL=
+#INCINTL=
 case $USE_INCLUDED_LIBINTL in
   yes)
     LIBINTL=`echo $LIBINTL | sed 's,${top_builddir},&/..,' `
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to