  We prove the equivalence of two conjectural constructions of unramified
cuspidal automorphic functions on the adelic group GL_n(A) associated to an
irreducible l-adic local system of rank n on an algebraic curve X over a finite
field. The existence of such a function is predicted by the Langlands
conjecture.
  The first construction, which was proposed by Shalika and Piatetski-Shapiro
following Weil and Jacquet-Langlands (n=2), is based on considering the
Whittaker function. The second construction, which was proposed recently by
Laumon following Drinfeld (n=2) and Deligne (n=1), is geometric: the
automorphic function is obtained via Grothendieck's ``faisceaux-fonctions''
correspondence from a complex of sheaves on an algebraic stack.
  Our proof of their equivalence is based on a local result about the spherical
Hecke algebra, which we prove for an arbitrary reductive group. We also discuss
a geometric interpretation of this result.
