summaryrefslogtreecommitdiff
path: root/acinclude.m4
diff options
context:
space:
mode:
authorKevin Ryde <user42@zip.com.au>2001-10-01 02:40:34 +0200
committerKevin Ryde <user42@zip.com.au>2001-10-01 02:40:34 +0200
commita0d58a093e2c0cd6f62f69e319076967feeeec96 (patch)
treed40ddf4a29842e5eccf269f71db914f651b3a1d6 /acinclude.m4
parent81113a41032782f56122415a64dd94f463598658 (diff)
downloadgmp-a0d58a093e2c0cd6f62f69e319076967feeeec96.tar.gz
* acinclude.m4 (GMP_PROG_CXX_WORKS): New macro.
(GMP_PROG_CC_WORKS): Write "conftest" test program, not a.out.
Diffstat (limited to 'acinclude.m4')
-rw-r--r--acinclude.m439
1 files changed, 36 insertions, 3 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index a94057c6b..3b9a6c533 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -299,13 +299,13 @@ void *f() { return g(); }
int main () { return 0; }
EOF
-gmp_compile="$1 conftest.c >&AC_FD_CC"
+gmp_compile="$1 conftest.c -o conftest >&AC_FD_CC"
if AC_TRY_EVAL(gmp_compile); then
- rm -f conftest* a.out
+ rm -f conftest*
AC_MSG_RESULT(yes)
ifelse([$2],,:,[$2])
else
- rm -f conftest* a.out
+ rm -f conftest*
AC_MSG_RESULT(no)
ifelse([$3],,:,[$3])
fi
@@ -544,6 +544,39 @@ fi
])
+dnl GMP_PROG_CXX_WORKS(cxx/cxxflags [, ACTION-YES [,ACTION-NO]])
+dnl ------------------------------------------------------------
+dnl Check whether cxx/cxxflags can compile and link.
+dnl
+dnl This test is designed to be run repeatedly with different cxx/cxxflags
+dnl selections, so the result is not cached.
+
+AC_DEFUN(GMP_PROG_CXX_WORKS,
+[AC_MSG_CHECKING([C++ compiler $1])
+cat >conftest.cc <<EOF
+#include <iostream.h>
+int
+main (void)
+{
+ cout.setf (ios::hex);
+ cout << 123;
+ return 0;
+}
+EOF
+
+gmp_cxxcompile="$1 conftest.cc -o conftest"
+if AC_TRY_EVAL(gmp_cxxcompile); then
+ rm -f conftest*
+ AC_MSG_RESULT(yes)
+ ifelse([$2],,:,[$2])
+else
+ rm -f conftest*
+ AC_MSG_RESULT(no)
+ ifelse([$3],,:,[$3])
+fi
+])
+
+
dnl GMP_INIT([M4-DEF-FILE])
dnl -----------------------
dnl Initializations for GMP config.m4 generation.