Add flag for generating executable file to check_compile

This is useful for checking that whether system has OS specific
functions, such as 'accept4', 'dup3', etc.