* acinclude.m4 (grub_CHECK_PIC): New test.

	* configure.ac: Add -fno-PIC to TARGET_CFLAGS if -fPIC is default.
parent 97304d7c
2012-02-29 Vladimir Serbinenko <phcoder@gmail.com>
* acinclude.m4 (grub_CHECK_PIC): New test.
* configure.ac: Add -fno-PIC to TARGET_CFLAGS if -fPIC is default.
2012-02-29 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/libgcc.h (__STDC_VERSION__): Define if it's not yet so
......@@ -424,3 +424,31 @@ else
AC_MSG_RESULT([no])
[fi]
])
dnl Check if the C compiler supports `-fPIC'.
AC_DEFUN([grub_CHECK_PIC],[
[# Position independent executable.
pic_possible=yes]
AC_MSG_CHECKING([whether `$CC' has `-fPIC' as default])
# Is this a reliable test case?
AC_LANG_CONFTEST([AC_LANG_SOURCE([[
#ifdef __PIC__
int main() {
return 0;
}
#else
#error NO __PIC__ DEFINED
#endif
]])])
[# `$CC -c -o ...' might not be portable. But, oh, well... Is calling
# `ac_compile' like this correct, after all?
if eval "$ac_compile -S -o conftest.s" 2> /dev/null; then]
AC_MSG_RESULT([yes])
[# Should we clear up other files as well, having called `AC_LANG_CONFTEST'?
rm -f conftest.s
else
pic_possible=no]
AC_MSG_RESULT([no])
[fi]
])
......@@ -596,6 +596,14 @@ if [ x"$pie_possible" = xyes ]; then
TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE"
fi]
# Position independent executable.
grub_CHECK_PIC
[# Need that, because some distributions ship compilers that include
# `-fPIC' in the default specs.
if [ x"$pic_possible" = xyes ]; then
TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIC"
fi]
# Smashing stack protector.
grub_CHECK_STACK_PROTECTOR
# Need that, because some distributions ship compilers that include
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment