\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage[xindy,automake]{glossaries}

\makeglossaries

\newglossaryentry{sample}{name={sample},
 description={an example}}

\begin{document}
A \gls{sample} document.

\printglossaries

\end{document}
