This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Ada files now checked in


On Thu, Oct 04, 2001 at 01:29:30PM -0400, Richard Kenner wrote:
>     I'm taking the position that we want "make bootstrap" from the top
>     level to Just Work provided appropriate tools are available in the
>     user's PATH. 
> 
> Correct.  "Appropriate tools" here means a complete GNAT installation.
> But if you don't have it, the *first time* you build it, there is
> another way with less.

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?

zw

top level:
	* aclocal.m4 (gcc_AC_PROG_GNAT): New.
	* configure.in: Use it.
ada:
	* Make-lang.in (ADA_FLAGS_TO_PASS): Override ADA_CFLAGS.
	* Makefile.in (ADAC): New variable set by autoconf.
	(ALL_ADAFLAGS, MOST_ADAFLAGS): Do not include CFLAGS.
	(.adb.o, .ads.o, a-numaux.o, a-teioed.o, s-interr.o,
	s-taskin.o, sdefault.o, s-tasdeb.o, s-vaflop.o, a-except.o,
	s-assert.o, s-stalib.o, s-memory.o, memtrack.o, mlib-tgt.o):
	Use $(ADAC) not $(CC) in commands.
	(gnattools): Don't use recursive make.

===================================================================
Index: configure.in
--- configure.in	2001/09/29 18:22:03	1.542
+++ configure.in	2001/10/04 18:05:08
@@ -469,7 +469,7 @@ gcc_AC_C_COMPILE_ENDIAN
 gcc_AC_C_FLOAT_FORMAT
 
 # See if GNAT has been installed
-AC_CHECK_PROG(have_gnat, gnatbind, yes, no)
+gcc_AC_PROG_GNAT
 
 # See if we have the mktemp command.
 AC_CHECK_PROG(have_mktemp_command, mktemp, yes, no)
===================================================================
Index: aclocal.m4
--- aclocal.m4	2001/07/18 17:16:58	1.50
+++ aclocal.m4	2001/10/04 18:05:08
@@ -308,6 +308,50 @@ test -z "$INSTALL_DATA" && INSTALL_DATA=
 AC_SUBST(INSTALL_DATA)dnl
 ])
 
+dnl Test for GNAT.
+dnl We require the gnatbind program, and a compiler driver that
+dnl understands Ada.  Add entries to the list as appropriate.
+dnl Sets the shell variable have_gnat to yes or no as appropriate, and
+dnl substitutes GNATBIND and ADAC.
+AC_DEFUN([gcc_AC_PROG_GNAT],
+[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])
+AC_CHECK_TOOL(GNATBIND, gnatbind, no)
+AC_CACHE_CHECK([for compiler driver that understands Ada],
+		 gcc_cv_prog_adac,
+[cat >conftest.adb <<EOF
+procedure conftest is begin null; end conftest;
+EOF
+gcc_cv_prog_adac=
+# Have to do ac_tool_prefix and user overrides by hand.
+user_adac=$ADAC
+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
+rm -f conftest.*])
+ADAC=$gcc_cv_prog_adac
+AC_SUBST(ADAC)
+
+if test x$GNATBIND != xno && test x$ADAC != xno; then
+  have_gnat=yes
+else
+  have_gnat=no
+fi
+])
+
 #serial 1
 dnl This test replaces the one in autoconf.
 dnl Currently this macro should have the same name as the autoconf macro
===================================================================
Index: ada/Make-lang.in
--- ada/Make-lang.in	2001/10/02 13:46:42	1.1
+++ ada/Make-lang.in	2001/10/04 18:05:08
@@ -54,6 +54,7 @@ ADA_RTL_OBJ_DIR = $(libsubdir)/adalib
 THREAD_KIND=native
 GNATBIND = gnatbind
 ADA_FLAGS_TO_PASS = \
+	"ADA_CFLAGS=$(CFLAGS)" \
 	"ADA_FOR_BUILD=$(ADA_FOR_BUILD)" \
 	"ADA_INCLUDE_DIR=$(ADA_INCLUDE_DIR)" \
 	"ADA_RTL_OBJ_DIR=$(ADA_RTL_OBJ_DIR)" \
===================================================================
Index: ada/Makefile.in
--- ada/Makefile.in	2001/10/02 13:46:42	1.1
+++ ada/Makefile.in	2001/10/04 18:05:09
@@ -79,6 +79,7 @@ X_CPPFLAGS =
 T_CPPFLAGS =
 
 CC = cc
+ADAC = @ADAC@
 BISON = bison
 BISONFLAGS =
 ECHO = echo
@@ -108,8 +109,8 @@ SOME_ADAFLAGS =-gnata
 FORCE_DEBUG_ADAFLAGS = -g
 GNATLIBFLAGS = -gnatpg
 GNATLIBCFLAGS= -g -O2
-ALL_ADAFLAGS = $(CFLAGS) $(ADA_CFLAGS) $(ADAFLAGS)
-MOST_ADAFLAGS = $(CFLAGS) $(ADA_CFLAGS) $(SOME_ADAFLAGS)
+ALL_ADAFLAGS = $(ADA_CFLAGS) $(ADAFLAGS)
+MOST_ADAFLAGS = $(ADA_CFLAGS) $(SOME_ADAFLAGS)
 THREAD_KIND=native
 GMEM_LIB=
 MISCLIB =
@@ -268,9 +269,9 @@ ADA_INCLUDES_FOR_SUBDIR = -I. -I$(fsrcdi
 .c.o:
 	$(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
 .adb.o:
-	$(CC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) $<
+	$(ADAC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) $<
 .ads.o:
-	$(CC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) $<
+	$(ADAC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) $<
 
 # This tells GNU make version 3 not to export all the variables
 # defined in this file into the environment.
@@ -836,11 +837,11 @@ ifeq ($(strip $(filter-out %86 interix,$
 
 # Work around for gcc optimization bug wrt cxa5a09
 a-numaux.o  : a-numaux.adb a-numaux.ads                                     
-	$(CC) -c $(ALL_ADAFLAGS) -O2 $(ADA_INCLUDES) $<
+	$(ADAC) -c $(ALL_ADAFLAGS) -O2 $(ADA_INCLUDES) $<
 
 # Work around for gcc optimization bug wrt cxf3a01
 a-teioed.o  : a-teioed.adb a-teioed.ads                   
-	$(CC) -c $(ALL_ADAFLAGS) -O0 $(ADA_INCLUDES) $<
+	$(ADAC) -c $(ALL_ADAFLAGS) -O0 $(ADA_INCLUDES) $<
 
 endif
 
@@ -960,7 +961,7 @@ ifeq ($(strip $(filter-out m68k% wrs vx%
 
 # ??? work around a gcc -O2 bug on m68k
 s-interr.o  : s-interr.adb s-interr.ads
-	$(CC) -c $(ALL_ADAFLAGS) -O1 $(ADA_INCLUDES) $<
+	$(ADAC) -c $(ALL_ADAFLAGS) -O1 $(ADA_INCLUDES) $<
 endif
 
 ifeq ($(strip $(filter-out powerpc% wrs vx%,$(targ))),)
@@ -1140,7 +1141,7 @@ ifeq ($(strip $(filter-out %86 solaris2%
 
 # ??? work around a gcc -O3 bug on x86
 a-numaux.o  : a-numaux.adb a-numaux.ads
-	$(CC) -c $(ALL_ADAFLAGS) -O2 $(ADA_INCLUDES) $<
+	$(ADAC) -c $(ALL_ADAFLAGS) -O2 $(ADA_INCLUDES) $<
 endif
 
 ifeq ($(strip $(filter-out %86 linux%,$(arch) $(osys))),)
@@ -1265,7 +1266,7 @@ a-tcbinf.o: s-tpgetc.ali
 
 # force debug info so that workshop can find the All_Tasks_List symbol
 s-taskin.o: s-taskin.adb s-taskin.ads
-	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) $(ADA_INCLUDES) $<
+	$(ADAC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) $(ADA_INCLUDES) $<
 endif
 
 ifeq ($(strip $(filter-out hppa% hp hpux%,$(targ))),)
@@ -1484,7 +1485,7 @@ ifeq ($(strip $(filter-out cygwin32% min
 
 # ??? work around a gcc -O3 bug on x86
 a-numaux.o  : a-numaux.adb a-numaux.ads
-	$(CC) -c $(ALL_ADAFLAGS) -O2 $(ADA_INCLUDES) $<
+	$(ADAC) -c $(ALL_ADAFLAGS) -O2 $(ADA_INCLUDES) $<
 endif
 
 # The runtime library for gnat comprises two directories.  One contains the
@@ -2076,12 +2077,7 @@ gnatbl.o: gnatbl.c adaint.h
 	  true; \
 	fi
 
-gnattools: force
-	$(MAKE) \
-	   "CC=$(CC)" "ALL_CFLAGS=$(ALL_CFLAGS)" "INCLUDE=$(INCLUDES)" \
-	   "LDFLAGS=$(LDFLAGS)" \
-	   "MISCLIB=$(MISCLIB)" "exeext=$(exeext)" \
-	   ../gnatbl$(exeext) ../gnatchop$(exeext) ../gnatcmd$(exeext) \
+gnattools: ../gnatbl$(exeext) ../gnatchop$(exeext) ../gnatcmd$(exeext) \
 	   ../gnatkr$(exeext) ../gnatlink$(exeext) \
 	   ../gnatls$(exeext) ../gnatmake$(exeext) ../gnatmem$(exeext) \
 	   ../gnatprep$(exeext) ../gnatpsta$(exeext) ../gnatpsys$(exeext) \
@@ -2464,40 +2460,43 @@ ADA_TREE_H = ada-tree.h ada-tree.def
 
 sdefault.o : sdefault.ads sdefault.adb types.ads unchdeal.ads \
    system.ads s-exctab.ads s-stalib.ads unchconv.ads 
-	$(CC) -c -O2 $(MOST_ADAFLAGS) $(ADA_INCLUDES) sdefault.adb
+	$(ADAC) -c -O2 $(MOST_ADAFLAGS) $(ADA_INCLUDES) sdefault.adb
 
 # force debugging information on s-tasdeb.o so that it is always
 # possible to set conditional breakpoints on tasks.
 
 s-tasdeb.o  : s-tasdeb.adb s-tasdeb.ads
-	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) $(ADA_INCLUDES) $<
+	$(ADAC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) $(ADA_INCLUDES) $<
 
 # force debugging information on s-vaflop.o so that it is always
 # possible to call the VAX float debug print routines.
 # force at least -O so that the inline assembly works.
 
 s-vaflop.o  : s-vaflop.adb s-vaflop.ads
-	$(CC) -c -O $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) $(ADA_INCLUDES) $<
+	$(ADAC) -c -O $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) \
+	 $(ADA_INCLUDES) $<
 
 # force debugging information on a-except.o so that it is always
 # possible to set conditional breakpoints on exceptions.
 # use -O1 otherwise gdb isn't able to get a full backtrace on mips targets.
 
 a-except.o  : a-except.adb a-except.ads
-	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O1 -fno-inline \
+	$(ADAC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O1 -fno-inline \
 	 $(ADA_INCLUDES) $<
 
 # force debugging information on s-assert.o so that it is always
 # possible to set breakpoint on assert failures.
 
 s-assert.o  : s-assert.adb s-assert.ads a-except.ads
-	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O2 $(ADA_INCLUDES) $<
+	$(ADAC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O2 \
+	 $(ADA_INCLUDES) $<
 
 # force debugging information on s-stalib.o so that it is always
 # possible to set breakpoints on exceptions.
 
 s-stalib.o  : s-stalib.adb s-stalib.ads
-	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O2 $(ADA_INCLUDES) $<
+	$(ADAC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O2 \
+	 $(ADA_INCLUDES) $<
 
 # force debugging information and no optimization on s-memory.o so that it 
 # is always possible to set breakpoint on __gnat_malloc and __gnat_free
@@ -2505,10 +2504,12 @@ s-stalib.o  : s-stalib.adb s-stalib.ads
 # memtrack.adb, and used by the post-mortem analysis with gnatmem.
 
 s-memory.o  : s-memory.adb s-memory.ads memtrack.o
-	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O0 $(ADA_INCLUDES) $<
+	$(ADAC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O0 \
+	 $(ADA_INCLUDES) $<
 
 memtrack.o  : memtrack.adb s-memory.ads
-	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O0 $(ADA_INCLUDES) $<
+	$(ADAC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O0 \
+	 $(ADA_INCLUDES) $<
 
 # Need to keep the frame pointer in this file to pop the stack properly on
 # some targets.
@@ -2599,7 +2600,7 @@ stamp-tool_src_dir:
 	touch stamp-tool_src_dir
 
 mlib-tgt.o : stamp-tool_src_dir
-	$(CC) -c -Itools $(ALL_ADAFLAGS) $(ADA_INCLUDES) tools/mlib-tgt.adb
+	$(ADAC) -c -Itools $(ALL_ADAFLAGS) $(ADA_INCLUDES) tools/mlib-tgt.adb
 
 # GNAT DEPENDENCIES
 # regular dependencies


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]