Solution (source code)

= Solution

Use the nonnegative parts $h^+=\max(h,0)$ and $h^-=\max(-h,0)$, so $h=h^+-h^-$. The zero-mean assumption gives $H:=\int_0^\pi h^+=\int_0^\pi h^-<\infty$. On the $k$-th period, each of the positive and negative weighted integrals lies between $H/((k+1)\pi)$ and $H/(k\pi)$. Their difference therefore satisfies the stronger estimate
$$
\left|\int_{k\pi}^{(k+1)\pi}\frac{h(x)}x\,dx\right|
\leq\frac H\pi\left(\frac1k-\frac1{k+1}\right)
=\frac H{\pi k(k+1)}\leq\boxed{\frac H{\pi k^2}}.
$$
The sum of the absolute values of these block integrals converges, proving the existence of the finite limit of the integrals from $\pi$ to $n\pi$.

For genuine <Lebesgue integrability> we instead need the integral of the absolute value. Periodicity gives
$$
\int_{k\pi}^{(k+1)\pi}\frac{|h(x)|}x\,dx\geq\frac{2H}{(k+1)\pi}.
$$
If $H>0$, summation diverges by the <harmonic series>. If $H=0$, then $h=0$ <almost everywhere> and the function is integrable. Thus
$$
\boxed{g\in L^1(\pi,\infty)\quad\Longleftrightarrow\quad h=0\text{ almost everywhere}.}
$$
The finite signed block limit therefore need not be a <Lebesgue integral>.