Fix an autoconf bug: The second argument to AC_LANG_PROGRAM is code that

gets placed inside a main function, and should not itself be a main
function. This is silently hidden in GCC-hosted builds because the
inner main looks like a nested function declaration, which GCC supports.
In builds with compilers which do not support nested functions (by default),
this was causing an error, which caused these autoconf checks to fail, 
leaving their options disabled.

This fixes test/Feature/load_module.ll on x86_64-unknown-linux-gnu
llvm-gcc selfhost builds, among other things.

This also includes a regenerated configure, as the diff is small and telling.

llvm-svn: 102288
This commit is contained in:
Dan Gohman 2010-04-25 00:12:20 +00:00
parent 9556257252
commit a1c94049c2
2 changed files with 6 additions and 6 deletions

View File

@ -8,7 +8,7 @@ AC_DEFUN([AC_LINK_USE_R],
[ AC_LANG_PUSH([C])
oldcflags="$CFLAGS"
CFLAGS="$CFLAGS -Wl,-R."
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[int main() { return 0; }]])],
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
[llvm_cv_link_use_r=yes],[llvm_cv_link_use_r=no])
CFLAGS="$oldcflags"
AC_LANG_POP([C])
@ -29,7 +29,7 @@ AC_DEFUN([AC_LINK_EXPORT_DYNAMIC],
[ AC_LANG_PUSH([C])
oldcflags="$CFLAGS"
CFLAGS="$CFLAGS -Wl,-export-dynamic"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[int main() { return 0; }]])],
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
[llvm_cv_link_use_export_dynamic=yes],[llvm_cv_link_use_export_dynamic=no])
CFLAGS="$oldcflags"
AC_LANG_POP([C])
@ -70,7 +70,7 @@ AC_DEFUN([AC_LINK_RETAIN_SYMBOLS_FILE],
echo "main" > "$tmp/exports"
CFLAGS="$CFLAGS -Wl,-retain-symbols-file=$tmp/exports"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[int main() { return 0; }]])],
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
[llvm_cv_link_use_retain_symbols_file=yes],[llvm_cv_link_use_retain_symbols_file=no])
rm "$tmp/exports"
rmdir "$tmp"

6
llvm/configure vendored
View File

@ -8634,7 +8634,7 @@ cat >>conftest.$ac_ext <<_ACEOF
int
main ()
{
int main() { return 0; }
;
return 0;
}
@ -8726,7 +8726,7 @@ cat >>conftest.$ac_ext <<_ACEOF
int
main ()
{
int main() { return 0; }
;
return 0;
}
@ -8837,7 +8837,7 @@ cat >>conftest.$ac_ext <<_ACEOF
int
main ()
{
int main() { return 0; }
;
return 0;
}