bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compiler flags in CC test broken


From: Thomas Dickey
Subject: Re: Compiler flags in CC test broken
Date: Wed, 22 Feb 2017 04:20:32 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Feb 22, 2017 at 08:12:25AM +0100, Stian Skjelstad wrote:
> > > The logic in aclocal (CF_CC_ENV_FLAGS) to detect compiler flags in CC and
> > > move them to CFLAGS is broken: the sed uses a greedy .* so will only move
> > > the last option, and any other options are deleted.
> > >
> > > My workaround here is this:
> > >
> > > - cf_flags=`echo "$CC" | sed -e 's/^.*[ ]\(-[^ ]\)/\1/'`
> > > + cf_flags=`echo "$CC" | cut -f2- -d' '`
> >
> > hmm - thanks - I'll have to rethink this (and use a better test-case :-)
> >
> >
> Is grep -o standard across unixes? If so

yes/no - see below
 
> cf_flags=`echo "$CC" |grep -o ' -.*'`
> 
> seems to do the trick, allowing $CC to include multiple start arguments
> before the - options appears

The "-o" option expects an argument, and putting that into $CC would
add a constraint to the assumptions I could make in setting up makefile
rules.

The technical issue is not whether you can put a "-o" option in the command,
but on usage.  Documented/standard usage puts compiler flags in $CFLAGS,
preprocessor flags in $CPPFLAGS, and $CC "should" be the name of the compiler.

With ncurses, the build script relies upon having $CPPFLAGS consistent.
I also use it for ad hoc generating ".i" files for debugging.

A while back, this was not a problem, but some people found it convenient
to put compiler flags needed for 64-bits into $CC (since at the same time,
they'd override the configure script's choice of compiler).  Naturally,
they (or people who cut/paste from those) started putting all of the flags
into one variable...

That was the cause of several bug reports, of course - and the problem
won't go away.  So I get to work around it.

-- 
Thomas E. Dickey <address@hidden>
http://invisible-island.net
ftp://invisible-island.net

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]