summaryrefslogtreecommitdiff
path: root/autosetup
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2016-10-26 19:52:06 +1000
committerSteve Bennett <steveb@workware.net.au>2016-10-26 19:52:51 +1000
commit7d5a6e3b6f19a5c9260c131f428711320da452a0 (patch)
treeb024d6e8c3d97ceb1a210a7e533a818fe26ed337 /autosetup
parentb7efe69818d2d12c0f004a5aaca70cd2ed2f388a (diff)
build: update autosetup for LIBS/LDFLAGS fix
343be844 cc tests should use LIBS and LDFLAGS Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'autosetup')
-rw-r--r--autosetup/cc.tcl13
1 files changed, 9 insertions, 4 deletions
diff --git a/autosetup/cc.tcl b/autosetup/cc.tcl
index 67f1ccd..c6702a2 100644
--- a/autosetup/cc.tcl
+++ b/autosetup/cc.tcl
@@ -211,7 +211,7 @@ proc cc-check-members {args} {
#
# If the function is found, the feature is defined and lib_$function is defined
# to -l$lib where the function was found, or "" if no library required.
-# In addition, -l$lib is added to the LIBS define.
+# In addition, -l$lib is prepended to the LIBS define.
#
# If additional libraries may be needed for linking, they should be specified
# as $extralibs as "-lotherlib1 -lotherlib2".
@@ -233,7 +233,8 @@ proc cc-check-function-in-lib {function libs {otherlibs {}}} {
if {[cctest_function $function]} {
msg-result -l$lib
define lib_$function -l$lib
- define-append LIBS -l$lib
+ # prepend to LIBS
+ define LIBS "-l$lib [get-define LIBS]"
incr found
break
}
@@ -499,13 +500,17 @@ proc cctest {args} {
}
}
- if {!$opts(-link)} {
+ if {$opts(-link)} {
+ lappend cmdline {*}[get-define LDFLAGS]
+ } else {
set tmp conftest__.o
lappend cmdline -c
}
lappend cmdline {*}$opts(-cflags) {*}[get-define cc-default-debug ""]
-
lappend cmdline $src -o $tmp {*}$opts(-libs)
+ if {$opts(-link)} {
+ lappend cmdline {*}[get-define LIBS]
+ }
# At this point we have the complete command line and the
# complete source to be compiled. Get the result from cache if