diff options
Diffstat (limited to 'autosetup')
-rwxr-xr-x | autosetup/autosetup | 33 | ||||
-rw-r--r-- | autosetup/cc-shared.tcl | 9 | ||||
-rw-r--r-- | autosetup/cc.tcl | 16 |
3 files changed, 43 insertions, 15 deletions
diff --git a/autosetup/autosetup b/autosetup/autosetup index 85c61ca..18c4218 100755 --- a/autosetup/autosetup +++ b/autosetup/autosetup @@ -927,7 +927,7 @@ proc use {args} { # Load module source in the global scope by executing the given command proc automf_load {args} { if {[catch [list uplevel #0 $args] msg opts] ni {0 2 3}} { - autosetup-full-error [error-dump $msg $opts] + autosetup-full-error [error-dump $msg $opts $::autosetup(debug)] } } @@ -1708,14 +1708,31 @@ proc error-stacktrace {msg} { # Given the return from [catch {...} msg opts], returns an appropriate # error message. A nice one for Jim and a less-nice one for Tcl. +# If 'fulltrace' is set, a full stack trace is provided. +# Otherwise a simple message is provided. # -# This is designed for developer errors, e.g. in module code +# This is designed for developer errors, e.g. in module code or auto.def code # -proc error-dump {msg opts} { +# +proc error-dump {msg opts fulltrace} { if {$::autosetup(istcl)} { - return "Error: [dict get $opts -errorinfo]" + if {$fulltrace} { + return "Error: [dict get $opts -errorinfo]" + } else { + return "Error: $msg" + } } else { - return "Error: $msg\n[stackdump $opts(-errorinfo)]" + lassign $opts(-errorinfo) p f l + if {$f ne ""} { + set result "$f:$l: Error: " + } + append result "$msg\n" + if {$fulltrace} { + append result [stackdump $opts(-errorinfo)] + } + + # Remove the trailing newline + string trim $result } } } @@ -1888,10 +1905,10 @@ proc defn {first args} { if {$autosetup(debug)} { main $argv } -if {[catch {main $argv} msg] == 1} { +if {[catch {main $argv} msg opts] == 1} { show-notices - puts stderr [error-stacktrace $msg] - if {!$autosetup(debug) && !$autosetup(istcl)} { + autosetup-full-error [error-dump $msg $opts $::autosetup(debug)] + if {!$autosetup(debug)} { puts stderr "Try: '[file tail $autosetup(exe)] --debug' for a full stack trace" } exit 1 diff --git a/autosetup/cc-shared.tcl b/autosetup/cc-shared.tcl index b9ae29d..6cfcb50 100644 --- a/autosetup/cc-shared.tcl +++ b/autosetup/cc-shared.tcl @@ -96,6 +96,15 @@ switch -glob -- [get-define host] { define SH_LINKFLAGS -Wl,+s define LD_LIBRARY_PATH SHLIB_PATH } + *-*-haiku { + define SHOBJ_CFLAGS "" + define SHOBJ_LDFLAGS -shared + define SH_CFLAGS "" + define SH_LDFLAGS -shared + define SH_LINKFLAGS "" + define SH_SOPREFIX "" + define LD_LIBRARY_PATH LIBRARY_PATH + } } if {![is-defined SHOBJ_LDFLAGS_R]} { diff --git a/autosetup/cc.tcl b/autosetup/cc.tcl index cd033c6..bbe7989 100644 --- a/autosetup/cc.tcl +++ b/autosetup/cc.tcl @@ -335,7 +335,7 @@ proc cc-add-settings {settings} { # Note that new libraries are added before previous libraries set new($name) [list {*}$value {*}$new($name)] } - -link - -lang { + -link - -lang - -nooutput { set new($name) $value } -source - -sourcefile - -code { @@ -430,6 +430,7 @@ proc cc-with {settings args} { ## -code code Code to compile in the body of main() ## -source code Compile a complete program. Ignore -includes, -declare and -code ## -sourcefile file Shorthand for -source [readfile [get-define srcdir]/$file] +## -nooutput 1 Treat any compiler output (e.g. a warning) as an error # # Unless -source or -sourcefile is specified, the C program looks like: # @@ -523,7 +524,8 @@ proc cctest {args} { writefile $src $lines\n set ok 1 - if {[catch {exec-with-stderr {*}$cmdline} result errinfo]} { + set err [catch {exec-with-stderr {*}$cmdline} result errinfo] + if {$err || ($opts(-nooutput) && [string length $result])} { configlog "Failed: [join $cmdline]" configlog $result configlog "============" @@ -673,7 +675,7 @@ if {[get-define CC] eq ""} { define CCACHE [find-an-executable [get-env CCACHE ccache]] # Initial cctest settings -cc-store-settings {-cflags {} -includes {} -declare {} -link 0 -lang c -libs {} -code {}} +cc-store-settings {-cflags {} -includes {} -declare {} -link 0 -lang c -libs {} -code {} -nooutput 0} set autosetup(cc-include-deps) {} msg-result "C compiler...[get-define CCACHE] [get-define CC] [get-define CFLAGS]" @@ -682,12 +684,12 @@ if {[get-define CXX] ne "false"} { } msg-result "Build C compiler...[get-define CC_FOR_BUILD]" -# On Darwin, we prefer to use -gstabs to avoid creating .dSYM directories -# but some compilers don't support -gstabs, so test for it here. +# On Darwin, we prefer to use -g0 to avoid creating .dSYM directories +# but some compilers may not support it, so test here. switch -glob -- [get-define host] { *-*-darwin* { - if {[cctest -cflags {-gstabs}]} { - define cc-default-debug -gstabs + if {[cctest -cflags {-g0}]} { + define cc-default-debug -g0 } } } |