Fix a build issue on Solaris 10

Use own mkdtemp implementation if not available.

Reported by Thomas Klausner and Jörn Clausen