[Top][All Lists]

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

Re: Check whether AC_PROG_X has failed

From: Aggelos Kolaitis
Subject: Re: Check whether AC_PROG_X has failed
Date: Fri, 28 Nov 2014 18:29:55 +0200

I run into that issue a while ago. That's what I came up with, it works perfecty

# Search for required tools

# Check if g++ works
AC_TRY_COMPILE([#include <iostream>],[ ], cxx_compiler_works=yes, CXX="" )

On Fri, Nov 28, 2014 at 12:51 PM, Shahbaz Youssefi <address@hidden> 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:
> 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
> address@hidden

reply via email to

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