@@ -62,6 +62,8 @@ def get_cflags(force_object_files=False):
6262 flags += ['-flto=' + shared .Settings .LTO ]
6363 if shared .Settings .RELOCATABLE :
6464 flags += ['-s' , 'RELOCATABLE' ]
65+ if shared .Settings .USE_PTHREADS :
66+ flags += ['-s' , 'USE_PTHREADS' ]
6567 return flags
6668
6769
@@ -635,7 +637,7 @@ def get_default_variation(cls, **kwargs):
635637 return super (AsanInstrumentedLibrary , cls ).get_default_variation (is_asan = shared .Settings .USE_ASAN , ** kwargs )
636638
637639
638- class libcompiler_rt (MTLibrary ):
640+ class libcompiler_rt (Library ):
639641 name = 'libcompiler_rt'
640642 # compiler_rt files can't currently be part of LTO although we are hoping to remove this
641643 # restriction soon: https://reviews.llvm.org/D71738
@@ -649,7 +651,7 @@ class libcompiler_rt(MTLibrary):
649651 src_files .append (shared .path_from_root ('system' , 'lib' , 'compiler-rt' , 'emscripten_exception_builtins.c' ))
650652
651653
652- class libc (AsanInstrumentedLibrary , MuslInternalLibrary , MTLibrary ):
654+ class libc (AsanInstrumentedLibrary , MuslInternalLibrary ):
653655 name = 'libc'
654656
655657 # Without -fno-builtin, LLVM can optimize away or convert calls to library
@@ -760,7 +762,7 @@ def get_files(self):
760762 filenames = ['vfprintf.c' ])
761763
762764
763- class libsockets (MuslInternalLibrary , MTLibrary ):
765+ class libsockets (MuslInternalLibrary ):
764766 name = 'libsockets'
765767
766768 cflags = ['-Os' , '-fno-builtin' ]
@@ -770,7 +772,7 @@ def get_files(self):
770772 return [os .path .join (network_dir , x ) for x in LIBC_SOCKETS ]
771773
772774
773- class libsockets_proxy (MuslInternalLibrary , MTLibrary ):
775+ class libsockets_proxy (MuslInternalLibrary ):
774776 name = 'libsockets_proxy'
775777
776778 cflags = ['-Os' ]
@@ -810,7 +812,7 @@ def can_use(self):
810812 return super (crt1_reactor , self ).can_use () and shared .Settings .STANDALONE_WASM
811813
812814
813- class libcxxabi (NoExceptLibrary , MTLibrary ):
815+ class libcxxabi (NoExceptLibrary ):
814816 name = 'libc++abi'
815817 cflags = [
816818 '-Oz' ,
@@ -823,7 +825,7 @@ class libcxxabi(NoExceptLibrary, MTLibrary):
823825 def get_cflags (self ):
824826 cflags = super (libcxxabi , self ).get_cflags ()
825827 cflags .append ('-DNDEBUG' )
826- if not self . is_mt :
828+ if shared . Settings . USE_PTHREADS == 0 :
827829 cflags .append ('-D_LIBCXXABI_HAS_NO_THREADS' )
828830 if self .eh_mode == exceptions .none :
829831 cflags .append ('-D_LIBCXXABI_NO_EXCEPTIONS' )
@@ -863,7 +865,7 @@ def get_files(self):
863865 filenames = filenames )
864866
865867
866- class libcxx (NoExceptLibrary , MTLibrary ):
868+ class libcxx (NoExceptLibrary ):
867869 name = 'libc++'
868870
869871 cflags = ['-DLIBCXX_BUILDING_LIBCXXABI=1' , '-D_LIBCPP_BUILDING_LIBRARY' , '-Oz' ,
@@ -910,7 +912,7 @@ class libcxx(NoExceptLibrary, MTLibrary):
910912 ]
911913
912914
913- class libunwind (NoExceptLibrary , MTLibrary ):
915+ class libunwind (NoExceptLibrary ):
914916 name = 'libunwind'
915917 cflags = ['-Oz' , '-D_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS' ]
916918 src_dir = ['system' , 'lib' , 'libunwind' , 'src' ]
@@ -925,7 +927,7 @@ def can_use(self):
925927 def get_cflags (self ):
926928 cflags = super (libunwind , self ).get_cflags ()
927929 cflags .append ('-DNDEBUG' )
928- if not self . is_mt :
930+ if shared . Settings . USE_PTHREADS == 0 :
929931 cflags .append ('-D_LIBUNWIND_HAS_NO_THREADS' )
930932 if self .eh_mode == exceptions .none :
931933 cflags .append ('-D_LIBUNWIND_HAS_NO_EXCEPTIONS' )
@@ -936,7 +938,7 @@ def get_cflags(self):
936938 return cflags
937939
938940
939- class libmalloc (MTLibrary ):
941+ class libmalloc (Library ):
940942 name = 'libmalloc'
941943
942944 cflags = ['-O2' , '-fno-builtin' ]
@@ -1024,7 +1026,7 @@ class libal(Library):
10241026 src_files = ['al.c' ]
10251027
10261028
1027- class libgl (MTLibrary ):
1029+ class libgl (Library ):
10281030 name = 'libgl'
10291031
10301032 src_dir = ['system' , 'lib' , 'gl' ]
@@ -1078,15 +1080,15 @@ def get_default_variation(cls, **kwargs):
10781080 )
10791081
10801082
1081- class libwebgpu_cpp (MTLibrary ):
1083+ class libwebgpu_cpp (Library ):
10821084 name = 'libwebgpu_cpp'
10831085
10841086 cflags = ['-std=c++11' , '-O2' ]
10851087 src_dir = ['system' , 'lib' , 'webgpu' ]
10861088 src_files = ['webgpu_cpp.cpp' ]
10871089
10881090
1089- class libembind (MTLibrary ):
1091+ class libembind (Library ):
10901092 name = 'libembind'
10911093 never_force = True
10921094
@@ -1118,15 +1120,15 @@ def get_default_variation(cls, **kwargs):
11181120 return super (libembind , cls ).get_default_variation (with_rtti = shared .Settings .USE_RTTI , ** kwargs )
11191121
11201122
1121- class libfetch (MTLibrary ):
1123+ class libfetch (Library ):
11221124 name = 'libfetch'
11231125 never_force = True
11241126
11251127 def get_files (self ):
11261128 return [shared .path_from_root ('system' , 'lib' , 'fetch' , 'emscripten_fetch.cpp' )]
11271129
11281130
1129- class libasmfs (MTLibrary ):
1131+ class libasmfs (Library ):
11301132 name = 'libasmfs'
11311133 never_force = True
11321134
@@ -1147,12 +1149,12 @@ class libhtml5(Library):
11471149 src_glob = '*.c'
11481150
11491151
1150- class libpthread (AsanInstrumentedLibrary , MuslInternalLibrary , MTLibrary ):
1152+ class libpthread (AsanInstrumentedLibrary , MuslInternalLibrary ):
11511153 name = 'libpthread'
11521154 cflags = ['-O2' ]
11531155
11541156 def get_files (self ):
1155- if self . is_mt :
1157+ if shared . Settings . USE_PTHREADS :
11561158 files = files_in_path (
11571159 path_components = ['system' , 'lib' , 'libc' , 'musl' , 'src' , 'thread' ],
11581160 filenames = [
@@ -1196,7 +1198,7 @@ def get_files(self):
11961198 return [shared .path_from_root ('system' , 'lib' , 'pthread' , 'library_pthread_stub.c' )]
11971199
11981200 def get_base_name_prefix (self ):
1199- return 'libpthread' if self . is_mt else 'libpthread_stub'
1201+ return 'libpthread' if shared . Settings . USE_PTHREADS else 'libpthread_stub'
12001202
12011203
12021204class CompilerRTLibrary (Library ):
@@ -1206,14 +1208,14 @@ class CompilerRTLibrary(Library):
12061208 force_object_files = True
12071209
12081210
1209- class libc_rt_wasm (AsanInstrumentedLibrary , CompilerRTLibrary , MuslInternalLibrary , MTLibrary ):
1211+ class libc_rt_wasm (AsanInstrumentedLibrary , CompilerRTLibrary , MuslInternalLibrary ):
12101212 name = 'libc_rt_wasm'
12111213
12121214 def get_files (self ):
12131215 return get_wasm_libc_rt_files ()
12141216
12151217
1216- class libubsan_minimal_rt_wasm (CompilerRTLibrary , MTLibrary ):
1218+ class libubsan_minimal_rt_wasm (CompilerRTLibrary ):
12171219 name = 'libubsan_minimal_rt_wasm'
12181220 never_force = True
12191221
@@ -1222,7 +1224,7 @@ class libubsan_minimal_rt_wasm(CompilerRTLibrary, MTLibrary):
12221224 src_files = ['ubsan_minimal_handlers.cpp' ]
12231225
12241226
1225- class libsanitizer_common_rt (CompilerRTLibrary , MTLibrary ):
1227+ class libsanitizer_common_rt (CompilerRTLibrary ):
12261228 name = 'libsanitizer_common_rt'
12271229 includes = [['system' , 'lib' , 'libc' , 'musl' , 'src' , 'internal' ],
12281230 ['system' , 'lib' , 'compiler-rt' , 'lib' ]]
@@ -1233,7 +1235,7 @@ class libsanitizer_common_rt(CompilerRTLibrary, MTLibrary):
12331235 src_glob_exclude = ['sanitizer_common_nolibc.cpp' ]
12341236
12351237
1236- class SanitizerLibrary (CompilerRTLibrary , MTLibrary ):
1238+ class SanitizerLibrary (CompilerRTLibrary ):
12371239 never_force = True
12381240
12391241 includes = [['system' , 'lib' , 'compiler-rt' , 'lib' ]]
@@ -1268,7 +1270,7 @@ class libasan_rt(SanitizerLibrary):
12681270 src_dir = ['system' , 'lib' , 'compiler-rt' , 'lib' , 'asan' ]
12691271
12701272
1271- class libasan_js (MTLibrary ):
1273+ class libasan_js (Library ):
12721274 name = 'libasan_js'
12731275
12741276 cflags = ['-fsanitize=address' ]
0 commit comments