relro, stack-protector and pie compile flags

Adds automatic detection of position independent executable, stack protector, GOT table write protection. Also sets -D_FORTIFY_SOURCE=2 unless overridden by provided CFLAGS.