-# Allow tic to run either from the install-path, or from the build-directory
-case "$PATH" in
-:*) PATH=../progs:${DESTDIR}$bindir$PATH ;;
-*) PATH=../progs:${DESTDIR}$bindir:$PATH ;;
-esac
-export PATH
+# Allow tic to run either from the install-path, or from the build-directory.
+# Do not do this if we appear to be cross-compiling. In that case, we rely
+# on the host's copy of tic to compile the terminfo database.
+if test "x$cross_compiling" = "xno"
+then
+ if test -f ../progs/tic$suffix
+ then
+ case "$PATH" in
+ \@PATH_SEPARATOR@*)
+ PATH="../progs@PATH_SEPARATOR@../lib@PATH_SEPARATOR@${DESTDIR}$bindir$PATH"
+ ;;
+ *)
+ PATH="../progs@PATH_SEPARATOR@../lib@PATH_SEPARATOR@${DESTDIR}$bindir@PATH_SEPARATOR@$PATH"
+ ;;
+ esac
+ export PATH
+ if test @DFT_LWR_MODEL@ = shared
+ then
+ SHLIB="sh $srcdir/shlib"
+ TIC_PATH="$SHLIB tic"
+ else
+ TIC_PATH="tic"
+ fi
+ elif test "$TIC_PATH" = unknown
+ then
+ echo '? no tic program found'
+ exit 1
+ fi
+else
+ # Cross-compiling, so don't set PATH or run shlib.
+ SHLIB=
+ # reset $suffix, since it applies to the target, not the build platform.
+ suffix=
+fi
+