Compiling PostgreSQL on FreeBSD: readline header not found

Long story short: when issueing a configure in your PostgreSQL source tree you got:
checking for readline.h... no
configure: error: readline header not found
and the readline library is installed on the system:
% pkg info readline       
Name           : readline
Version        : 7.0.3_1
Installed on   : Thu May 31 13:39:23 2018 CEST
So what is going wrong? Simple: the configure script is not searching for in the correct include path, that on FreeBSD is /usr/local/include. The problem can be easily fixed adding --with-includes to the configure command line, and in particular the following is the line I use to compile PostgreSQL (e.g., 11 beta 1):
% ./configure --prefix=/opt/pg11b1 
The part --with-includes=/usr/local/include/ fixes the error on readline.

The article PostgreSQL 11 beta 1 on FreeBSD 11 has been posted by Luca Ferrari on May 31, 2018