fixing AC_OPENMP for Apple clang
Dima Pasechnik <[email protected]> Sun, 1 Mar 2026 22:10:41 -0600
| Newsgroups | gmane.comp.sysutils.autoconf.general |
|---|---|
| Message-ID | <aaUNwVZZngdl3_FP@tarski> |
--Ja3Fm9vgcP7Mf+7l
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
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=3Domp -h=
omp \
-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 e=
xplicitly link with "-lomp".=20
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 ("-Xpreproces=
sor -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
--Ja3Fm9vgcP7Mf+7l
Content-Type: application/pgp-signature; name=signature.asc
-----BEGIN PGP SIGNATURE-----
iQFPBAABCAA5FiEEJVdDnfI7raAa4RJxoksLHjfJBTEFAmmlDb0bFIAAAAAABAAO
bWFudTIsMi41KzEuMTEsMiwyAAoJEKJLCx43yQUx5KUIAMN/MNUhfwkBm9lgYlPH
AXa/HhqWBs99oTDwIcD9prHa0/Gm+e8mU1zPkg7rOlWvpHg7YthhjYOh8Qie+7aL
dhz4thGBRBdK7RtgTBzMAZwcT2lvv8IITQqlDrFe6AwPvWaJ1Tio2Nw6UN6e+xsh
jC93pjPnyv7D8q8ZloengEVWEkNv4xG+9HXdBI82lB33GfS4AZ//CZV4JEjuIW6N
VsJPOh3NEJ0zPrcpglqM2rHLuCNIy9Grjvzrcq/CmoBBYPQHQRJZ3zt4WWBrzodQ
vR4dHoYvaWE70/YieKJECQ6iRHHF18duNForknw3DJuvNcofRDFCLHa4wjL9JOXC
Lic=
=kQDQ
-----END PGP SIGNATURE-----
--Ja3Fm9vgcP7Mf+7l--