We introduce a new technique to optimize a linear cost function subject to a one-dimensional affine homogeneous quadratic integral inequality, i.e., the requirement that a homogeneous quadratic integral functional, affine in the optimization variables, is non-negative over a space of functions defined by homogeneous boundary conditions. Such problems arise in stability analysis, input-to-state/output analysis, and control of many systems governed by partial differential equations (PDEs), in particular fluid dynamical systems. First, we derive outer approximations for the feasible set of a homogeneous quadratic integral inequality in terms of linear matrix inequalities (LMIs), and show that under mild assumptions a convergent, non-decreasing sequence of lower bounds for the optimal cost can be computed with a sequence of semidefinite programs (SDPs). Second, we obtain inner approximations in terms of LMIs and sum-of-squares constraints, so upper bounds for the optimal cost and strictly feasible points for the integral inequality can also be computed with SDPs. To aid the formulation and solution of our SDP relaxations, we implement our techniques in QUINOPT, an opensource add-on to YALMIP. We demonstrate our techniques by solving problems arising from the stability analysis of PDEs.