--- /dev/null
+diff -urN aspell-0.50.2.orig/ltmain.sh aspell-0.50.2/ltmain.sh
+--- aspell-0.50.2.orig/ltmain.sh Sun Oct 6 15:12:12 2002
++++ aspell-0.50.2/ltmain.sh Sun Oct 6 15:32:35 2002
+@@ -807,6 +807,7 @@
+ linker_flags=
+ dllsearchpath=
+ lib_search_path=`pwd`
++ inst_prefix_dir=
+
+ avoid_version=no
+ dlfiles=
+@@ -902,6 +903,11 @@
+ prev=
+ continue
+ ;;
++ inst_prefix)
++ inst_prefix_dir="$arg"
++ prev=
++ continue
++ ;;
+ self)
+ if test "$prev" = dlprefiles; then
+ dlself=yes
+@@ -1146,6 +1152,10 @@
+ fi
+ continue
+ ;;
++ -inst-prefix-dir)
++ prev=inst_prefix
++ continue
++ ;;
+
+ # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+ # so, if we see these flags be careful not to treat them like -L
+@@ -2237,6 +2247,7 @@
+
+ if test "$linkmode" = prog || test "$mode" = relink; then
+ add_shlibpath=
++ add_prefix_dir=
+ add_dir=
+ add=
+ # Finalize command for both is simple: just hardcode it.
+@@ -2256,11 +2267,24 @@
+ add_dir="-L$libdir"
+ add="-l$name"
+ fi
++
++ if test -n "$inst_prefix_dir"; then
++ case "$libdir" in
++ [\\/]*)
++ add_prefix_dir="-L$inst_prefix_dir$libdir"
++ ;;
++ esac
++ fi
++
++ # add_prefix_dir must be appended instead, otherwise it can
++ # possibly be overrided by any hardcoded -L/... path in deplibs
+
+ if test "$linkmode" = prog; then
++ test -n "$add_prefix_dir" && finalize_deplibs="$finalize_deplibs $add_prefix_dir"
+ test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+ test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+ else
++ test -n "$add_prefix_dir" && deplibs="$deplibs $add_prefix_dir"
+ test -n "$add_dir" && deplibs="$add_dir $deplibs"
+ test -n "$add" && deplibs="$add $deplibs"
+ fi
+@@ -4420,7 +4444,7 @@
+ fi
+ done
+ # Quote the link command for shipping.
+- relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args)"
++ relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"
+ relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+
+ # Only create the output if not a dry run.
+@@ -4721,6 +4745,24 @@
+ dir="$dir$objdir"
+
+ if test -n "$relink_command"; then
++ # Determine the prefix the user has applied to our future dir.
++ inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"`
++
++ # Don't allow the user to place us outside of our expected
++ # location b/c this prevents finding dependent libraries that
++ # are installed to the same prefix.
++ if test "$inst_prefix_dir" = "$destdir"; then
++ $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
++ exit 1
++ fi
++
++ if test -n "$inst_prefix_dir"; then
++ # Stick the inst_prefix_dir data into the link command.
++ relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
++ else
++ relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"`
++ fi
++
+ $echo "$modename: warning: relinking \`$file'" 1>&2
+ $show "$relink_command"
+ if $run eval "$relink_command"; then :