Check whether AC_PROG_X has failed

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

 



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




[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux