configure - reorganize the checks in a rational way

Signed-off-by: Davide Madrisan <davide.madrisan@gmail.com>