This question is motivated by my previous post about sinc function.
Prove or disprove that $\frac{\sin x}{x}$ is the only nonzero entire (i.e. analytic everywhere) function $f(x)$ on $\mathbb{R}$ such that $$\int_0^\infty f(x) dx=\int_0^\infty f(x)^2 dx$$ or $$\int_{-\infty}^\infty f(x) dx=\int_{-\infty}^\infty f(x)^2 dx.$$
If $f$ is required only to be continuous, then other examples are possible, e.g. the even extension of the following function: $$ f(x)=\left\{\begin{array}{ll} -2(5+\sqrt{65})x^2+(7+\sqrt{65})x-1 & 0\le x\le \frac{1}{2}\\ 2(5+\sqrt{65})x^2-(13+3\sqrt{65})x+4+\sqrt{65} & \frac{1}{2}\le x\le 1\\ \frac{1}{x^2} & x\ge 1 \end{array}\right. $$
As commented below, it turns out that there are easy answers to the above question. AD also showed a function below that also satisfies $$ \sum_{n=1}^\infty f(n)=\sum_{n=1}^\infty f(n)^2=0. $$ In view of these answers, my question is now revised to:
Prove or disprove that $\frac{\sin x}{x}$ is the only nonzero entire function, $f(x)$ on $\mathbb{R}$ such that $$\int_{-\infty}^\infty f(x) dx=\int_{-\infty}^\infty f(x)^2 dx=\sum_{-\infty}^\infty f(n) =\sum_{-\infty}^\infty f(n)^2 $$