readlink -f doesn't work on Mac OS; don't use -f

I don't know any good cross-platform way to do this simply, so I inlined
the first solution from
http://stackoverflow.com/questions/1055671/how-can-i-get-the-behavior-of-gnus-readlink-f-on-a-mac.
(I added quotes in appropriate places to make the script still work with
spaces or backslashes.)

This closes #243.

I don't like the fact that I've duplicated so much code, but I don't see a good way around it.  (I suppose I could make a bunch of .in files, one for each script, and do `@readlink_f@`, and put the definition of the function as a string in the `configure` file, but I think that might be even worse...)