From: Dan Gohman Date: Sun, 25 Apr 2010 00:12:20 +0000 (+0000) Subject: Fix an autoconf bug: The second argument to AC_LANG_PROGRAM is code that X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=39ed6789c537ab6ec3d9b5944761e87c215f4fab;p=oota-llvm.git 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 --- diff --git a/autoconf/m4/link_options.m4 b/autoconf/m4/link_options.m4 index 3442e465674..697abab07d4 100644 --- a/autoconf/m4/link_options.m4 +++ b/autoconf/m4/link_options.m4 @@ -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" diff --git a/configure b/configure index 84bf2e2d58b..9f35b4196a0 100755 --- a/configure +++ b/configure @@ -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; }