On Mon, Mar 02, 2026 at 10:14:10AM -0600, Dima Pasechnik wrote:
>
> On Mon, Mar 02, 2026 at 09:44:08AM -0500, Zack Weinberg wrote:
> > 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".
> >
[...]
> > 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).
>
> Apologies - I should have looked more carefully in c.m4,
> before making statements about the linking issue.
> Great, this makes the job to be done smaller.
>
> >
> > 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.
>
> A patch is coming.What I am confused about is that there seems to be no way in the current AC_OPENMP to tell whether the call was a success. Note that there is case in the macro where no flags are needed. Then the test may succeed, or may fail. To quote the manual: "OPENMP_CFLAGS is set to empty if the compiler already supports OpenMP, if it has no way to activate OpenMP support, or if the user rejects OpenMP support by invoking ‘configure’ with the ‘--disable-openmp’ option." [...] This macro caches its result in the ac_cv_prog_c_openmp, ac_cv_prog_cxx_openmp, ac_cv_prog_f77_openmp, or ac_cv_prog_fc_openmp variable, depending on the current language. Only by reading the macro code, or by doing a trial run and looking at config.log, one can conclude that to test for failure (say, with current language C) one has to test ac_cv_prog_c_openmp for being equal to 'unsupported'. Should the manual be more clear on this? Best, Dima
signature.asc
Description: PGP signature
