Re: fixing AC_OPENMP for Apple clang
Dima Pasechnik <[email protected]> Mon, 2 Mar 2026 12:43:30 -0600
| Newsgroups | gmane.comp.sysutils.autoconf.general |
|---|---|
| Message-ID | <aaXaUqlnce7ddLkM@tarski> |
--YS+FTSAGj2dkD3Ko Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Mar 02, 2026 at 12:55:43PM -0500, Ben Boeckel wrote: > On Mon, Mar 02, 2026 at 19:07:26 +0200, Andrew W. Nosenko wrote: > > On Mon, 2 Mar 2026 at 18:14, Dima Pasechnik <[email protected]> wrote: > > > Homebrew is the de-facto macOS package manager (supported by Apple, in > > > fact, albeit not > > > too publicly), see https://brew.sh/ > >=20 > > Sorry, but I slightly confused now, what OS do you targeting? Because I > > use Clang (installed from MacPorts) + Autotools on macOS without any ex= tra > > dances, just with regular AC_OPENMP, which results in plain -fopenmp, f= or > > years (just since Clang obtained OpenMP support) >=20 > Xcode's Clang build uses its own versioning scheme. MacPorts' Clang is > upstream Clang and its versioning scheme. Indeed, I am talking about the "native" Apple clang (which they aliased to gcc, to make it even more confusing), the one that comes with Apple's XC= ode suite. % gcc -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/XcodeDe= fault.xctoolchain/usr/bin % clang -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/XcodeDe= fault.xctoolchain/usr/bin It does need "-Xpreprocessor -fopenmp": % echo "#include <stdio.h>" > foo.c=20 % clang -fopenmp -c foo.c # oops... clang: error: unsupported option '-fopenmp' % % clang -Xpreprocessor -fopenmp -c foo.c # is OK. % Homebrew, just as MacPorts, allows one to install the llvm (upstream) clang. % /usr/local/opt/llvm/bin/clang -v Homebrew clang version 22.1.0 Target: x86_64-apple-darwin24.6.0 Thread model: posix InstalledDir: /usr/local/Cellar/llvm/22.1.0/bin Configuration file: /usr/local/etc/clang/x86_64-apple-darwin24.cfg System configuration file directory: /usr/local/etc/clang User configuration file directory: /Users/dima/.config/clang And it doesn't mind the normal "-fopenmp" option: % /usr/local/opt/llvm/bin/clang -fopenmp -c foo.c # is OK. % HTH Dima --YS+FTSAGj2dkD3Ko Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQFPBAABCAA5FiEEJVdDnfI7raAa4RJxoksLHjfJBTEFAmml2k4bFIAAAAAABAAO bWFudTIsMi41KzEuMTEsMiwyAAoJEKJLCx43yQUx8A0H/3VGu3bbtgzVNXwITaur Lb69usonGSJ5Oozi6x/nJm+b2cz2U/Xgb/WpNPmjqi49cA5xbPrZEBp0sPp+nvPA PF03AqvTV4cwgsUH/2t91FJQT+DjlZbatdnX5PZMXQi+BVCC2rILmaNConNq/f4W tgImraHnELgnZxc5RyIsIoso2eVnE+tTSqFTEfrqVdcWcQ8rmk7b5H0WASOTUo6d nac0gPxGeJVkcgrFKAaQ8G7z7yF8qC47ejM0gt7YUZ4FsyEll8WQ9kuOoIEwiiqD 2kVIqTljjcbBaaUBgd8EYDUBrklHIgZH83KW1OlwXz4StAVaYFJR8EAckD2UfTOa pJw= =NLVh -----END PGP SIGNATURE----- --YS+FTSAGj2dkD3Ko--