From 81e5b262da643414507a76c4db185d28e81d9a32 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 26 Jul 2018 08:02:33 +0200 Subject: [PATCH] build: avoid AC_CHECK_FILE() due to problems with cross-compilation AC_CHECK_FILE() does not work for cross compilation. Autoconf documentation says: Be aware that, like most Autoconf macros, they test a feature of the host machine, and therefore, they die when cross-compiling. [1] Test for the existance of the file directly. Of course, when cross compiling, it's not at all clear that the host machine will run the same distribution. And thus detecting --enable-ifcfg-rh based on the build machine is likely wrong. Note, that we already did AS_IF([test -z "$hostname_persist" -a -f /etc/SuSE-release], hostname_persist=suse) which has the same problem. At least, build no longer fails, and the user can inspect the ./configure summary and see which features were misdetected. [1] https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Files.html --- configure.ac | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index e27c90763..a3d396368 100644 --- a/configure.ac +++ b/configure.ac @@ -134,8 +134,8 @@ AC_ARG_ENABLE(config-plugin-ibft, AS_HELP_STRING([--enable-config-plugin-ibft], AC_ARG_ENABLE(ifcfg-rh, AS_HELP_STRING([--enable-ifcfg-rh], [enable ifcfg-rh configuration plugin (Fedora/RHEL)])) AC_ARG_ENABLE(ifupdown, AS_HELP_STRING([--enable-ifupdown], [enable ifupdown configuration plugin (Debian/Ubuntu)])) # Default alternative plugins by distribution -AS_IF([test -z "$enable_ifcfg_rh"], AC_CHECK_FILE(/etc/sysconfig/network-scripts, enable_ifcfg_rh=yes)) -AS_IF([test -z "$enable_ifupdown"], AC_CHECK_FILE(/etc/debian_version, enable_ifupdown=yes)) +AS_IF([test -z "$enable_ifcfg_rh" -a -d /etc/sysconfig/network-scripts], enable_ifcfg_rh=yes) +AS_IF([test -z "$enable_ifupdown" -a -f /etc/debian_version], enable_ifupdown=yes) # Otherwise plugins default to "no" AS_IF([test -z "$enable_ifcfg_rh"], enable_ifcfg_rh=no) AS_IF([test -z "$enable_ifupdown"], enable_ifupdown=no) @@ -921,7 +921,7 @@ if test "$config_dns_rc_manager_default" != symlink -a \ config_dns_rc_manager_default= fi # Use netconfig by default on SUSE -AS_IF([test -z "$with_netconfig"], AC_CHECK_FILE(/etc/SuSE-release, with_netconfig=yes)) +AS_IF([test -z "$with_netconfig" -a -f /etc/SuSE-release], with_netconfig=yes) # Otherwise default to "no" AS_IF([test -z "$with_resolvconf"], with_resolvconf=no) AS_IF([test -z "$with_netconfig"], with_netconfig=no)