Don't clobber TMPDIR during Java detection

- Java detection used TMPDIR as var to parse command output
- TMPDIR is used in libltdl later on in ./configure
- alternative fix is local var or subshell
- fixes issue introduced via #33163ee

This should allow building on OS X again via homebrew for example.