implement SailfishOS support, made in collaboration with vakkov

sorry for building your hopes up, it currently segfaults:
https://bpaste.net/show/319c346897f6
i hope someone can help me out there

i've continued what vakkov started with cleanups and i tried to make it so that other platforms still work (but i cannot test all of them :()
Same as above. But at this point, it might be worth writing a small configure script that does tall the detecting and writes a small `config.h` and `config.mk` file that gets included by the makefile and the C source.