This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

3.4/3.5 PATCH: Fix Ada support check with non-GNAT CC


Bootstrapping with CC=cc currently fails both on mainline and the 3.4
branch if gnatbind happens to be present: due to a typo in the
gcc_AC_PROG_GNAT (3.4) or ACX_PROG_GNAT (mainline) macros, the wrong cache
variable is tested, working Ada support is incorrectly assumed and the
native cc is invoked on Ada code, which fails of course.

On Tru64 UNIX, it gets even worse because cc -c conftest.adb exits
successfully, but produces no object file.

The following trivial patch fixes both problems.

Tested by starting a bootstrap on alpha-dec-osf4.0f with both cc and gcc
and checking if ada support is correctly detected.

Ok for mainline and 3.4.0?

	Rainer

-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University


* mainline variant:

	config:
	* acx.m4 (ACX_PROG_GNAT): Check if ${CC} produces object file for
	Ada compilation.
	Fix acx_cv_cc_gcc_supports_ada spelling.

	* configure: Regenerate.

Index: config/acx.m4
===================================================================
RCS file: /cvs/gcc/gcc/config/acx.m4,v
retrieving revision 1.5
diff -u -p -r1.5 acx.m4
--- config/acx.m4	11 Mar 2004 05:01:01 -0000	1.5
+++ config/acx.m4	16 Apr 2004 16:30:37 -0000
@@ -177,14 +177,17 @@ acx_cv_cc_gcc_supports_ada=no
 # 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.
+# Other compilers, like HP Tru64 UNIX cc, exit successfully when
+# given a .adb file, but produce no object file.  So we must check
+# if an object file was really produced to guard against this.
 errors=`(${CC} -c conftest.adb) 2>&1 || echo failure`
-if test x"$errors" = x; then
+if test x"$errors" = x && test -f conftest.$ac_objext; then
   acx_cv_cc_gcc_supports_ada=yes
   break
 fi
 rm -f conftest.*])
 
-if test x$GNATBIND != xno && test x$acx_cv_gcc_supports_ada != xno; then
+if test x$GNATBIND != xno && test x$acx_cv_cc_gcc_supports_ada != xno; then
   have_gnat=yes
 else
   have_gnat=no

* variant for 3.4 branch:
	
	* aclocal.m4 (gcc_AC_PROG_GNAT): Check if ${CC} produces object
	file for Ada compilation.
	Fix gcc_cv_cc_supports_ada spelling.
	* configure: Regenerate.
	
Index: gcc/aclocal.m4
===================================================================
RCS file: /cvs/gcc/gcc/gcc/aclocal.m4,v
retrieving revision 1.88
diff -u -p -r1.88 aclocal.m4
--- gcc/aclocal.m4	3 Jan 2004 18:59:32 -0000	1.88
+++ gcc/aclocal.m4	16 Apr 2004 16:44:41 -0000
@@ -316,14 +316,17 @@ gcc_cv_cc_supports_ada=no
 # 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.
+# Other compilers, like HP Tru64 UNIX cc, exit successfully when
+# given a .adb file, but produce no object file.  So we must check
+# if an object file was really produced to guard against this.
 errors=`(${CC} -c conftest.adb) 2>&1 || echo failure`
-if test x"$errors" = x; then
+if test x"$errors" = x && test -f conftest.$ac_objext; then
   gcc_cv_cc_supports_ada=yes
   break
 fi
 rm -f conftest.*])
 
-if test x$GNATBIND != xno && test x$gcc_cv_supports_ada != xno; then
+if test x$GNATBIND != xno && test x$gcc_cv_cc_supports_ada != xno; then
   have_gnat=yes
 else
   have_gnat=no


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