On Sun, Mar 1, 2026, at 11:10 PM, Dima Pasechnik wrote:
> Since a while, Apple clang allows OpenMP (from llvm project, GNU
> OpenMP doesn't work) if one supplies an option "-Xpreprocessor -
> fopenmp".
I do not have an informed opinion on the "*should* we use this
undocumented mode of Apple clang" issue raised by Florian. I'm not
going to override his objection, though. Please work with him to come
to an agreement.
That said:
...
> 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
Autoconf proper cannot accept a patch to enable use of "-Xpreprocessor
-fopenmp" until it is supported in a *released* version of GNU libtool.
If any changes to Automake are necessary, those also need to happen first.
Also, no matter what, this is not going into 2.73 (which I'm hoping to
cut a release candidate for *today*).
Nonetheless, please go ahead and write and *post* your patch, so that
interested people can try it out (along with your libtool patch).
> 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.
AC_OPENMP already does a link test; the appropriate change would be, if
the compile test succeeds and the link test fails, to retry that link
test with -lomp added to LIBS (take care to restore the original value
of LIBS afterward).
Note that this retry should happen for all values of ac_option, not
just for "-Xpreprocessor -fopenmp".
> 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'?
Yes, a new AC_SUBST variable. I think it should be called
OPENMP_{_AC_LANG_PREFIX}LIBS, consistent with the existing
OPENMP_{_AC_LANG_PREFIX}FLAGS.
zw