/// \brief Get our best guess at the multiarch triple for a target. /// /// Debian-based systems are starting to use a multiarch setup where they use /// a target-triple directory in the library and header search paths. /// Unfortunately, this triple does not align with the vanilla target triple, /// so we provide a rough mapping here. static std::string getMultiarchTriple(const Driver &D, const llvm::Triple &TargetTriple, StringRef SysRoot) { llvm::Triple::EnvironmentType TargetEnvironment = TargetTriple.getEnvironment(); // For most architectures, just use whatever we have rather than trying to be // clever. switch (TargetTriple.getArch()) { default: break; // We use the existence of '/lib/<triple>' as a directory to detect some // common linux triples that don't quite match the Clang triple for both // 32-bit and 64-bit targets. Multiarch fixes its install triples to these // regardless of what the actual target triple is. case llvm::Triple::arm: case llvm::Triple::thumb: if (TargetEnvironment == llvm::Triple::GNUEABIHF) { if (D.getVFS().exists(SysRoot + "/lib/arm-linux-gnueabihf")) return "arm-linux-gnueabihf"; } else { if (D.getVFS().exists(SysRoot + "/lib/arm-linux-gnueabi")) return "arm-linux-gnueabi"; } break; case llvm::Triple::armeb: case llvm::Triple::thumbeb: if (TargetEnvironment == llvm::Triple::GNUEABIHF) { if (D.getVFS().exists(SysRoot + "/lib/armeb-linux-gnueabihf")) return "armeb-linux-gnueabihf"; } else { if (D.getVFS().exists(SysRoot + "/lib/armeb-linux-gnueabi")) return "armeb-linux-gnueabi"; } break; case llvm::Triple::x86: if (D.getVFS().exists(SysRoot + "/lib/i386-linux-gnu")) return "i386-linux-gnu"; break; case llvm::Triple::x86_64: // We don't want this for x32, otherwise it will match x86_64 libs if (TargetEnvironment != llvm::Triple::GNUX32 && D.getVFS().exists(SysRoot + "/lib/x86_64-linux-gnu")) return "x86_64-linux-gnu"; break; case llvm::Triple::aarch64: if (D.getVFS().exists(SysRoot + "/lib/aarch64-linux-gnu")) return "aarch64-linux-gnu"; break; case llvm::Triple::aarch64_be: if (D.getVFS().exists(SysRoot + "/lib/aarch64_be-linux-gnu")) return "aarch64_be-linux-gnu"; break; case llvm::Triple::mips: if (D.getVFS().exists(SysRoot + "/lib/mips-linux-gnu")) return "mips-linux-gnu"; break; case llvm::Triple::mipsel: if (D.getVFS().exists(SysRoot + "/lib/mipsel-linux-gnu")) return "mipsel-linux-gnu"; break; case llvm::Triple::mips64: if (D.getVFS().exists(SysRoot + "/lib/mips64-linux-gnu")) return "mips64-linux-gnu"; if (D.getVFS().exists(SysRoot + "/lib/mips64-linux-gnuabi64")) return "mips64-linux-gnuabi64"; break; case llvm::Triple::mips64el: if (D.getVFS().exists(SysRoot + "/lib/mips64el-linux-gnu")) return "mips64el-linux-gnu"; if (D.getVFS().exists(SysRoot + "/lib/mips64el-linux-gnuabi64")) return "mips64el-linux-gnuabi64"; break; case llvm::Triple::ppc: if (D.getVFS().exists(SysRoot + "/lib/powerpc-linux-gnuspe")) return "powerpc-linux-gnuspe"; if (D.getVFS().exists(SysRoot + "/lib/powerpc-linux-gnu")) return "powerpc-linux-gnu"; break; case llvm::Triple::ppc64: if (D.getVFS().exists(SysRoot + "/lib/powerpc64-linux-gnu")) return "powerpc64-linux-gnu"; break; case llvm::Triple::ppc64le: if (D.getVFS().exists(SysRoot + "/lib/powerpc64le-linux-gnu")) return "powerpc64le-linux-gnu"; break; case llvm::Triple::sparc: if (D.getVFS().exists(SysRoot + "/lib/sparc-linux-gnu")) return "sparc-linux-gnu"; break; case llvm::Triple::sparcv9: if (D.getVFS().exists(SysRoot + "/lib/sparc64-linux-gnu")) return "sparc64-linux-gnu"; break; case llvm::Triple::systemz: if (D.getVFS().exists(SysRoot + "/lib/s390x-linux-gnu")) return "s390x-linux-gnu"; break; } return TargetTriple.str(); }
void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple, const HeaderSearchOptions &HSOpts) { llvm::Triple::OSType os = triple.getOS(); if (HSOpts.UseStandardSystemIncludes) { switch (os) { case llvm::Triple::CloudABI: case llvm::Triple::FreeBSD: case llvm::Triple::NetBSD: case llvm::Triple::OpenBSD: case llvm::Triple::NaCl: case llvm::Triple::PS4: case llvm::Triple::ELFIAMCU: break; case llvm::Triple::Win32: if (triple.getEnvironment() != llvm::Triple::Cygnus) break; LLVM_FALLTHROUGH; default: // FIXME: temporary hack: hard-coded paths. AddPath("/usr/local/include", System, false); break; } } // Builtin includes use #include_next directives and should be positioned // just prior C include dirs. if (HSOpts.UseBuiltinIncludes) { // Ignore the sys root, we *always* look for clang headers relative to // supplied path. SmallString<128> P = StringRef(HSOpts.ResourceDir); llvm::sys::path::append(P, "include"); AddUnmappedPath(P, ExternCSystem, false); } // All remaining additions are for system include directories, early exit if // we aren't using them. if (!HSOpts.UseStandardSystemIncludes) return; // Add dirs specified via 'configure --with-c-include-dirs'. StringRef CIncludeDirs(C_INCLUDE_DIRS); if (CIncludeDirs != "") { SmallVector<StringRef, 5> dirs; CIncludeDirs.split(dirs, ":"); for (StringRef dir : dirs) AddPath(dir, ExternCSystem, false); return; } switch (os) { case llvm::Triple::Linux: case llvm::Triple::Solaris: llvm_unreachable("Include management is handled in the driver."); case llvm::Triple::CloudABI: { // <sysroot>/<triple>/include SmallString<128> P = StringRef(HSOpts.ResourceDir); llvm::sys::path::append(P, "../../..", triple.str(), "include"); AddPath(P, System, false); break; } case llvm::Triple::Haiku: AddPath("/boot/system/non-packaged/develop/headers", System, false); AddPath("/boot/system/develop/headers/os", System, false); AddPath("/boot/system/develop/headers/os/app", System, false); AddPath("/boot/system/develop/headers/os/arch", System, false); AddPath("/boot/system/develop/headers/os/device", System, false); AddPath("/boot/system/develop/headers/os/drivers", System, false); AddPath("/boot/system/develop/headers/os/game", System, false); AddPath("/boot/system/develop/headers/os/interface", System, false); AddPath("/boot/system/develop/headers/os/kernel", System, false); AddPath("/boot/system/develop/headers/os/locale", System, false); AddPath("/boot/system/develop/headers/os/mail", System, false); AddPath("/boot/system/develop/headers/os/media", System, false); AddPath("/boot/system/develop/headers/os/midi", System, false); AddPath("/boot/system/develop/headers/os/midi2", System, false); AddPath("/boot/system/develop/headers/os/net", System, false); AddPath("/boot/system/develop/headers/os/opengl", System, false); AddPath("/boot/system/develop/headers/os/storage", System, false); AddPath("/boot/system/develop/headers/os/support", System, false); AddPath("/boot/system/develop/headers/os/translation", System, false); AddPath("/boot/system/develop/headers/os/add-ons/graphics", System, false); AddPath("/boot/system/develop/headers/os/add-ons/input_server", System, false); AddPath("/boot/system/develop/headers/os/add-ons/mail_daemon", System, false); AddPath("/boot/system/develop/headers/os/add-ons/registrar", System, false); AddPath("/boot/system/develop/headers/os/add-ons/screen_saver", System, false); AddPath("/boot/system/develop/headers/os/add-ons/tracker", System, false); AddPath("/boot/system/develop/headers/os/be_apps/Deskbar", System, false); AddPath("/boot/system/develop/headers/os/be_apps/NetPositive", System, false); AddPath("/boot/system/develop/headers/os/be_apps/Tracker", System, false); AddPath("/boot/system/develop/headers/3rdparty", System, false); AddPath("/boot/system/develop/headers/bsd", System, false); AddPath("/boot/system/develop/headers/glibc", System, false); AddPath("/boot/system/develop/headers/posix", System, false); AddPath("/boot/system/develop/headers", System, false); break; case llvm::Triple::RTEMS: break; case llvm::Triple::Win32: switch (triple.getEnvironment()) { default: llvm_unreachable("Include management is handled in the driver."); case llvm::Triple::Cygnus: AddPath("/usr/include/w32api", System, false); break; case llvm::Triple::GNU: break; } break; default: break; } switch (os) { case llvm::Triple::CloudABI: case llvm::Triple::RTEMS: case llvm::Triple::NaCl: case llvm::Triple::ELFIAMCU: break; case llvm::Triple::PS4: { // <isysroot> gets prepended later in AddPath(). std::string BaseSDKPath = ""; if (!HasSysroot) { const char *envValue = getenv("SCE_ORBIS_SDK_DIR"); if (envValue) BaseSDKPath = envValue; else { // HSOpts.ResourceDir variable contains the location of Clang's // resource files. // Assuming that Clang is configured for PS4 without // --with-clang-resource-dir option, the location of Clang's resource // files is <SDK_DIR>/host_tools/lib/clang SmallString<128> P = StringRef(HSOpts.ResourceDir); llvm::sys::path::append(P, "../../.."); BaseSDKPath = P.str(); } } AddPath(BaseSDKPath + "/target/include", System, false); if (triple.isPS4CPU()) AddPath(BaseSDKPath + "/target/include_common", System, false); LLVM_FALLTHROUGH; } default: AddPath("/usr/include", ExternCSystem, false); break; } }
void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple, const HeaderSearchOptions &HSOpts) { llvm::Triple::OSType os = triple.getOS(); if (HSOpts.UseStandardSystemIncludes) { switch (os) { case llvm::Triple::CloudABI: case llvm::Triple::FreeBSD: case llvm::Triple::NetBSD: case llvm::Triple::OpenBSD: case llvm::Triple::Bitrig: case llvm::Triple::NaCl: break; case llvm::Triple::Win32: if (triple.getEnvironment() != llvm::Triple::Cygnus) break; default: // FIXME: temporary hack: hard-coded paths. AddPath("/usr/local/include", System, false); break; } } // Builtin includes use #include_next directives and should be positioned // just prior C include dirs. if (HSOpts.UseBuiltinIncludes) { // Ignore the sys root, we *always* look for clang headers relative to // supplied path. SmallString<128> P = StringRef(HSOpts.ResourceDir); llvm::sys::path::append(P, "include"); AddUnmappedPath(P, ExternCSystem, false); } // All remaining additions are for system include directories, early exit if // we aren't using them. if (!HSOpts.UseStandardSystemIncludes) return; // Add dirs specified via 'configure --with-c-include-dirs'. StringRef CIncludeDirs(C_INCLUDE_DIRS); if (CIncludeDirs != "") { SmallVector<StringRef, 5> dirs; CIncludeDirs.split(dirs, ":"); for (SmallVectorImpl<StringRef>::iterator i = dirs.begin(); i != dirs.end(); ++i) AddPath(*i, ExternCSystem, false); return; } switch (os) { case llvm::Triple::Linux: llvm_unreachable("Include management is handled in the driver."); case llvm::Triple::CloudABI: { // <sysroot>/<triple>/include SmallString<128> P = StringRef(HSOpts.ResourceDir); llvm::sys::path::append(P, "../../..", triple.str(), "include"); AddPath(P, System, false); break; } case llvm::Triple::Haiku: AddPath("/boot/common/include", System, false); AddPath("/boot/develop/headers/os", System, false); AddPath("/boot/develop/headers/os/app", System, false); AddPath("/boot/develop/headers/os/arch", System, false); AddPath("/boot/develop/headers/os/device", System, false); AddPath("/boot/develop/headers/os/drivers", System, false); AddPath("/boot/develop/headers/os/game", System, false); AddPath("/boot/develop/headers/os/interface", System, false); AddPath("/boot/develop/headers/os/kernel", System, false); AddPath("/boot/develop/headers/os/locale", System, false); AddPath("/boot/develop/headers/os/mail", System, false); AddPath("/boot/develop/headers/os/media", System, false); AddPath("/boot/develop/headers/os/midi", System, false); AddPath("/boot/develop/headers/os/midi2", System, false); AddPath("/boot/develop/headers/os/net", System, false); AddPath("/boot/develop/headers/os/storage", System, false); AddPath("/boot/develop/headers/os/support", System, false); AddPath("/boot/develop/headers/os/translation", System, false); AddPath("/boot/develop/headers/os/add-ons/graphics", System, false); AddPath("/boot/develop/headers/os/add-ons/input_server", System, false); AddPath("/boot/develop/headers/os/add-ons/screen_saver", System, false); AddPath("/boot/develop/headers/os/add-ons/tracker", System, false); AddPath("/boot/develop/headers/os/be_apps/Deskbar", System, false); AddPath("/boot/develop/headers/os/be_apps/NetPositive", System, false); AddPath("/boot/develop/headers/os/be_apps/Tracker", System, false); AddPath("/boot/develop/headers/cpp", System, false); AddPath("/boot/develop/headers/cpp/i586-pc-haiku", System, false); AddPath("/boot/develop/headers/3rdparty", System, false); AddPath("/boot/develop/headers/bsd", System, false); AddPath("/boot/develop/headers/glibc", System, false); AddPath("/boot/develop/headers/posix", System, false); AddPath("/boot/develop/headers", System, false); break; case llvm::Triple::RTEMS: break; case llvm::Triple::Win32: switch (triple.getEnvironment()) { default: llvm_unreachable("Include management is handled in the driver."); case llvm::Triple::Cygnus: AddPath("/usr/include/w32api", System, false); break; case llvm::Triple::GNU: break; } break; default: break; } switch (os) { case llvm::Triple::CloudABI: case llvm::Triple::RTEMS: case llvm::Triple::NaCl: break; default: AddPath("/usr/include", ExternCSystem, false); break; } }
void InitHeaderSearch:: AddDefaultCPlusPlusIncludePaths(const llvm::Triple &triple, const HeaderSearchOptions &HSOpts) { llvm::Triple::OSType os = triple.getOS(); StringRef CxxIncludeRoot(CXX_INCLUDE_ROOT); if (CxxIncludeRoot != "") { StringRef CxxIncludeArch(CXX_INCLUDE_ARCH); if (CxxIncludeArch == "") AddGnuCPlusPlusIncludePaths(CxxIncludeRoot, triple.str().c_str(), CXX_INCLUDE_32BIT_DIR, CXX_INCLUDE_64BIT_DIR, triple); else AddGnuCPlusPlusIncludePaths(CxxIncludeRoot, CXX_INCLUDE_ARCH, CXX_INCLUDE_32BIT_DIR, CXX_INCLUDE_64BIT_DIR, triple); return; } // FIXME: temporary hack: hard-coded paths. if (triple.isOSDarwin()) { switch (triple.getArch()) { default: break; case llvm::Triple::ppc: case llvm::Triple::ppc64: AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1", "powerpc-apple-darwin10", "", "ppc64", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.0.0", "powerpc-apple-darwin10", "", "ppc64", triple); break; case llvm::Triple::x86: case llvm::Triple::x86_64: AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1", "i686-apple-darwin10", "", "x86_64", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.0.0", "i686-apple-darwin8", "", "", triple); break; case llvm::Triple::arm: case llvm::Triple::thumb: AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1", "arm-apple-darwin10", "v7", "", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1", "arm-apple-darwin10", "v6", "", triple); break; } return; } switch (os) { case llvm::Triple::Cygwin: // Cygwin-1.7 AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "4.3.4"); // g++-4 / Cygwin-1.5 AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "4.3.2"); // FIXME: Do we support g++-3.4.4? AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "3.4.4"); break; case llvm::Triple::MinGW32: // mingw-w64 C++ include paths (i686-w64-mingw32 and x86_64-w64-mingw32) AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.5.0"); AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.5.1"); AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.5.2"); AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.5.3"); AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.6.0"); AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.6.1"); AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.6.2"); AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.7.0"); // mingw.org C++ include paths AddMinGWCPlusPlusIncludePaths("/mingw/lib/gcc", "mingw32", "4.5.2"); //MSYS AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.5.0"); AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.4.0"); AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.3.0"); break; case llvm::Triple::DragonFly: AddPath("/usr/include/c++/4.1", CXXSystem, true, false, false); break; case llvm::Triple::Linux: //===------------------------------------------------------------------===// // Debian based distros. // Note: these distros symlink /usr/include/c++/X.Y.Z -> X.Y //===------------------------------------------------------------------===// // Ubuntu 11.11 "Oneiric Ocelot" -- gcc-4.6.0 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6", "x86_64-linux-gnu", "32", "", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6", "i686-linux-gnu", "", "64", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6", "i486-linux-gnu", "", "64", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6", "arm-linux-gnueabi", "", "", triple); // Ubuntu 11.04 "Natty Narwhal" -- gcc-4.5.2 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5", "x86_64-linux-gnu", "32", "", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5", "i686-linux-gnu", "", "64", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5", "i486-linux-gnu", "", "64", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5", "arm-linux-gnueabi", "", "", triple); // Ubuntu 10.10 "Maverick Meerkat" -- gcc-4.4.5 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4", "i686-linux-gnu", "", "64", triple); // The rest of 10.10 is the same as previous versions. // Ubuntu 10.04 LTS "Lucid Lynx" -- gcc-4.4.3 // Ubuntu 9.10 "Karmic Koala" -- gcc-4.4.1 // Debian 6.0 "squeeze" -- gcc-4.4.2 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4", "x86_64-linux-gnu", "32", "", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4", "i486-linux-gnu", "", "64", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4", "arm-linux-gnueabi", "", "", triple); // Ubuntu 9.04 "Jaunty Jackalope" -- gcc-4.3.3 // Ubuntu 8.10 "Intrepid Ibex" -- gcc-4.3.2 // Debian 5.0 "lenny" -- gcc-4.3.2 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3", "x86_64-linux-gnu", "32", "", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3", "i486-linux-gnu", "", "64", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3", "arm-linux-gnueabi", "", "", triple); // Ubuntu 8.04.4 LTS "Hardy Heron" -- gcc-4.2.4 // Ubuntu 8.04.[0-3] LTS "Hardy Heron" -- gcc-4.2.3 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2", "x86_64-linux-gnu", "32", "", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2", "i486-linux-gnu", "", "64", triple); // Ubuntu 7.10 "Gutsy Gibbon" -- gcc-4.1.3 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.1", "x86_64-linux-gnu", "32", "", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.1", "i486-linux-gnu", "", "64", triple); //===------------------------------------------------------------------===// // Redhat based distros. //===------------------------------------------------------------------===// // Fedora 15 (GCC 4.6.1) AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6.1", "x86_64-redhat-linux", "32", "", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6.1", "i686-redhat-linux", "", "", triple); // Fedora 15 (GCC 4.6.0) AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6.0", "x86_64-redhat-linux", "32", "", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6.0", "i686-redhat-linux", "", "", triple); // Fedora 14 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5.1", "x86_64-redhat-linux", "32", "", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5.1", "i686-redhat-linux", "", "", triple); // RHEL5(gcc44) AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.4", "x86_64-redhat-linux6E", "32", "", triple); // Fedora 13 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.4", "x86_64-redhat-linux", "32", "", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.4", "i686-redhat-linux","", "", triple); // Fedora 12 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.3", "x86_64-redhat-linux", "32", "", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.3", "i686-redhat-linux","", "", triple); // Fedora 12 (pre-FEB-2010) AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.2", "x86_64-redhat-linux", "32", "", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.2", "i686-redhat-linux","", "", triple); // Fedora 11 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.1", "x86_64-redhat-linux", "32", "", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.1", "i586-redhat-linux","", "", triple); // Fedora 10 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.2", "x86_64-redhat-linux", "32", "", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.2", "i386-redhat-linux","", "", triple); // Fedora 9 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.0", "x86_64-redhat-linux", "32", "", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.0", "i386-redhat-linux", "", "", triple); // Fedora 8 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.1.2", "x86_64-redhat-linux", "", "", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.1.2", "i386-redhat-linux", "", "", triple); // RHEL 5 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.1.1", "x86_64-redhat-linux", "32", "", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.1.1", "i386-redhat-linux", "", "", triple); //===------------------------------------------------------------------===// // Exherbo (2010-01-25) AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.3", "x86_64-pc-linux-gnu", "32", "", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.3", "i686-pc-linux-gnu", "", "", triple); // openSUSE 11.1 32 bit AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3", "i586-suse-linux", "", "", triple); // openSUSE 11.1 64 bit AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3", "x86_64-suse-linux", "32", "", triple); // openSUSE 11.2 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4", "i586-suse-linux", "", "", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4", "x86_64-suse-linux", "", "", triple); // openSUSE 11.4 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5", "i586-suse-linux", "", "", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5", "x86_64-suse-linux", "", "", triple); // openSUSE 12.1 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6", "i586-suse-linux", "", "", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6", "x86_64-suse-linux", "", "", triple); // Arch Linux 2008-06-24 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.1", "i686-pc-linux-gnu", "", "", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.1", "x86_64-unknown-linux-gnu", "", "", triple); // Arch Linux gcc 4.6 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6.1", "i686-pc-linux-gnu", "", "", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6.1", "x86_64-unknown-linux-gnu", "", "", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6.0", "i686-pc-linux-gnu", "", "", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6.0", "x86_64-unknown-linux-gnu", "", "", triple); // Slackware gcc 4.5.2 (13.37) AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5.2", "i486-slackware-linux", "", "", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5.2", "x86_64-slackware-linux", "", "", triple); // Slackware gcc 4.5.3 (-current) AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5.3", "i486-slackware-linux", "", "", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5.3", "x86_64-slackware-linux", "", "", triple); // Gentoo x86 gcc 4.5.2 AddGnuCPlusPlusIncludePaths( "/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/g++-v4", "i686-pc-linux-gnu", "", "", triple); // Gentoo x86 gcc 4.4.5 AddGnuCPlusPlusIncludePaths( "/usr/lib/gcc/i686-pc-linux-gnu/4.4.5/include/g++-v4", "i686-pc-linux-gnu", "", "", triple); // Gentoo x86 gcc 4.4.4 AddGnuCPlusPlusIncludePaths( "/usr/lib/gcc/i686-pc-linux-gnu/4.4.4/include/g++-v4", "i686-pc-linux-gnu", "", "", triple); // Gentoo x86 2010.0 stable AddGnuCPlusPlusIncludePaths( "/usr/lib/gcc/i686-pc-linux-gnu/4.4.3/include/g++-v4", "i686-pc-linux-gnu", "", "", triple); // Gentoo x86 2009.1 stable AddGnuCPlusPlusIncludePaths( "/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4", "i686-pc-linux-gnu", "", "", triple); // Gentoo x86 2009.0 stable AddGnuCPlusPlusIncludePaths( "/usr/lib/gcc/i686-pc-linux-gnu/4.3.2/include/g++-v4", "i686-pc-linux-gnu", "", "", triple); // Gentoo x86 2008.0 stable AddGnuCPlusPlusIncludePaths( "/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/include/g++-v4", "i686-pc-linux-gnu", "", "", triple); // Gentoo x86 llvm-gcc trunk AddGnuCPlusPlusIncludePaths( "/usr/lib/llvm-gcc-4.2-9999/include/c++/4.2.1", "i686-pc-linux-gnu", "", "", triple); // Gentoo amd64 gcc 4.5.2 AddGnuCPlusPlusIncludePaths( "/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.2/include/g++-v4", "x86_64-pc-linux-gnu", "32", "", triple); // Gentoo amd64 gcc 4.4.5 AddGnuCPlusPlusIncludePaths( "/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.5/include/g++-v4", "x86_64-pc-linux-gnu", "32", "", triple); // Gentoo amd64 gcc 4.4.4 AddGnuCPlusPlusIncludePaths( "/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.4/include/g++-v4", "x86_64-pc-linux-gnu", "32", "", triple); // Gentoo amd64 gcc 4.4.3 AddGnuCPlusPlusIncludePaths( "/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.3/include/g++-v4", "x86_64-pc-linux-gnu", "32", "", triple); // Gentoo amd64 gcc 4.3.4 AddGnuCPlusPlusIncludePaths( "/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.4/include/g++-v4", "x86_64-pc-linux-gnu", "", "", triple); // Gentoo amd64 gcc 4.3.2 AddGnuCPlusPlusIncludePaths( "/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.2/include/g++-v4", "x86_64-pc-linux-gnu", "", "", triple); // Gentoo amd64 stable AddGnuCPlusPlusIncludePaths( "/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/include/g++-v4", "x86_64-pc-linux-gnu", "", "", triple); // Gentoo amd64 llvm-gcc trunk AddGnuCPlusPlusIncludePaths( "/usr/lib/llvm-gcc-4.2-9999/include/c++/4.2.1", "x86_64-pc-linux-gnu", "", "", triple); break; case llvm::Triple::FreeBSD: // FreeBSD 8.0 // FreeBSD 7.3 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2", "", "", "", triple); break; case llvm::Triple::NetBSD: AddGnuCPlusPlusIncludePaths("/usr/include/g++", "", "", "", triple); break; case llvm::Triple::OpenBSD: { std::string t = triple.getTriple(); if (t.substr(0, 6) == "x86_64") t.replace(0, 6, "amd64"); AddGnuCPlusPlusIncludePaths("/usr/include/g++", t, "", "", triple); break; } case llvm::Triple::Minix: AddGnuCPlusPlusIncludePaths("/usr/gnu/include/c++/4.4.3", "", "", "", triple); break; case llvm::Triple::Solaris: // Solaris - Fall though.. case llvm::Triple::AuroraUX: // AuroraUX AddGnuCPlusPlusIncludePaths("/opt/gcc4/include/c++/4.2.4", "i386-pc-solaris2.11", "", "", triple); break; default: break; } }
void InitHeaderSearch::AddDefaultCPlusPlusIncludePaths(const llvm::Triple &triple) { llvm::Triple::OSType os = triple.getOS(); llvm::StringRef CxxIncludeRoot(CXX_INCLUDE_ROOT); if (CxxIncludeRoot != "") { llvm::StringRef CxxIncludeArch(CXX_INCLUDE_ARCH); if (CxxIncludeArch == "") AddGnuCPlusPlusIncludePaths(CxxIncludeRoot, triple.str().c_str(), CXX_INCLUDE_32BIT_DIR, CXX_INCLUDE_64BIT_DIR, triple); else AddGnuCPlusPlusIncludePaths(CxxIncludeRoot, CXX_INCLUDE_ARCH, CXX_INCLUDE_32BIT_DIR, CXX_INCLUDE_64BIT_DIR, triple); return; } // FIXME: temporary hack: hard-coded paths. switch (os) { case llvm::Triple::Cygwin: AddPath("/lib/gcc/i686-pc-cygwin/3.4.4/include", System, true, false, false); AddPath("/lib/gcc/i686-pc-cygwin/3.4.4/include/c++", System, true, false, false); break; case llvm::Triple::MinGW64: // Try gcc 4.4.0 AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw64", "4.4.0"); // Try gcc 4.3.0 AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw64", "4.3.0"); // Fall through. case llvm::Triple::MinGW32: // Try gcc 4.4.0 AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.4.0"); // Try gcc 4.3.0 AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.3.0"); break; case llvm::Triple::Darwin: AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1", "i686-apple-darwin10", "", "x86_64", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.0.0", "i686-apple-darwin8", "", "", triple); break; case llvm::Triple::DragonFly: AddPath("/usr/include/c++/4.1", System, true, false, false); break; case llvm::Triple::Linux: // Exherbo (2010-01-25) AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.3", "x86_64-pc-linux-gnu", "32", "", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.3", "i686-pc-linux-gnu", "", "", triple); // Debian sid AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4", "x86_64-linux-gnu", "32", "", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4", "i486-linux-gnu", "64", "", triple); // Ubuntu 7.10 - Gutsy Gibbon AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.1.3", "i486-linux-gnu", "", "", triple); // Ubuntu 9.04 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.3", "x86_64-linux-gnu","32", "", triple); // Ubuntu 9.10 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.1", "x86_64-linux-gnu", "32", "", triple); // Fedora 8 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.1.2", "i386-redhat-linux", "", "", triple); // Fedora 9 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.0", "i386-redhat-linux", "", "", triple); // Fedora 10 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.2", "i386-redhat-linux","", "", triple); // Fedora 10 x86_64 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.2", "x86_64-redhat-linux", "32", "", triple); // Fedora 11 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.1", "i586-redhat-linux","", "", triple); // Fedora 12 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.2", "i686-redhat-linux","", "", triple); // Fedora 12 (February-2010+) AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.3", "i686-redhat-linux","", "", triple); // openSUSE 11.1 32 bit AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3", "i586-suse-linux", "", "", triple); // openSUSE 11.1 64 bit AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3", "x86_64-suse-linux", "32", "", triple); // openSUSE 11.2 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4", "i586-suse-linux", "", "", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4", "x86_64-suse-linux", "", "", triple); // Arch Linux 2008-06-24 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.1", "i686-pc-linux-gnu", "", "", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.1", "x86_64-unknown-linux-gnu", "", "", triple); // Gentoo x86 2009.1 stable AddGnuCPlusPlusIncludePaths( "/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4", "i686-pc-linux-gnu", "", "", triple); // Gentoo x86 2009.0 stable AddGnuCPlusPlusIncludePaths( "/usr/lib/gcc/i686-pc-linux-gnu/4.3.2/include/g++-v4", "i686-pc-linux-gnu", "", "", triple); // Gentoo x86 2008.0 stable AddGnuCPlusPlusIncludePaths( "/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/include/g++-v4", "i686-pc-linux-gnu", "", "", triple); // Ubuntu 8.10 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3", "i486-pc-linux-gnu", "", "", triple); // Ubuntu 9.04 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3", "i486-linux-gnu","", "", triple); // Gentoo amd64 stable AddGnuCPlusPlusIncludePaths( "/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/include/g++-v4", "i686-pc-linux-gnu", "", "", triple); // Gentoo amd64 gcc 4.3.2 AddGnuCPlusPlusIncludePaths( "/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.2/include/g++-v4", "x86_64-pc-linux-gnu", "", "", triple); // Gentoo amd64 gcc 4.4.3 AddGnuCPlusPlusIncludePaths( "/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.3/include/g++-v4", "x86_64-pc-linux-gnu", "32", "", triple); break; case llvm::Triple::FreeBSD: AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2", "", "", "", triple); break; case llvm::Triple::Solaris: // Solaris - Fall though.. case llvm::Triple::AuroraUX: // AuroraUX AddGnuCPlusPlusIncludePaths("/opt/gcc4/include/c++/4.2.4", "i386-pc-solaris2.11", "", "", triple); break; default: break; } }