Correct encdir handling

Moves it below @libdir, as appropriate if it or @appdir is set.