detect.py 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  1. import os
  2. import platform
  3. import sys
  4. from methods import get_compiler_version, using_gcc
  5. from platform_methods import detect_arch
  6. from typing import TYPE_CHECKING
  7. if TYPE_CHECKING:
  8. from SCons.Script.SConscript import SConsEnvironment
  9. def get_name():
  10. return "LinuxBSD"
  11. def can_build():
  12. if os.name != "posix" or sys.platform == "darwin":
  13. return False
  14. pkgconf_error = os.system("pkg-config --version > /dev/null")
  15. if pkgconf_error:
  16. print("Error: pkg-config not found. Aborting.")
  17. return False
  18. return True
  19. def get_opts():
  20. from SCons.Variables import BoolVariable, EnumVariable
  21. return [
  22. EnumVariable("linker", "Linker program", "default", ("default", "bfd", "gold", "lld", "mold")),
  23. BoolVariable("use_llvm", "Use the LLVM compiler", False),
  24. BoolVariable("use_static_cpp", "Link libgcc and libstdc++ statically for better portability", True),
  25. BoolVariable("use_coverage", "Test Godot coverage", False),
  26. BoolVariable("use_ubsan", "Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)", False),
  27. BoolVariable("use_asan", "Use LLVM/GCC compiler address sanitizer (ASAN)", False),
  28. BoolVariable("use_lsan", "Use LLVM/GCC compiler leak sanitizer (LSAN)", False),
  29. BoolVariable("use_tsan", "Use LLVM/GCC compiler thread sanitizer (TSAN)", False),
  30. BoolVariable("use_msan", "Use LLVM compiler memory sanitizer (MSAN)", False),
  31. BoolVariable("use_sowrap", "Dynamically load system libraries", True),
  32. BoolVariable("alsa", "Use ALSA", True),
  33. BoolVariable("pulseaudio", "Use PulseAudio", True),
  34. BoolVariable("dbus", "Use D-Bus to handle screensaver and portal desktop settings", True),
  35. BoolVariable("speechd", "Use Speech Dispatcher for Text-to-Speech support", True),
  36. BoolVariable("fontconfig", "Use fontconfig for system fonts support", True),
  37. BoolVariable("udev", "Use udev for gamepad connection callbacks", True),
  38. BoolVariable("x11", "Enable X11 display", True),
  39. BoolVariable("wayland", "Enable Wayland display", True),
  40. BoolVariable("libdecor", "Enable libdecor support", True),
  41. BoolVariable("touch", "Enable touch events", True),
  42. BoolVariable("execinfo", "Use libexecinfo on systems where glibc is not available", None),
  43. ]
  44. def get_doc_classes():
  45. return [
  46. "EditorExportPlatformLinuxBSD",
  47. ]
  48. def get_doc_path():
  49. return "doc_classes"
  50. def get_flags():
  51. return [
  52. ("arch", detect_arch()),
  53. ]
  54. def configure(env: "SConsEnvironment"):
  55. # Validate arch.
  56. supported_arches = ["x86_32", "x86_64", "arm32", "arm64", "rv64", "ppc32", "ppc64"]
  57. if env["arch"] not in supported_arches:
  58. print(
  59. 'Unsupported CPU architecture "%s" for Linux / *BSD. Supported architectures are: %s.'
  60. % (env["arch"], ", ".join(supported_arches))
  61. )
  62. sys.exit(255)
  63. ## Build type
  64. if env.dev_build:
  65. # This is needed for our crash handler to work properly.
  66. # gdb works fine without it though, so maybe our crash handler could too.
  67. env.Append(LINKFLAGS=["-rdynamic"])
  68. # Cross-compilation
  69. # TODO: Support cross-compilation on architectures other than x86.
  70. host_is_64_bit = sys.maxsize > 2**32
  71. if host_is_64_bit and env["arch"] == "x86_32":
  72. env.Append(CCFLAGS=["-m32"])
  73. env.Append(LINKFLAGS=["-m32"])
  74. elif not host_is_64_bit and env["arch"] == "x86_64":
  75. env.Append(CCFLAGS=["-m64"])
  76. env.Append(LINKFLAGS=["-m64"])
  77. # CPU architecture flags.
  78. if env["arch"] == "rv64":
  79. # G = General-purpose extensions, C = Compression extension (very common).
  80. env.Append(CCFLAGS=["-march=rv64gc"])
  81. ## Compiler configuration
  82. if "CXX" in env and "clang" in os.path.basename(env["CXX"]):
  83. # Convenience check to enforce the use_llvm overrides when CXX is clang(++)
  84. env["use_llvm"] = True
  85. if env["use_llvm"]:
  86. if "clang++" not in os.path.basename(env["CXX"]):
  87. env["CC"] = "clang"
  88. env["CXX"] = "clang++"
  89. env.extra_suffix = ".llvm" + env.extra_suffix
  90. if env["linker"] != "default":
  91. print("Using linker program: " + env["linker"])
  92. if env["linker"] == "mold" and using_gcc(env): # GCC < 12.1 doesn't support -fuse-ld=mold.
  93. cc_version = get_compiler_version(env)
  94. cc_semver = (cc_version["major"], cc_version["minor"])
  95. if cc_semver < (12, 1):
  96. found_wrapper = False
  97. for path in ["/usr/libexec", "/usr/local/libexec", "/usr/lib", "/usr/local/lib"]:
  98. if os.path.isfile(path + "/mold/ld"):
  99. env.Append(LINKFLAGS=["-B" + path + "/mold"])
  100. found_wrapper = True
  101. break
  102. if not found_wrapper:
  103. print("Couldn't locate mold installation path. Make sure it's installed in /usr or /usr/local.")
  104. sys.exit(255)
  105. else:
  106. env.Append(LINKFLAGS=["-fuse-ld=mold"])
  107. else:
  108. env.Append(LINKFLAGS=["-fuse-ld=%s" % env["linker"]])
  109. if env["use_coverage"]:
  110. env.Append(CCFLAGS=["-ftest-coverage", "-fprofile-arcs"])
  111. env.Append(LINKFLAGS=["-ftest-coverage", "-fprofile-arcs"])
  112. if env["use_ubsan"] or env["use_asan"] or env["use_lsan"] or env["use_tsan"] or env["use_msan"]:
  113. env.extra_suffix += ".san"
  114. env.Append(CCFLAGS=["-DSANITIZERS_ENABLED"])
  115. if env["use_ubsan"]:
  116. env.Append(
  117. CCFLAGS=[
  118. "-fsanitize=undefined,shift,shift-exponent,integer-divide-by-zero,unreachable,vla-bound,null,return,signed-integer-overflow,bounds,float-divide-by-zero,float-cast-overflow,nonnull-attribute,returns-nonnull-attribute,bool,enum,vptr,pointer-overflow,builtin"
  119. ]
  120. )
  121. env.Append(LINKFLAGS=["-fsanitize=undefined"])
  122. if env["use_llvm"]:
  123. env.Append(
  124. CCFLAGS=[
  125. "-fsanitize=nullability-return,nullability-arg,function,nullability-assign,implicit-integer-sign-change"
  126. ]
  127. )
  128. else:
  129. env.Append(CCFLAGS=["-fsanitize=bounds-strict"])
  130. if env["use_asan"]:
  131. env.Append(CCFLAGS=["-fsanitize=address,pointer-subtract,pointer-compare"])
  132. env.Append(LINKFLAGS=["-fsanitize=address"])
  133. if env["use_lsan"]:
  134. env.Append(CCFLAGS=["-fsanitize=leak"])
  135. env.Append(LINKFLAGS=["-fsanitize=leak"])
  136. if env["use_tsan"]:
  137. env.Append(CCFLAGS=["-fsanitize=thread"])
  138. env.Append(LINKFLAGS=["-fsanitize=thread"])
  139. if env["use_msan"] and env["use_llvm"]:
  140. env.Append(CCFLAGS=["-fsanitize=memory"])
  141. env.Append(CCFLAGS=["-fsanitize-memory-track-origins"])
  142. env.Append(CCFLAGS=["-fsanitize-recover=memory"])
  143. env.Append(LINKFLAGS=["-fsanitize=memory"])
  144. # LTO
  145. if env["lto"] == "auto": # Full LTO for production.
  146. env["lto"] = "full"
  147. if env["lto"] != "none":
  148. if env["lto"] == "thin":
  149. if not env["use_llvm"]:
  150. print("ThinLTO is only compatible with LLVM, use `use_llvm=yes` or `lto=full`.")
  151. sys.exit(255)
  152. env.Append(CCFLAGS=["-flto=thin"])
  153. env.Append(LINKFLAGS=["-flto=thin"])
  154. elif not env["use_llvm"] and env.GetOption("num_jobs") > 1:
  155. env.Append(CCFLAGS=["-flto"])
  156. env.Append(LINKFLAGS=["-flto=" + str(env.GetOption("num_jobs"))])
  157. else:
  158. env.Append(CCFLAGS=["-flto"])
  159. env.Append(LINKFLAGS=["-flto"])
  160. if not env["use_llvm"]:
  161. env["RANLIB"] = "gcc-ranlib"
  162. env["AR"] = "gcc-ar"
  163. env.Append(CCFLAGS=["-pipe"])
  164. ## Dependencies
  165. if env["use_sowrap"]:
  166. env.Append(CPPDEFINES=["SOWRAP_ENABLED"])
  167. if env["wayland"]:
  168. if os.system("wayland-scanner -v 2>/dev/null") != 0:
  169. print("wayland-scanner not found. Disabling Wayland support.")
  170. env["wayland"] = False
  171. if env["touch"]:
  172. env.Append(CPPDEFINES=["TOUCH_ENABLED"])
  173. # FIXME: Check for existence of the libs before parsing their flags with pkg-config
  174. # freetype depends on libpng and zlib, so bundling one of them while keeping others
  175. # as shared libraries leads to weird issues. And graphite and harfbuzz need freetype.
  176. ft_linked_deps = [
  177. env["builtin_freetype"],
  178. env["builtin_libpng"],
  179. env["builtin_zlib"],
  180. env["builtin_graphite"],
  181. env["builtin_harfbuzz"],
  182. ]
  183. if (not all(ft_linked_deps)) and any(ft_linked_deps): # All or nothing.
  184. print(
  185. "These libraries should be either all builtin, or all system provided:\n"
  186. "freetype, libpng, zlib, graphite, harfbuzz.\n"
  187. "Please specify `builtin_<name>=no` for all of them, or none."
  188. )
  189. sys.exit(255)
  190. if not env["builtin_freetype"]:
  191. env.ParseConfig("pkg-config freetype2 --cflags --libs")
  192. if not env["builtin_graphite"]:
  193. env.ParseConfig("pkg-config graphite2 --cflags --libs")
  194. if not env["builtin_icu4c"]:
  195. env.ParseConfig("pkg-config icu-i18n icu-uc --cflags --libs")
  196. if not env["builtin_harfbuzz"]:
  197. env.ParseConfig("pkg-config harfbuzz harfbuzz-icu --cflags --libs")
  198. if not env["builtin_libpng"]:
  199. env.ParseConfig("pkg-config libpng16 --cflags --libs")
  200. if not env["builtin_enet"]:
  201. env.ParseConfig("pkg-config libenet --cflags --libs")
  202. if not env["builtin_squish"]:
  203. # libsquish doesn't reliably install its .pc file, so some distros lack it.
  204. env.Append(LIBS=["libsquish"])
  205. if not env["builtin_zstd"]:
  206. env.ParseConfig("pkg-config libzstd --cflags --libs")
  207. if env["brotli"] and not env["builtin_brotli"]:
  208. env.ParseConfig("pkg-config libbrotlicommon libbrotlidec --cflags --libs")
  209. # Sound and video libraries
  210. # Keep the order as it triggers chained dependencies (ogg needed by others, etc.)
  211. if not env["builtin_libtheora"]:
  212. env["builtin_libogg"] = False # Needed to link against system libtheora
  213. env["builtin_libvorbis"] = False # Needed to link against system libtheora
  214. env.ParseConfig("pkg-config theora theoradec --cflags --libs")
  215. else:
  216. if env["arch"] in ["x86_64", "x86_32"]:
  217. env["x86_libtheora_opt_gcc"] = True
  218. if not env["builtin_libvorbis"]:
  219. env["builtin_libogg"] = False # Needed to link against system libvorbis
  220. env.ParseConfig("pkg-config vorbis vorbisfile --cflags --libs")
  221. if not env["builtin_libogg"]:
  222. env.ParseConfig("pkg-config ogg --cflags --libs")
  223. if not env["builtin_libwebp"]:
  224. env.ParseConfig("pkg-config libwebp --cflags --libs")
  225. if not env["builtin_mbedtls"]:
  226. # mbedTLS does not provide a pkgconfig config yet. See https://github.com/ARMmbed/mbedtls/issues/228
  227. env.Append(LIBS=["mbedtls", "mbedcrypto", "mbedx509"])
  228. if not env["builtin_wslay"]:
  229. env.ParseConfig("pkg-config libwslay --cflags --libs")
  230. if not env["builtin_miniupnpc"]:
  231. # No pkgconfig file so far, hardcode default paths.
  232. env.Prepend(CPPPATH=["/usr/include/miniupnpc"])
  233. env.Append(LIBS=["miniupnpc"])
  234. # On Linux wchar_t should be 32-bits
  235. # 16-bit library shouldn't be required due to compiler optimizations
  236. if not env["builtin_pcre2"]:
  237. env.ParseConfig("pkg-config libpcre2-32 --cflags --libs")
  238. if not env["builtin_recastnavigation"]:
  239. # No pkgconfig file so far, hardcode default paths.
  240. env.Prepend(CPPPATH=["/usr/include/recastnavigation"])
  241. env.Append(LIBS=["Recast"])
  242. if not env["builtin_embree"] and env["arch"] in ["x86_64", "arm64"]:
  243. # No pkgconfig file so far, hardcode expected lib name.
  244. env.Append(LIBS=["embree3"])
  245. if not env["builtin_openxr"]:
  246. env.ParseConfig("pkg-config openxr --cflags --libs")
  247. if env["fontconfig"]:
  248. if not env["use_sowrap"]:
  249. if os.system("pkg-config --exists fontconfig") == 0: # 0 means found
  250. env.ParseConfig("pkg-config fontconfig --cflags --libs")
  251. env.Append(CPPDEFINES=["FONTCONFIG_ENABLED"])
  252. else:
  253. print("Warning: fontconfig development libraries not found. Disabling the system fonts support.")
  254. env["fontconfig"] = False
  255. else:
  256. env.Append(CPPDEFINES=["FONTCONFIG_ENABLED"])
  257. if env["alsa"]:
  258. if not env["use_sowrap"]:
  259. if os.system("pkg-config --exists alsa") == 0: # 0 means found
  260. env.ParseConfig("pkg-config alsa --cflags --libs")
  261. env.Append(CPPDEFINES=["ALSA_ENABLED", "ALSAMIDI_ENABLED"])
  262. else:
  263. print("Warning: ALSA development libraries not found. Disabling the ALSA audio driver.")
  264. env["alsa"] = False
  265. else:
  266. env.Append(CPPDEFINES=["ALSA_ENABLED", "ALSAMIDI_ENABLED"])
  267. if env["pulseaudio"]:
  268. if not env["use_sowrap"]:
  269. if os.system("pkg-config --exists libpulse") == 0: # 0 means found
  270. env.ParseConfig("pkg-config libpulse --cflags --libs")
  271. env.Append(CPPDEFINES=["PULSEAUDIO_ENABLED"])
  272. else:
  273. print("Warning: PulseAudio development libraries not found. Disabling the PulseAudio audio driver.")
  274. env["pulseaudio"] = False
  275. else:
  276. env.Append(CPPDEFINES=["PULSEAUDIO_ENABLED", "_REENTRANT"])
  277. if env["dbus"]:
  278. if not env["use_sowrap"]:
  279. if os.system("pkg-config --exists dbus-1") == 0: # 0 means found
  280. env.ParseConfig("pkg-config dbus-1 --cflags --libs")
  281. env.Append(CPPDEFINES=["DBUS_ENABLED"])
  282. else:
  283. print("Warning: D-Bus development libraries not found. Disabling screensaver prevention.")
  284. env["dbus"] = False
  285. else:
  286. env.Append(CPPDEFINES=["DBUS_ENABLED"])
  287. if env["speechd"]:
  288. if not env["use_sowrap"]:
  289. if os.system("pkg-config --exists speech-dispatcher") == 0: # 0 means found
  290. env.ParseConfig("pkg-config speech-dispatcher --cflags --libs")
  291. env.Append(CPPDEFINES=["SPEECHD_ENABLED"])
  292. else:
  293. print("Warning: speech-dispatcher development libraries not found. Disabling text to speech support.")
  294. env["speechd"] = False
  295. else:
  296. env.Append(CPPDEFINES=["SPEECHD_ENABLED"])
  297. if not env["use_sowrap"]:
  298. if os.system("pkg-config --exists xkbcommon") == 0: # 0 means found
  299. env.ParseConfig("pkg-config xkbcommon --cflags --libs")
  300. env.Append(CPPDEFINES=["XKB_ENABLED"])
  301. else:
  302. if env["wayland"]:
  303. print("Error: libxkbcommon development libraries required by Wayland not found. Aborting.")
  304. sys.exit(255)
  305. else:
  306. print(
  307. "Warning: libxkbcommon development libraries not found. Disabling dead key composition and key label support."
  308. )
  309. else:
  310. env.Append(CPPDEFINES=["XKB_ENABLED"])
  311. if platform.system() == "Linux":
  312. env.Append(CPPDEFINES=["JOYDEV_ENABLED"])
  313. if env["udev"]:
  314. if not env["use_sowrap"]:
  315. if os.system("pkg-config --exists libudev") == 0: # 0 means found
  316. env.ParseConfig("pkg-config libudev --cflags --libs")
  317. env.Append(CPPDEFINES=["UDEV_ENABLED"])
  318. else:
  319. print("Warning: libudev development libraries not found. Disabling controller hotplugging support.")
  320. env["udev"] = False
  321. else:
  322. env.Append(CPPDEFINES=["UDEV_ENABLED"])
  323. else:
  324. env["udev"] = False # Linux specific
  325. # Linkflags below this line should typically stay the last ones
  326. if not env["builtin_zlib"]:
  327. env.ParseConfig("pkg-config zlib --cflags --libs")
  328. env.Prepend(CPPPATH=["#platform/linuxbsd"])
  329. if env["use_sowrap"]:
  330. env.Prepend(CPPPATH=["#thirdparty/linuxbsd_headers"])
  331. env.Append(
  332. CPPDEFINES=[
  333. "LINUXBSD_ENABLED",
  334. "UNIX_ENABLED",
  335. ("_FILE_OFFSET_BITS", 64),
  336. ]
  337. )
  338. if env["x11"]:
  339. if not env["use_sowrap"]:
  340. if os.system("pkg-config --exists x11"):
  341. print("Error: X11 libraries not found. Aborting.")
  342. sys.exit(255)
  343. env.ParseConfig("pkg-config x11 --cflags --libs")
  344. if os.system("pkg-config --exists xcursor"):
  345. print("Error: Xcursor library not found. Aborting.")
  346. sys.exit(255)
  347. env.ParseConfig("pkg-config xcursor --cflags --libs")
  348. if os.system("pkg-config --exists xinerama"):
  349. print("Error: Xinerama library not found. Aborting.")
  350. sys.exit(255)
  351. env.ParseConfig("pkg-config xinerama --cflags --libs")
  352. if os.system("pkg-config --exists xext"):
  353. print("Error: Xext library not found. Aborting.")
  354. sys.exit(255)
  355. env.ParseConfig("pkg-config xext --cflags --libs")
  356. if os.system("pkg-config --exists xrandr"):
  357. print("Error: XrandR library not found. Aborting.")
  358. sys.exit(255)
  359. env.ParseConfig("pkg-config xrandr --cflags --libs")
  360. if os.system("pkg-config --exists xrender"):
  361. print("Error: XRender library not found. Aborting.")
  362. sys.exit(255)
  363. env.ParseConfig("pkg-config xrender --cflags --libs")
  364. if os.system("pkg-config --exists xi"):
  365. print("Error: Xi library not found. Aborting.")
  366. sys.exit(255)
  367. env.ParseConfig("pkg-config xi --cflags --libs")
  368. env.Append(CPPDEFINES=["X11_ENABLED"])
  369. if env["wayland"]:
  370. if not env["use_sowrap"]:
  371. if os.system("pkg-config --exists libdecor-0"):
  372. print("Warning: libdecor development libraries not found. Disabling client-side decorations.")
  373. env["libdecor"] = False
  374. else:
  375. env.ParseConfig("pkg-config libdecor-0 --cflags --libs")
  376. if os.system("pkg-config --exists wayland-client"):
  377. print("Error: Wayland client library not found. Aborting.")
  378. sys.exit(255)
  379. env.ParseConfig("pkg-config wayland-client --cflags --libs")
  380. if os.system("pkg-config --exists wayland-cursor"):
  381. print("Error: Wayland cursor library not found. Aborting.")
  382. sys.exit(255)
  383. env.ParseConfig("pkg-config wayland-cursor --cflags --libs")
  384. if os.system("pkg-config --exists wayland-egl"):
  385. print("Error: Wayland EGL library not found. Aborting.")
  386. sys.exit(255)
  387. env.ParseConfig("pkg-config wayland-egl --cflags --libs")
  388. if env["libdecor"]:
  389. env.Append(CPPDEFINES=["LIBDECOR_ENABLED"])
  390. env.Prepend(CPPPATH=["#platform/linuxbsd", "#thirdparty/linuxbsd_headers/wayland/"])
  391. env.Append(CPPDEFINES=["WAYLAND_ENABLED"])
  392. env.Append(LIBS=["rt"]) # Needed by glibc, used by _allocate_shm_file
  393. if env["vulkan"]:
  394. env.Append(CPPDEFINES=["VULKAN_ENABLED", "RD_ENABLED"])
  395. if not env["use_volk"]:
  396. env.ParseConfig("pkg-config vulkan --cflags --libs")
  397. if not env["builtin_glslang"]:
  398. # No pkgconfig file so far, hardcode expected lib name.
  399. env.Append(LIBS=["glslang", "SPIRV"])
  400. if env["opengl3"]:
  401. env.Append(CPPDEFINES=["GLES3_ENABLED"])
  402. env.Append(LIBS=["pthread"])
  403. if platform.system() == "Linux":
  404. env.Append(LIBS=["dl"])
  405. if platform.libc_ver()[0] != "glibc":
  406. # The default crash handler depends on glibc, so if the host uses
  407. # a different libc (BSD libc, musl), fall back to libexecinfo.
  408. if not "execinfo" in env:
  409. print("Note: Using `execinfo=yes` for the crash handler as required on platforms where glibc is missing.")
  410. env["execinfo"] = True
  411. if env["execinfo"]:
  412. env.Append(LIBS=["execinfo"])
  413. env.Append(CPPDEFINES=["CRASH_HANDLER_ENABLED"])
  414. else:
  415. print("Note: Using `execinfo=no` disables the crash handler on platforms where glibc is missing.")
  416. else:
  417. env.Append(CPPDEFINES=["CRASH_HANDLER_ENABLED"])
  418. if platform.system() == "FreeBSD":
  419. env.Append(LINKFLAGS=["-lkvm"])
  420. # Link those statically for portability
  421. if env["use_static_cpp"]:
  422. env.Append(LINKFLAGS=["-static-libgcc", "-static-libstdc++"])
  423. if env["use_llvm"] and platform.system() != "FreeBSD":
  424. env["LINKCOM"] = env["LINKCOM"] + " -l:libatomic.a"
  425. else:
  426. if env["use_llvm"] and platform.system() != "FreeBSD":
  427. env.Append(LIBS=["atomic"])