recipes: devel/elfutils: Added as drop in replacement for libelf
[dragora.git] / patches / elfutils / musl-fts-obstack.patch
blob77e3c4ea040fc1be200187a671e94e89a4e040e8
1 --- configure.ac 2015-10-15 15:16:57.000000000 +0200
2 +++ configure.ac 2015-11-20 05:32:57.723901582 +0100
3 @@ -305,6 +305,62 @@
4 fi
5 AC_SUBST([argp_LDADD])
7 +dnl Check if we have fts available from our libc
8 +AC_LINK_IFELSE(
9 + [AC_LANG_PROGRAM(
10 + [#if !defined(__x86_64__)
11 + #undef _FILE_OFFSET_BITS
12 + #define _FILE_OFFSET_BITS 32
13 + #endif
14 + #include <fts.h>],
15 + [FTS* fts = 0; return fts_close(fts); return 0;]
16 + )],
17 + [libc_has_fts="true"],
18 + [libc_has_fts="false"]
21 +dnl If our libc doesn't provide fts, then test for libfts
22 +if test "$libc_has_fts" = "false" ; then
23 + AC_MSG_WARN("libc does not have fts")
24 + AC_CHECK_LIB([fts], [fts_close], [have_fts="true"], [have_fts="false"])
26 + if test "$have_fts" = "false"; then
27 + AC_MSG_ERROR("no libfts found")
28 + else
29 + fts_LDADD="-lfts"
30 + fi
31 +else
32 + fts_LDADD=""
33 +fi
34 +AC_SUBST([fts_LDADD])
36 +dnl Check if we have obstack available from our libc
37 +AC_LINK_IFELSE(
38 + [AC_LANG_PROGRAM(
39 + [#include <obstack.h>],
40 + [_obstack_begin(0, 0, 0, NULL, NULL); return 0;]
41 + )],
42 + [libc_has_obstack="true"],
43 + [libc_has_obstack="false"]
46 +dnl If our libc doesn't provide obstack, then test for libobstack
47 +if test "$libc_has_obstack" = "false" ; then
48 + AC_MSG_WARN("libc does not have obstack")
49 + AC_CHECK_LIB([obstack], [_obstack_begin], [have_obstack="true"], [have_obstack="false"])
51 + if test "$have_obstack" = "false"; then
52 + AC_MSG_ERROR("no libobstack found")
53 + else
54 + obstack_LDADD="-lobstack"
55 + fi
56 +else
57 + obstack_LDADD=""
58 +fi
59 +AC_SUBST([obstack_LDADD])
61 +dnl The directories with content.
63 dnl The directories with content.
65 dnl Documentation.
66 --- src/Makefile.am.orig
67 +++ src/Makefile.am
68 @@ -46,7 +46,7 @@
69 else
70 libasm = ../libasm/libasm.so
71 libdw = ../libdw/libdw.so
72 -libelf = ../libelf/libelf.so
73 +libelf = ../libelf/libelf.so $(fts_LDADD) $(obstack_LDADD)
74 endif
75 libebl = ../libebl/libebl.a
76 libeu = ../lib/libeu.a
77 --- libdw/Makefile.am.orig
78 +++ libdw/Makefile.am
79 @@ -109,7 +109,7 @@
80 ../libcpu/libcpu_pic.a libdw_pic.a ../libdwelf/libdwelf_pic.a \
81 ../libdwfl/libdwfl_pic.a
82 libdw_so_DEPS = ../lib/libeu.a ../libelf/libelf.so
83 -libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(zip_LIBS) -pthread
84 +libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) $(zip_LIBS) -pthread
85 libdw_so_SOURCES =
86 libdw.so$(EXEEXT): $(srcdir)/libdw.map $(libdw_so_LIBS) $(libdw_so_DEPS)
87 $(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \