@@ -11,6 +11,10 @@ options-defaults {
11
11
use cc cc-shared cc-db cc-lib pkg-config util
12
12
use local
13
13
14
+ # CFLAGS, CXXFLAGS only come from the user
15
+ define CFLAGS [get-env CFLAGS ""]
16
+ define CXXFLAGS [get-env CFLAGS ""]
17
+
14
18
options {
15
19
utf8 => "Include support for utf8-encoded strings"
16
20
lineedit=1 => "Disable line editing"
@@ -190,19 +194,18 @@ if {"-Werror" in [get-define CFLAGS] && [cctest -cflags -Wno-error]} {
190
194
cc-check-types "long long"
191
195
cc-check-sizeof int
192
196
193
- define CCOPTS ""
194
- define CXXOPTS ""
195
- if {[cctest -cflags -fno-unwind-tables]} {
196
- define-append CCOPTS -fno-unwind-tables
197
- }
198
- if {[cctest -cflags -fno-asynchronous-unwind-tables]} {
199
- define-append CCOPTS -fno-asynchronous-unwind-tables
197
+ # Default optimisation
198
+ define-append AS_CPPFLAGS -O2
199
+
200
+ # check, but don't add to -cflags
201
+ cc-with {} {
202
+ cc-check-flags -fno-unwind-tables -fno-asynchronous-unwind-tables
200
203
}
201
204
if {[opt-bool coverage]} {
202
205
if {[cctest -link 1 -cflags --coverage]} {
203
206
# When using coverage, disable ccache and compiler optimisation
204
207
define CCACHE ""
205
- define-append CCOPTS --coverage -O0
208
+ define-append AS_CFLAGS --coverage -O0
206
209
define-append LDFLAGS --coverage
207
210
define COVERAGE 1
208
211
if {[cc-check-progs gcovr]} {
@@ -286,7 +289,7 @@ switch -glob -- $host_os {
286
289
define TCL_PLATFORM_PLATFORM windows
287
290
define TCL_PLATFORM_PATH_SEPARATOR {;}
288
291
# Target WinXP or later. Should this be configurable?
289
- define-append CCOPTS -D_WIN32_WINNT=0x501 -Wno-deprecated-declarations
292
+ define-append AS_CFLAGS -D_WIN32_WINNT=0x501 -Wno-deprecated-declarations
290
293
}
291
294
default {
292
295
# Note that cygwin is considered a unix platform
@@ -370,7 +373,7 @@ proc opt-bool-or-full {opt} {
370
373
if {[opt-bool-or-full utf8]} {
371
374
msg-result "Enabling UTF-8"
372
375
define JIM_UTF8
373
- define-append CCOPTS -DUSE_UTF8
376
+ define-append AS_CFLAGS -DUSE_UTF8
374
377
define PARSE_UNIDATA_FLAGS ""
375
378
incr jimregexp
376
379
} else {
@@ -399,7 +402,7 @@ if {[opt-bool-or-full ssl]} {
399
402
define JIM_SSL
400
403
define-append LDLIBS [pkg-config-get $pkg LIBS]
401
404
define-append LDFLAGS [pkg-config-get $pkg LDFLAGS]
402
- define-append CCOPTS [pkg-config-get $pkg CFLAGS]
405
+ define-append AS_CFLAGS [pkg-config-get $pkg CFLAGS]
403
406
msg-result "Enabling SSL ($pkg)"
404
407
define-append PKG_CONFIG_REQUIRES $pkg
405
408
break
@@ -417,7 +420,7 @@ if {[opt-bool-or-full ssl]} {
417
420
}
418
421
# Later versions deprecate TLSv1_2_method, but older versions don't have TLS_method
419
422
if {![cc-check-function-in-lib TLS_method ssl]} {
420
- define-append CCOPTS -DUSE_TLSv1_2_method
423
+ define-append AS_CFLAGS -DUSE_TLSv1_2_method
421
424
}
422
425
}
423
426
if {[opt-bool-or-full lineedit]} {
@@ -427,7 +430,7 @@ if {[opt-bool-or-full lineedit]} {
427
430
define-append PARSE_UNIDATA_FLAGS -width
428
431
lappend extra_objs linenoise.o
429
432
if {[cc-check-inline] && [is-defined inline]} {
430
- define-append CCOPTS -Dinline=[get-define inline]
433
+ define-append AS_CFLAGS -Dinline=[get-define inline]
431
434
}
432
435
}
433
436
}
0 commit comments