All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] configure: Fix default -O2 being added when CFLAGS not set
@ 2022-03-24 22:31 Glenn Washburn
  2022-03-25  6:53 ` Paul Menzel
  2022-03-25 15:54 ` Robbie Harwood
  0 siblings, 2 replies; 5+ messages in thread
From: Glenn Washburn @ 2022-03-24 22:31 UTC (permalink / raw)
  To: grub-devel, Daniel Kiper; +Cc: Glenn Washburn

Autoconf will set a default CFLAGS of "-g -O2" if CFLAGS is not set. CFLAGS
was defaulted to "" early in configure to prevent this. Apparently something
changed in autoconf and now AC_USE_SYSTEM_EXTENSIONS, which is before the
default setting of CFLAGS, will pull in this check. Move the default
setting of CFLAGS to before this so that if will see CFLAGS as set and not
give it a default.

Signed-off-by: Glenn Washburn <development@efficientek.com>
---
 configure.ac | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 3ffbc7c57b..c1e50c9d75 100644
--- a/configure.ac
+++ b/configure.ac
@@ -36,12 +36,12 @@ dnl description of the relationships between them.
 
 AC_INIT([GRUB],[2.11],[bug-grub@gnu.org])
 
-AC_USE_SYSTEM_EXTENSIONS
-AC_CONFIG_AUX_DIR([build-aux])
-
 # We don't want -g -O2 by default in CFLAGS
 : ${CFLAGS=""}
 
+AC_USE_SYSTEM_EXTENSIONS
+AC_CONFIG_AUX_DIR([build-aux])
+
 # Checks for build, host and target systems.
 AC_CANONICAL_BUILD
 AC_CANONICAL_HOST
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] configure: Fix default -O2 being added when CFLAGS not set
  2022-03-24 22:31 [PATCH] configure: Fix default -O2 being added when CFLAGS not set Glenn Washburn
@ 2022-03-25  6:53 ` Paul Menzel
  2022-03-28 16:14   ` Glenn Washburn
  2022-03-25 15:54 ` Robbie Harwood
  1 sibling, 1 reply; 5+ messages in thread
From: Paul Menzel @ 2022-03-25  6:53 UTC (permalink / raw)
  To: Glenn Washburn; +Cc: grub-devel, Daniel Kiper

Dear Glenn,


Thank you for your tireless awesome work on GRUB.

Am 24.03.22 um 23:31 schrieb Glenn Washburn:
> Autoconf will set a default CFLAGS of "-g -O2" if CFLAGS is not set. CFLAGS
> was defaulted to "" early in configure to prevent this. Apparently something
> changed in autoconf and now AC_USE_SYSTEM_EXTENSIONS, which is before the
> default setting of CFLAGS, will pull in this check. Move the default
> setting of CFLAGS to before this so that if will see CFLAGS as set and not
> give it a default.

Could you please mention the Autoconf version you use? I guess, it’d be 
great to know, when this behavior started, so to make sure, that the 
last X years all the tests were done like this, and reverting the 
behavior would actually break things (though shouldn’t).

With Debian sid/unstable and GNU Autoconf 2.71 I can reproduce your 
behavior:

     $ grep '^CFLAGS=' config.log
     CFLAGS='-g -O2'

> Signed-off-by: Glenn Washburn <development@efficientek.com>
> ---
>   configure.ac | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 3ffbc7c57b..c1e50c9d75 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -36,12 +36,12 @@ dnl description of the relationships between them.
>   
>   AC_INIT([GRUB],[2.11],[bug-grub@gnu.org])
>   
> -AC_USE_SYSTEM_EXTENSIONS
> -AC_CONFIG_AUX_DIR([build-aux])
> -
>   # We don't want -g -O2 by default in CFLAGS
>   : ${CFLAGS=""}
>   
> +AC_USE_SYSTEM_EXTENSIONS
> +AC_CONFIG_AUX_DIR([build-aux])
> +
>   # Checks for build, host and target systems.
>   AC_CANONICAL_BUILD
>   AC_CANONICAL_HOST

Tested-by: Paul Menzel <pmenzel@molgen.mpg.de>

     $ git am … && ./autogen.sh && ./configure --with-platform=coreboot
     $ grep '^CFLAGS=' config.log
     CFLAGS=''


Kind regards,

Paul


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] configure: Fix default -O2 being added when CFLAGS not set
  2022-03-24 22:31 [PATCH] configure: Fix default -O2 being added when CFLAGS not set Glenn Washburn
  2022-03-25  6:53 ` Paul Menzel
@ 2022-03-25 15:54 ` Robbie Harwood
  2022-03-28 15:53   ` Glenn Washburn
  1 sibling, 1 reply; 5+ messages in thread
From: Robbie Harwood @ 2022-03-25 15:54 UTC (permalink / raw)
  To: Glenn Washburn, grub-devel, Daniel Kiper; +Cc: Glenn Washburn

[-- Attachment #1: Type: text/plain, Size: 794 bytes --]

Glenn Washburn <development@efficientek.com> writes:

> Autoconf will set a default CFLAGS of "-g -O2" if CFLAGS is not set. CFLAGS
> was defaulted to "" early in configure to prevent this. Apparently something
> changed in autoconf and now AC_USE_SYSTEM_EXTENSIONS, which is before the
> default setting of CFLAGS, will pull in this check. Move the default
> setting of CFLAGS to before this so that if will see CFLAGS as set and not
> give it a default.

This is a result of ad9ccf660013c208077b1e983d6c824df25ed1cf
("configure: Fix various new autotools warnings"), which hoisted
AC_USE_SYSTEM_EXTENSIONS to avoid a new warning (slightly too far, it
seems).

> Signed-off-by: Glenn Washburn <development@efficientek.com>

Reviewed-by: Robbie Harwood <rharwood@redhat.com>

Be well,
--Robbie

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] configure: Fix default -O2 being added when CFLAGS not set
  2022-03-25 15:54 ` Robbie Harwood
@ 2022-03-28 15:53   ` Glenn Washburn
  0 siblings, 0 replies; 5+ messages in thread
From: Glenn Washburn @ 2022-03-28 15:53 UTC (permalink / raw)
  To: Robbie Harwood; +Cc: grub-devel, Daniel Kiper

On Fri, 25 Mar 2022 11:54:59 -0400
Robbie Harwood <rharwood@redhat.com> wrote:

> Glenn Washburn <development@efficientek.com> writes:
> 
> > Autoconf will set a default CFLAGS of "-g -O2" if CFLAGS is not set. CFLAGS
> > was defaulted to "" early in configure to prevent this. Apparently something
> > changed in autoconf and now AC_USE_SYSTEM_EXTENSIONS, which is before the
> > default setting of CFLAGS, will pull in this check. Move the default
> > setting of CFLAGS to before this so that if will see CFLAGS as set and not
> > give it a default.
> 
> This is a result of ad9ccf660013c208077b1e983d6c824df25ed1cf
> ("configure: Fix various new autotools warnings"), which hoisted
> AC_USE_SYSTEM_EXTENSIONS to avoid a new warning (slightly too far, it
> seems).

I neglected to check the commit log, which hints at the fact that this
isn't an issue in autoconf. Thanks for pointing this out, I'll update
the commit message with this info to more accurately reflect what's
going on.

Glenn

> > Signed-off-by: Glenn Washburn <development@efficientek.com>
> 
> Reviewed-by: Robbie Harwood <rharwood@redhat.com>
> 
> Be well,
> --Robbie


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] configure: Fix default -O2 being added when CFLAGS not set
  2022-03-25  6:53 ` Paul Menzel
@ 2022-03-28 16:14   ` Glenn Washburn
  0 siblings, 0 replies; 5+ messages in thread
From: Glenn Washburn @ 2022-03-28 16:14 UTC (permalink / raw)
  To: Paul Menzel; +Cc: grub-devel, Daniel Kiper

Hi Paul,

On Fri, 25 Mar 2022 07:53:29 +0100
Paul Menzel <pmenzel@molgen.mpg.de> wrote:

> Dear Glenn,
> 
> 
> Thank you for your tireless awesome work on GRUB.

Sincerely, thank you. It seems to me that you're also deserving of this
compliment and probably more so. 

> Am 24.03.22 um 23:31 schrieb Glenn Washburn:
> > Autoconf will set a default CFLAGS of "-g -O2" if CFLAGS is not set. CFLAGS
> > was defaulted to "" early in configure to prevent this. Apparently something
> > changed in autoconf and now AC_USE_SYSTEM_EXTENSIONS, which is before the
> > default setting of CFLAGS, will pull in this check. Move the default
> > setting of CFLAGS to before this so that if will see CFLAGS as set and not
> > give it a default.
> 
> Could you please mention the Autoconf version you use? I guess, it’d be 
> great to know, when this behavior started, so to make sure, that the 
> last X years all the tests were done like this, and reverting the 
> behavior would actually break things (though shouldn’t).

I'm generally testing on Debian 11 and have an autoconf version
of 2.69. However, I was wrong in the commit message as Robbie pointed
out. The issue wasn't from a change in autoconf, but in a very recent
change in GRUB's usage of autoconf. So this shouldn't have affected any
previous testing.

> With Debian sid/unstable and GNU Autoconf 2.71 I can reproduce your 
> behavior:
> 
>      $ grep '^CFLAGS=' config.log
>      CFLAGS='-g -O2'
> 
> > Signed-off-by: Glenn Washburn <development@efficientek.com>
> > ---
> >   configure.ac | 6 +++---
> >   1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/configure.ac b/configure.ac
> > index 3ffbc7c57b..c1e50c9d75 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -36,12 +36,12 @@ dnl description of the relationships between them.
> >   
> >   AC_INIT([GRUB],[2.11],[bug-grub@gnu.org])
> >   
> > -AC_USE_SYSTEM_EXTENSIONS
> > -AC_CONFIG_AUX_DIR([build-aux])
> > -
> >   # We don't want -g -O2 by default in CFLAGS
> >   : ${CFLAGS=""}
> >   
> > +AC_USE_SYSTEM_EXTENSIONS
> > +AC_CONFIG_AUX_DIR([build-aux])
> > +
> >   # Checks for build, host and target systems.
> >   AC_CANONICAL_BUILD
> >   AC_CANONICAL_HOST
> 
> Tested-by: Paul Menzel <pmenzel@molgen.mpg.de>

Thank you for testing this.

Glenn

> 
>      $ git am … && ./autogen.sh && ./configure --with-platform=coreboot
>      $ grep '^CFLAGS=' config.log
>      CFLAGS=''
> 
> 
> Kind regards,
> 
> Paul


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-03-28 16:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-24 22:31 [PATCH] configure: Fix default -O2 being added when CFLAGS not set Glenn Washburn
2022-03-25  6:53 ` Paul Menzel
2022-03-28 16:14   ` Glenn Washburn
2022-03-25 15:54 ` Robbie Harwood
2022-03-28 15:53   ` Glenn Washburn

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.