autoconf
[Top][All Lists]
Advanced

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

no way to conditionally check for a C compiler?


From: Per Bothner
Subject: no way to conditionally check for a C compiler?
Date: Sun, 19 Jan 2014 15:58:51 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

My problem: I use autoconf+automake for Kawa.  (There is an option
to build using Ant, but it doesn't support running all the tests,
for example.)  Most of Kawa is written in Java, but there is a
--enable-kawa-frontend option that builds a small C front-end wrapper
that uses readline.

This means I have to do AC_PROG_CC unconditionally, which means
you can't run configure unless a C compiler is available.  This is
a shame, since you only need the C compiler if --enable-kawa-frontend
is selected.

I realize this is a highly unusual use-case, and autoconf can't
necessarily be all things to everyone.  I thought I'd just ask if
there is a recommended solution.

I tried:

AC_CHECK_PROG(CC, gcc cc, missing-c-compiler)
AC_SUBST(CC)

But then automake complains:

/usr/share/automake-1.13/am/depend2.am: error: am__fastdepCC does not appear in AM_CONDITIONAL /usr/share/automake-1.13/am/depend2.am: The usual way to define 'am__fastdepCC' is to add 'AC_PROG_CC' /usr/share/automake-1.13/am/depend2.am: to 'configure.ac' and run 'aclocal' and 'autoconf' again

I kludged this by adding:

AM_CONDITIONAL(AMDEP,false) dnl kludge
AM_CONDITIONAL(am__fastdepCC,false) dnl kludge

But then AC_OBJEXT is ignored.

So it all seems to be tied together: I can use autoconf+automake
as designed to compile C/C++ porgrams - but *only* if I do so
unconditionally.  Otherwise I need to roll my own.

The advice "never perform tests conditionally: depend conditionally
on their output!" doesn't apply when the tests conditionally abort ...
--
        --Per Bothner
address@hidden   http://per.bothner.com/



reply via email to

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