Hi Dima, Please keep me in CC, since I am not subscribed to this mailing list.
Dima Pasechnik wrote in <https://lists.gnu.org/archive/html/autoconf/2026-10/msg00000.html>: > for AC_OPENMP which allows for Apple clang > to be configured to use OpenMP I am opposing this patch, for two reasons: 1) This is pointless, because Apple clang *does not* support OpenMP. On the cfarm104.cfarm.net there is now a newer 'cc' than in March 2026, but it has the same problem: $ cc -v Apple clang version 21.0.0 (clang-2100.1.1.101) Target: arm64-apple-darwin25.5.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin $ cc --help | grep "fopenmp " -fopenmp Parse OpenMP pragmas and generate parallel code. $ cat foo.c #include <omp.h> int main (void) { return omp_get_num_threads (); } $ cc -fopenmp foo.c clang: error: unsupported option '-fopenmp' clang: error: unsupported option '-fopenmp' $ cc -Xpreprocessor -fopenmp foo.c foo.c:1:12: fatal error: 'omp.h' file not found 1 | #include <omp.h> | ^~~~~~~ 1 error generated. $ find /Library/Developer/CommandLineTools -name omp.h | wc -l 0 So this cc - does not understand the advertised command-line option, - does not have the required header file <omp.h>. Since an OpenMP implementation needs three parts: - header files, - code generation routines for '#pragma omp' in the compiler, - a library, it is pointless to expect that you can make OpenMP work with this compiler. > On macOS (with Homebrew installed) > one has to jump a few hoops, as libomp is not installed in a location > known to the toolchain: But what about the code generation routines for '#pragma omp' in the compiler? You can't add them to Apple's cc by installing Homebrew. 2) The patch makes an incompatible change to the interface: > The > + new output variables OPENMP_CLIBS, OPENMP_CXXLIBS, OPENMP_FLIBS, and > + OPENMP_FCLIBS report any additional library needed for the current > language. > + Packages using AC_OPENMP should add the corresponding variable to their > OpenMP > + link commands after the object files. This is not backward compatible. The Autoconf documentation states that the link requirement for use of AC_OPENMP is $(OPENMP_CFLAGS). Adding another link requirement ($(OPENMP_CLIBS)) for the same thing will break existing Makefiles. And actually, for your attempted case it is not needed, because you wrote: > configure_options="CPPFLAGS=-I/opt/homebrew/opt/libomp/include > LDFLAGS=-L/opt/homebrew/opt/libomp/lib"' and $(LDFLAGS) are already used for linking. So, this patch is wrong on two accounts. If you want OpenMP support on macOS, just use gcc or upstream clang, not Apple clang. Bruno
