0001-configure-ac-check-for-libraries-in-C-mode.patch 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. From 4446516eb4fc8613d26669f5683f9d5d7c36ee67 Mon Sep 17 00:00:00 2001
  2. From: Peter Seiderer <ps.report@gmx.net>
  3. Date: Wed, 18 Dec 2019 21:26:58 +0100
  4. Subject: [PATCH] configure.ac: check for libraries in C mode
  5. Fixes check for libraries failures, e.g. (from config.log):
  6. arc-buildroot-linux-uclibc-g++ -o conftest -Os -Wall -fdiagnostics-show-caret -ftrack-macro-expansion -fdiagnostics-color=auto -Wextra -pedantic -Wstrict-aliasing -Wstrict-overflow -Woverloaded-virtual -Wold-style-cast -Wc++14-compat -Wundef -Wshadow -Wformat -Wnoexcept -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wno-variadic-macros -fvisibility=hidden conftest.cpp -latomic
  7. conftest.cpp:28:6: error: new declaration 'char __atomic_fetch_and_4()' ambiguates built-in declaration 'unsigned int __atomic_fetch_and_4(volatile void*, unsigned int, int)' [-fpermissive]
  8. 28 | char __atomic_fetch_and_4 ();
  9. | ^~~~~~~~~~~~~~~~~~~~
  10. conftest.cpp: In function 'int main()':
  11. conftest.cpp:32:30: error: too few arguments to function 'unsigned int __atomic_fetch_and_4(volatile void*, unsigned int, int)'
  12. 32 | return __atomic_fetch_and_4 ();
  13. | ^
  14. Resulting in:
  15. checking for library containing __atomic_fetch_and_4... no
  16. instead (after the fix applied):
  17. checking for library containing __atomic_fetch_and_4... -latomic
  18. Signed-off-by: Peter Seiderer <ps.report@gmx.net>
  19. [Retrieved from:
  20. https://github.com/log4cplus/log4cplus/commit/4446516eb4fc8613d26669f5683f9d5d7c36ee67]
  21. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  22. ---
  23. configure.ac | 4 ++++
  24. 1 file changed, 4 insertions(+)
  25. diff --git a/configure.ac b/configure.ac
  26. index 72fbd870a..64eff1936 100644
  27. --- a/configure.ac
  28. +++ b/configure.ac
  29. @@ -412,6 +412,7 @@ LOG4CPLUS_DEFINE_MACRO_IF([LOG4CPLUS_HAVE_VAR_ATTRIBUTE_INIT_PRIORITY],
  30. dnl Checks for libraries.
  31. +AC_LANG_PUSH([C])
  32. AC_SEARCH_LIBS([__atomic_fetch_and_4], [atomic])
  33. AC_SEARCH_LIBS([strerror], [cposix])
  34. dnl On some systems libcompat exists only as a static library which
  35. @@ -422,6 +423,7 @@ AC_SEARCH_LIBS([setsockopt], [socket network net])
  36. AS_IF([test "x$with_iconv" = "xyes"],
  37. [AC_SEARCH_LIBS([iconv_open], [iconv], [],
  38. [AC_SEARCH_LIBS([libiconv_open], [iconv])])])
  39. +AC_LANG_POP([C])
  40. dnl Windows/MinGW specific.
  41. @@ -497,7 +499,9 @@ dnl Multi threaded library.
  42. AS_VAR_APPEND([LIBS], [" $PTHREAD_LIBS"])
  43. dnl required on HP-UX
  44. + AC_LANG_PUSH([C])
  45. AC_SEARCH_LIBS([sem_init], [rt])
  46. + AC_LANG_POP([C])
  47. AS_CASE([$ax_cv_cxx_compiler_vendor],
  48. [gnu|clang],