@@ -680,29 +680,32 @@ proc sqlite-handle-soname {} {
680
680
}
681
681
682
682
########################################################################
683
- # If --enable-thresafe is set, this adds -DSQLITE_THREADSAFE=1 to
683
+ # If --enable-threadsafe is set, this adds -DSQLITE_THREADSAFE=1 to
684
684
# 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.
688
688
proc sqlite-handle-threadsafe {} {
689
689
msg-checking " Support threadsafe operation? "
690
+ define LDFLAGS_PTHREAD " "
691
+ set enable 0
690
692
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."
696
701
}
697
- define LDFLAGS_PTHREAD [ get-define lib_pthread_create]
698
- undefine lib_pthread_create
699
702
# Recall that LDFLAGS_PTHREAD might be empty even if pthreads if
700
703
# found because it's in -lc on some platforms.
701
704
} {
702
705
msg-result no
703
- sqlite-add-feature-flag -DSQLITE_THREADSAFE=0
704
- define LDFLAGS_PTHREAD " "
705
706
}
707
+ sqlite-add-feature-flag -DSQLITE_THREADSAFE=${enable}
708
+ return $enable
706
709
}
707
710
708
711
########################################################################
0 commit comments