musl-fts-obstack.patch 2.4 KB

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