]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix cross-compilation
authorMichał Kępień <michal@isc.org>
Mon, 2 Nov 2020 11:27:55 +0000 (12:27 +0100)
committerMichał Kępień <michal@isc.org>
Mon, 2 Nov 2020 11:27:55 +0000 (12:27 +0100)
Using AC_RUN_IFELSE() in configure.ac breaks cross-compilation:

    configure: error: cannot run test program while cross compiling

Commit 978c7b2e89aa37a7ddfe2f6b6ba12ce73dd04528 caused AC_RUN_IFELSE()
to be used instead of AC_LINK_IFELSE() because the latter had seemingly
been causing the check for --wrap support in the linker to not work as
expected.  However, it later turned out that the problem lied elsewhere:
a minus sign ('-') was missing from the LDFLAGS variable used in the
relevant check [1].

Revert to using AC_LINK_IFELSE() for checking whether the linker
supports the --wrap option in order to make cross-compilation possible
again.

[1] see commit cfa4ea64bc06685f210a4187dcc05cc0aac84851

configure
configure.ac

index 401a6e70a596d1e2bf22429614fa077805f14757..91ad5368236a3b0e01b0db6e36dfbd8aa5720db1 100755 (executable)
--- a/configure
+++ b/configure
@@ -22068,13 +22068,7 @@ $as_echo_n "checking for linker support for --wrap option... " >&6; }
 
 
 LDFLAGS="-Wl,--wrap,exit"
-if test "$cross_compiling" = yes; then :
-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot run test program while cross compiling
-See \`config.log' for more details" "$LINENO" 5; }
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <stdlib.h>
                       void __real_exit (int status);
@@ -22088,7 +22082,7 @@ exit (1);
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
+if ac_fn_c_try_link "$LINENO"; then :
   LD_WRAP_TESTS=true
 
 $as_echo "#define LD_WRAP 1" >>confdefs.h
@@ -22099,10 +22093,8 @@ else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
   CCASFLAGS=$CCASFLAGS_wrap_ax_save_flags
 
index 4a7c6f967e12f7f995a76a279c834757c482ae02..4ac045fd938f7a7ca18f7c73850f3c373c7edd05 100644 (file)
@@ -2254,7 +2254,7 @@ LD_WRAP_TESTS=false
 AC_MSG_CHECKING([for linker support for --wrap option])
 AX_SAVE_FLAGS([wrap])
 LDFLAGS="-Wl,--wrap,exit"
-AC_RUN_IFELSE(
+AC_LINK_IFELSE(
     [AC_LANG_PROGRAM([[#include <stdlib.h>
                       void __real_exit (int status);
                       void __wrap_exit (int status) { __real_exit (0); }