diff options
author | Kevin Ryde <user42@zip.com.au> | 2001-06-20 00:08:45 +0200 |
---|---|---|
committer | Kevin Ryde <user42@zip.com.au> | 2001-06-20 00:08:45 +0200 |
commit | 62b4dcf17e2b7d73f728b13109520a76ac8935a6 (patch) | |
tree | c64ad8f5ccf6689a3edcf43ed771a41a1b9f6ead /acinclude.m4 | |
parent | 4af1acba473084ba5779c50de81e2e1c56a622b5 (diff) | |
download | gmp-62b4dcf17e2b7d73f728b13109520a76ac8935a6.tar.gz |
More of:
* acinclude.m4, configure.in (GMP_C_ATTRIBUTE_MALLOC): New macro.
Diffstat (limited to 'acinclude.m4')
-rw-r--r-- | acinclude.m4 | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/acinclude.m4 b/acinclude.m4 index f83bfb731..809f0f7e1 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1352,12 +1352,28 @@ fi dnl GMP_C_ATTRIBUTE_MALLOC dnl ---------------------- +dnl gcc 2.95.x accepts __attribute__ ((malloc)) but with a warning that +dnl it's ignored. Pretend it doesn't exist in this case, to avoid that +dnl warning. AC_DEFUN(GMP_C_ATTRIBUTE_MALLOC, [AC_CACHE_CHECK([whether gcc __attribute__ ((malloc)) works], gmp_cv_c_attribute_malloc, -[AC_TRY_COMPILE([void *foo (int x) __attribute__ ((malloc));], , - gmp_cv_c_attribute_malloc=yes, gmp_cv_c_attribute_malloc=no) +[cat >conftest.c <<EOF +void *foo (int x) __attribute__ ((malloc)); +EOF +gmp_compile="$CC $CFLAGS $CPPFLAGS -c conftest.c >conftest.out 2>&1" +if AC_TRY_EVAL(gmp_compile); then + if grep "attribute directive ignored" conftest.out >/dev/null; then + gmp_cv_c_attribute_malloc=no + else + gmp_cv_c_attribute_malloc=yes + fi +else + gmp_cv_c_attribute_malloc=no +fi +cat conftest.out >&AC_FD_CC +rm -f conftest* ]) if test $gmp_cv_c_attribute_malloc = yes; then AC_DEFINE(HAVE_ATTRIBUTE_MALLOC, 1, |