https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112534
--- Comment #6 from Arsen Arsenović <arsen at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #5) > The problem is that the toplevel configure (which is autoconf 2.69 as pretty > much everything in gcc) uses the older AC_PROG_CC, which only checks for > -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99, not for > -std=gnu11. > And sets > CC = @CC@ > in toplevel Makefile.in to > CC = gcc -std=gnu99 > in toplevel objdir Makefile. That gets then passed to in-tree gettext (if > present, I really don't think you need it on powerpc64-linux-gnu, perhaps > download_prerequisities should be smarter and check if gettext is really > needed) configure (where it just means > CC is set there to gcc -std=gnu99 -std=gnu11 in gettext/Makefile), but worse > is passed as CC="gcc -std=gnu99" in environment down when doing make all in > the gettext subdir. > I think that is something very similar to how CXX="g++ -std=c++11" is being > passed down > to in-tree isl build and breaks with recent isl which wants to use C++17 or > what. > Strangely, in my x86_64-linux toplevel Makefile I only have > CC = gcc > CXX = g++ -std=c++11 > Dunno why it hasn't added -std=gnu99 there, maybe because that gcc already > defaults to gnu17? Anyway, even when CC = gcc, I think that is passed down > to make of the in-tree compilations. > So, I guess if we don't want to switch to autoconf 2.70 or later (which I > think is a lot of work), one possibility if we know gettext relies on C11 > and newest ISL relies on C++17 (does it really?) would be to add explicit > probing in configure for -std=gnu11 or -std=c11 and if that works, pass it > down in the gettext build case; and similarly for isl. Maybe better not in > CC/CXX but in CFLAGS/CXXFLAGS? > The propagation of flags is done in $(HOST_EXPORTS) and for stage2+ > $(POSTSTAGE1_HOST_EXPORTS). > > Looking around in Makefile.def, I see e.g. for gmp/mpfr we use > extra_make_flags='AM_CFLAGS="-DNO_ASM"'; > and for isl > extra_make_flags='V=1'; > Dunno if it would work to add for the gettext case > extra_make_flags='CFLAGS="$(CFLAGS) @C11_CFLAGS@"'; > with configure check for C11_FLAGS or something similar. yes, that seems doable but I am curious about why the flag propagation via export is necessary. would each configure not already have the appropriate flags set?