-# This is commented out for now.
-#if [ x${with_gnu_as} != xyes ] && echo ${configdirs} | grep gas > /dev/null && [ -d ${srcdir}/gas ]; then
-# with_gnu_as=yes
-# withoptions="$withoptions -with-gnu-as"
-#fi
-#if [ x${with_gnu_ld} != xyes ] && echo ${configdirs} | grep ld > /dev/null && [ -d ${srcdir}/ld ]; then
-# with_gnu_ld=yes
-# withoptions="$withoptions -with-gnu-ld"
-#fi
+#
+# This is done by determining whether or not the appropriate directory
+# is available, and by checking whether or not specific configurations
+# have requested that this magic not happen.
+#
+# The command line options always override the explicit settings in
+# configure.in, and the settings in configure.in override this magic.
+#
+# If the default for a toolchain is to use GNU as and ld, and you don't
+# want to do that, then you should use the --without-gnu-as and
+# --without-gnu-ld options for the configure script.
+
+if [ x${use_gnu_as} = x ] ; then
+ if [ x${with_gnu_as} != xno ] && echo " ${configdirs} " | grep " ${gasdir} " > /dev/null 2>&1 && [ -d ${srcdir}/${gasdir} ] ; then
+ with_gnu_as=yes
+ withoptions="$withoptions --with-gnu-as"
+ fi
+fi
+
+if [ x${use_gnu_ld} = x ] ; then
+ if [ x${with_gnu_ld} != xno ] && echo " ${configdirs} " | grep " ld " > /dev/null 2>&1 && [ -d ${srcdir}/ld ] ; then
+ with_gnu_ld=yes
+ withoptions="$withoptions --with-gnu-ld"
+ fi
+fi