[llvm-commits] [llvm] r102288 - in /llvm/trunk: autoconf/m4/link_options.m4 configure

Dan Gohman gohman at apple.com
Sat Apr 24 17:12:20 PDT 2010


Author: djg
Date: Sat Apr 24 19:12:20 2010
New Revision: 102288

URL: http://llvm.org/viewvc/llvm-project?rev=102288&view=rev
Log:
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.

Modified:
    llvm/trunk/autoconf/m4/link_options.m4
    llvm/trunk/configure

Modified: llvm/trunk/autoconf/m4/link_options.m4
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/m4/link_options.m4?rev=102288&r1=102287&r2=102288&view=diff
==============================================================================
--- llvm/trunk/autoconf/m4/link_options.m4 (original)
+++ llvm/trunk/autoconf/m4/link_options.m4 Sat Apr 24 19:12:20 2010
@@ -8,7 +8,7 @@
 [ 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_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 @@
   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"

Modified: llvm/trunk/configure
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=102288&r1=102287&r2=102288&view=diff
==============================================================================
--- llvm/trunk/configure (original)
+++ llvm/trunk/configure Sat Apr 24 19:12:20 2010
@@ -8634,7 +8634,7 @@
 int
 main ()
 {
-int main() { return 0; }
+
   ;
   return 0;
 }
@@ -8726,7 +8726,7 @@
 int
 main ()
 {
-int main() { return 0; }
+
   ;
   return 0;
 }
@@ -8837,7 +8837,7 @@
 int
 main ()
 {
-int main() { return 0; }
+
   ;
   return 0;
 }





More information about the llvm-commits mailing list