diff options
Diffstat (limited to 'gcc/configure.ac')
-rw-r--r-- | gcc/configure.ac | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/gcc/configure.ac b/gcc/configure.ac index c76d06d..83f9c09 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -5819,6 +5819,46 @@ cat > gcc-driver-name.h <<EOF #define GCC_DRIVER_NAME "${target_noncanonical}-gcc-${gcc_BASEVER}${exeext}" EOF +# Check whether --enable-default-pie was given. +AC_ARG_ENABLE(default-pie, +[AS_HELP_STRING([--enable-default-pie], + [enable Position Independent Executable as default])], +enable_default_pie=$enableval, +enable_default_pie=no) +if test x$enable_default_pie == xyes ; then + AC_DEFINE(ENABLE_DEFAULT_PIE, 1, + [Define if your target supports default PIE and it is enabled.]) +fi +AC_SUBST([enable_default_pie]) + +# Check if -fno-PIE works. +AC_CACHE_CHECK([for -fno-PIE option], + [gcc_cv_c_no_fpie], + [saved_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-PIE" + AC_COMPILE_IFELSE([int main(void) {return 0;}], + [gcc_cv_c_no_fpie=yes], + [gcc_cv_c_no_fpie=no]) + CFLAGS="$saved_CFLAGS"]) +if test "$gcc_cv_c_no_fpie" = "yes"; then + NO_PIE_CFLAGS="-fno-PIE" +fi +AC_SUBST([NO_PIE_CFLAGS]) + +# Check if -no-pie works. +AC_CACHE_CHECK([for -no-pie option], + [gcc_cv_no_pie], + [saved_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -no-pie" + AC_LINK_IFELSE([int main(void) {return 0;}], + [gcc_cv_no_pie=yes], + [gcc_cv_no_pie=no]) + LDFLAGS="$saved_LDFLAGS"]) +if test "$gcc_cv_no_pie" = "yes"; then + NO_PIE_FLAG="-no-pie" +fi +AC_SUBST([NO_PIE_FLAG]) + # Configure the subdirectories # AC_CONFIG_SUBDIRS($subdirs) |