[sr #110360] AC_CANONICAL_HOST sets wrong $host_cpu on Raspberry Pi 3

Zack Weinberg <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.bugs
Message-ID <[email protected]>
Follow-up Comment #9, sr #110360 (project autoconf):

I looked over spinhawk/configure.ac and I can now say with confidence that you
shouldn't override $host_cpu.  "armv7l" is *not* incorrect, just not
recognized as a -march= argument by GCC; changing it to start with "cortex"
will cause a whole bunch of "case $host_cpu in" blocks later in the configure
script to make the wrong choice.

I think the *proper* fix is for the code that sets $hc_cv_optimization_flags
(e.g. https://github.com/rbowler/spinhawk/blob/master/configure.ac#L1909)...


    case "$host_cpu-$GCC" in
...
        xscale-yes|arm*-yes)

            hc_cv_is_intel_x86_arch=no
            hc_cv_optimization_flags="$hc_cv_optimization_flags
-mcpu=$host_cpu -mtune=$host_cpu -frename-registers"
            ;;


to become aware that the value of $host_cpu is *not* necessarily usable as the
argument to either -mcpu= or -mtune=.  What I would recommend is for this
entire mess to be replaced with `-O2 -march=native -mtune=native` in native
compilation.  Cross compilation could continue to use $host_cpu as the
default, but a command-line option should be added (using AC_ARG_WITH) that
lets people set it to whatever specific thing they want.

I think this is not a bug in autoconf or automake, and should be re-filed as a
bug on spinhawk.  Viktor, it's probably best if you do that, but feel free to
cc: me on it (my Github handle is @zackw).

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/support/?110360>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.