Quick and dirty solution
The package ifplatform provides four \if.... commands to check which system is underlying:
\ifwindows
\iflinux
\ifmacosx
\ifcygwin
Please note, that shell-escape must be enabled, otherwise all \if... macros by the package return false!
The basic question is, why one would use such a switch for encodings at all, as this is basically an editor setting, not an OS configuration issue.
\documentclass{article}
\usepackage{ifplatform}
% Possible, but not recommended!!!!!!!!
\iflinux
\usepackage[utf8]{inputenc}
\else
\ifwindows
\usepackage[latin1]{inputenc}
\fi
\fi
\begin{document}
\iflinux
\Huge Yes, this is the most beautiful system in the world
\else
\small Poor boy
\fi
\end{document}

ifplatformshould help – Dec 03 '14 at 21:53