Skip to content

Commit 0b7d0b6

Browse files
committed
Make failure to find pthreads support non-fatal unless --enable-threadsafe is specifically passed in. Build regression reported in [forum:8e0fdb8c0d|forum post 8e0fdb8c0d].
1 parent 3f7b6ce commit 0b7d0b6

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

autosetup/sqlite-config.tcl

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -680,29 +680,32 @@ proc sqlite-handle-soname {} {
680680
}
681681
682682
########################################################################
683-
# If --enable-thresafe is set, this adds -DSQLITE_THREADSAFE=1 to
683+
# If --enable-threadsafe is set, this adds -DSQLITE_THREADSAFE=1 to
684684
# OPT_FEATURE_FLAGS and sets LDFLAGS_PTHREAD to the linker flags
685-
# needed for linking pthread. If --enable-threadsafe is not set, adds
686-
# -DSQLITE_THREADSAFE=0 to OPT_FEATURE_FLAGS and sets LDFLAGS_PTHREAD
687-
# to an empty string.
685+
# needed for linking pthread (possibly an empty string). If
686+
# --enable-threadsafe is not set, adds -DSQLITE_THREADSAFE=0 to
687+
# OPT_FEATURE_FLAGS and sets LDFLAGS_PTHREAD to an empty string.
688688
proc sqlite-handle-threadsafe {} {
689689
msg-checking "Support threadsafe operation? "
690+
define LDFLAGS_PTHREAD ""
691+
set enable 0
690692
proj-if-opt-truthy threadsafe {
691-
msg-result yes
692-
sqlite-add-feature-flag -DSQLITE_THREADSAFE=1
693-
if {![proj-check-function-in-lib pthread_create pthread]
694-
|| ![proj-check-function-in-lib pthread_mutexattr_init pthread]} {
695-
user-error "Missing required pthread bits"
693+
if {[proj-check-function-in-lib pthread_create pthread]
694+
&& [proj-check-function-in-lib pthread_mutexattr_init pthread]} {
695+
set enable 1
696+
define LDFLAGS_PTHREAD [get-define lib_pthread_create]
697+
undefine lib_pthread_create
698+
undefine lib_pthread_mutexattr_init
699+
} elseif {[proj-opt-was-provided threadsafe]} {
700+
user-error "Missing required pthread libraries. Use --disable-threadsafe to disable this check."
696701
}
697-
define LDFLAGS_PTHREAD [get-define lib_pthread_create]
698-
undefine lib_pthread_create
699702
# Recall that LDFLAGS_PTHREAD might be empty even if pthreads if
700703
# found because it's in -lc on some platforms.
701704
} {
702705
msg-result no
703-
sqlite-add-feature-flag -DSQLITE_THREADSAFE=0
704-
define LDFLAGS_PTHREAD ""
705706
}
707+
sqlite-add-feature-flag -DSQLITE_THREADSAFE=${enable}
708+
return $enable
706709
}
707710
708711
########################################################################

0 commit comments

Comments
 (0)