Debian Codegraph @

m4/inline.m4

raw
1 # inline.m4
2 # serial 4
3 dnl Copyright (C) 2006, 2009-2024 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7 dnl This file is offered as-is, without any warranty.
8
9 dnl Test for the 'inline' keyword or equivalent.
10 dnl Define 'inline' to a supported equivalent, or to nothing if not supported,
11 dnl like AC_C_INLINE does. Also, define HAVE_INLINE if 'inline' or an
12 dnl equivalent is effectively supported, i.e. if the compiler is likely to
13 dnl drop unused 'static inline' functions.
14 AC_DEFUN([gl_INLINE],
15 [
16 AC_REQUIRE([AC_C_INLINE])
17 AC_CACHE_CHECK([whether the compiler generally respects inline],
18 [gl_cv_c_inline_effective],
19 [if test $ac_cv_c_inline = no; then
20 gl_cv_c_inline_effective=no
21 else
22 dnl GCC defines __NO_INLINE__ if not optimizing or if -fno-inline is
23 dnl specified.
24 dnl Use AC_COMPILE_IFELSE here, not AC_EGREP_CPP, because the result
25 dnl depends on optimization flags, which can be in CFLAGS.
26 dnl (AC_EGREP_CPP looks only at the CPPFLAGS.)
27 AC_COMPILE_IFELSE(
28 [AC_LANG_PROGRAM([[]],
29 [[#ifdef __NO_INLINE__
30 #error "inline is not effective"
31 #endif]])],
32 [gl_cv_c_inline_effective=yes],
33 [gl_cv_c_inline_effective=no])
34 fi
35 ])
36 if test $gl_cv_c_inline_effective = yes; then
37 AC_DEFINE([HAVE_INLINE], [1],
38 [Define to 1 if the compiler supports one of the keywords
39 'inline', '__inline__', '__inline' and effectively inlines
40 functions marked as such.])
41 fi
42 ])