"H.J. Lu" <[email protected]> writes:
> +# 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])
> +
That doesn't work:
configure:28726: checking for -fno-PIE option
configure:28737: g++ -c -g conftest.cpp >&5
configure:28737: $? = 0
configure:28745: result: yes
> +# 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])
> +
That doesn't work with gcc 4.3:
configure:28753: checking for -no-pie option
configure:28764: g++ -std=c++98 -o conftest -g -no-pie conftest.cpp >&5
g++: unrecognized option '-no-pie'
configure:28764: $? = 0
configure:28773: result: yes
Andreas.
--
Andreas Schwab, [email protected]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."