Opened 13 years ago

Closed 13 years ago

#333 closed task (fixed)

Do not set CPPFLAGS, CXXFLAGS, and LDFLAGS in configure

Reported by: Peter Johansson Owned by: Peter Johansson
Priority: major Milestone: svndigest 0.7
Component: build Version: trunk
Keywords: Cc:

Description (last modified by Peter Johansson)

Setting CPPFLAGS, CXXFLAGS, and LDFLAGS in configure is bad style.

See for example Automake manual 27.6.1 in which they suggest:

You should not add options to these user variables within configure either, for the same reason. Occasionally you need to modify these variables to perform a test, but you should reset their values afterwards. In contrast, it is OK to modify the ‘AM_’ variables within configure if you AC_SUBST them, but it is rather rare that you need to do this, unless you really want to change the default definitions of the ‘AM_’ variables in all Makefiles.

I suggest the following structure (I use CPPFLAGS here as an example; the same structure could be used for other flags as well):

  1. Save flag given by user - CPPFLAGS_SAVE = CPPFLAGS
  2. Set SD_CPPFLAGS depending on --enable-debug, --with-apr, and --with-svn
  3. Set CPPFLAGS = SD_CPPFLAGS CPPFLAGS
  4. Perform tests
  5. export SD_CPPFLAGS using AC_SUBST
  6. reset CPPFLAGS to CPPFLAGS_SAVE
  7. AC_OUTPUT

The major change is that we need to split up chunks such as APR stuff, because some part belong in 2) and some parts belong in 4).

Change History (2)

comment:1 Changed 13 years ago by Peter Johansson

Description: modified (diff)

comment:2 Changed 13 years ago by Peter Johansson

Resolution: fixed
Status: newclosed

fixed in [640]

Note: See TracTickets for help on using tickets.