Hello,

Since a while, Apple clang allows OpenMP (from llvm project, GNU OpenMP
doesn't work) if one supplies an option "-Xpreprocessor -fopenmp".
The (unprefixed) option "-fopenmp" is not understood, and leads to an
error.

This is quite easy to fix: change the separator in the list

      for ac_option in '' -fopenmp -xopenmp -openmp -mp -omp -qsmp=omp -homp \
                       -Popenmp --openmp; do

and add "-Xpreprocessor -fopenmp" as one of possible values of ac_option.


A slightly harder to fix issue is that for the linker to work, one has to 
explicitly link with "-lomp". 
I am inclined to say that a linking test should be added into AC_OPENMP, by a 
call to AC_LINK_IFELSE.
I am not sure how the result of the latter test should be communicated, by 
setting a variable, i.e.
setting OPENMP_LIB / OPENMP_LIB / OPENMP_LIB to either '' or to '-lomp'?
Or is there a more uniform way?

I've implemented a similar fix for the autoconf-archive macro AX_OPENMP,
see 
https://lists.gnu.org/archive/html/autoconf-archive-maintainers/2026-02/msg00000.html

Last but not the least, GNU libtool needs a fix for this case ("-Xpreprocessor 
-fopenmp"),
too, but this one I've already got (hopefully) accepted:
https://lists.gnu.org/archive/html/libtool/2026-02/msg00003.html

I'd be happy to proceed with producing a patch, once the "-lomp" detail
has been clarified.

Best,
Dima



Attachment: signature.asc
Description: PGP signature

Reply via email to