You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
2.8 KiB

  1. From 12a10bcfb1999d07961206587d79ce27c432c6ce Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= <michal@isc.org>
  3. Date: Tue, 27 Oct 2020 12:40:45 +0100
  4. Subject: [PATCH] Fix cross-compilation
  5. Using AC_RUN_IFELSE() in configure.ac breaks cross-compilation:
  6. configure: error: cannot run test program while cross compiling
  7. Commit 978c7b2e89aa37a7ddfe2f6b6ba12ce73dd04528 caused AC_RUN_IFELSE()
  8. to be used instead of AC_LINK_IFELSE() because the latter had seemingly
  9. been causing the check for --wrap support in the linker to not work as
  10. expected. However, it later turned out that the problem lied elsewhere:
  11. a minus sign ('-') was missing from the LDFLAGS variable used in the
  12. relevant check [1].
  13. Revert to using AC_LINK_IFELSE() for checking whether the linker
  14. supports the --wrap option in order to make cross-compilation possible
  15. again.
  16. Fixes: https://gitlab.isc.org/isc-projects/bind9/-/issues/2237
  17. [1] see commit cfa4ea64bc06685f210a4187dcc05cc0aac84851
  18. ---
  19. configure | 16 ++++------------
  20. configure.ac | 2 +-
  21. 2 files changed, 5 insertions(+), 13 deletions(-)
  22. diff --git a/configure b/configure
  23. index a408f0dcf6..7694a18c0b 100755
  24. --- a/configure
  25. +++ b/configure
  26. @@ -22047,13 +22047,7 @@ $as_echo_n "checking for linker support for --wrap option... " >&6; }
  27. LDFLAGS="-Wl,--wrap,exit"
  28. -if test "$cross_compiling" = yes; then :
  29. - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
  30. -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
  31. -as_fn_error $? "cannot run test program while cross compiling
  32. -See \`config.log' for more details" "$LINENO" 5; }
  33. -else
  34. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  35. +cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  36. /* end confdefs.h. */
  37. #include <stdlib.h>
  38. void __real_exit (int status);
  39. @@ -22067,7 +22061,7 @@ exit (1);
  40. return 0;
  41. }
  42. _ACEOF
  43. -if ac_fn_c_try_run "$LINENO"; then :
  44. +if ac_fn_c_try_link "$LINENO"; then :
  45. LD_WRAP_TESTS=true
  46. $as_echo "#define LD_WRAP 1" >>confdefs.h
  47. @@ -22078,10 +22072,8 @@ else
  48. { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
  49. $as_echo "no" >&6; }
  50. fi
  51. -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
  52. - conftest.$ac_objext conftest.beam conftest.$ac_ext
  53. -fi
  54. -
  55. +rm -f core conftest.err conftest.$ac_objext \
  56. + conftest$ac_exeext conftest.$ac_ext
  57. CCASFLAGS=$CCASFLAGS_wrap_ax_save_flags
  58. diff --git a/configure.ac b/configure.ac
  59. index 1201b5e2a7..9648d9727a 100644
  60. --- a/configure.ac
  61. +++ b/configure.ac
  62. @@ -2247,7 +2247,7 @@ LD_WRAP_TESTS=false
  63. AC_MSG_CHECKING([for linker support for --wrap option])
  64. AX_SAVE_FLAGS([wrap])
  65. LDFLAGS="-Wl,--wrap,exit"
  66. -AC_RUN_IFELSE(
  67. +AC_LINK_IFELSE(
  68. [AC_LANG_PROGRAM([[#include <stdlib.h>
  69. void __real_exit (int status);
  70. void __wrap_exit (int status) { __real_exit (0); }
  71. --
  72. GitLab