0004-m4-boost.m4-fix-rpath-option-check-for-static-linkin.patch 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. From 5e74a15ce1e093b4d8e83cdade60a43b09d698de Mon Sep 17 00:00:00 2001
  2. From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  3. Date: Sun, 20 Aug 2017 15:25:06 +0200
  4. Subject: [PATCH] m4/boost.m4: fix rpath option check for static linking
  5. When statically linking, the order in which -l options are passed is
  6. important. The contents of the LIBS option passed to the configure
  7. environment should be passed *after* other -l options used internally
  8. by the package.
  9. For example, libboost_program_options may used symbols from the
  10. libatomic library, and in this case, one need to pass LIBS="-latomic"
  11. to cc-tool's configure script. When using dynamic linking, this works
  12. fine, because the rpath test does "-latomic
  13. -lboost_program_options". However, when statically linking, this
  14. doesn't work because libboost_program_options uses symbols from
  15. libatomic, so -latomic must be passed *after* -lboost_program_options.
  16. Therefore, this commit inverts the list of variables used to construct
  17. LIBS before doing the _BOOST_AC_LINK_IFELSE() test detecting the rpath
  18. option to be used. Indeed, $boost_save_LIBS contains the previously
  19. saved LIBS variable, and should be passed after $Boost_lib_LIBS.
  20. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  21. ---
  22. m4/boost.m4 | 2 +-
  23. 1 file changed, 1 insertion(+), 1 deletion(-)
  24. diff --git a/m4/boost.m4 b/m4/boost.m4
  25. index be470a7..f1825ba 100644
  26. --- a/m4/boost.m4
  27. +++ b/m4/boost.m4
  28. @@ -479,7 +479,7 @@ dnl generated only once above (before we start the for loops).
  29. *)
  30. for boost_cv_rpath_link_ldflag in -Wl,-R, -Wl,-rpath,; do
  31. LDFLAGS="$boost_save_LDFLAGS -L$boost_ldpath $boost_cv_rpath_link_ldflag$boost_ldpath"
  32. - LIBS="$boost_save_LIBS $Boost_lib_LIBS"
  33. + LIBS="$Boost_lib_LIBS $boost_save_LIBS"
  34. _BOOST_AC_LINK_IFELSE([],
  35. [boost_rpath_link_ldflag_found=yes
  36. break],
  37. --
  38. 2.9.4