Unset $CFLAGS for "GNU non-executable stack" configure test; fixes #3889
authorIan Lynagh <igloo@earth.li>
Fri, 21 May 2010 16:50:05 +0000 (16:50 +0000)
committerIan Lynagh <igloo@earth.li>
Fri, 21 May 2010 16:50:05 +0000 (16:50 +0000)
With gcc 4.4 we get
    Error: can't resolve `.note.GNU-stack' {.note.GNU-stack section} - `.Ltext0' {.text section}
when running gcc with the -g flag. To work around this we unset
CFLAGS when running the test.

configure.ac

index 634b66b..28e380b 100644 (file)
@@ -823,6 +823,11 @@ AC_COMPILE_IFELSE(
 dnl *** check for GNU non-executable stack note support (ELF only)
 dnl     (.section .note.GNU-stack,"",@progbits)
 
+dnl This test doesn't work with "gcc -g" in gcc 4.4 (GHC trac #3889:
+dnl     Error: can't resolve `.note.GNU-stack' {.note.GNU-stack section} - `.Ltext0' {.text section}
+dnl so we empty CFLAGS while running this test
+CFLAGS2="$CFLAGS"
+CFLAGS=
 AC_MSG_CHECKING(for GNU non-executable stack support)
 AC_COMPILE_IFELSE(
     [AC_LANG_PROGRAM([__asm__ (".section .note.GNU-stack,\"\",@progbits");], [0])],
@@ -831,6 +836,7 @@ AC_COMPILE_IFELSE(
                [Define to 1 if GNU non-executable stack notes are supported.])
     ],
     [AC_MSG_RESULT(no)])
+CFLAGS="$CFLAGS2"
 
 dnl ** check for librt
 AC_CHECK_LIB(rt, clock_gettime)