reorder libraries to solve linker error.

: 'undefined reference to __errno'
Change if statement to an elif.