diff mbox series

gcc/configure.ac: Fix cross build by using $(CFLAGS-$@) [PR100598]

Message ID 1d54afbb-3519-dc1b-4838-b00e295bbc59@codesourcery.com
State New
Headers show
Series gcc/configure.ac: Fix cross build by using $(CFLAGS-$@) [PR100598] | expand

Commit Message

Tobias Burnus May 14, 2021, 2:19 p.m. UTC
Fixes the build fail:
../../gcc/genversion.c:37:20: error: ‘BASEVER’ was not declared in this scope
    char basever[] = BASEVER;
when doing a cross compilation.

Cf. patch for details.
OK for mainline?

(The runstatedir appears when not using 2.69 but a newer subrelease.
[I think it was 2.69b?].)

Tobias

-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank Thürauf

Comments

Tobias Burnus May 18, 2021, 6:32 a.m. UTC | #1
Early *PING* for this bootstrap issue; in the PR, it affected a Linux to
mingw64 cross build.

Here, it affects x86-64 → PowerPC Linux builds, which builds with the
patch applied.

On 14.05.21 16:19, Tobias Burnus wrote:
> Fixes the build fail:
> ../../gcc/genversion.c:37:20: error: ‘BASEVER’ was not declared in
> this scope
>    char basever[] = BASEVER;
> when doing a cross compilation.
>
> Cf. patch for details.
> OK for mainline?
>
> (The runstatedir appears when not using 2.69 but a newer subrelease.
> [I think it was 2.69b?].)
>
> Tobias
>
-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank Thürauf
Richard Biener May 18, 2021, 9:30 a.m. UTC | #2
On Fri, May 14, 2021 at 8:44 PM Tobias Burnus <tobias@codesourcery.com> wrote:
>
> Fixes the build fail:
> ../../gcc/genversion.c:37:20: error: ‘BASEVER’ was not declared in this scope
>     char basever[] = BASEVER;
> when doing a cross compilation.
>
> Cf. patch for details.
> OK for mainline?

OK.

Richard.

> (The runstatedir appears when not using 2.69 but a newer subrelease.
> [I think it was 2.69b?].)
>
> Tobias
>
> -----------------
> Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank Thürauf
diff mbox series

Patch

gcc/configure.ac: Fix cross build by using $(CFLAGS-$@) [PR100598]

BUILD_CFLAGS is set by configure; by default, BUILD_CFLAGS = $(ALL_CFLAGS)
is used. The latter contains (see gcc/Makefile.in) $(CFLAGS-$@), which is used
to pass .o-file specific flags to the compiler.
For cross builds, BUILD_CFLAGS is constructed in configure{,.ac} and missed
the $(CFLAGS-$@) - despite the comment above ALL_CFLAGS that configure.ac
might have to kept in sync.

gcc/ChangeLog:

	PR other/100598
	* configure: Regenerate.
	* configure.ac (BUILD_CFLAG, BUILD_CXXFLAGS): Add $(CFLAGS-$@).

diff --git a/gcc/configure.ac b/gcc/configure.ac
index e9ba2af548a..856b261fb97 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2448,8 +2448,8 @@  BUILD_NO_PIE_FLAG='$(NO_PIE_FLAG)' AC_SUBST(BUILD_NO_PIE_FLAG)
 # And these apply if build != host, or we are generating coverage data
 if test x$build != x$host || test "x$coverage_flags" != x
 then
-    BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)'
-    BUILD_CXXFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CXXFLAGS_FOR_BUILD)'
+    BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS-$@) $(CFLAGS_FOR_BUILD)'
+    BUILD_CXXFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS-$@) $(CXXFLAGS_FOR_BUILD)'
     BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)'
 
     NO_PIE_CFLAGS_FOR_BUILD=${NO_PIE_CFLAGS_FOR_BUILD-${NO_PIE_CFLAGS}}
diff --git a/gcc/configure b/gcc/configure
index f03fe888384..71a077ab009 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -911,7 +911,6 @@  infodir
 docdir
 oldincludedir
 includedir
-runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -1086,7 +1085,6 @@  datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
-runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE}'
@@ -1339,15 +1337,6 @@  do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
-  -runstatedir | --runstatedir | --runstatedi | --runstated \
-  | --runstate | --runstat | --runsta | --runst | --runs \
-  | --run | --ru | --r)
-    ac_prev=runstatedir ;;
-  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
-  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
-  | --run=* | --ru=* | --r=*)
-    runstatedir=$ac_optarg ;;
-
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1485,7 +1474,7 @@  fi
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir runstatedir
+		libdir localedir mandir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1638,7 +1627,6 @@  Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
-  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
@@ -13309,8 +13297,8 @@  BUILD_NO_PIE_FLAG='$(NO_PIE_FLAG)'
 # And these apply if build != host, or we are generating coverage data
 if test x$build != x$host || test "x$coverage_flags" != x
 then
-    BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)'
-    BUILD_CXXFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CXXFLAGS_FOR_BUILD)'
+    BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS-$@) $(CFLAGS_FOR_BUILD)'
+    BUILD_CXXFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS-$@) $(CXXFLAGS_FOR_BUILD)'
     BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)'
 
     NO_PIE_CFLAGS_FOR_BUILD=${NO_PIE_CFLAGS_FOR_BUILD-${NO_PIE_CFLAGS}}
@@ -19447,7 +19435,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 19450 "configure"
+#line 19438 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -19553,7 +19541,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 19556 "configure"
+#line 19544 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H