Support uClibc compilation

partly based on aports from Alpine Linux:
http://code.ohloh.net/file?fid=Up3lAbVglPtyupfNPazFHQYMKM8&cid=Sr-nRbkkE8E&s=&fp=302485&mp=&projSelected=true#L0