This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Ada files now checked in
- To: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>
- Subject: Re: Ada files now checked in
- From: Zack Weinberg <zack at codesourcery dot com>
- Date: Thu, 4 Oct 2001 11:42:50 -0700
- Cc: gcc at gcc dot gnu dot org
- References: <10110041824.AA26347@vlsi1.ultra.nyu.edu>
On Thu, Oct 04, 2001 at 02:24:36PM -0400, Richard Kenner wrote:
> With the appended patch, using the Debian packages of gnat 3.13p, I
> can get as far as where it trips over the absence of .spt files and/or
> xsinfo/xnmake/xtreeprs. I believe this is the problem Laurent is
> addressing?
>
> Sort of. The real problem is that "touch" commands are missing since the
> files are there.
I tend to agree with the people who are saying that these files ought
to be generated in the build directory during the bootstrap.
> I don't even begin to understand your patch, though.
Sorry, I should have explained it the first time.
Ignore the change to aclocal.m4 for the moment. The remainder of the
patch is straightforward. It does two things:
1. Any compilation of an Ada source file (.ads or .adb) might have to
use a different program from the one used to compile C source. This
program is given the makefile variable ADAC (for "ada compiler"),
which is set by the configure script. All the rules that formerly
used $(CC) to compile Ada are changed to use $(ADAC) instead.
2. Since gnat 3.13 objects to -W options, compilation command lines
for Ada must not include them. However, compilation of C in the ada
subdirectory should include -W options.
They are appearing because the top level Makefile sets submake CFLAGS
to "$(CFLAGS) $(WARN_CFLAGS)" (look for the definition of
ORDINARY_FLAGS_TO_PASS). This is fine for C, but for Ada we want just
the toplevel CFLAGS (which is where -g and -O switches appear). In
ada/Make-lang.in, therefore, I cause ADA_CFLAGS to be set to $(CFLAGS)
in the sub-make invocation. ada/Makefile.in is then changed to use
just ADA_CFLAGS in ALL_ADAFLAGS and MOST_ADAFLAGS. All $(ADAC)
invocations use one of those two, so we are now safe.
As a side effect ADA_CFLAGS is no longer available for overriding by
target Makefile fragments. The only ones that do are pa/t-* which all
set -mdisable-indexing. Does anyone know what that switch means?
Now, the aclocal.m4 gook has the sole purpose of setting ADAC and
GNATBIND correctly. GNATBIND is easy - just call AC_CHECK_TOOL.
(AC_CHECK_PROG was being used, but that will pick the wrong program in
a cross-compilation.) ADAC is trickier. The core is this loop:
for cand in ${ac_tool_prefix}$user_adac $user_adac \
${ac_tool_prefix}gcc gcc \
${ac_tool_prefix}gnatgcc gnatgcc \
${ac_tool_prefix}cc cc \
${ac_tool_prefix}gnatcc gnatcc ; do
# There is a bug in all released versions of GCC which causes the
# driver to exit successfully when the appropriate language module
# has not been installed. This is fixed in 2.95.4, 3.0.2, and 3.1.
# Therefore we must check for the error message as well as an
# unsuccessful exit.
errors=`$cand -c conftest.adb 2>&1 || echo failure`
if test x"$errors" = x; then
gcc_cv_prog_adac=$cand
break
fi
gcc_cv_prog_adac=no
done
(oops, the last two lines should be switched.) It iterates over a
series of four (normally) possible candidates for the Ada compiler
driver. Each is asked to compile a trivial Ada procedure. The first
one that exits successfully and produces no output is taken to work.
We then set up ADAC appropriately.
The stuff with ${ac_tool_prefix} is to simulate the effect of
AC_CHECK_TOOL: if we were cross compiling we would probably want
something named powerpc-eabi-gnatgcc, for instance.
zw