# HG changeset patch
# User Andrew Jeffery <andrew@aj.id.au>
# Date 1260493323 -37800
# Node ID bf8aedcfe67afaebc65544a6f4eeab4a99c3ed5a
# Parent  32cc41c2fdeaf3c5400cc3491ad82b8a9341d305
configure: fix main signature in compiler ANSI check

The check GMP_C_FOR_BUILD_ANSI ("checking whether build system compiler is
ANSI...") fails, due to what seems to be an issue with the main function
signature. The configure script attempts to compile:

  cat >conftest.c <<EOF
int
main (int argc, char *argv)
{
  exit(0);
}
EOF

for the test. This code fails when compiled with clang:

$ clang conftest.c
conftest.c:2:1: error: second argument of 'main' should be of type 'char **'
main (int argc, char *argv)
^
conftest.c:4:3: warning: implicitly declaring C library function 'exit' with
type 'void (int)'
  exit(0);
  ^
conftest.c:4:3: note: please include the header <stdlib.h> or explicitly
provide a declaration for 'exit' 3 diagnostics generated.

The macro definition in acinclude.m4 follows; I think this might be something
to do with '[]'s not being escaped, and hence they don't get included as part
of the code that gets compiled in configure:

[cat >conftest.c <<EOF
int
main (int argc, char *argv[])
{
  exit(0);
}
EOF
gmp_compile="$CC_FOR_BUILD conftest.c"
if AC_TRY_EVAL(gmp_compile); then
  gmp_cv_c_for_build_ansi=yes
else
  gmp_cv_c_for_build_ansi=no
fi
rm -f conftest* a.out b.out a.exe a_out.exe
]

diff -r 32cc41c2fdea -r bf8aedcfe67a acinclude.m4
--- a/acinclude.m4	Sun Oct 25 17:49:40 2009 +0100
+++ b/acinclude.m4	Fri Dec 11 11:32:03 2009 +1030
@@ -3807,7 +3807,7 @@
                gmp_cv_c_for_build_ansi,
 [cat >conftest.c <<EOF
 int
-main (int argc, char *argv[])
+main (int argc, char **argv)
 {
   exit(0);
 }
