[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: if (...) then; AC_PROG_CC else AC_PROG_CC fi doesn't work?
From: |
Eric Blake |
Subject: |
Re: if (...) then; AC_PROG_CC else AC_PROG_CC fi doesn't work? |
Date: |
Wed, 24 Oct 2007 03:32:51 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Brooks Moses <brooks.moses <at> codesourcery.com> writes:
> Thanks! Unfortunately, however, that "fixes" it by breaking the desired
> functionality. The point of enable_foo is not the echo statements, but
> the fact that AC_PROG_CC uses the "[gcc]" list when foo is enabled, and
> uses the default program list when foo is disabled.
gcc is already the first compiler checked, so your attempt to specify gcc
merely repeats what is already the default. (Oh, maybe what you are trying to
do is give up if gcc is not found? Or maybe you aren't posting the real
problem you are having?)
>
> Is there some way to define a variable argument to AC_PROG_CC to get
> this functionality?
No, but you can do a followup check that gcc was indeed selected, and bail if
some other compiler was selected (although, by requiring gcc, your program is
not as portable; so maybe you should rethink the more fundamental issue of why
enable_foo seems to require gcc).
And, while we're at it, let's use proper quoting, and take advantage of
AC_ARG_ENABLE's optional parameters.
AC_INIT
AC_PROG_CC
AC_ARG_ENABLE([foo], [AS_HELP_STRING([--enable-foo], [whatever foo does])],
[echo "enabled"
if test "x$CC" != xgcc ; then
echo "uh-oh - gcc not detected"],
[echo "disabled"])
--
Eric Blake