In cbits/atomic.c we use HAVE_C11_ATOMICS, which gloriously is defined via autoconfig, outside of ghc-prim, and ends up in ghcautoconf.h
So maybe we should rather define a atomic flag in ghc-prim, which sets the HAVE_C11_ATOMICS, and links -latomic? And then have
GHC build ghc-prim with -f+atomic, if we detect HAVE_C11_ATOMICS?
Or we could just turn ghc-prim into a configure package. And have it do the right thing self contained?
I have a working version with the configure script in a local branch.
I am much in favor of untangling the build system and making the packages self contained instead of linking resources across package boundaries. (header files, ... and here: defines)