I run into that issue a while ago. That's what I came up with, it works perfecty # Search for required tools AC_PROG_CC AC_PROG_CXX # Check if g++ works AC_MSG_CHECKING(if $CXX works) cxx_compiler_works=no AC_LANG_PUSH(C++) AC_TRY_COMPILE([#include <iostream>],[ ], cxx_compiler_works=yes, CXX="" ) AC_LANG_POP AC_MSG_RESULT($cxx_compiler_works) On Fri, Nov 28, 2014 at 12:51 PM, Shahbaz Youssefi <shabbyx@xxxxxxxxx> wrote: > Hi all, > > First off, I'm not in the mailing list, so please CC replies to myself. > > Second, I am rather new to autoconf. > > I noticed a problem with the output of AC_PROG_CXX which I guess (but not > yet sure) extends to others such as AC_PROG_CC, AC_PROG_CPP etc. > > 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. > > My idea is to add a variable that simply says whether the test was > successful or not. For example, ac_cv_prog_cc_g, ac_cv_prog_cc_c_o, > ac_cv_prog_cc_c99 etc are used for various feature tests, so why not have > these additional variables: > > - ac_cv_prog_cc set to yes if AC_PROG_CC succeeded (and therefore CC is > valid) > - ac_cv_prog_cpp set to yes if AC_PROG_CPP succeeded (and therefore CPP is > valid) > - ac_cv_prog_cxx set to yes if AC_PROG_CXX succeeded (and therefore CXX is > valid) > > You get the idea! > > This addition would be completely backward-compatible since it doesn't > remove anything and uses only reserved variable names. > > That is unless those variables are actually used and I don't know about it, > then of course another name could be picked. > > Please let me know what you think, > Shahbaz > _______________________________________________ > Autoconf mailing list > Autoconf@xxxxxxx > https://lists.gnu.org/mailman/listinfo/autoconf _______________________________________________ Autoconf mailing list Autoconf@xxxxxxx https://lists.gnu.org/mailman/listinfo/autoconf