--- orig/tools/clang/lib/Driver/Tools.cpp 2015-09-03 11:39:15.000000000 -0500 +++ fixed/tools/clang/lib/Driver/Tools.cpp 2015-09-03 11:44:09.000000000 -0500 @@ -2471,12 +2471,18 @@ switch (getOpenMPRuntime(TC, Args)) { case OMPRT_OMP: + // Automatically find MacPorts' libomp + CmdArgs.push_back("-L@@PREFIX@@/lib/libomp"); CmdArgs.push_back("-lomp"); break; case OMPRT_GOMP: + // Automatically find MacPorts' libgomp (libomp) + CmdArgs.push_back("-L@@PREFIX@@/lib/libomp"); CmdArgs.push_back("-lgomp"); break; case OMPRT_IOMP5: + // Automatically find MacPorts' libiomp (libomp) + CmdArgs.push_back("-L@@PREFIX@@/lib/libomp"); CmdArgs.push_back("-liomp5"); break; case OMPRT_Unknown: @@ -4089,6 +4095,8 @@ case OMPRT_OMP: case OMPRT_IOMP5: // Clang can generate useful OpenMP code for these two runtime libraries. + // Automatically find MacPorts' omp.h + CmdArgs.push_back("-I@@PREFIX@@/include/libomp"); CmdArgs.push_back("-fopenmp"); // If no option regarding the use of TLS in OpenMP codegeneration is @@ -8261,9 +8269,13 @@ // Also link the particular OpenMP runtimes. switch (getOpenMPRuntime(ToolChain, Args)) { case OMPRT_OMP: + // Automatically find MacPorts' libomp + CmdArgs.push_back("-L@@PREFIX@@/lib/libomp"); CmdArgs.push_back("-lomp"); break; case OMPRT_GOMP: + // Automatically find MacPorts' libgomp (libomp) + CmdArgs.push_back("-L@@PREFIX@@/lib/libomp"); CmdArgs.push_back("-lgomp"); // FIXME: Exclude this for platforms with libgomp that don't require @@ -8271,6 +8283,8 @@ CmdArgs.push_back("-lrt"); break; case OMPRT_IOMP5: + // Automatically find MacPorts' libiomp5 (libomp) + CmdArgs.push_back("-L@@PREFIX@@/lib/libomp"); CmdArgs.push_back("-liomp5"); break; case OMPRT_Unknown: