Opened 9 years ago

Closed 9 years ago

#789 closed discussion (fixed)

./configure CXXFLAGS="-g -O3"

Reported by: Peter Owned by: Jari Häkkinen
Priority: trivial Milestone: yat 0.12
Component: build Version: 0.11.2
Keywords: Cc:

Description

I configured latest yat with CXXFLAGS="-g -O3" because I want both debug symbols and high level of optimization. To my surprise I noticed that this choice propagated to yat-config and consequently to other projects using yat.

Should we have some automagic to decide what flags go into yat-config and not. Or should we have a separate flag such as `./configure SEPARATE_CXXFLAGS="-g -O3", i.e., let the user decide what goes where?

Change History (6)

comment:1 Changed 9 years ago by Jari Häkkinen

The default behaviour could be the current behaviour and if the package installer decides to use SEPARATE then the supplied flags should be used.

comment:2 Changed 9 years ago by Peter

I'm confused. The current behaviour is:

./configure

CXXFLAGS is set to "-O3" in Makefiles and yat-config --cxxflags is empty.

./configure CXXFLAGS="-g -O3"

CXXFLAGS is set to "-g -O3" in Makefiles and yat-config --cxxflags is "-g -O3". Or in English: configure variable CXXFLAGS can be used to set both compiler flags in Makefiles and what is returned from yat-config --cxxflags. The default for the former is "-O3" but for the latter "". I find that confusing too.

comment:3 Changed 9 years ago by Peter

We have the following code in configure.ac:

  AS_IF([test x$CXXFLAGS_set_by_user != xyes], [
    YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS],[-O3])
  ])

which says that if user has not provided a CXXFLAGS, so is INTERNAL_CXXFLAGS set to our default value "-O3". I think an improvement would be that if user has provided CXXFLAGS we should shuffle flags that match -g or -O*.

comment:4 Changed 9 years ago by Peter

Playing with CXXFLAGS - I don't know - have the feeling it will boomerang back and hit us from behind. Another idea is to use INTERNAL_CXXFLAGS which is closer to initial suggestion and perhaps what jari suggested.

If user sets INTERNAL_CXXFLAGS it should be detected so we do not set CXXFLAGS to default value but let it be empty.

comment:5 Changed 9 years ago by Peter

Milestone: yat 0.x+yat 0.12

comment:6 Changed 9 years ago by Peter

Resolution: fixed
Status: newclosed

(In [3214]) fixes #789. Change behavious of configure so that if INTERNAL_CXXFLAGS is set e.g. via ./configure INTERNAL_CXXFLAGS=shaboom, default value of CXXFLAGS is not set but it is left empty. Also make INTERNAL_CXXFLAGS (and friends) precious, which means that appear in output of ./configure --help and their value is remembered so when ./config.status --recheck is issued (typically via Make rule) the value INTERNAL_* variable are set as in previous configuration."

Note: See TracTickets for help on using tickets.