1 Allow the usage of an external implementation of the argp functions
3 uClibc lack the argp family of functions that glibc has. Therefore, we
4 add a check in the configure script to see if argp_parse is available
5 in the C library. If not, we look if it is available in the additional
6 'argp' library. If so, we link against that library. If not, we error
9 This allows to build elfutils against uClibc with an external argp
12 Based on the former patch by Thomas Petazzoni.
14 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
15 Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
17 diff -rup a/configure.ac b/configure.ac
18 --- a/configure.ac 2015-01-06 11:30:02.170052875 +0000
19 +++ b/configure.ac 2015-01-06 11:31:10.122219826 +0000
20 @@ -253,6 +253,13 @@ AC_SUBST([LIBEBL_SUBDIR])
21 AC_DEFINE_UNQUOTED(LIBEBL_SUBDIR, "$LIBEBL_SUBDIR")
22 AH_TEMPLATE([LIBEBL_SUBDIR], [$libdir subdirectory containing libebl modules.])
24 +AC_CHECK_FUNC([argp_parse])
25 +if test "$ac_cv_func_argp_parse" != yes; then
26 + AC_CHECK_LIB([argp],[argp_parse],ARGP_LIBS=-largp,
27 + AC_MSG_ERROR([No argp_parse function available.]))
31 dnl Test for zlib and bzlib, gives ZLIB/BZLIB .am
32 dnl conditional and config.h USE_ZLIB/USE_BZLIB #define.
34 diff -rup a/libdw/Makefile.am b/libdw/Makefile.am
35 --- a/libdw/Makefile.am 2014-12-19 20:43:11.000000000 +0000
36 +++ b/libdw/Makefile.am 2015-01-06 11:32:21.075438524 +0000
37 @@ -112,7 +112,7 @@ libdw.so$(EXEEXT): $(srcdir)/libdw.map l
38 -Wl,--enable-new-dtags,-rpath,$(pkglibdir) \
39 -Wl,--version-script,$<,--no-undefined \
40 -Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
42 + -ldl $(zip_LIBS) $(ARGP_LIBS)
44 ln -fs $@ $@.$(VERSION)
46 diff -rup a/src/Makefile.am b/src/Makefile.am
47 --- a/src/Makefile.am 2015-01-06 11:30:02.430057339 +0000
48 +++ b/src/Makefile.am 2015-01-06 11:34:53.061049752 +0000
49 @@ -94,27 +94,29 @@ readelf_no_Werror = yes
50 strings_no_Werror = yes
51 addr2line_no_Wformat = yes
53 -readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) -ldl
54 +readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) -ldl $(ARGP_LIBS)
55 nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) -ldl \
57 -size_LDADD = $(libelf) $(libeu)
58 -strip_LDADD = $(libebl) $(libelf) $(libeu) -ldl
59 -ld_LDADD = $(libebl) $(libelf) $(libeu) -ldl
60 + $(demanglelib) $(ARGP_LIBS)
61 +size_LDADD = $(libelf) $(libeu) $(ARGP_LIBS)
62 +strip_LDADD = $(libebl) $(libelf) $(libeu) -ldl $(ARGP_LIBS)
63 +ld_LDADD = $(libebl) $(libelf) $(libeu) -ldl $(ARGP_LIBS)
65 # -ldl is always needed for libebl.
66 ld_LDADD += libld_elf.a
68 ld_LDFLAGS = -rdynamic
69 -elflint_LDADD = $(libebl) $(libelf) $(libeu) -ldl
70 -findtextrel_LDADD = $(libdw) $(libelf)
71 -addr2line_LDADD = $(libdw) $(libelf)
72 -elfcmp_LDADD = $(libebl) $(libelf) -ldl
73 -objdump_LDADD = $(libasm) $(libebl) $(libelf) $(libeu) -ldl
74 -ranlib_LDADD = libar.a $(libelf) $(libeu)
75 -strings_LDADD = $(libelf) $(libeu)
76 -ar_LDADD = libar.a $(libelf) $(libeu)
77 -unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) -ldl
78 -stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) -ldl $(demanglelib)
79 +elflint_LDADD = $(libebl) $(libelf) $(libeu) -ldl $(ARGP_LIBS)
80 +findtextrel_LDADD = $(libdw) $(libelf) $(ARGP_LIBS)
81 +addr2line_LDADD = $(libdw) $(libelf) $(ARGP_LIBS)
82 +elfcmp_LDADD = $(libebl) $(libelf) -ldl $(ARGP_LIBS)
83 +objdump_LDADD = $(libasm) $(libebl) $(libelf) $(libeu) -ldl \
85 +ranlib_LDADD = libar.a $(libelf) $(libeu) $(ARGP_LIBS)
86 +strings_LDADD = $(libelf) $(libeu) $(ARGP_LIBS)
87 +ar_LDADD = libar.a $(libelf) $(libeu) $(ARGP_LIBS)
88 +unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) -ldl $(ARGP_LIBS)
89 +stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) -ldl \
90 + $(demanglelib) $(ARGP_LIBS)