This should finally fix #5293 by fixing two bugs in GMP's configuration setup