[libffi,2/4] Use a documented way to pass $compiler_vendor to DejaGNU

Message ID alpine.LFD.2.21.2004031354120.461@redsun52.ssa.fujisawa.hgst.com
State New
Headers show
Series
  • [libffi,1/4] Use a template to pass $CC and $CXX to DejaGNU
Related show

Commit Message

Xionghu Luo via Gcc-patches April 3, 2020, 10:55 p.m.
Use Autoconf substitution in the template used for extra DejaGNU site 
configuration, which is a documented supported way to pass information 
from the `configure' script, rather than resorting to a hack with 
extracting an undocumented internal setting from `config.log' to pass 
the compiler vendor to DejaGNU.  No functional change (and no risk of 
breakage with some Autoconf version anymore).

Use AM_SUBST_NOTMAKE with the new substitution so as not to place it in 
Makefile.in files, where it is not needed, and set the Autmoake version 
requirement accordingly.
---
Hi,

 I chose to use AM_SUBST_NOTMAKE so as not to clutter Makefile.in files 
with the new variable as Automake does that by default.  That however 
requires the use of Automake 1.11 or newer.  By the look of our sources 
that shouldn't be an issue as far as I can tell, but the macro invocation 
can be dropped along with the requirement if it would.

  Maciej
---
 Makefile.am              |    3 ++-
 configure.ac             |    2 ++
 testsuite/lib/libffi.exp |    4 ----
 testsuite/local.exp.in   |    1 +
 4 files changed, 5 insertions(+), 5 deletions(-)

libffi-compiler-vendor.diff

Comments

Xionghu Luo via Gcc-patches April 6, 2020, 6 p.m. | #1
On Fri, 2020-04-03 at 23:55 +0100, Maciej W. Rozycki via Gcc-patches wrote:
> Use Autoconf substitution in the template used for extra DejaGNU site 

> configuration, which is a documented supported way to pass information 

> from the `configure' script, rather than resorting to a hack with 

> extracting an undocumented internal setting from `config.log' to pass 

> the compiler vendor to DejaGNU.  No functional change (and no risk of 

> breakage with some Autoconf version anymore).

> 

> Use AM_SUBST_NOTMAKE with the new substitution so as not to place it in 

> Makefile.in files, where it is not needed, and set the Autmoake version 

> requirement accordingly.

> ---

> Hi,

> 

>  I chose to use AM_SUBST_NOTMAKE so as not to clutter Makefile.in files 

> with the new variable as Automake does that by default.  That however 

> requires the use of Automake 1.11 or newer.  By the look of our sources 

> that shouldn't be an issue as far as I can tell, but the macro invocation 

> can be dropped along with the requirement if it would.

> 

>   Maciej

> ---

>  Makefile.am              |    3 ++-

>  configure.ac             |    2 ++

>  testsuite/lib/libffi.exp |    4 ----

>  testsuite/local.exp.in   |    1 +

>  4 files changed, 5 insertions(+), 5 deletions(-)

OK
jeff
>

Patch

Index: libffi/Makefile.am
===================================================================
--- libffi.orig/Makefile.am
+++ libffi/Makefile.am
@@ -1,6 +1,7 @@ 
 ## Process this with automake to create Makefile.in
 
-AUTOMAKE_OPTIONS = foreign subdir-objects
+# Automake 1.11 needed for AM_SUBST_NOTMAKE.
+AUTOMAKE_OPTIONS = 1.11 foreign subdir-objects
 
 ACLOCAL_AMFLAGS = -I m4
 
Index: libffi/configure.ac
===================================================================
--- libffi.orig/configure.ac
+++ libffi/configure.ac
@@ -45,6 +45,8 @@  AC_CONFIG_MACRO_DIR([m4])
 AC_CHECK_SIZEOF([size_t])
 
 AX_COMPILER_VENDOR
+AC_SUBST([compiler_vendor], [$ax_cv_c_compiler_vendor])
+AM_SUBST_NOTMAKE([compiler_vendor])
 AX_CC_MAXOPT
 # The AX_CFLAGS_WARN_ALL macro doesn't currently work for sunpro
 # compiler.
Index: libffi/testsuite/lib/libffi.exp
===================================================================
--- libffi.orig/testsuite/lib/libffi.exp
+++ libffi/testsuite/lib/libffi.exp
@@ -286,10 +286,6 @@  proc libffi-init { args } {
 
     verbose "libffi $blddirffi"
 
-    # Which compiler are we building with?
-    set tmp [grep "$blddirffi/config.log" "^ax_cv_c_compiler_vendor.*$"]
-    regexp -- {^[^=]*=(.*)$} $tmp nil compiler_vendor
-
     if { [string match $compiler_vendor "gnu"] } {
         set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a]
         if {$gccdir != ""} {
Index: libffi/testsuite/local.exp.in
===================================================================
--- libffi.orig/testsuite/local.exp.in
+++ libffi/testsuite/local.exp.in
@@ -1,2 +1,3 @@ 
 set CC_FOR_TARGET "@CC@"
 set CXX_FOR_TARGET "@CXX@"
+set compiler_vendor "@compiler_vendor@"