We prove that if the exponent function $p(\cdot)$ satisfies
log-Hölder continuity conditions locally and at infinity, then the
fractional maximal operator $M_\alpha$, $0 < \alpha < n$, maps
$L^{p(\cdot)}$ to $L^{q(\cdot)}$, where $\frac{1}{p(x)}-\frac{1}{q(x)}=\frac{\alpha}{n}$.
We also prove a weak-type inequality corresponding to the weak
$(1,n/(n-\alpha))$ inequality for $M_\alpha$.
We build upon earlier work on the Hardy-Littlewood maximal operator
by Cruz-Uribe, Fiorenza and Neugebauer [The maximal function on variable $L^p$ spaces.
Ann. Acad. Sci. Fenn. Math. 28 (2003), 223-238]. As a
consequence of these results for $M_\alpha$, we show that the
fractional integral operator $I_\alpha$ satisfies the same norm
inequalities. These in turn yield a generalization of the Sobolev
embedding theorem to variable $L^p$ spaces.