[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
if (...) then; AC_PROG_CC else AC_PROG_CC fi doesn't work?
From: |
Brooks Moses |
Subject: |
if (...) then; AC_PROG_CC else AC_PROG_CC fi doesn't work? |
Date: |
Tue, 23 Oct 2007 14:52:46 -0700 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.8.1.6) Gecko/20070728 Thunderbird/2.0.0.6 Mnenhy/0.7.5.666 |
Consider the following nearly-minimal configure.ac example:
=================================
AC_INIT
AC_ARG_ENABLE(foo)
if test "$enable_foo"; then
echo "enabled"
AC_PROG_CC([gcc])
else
echo "disabled"
AC_PROG_CC
fi
=================================
This does not work correctly; when --enable-foo is not given, the check
for the C compiler will produce erroneous results (such as detecting GCC
and then "checking whether we are using the GNU C compiler... no"), and
some investigation shows that the problem is that ac_objext is "".
Further, inspection of the generated "configure" file shows the reason:
The check for the object extension is only placed in the code for the
first AC_PROG_CC, and thus gets omitted from the second one.
This is happening both with autoconf 2.59 and 2.61. I haven't checked
other versions.
Is this a known bug? Is there a suggested workaround?
Thanks,
- Brooks
- if (...) then; AC_PROG_CC else AC_PROG_CC fi doesn't work?,
Brooks Moses <=