summary refs log tree commit diff
path: root/configure.in
diff options
context:
space:
mode:
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in97
1 files changed, 68 insertions, 29 deletions
diff --git a/configure.in b/configure.in
index 8939236641..d5370f897e 100644
--- a/configure.in
+++ b/configure.in
@@ -77,6 +77,12 @@ AC_ARG_ENABLE(add-ons, dnl
    	      [add_ons=`echo "$enableval" | sed 's/,/ /g'`],
 	      [add_ons=])
 AC_CONFIG_SUBDIRS($add_ons)
+add_ons_pfx=
+if test x$add_ons != x; then
+  for f in $add_ons; do
+    add_ons_pfx="$add_ons_pfx $f/"
+  done
+fi
 
 AC_CANONICAL_HOST
 # We keep the original values in `$config_*' and never modify them, so we
@@ -189,23 +195,34 @@ changequote([,])dnl
 
 # Find what sysdep directories exist.
 sysnames=
-for b in $base ''; do
-  for m0 in $mach ''; do
-    for v in /$vendor ''; do
-      for o in /$ostry ''; do
-	for m in $mach ''; do
-	  try="$m0$b$v$o$m"
-	  test -n "$enable_debug_configure" && echo "$0 [DEBUG]: try $try" >&2
-	  if test -d $sysdep_dir$try; then
-	    sysnames="$sysnames $try"
-	    { test -n "$o" || test -n "$b"; } && os_used=t
-	    { test -n "$m" || test -n "$m0"; } && machine_used=t
-	  fi
+IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+for d in $add_ons_pfx ''; do
+  for b in $base ''; do
+    for m0 in $mach ''; do
+      for v in /$vendor ''; do
+	for o in /$ostry ''; do
+	  for m in $mach ''; do
+	    if test "$m0$b$v$o$m"; then
+	      try="${d}sysdeps$m0$b$v$o$m"
+	      test -n "$enable_debug_configure" &&
+	      echo "$0 [DEBUG]: try $try" >&2
+	      case $try in
+		/*) dest=$try ;;
+		*)  dest=$srcdir/$try ;;
+	      esac
+	      if test -d $dest; then
+		sysnames="$sysnames $try"
+		{ test -n "$o" || test -n "$b"; } && os_used=t
+		{ test -n "$m" || test -n "$m0"; } && machine_used=t
+	      fi
+	    fi
+	  done
 	done
       done
     done
   done
 done
+IFS="$ac_save_ifs"
 
 if test -z "$os_used" && test "$os" != none; then
   AC_MSG_ERROR(Operating system $os is not supported.)
@@ -224,12 +241,18 @@ fi
 # machine (otherwise what's the point of an ABI?).
 if test "$elf" = yes; then
   elf_dirs=
-  for m in $mach; do
-    if test -d $sysdep_dir$m/elf; then
-      elf_dirs="$elf_dirs $m/elf"
-    fi
+  for d in $add_ons_pfx ''; do
+    case $d in
+      /*) xsrcdir= ;;
+      *)  xsrcdir=$srcdir/ ;;
+    esac
+    for m in $mach; do
+      if test -d $xsrcdir${d}sysdeps$m/elf; then
+	elf_dirs="$elf_dirs $d$m/elf"
+      fi
+    done
   done
-  sysnames="`echo $elf_dirs | sed -e 's,^/,,' -e 's, /,,g'` $sysnames"
+  sysnames="`echo $elf_dirs | sed -e 's,//,/,g'` $sysnames"
 fi
 
 
@@ -253,13 +276,25 @@ while test $# -gt 0; do
   # Report each name as we discover it, so there is no long pause in output.
   echo $ac_n "$name $ac_c" >&AC_FD_MSG
 
-  if test -f $sysdep_dir/$name/Implies; then
+  name_base=`echo $name | sed -e 's@\(.*sysdeps\)/.*@\1@'`
+
+  case $name in
+    /*) xsrcdir= ;;
+    *)  xsrcdir=$srcdir/ ;;
+  esac
+  test -n "$enable_debug_configure" &&
+  echo "[DEBUG]: name/Implies $xsrcdir$name/Implies" >&2
+
+  if test -f $xsrcdir$name/Implies; then
     # Collect more names from the `Implies' file (removing comments).
-    implied="`sed 's/#.*$//' < $sysdep_dir/$name/Implies`"
-    for x in $implied; do
-      test -d $sysdep_dir/$x || {
-        AC_MSG_WARN(sysdeps/$name/Implies specifies nonexistent $x)
-      }
+    implied_candidate="`sed 's/#.*$//' < $xsrcdir$name/Implies`"
+    implied=
+    for x in $implied_candidate; do
+      if test -d $xsrcdir$name_base/$x; then
+	implied="$implied $name_base/$x";
+      else
+        AC_MSG_WARN($name/Implies specifies nonexistent $x)
+      fi
     done
   else
     implied=
@@ -270,7 +305,7 @@ while test $# -gt 0; do
 
   # Find the parent of NAME, using the empty string if it has none.
 changequote(,)dnl
-  parent="`echo $name | sed -n -e '/\//!q' -e 's=/[^/]*$==p'`"
+  parent="`echo $name | sed -n -e 's=/[^/]*$==' -e '/sysdeps$/q' -e p`"
 changequote([,])dnl
 
   # Add the names implied by NAME, and NAME's parent (if it has one), to
@@ -285,10 +320,10 @@ changequote([,])dnl
 done
 
 # Add the default directories.
-sysnames="$names generic stub"
+sysnames="$names sysdeps/generic sysdeps/stub"
 AC_SUBST(sysnames)
 # The other names were emitted during the scan.
-AC_MSG_RESULT(generic stub)
+AC_MSG_RESULT(sysdeps/generic sysdeps/stub)
 
 
 ### Locate tools.
@@ -525,9 +560,13 @@ libc_link_sources=
 # configure fragments, and looking for a uname implementation.
 uname=
 for dir in $sysnames; do
-  if test -r $sysdep_dir/$dir/configure; then
-    AC_MSG_RESULT(running configure fragment for $dir)
-    . $sysdep_dir/$dir/configure
+  case $dir in
+    /*) dest=$dir ;;
+    *)  dest=$srcdir/$dir ;;
+  esac
+  if test -r $dest/configure; then
+    AC_MSG_RESULT(running configure fragment for $dest)
+    . $dest/configure
   fi
 [
   if test -z "$uname"; then