0001-Compare-linker-compiler-output-with-their-default-ou.patch 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. From 58d05b2a57802345f43e628bc0807dbf0116cdcc Mon Sep 17 00:00:00 2001
  2. From: Max Filippov <jcmvbkbc@gmail.com>
  3. Date: Fri, 20 Mar 2015 16:37:51 +0300
  4. Subject: [PATCH] Compare linker/compiler output with their default output
  5. linker and compiler may have noisy output by default, making
  6. acx_pthread.m4 believe that pthread options that it tries are ignored
  7. as invalid.
  8. Record default compiler and linker output and see if adding pthread
  9. option changes that, instead of assuming that linker and compiler are
  10. silent by default.
  11. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
  12. ---
  13. config/acx_pthread.m4 | 18 +++++++++++++++++-
  14. 1 file changed, 17 insertions(+), 1 deletion(-)
  15. diff --git a/config/acx_pthread.m4 b/config/acx_pthread.m4
  16. index 581164b..d254612 100644
  17. --- a/config/acx_pthread.m4
  18. +++ b/config/acx_pthread.m4
  19. @@ -80,6 +80,22 @@
  20. esac
  21. if test x"$acx_pthread_ok" = xno; then
  22. +
  23. +cat >conftest.$ac_ext <<_ACEOF
  24. +int
  25. +main (int argc, char **argv)
  26. +{
  27. + (void) argc;
  28. + (void) argv;
  29. + return 0;
  30. +}
  31. +_ACEOF
  32. +rm -f conftest.$ac_objext conftest$ac_exeext
  33. +
  34. +# Record the default linker and compiler output
  35. +ld_default_output="`(eval $ac_link 2>&1 1>&5)`"
  36. +cc_default_output="`(eval $ac_compile 2>&1 1>&5)`"
  37. +
  38. for flag in $acx_pthread_flags; do
  39. tryPTHREAD_CFLAGS=""
  40. @@ -143,7 +159,7 @@
  41. _ACEOF
  42. rm -f conftest.$ac_objext conftest$ac_exeext
  43. # Check both linking and compiling, because they might tolerate different options.
  44. - if test "`(eval $ac_link 2>&1 1>&5)`" = "" && test "`(eval $ac_compile 2>&1 1>&5)`" = ""; then
  45. + if test "`(eval $ac_link 2>&1 1>&5)`" = "$ld_default_output" && test "`(eval $ac_compile 2>&1 1>&5)`" = "$cc_default_output"; then
  46. # we continue with more flags because Linux needs -lpthread
  47. # for libpq builds on PostgreSQL. The test above only
  48. # tests for building binaries, not shared libraries.
  49. --
  50. 1.8.1.4