autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Check whether AC_PROG_X has failed


From: Shahbaz Youssefi
Subject: Check whether AC_PROG_X has failed
Date: Fri, 28 Nov 2014 11:51:46 +0100

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]