Mailinglist Archive: opensuse (3666 mails)

< Previous Next >
Re: What is the proper way to optimize compilations?
  • From: Philipp Thomas <pth-listonly@xxxxxxx>
  • Date: Mon, 14 Mar 2005 13:33:01 +0100
  • Message-id: <20050314123301.GH16679@xxxxxxxxxxxxxxxx>
* Carlos E. R. (robin1.listas@xxxxxxxxxx) [20050313 13:58]:

> I have a P-IV, and when I compile something I like to have it optimized
> for my cpu.

> System types:
> --build=BUILD configure for building on BUILD [guessed]
> --host=HOST cross-compile to build programs to run on HOST [BUILD]
> --target=TARGET configure for building compilers for TARGET [HOST]

> I'm not sure which one should I use, to get output compiled for the
> pentium4.

See

info '(autoconf)Canonicalizing'

for an explanation.

But that won't get you anywhere unless the configure script has support for
setting compiler options based on processor. BTW, run config.guess to see
what configure will use as target tripple if you don't pass one explicitly.

>
> pentiumpro-* | pentium2-* | i686-*)
> archopt_val="pentiumpro"
> #Cer hack,
> archopt_val="pentium4"
>
> So now I'm getting:
>
> CFLAGS = -mcpu=pentium4 -O3 -march=pentium4 -pipe -fomit-frame-pointer ...
>
> It is a hack, and I have to remember it is there the next time I download
> a new version. I don't like it, although it produces the expected result.
>
> Can you suggest a better, and general, method?

There isn't a general method as most software do not provide a means other
then CFLAGS/CXXFLAGS. But if the package doesn't provide a way to add your
own CFLAGS/CXXFLAGS, you'll have to hack configure.in and/or Makefile.am to
get what you want.

BTW, if a package doesn't ignore passed in values and adds its own
optimization flags via a different make variable, this should work:

export CFLAGS="-march=pentium4 -mcpu=pentium4"
./configure

Philipp

--
Philipp Thomas <pth <at> suse.de>
Research & Development
SUSE LINUX Products GmbH, Maxfeldstr. 5, D-90409 Nuremberg, Germany

< Previous Next >
Follow Ups
References