Take a look at this post: Optimization, root finding, and nonlinear equation solving
For constrained optimization, you would need something like SLSQP (free), SNOPT (not free) or VF13AD (freely available for download). IPOPT (free, non-trivial to compile though) is C++ but has a Fortran interface that works.