summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2006-11-10 14:37:40 +0000
committerBruno Haible <bruno@clisp.org>2006-11-10 14:37:40 +0000
commitba240e2ebbe21e986c41e7af3eac7268716e7702 (patch)
tree8788c8c1c1f46ad0735bf9b939f9aa64569006bc
parentba700afa42d9f358e78a717d3430883280b048a7 (diff)
downloadgnulib-ba240e2ebbe21e986c41e7af3eac7268716e7702.tar.gz
Use a command that uses $CC $CFLAGS, not $CPP, to test whether inline is
effective. From Jim.
-rw-r--r--ChangeLog6
-rw-r--r--m4/inline.m417
2 files changed, 17 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 43670409bd..74371ff135 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2006-11-10 Jim Meyering <jim@meyering.net>
+ * m4/inline.m4 (gl_INLINE): Check with the compiler, not cpp, so that
+ relevant options in CFLAGS (like -O, -fno-inline) are taken into
+ account.
+
+2006-11-10 Jim Meyering <jim@meyering.net>
+
* modules/inline: New file/module.
* modules/xalloc (Files): Remove m4/inline.m4.
(Depends-on): Add inline, instead.
diff --git a/m4/inline.m4 b/m4/inline.m4
index 2810dd1a22..a07076cd6b 100644
--- a/m4/inline.m4
+++ b/m4/inline.m4
@@ -1,4 +1,4 @@
-# inline.m4 serial 2
+# inline.m4 serial 3
dnl Copyright (C) 2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -19,11 +19,16 @@ AC_DEFUN([gl_INLINE],
else
dnl GCC defines __NO_INLINE__ if not optimizing or if -fno-inline is
dnl specified.
- AC_EGREP_CPP([bummer], [
- #ifdef __NO_INLINE__
- bummer
- #endif
- ], [gl_cv_c_inline_effective=no], [gl_cv_c_inline_effective=yes])
+ dnl Use AC_COMPILE_IFELSE here, not AC_EGREP_CPP, because the result
+ dnl depends on optimization flags, which can be in CFLAGS.
+ dnl (AC_EGREP_CPP looks only at the CPPFLAGS.)
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[]],
+ [[#ifdef __NO_INLINE__
+ #error "inline is not effective"
+ #endif]])],
+ [gl_cv_c_inline_effective=yes],
+ [gl_cv_c_inline_effective=no])
fi
])
if test $gl_cv_c_inline_effective = yes; then