cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: ./configure --enable-optimize

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 28 May 2014 00:38:29 +0200 (CEST)

On Sun, 25 May 2014, wrote:

> Autoconf provides sufficient mechanisms to pass (optimizing) options to the
> compiler. One such option is via /usr/local/etc/config.site, which on my
> system contains:
>
> export CFLAGS='-pipe -O2 -Wl,-S -Wl,--hash-style=gnu -Wl,-O1 -Wl,-z,relro
> -Wall -Wextra'

Yes, configure allows you to set flags in CFLAGS and it'll use them. Our
configure should acknowledge and use that when provided. Doesn't it do that
fine already?

Such a config.site file is however not that common.

> In all cases, the person running ./configure has enough possibilities to
> influence how the compiler is called, provided he knows what options he want
> to pass to the compiler and is confident with autoconf.

Yes that's perfectly true.

> If this conditions are not met, it is unlikely that
> curl/m4/curl-compilers.m4 will guess the right options for the compiler, and
> it is unlikely that the person compiling curl will notice, that cURL is not
> optimized by the compiler.

Your assumption that the amount of people who are "confident with autoconf" or
even pass in custom values in LDFLAGS or whatever is particularly large does
not match my experience. In my experience, autoconf and configure are not
generally well understood and they're often not used correctly

> That said, I recommend complete removal of the --enable-optimize ./configure
> option and all compiler specific tweaks.

I don't think it hurts and it might help.

> The idea behind GNU Autoconf is to not put any compiler specific stuff in
> the Autoconf files, autoconf provides enough facilities for the called to
> tweak at ./configure time what he wants.

I disagree with both these statements.

Autoconf is used to detect local specifics to make sure the build process runs
smoothly. That can very well and will often include compiler specific fun.
You'll find numerous standard autoconf macros that do such things.

I also don't think that it "provides enough facilities" for an ordinary user
to know what to do at run-time to really polish the build. Many users don't
know for example what the best optimizer options are and autoconf offers no
clues at all to allow anyone to figure out those things.

-- 
  / daniel.haxx.se

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-05-28