Yes they're a pain in the ass, but a necessary one.
`uname -s` obviously doesn't cater for the divergences and bugs within a platform.
Have a look at gnulib for things one has to deal with. BTW, one can just use gnulib and forget about lots of portability issues