gdb's configure check for GMP is insufficient to build gdb 11.1 on Solaris 11.3: * The bundled gmp is too old (at least for gcc's requirements), and even if it were ok for gdb, gmp.h lives in /usr/include/gmp, thus the header isn't found. * A self-compiled libgmp isn't found for a 64-bit build. While the header lives in $prefix/include, the library lives in $prefix/lib/sparcv9 resp. $prefix/lib/amd64 for the 64-bit case. Solaris being multilibbed, the 32-bit libraries live in .../lib, while the 64-bit libs live in .../lib/sparcv9 etc. subdirs. gdb's --with-gmp-prefix is not enough to describe this situation because it only supports $prefix/include and $prefix/lib. Neither the Solaris 11.3-native /usr/include/gmp directory for the header no the non-default $prefix/lib/{sparcv9,amd64} can be described that way. I tried configuring with LDFLAGS=-L$prefix/lib/sparcv9 so the library is found at configure time, but this doesn't work because the link line is gcc -o conftest -g -O2 -I/vol/gcc/include -L/vol/gcc/lib/sparcv9 conftest.c -lncurses -lsocket -lnsl -lm /vol/gcc/lib/libgmp.a i.e. the static library is specified with a (wrong) full path. gcc gets things right by providing --with-gmp=$dir for the default case, but allowing to specify --with-gmp-include and --with-gmp-lib separately to allow for specific situations.
I also tried passing CPPFLAGS=-I/usr/include/gmp so the bundled gmp.h is found, but that doesn't work either because that isn't used in the subdir configure runs.
There was a thread about unifying the two different flags approaches: https://sourceware.org/pipermail/gdb-patches/2020-November/173301.html
I'm arbitrarily picking one bug as the canonical one. *** This bug has been marked as a duplicate of bug 28500 ***