aboutsummaryrefslogtreecommitdiff
path: root/autosetup/cc-lib.tcl
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2017-04-22 20:30:59 +1000
committerSteve Bennett <steveb@workware.net.au>2017-04-22 20:31:22 +1000
commit31a9f433f06b8cc426d281436a628a5fdd3bf755 (patch)
tree42ebfbbcc964f60a8432b3b42f2880db44926287 /autosetup/cc-lib.tcl
parenta9c149f459c9711ce5e36efa7f4eca1fe57622d9 (diff)
downloadjimtcl-31a9f433f06b8cc426d281436a628a5fdd3bf755.zip
jimtcl-31a9f433f06b8cc426d281436a628a5fdd3bf755.tar.gz
jimtcl-31a9f433f06b8cc426d281436a628a5fdd3bf755.tar.bz2
build: Update autosetup to v0.6.6-8-g062d650
Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'autosetup/cc-lib.tcl')
-rw-r--r--autosetup/cc-lib.tcl150
1 files changed, 74 insertions, 76 deletions
diff --git a/autosetup/cc-lib.tcl b/autosetup/cc-lib.tcl
index 1ef7c63..c4b45bc 100644
--- a/autosetup/cc-lib.tcl
+++ b/autosetup/cc-lib.tcl
@@ -11,7 +11,7 @@ module-options {}
# @cc-check-lfs
#
-# The equivalent of the AC_SYS_LARGEFILE macro
+# The equivalent of the 'AC_SYS_LARGEFILE' macro.
#
# defines 'HAVE_LFS' if LFS is available,
# and defines '_FILE_OFFSET_BITS=64' if necessary
@@ -37,7 +37,7 @@ proc cc-check-lfs {} {
# @cc-check-endian
#
-# The equivalent of the AC_C_BIGENDIAN macro
+# The equivalent of the 'AC_C_BIGENDIAN' macro.
#
# defines 'HAVE_BIG_ENDIAN' if endian is known to be big,
# or 'HAVE_LITTLE_ENDIAN' if endian is known to be little.
@@ -82,34 +82,34 @@ proc cc-check-endian {} {
# names prefixed with 'HAVE_CFLAG' and 'HAVE_CXXFLAG' respectively, and
# appends working flags to '-cflags' and 'CFLAGS' or 'CXXFLAGS'.
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 ${prefix}S $flag
- } else {
- msg-result no
- set result 0
- }
- }
- return $result
+ 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 ${prefix}S $flag
+ } else {
+ msg-result no
+ set result 0
+ }
+ }
+ return $result
}
# @cc-check-standards ver ?...?
@@ -118,26 +118,24 @@ proc cc-check-flags {args} {
# options, and appends the first working one to '-cflags' and 'CFLAGS' or
# 'CXXFLAGS'.
proc cc-check-standards {args} {
- array set opts [cc-get-settings]
- foreach std $args {
- if {[cc-check-flags -std=$std]} {
- return $std
- }
- }
- return ""
+ array set opts [cc-get-settings]
+ foreach std $args {
+ if {[cc-check-flags -std=$std]} {
+ return $std
+ }
+ }
+ return ""
}
# Checks whether $keyword is usable as alignof
proc cctest_alignof {keyword} {
- msg-checking "Checking for $keyword..."
- if {[cctest -code [subst -nobackslashes {
- printf("minimum alignment is %d == %d\n", ${keyword}(char), ${keyword}('x'));
- }]]} then {
- msg-result ok
- define-feature $keyword
- } else {
- msg-result "not found"
- }
+ 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"
+ }
}
# @cc-check-c11
@@ -145,47 +143,47 @@ proc cctest_alignof {keyword} {
# Checks for several C11/C++11 extensions and their alternatives. Currently
# checks for '_Static_assert', '_Alignof', '__alignof__', '__alignof'.
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"
- }
+ 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
+ cctest_alignof _Alignof
+ cctest_alignof __alignof__
+ cctest_alignof __alignof
}
# @cc-check-alloca
#
-# The equivalent of the AC_FUNC_ALLOCA macro
+# The equivalent of the 'AC_FUNC_ALLOCA' macro.
#
-# Checks for the existence of alloca
-# defines HAVE_ALLOCA and returns 1 if it exists
+# Checks for the existence of 'alloca'
+# defines 'HAVE_ALLOCA' and returns 1 if it exists.
proc cc-check-alloca {} {
- cc-check-some-feature alloca {
- cctest -includes alloca.h -code { alloca (2 * sizeof (int)); }
- }
+ cc-check-some-feature alloca {
+ cctest -includes alloca.h -code { alloca (2 * sizeof (int)); }
+ }
}
# @cc-signal-return-type
#
-# The equivalent of the AC_TYPE_SIGNAL macro
+# The equivalent of the 'AC_TYPE_SIGNAL' macro.
#
-# defines RETSIGTYPE to int or void
+# defines 'RETSIGTYPE' to 'int' or 'void'.
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
- }
+ 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
+ }
}