autoconf
[Top][All Lists]
Advanced

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

AC_LANG([C]) and _AC_LANG_ABBREV


From: J. Gregory Wright
Subject: AC_LANG([C]) and _AC_LANG_ABBREV
Date: Thu, 29 Apr 2004 13:57:17 -0400

I have run into two unexpected (to me) behaviors involving AC_LANG([C]), and
am curious as to (a) if they are supposed to be that way, and (b) if so,
why?

(1) I am converting a mixed Fortran 77 and C code base to use autotools. I
have noticed that if I set up configure.ac as follows, since for some
systems we use native compilers instead of GCC:

AC_LANG([Fortran 77])
AC_PROG_F77([f77 g77])
…

AC_LANG([C])
AC_PROG_CC([cc gcc])

That autoconf decides we’re using gcc, and all tests are performed
accordingly. In fact, it will detect gcc first before detecting the Fortran
compiler. If I change the order such that:

AC_LANG([C])
AC_PROG_CC([cc gcc])
…

AC_LANG([Fortran 77])
AC_PROG_F77([f77 g77])

Then it will honor the fact that I want ‘cc’ if it appears first in the
search list. Nitpicky, but since the majority of the code and tests are for
Fortran, I had wanted to do them first. Is this behavior by design, and if
so, why?

(2) Due to the way we do builds, we want the ability to not include symbols
(i.e., no –g option). I can disable this by setting CFLAGS and FFLAGS to “”
if they were not specified on the command lines, but then I have to see if
“-g” is supported, so that it can be included if symbols are enabled. After
looking through the macro definitions for autoconf, I saw that
_AC_PROG_F77_G and AC_PROG_C_G place a result of yes or no in
ac_cv_prog_[]_AC_PROG_ABBREV[]_g depending upon whether –g is supported or
not. What I noticed however is that:

(a) Within the scope of AC_LANG([Fortran 77]),
ac_cv_prog_[]_AC_PROG_ABBREV[]_g becomes ac_cv_prog_f77_g and reflects the
correct value.

(b) Within the scope of AC_LANG([C]) however,
ac_cv_prog_[]_AC_PROG_ABBREV[]_g becomes ac_cv_prog_c_g and contains no
value (but ac_cv_prog_cc_g is set correctly).

I understand that _AC* macros are more for internal use to autoconf, but is
there a reliable way to get the information about the -g flag that does not
assume something about how autoconf stores things internally?

Thanks,
Greg

--
J. Gregory Wright <address@hidden>
 
Integrity Applications Incorporated <http://www.integrity-apps.com>
703-378-8672 x260






reply via email to

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