llvm.org GIT mirror llvm / 39ed678
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102288 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 9 years ago
2 changed file(s) with 6 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
77 [ AC_LANG_PUSH([C])
88 oldcflags="$CFLAGS"
99 CFLAGS="$CFLAGS -Wl,-R."
10 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[int main() { return 0; }]])],
10 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
1111 [llvm_cv_link_use_r=yes],[llvm_cv_link_use_r=no])
1212 CFLAGS="$oldcflags"
1313 AC_LANG_POP([C])
2828 [ AC_LANG_PUSH([C])
2929 oldcflags="$CFLAGS"
3030 CFLAGS="$CFLAGS -Wl,-export-dynamic"
31 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[int main() { return 0; }]])],
31 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
3232 [llvm_cv_link_use_export_dynamic=yes],[llvm_cv_link_use_export_dynamic=no])
3333 CFLAGS="$oldcflags"
3434 AC_LANG_POP([C])
6969 echo "main" > "$tmp/exports"
7070
7171 CFLAGS="$CFLAGS -Wl,-retain-symbols-file=$tmp/exports"
72 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[int main() { return 0; }]])],
72 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
7373 [llvm_cv_link_use_retain_symbols_file=yes],[llvm_cv_link_use_retain_symbols_file=no])
7474 rm "$tmp/exports"
7575 rmdir "$tmp"
86338633 int
86348634 main ()
86358635 {
8636 int main() { return 0; }
8636
86378637 ;
86388638 return 0;
86398639 }
87258725 int
87268726 main ()
87278727 {
8728 int main() { return 0; }
8728
87298729 ;
87308730 return 0;
87318731 }
88368836 int
88378837 main ()
88388838 {
8839 int main() { return 0; }
8839
88408840 ;
88418841 return 0;
88428842 }