[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Setting optimizations without violating autotools principles
From: |
Chris Stankevitz |
Subject: |
Re: Setting optimizations without violating autotools principles |
Date: |
Thu, 7 Jul 2011 19:22:41 -0700 (PDT) |
--- On Thu, 7/7/11, Ralf Wildenhues <address@hidden> wrote:
> From: Ralf Wildenhues <address@hidden>
> # Override CFLAGS if not set by the user.
> test ${CFLAGS+set} = set || CFLAGS=-O0
Ralf,
Thank you. I believe your method does not work when the user has set CFLAGS to
something that has nothing to do with optimizations (e.g. CFLAGS=-I/foo/bar).
Would you please comment on the solution I came up with:
In configure.ac:
CFLAGS_ORIG=${CFLAGS}
AC_PROG_CC
CFLAGS=${CFLAGS_ORIG}
In Makefile.am:
if DEBUG
AM_CFLAGS = -g3 -O0
endif
I believe my approach
1. Allows the user full control via the sacred CFLAGS
2. Does not touch, mutate, or alter the user's sacred CFLAGS
3. Works despite AC_PROG_CC mucking around with CFLAGS
4. Works even when the user specifies CFLAGS that do not change the
optimization level
Thank you all for your help,
Chris