Commit 81e5b262 authored by Thomas Haller's avatar Thomas Haller
Browse files

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
parent 7d8d21ac
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment