Use mktemp instead of tempfile

We now use the mktemp command to generate temporary file names instead
of the tempfile command which is not available on BSD systems.