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]

[patch] aclocal.m4: Work around a bug in AC_PATH_PROGS.


Hi,

Attached is a patch to work around a bug in AC_PATH_PROGS.

Suppose the last argument to AC_PATH_PROGS is empty, which could
happen during a canadian cross build.  According to Paul Brook, part
of AC_PATH_PROGS($1,$2,, $gcc_cv_tool_dirs) expands to:

as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $gcc_cv_tool_dirs
do
  IFS=$as_save_IFS

If $gcc_cv_tool_dirs == "" the body of the for will never execute, so
IFS will never be restored.

Tested on x86_64-pc-linux-gnu and cross to arm-none-eabi.  OK to
apply?

Kazu Hirata

2005-07-06  Paul Brook  <paul@codesourcery.com>

	* aclocal.m4: Work around a bug in AC_PATH_PROGS when its last
	argument is empty.

Index: aclocal.m4
===================================================================
RCS file: /cvs/gcc/gcc/gcc/aclocal.m4,v
retrieving revision 1.108
diff -u -d -p -r1.108 aclocal.m4
--- aclocal.m4	25 Jun 2005 01:59:09 -0000	1.108
+++ aclocal.m4	5 Jul 2005 16:29:09 -0000
@@ -711,7 +711,13 @@ dnl shut up useless "checking for..." me
 dnl we can still read them in config.log
 exec AS_MESSAGE_FD([])>/dev/null
 if test "x[$]$1" = x; then
-	AC_PATH_PROGS($1, $2, , $gcc_cv_tool_dirs)
+	# The AC_PATH_PROGS macro doesn't work properly when its 4th argument
+	# is empty.
+	if test "x$gcc_cv_tool_dirs" = x; then
+		$1=
+	else
+		AC_PATH_PROGS($1, $2, , $gcc_cv_tool_dirs)
+	fi
 fi
 if test "x[$]$1" = x; then
 	# If the loop above did not find a tool, then use whatever


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