I see, so AC_PROG_CC cannot "optionally fail"? No matter. Particularly regarding AC_PROG_CXX, I am aware that you can add a test then to check if the compiler works, but that is essentially a duplicate of what AC_PROG_CXX was supposed to do, no? As a side note, why does AC_PROG_CXX set the CXX variable to g++ even if it knows for sure that g++ doesn't exist? This is according to the documentation ( https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/C_002b_002b-Compiler.html ) > If none of those checks succeed, then as a last resort set CXX to g++ What does AC_PROG_CXX hope to achieve by setting CXX to something that it knows doesn't work? On Fri, Nov 28, 2014 at 4:34 PM, Nick Bowler <nbowler@xxxxxxxxxxxxxxxx> wrote: > Hello, > > On 2014-11-28 11:51 +0100, Shahbaz Youssefi wrote: > > The problem is that if you call AC_PROG_CXX, even if there are no C++ > > compilers, *CXX is set to g++ anyway* and the macro doesn't provide a > means > > to understand if it actually succeeded or not. This is a problem because > if > > you want to enable a feature only if a C++ compiler exists, you need to > be > > able to well, check if there is a C++ compiler. This is the relevant > Stack > > Overflow question: http://stackoverflow.com/q/27111000/912144 > > > > Now I'm by no means an expert with m4, but I think I could hack away at > > this. Before sending a patch however, I wanted to make sure if the idea > is > > acceptable. > > To contrast: AC_PROG_CC behaviour is to fail hard if no C compiler is > found (or if certain tests of it fail). > > You may find that defining what "succeeded" means for AC_PROG_CXX > will be hard to do. But you can always do something like this in > configure.ac (totally untested): > > AC_PROG_CXX > > AC_LANG([C++]) > AC_CACHE_CHECK([whether the C++ compiler works], [my_cv_cxx_works], > [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <iostream>], > [std::cout << "Hello, World" << std::endl;])], > [my_cv_cxx_works=yes], [my_cv_cxx_works=no])]) > > AS_IF([test x"$my_cv_cxx_works" != x"yes"], > [AC_MSG_ERROR([sorry, can't help you])]) > > Perhaps AC_PROG_CXX would be improved by simply performing a test like > the above at the end. > > Regards, > -- > Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/) > _______________________________________________ Autoconf mailing list Autoconf@xxxxxxx https://lists.gnu.org/mailman/listinfo/autoconf