automake issue
Corinna Vinschen
corinna-cygwin@cygwin.com
Thu Oct 21 10:48:38 GMT 2021
On Oct 20 16:58, Ken Brown wrote:
> I was debugging with what I thought was an unoptimized build of cygwin1.dll
> (with -O0 in CXXFLAGS), but then I discovered that malloc.cc was actually
> compiled with -O3. This is because of the following snippet from
> winsup/cygwin/Makefile.am:
>
> # If an optimization level is explicitly set in CXXFLAGS, set -O3 for these files
> # XXX: this seems to assume it's not -O0?
> #
> # (the indentation here prevents automake trying to process this as an automake
> # conditional)
> ifneq "${filter -O%,$(CXXFLAGS)}" ""
> malloc_CFLAGS=-O3
> sync_CFLAGS=-O3
> endif
>
> I thought I could fix this by changing the snippet to
>
> ifneq "${filter -O%,$(CXXFLAGS)}" ""
> ifeq "${filter -O0,$(CXXFLAGS)}" ""
> malloc_CFLAGS=-O3
> sync_CFLAGS=-O3
> endif
> endif
>
> but this didn't work. After running winsup/autogen.sh,
> winsup/cygwin/Makefile.in contained
>
> malloc_CFLAGS = -O3
> sync_CFLAGS = -O3
>
> unconditionally.
>
> So in spite of the comment above about indentation, it seems that the
> conditional is being treated as an automake conditional.
>
> Does anyone know how to fix this so that -O0 really produces an unoptimized build?
I workaround this by setting CFLAGS=-g on the command line. There's no
-O then and it should work as desired. The save thing would probably
be something like this, though:
https://stackoverflow.com/questions/4256609/makefile-conditional-with-automake-autoconf
Corinna
More information about the Cygwin-developers
mailing list