aboutsummaryrefslogtreecommitdiff
path: root/package/elfutils/0001-argp-support.patch
blob: 1a74b35ffd59b75aaa995ff4d09447811c5e4b2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
Allow the usage of an external implementation of the argp functions

uClibc lack the argp family of functions that glibc has. Therefore, we
add a check in the configure script to see if argp_parse is available
in the C library. If not, we look if it is available in the additional
'argp' library. If so, we link against that library. If not, we error
out.

This allows to build elfutils against uClibc with an external argp
library.

Based on the former patch by Thomas Petazzoni.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>

diff -rup a/configure.ac b/configure.ac
--- a/configure.ac	2015-01-06 11:30:02.170052875 +0000
+++ b/configure.ac	2015-01-06 11:31:10.122219826 +0000
@@ -253,6 +253,13 @@ AC_SUBST([LIBEBL_SUBDIR])
 AC_DEFINE_UNQUOTED(LIBEBL_SUBDIR, "$LIBEBL_SUBDIR")
 AH_TEMPLATE([LIBEBL_SUBDIR], [$libdir subdirectory containing libebl modules.])
 
+AC_CHECK_FUNC([argp_parse])
+if test "$ac_cv_func_argp_parse" != yes; then
+	AC_CHECK_LIB([argp],[argp_parse],ARGP_LIBS=-largp,
+		AC_MSG_ERROR([No argp_parse function available.]))
+fi
+AC_SUBST(ARGP_LIBS)
+
 dnl Test for zlib and bzlib, gives ZLIB/BZLIB .am
 dnl conditional and config.h USE_ZLIB/USE_BZLIB #define.
 save_LIBS="$LIBS"
diff -rup a/libdw/Makefile.am b/libdw/Makefile.am
--- a/libdw/Makefile.am	2014-12-19 20:43:11.000000000 +0000
+++ b/libdw/Makefile.am	2015-01-06 11:32:21.075438524 +0000
@@ -112,7 +112,7 @@ libdw.so$(EXEEXT): $(srcdir)/libdw.map l
 		-Wl,--enable-new-dtags,-rpath,$(pkglibdir) \
 		-Wl,--version-script,$<,--no-undefined \
 		-Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
-		-ldl $(zip_LIBS)
+		-ldl $(zip_LIBS) $(ARGP_LIBS)
 	@$(textrel_check)
 	ln -fs $@ $@.$(VERSION)
 
diff -rup a/src/Makefile.am b/src/Makefile.am
--- a/src/Makefile.am	2015-01-06 11:30:02.430057339 +0000
+++ b/src/Makefile.am	2015-01-06 11:34:53.061049752 +0000
@@ -94,27 +94,29 @@ readelf_no_Werror = yes
 strings_no_Werror = yes
 addr2line_no_Wformat = yes
 
-readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) -ldl
+readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) -ldl $(ARGP_LIBS)
 nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) -ldl \
-	   $(demanglelib)
-size_LDADD = $(libelf) $(libeu)
-strip_LDADD = $(libebl) $(libelf) $(libeu) -ldl
-ld_LDADD = $(libebl) $(libelf) $(libeu) -ldl
+	   $(demanglelib) $(ARGP_LIBS)
+size_LDADD = $(libelf) $(libeu) $(ARGP_LIBS)
+strip_LDADD = $(libebl) $(libelf) $(libeu) -ldl $(ARGP_LIBS)
+ld_LDADD = $(libebl) $(libelf) $(libeu) -ldl $(ARGP_LIBS)
 if NATIVE_LD
 # -ldl is always needed for libebl.
 ld_LDADD += libld_elf.a
 endif
 ld_LDFLAGS = -rdynamic
-elflint_LDADD  = $(libebl) $(libelf) $(libeu) -ldl
-findtextrel_LDADD = $(libdw) $(libelf)
-addr2line_LDADD = $(libdw) $(libelf)
-elfcmp_LDADD = $(libebl) $(libelf) -ldl
-objdump_LDADD  = $(libasm) $(libebl) $(libelf) $(libeu) -ldl
-ranlib_LDADD = libar.a $(libelf) $(libeu)
-strings_LDADD = $(libelf) $(libeu)
-ar_LDADD = libar.a $(libelf) $(libeu)
-unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) -ldl
-stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) -ldl $(demanglelib)
+elflint_LDADD  = $(libebl) $(libelf) $(libeu) -ldl $(ARGP_LIBS)
+findtextrel_LDADD = $(libdw) $(libelf) $(ARGP_LIBS)
+addr2line_LDADD = $(libdw) $(libelf) $(ARGP_LIBS)
+elfcmp_LDADD = $(libebl) $(libelf) -ldl $(ARGP_LIBS)
+objdump_LDADD  = $(libasm) $(libebl) $(libelf) $(libeu) -ldl \
+	$(ARGP_LIBS)
+ranlib_LDADD = libar.a $(libelf) $(libeu) $(ARGP_LIBS)
+strings_LDADD = $(libelf) $(libeu) $(ARGP_LIBS)
+ar_LDADD = libar.a $(libelf) $(libeu) $(ARGP_LIBS)
+unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) -ldl $(ARGP_LIBS)
+stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) -ldl \
+	$(demanglelib) $(ARGP_LIBS)
 
 ldlex.o: ldscript.c
 ldlex_no_Werror = yes