|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use cc |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
proc cc-check-lfs {} { |
|
|
cc-check-includes sys/types.h |
|
|
msg-checking "Checking if -D_FILE_OFFSET_BITS=64 is needed..." |
|
|
set lfs 1 |
|
|
if {[msg-quiet cc-with {-includes sys/types.h} {cc-check-sizeof off_t}] == 8} { |
|
|
msg-result no |
|
|
} elseif {[msg-quiet cc-with {-includes sys/types.h -cflags -D_FILE_OFFSET_BITS=64} {cc-check-sizeof off_t}] == 8} { |
|
|
define _FILE_OFFSET_BITS 64 |
|
|
msg-result yes |
|
|
} else { |
|
|
set lfs 0 |
|
|
msg-result none |
|
|
} |
|
|
define-feature lfs $lfs |
|
|
return $lfs |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
proc cc-check-endian {} { |
|
|
cc-check-includes sys/types.h sys/param.h |
|
|
set rc 0 |
|
|
msg-checking "Checking endian..." |
|
|
cc-with {-includes {sys/types.h sys/param.h}} { |
|
|
if {[cctest -code { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}]} { |
|
|
define-feature big-endian |
|
|
msg-result "big" |
|
|
set rc 1 |
|
|
} elseif {[cctest -code { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}]} { |
|
|
define-feature little-endian |
|
|
msg-result "little" |
|
|
set rc 1 |
|
|
} else { |
|
|
msg-result "unknown" |
|
|
} |
|
|
} |
|
|
return $rc |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
proc cc-check-flags {args} { |
|
|
set result 1 |
|
|
array set opts [cc-get-settings] |
|
|
switch -exact -- $opts(-lang) { |
|
|
c++ { |
|
|
set lang C++ |
|
|
set prefix CXXFLAG |
|
|
} |
|
|
c { |
|
|
set lang C |
|
|
set prefix CFLAG |
|
|
} |
|
|
default { |
|
|
autosetup-error "cc-check-flags failed with unknown language: $opts(-lang)" |
|
|
} |
|
|
} |
|
|
foreach flag $args { |
|
|
msg-checking "Checking whether the $lang compiler accepts $flag..." |
|
|
if {[cctest -cflags $flag]} { |
|
|
msg-result yes |
|
|
define-feature $prefix$flag |
|
|
cc-with [list -cflags [list $flag]] |
|
|
define-append AS_${prefix}S $flag |
|
|
} else { |
|
|
msg-result no |
|
|
set result 0 |
|
|
} |
|
|
} |
|
|
return $result |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
proc cc-check-standards {args} { |
|
|
array set opts [cc-get-settings] |
|
|
foreach std $args { |
|
|
if {[cc-check-flags -std=$std]} { |
|
|
return $std |
|
|
} |
|
|
} |
|
|
return "" |
|
|
} |
|
|
|
|
|
|
|
|
proc cctest_alignof {keyword} { |
|
|
msg-checking "Checking for $keyword..." |
|
|
if {[cctest -code "int x = ${keyword}(char), y = ${keyword}('x');"]} then { |
|
|
msg-result ok |
|
|
define-feature $keyword |
|
|
} else { |
|
|
msg-result "not found" |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
proc cc-check-c11 {} { |
|
|
msg-checking "Checking for _Static_assert..." |
|
|
if {[cctest -code { |
|
|
_Static_assert(1, "static assertions are available"); |
|
|
}]} then { |
|
|
msg-result ok |
|
|
define-feature _Static_assert |
|
|
} else { |
|
|
msg-result "not found" |
|
|
} |
|
|
|
|
|
cctest_alignof _Alignof |
|
|
cctest_alignof __alignof__ |
|
|
cctest_alignof __alignof |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
proc cc-check-alloca {} { |
|
|
cc-check-some-feature alloca { |
|
|
cctest -includes alloca.h -code { alloca (2 * sizeof (int)); } |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
proc cc-signal-return-type {} { |
|
|
msg-checking "Checking return type of signal handlers..." |
|
|
cc-with {-includes {sys/types.h signal.h}} { |
|
|
if {[cctest -code {return *(signal (0, 0)) (0) == 1;}]} { |
|
|
set type int |
|
|
} else { |
|
|
set type void |
|
|
} |
|
|
define RETSIGTYPE $type |
|
|
msg-result $type |
|
|
} |
|
|
} |
|
|
|