[PATCH 1/2] GCC: Check if AR works with --plugin and rc
Alan Modra
amodra@gmail.com
Mon Jan 11 23:27:43 GMT 2021
On Mon, Jan 11, 2021 at 08:57:05AM -0800, H.J. Lu via Binutils wrote:
> diff --git a/config/gcc-plugin.m4 b/config/gcc-plugin.m4
> index c5b72e9a13d..798a2054edd 100644
> --- a/config/gcc-plugin.m4
> +++ b/config/gcc-plugin.m4
> @@ -145,6 +145,18 @@ for plugin in $plugin_names; do
> break
> fi
> done
> +dnl Check if ${AR} $plugin_option rc works.
> +AC_CHECK_TOOL(AR, ar)
> +if test "${AR}" = "" ; then
> + AC_MSG_ERROR([Required archive tool 'ar' not found on PATH.])
> +fi
> +touch conftest.c
> +${AR} $plugin_option rc conftest.a conftest.c
> +if test "$?" != 0; then
> + echo "Failed: ${AR} $plugin_option rc"
Use AC_MSG_ERROR rather than echo.
> + plugin_option=
> +fi
> +rm -f conftest.*
> if test -n "$plugin_option"; then
> $1="$plugin_option"
> AC_MSG_RESULT($plugin_option)
> diff --git a/libtool.m4 b/libtool.m4
> index 3672e9516e2..150971974c1 100644
> --- a/libtool.m4
> +++ b/libtool.m4
> @@ -1340,7 +1340,14 @@ AC_CHECK_TOOL(AR, ar, false)
> test -z "$AR" && AR=ar
> if test -n "$plugin_option"; then
> if $AR --help 2>&1 | grep -q "\--plugin"; then
> - AR="$AR $plugin_option"
> + touch conftest.c
> + $AR $plugin_option rc conftest.a conftest.c
> + if test "$?" != 0; then
> + echo "Failed: $AR $plugin_option rc"
AC_MSG_ERROR again.
> + else
> + AR="$AR $plugin_option"
> + fi
> + rm -f conftest.*
> fi
> fi
> test -z "$AR_FLAGS" && AR_FLAGS=cru
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list