find libc and zig std lib at runtime

this removes the following configure options:
 * ZIG_LIBC_LIB_DIR
 * ZIG_LIBC_STATIC_LIB_DIR
 * ZIG_LIBC_INCLUDE_DIR
 * ZIG_DYNAMIC_LINKER
 * ZIG_EACH_LIB_RPATH
 * zig's reliance on CMAKE_INSTALL_PREFIX

these options are still available as command line options, however,
the default will attempt to execute the system's C compiler to
collect system defaults for these values.

closes #870
This commit is contained in:
Andrew Kelley
2018-03-30 17:10:54 -04:00
parent f586acabdc
commit b01c50d6fa
9 changed files with 171 additions and 57 deletions

View File

@@ -112,10 +112,10 @@ CodeGen *codegen_create(Buf *root_src_path, const ZigTarget *target, OutType out
// that's for native compilation
g->zig_target = *target;
resolve_target_object_format(&g->zig_target);
g->dynamic_linker = buf_create_from_str("");
g->libc_lib_dir = buf_create_from_str("");
g->libc_static_lib_dir = buf_create_from_str("");
g->libc_include_dir = buf_create_from_str("");
g->dynamic_linker = nullptr;
g->libc_lib_dir = nullptr;
g->libc_static_lib_dir = nullptr;
g->libc_include_dir = nullptr;
g->msvc_lib_dir = nullptr;
g->kernel32_lib_dir = nullptr;
g->each_lib_rpath = false;
@@ -123,16 +123,13 @@ CodeGen *codegen_create(Buf *root_src_path, const ZigTarget *target, OutType out
// native compilation, we can rely on the configuration stuff
g->is_native_target = true;
get_native_target(&g->zig_target);
g->dynamic_linker = buf_create_from_str(ZIG_DYNAMIC_LINKER);
g->libc_lib_dir = buf_create_from_str(ZIG_LIBC_LIB_DIR);
g->libc_static_lib_dir = buf_create_from_str(ZIG_LIBC_STATIC_LIB_DIR);
g->libc_include_dir = buf_create_from_str(ZIG_LIBC_INCLUDE_DIR);
g->dynamic_linker = nullptr; // find it at runtime
g->libc_lib_dir = nullptr; // find it at runtime
g->libc_static_lib_dir = nullptr; // find it at runtime
g->libc_include_dir = nullptr; // find it at runtime
g->msvc_lib_dir = nullptr; // find it at runtime
g->kernel32_lib_dir = nullptr; // find it at runtime
#ifdef ZIG_EACH_LIB_RPATH
g->each_lib_rpath = true;
#endif
if (g->zig_target.os == OsMacOSX ||
g->zig_target.os == OsIOS)