Re: fixing AC_OPENMP for Apple clang

Dima Pasechnik <[email protected]> Tue, 3 Mar 2026 22:17:08 -0600
Newsgroups gmane.comp.sysutils.autoconf.general
Message-ID <aaeyRMBhUYv3dKM1@tarski>
--ZR0EZH+xJRQ5NaFD
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Mar 04, 2026 at 01:33:10AM +0100, Bruno Haible wrote:
> See also the ticket <https://savannah.gnu.org/support/?111055>.
> There, two facts were mentioned:
>=20
> * While libtool (version 2.5.3) does not support "-Xpreprocessor -fopenmp=
",
>   it does support "-Wp,-fopenmp".
>=20
> * On macOS 26.2, with cc being "Apple clang version 17.0.0 (clang-1700.6.=
3.2)",
>   "cc -help" reports that the option '-fopenmp' exists.
>   Therefore it looks like trying "-Wp,-fopenmp" is only needed for older
>   versions of Apple clang (which ones?).

Apple lies to us here!
I have "Apple clang version 17.0.0 (clang-1700.6.3.2)" on the latest versio=
n of Intel macOS=20

  % uname -a
  Darwin OUCL13243.local 24.6.0 Darwin Kernel Version 24.6.0: Mon Jan 19 22=
:00:10 PST 2026; root:xnu-11417.140.69.708.3~1/RELEASE_X86_64 x86_64

  % cc -v
  Apple clang version 17.0.0 (clang-1700.6.3.2)
  Target: x86_64-apple-darwin24.6.0
  Thread model: posix
  InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/Xcode=
Default.xctoolchain/usr/bin

and "cc -help" reports that "-fopenmp" is an option,

   % cc --help | grep "fopenmp "
  -fopenmp                Parse OpenMP pragmas and generate parallel code.


yet it does not work:

% cat foo.c
#include <stdio.h>

% cc -c foo.c -fopenmp
clang: error: unsupported option '-fopenmp'

% cc -c foo.c -Xclang -fopenmp # this is OK
% cc -c foo.c -Xpreprocessor -fopenmp # OK too

And I do have reports from people running the latest macOS 26 and clang
17.0.0, who say the same, that "-fopenmp" doesn't work with the extra
prefix of "-Xpreprocessor".


By the way, does anyone here knows the difference between "-Xpreprocessor" =
and "-Xclang" ?

Dima


>=20
> Bruno
>=20
>=20
>=20

--ZR0EZH+xJRQ5NaFD
Content-Type: application/pgp-signature; name=signature.asc

-----BEGIN PGP SIGNATURE-----

iQFPBAABCAA5FiEEJVdDnfI7raAa4RJxoksLHjfJBTEFAmmnskEbFIAAAAAABAAO
bWFudTIsMi41KzEuMTEsMiwyAAoJEKJLCx43yQUxVGwH/2ZyMT/M/H900B3SaOi4
lKTz0roSX0rhUtiKSmkPp75OkiDfn8CsHO0tT33D3st8vjo4YlEtYulxzFdkBQb2
+NQneznWNJjSxCmGFLDIJ864IgDWqIpWvanDqKq69byS/95E9Lj4uzBf9xmrMqrB
42YrBiL8cv976mhNM+VU89apdaTQtIpqelNMMYunNrv15/qtQ0LG1mKgJ3trKH5A
besKOV76uTa9yNGStplSL4lD2Gg+ZQxbLJ892wr+6WXwlF/cq73tZsaYWS6+SjDI
8ckwp8XEHEXr9kvtLwVZJJAmLGQ/odbQaiVptw5+j5Ue808FE6h4a3TgY2Sel6k/
paQ=
=BwcZ
-----END PGP SIGNATURE-----

--ZR0EZH+xJRQ5NaFD--