X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f From: "Tim Van Holder" To: "'Laurynas Biveinis'" , Cc: Subject: Re: AC_PROG_CXX does not work correctly after AC_PROG_CC Date: Sat, 20 Apr 2002 15:39:05 +0200 Message-ID: <000101c1e870$bd7d2100$9b5f77d5@zastaixp> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.3416 In-reply-to: <63658361453.20020417145858@softhome.net> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > and, among others, will substitute CXX and CXXFLAGS variables in > output files. So it does not detect that in fact there is no working > C++ compiler. If I remove AC_PROG_CC in this configure script, then > I get correct error message: > checking for C++ compiler default output... configure: error: C++ > compiler cannot create executables > But such a check is missing if there is AC_PROG_CC before AC_PROG_CXX. > > I've verified it with DJGPP port of Autoconf 2.50 and Cygwin port of > Autoconf 2.52. > > Is there any fix or workaround? Please CC me on replies and TIA ;) Actually, Laurynas, it seems that this is perfectly correct behaviour. From the autoconf docs for AC_PROG_CXX: Determine a C++ compiler to use. Check if the environment variable `CXX' or `CCC' (in that order) is set; if so, then set output variable `CXX' to its value. Otherwise, if the macro is invoked without an argument, then search for a C++ compiler under the likely names (first `g++' and `c++' then other names). If none of those checks succeed, then as a last resort set `CXX' to `g++'. This macro may, however, be invoked with an optional first argument which, if specified, must be a space separated list of C++ compilers to search for. This just gives the user an opportunity to specify an alternative search list for the C++ compiler. For example, if you didn't like the default order, then you could invoke `AC_PROG_CXX' like this: AC_PROG_CXX(cl KCC CC cxx cc++ xlC aCC c++ g++ egcs gcc) If using the GNU C++ compiler, set shell variable `GXX' to `yes'. If output variable `CXXFLAGS' was not already set, set it to `-g -O2' for the GNU C++ compiler (`-O2' on systems where G++ does not accept `-g'), or `-g' for other compilers. Now as a side-effect, the first compiler check (PROG_CC or PROG_CXX) will also try to determine the executable extension using that compiler. It is that test that bombs out if you only use PROG_CXX (or use it first) on a system without a C++ compiler. The other effects are as documented: it defaults to g++ if nothing is found. As such, I might consider it a bug/misfeature that the EXEEXT test bombs out - if the compiler being tested doesn't produce valid output (e.g. because it does not exist), simply let that macro not report a result, so that a following test (e.g. AC_PROG_CC) can determine it.