1diff -cr a/autosetup/autosetup-find-tclsh b/autosetup/autosetup-find-tclsh 2*** a/autosetup/autosetup-find-tclsh 2019-02-02 03:13:40.000000000 +0100 3--- b/autosetup/autosetup-find-tclsh 2019-02-02 03:11:58.000000000 +0100 4*************** 5*** 5,15 **** 6 d=`dirname "$0"` 7 { "$d/jimsh0" "$d/autosetup-test-tclsh"; } 2>/dev/null && exit 0 8 PATH="$PATH:$d"; export PATH 9! for tclsh in $autosetup_tclsh jimsh tclsh tclsh8.5 tclsh8.6; do 10! { $tclsh "$d/autosetup-test-tclsh"; } 2>/dev/null && exit 0 11! done 12! echo 1>&2 "No installed jimsh or tclsh, building local bootstrap jimsh0" 13! for cc in ${CC_FOR_BUILD:-cc} gcc; do 14 { $cc -o "$d/jimsh0" "$d/jimsh0.c"; } 2>/dev/null || continue 15 "$d/jimsh0" "$d/autosetup-test-tclsh" && exit 0 16 done 17--- 5,12 ---- 18 d=`dirname "$0"` 19 { "$d/jimsh0" "$d/autosetup-test-tclsh"; } 2>/dev/null && exit 0 20 PATH="$PATH:$d"; export PATH 21! echo "Bootstrapping standalone Tcl interpreter" 1>&2 22! for cc in ${CC_FOR_BUILD} gcc clang cc; do 23 { $cc -o "$d/jimsh0" "$d/jimsh0.c"; } 2>/dev/null || continue 24 "$d/jimsh0" "$d/autosetup-test-tclsh" && exit 0 25 done 26diff -cr a/autosetup/cc.tcl b/autosetup/cc.tcl 27*** a/autosetup/cc.tcl 2019-02-02 03:13:40.000000000 +0100 28--- b/autosetup/cc.tcl 2019-02-02 03:11:58.000000000 +0100 29*************** 30*** 262,276 **** 31 # 32 proc cc-check-tools {args} { 33 foreach tool $args { 34 set TOOL [string toupper $tool] 35 set exe [get-env $TOOL [get-define cross]$tool] 36 if {[find-executable {*}$exe]} { 37 define $TOOL $exe 38 continue 39 } 40 if {[find-executable {*}$tool]} { 41- msg-result "Warning: Failed to find $exe, falling back to $tool which may be incorrect" 42 define $TOOL $tool 43 continue 44 } 45 user-error "Failed to find $exe" 46--- 262,279 ---- 47 # 48 proc cc-check-tools {args} { 49 foreach tool $args { 50+ msg-checking "Checking for $tool..." 51 set TOOL [string toupper $tool] 52 set exe [get-env $TOOL [get-define cross]$tool] 53 if {[find-executable {*}$exe]} { 54 define $TOOL $exe 55+ msg-result $exe 56 continue 57 } 58 if {[find-executable {*}$tool]} { 59 define $TOOL $tool 60+ msg-result $tool 61+ msg-result "Warning: Failed to find $exe, falling back to $tool which may be incorrect" 62 continue 63 } 64 user-error "Failed to find $exe" 65*************** 66*** 505,511 **** 67 68 # Build the command line 69 set cmdline {} 70- lappend cmdline {*}[get-define CCACHE] 71 switch -exact -- $opts(-lang) { 72 c++ { 73 lappend cmdline {*}[get-define CXX] {*}[get-define CXXFLAGS] 74--- 508,513 ---- 75*************** 76*** 659,665 **** 77 } 78 79 # Initialise some values from the environment or commandline or default settings 80! foreach i {LDFLAGS LIBS CPPFLAGS LINKFLAGS {CFLAGS "-g -O2"}} { 81 lassign $i var default 82 define $var [get-env $var $default] 83 } 84--- 661,667 ---- 85 } 86 87 # Initialise some values from the environment or commandline or default settings 88! foreach i {LDFLAGS LIBS CPPFLAGS LINKFLAGS CFLAGS} { 89 lassign $i var default 90 define $var [get-env $var $default] 91 } 92*************** 93*** 669,675 **** 94 set try [list [get-env CC ""]] 95 } else { 96 # Try some reasonable options 97! set try [list [get-define cross]cc [get-define cross]gcc] 98 } 99 define CC [find-an-executable {*}$try] 100 if {[get-define CC] eq ""} { 101--- 671,677 ---- 102 set try [list [get-env CC ""]] 103 } else { 104 # Try some reasonable options 105! set try [list [get-define cross]gcc [get-define cross]clang [get-define cross]cc] 106 } 107 define CC [find-an-executable {*}$try] 108 if {[get-define CC] eq ""} { 109*************** 110*** 683,696 **** 111 if {[env-is-set CXX]} { 112 define CXX [find-an-executable -required [get-env CXX ""]] 113 } else { 114! define CXX [find-an-executable [get-define cross]c++ [get-define cross]g++ false] 115 } 116 117 # CXXFLAGS default to CFLAGS if not specified 118 define CXXFLAGS [get-env CXXFLAGS [get-define CFLAGS]] 119 120 # May need a CC_FOR_BUILD, so look for one 121! define CC_FOR_BUILD [find-an-executable [get-env CC_FOR_BUILD ""] cc gcc false] 122 123 if {[get-define CC] eq ""} { 124 user-error "Could not find a C compiler. Tried: [join $try ", "]" 125--- 685,698 ---- 126 if {[env-is-set CXX]} { 127 define CXX [find-an-executable -required [get-env CXX ""]] 128 } else { 129! define CXX [find-an-executable [get-define cross]g++ [get-define cross]clang++ [get-define cross]c++ false] 130 } 131 132 # CXXFLAGS default to CFLAGS if not specified 133 define CXXFLAGS [get-env CXXFLAGS [get-define CFLAGS]] 134 135 # May need a CC_FOR_BUILD, so look for one 136! define CC_FOR_BUILD [find-an-executable [get-env CC_FOR_BUILD ""] gcc clang cc false] 137 138 if {[get-define CC] eq ""} { 139 user-error "Could not find a C compiler. Tried: [join $try ", "]" 140*************** 141*** 711,719 **** 142 cc-store-settings {-cflags {} -includes {} -declare {} -link 0 -lang c -libs {} -code {} -nooutput 0} 143 set autosetup(cc-include-deps) {} 144 145! msg-result "C compiler...[get-define CCACHE] [get-define CC] [get-define CFLAGS]" 146 if {[get-define CXX] ne "false"} { 147! msg-result "C++ compiler...[get-define CCACHE] [get-define CXX] [get-define CXXFLAGS]" 148 } 149 msg-result "Build C compiler...[get-define CC_FOR_BUILD]" 150 151--- 713,721 ---- 152 cc-store-settings {-cflags {} -includes {} -declare {} -link 0 -lang c -libs {} -code {} -nooutput 0} 153 set autosetup(cc-include-deps) {} 154 155! msg-result "C compiler...[get-define CC] [get-define CFLAGS]" 156 if {[get-define CXX] ne "false"} { 157! msg-result "C++ compiler...[get-define CXX] [get-define CXXFLAGS]" 158 } 159 msg-result "Build C compiler...[get-define CC_FOR_BUILD]" 160 161