[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCHv3] AC_COMPILE_IFELSE: Evaluate user supplied arguments
From: |
Nikolai Merinov |
Subject: |
Re: [PATCHv3] AC_COMPILE_IFELSE: Evaluate user supplied arguments |
Date: |
Sun, 16 Feb 2020 23:02:05 +0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) |
Hi,
This is gentle reminder about the patch
Regards,
Nikolai
Nikolai Merinov <address@hidden> writes:
> Hi,
>
> Do I need to make additional changes to the patch?
>
> Regards,
> Nikolai
>
> On Thu, Mar 14, 2019 at 8:08 PM Nikolai Merinov <address@hidden> wrote:
>
> Hi,
>
> During work on a same issue in the libtool code I observed that it's
> necessary to fix the _AC_DO macro in same manner in order to pass
> compiler checks with flags like CFLAGS='"-Wall"'.
>
> An updated version of the patch with changes to both _AC_DO and
> _AC_DO_STDERR attached.
>
> Regards,
> Nikolai
>
>From 614d16f92a75a62652dc8c99e872576d9bfb7399 Mon Sep 17 00:00:00 2001
>From: Nikolai Merinov <address@hidden>
>Date: Thu, 7 Mar 2019 22:33:13 +0500
>Subject: [PATCH] _AC_DO _AC_DO_STDERR: Evaluate argument twice
>
>The `AC_COMPILE_IFELSE', `AC_LINK_IFELSE', `AC_PREPROC_IFELSE' macros
>use the `_AC_DO_STDERR` macro in the following manner:
>
>> ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
>> _AC_DO_STDERR($ac_compile)
>
>In order to have same behavior during a configuration stage and during
>a compilation stage we should evaluate a passed argument twice: in
>second time we'll be able to unquote strings in user-supplied
>variables as it happens during make rules execution.
>
>The `_AC_DO' macro used through the `_AC_DO_VAR' macro in similar
>manner in many places and should work by same rules.
>
>* lib/autoconf/general.m4 (_AC_DO_STDERR): Reuse `_AC_DO_ECHO' trick
>to evaluate arguments twice if compile string have no '\"', '`', or
>'\\' symbols.
> (_AC_DO): Same changes.
>* tests/compile.at: Add test for CFLAGS evaluation.
>---
> NEWS | 5 +++++
> lib/autoconf/general.m4 | 22 ++++++++++++++++++----
> tests/compile.at | 11 +++++++++++
> 3 files changed, 34 insertions(+), 4 deletions(-)
>
>diff --git a/NEWS b/NEWS
>index efade585..b6d0136a 100644
>--- a/NEWS
>+++ b/NEWS
>@@ -123,6 +123,11 @@ GNU Autoconf NEWS - User visible changes.
> use with multiple languages, rather than forcing all checks in the
> language used by the first encounter of the macro.
>
>+- The _AC_DO_STDERR and _AC_DO macros now evaluate a COMMAND argument
>+ twice. This change consolidate behavior for user-supplied arguments
>+ between the AC_COMPILE_IFELSE and AC_LINK_IFELSE macros and
>+ compilation commands used in makefiles.
>+
> ** Man pages for config.guess and config.sub are no longer provided.
> They were moved to the master source tree for config.guess and config.sub.
>
>diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
>index e1d82b54..0af61b2a 100644
>--- a/lib/autoconf/general.m4
>+++ b/lib/autoconf/general.m4
>@@ -2448,16 +2448,30 @@ AS_ECHO(["$ac_try_echo"])])
> # Eval COMMAND, save the exit status in ac_status, and log it.
> # For internal use only.
> AC_DEFUN([_AC_DO],
>-[_AC_RUN_LOG([eval "$1"],
>- [_AC_DO_ECHO([$1])])])
>+[m4_if([$1], [$ac_do], [], [ac_do="$1"
>+])]dnl
>+[[case "(($ac_do" in
>+ *\"* | *\`* | *\\*) ac_do_command=\$ac_do;;
>+ *) ac_do_command=$ac_do;;
>+esac
>+eval ac_do_command="\"$ac_do_command\""]
>+_AC_RUN_LOG([eval "$ac_do_command"],
>+ [_AC_DO_ECHO([$ac_do])])])
>
>
> # _AC_DO_STDERR(COMMAND)
> # ----------------------
> # Like _AC_RUN_LOG_STDERR, but eval (instead of running) COMMAND.
> AC_DEFUN([_AC_DO_STDERR],
>-[_AC_RUN_LOG_STDERR([eval "$1"],
>- [_AC_DO_ECHO([$1])])])
>+[m4_if([$1], [$ac_do_stderr], [], [ac_do_stderr="$1"
>+])]dnl
>+[[case "(($ac_do_stderr" in
>+ *\"* | *\`* | *\\*) ac_do_stderr_command=\$ac_do_stderr;;
>+ *) ac_do_stderr_command=$ac_do_stderr;;
>+esac
>+eval ac_do_stderr_command="\"$ac_do_stderr_command\""]
>+_AC_RUN_LOG_STDERR([eval "$ac_do_stderr_command"],
>+ [_AC_DO_ECHO([$ac_do_stderr])])])
>
>
> # _AC_DO_VAR(VARIABLE)
>diff --git a/tests/compile.at b/tests/compile.at
>index 29374529..9af8cb38 100644
>--- a/tests/compile.at
>+++ b/tests/compile.at
>@@ -301,6 +301,17 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [return 2])],
> AT_CHECK_AUTOCONF
> AT_CHECK_CONFIGURE([-q])
>
>+AT_DATA([configure.ac],
>+[[AC_INIT
>+AC_PROG_CC
>+test x$GCC = xyes && CFLAGS='"-Wall"'
>+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [return 0])], [],
>+ [AC_MSG_ERROR([compiling trivial program failed])])
>+]])
>+
>+AT_CHECK_AUTOCONF
>+AT_CHECK_CONFIGURE([-q])
>+
> AT_CLEANUP
>
> ## --------------- ##
>--
>2.21.0
>