Evaluate $\int_0^\infty\frac{\sin(\varphi_1x)}x\frac{\sin\varphi_2x}x\cdots\frac{\sin\varphi_nx}x\frac{\sin(ax)}x\cos(a_1x)\cdots\cos(a_mx) \, dx$ How to evaluate
$$ 
\int_0^\infty \frac{\sin(\varphi_1x)}{x}\frac{\sin\varphi_2x}{x} \cdots \frac{\sin\varphi_nx}{x} \frac{\sin(ax)}{x}\cos(a_1x) \cdots \cos(a_mx) \, dx  \text{ ?}
$$
For small $n$ and $m$ it's simple (setting $\sin(kx)=\dfrac{e^{ikx}-e^{-ikx}}{2i}$ and using Jordan's lemma, but for arbitrary $n$ the calculation is too tedious. Surely there must be some nice trick here?
Thanks 
 A: We will assume the parameters $\phi_1,\ldots,\phi_n$, $a_1,\ldots, a_m$ satisfy
the condition given in page 122 of Whittaker and Waston's classic "A Course of Modern Analysis".

$\phi_1,\ldots,\phi_n$, $a_1, \ldots, a_m$ are real, $a$ is positive and
  $a > \sum_{p=1}^n |\phi_p| + \sum_{q=1}^m | a_q|$

Under this condition, the integral at hand evaluates to $\frac{\pi}{2}\prod_{p=1}^n \phi_p$.
We will further assume all $\phi_p \ne 0$. Otherwise, the integral trivially evaluates to zero. 
When $\phi_p \ne 0$, the singularity of $\frac{\sin(\phi_p x)}{x}$ at $x = 0$ is removable, if we define the value of $\frac{\sin(\phi_p x)}{x}$ at $x = 0$ to be $\phi_p$, we will turn this into an entire function.
Let $f(x)$ be the product $\prod\limits_{p=1}^n\frac{\sin(\phi_p x)}{x}\prod\limits_{q=1}^m \cos(a_q x)$. With above interpretation in mind, this is an entire function in $x$. For large $z \in \mathbb{C}$, we can bound the growth
of $f(z)$ as
$$|f(z)| = O( e^{K|\Im z|} )\quad\text{ where }\quad K = \sum_{p=1}^n|\phi_p| + \sum_{q=1}^m|a_m|\tag{*1}$$
Notice $\frac{\sin(a x)}{x}$ is finite
at $x = 0$ and $f(x)$ is an even function in $x$. 
Our integral equals to
$$\int_0^\infty f(x)\frac{\sin a x}{x} dx 
= \lim_{\substack{R\to\infty\\ \epsilon\to 0}}  \int_{\epsilon}^R f(x)\frac{\sin( a x)}{x} dx
= \frac12 \lim_{\substack{R\to\infty\\ \epsilon\to 0}} \left(
\int_{-R}^{-\epsilon} + \int_{\epsilon}^R\right) f(x)\frac{\sin(a x)}{x} dx
\\= \frac{1}{2i}
\lim_{\substack{R\to\infty\\ \epsilon\to 0}} \left(
\int_{-R}^{-\epsilon} + \int_{\epsilon}^R\right)
f(x)\frac{e^{iax}}{x} dx
$$
To evaluate this integral, consider following contour $C$ consists of 4 segments:


*

*a line segment from $-R$ to $-\epsilon$.

*$C_\epsilon$ a circular segment $\epsilon e^{i\theta}$ with $\theta$ from $\pi$ to $0$.

*a line segment from $\epsilon$ to $R$.

*$C_R$ a circular segment $R e^{i\phi}$ with $\phi$ from $0$ to $\pi$.


Since $C$ doesn't contain any singularity of the integrand, we have
$$\oint_C f(x)\frac{e^{iax}}{x} dx = 0
\implies
\left(
\int_{-R}^{-\epsilon} + \int_{\epsilon}^R\right)
f(x)\frac{e^{iax}}{x} dx
= -\left(
\int_{C_R} + \int_{C_\epsilon}\right)
f(x)\frac{e^{iax}}{x} dx
$$
Under the assumption $a > K = \sum_{p=1}^n|\phi_p| + \sum_{q=1}^m |a_q|$, 
the bound $(*1)$ tell us
$$\lim_{R\to\infty}\int_{C_R} f(x)\frac{e^{iax}}{x} dx = 0$$
Since $f(x)$ is regular near $x = 0$, as $\epsilon \to 0$, the integral over $C_{\epsilon}$ gives us $-\pi i = (-\frac12)(2\pi i)$ of the residue of $f(x) \frac{e^{iax}}{x}$ at $x = 0$ ($-\pi i$ instead of $\pi i$ because $\theta$ varies from $\pi$ to $0$). As a result, the integral at hand equals to
$$\frac{i}{2}\lim_{\epsilon\to 0}\int_{C_\epsilon}f(x)\frac{e^{iax}}{x}dx = \frac{i}{2} (-\pi i) f(0) e^{i0} = \frac{\pi}{2}f(0) = \frac{\pi}{2} \prod_{p=1}^n \phi_p$$
