aboutsummaryrefslogtreecommitdiffstats
path: root/package/elfutils/elfutils-02-argp-support.patch
blob: f81ac8f9fad544710db4b520ab4f978ceed7d454 (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
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.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Index: b/configure.ac
===================================================================
--- a/configure.ac
+++ b/configure.ac
@@ -269,6 +269,13 @@
 	enable_progs=yes)
 AM_CONDITIONAL(ENABLE_PROGS, test "$enable_progs" = yes)
 
+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"
Index: b/src/Makefile.am
===================================================================
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -98,26 +98,29 @@
 # Buggy old compilers.
 readelf_no_Werror = yes
 
-readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
+readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl \
+	$(ARGP_LIBS)
 nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl \
-	   $(demanglelib)
-size_LDADD = $(libelf) $(libeu) $(libmudflap)
-strip_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
-ld_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
+	   $(demanglelib) $(ARGP_LIBS)
+size_LDADD = $(libelf) $(libeu) $(libmudflap) $(ARGP_LIBS)
+strip_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl $(ARGP_LIBS)
+ld_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -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) $(libmudflap) -ldl
-findtextrel_LDADD = $(libdw) $(libelf) $(libmudflap)
-addr2line_LDADD = $(libdw) $(libelf) $(libmudflap)
-elfcmp_LDADD = $(libebl) $(libelf) $(libmudflap) -ldl
-objdump_LDADD  = $(libasm) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
-ranlib_LDADD = libar.a $(libelf) $(libeu) $(libmudflap)
-strings_LDADD = $(libelf) $(libeu) $(libmudflap)
-ar_LDADD = libar.a $(libelf) $(libeu) $(libmudflap)
-unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(libmudflap) -ldl
+elflint_LDADD  = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl $(ARGP_LIBS)
+findtextrel_LDADD = $(libdw) $(libelf) $(libmudflap) $(ARGP_LIBS)
+addr2line_LDADD = $(libdw) $(libelf) $(libmudflap) $(ARGP_LIBS)
+elfcmp_LDADD = $(libebl) $(libelf) $(libmudflap) -ldl $(ARGP_LIBS)
+objdump_LDADD  = $(libasm) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl \
+	$(ARGP_LIBS)
+ranlib_LDADD = libar.a $(libelf) $(libeu) $(libmudflap) $(ARGP_LIBS)
+strings_LDADD = $(libelf) $(libeu) $(libmudflap) $(ARGP_LIBS)
+ar_LDADD = libar.a $(libelf) $(libeu) $(libmudflap) $(ARGP_LIBS)
+unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(libmudflap) -ldl \
+	$(ARGP_LIBS)
 
 ldlex.o: ldscript.c
 ldlex_no_Werror = yes
Index: b/libdw/Makefile.am
===================================================================
--- a/libdw/Makefile.am
+++ b/libdw/Makefile.am
@@ -111,7 +111,7 @@
 		-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)
 	if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
 	ln -fs $@ $@.$(VERSION)