configure.in change

samba-technical at thewrittenword.com samba-technical at thewrittenword.com
Tue Apr 10 22:44:50 GMT 2001


On Thu, Apr 05, 2001 at 07:22:37PM -0700, Herb Lewis wrote:
> This is what I propose for configure.in (and configure)
> 
> Without --enable-debug CFLAGS will be set to -O if undefined else
> it will prepend -O to environment CFLAGS. One "drawback" to this
> is if the environment has -g set then you will not "optimize
> by default" as the comment says. Presumably if the environment
> was set, this is what you wanted anyway. This way you only get
> the -O duplicated instead of the entire CFLAGS environment
> (assuming -O was in CFLAGS). The alternative would be to make
> the first definition CFLAGS=${CFLAGS-"-O"} which would not
> duplicate anything but also would not guarantee -O would be in
> CFLAGS.
> 
> With --enable-debug CFLAGS will be set to -g if undefined else
> it will have -g appended to the end of its environment definition.
> -g typically overrides any -O setting and since it is last it will
> override any -g[n] settings as well (at least with IRIX compilers).
> 
> Does anyone see any problems with this change? I assume this is 
> what was originally intended by the change to configure.in file
> but it was not tested with CFLAGS environment set.
> 
> Index: configure.in
> ===================================================================
> RCS file: /data/cvs/samba/source/configure.in,v
> retrieving revision 1.130.4.22
> diff -u -r1.130.4.22 configure.in
> --- configure.in        2001/04/03 00:34:41     1.130.4.22
> +++ configure.in        2001/04/06 01:53:38
> @@ -108,14 +108,14 @@
>  AC_SUBST(SHLIBEXT)
>  
>  # compile with optimization and without debugging by default
> -OPTIM=${CFLAGS-"-O"}
> +CFLAGS="-O ${CFLAGS}"
>  
>  AC_ARG_ENABLE(debug, [  --enable-debug        turn on debugging
> [default=no]],
>      [if eval "test x$enable_debug = xyes"; then
> -       OPTIM="-g"
> +       CFLAGS="${CFLAGS} -g"
>      fi])
>  
> -CFLAGS="${CFLAGS:=} $OPTIM"
> +

Ick! And how does someone compile with -O2? I would recommend leaving
CFLAGS alone if it is set at all:
  test "${CFLAGS+set}" != set && CFLAGS="-O ${CFLAGS}"

-- 
albert chin (china at thewrittenword.com)




More information about the samba-technical mailing list