if (...) then; AC_PROG_CC else AC_PROG_CC fi doesn't work?

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

 



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


_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux