diff options
Diffstat (limited to 'autosetup/cc.tcl')
-rw-r--r-- | autosetup/cc.tcl | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/autosetup/cc.tcl b/autosetup/cc.tcl index 40f2ae1..585d259 100644 --- a/autosetup/cc.tcl +++ b/autosetup/cc.tcl @@ -11,6 +11,7 @@ # ## CC - C compiler ## CXX - C++ compiler +## CPP - C preprocessor ## CCACHE - Set to "none" to disable automatic use of ccache ## CFLAGS - Additional C compiler flags ## CXXFLAGS - Additional C++ compiler flags @@ -465,7 +466,6 @@ proc cc-with {settings args} { # Any failures are recorded in 'config.log' # proc cctest {args} { - set src conftest__.c set tmp conftest__ # Easiest way to merge in the settings @@ -507,9 +507,11 @@ proc cctest {args} { lappend cmdline {*}[get-define CCACHE] switch -exact -- $opts(-lang) { c++ { + set src conftest__.cpp lappend cmdline {*}[get-define CXX] {*}[get-define CXXFLAGS] } c { + set src conftest__.c lappend cmdline {*}[get-define CC] {*}[get-define CFLAGS] } default { @@ -697,6 +699,15 @@ if {[get-define CC] eq ""} { define CCACHE [find-an-executable [get-env CCACHE ccache]] +# If any of these are set in the environment, propagate them to the AUTOREMAKE commandline +foreach i {CC CXX CCACHE CPP CFLAGS CXXFLAGS CXXFLAGS LDFLAGS LIBS CROSS CPPFLAGS LINKFLAGS CC_FOR_BUILD LD} { + if {[env-is-set $i]} { + # Note: If the variable is set on the command line, get-env will return that value + # so the command line will continue to override the environment + define-append AUTOREMAKE [quote-if-needed $i=[get-env $i ""]] + } +} + # Initial cctest settings cc-store-settings {-cflags {} -includes {} -declare {} -link 0 -lang c -libs {} -code {} -nooutput 0} set autosetup(cc-include-deps) {} |