This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Check if we need -lintl for linking gettext


We might not have gettext available from libc and we cannot get it from
gnulib either.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
---
 ChangeLog            |  5 +++++
 backends/ChangeLog   |  4 ++++
 backends/Makefile.am |  2 +-
 configure.ac         | 25 +++++++++++++++++++++++++
 libasm/ChangeLog     |  4 ++++
 libasm/Makefile.am   |  2 +-
 libcpu/ChangeLog     |  4 ++++
 libcpu/Makefile.am   |  2 +-
 libdw/ChangeLog      |  4 ++++
 libdw/Makefile.am    |  2 +-
 libelf/ChangeLog     |  4 ++++
 libelf/Makefile.am   |  2 +-
 src/ChangeLog        |  4 ++++
 src/Makefile.am      | 30 +++++++++++++++---------------
 tests/ChangeLog      |  4 ++++
 tests/Makefile.am    | 18 +++++++++---------
 16 files changed, 87 insertions(+), 29 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 01f88f3..ccfb3ef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-04-28  Ulf Hermann  <ulf.hermann@qt.io>
+
+	* configure.ac: Check for availability of dgettext from either libc or
+	a separate libintl.
+
 2017-04-27  Ulf Hermann  <ulf.hermann@qt.io>
 
 	* configure.ac: Check if the compiler supports
diff --git a/backends/ChangeLog b/backends/ChangeLog
index baeb7b9..a35d83a 100644
--- a/backends/ChangeLog
+++ b/backends/ChangeLog
@@ -1,3 +1,7 @@
+2017-04-28  Ulf Hermann <ulf.hermann@qt.io>
+
+	* Makefile.am: Use intl_LDADD.
+
 2017-04-27  Ulf Hermann <ulf.hermann@qt.io>
 
 	* Makefile.am: Use dso_LDFLAGS.
diff --git a/backends/Makefile.am b/backends/Makefile.am
index 3e1992e..6dc2022 100644
--- a/backends/Makefile.am
+++ b/backends/Makefile.am
@@ -141,7 +141,7 @@ libebl_%.so libebl_%.map: libebl_%_pic.a $(libelf) $(libdw) $(libgnu)
 	$(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $(@:.map=.so) \
 		-Wl,--whole-archive $< $(cpu_$*) -Wl,--no-whole-archive \
 		-Wl,--version-script,$(@:.so=.map) \
-		-Wl,--as-needed $(libelf) $(libdw) $(libgnu)
+		-Wl,--as-needed $(libelf) $(libdw) $(libgnu) $(intl_LDADD)
 	@$(textrel_check)
 
 libebl_i386.so: $(cpu_i386)
diff --git a/configure.ac b/configure.ac
index 165149d..0266a36 100644
--- a/configure.ac
+++ b/configure.ac
@@ -431,6 +431,31 @@ CFLAGS="$old_CFLAGS"])
 AM_CONDITIONAL(HAVE_IMPLICIT_FALLTHROUGH_WARNING,
 	       [test "x$ac_cv_implicit_fallthrough" != "xno"])
 
+dnl Check if gettext is available form libc
+AC_LINK_IFELSE(
+	[AC_LANG_PROGRAM(
+		[#include <libintl.h>],
+		[dgettext("foo", "bar"); return 0;]
+		)],
+	[libc_has_gettext="true"],
+	[libc_has_gettext="false"]
+)
+
+dnl If our libc doesn't provide gettext, then test for libintl
+if test "$libc_has_gettext" = "false" ; then
+	AC_MSG_WARN("libc does not have gettext")
+	AC_CHECK_LIB([intl], [dgettext], [have_intl="true"], [have_intl="false"], [-liconv])
+
+	if test "$have_intl" = "false"; then
+		AC_MSG_ERROR("no libintl found")
+	else
+		intl_LDADD="-lintl -liconv"
+	fi
+else
+	intl_LDADD=""
+fi
+AC_SUBST([intl_LDADD])
+
 dnl Check if we have <linux/bpf.h> for EM_BPF disassembly.
 AC_CHECK_HEADERS(linux/bpf.h)
 AM_CONDITIONAL(HAVE_LINUX_BPF_H, [test "x$ac_cv_header_linux_bpf_h" = "xyes"])
diff --git a/libasm/ChangeLog b/libasm/ChangeLog
index 971492a..066c64e 100644
--- a/libasm/ChangeLog
+++ b/libasm/ChangeLog
@@ -1,3 +1,7 @@
+2017-02-28  Ulf Hermann  <ulf.hermann@qt.io>
+
+	* Makefile.am: Use intl_LDADD.
+
 2017-02-27  Ulf Hermann  <ulf.hermann@qt.io>
 
 	* Makefile.am: Use dso_LDFLAGS.
diff --git a/libasm/Makefile.am b/libasm/Makefile.am
index a5fc9fc..30f7fa9 100644
--- a/libasm/Makefile.am
+++ b/libasm/Makefile.am
@@ -55,7 +55,7 @@ libasm_a_SOURCES = asm_begin.c asm_abort.c asm_end.c asm_error.c \
 libasm_pic_a_SOURCES =
 am_libasm_pic_a_OBJECTS = $(libasm_a_SOURCES:.c=.os)
 
-libasm_so_LDLIBS =
+libasm_so_LDLIBS = $(intl_LDADD)
 if USE_LOCKS
 libasm_so_LDLIBS += -lpthread
 endif
diff --git a/libcpu/ChangeLog b/libcpu/ChangeLog
index ef5da58..42cfb58 100644
--- a/libcpu/ChangeLog
+++ b/libcpu/ChangeLog
@@ -1,3 +1,7 @@
+2017-02-28  Ulf Hermann  <ulf.hermann@qt.io>
+
+	* Makefile.am: Use intl_LDADD.
+
 2017-02-27  Ulf Hermann  <ulf.hermann@qt.io>
 
 	* Makefile.am: Use fpic_CFLAGS.
diff --git a/libcpu/Makefile.am b/libcpu/Makefile.am
index 9ca0f43..d277583 100644
--- a/libcpu/Makefile.am
+++ b/libcpu/Makefile.am
@@ -90,7 +90,7 @@ i386_lex_CFLAGS = -Wno-unused-label -Wno-unused-function -Wno-sign-compare
 i386_parse.o: i386_parse.c i386.mnemonics
 i386_parse_CFLAGS = -DNMNES="`wc -l < i386.mnemonics`"
 i386_lex.o: i386_parse.h
-i386_gendis_LDADD = $(libeu) $(libgnu) -lm
+i386_gendis_LDADD = $(libeu) $(libgnu) $(intl_LDADD) -lm
 
 i386_parse.h: i386_parse.c ;
 
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 79c3898..7c6e19a 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,7 @@
+2017-02-28  Ulf Hermann  <ulf.hermann@qt.io>
+
+	* Makefile.am: Use intl_LDADD.
+
 2017-02-27  Ulf Hermann  <ulf.hermann@qt.io>
 
 	* libdwP.h: Use attribute_hidden.
diff --git a/libdw/Makefile.am b/libdw/Makefile.am
index 7b69f6a..31f7012 100644
--- a/libdw/Makefile.am
+++ b/libdw/Makefile.am
@@ -118,7 +118,7 @@ libdw.so$(EXEEXT): $(srcdir)/libdw.map libdw_pic.a ../libdwelf/libdwelf_pic.a \
 		-Wl,--enable-new-dtags,-rpath,$(pkglibdir) \
 		-Wl,--version-script,$<,--no-undefined \
 		-Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
-		-ldl -lz $(zip_LIBS) $(libgnu)
+		-ldl -lz $(intl_LDADD) $(zip_LIBS) $(libgnu)
 	@$(textrel_check)
 	$(AM_V_at)ln -fs $@ $@.$(VERSION)
 
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index fd58ed3..2894ecd 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,7 @@
+2017-02-28  Ulf Hermann  <ulf.hermann@qt.io>
+
+	* Makefile.am: Use intl_LDADD.
+
 2017-04-27  Ulf Hermann  <ulf.hermann@qt.io>
 
 	* libelfP.h: Use attribute_hidden.
diff --git a/libelf/Makefile.am b/libelf/Makefile.am
index 78d6853..64687b7 100644
--- a/libelf/Makefile.am
+++ b/libelf/Makefile.am
@@ -95,7 +95,7 @@ libelf_a_SOURCES = elf_version.c elf_hash.c elf_error.c elf_fill.c \
 libelf_pic_a_SOURCES =
 am_libelf_pic_a_OBJECTS = $(libelf_a_SOURCES:.c=.os)
 
-libelf_so_LDLIBS = -lz
+libelf_so_LDLIBS = -lz $(intl_LDADD)
 if USE_LOCKS
 libelf_so_LDLIBS += -lpthread
 endif
diff --git a/src/ChangeLog b/src/ChangeLog
index c5805c9..b6bf70c 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
+2017-02-28  Ulf Hermann  <ulf.hermann@qt.io>
+
+	* Makefile.am: Use intl_LDADD.
+
 2017-04-27  Ulf Hermann  <ulf.hermann@qt.io>
 
 	* Makefile.am: Drop argp_LDADD.
diff --git a/src/Makefile.am b/src/Makefile.am
index aca4b1c..a330959 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -72,22 +72,22 @@ ranlib_no_Wstack_usage = yes
 ar_no_Wstack_usage = yes
 unstrip_no_Wstack_usage = yes
 
-readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libgnu) -ldl
-nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libgnu) -ldl \
+readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libgnu) $(intl_LDADD) -ldl
+nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libgnu) $(intl_LDADD) -ldl \
 	   $(demanglelib)
-size_LDADD = $(libelf) $(libeu) $(libgnu)
-strip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(libgnu) -ldl
-elflint_LDADD  = $(libebl) $(libelf) $(libeu) $(libgnu) -ldl
-findtextrel_LDADD = $(libdw) $(libelf) $(libeu) $(libgnu)
-addr2line_LDADD = $(libdw) $(libelf) $(libeu) $(libgnu) $(demanglelib)
-elfcmp_LDADD = $(libebl) $(libelf) $(libeu) $(libgnu) -ldl
-objdump_LDADD  = $(libasm) $(libebl) $(libelf) $(libeu) $(libgnu) -ldl
-ranlib_LDADD = libar.a $(libelf) $(libeu) $(libgnu)
-strings_LDADD = $(libelf) $(libeu) $(libgnu)
-ar_LDADD = libar.a $(libelf) $(libeu) $(libgnu)
-unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(libgnu) -ldl
-stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(libgnu) -ldl $(demanglelib)
-elfcompress_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(libgnu)
+size_LDADD = $(libelf) $(libeu) $(libgnu) $(intl_LDADD)
+strip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(libgnu) $(intl_LDADD) -ldl
+elflint_LDADD  = $(libebl) $(libelf) $(libeu) $(libgnu) $(intl_LDADD) -ldl
+findtextrel_LDADD = $(libdw) $(libelf) $(libeu) $(libgnu) $(intl_LDADD)
+addr2line_LDADD = $(libdw) $(libelf) $(libeu) $(libgnu) $(intl_LDADD) $(demanglelib)
+elfcmp_LDADD = $(libebl) $(libelf) $(libeu) $(libgnu) $(intl_LDADD) -ldl
+objdump_LDADD  = $(libasm) $(libebl) $(libelf) $(libeu) $(libgnu) $(intl_LDADD) -ldl
+ranlib_LDADD = libar.a $(libelf) $(libeu) $(libgnu) $(intl_LDADD)
+strings_LDADD = $(libelf) $(libeu) $(libgnu) $(intl_LDADD)
+ar_LDADD = libar.a $(libelf) $(libeu) $(libgnu) $(intl_LDADD)
+unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(libgnu) $(intl_LDADD) -ldl
+stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(libgnu) $(intl_LDADD) -ldl $(demanglelib)
+elfcompress_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(libgnu) $(intl_LDADD)
 
 installcheck-binPROGRAMS: $(bin_PROGRAMS)
 	bad=0; pid=$$$$; list="$(bin_PROGRAMS)"; for p in $$list; do \
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 9d20341..1d347f6 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,7 @@
+2017-02-28  Ulf Hermann  <ulf.hermann@qt.io>
+
+	* Makefile.am: Use intl_LDADD.
+
 2017-04-27  Ulf Hermann <ulf.hermann@qt.io>
 
 	* Makefile.am: Use fpie_CFLAGS and fpic_CFLAGS.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7258069..f9b556d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -433,15 +433,15 @@ funcretval_LDADD = $(libdw) $(libgnu)
 allregs_LDADD = $(libdw) $(libgnu)
 find_prologues_LDADD = $(libdw) $(libgnu)
 #show_ciefde_LDADD = ../libdwarf/libdwarf.so $(libelf)
-asm_tst1_LDADD = $(libasm) $(libebl) $(libelf) $(libdw) $(libgnu) -ldl
-asm_tst2_LDADD = $(libasm) $(libebl) $(libelf) $(libdw) $(libgnu) -ldl
-asm_tst3_LDADD = $(libasm) $(libebl) $(libelf) $(libdw) $(libgnu) -ldl
-asm_tst4_LDADD = $(libasm) $(libebl) $(libelf) $(libdw) $(libgnu) -ldl
-asm_tst5_LDADD = $(libasm) $(libebl) $(libelf) $(libdw) $(libgnu) -ldl
-asm_tst6_LDADD = $(libasm) $(libebl) $(libelf) $(libdw) $(libgnu) -ldl
-asm_tst7_LDADD = $(libasm) $(libebl) $(libelf) $(libdw) $(libgnu) -ldl
-asm_tst8_LDADD = $(libasm) $(libebl) $(libelf) $(libdw) $(libgnu) -ldl
-asm_tst9_LDADD = $(libasm) $(libebl) $(libelf) $(libdw) $(libgnu) -ldl
+asm_tst1_LDADD = $(libasm) $(libebl) $(libelf) $(libdw) $(libgnu) $(intl_LDADD) -ldl
+asm_tst2_LDADD = $(libasm) $(libebl) $(libelf) $(libdw) $(libgnu) $(intl_LDADD) -ldl
+asm_tst3_LDADD = $(libasm) $(libebl) $(libelf) $(libdw) $(libgnu) $(intl_LDADD) -ldl
+asm_tst4_LDADD = $(libasm) $(libebl) $(libelf) $(libdw) $(libgnu) $(intl_LDADD) -ldl
+asm_tst5_LDADD = $(libasm) $(libebl) $(libelf) $(libdw) $(libgnu) $(intl_LDADD) -ldl
+asm_tst6_LDADD = $(libasm) $(libebl) $(libelf) $(libdw) $(libgnu) $(intl_LDADD) -ldl
+asm_tst7_LDADD = $(libasm) $(libebl) $(libelf) $(libdw) $(libgnu) $(intl_LDADD) -ldl
+asm_tst8_LDADD = $(libasm) $(libebl) $(libelf) $(libdw) $(libgnu) $(intl_LDADD) -ldl
+asm_tst9_LDADD = $(libasm) $(libebl) $(libelf) $(libdw) $(libgnu) $(intl_LDADD) -ldl
 dwflmodtest_LDADD = $(libdw) $(libebl) $(libelf) $(libgnu) -ldl
 rdwrmmap_LDADD = $(libelf) $(libgnu)
 dwfl_bug_addr_overflow_LDADD = $(libdw) $(libebl) $(libelf) $(libgnu) -ldl
-- 
2.1.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]