What the configure.in script does here is pretty bad practice, changing PATH, CPATH, and LD_LIBRARY_PATH, as well as other environment variables in a way that effectively overrides the user's preferred values by prepending to them instead of appending to them.
I am on a machine where /usr/bin/gcc is an old gcc that doesn't have the standard required to build tkrzw. I have in my PATH a newer gcc (13.2.0) that is the one I use by default. gcc --version gives me 13.2.0, but because tkrzw's configure script prepends /usr/bin to the PATH variable, it picks up the old gcc and fails to compile. Took me a while to figure out why.