TL;DR: please undo the apparently accidentally committed part of 78376b0797aa994538169a20abb9800a361f82b5 which seems to be a local debug check
Building fails when using --with-builtin-tommath configure option because gen/Makefile contains this line
$(MAKE) -C $(ROOT)/extern/libtommath -f makefile.shared LIBTOOL=$(LIBTOOL)
while extern/libtommath/makefile.shared contains this
So LIBTOOL ends up being defined, but empty, meaning that all attempts to use it fail.
The problematic line in gen/Makefile comes from builds/posix/Makefile.in and was added to it by 78376b0797aa994538169a20abb9800a361f82b5 seemingly accidentally, as it doesn't bear any relationship to the commit message. AFAICS the first chunk of this commit should be just reverted, which would fix the problem. Alternatively, fix extern/libtommath/makefile.shared to use ifeq($(LIBTOOL),) instead of checking if it's defined.
Note that this commit is in 3.0 branch only, so it doesn't affect master/4.0.