Re: fixing AC_OPENMP for Apple clang

Jacob Bachmeyer <[email protected]> Sat, 4 Apr 2026 19:17:10 -0500
Newsgroups gmane.comp.sysutils.autoconf.general
Message-ID <[email protected]>
On 4/4/26 11:09, Dima Pasechnik wrote:
> On Sat, Apr 04, 2026 at 10:18:59AM -0400, Zack Weinberg wrote:
>> On Sat, Apr 4, 2026, at 12:07 AM, Dima Pasechnik wrote:
>>> 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.
>> ...
>>> 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?
>> Yes, this should be clarified.  However, the reason it's not documented right now is that it was assumed the rest of the configure script *wouldn't need to know* whether OpenMP support is actually available or not.  That information is available to the *program* by checking whether the preprocessor macro `_OPENMP` is defined, and the people who wrote AC_OPENMP originally (before my time) assumed that was good enough.
> Some legacy code we have uses GNU gengetopt to set up options for an
> interactive code at configure time, by filling an .ggo.in template,
> so it needs to know whether to emable an OpenMP-related option or not.
> Testing $ac_cv_prog_c_openmp is the most natural thing to do in this
> case, it seems.

Would it be possible to test if _OPENMP is defined by using the C 
preprocessor on the template?


-- Jacob