/* !!!
 * If you're looking at config.c and thinking of editing - this is a
 * generated file. See build/config.c.in, unless you're just twiddling
 * to get things to work on your platform before updating Configure,
 * in which case go right ahead. :-)
 * !!!
 */

#include "moar.h"

#define add_entry(tc, hash, name, value) do { \
    MVMString * const key = MVM_string_ascii_decode_nt(tc, tc->instance->VMString, (name)); \
    MVMROOT(tc, key, { \
        MVMString * const value_str = MVM_string_ascii_decode_nt(tc, tc->instance->VMString, (value)); \
        MVMObject * const boxed_value = MVM_repr_box_str(tc, MVM_hll_current(tc)->str_box_type, value_str); \
        MVM_repr_bind_key_o(tc, hash, key, boxed_value); \
    }); \
} while (0)

MVMObject *MVM_backend_config(MVMThreadContext *tc) {
    MVMObject *config = tc->instance->cached_backend_config;
    if (config)
        return config;

    config = MVM_repr_alloc_init(tc, tc->instance->boot_types.BOOTHash);
    MVMROOT(tc, config, {
        add_entry(tc, config, "ar", "ar");
        add_entry(tc, config, "arflags", "rcs");
        add_entry(tc, config, "arout", "");
        add_entry(tc, config, "as", "as");
        add_entry(tc, config, "asm", ".s");
        add_entry(tc, config, "asmout", "-o ");
        add_entry(tc, config, "asmswitch", "-S");
        add_entry(tc, config, "auxclean", "@:");
        add_entry(tc, config, "be", "0");
        add_entry(tc, config, "bindir", "/usr/pkg/bin");
        add_entry(tc, config, "booltype", "_Bool");
        add_entry(tc, config, "can_specific_werror", "1");
        add_entry(tc, config, "can_unaligned_int32", "0");
        add_entry(tc, config, "can_unaligned_int64", "0");
        add_entry(tc, config, "can_unaligned_num64", "0");
        add_entry(tc, config, "cancgoto", "1");
        add_entry(tc, config, "canrdtscp", "0");
        add_entry(tc, config, "cat", "cat");
        add_entry(tc, config, "cc", "gcc");
        add_entry(tc, config, "ccdebugflags", "-g3");
        add_entry(tc, config, "ccdef", "-D");
        add_entry(tc, config, "ccdefflags", "-D_REENTRANT -D_FILE_OFFSET_BITS=64 -DHAVE_LIBFFI");
        add_entry(tc, config, "ccinc", "-I");
        add_entry(tc, config, "ccinstflags", "-pg");
        add_entry(tc, config, "ccjitflags", "");
        add_entry(tc, config, "ccmiscflags", "-Werror=declaration-after-statement -Werror=pointer-arith");
        add_entry(tc, config, "ccoptiflags", "-O3 -DNDEBUG");
        add_entry(tc, config, "ccout", "-o ");
        add_entry(tc, config, "ccshared", "-fPIC");
        add_entry(tc, config, "ccswitch", "-c");
        add_entry(tc, config, "ccwarnflags", "");
        add_entry(tc, config, "cflags", "-Werror=declaration-after-statement -Werror=pointer-arith -O3 -DNDEBUG  -D_REENTRANT -D_FILE_OFFSET_BITS=64 -DHAVE_LIBFFI -fPIC -O2 -mieee -D_FORTIFY_SOURCE=2 -I/usr/pkg/include -I/usr/pkg/include");
        add_entry(tc, config, "cincludes", " -I/usr/local/include");
        add_entry(tc, config, "cmpclean", "cd 3rdparty/cmp && $(RM) libcmp.a && $(RM) cmp.lib && $(RM) cmp.obj && $(MAKE) clean");
        add_entry(tc, config, "cmplib", "3rdparty/cmp/libcmp.a");
        add_entry(tc, config, "cmpobjects", "3rdparty/cmp/cmp.o");
        add_entry(tc, config, "cmprule", "$(AR) $(ARFLAGS) $@ 3rdparty/cmp/*.o");
        add_entry(tc, config, "config", "--prefix=/usr/pkg --has-libatomic_ops --has-libffi --has-libuv --has-libtommath");
        add_entry(tc, config, "cppout", "> ");
        add_entry(tc, config, "cppswitch", "-E");
        add_entry(tc, config, "crossconf", "");
        add_entry(tc, config, "dasm_flags", "");
        add_entry(tc, config, "dcbclean", "@:");
        add_entry(tc, config, "dcblib", "__dcb__");
        add_entry(tc, config, "dcbobjects", "");
        add_entry(tc, config, "dcbrule", "@:");
        add_entry(tc, config, "dcclean", "@:");
        add_entry(tc, config, "dclib", "__dc__");
        add_entry(tc, config, "dcobjects", "");
        add_entry(tc, config, "dcrule", "@:");
        add_entry(tc, config, "defs[0]", "_REENTRANT");
        add_entry(tc, config, "defs[1]", "_FILE_OFFSET_BITS=64");
        add_entry(tc, config, "defs[2]", "HAVE_LIBFFI");
        add_entry(tc, config, "dlclean", "@:");
        add_entry(tc, config, "dll", "lib%s.so");
        add_entry(tc, config, "dllexport", "");
        add_entry(tc, config, "dllib", "__dl__");
        add_entry(tc, config, "dllimport", "");
        add_entry(tc, config, "dlllocal", "");
        add_entry(tc, config, "dlobjects", "");
        add_entry(tc, config, "dlrule", "@:");
        add_entry(tc, config, "exe", "");
        add_entry(tc, config, "expect_condition", "__builtin_expect((condition), (expection))");
        add_entry(tc, config, "expect_likely", "__builtin_expect(!!(condition), 1)");
        add_entry(tc, config, "expect_unlikely", "__builtin_expect(!!(condition), 0)");
        add_entry(tc, config, "formatattribute", "__attribute__((format(X, Y, Z)))");
        add_entry(tc, config, "has_fn_malloc_trim", "0");
        add_entry(tc, config, "has_pthread_yield", "0");
        add_entry(tc, config, "havebooltype", "1");
        add_entry(tc, config, "impinst", "");
        add_entry(tc, config, "install", "");
        add_entry(tc, config, "jit_arch", "MVM_JIT_ARCH_NONE");
        add_entry(tc, config, "jit_obj", "$(JIT_STUB)");
        add_entry(tc, config, "jit_platform", "MVM_JIT_PLATFORM_NONE");
        add_entry(tc, config, "laoclean", "@:");
        add_entry(tc, config, "laolib", "__lao__");
        add_entry(tc, config, "laoobjects", "");
        add_entry(tc, config, "laorule", "@:");
        add_entry(tc, config, "ld", "gcc");
        add_entry(tc, config, "lddebugflags", "-g3");
        add_entry(tc, config, "lddir", "-L");
        add_entry(tc, config, "ldflags", " -O3 -DNDEBUG -Wl,-rpath,\"//usr/pkg/lib\" -Wl,-R/usr/pkg/lib -L/usr/pkg/lib");
        add_entry(tc, config, "ldimp", "");
        add_entry(tc, config, "ldinstflags", "-pg");
        add_entry(tc, config, "ldlibs", " -L/usr/local/lib -lffi -ltommath -latomic_ops -luv -lm -lpthread -lkvm");
        add_entry(tc, config, "ldmiscflags", "");
        add_entry(tc, config, "ldoptiflags", "-O3 -DNDEBUG");
        add_entry(tc, config, "ldout", "-o ");
        add_entry(tc, config, "ldrpath", "-Wl,-rpath,\"//usr/pkg/lib\"");
        add_entry(tc, config, "ldrpath_relocatable", "-Wl,-z,origin,-rpath,'$$ORIGIN/../lib'");
        add_entry(tc, config, "ldshared", "-shared -fPIC");
        add_entry(tc, config, "ldsys", "-l%s");
        add_entry(tc, config, "ldusr", "-l%s");
        add_entry(tc, config, "lib", "lib%s.a");
        add_entry(tc, config, "libdir", "/usr/pkg/lib");
        add_entry(tc, config, "lincludes", " -L/usr/local/lib");
        add_entry(tc, config, "mainflags", "-DMVM_SHARED");
        add_entry(tc, config, "mainlibs", "-L. -lmoar");
        add_entry(tc, config, "make", "make");
        add_entry(tc, config, "mastdir", "/usr/pkg/share/nqp/lib/MAST");
        add_entry(tc, config, "mkflags", "");
        add_entry(tc, config, "mknoisy", "ifneq ($(NOISY), 1)\
MSG = @echo\
CMD = @\
NOOUT = > /dev/null\
NOERR = 2> /dev/null\
endif\
");
        add_entry(tc, config, "moar", "libmoar.so");
        add_entry(tc, config, "moardll", "libmoar.so");
        add_entry(tc, config, "moarlib", "libmoar.a");
        add_entry(tc, config, "moarshared", "");
        add_entry(tc, config, "moarshared_norelocatable", "");
        add_entry(tc, config, "moarshared_relocatable", "");
        add_entry(tc, config, "mtclean", "$(RM) 3rdparty/tinymt/libtinymt.a 3rdparty/tinymt/*.o");
        add_entry(tc, config, "mtlib", "3rdparty/tinymt/libtinymt.a");
        add_entry(tc, config, "mtobjects", "3rdparty/tinymt/tinymt64.o");
        add_entry(tc, config, "mtrule", "$(AR) $(ARFLAGS) $@ 3rdparty/tinymt/*.o");
        add_entry(tc, config, "name", "moar");
        add_entry(tc, config, "nativecall_backend", "libffi");
        add_entry(tc, config, "noreturnattribute", "__attribute__((noreturn))");
        add_entry(tc, config, "noreturnspecifier", "");
        add_entry(tc, config, "nul", "/dev/null");
        add_entry(tc, config, "obj", ".o");
        add_entry(tc, config, "objflags", "-DMVM_BUILD_SHARED -fPIC");
        add_entry(tc, config, "objout", "-o ");
        add_entry(tc, config, "os", "netbsd");
        add_entry(tc, config, "osname", "netbsd");
        add_entry(tc, config, "osvers", "9.0");
        add_entry(tc, config, "perl", "/usr/pkg/bin/perl");
        add_entry(tc, config, "pkgconfig", "/usr/bin/pkg-config");
        add_entry(tc, config, "platform", "$(PLATFORM_POSIX)");
        add_entry(tc, config, "prefix", "/usr/pkg");
        add_entry(tc, config, "ptr_size", "8");
        add_entry(tc, config, "rm", "rm -f");
        add_entry(tc, config, "sh", "/bin/sh");
        add_entry(tc, config, "shaclean", "$(RM) 3rdparty/sha1/libsha1.a 3rdparty/sha1/*.o");
        add_entry(tc, config, "shaincludedir", "3rdparty/sha1");
        add_entry(tc, config, "shalib", "3rdparty/sha1/libsha1.a");
        add_entry(tc, config, "shaobjects", "3rdparty/sha1/sha1.o");
        add_entry(tc, config, "sharedlib", "");
        add_entry(tc, config, "sharule", "$(AR) $(ARFLAGS) $@ 3rdparty/sha1/*.o");
        add_entry(tc, config, "static_inline", "static __inline__");
        add_entry(tc, config, "staticlib", "");
        add_entry(tc, config, "syslibs[0]", "m");
        add_entry(tc, config, "syslibs[1]", "pthread");
        add_entry(tc, config, "syslibs[2]", "kvm");
        add_entry(tc, config, "thirdpartylibs", "3rdparty/cmp/libcmp.a 3rdparty/tinymt/libtinymt.a 3rdparty/sha1/libsha1.a");
        add_entry(tc, config, "tomclean", "@:");
        add_entry(tc, config, "tomlib", "__tom__");
        add_entry(tc, config, "tomobjects", "");
        add_entry(tc, config, "tomrule", "@:");
        add_entry(tc, config, "translate_newline_output", "0");
        add_entry(tc, config, "usrlibs[0]", "ffi");
        add_entry(tc, config, "usrlibs[1]", "tommath");
        add_entry(tc, config, "usrlibs[2]", "atomic_ops");
        add_entry(tc, config, "usrlibs[3]", "uv");
        add_entry(tc, config, "uvclean", "@:");
        add_entry(tc, config, "uvlib", "__uv__");
        add_entry(tc, config, "uvobjects", "");
        add_entry(tc, config, "uvrule", "@:");
        add_entry(tc, config, "vectorizerspecifier", "");
        add_entry(tc, config, "version", "2019.07.1");
        add_entry(tc, config, "versionmajor", "2019");
        add_entry(tc, config, "versionminor", "07");
        add_entry(tc, config, "versionpatch", "0");

    });
    tc->instance->cached_backend_config = config;

    return config;
}
