build: Oops, have configure honor --host.

This allows

    ./configure --host=i686-unknown-linux-gnu

instead of

    CC=i686-unknown-linux-gnu-gcc ./configure

* configure (main): Honor --host.
This commit is contained in:
Jan Nieuwenhuizen 2019-12-08 15:48:27 +01:00
parent 65e223ff9b
commit 350fa7f0de
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273

11
configure vendored
View file

@ -442,7 +442,8 @@ Some influential environment variables:
mes-seed)) mes-seed))
(tinycc-prefix (or (getenv "TINYCC_PREFIX") (tinycc-prefix (or (getenv "TINYCC_PREFIX")
(string-append srcdest "../tinycc-prefix"))) (string-append srcdest "../tinycc-prefix")))
(gcc (or (getenv "CC") "gcc")) (cross? (not (equal? host-type build-type)))
(gcc (or (getenv "CC") (if cross? (string-append host-type "-" "gcc") "gcc")))
(tcc (or (getenv "TCC") "tcc")) (tcc (or (getenv "TCC") "tcc"))
(mescc (or (getenv "MESCC") "mescc")) (mescc (or (getenv "MESCC") "mescc"))
(deps (fold (lambda (program results) (deps (fold (lambda (program results)
@ -510,9 +511,9 @@ Some influential environment variables:
deps) deps)
deps)) deps))
(system-libc? (and with-system-libc? (file-name "if cc can create executables" deps))) (system-libc? (and with-system-libc? (file-name "if cc can create executables" deps)))
(build-type (or (and cc (gulp-pipe* cc "-dumpmachine")) build-type)) (host-type (or (and cc (gulp-pipe* cc "-dumpmachine")) host-type))
(build-type-list (string-split build-type #\-)) (host-type-list (string-split host-type #\-))
(mes-cpu (car build-type-list)) (mes-cpu (car host-type-list))
(mes-cpu (cond ((member mes-cpu '("i386" "i486" "i586" "i686")) "x86") (mes-cpu (cond ((member mes-cpu '("i386" "i486" "i586" "i686")) "x86")
((member mes-cpu '("arm" "armv4" "armv7l")) "arm") ((member mes-cpu '("arm" "armv4" "armv7l")) "arm")
(else mes-cpu))) (else mes-cpu)))
@ -520,7 +521,7 @@ Some influential environment variables:
"32")) "32"))
(mes-libc (if system-libc? "system" "mes")) (mes-libc (if system-libc? "system" "mes"))
(kernel-list (filter (compose not (cut member <> '("pc" "unknown"))) (cdr build-type-list))) (kernel-list (filter (compose not (cut member <> '("pc" "unknown"))) (cdr host-type-list)))
(mes-kernel (cond ((or (equal? '("linux" "gnu") kernel-list) (mes-kernel (cond ((or (equal? '("linux" "gnu") kernel-list)
(equal? "linux" (car kernel-list))) "linux") (equal? "linux" (car kernel-list))) "linux")
((equal? '( "gnu") kernel-list) "gnu") ((equal? '( "gnu") kernel-list) "gnu")