Detecting that a language compiler is not found

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Detecting that a language compiler is not found

Reuben Thomas
I have AC_PROG_OBJCXX in my On a system that lacks an
Objective C++ compiler, but has g++, this happily sets OBJCXX=g++.

Later, I have a stanza that looks like this:

AC_LANG_PUSH([Objective C++])
... some stuff ...
AC_LANG_POP([Objective C++])

On a system without an Objective C++ compiler, it gives an error:

checking how to run the Objective C++ preprocessor... /lib/cpp
configure: error: in `/home/rrt/enchant-src':
configure: error: Objective C++ preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details

This turns out to be because there is no such file /lib/cpp. I understand
that OBJCXXCPP is set to /lib/cpp as a default (this is documented in the
autoconf manual). However, this is conceivably a valid value.

In config.log, I see several times:

g++: error: Objective-C++ compiler not installed on this system

However, this information does not seem to be communicated in any obvious
way that I can use in

How can I detect that no Objective C++ compiler was found, and therefore
not run the failing test?

(In principle, the question applies to other languages, as I can't see how
to tell no C, C++ etc. compiler was found either.)

​I'm a bit puzzled as to why this is not more obvious, except that I guess
that particular languages are usually mandatory (as opposed to my project,
in which Objective C++ is only required for an optional part), and hence
it's not something one would need to detect, as configuration will fail

The closest thing I can see is


But this does not appear to be something documented.