void-packages/srcpkgs/elfutils/patches/musl-fts-obstack.patch

88 lines
2.4 KiB
Diff

--- configure.ac 2015-10-15 15:16:57.000000000 +0200
+++ configure.ac 2015-11-20 05:32:57.723901582 +0100
@@ -305,6 +305,62 @@
fi
AC_SUBST([argp_LDADD])
+dnl Check if we have fts available from our libc
+AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#if !defined(__x86_64__)
+ #undef _FILE_OFFSET_BITS
+ #define _FILE_OFFSET_BITS 32
+ #endif
+ #include <fts.h>],
+ [FTS* fts = 0; return fts_close(fts); return 0;]
+ )],
+ [libc_has_fts="true"],
+ [libc_has_fts="false"]
+)
+
+dnl If our libc doesn't provide fts, then test for libfts
+if test "$libc_has_fts" = "false" ; then
+ AC_MSG_WARN("libc does not have fts")
+ AC_CHECK_LIB([fts], [fts_close], [have_fts="true"], [have_fts="false"])
+
+ if test "$have_fts" = "false"; then
+ AC_MSG_ERROR("no libfts found")
+ else
+ fts_LDADD="-lfts"
+ fi
+else
+ fts_LDADD=""
+fi
+AC_SUBST([fts_LDADD])
+
+dnl Check if we have obstack available from our libc
+AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#include <obstack.h>],
+ [_obstack_begin(0, 0, 0, NULL, NULL); return 0;]
+ )],
+ [libc_has_obstack="true"],
+ [libc_has_obstack="false"]
+)
+
+dnl If our libc doesn't provide obstack, then test for libobstack
+if test "$libc_has_obstack" = "false" ; then
+ AC_MSG_WARN("libc does not have obstack")
+ AC_CHECK_LIB([obstack], [_obstack_begin], [have_obstack="true"], [have_obstack="false"])
+
+ if test "$have_obstack" = "false"; then
+ AC_MSG_ERROR("no libobstack found")
+ else
+ obstack_LDADD="-lobstack"
+ fi
+else
+ obstack_LDADD=""
+fi
+AC_SUBST([obstack_LDADD])
+
+dnl The directories with content.
+
dnl The directories with content.
dnl Documentation.
--- src/Makefile.am.orig
+++ src/Makefile.am
@@ -46,7 +46,7 @@
else
libasm = ../libasm/libasm.so
libdw = ../libdw/libdw.so
-libelf = ../libelf/libelf.so
+libelf = ../libelf/libelf.so $(fts_LDADD) $(obstack_LDADD)
endif
libebl = ../libebl/libebl.a
libeu = ../lib/libeu.a
--- libdw/Makefile.am.orig
+++ libdw/Makefile.am
@@ -109,7 +109,7 @@
../libcpu/libcpu_pic.a libdw_pic.a ../libdwelf/libdwelf_pic.a \
../libdwfl/libdwfl_pic.a
libdw_so_DEPS = ../lib/libeu.a ../libelf/libelf.so
-libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(zip_LIBS) -pthread
+libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) $(zip_LIBS) -pthread
libdw_so_SOURCES =
libdw.so$(EXEEXT): $(srcdir)/libdw.map $(libdw_so_LIBS) $(libdw_so_DEPS)
$(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \