+# Does this compiler and linker support -pie?
+# Some compilers actually do not support -pie and report its usage
+# as an error. We need to check if it is safe to use it first.
+AC_MSG_CHECKING([if gcc accepts -pie])
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[
+ return 0;
# Does this compiler support -no-pie?
# On Ubuntu 16.10+, gcc produces position independent executables (PIE) by
# default. However this gets in the way with some tests, we use -no-pie