Lines Matching +full:pre +full:- +full:set
12 # ----- @module feature-tests.tcl -----
13 # @section TEA-ish collection of feature tests.
16 # private/internal APIs. Those with a prefix of teaish- are
20 # @teaish-check-libz
23 # prepends -lz to the extension's ldflags and returns 1, else returns
26 proc teaish-check-libz {} {
27 teaish-check-cached "Checking for libz" {
28 set rc 0
29 if {[msg-quiet cc-check-includes zlib.h] && [msg-quiet proj-check-function-in-lib deflate z]} {
30 teaish-ldflags-prepend [define LDFLAGS_LIBZ [get-define lib_deflate]]
38 # @teaish-check-librt ?funclist?
40 # Checks whether -lrt is needed for any of the given functions. If
41 # so, appends -lrt via [teaish-ldflags-prepend] and returns 1, else
45 # Some systems (ex: SunOS) require -lrt in order to use nanosleep.
47 proc teaish-check-librt {{funclist {fdatasync nanosleep}}} {
48 teaish-check-cached -nostatus "Checking whether ($funclist) need librt" {
51 if {[msg-quiet proj-check-function-in-lib $func rt]} {
52 set ldrt [get-define lib_${func}]
55 teaish-ldflags-prepend -r [define LDFLAGS_LIBRT $ldrt]
56 msg-result $ldrt
59 msg-result "no lib needed"
64 msg-result "not found"
69 # @teaish-check-stdint
71 # A thin proxy for [cc-with] which checks for <stdint.h> and the
72 # various fixed-size int types it declares. It defines HAVE_STDINT_T
75 proc teaish-check-stdint {} {
76 teaish-check-cached "Checking for stdint.h" {
77 msg-quiet cc-with {-includes stdint.h} \
78 {cc-check-types int8_t int16_t int32_t int64_t intptr_t \
83 # @teaish-is-mingw
86 proc teaish-is-mingw {} {
88 [string match *mingw* [get-define host]] &&
93 # @teaish-check-libdl
96 # -ldl for linking. If found, returns 1, defines LDFLAGS_DLOPEN to the
98 # teaish-ldflags-prepend. It unconditionally defines HAVE_DLOPEN to 0
100 proc teaish-check-dlopen {} {
101 teaish-check-cached -nostatus "Checking for dlopen()" {
102 set rc 0
103 set lfl ""
104 if {[cc-with {-includes dlfcn.h} {
105 cctest -link 1 -declare "extern char* dlerror(void);" -code "dlerror();"}]} {
106 msg-result "-ldl not needed"
108 } elseif {[cc-check-includes dlfcn.h]} {
110 if {[cc-check-function-in-lib dlopen dl]} {
111 set lfl [get-define lib_dlopen]
113 msg-result " dlopen() needs $lfl"
115 msg-result " - dlopen() not found in libdl. Assuming dlopen() is built-in."
118 msg-result "not found"
120 teaish-ldflags-prepend [define LDFLAGS_DLOPEN $lfl]
126 # @teaish-check-libmath
128 # Handles the --enable-math flag. Returns 1 if found, else 0.
129 # If found, it prepends -lm (if needed) to the linker flags.
130 proc teaish-check-libmath {} {
131 teaish-check-cached "Checking for libc math library" {
132 set lfl ""
133 set rc 0
134 if {[msg-quiet proj-check-function-in-lib ceil m]} {
136 set lfl [get-define lib_ceil]
138 teaish-ldflags-prepend $lfl
139 msg-checking "$lfl "
146 # @teaish-import-features ?-flags? feature-names...
148 # For each $name in feature-names... it invokes:
154 # By default, if a proc named teaish-check-${name}-options is defined
156 # proj-append-options. This can be suppressed with the -no-options
161 # -no-options: disables the automatic running of
162 # teaish-check-NAME-options,
164 # -run: if the function teaish-check-NAME exists after importing
166 # function from teaish-options. This trumps both -pre and -post.
168 # -pre: if the function teaish-check-NAME exists after importing
169 # then it is passed to [teaish-checks-queue -pre].
171 # -post: works like -pre but instead uses[teaish-checks-queue -post].
172 proc teaish-import-features {args} {
173 set pk ""
174 set doOpt 1
175 proj-parse-simple-flags args flags {
176 -no-options 0 {set doOpt 0}
177 -run 0 {expr 1}
178 -pre 0 {set pk -pre}
179 -post 0 {set pk -post}
184 # remember whether or not any teaish-check-${arg}* procs have been
187 if {$flags(-run) && "" ne $pk} {
188 proj-error "Cannot use both -run and $pk" \
189 " (called from [proj-scope 1])"
195 set n "teaish-check-${arg}-options"
197 if {"" ne [set x [$n]]} {
198 options-add $x
202 if {$flags(-run)} {
203 set n "teaish-check-${arg}"
208 set n "teaish-check-${arg}"
210 teaish-checks-queue {*}$pk $n