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]

Re: configury assembler features


On Wed, Mar 20, 2002 at 01:25:53PM +1030, Alan Modra wrote:
> On Tue, Mar 19, 2002 at 09:33:06PM -0500, Daniel Jacobowitz wrote:
> > On Wed, Mar 20, 2002 at 12:44:05PM +1030, Alan Modra wrote:
> > > This patch allows gcc to find assembler capabilities when cross-
> > > compiling.  Also corrects the search dirs to use $target_alias rather
> > > than $target.
> > > 
> > > 	* configure.in (gcc_cv_as): Use $target_alias in directory searchs
> > > 	rather than $target.  Heed program_prefix and
> > > 	program_transform_name.  Search for gas in cross-compiler case too.
> > > 	"test -x" rather than "test -f".
> > > 	(gcc_cv_ld): Likewise.
> > > 	(gcc_cv_nm): Heed program_prefix and program_transform_name.
> > > 	(gcc_cv_objdump): Likewise.
> > > 	* configure: Regenerate.
> > 
> > I'm glad you did this.  I had a whole long message about a problem with
> > it, which I can no longer find.  I've still got one concern, but you
> > didn't introduce it: host-x-host crosses.  $host = $target doesn't
> > imply that $build has any relation to either, and you can easily find
> > the $build assembler here.  I build GCC on an i386-linux build for a
> > mipsel-linux host, so program_prefix et al will not be used, and you'll
> > just find my system assembler.
> 
> Hmm, yes.  We obviously can't run the assembler and other tools to
> find their capabilities when $build != $host.  I'll modify the patch

Like this

Index: gcc/configure.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/configure.in,v
retrieving revision 1.579
diff -u -p -r1.579 configure.in
--- configure.in	2002/03/14 09:56:40	1.579
+++ configure.in	2002/03/26 23:51:44
@@ -1222,8 +1222,7 @@ changequote(,)dnl
 changequote([,])dnl
 fi
 
-if test "x$gcc_cv_as" = x -a x$host = x$target; then
-	# Native build.
+if test "x$gcc_cv_as" = x -a x$build = x$host; then
 	# Search the same directories that the installed compiler will
 	# search.  Else we may find the wrong assembler and lose.  If we
 	# do not find a suitable assembler binary, then try the user's
@@ -1248,14 +1247,21 @@ if test "x$gcc_cv_as" = x -a x$host = x$
 	# If the loop below does not find an assembler, then use whatever
 	# one we can find in the users's path.
 	# user's path.
-	gcc_cv_as=as$host_exeext
+	if test "x$program_prefix" != xNONE; then
+		gcc_cv_as=${program_prefix}as$host_exeext
+	else
+		gcc_cv_as=`echo as | sed ${program_transform_name}`$host_exeext
+	fi
+
+	test_dirs="$test_prefix/lib/gcc-lib/$target_alias/$gcc_version \
+		   $test_prefix/lib/gcc-lib/$target_alias \
+		   /usr/lib/gcc/$target_alias/$gcc_version \
+		   /usr/lib/gcc/$target_alias \
+		   $test_prefix/$target_alias/bin/$target_alias/$gcc_version \
+		   $test_prefix/$target_alias/bin"
 
-	test_dirs="$test_prefix/lib/gcc-lib/$target/$gcc_version \
-		   $test_prefix/lib/gcc-lib/$target \
-		   /usr/lib/gcc/$target/$gcc_version \
-		   /usr/lib/gcc/$target \
-		   $test_prefix/$target/bin/$target/$gcc_version \
-		   $test_prefix/$target/bin \
+	if test x$host = x$target; then
+	    test_dirs="$test_dirs \
 		   /usr/libexec \
 		   /usr/ccs/gcc \
 		   /usr/ccs/bin \
@@ -1266,9 +1272,10 @@ if test "x$gcc_cv_as" = x -a x$host = x$
 		   /sysv/usr/lib/cmplrs/cc \
 		   /svr4/usr/lib/cmplrs/cc \
 		   /usr/bin"
+	fi
 
 	for dir in $test_dirs; do
-		if test -f $dir/as$host_exeext; then
+		if test -x $dir/as$host_exeext; then
 			gcc_cv_as=$dir/as$host_exeext
 			break;
 		fi
@@ -1311,8 +1318,7 @@ changequote(,)dnl
 changequote([,])dnl
 fi
 
-if test "x$gcc_cv_ld" = x -a x$host = x$target; then
-	# Native build.
+if test "x$gcc_cv_ld" = x -a x$build = x$host; then
 	# Search the same directories that the installed compiler will
 	# search.  Else we may find the wrong linker and lose.  If we
 	# do not find a suitable linker binary, then try the user's
@@ -1337,14 +1343,21 @@ if test "x$gcc_cv_ld" = x -a x$host = x$
 	# If the loop below does not find an linker, then use whatever
 	# one we can find in the users's path.
 	# user's path.
-	gcc_cv_ld=ld$host_exeext
+	if test "x$program_prefix" != xNONE; then
+		gcc_cv_ld=${program_prefix}ld$host_exeext
+	else
+		gcc_cv_ld=`echo ld | sed ${program_transform_name}`$host_exeext
+	fi
 
-	test_dirs="$test_prefix/lib/gcc-lib/$target/$gcc_version \
-		   $test_prefix/lib/gcc-lib/$target \
-		   /usr/lib/gcc/$target/$gcc_version \
-		   /usr/lib/gcc/$target \
-		   $test_prefix/$target/bin/$target/$gcc_version \
-		   $test_prefix/$target/bin \
+	test_dirs="$test_prefix/lib/gcc-lib/$target_alias/$gcc_version \
+		   $test_prefix/lib/gcc-lib/$target_alias \
+		   /usr/lib/gcc/$target_alias/$gcc_version \
+		   /usr/lib/gcc/$target_alias \
+		   $test_prefix/$target_alias/bin/$target_alias/$gcc_version \
+		   $test_prefix/$target_alias/bin"
+
+	if test x$host = x$target; then
+	    test_dirs="$test_dirs \
 		   /usr/libexec \
 		   /usr/ccs/gcc \
 		   /usr/ccs/bin \
@@ -1355,9 +1368,10 @@ if test "x$gcc_cv_ld" = x -a x$host = x$
 		   /sysv/usr/lib/cmplrs/cc \
 		   /svr4/usr/lib/cmplrs/cc \
 		   /usr/bin"
+	fi
 
 	for dir in $test_dirs; do
-		if test -f $dir/ld$host_exeext; then
+		if test -x $dir/ld$host_exeext; then
 			gcc_cv_ld=$dir/ld$host_exeext
 			break;
 		fi
@@ -1373,9 +1387,12 @@ fi
 AC_MSG_CHECKING(what nm to use)
 if test -x nm$host_exeext; then
 	gcc_cv_nm=./nm$host_exeext
-elif test x$host = x$target; then
-	# Native build.
-	gcc_cv_nm=nm$host_exeext
+elif test x$build = x$host; then
+	if test "x$program_prefix" != xNONE; then
+		gcc_cv_nm=${program_prefix}nm$host_exeext
+	else
+		gcc_cv_nm=`echo nm | sed ${program_transform_name}`$host_exeext
+	fi
 fi
 AC_MSG_RESULT($gcc_cv_nm)
 
@@ -1383,9 +1400,12 @@ AC_MSG_RESULT($gcc_cv_nm)
 AC_MSG_CHECKING(what objdump to use)
 if test -x objdump$host_exeext; then
 	gcc_cv_objdump=./objdump$host_exeext
-elif test x$host = x$target; then
-	# Native build.
-	gcc_cv_objdump=objdump$host_exeext
+elif test x$build = x$host; then
+	if test "x$program_prefix" != xNONE; then
+		gcc_cv_objdump=${program_prefix}objdump$host_exeext
+	else
+		gcc_cv_objdump=`echo objdump | sed ${program_transform_name}`$host_exeext
+	fi
 fi
 AC_MSG_RESULT($gcc_cv_objdump)
 
-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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