100-use-xtools.patch 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. This patch makes configure use the cross ld and ar rather than the native tools.
  2. It was build up by Yann E. MORIN <yann.morin.1998@anciens.enib.fr> from some
  3. bits gathered from buildroot, which is LGPL v2.1
  4. License for dmalloc is:
  5. * Permission to use, copy, modify, and distribute this software for
  6. * any purpose and without fee is hereby granted, provided that the
  7. * above copyright notice and this permission notice appear in all
  8. * copies, and that the name of Gray Watson not be used in advertising
  9. * or publicity pertaining to distribution of the document or software
  10. * without specific, written prior permission.
  11. *
  12. * Gray Watson makes no representations about the suitability of the
  13. * software described herein for any purpose. It is provided "as is"
  14. * without express or implied warranty.
  15. I personnaly believe that the resulting code should therefore be
  16. LGPL v2.1, but don't believe me, ask your lawyers!
  17. Index: dmalloc-5.5.2/configure.ac
  18. ===================================================================
  19. --- dmalloc-5.5.2.orig/configure.ac
  20. +++ dmalloc-5.5.2/configure.ac
  21. @@ -69,6 +69,15 @@ if test "$ac_cv_prog_cc_stdc" = "no" ; t
  22. fi
  23. AC_PROG_INSTALL
  24. AC_PROG_RANLIB
  25. +AN_MAKEVAR([AR], [AC_PROG_AR])
  26. +AN_PROGRAM([ar], [AC_PROG_AR])
  27. +AC_DEFUN([AC_PROG_AR], [AC_CHECK_TOOL(AR, ar, :)])
  28. +AC_PROG_AR
  29. +AN_MAKEVAR([LD], [AC_PROG_LD])
  30. +AN_PROGRAM([ld], [AC_PROG_LD])
  31. +AC_DEFUN([AC_PROG_LD], [AC_CHECK_TOOL(LD, ld, :)])
  32. +AC_PROG_LD
  33. +
  34. AC_C_CONST
  35. # we need this for various settings
  36. @@ -131,14 +140,14 @@ AC_SUBST(shlibdir)
  37. AC_MSG_CHECKING([shared library link args])
  38. AC_COMPILE_IFELSE([ int foo(int val) { return val + 1; } ],[
  39. # so now we try to create an archive from the compiled .o file
  40. - (ar cr conftest.a conftest.o) 2>&5
  41. + (${ac_cv_prog_AR} cr conftest.a conftest.o) 2>&5
  42. # see which shared-library ld commands work
  43. #
  44. # Darwin/Mac OS X - Terry Teague
  45. # username terry_teague at domain users.sourceforge.net
  46. ac_cv_shared_lib_link_objs=no
  47. if test `uname` = "Darwin"; then
  48. - if (ld -dylib -o conftest.so.t -lc conftest.a) 2>&5; then
  49. + if (${ac_cv_prog_LD} -dylib -o conftest.so.t -lc conftest.a) 2>&5; then
  50. # By convention on some platforms
  51. # libLLL.so, libLLL.X.so are symlinks to libLLL.X.Y.Z.so
  52. # where X.Y.Z is version # (major.minor.increment) of the library
  53. @@ -156,12 +165,12 @@ AC_COMPILE_IFELSE([ int foo(int val) { r
  54. ac_cv_shared_link_args='# Could not configure shlib linking'
  55. enable_shlib=no
  56. fi
  57. - elif (ld -shared --whole-archive -soname conftest.so -o conftest.so.t conftest.a) 2>&5; then
  58. - ac_cv_shared_link_args='ld -shared --whole-archive -soname $@ -o $@.t'
  59. - elif (ld -shared -o conftest.so.t -all -soname conftest.so.t -none -lc -all conftest.a) 2>&5; then
  60. - ac_cv_shared_link_args='ld -shared -o $@.t -all -soname $@ -none -lc -all'
  61. - elif (ld -G -o conftest.so.t conftest.a) 2>&5; then
  62. - ac_cv_shared_link_args='ld -G -o $@.t'
  63. + elif (${ac_cv_prog_LD} -shared --whole-archive -soname conftest.so -o conftest.so.t conftest.a) 2>&5; then
  64. + ac_cv_shared_link_args='${CC} -Wl,-shared -Wl,--whole-archive -Wl,-soname,$@ -o $@.t -Wl,--no-whole-archive'
  65. + elif (${ac_cv_prog_LD} -shared -o conftest.so.t -all -soname conftest.so.t -none -lc -all conftest.a) 2>&5; then
  66. + ac_cv_shared_link_args='${CC} -Wl,-shared -o $@.t -Wl,-all -Wl,-soname,$@ -Wl,-none -lc -Wl,-all'
  67. + elif (${ac_cv_prog_LD} -G -o conftest.so.t conftest.a) 2>&5; then
  68. + ac_cv_shared_link_args='${CC} -Wl,-G -o $@.t'
  69. else
  70. # oh well, toss an error
  71. ac_cv_shared_link_args='# Could not configure shlib linking'
  72. Index: dmalloc-5.5.2/Makefile.in
  73. ===================================================================
  74. --- dmalloc-5.5.2.orig/Makefile.in
  75. +++ dmalloc-5.5.2/Makefile.in
  76. @@ -263,25 +263,25 @@ $(LIB_SL) : $(OBJS_SL) $(NORMAL_OBJS_SL)
  77. $(CC) $(LDFLAGS) -shared -Wl,-soname,libdmalloc.so.5 -o $@ $(OBJS_SL) $(NORMAL_OBJS_SL)
  78. $(LIBRARY) : $(OBJS) $(NORMAL_OBJS)
  79. - ar cr $@ $?
  80. + @AR@ cr $@ $?
  81. @RANLIB@ $@
  82. $(LIB_TH) : $(OBJS) $(THREAD_OBJS)
  83. - ar cr $@ $?
  84. + @AR@ cr $@ $?
  85. @RANLIB@ $@
  86. $(LIB_TH_SL) : $(OBJS_SL) $(THREAD_OBJS_SL)
  87. $(CC) $(LDFLAGS) -shared -Wl,-soname,libdmallocth.so.5 -o $@ $(OBJS_SL) $(THREAD_OBJS_SL)
  88. $(LIB_CXX) : $(OBJS) $(NORMAL_OBJS) $(CXX_OBJS)
  89. - ar cr $@ $?
  90. + @AR@ cr $@ $?
  91. @RANLIB@ $@
  92. $(LIB_CXX_SL) : $(OBJS_SL) $(NORMAL_OBJS_SL) $(CXX_OBJS_SL)
  93. $(CC) $(LDFLAGS) -shared -Wl,-soname,libdmalloccxx.so.5 -o $@ $(OBJS_SL) $(NORMAL_OBJS_SL) $(CXX_OBJS_SL)
  94. $(LIB_TH_CXX) : $(OBJS) $(THREAD_OBJS) $(CXX_OBJS)
  95. - ar cr $@ $?
  96. + @AR@ cr $@ $?
  97. @RANLIB@ $@
  98. $(LIB_TH_CXX_SL) : $(OBJS_SL) $(THREAD_OBJS_SL) $(CXX_OBJS_SL)