Debian Codegraph @

lib/unistring/m4/inline.m4

raw
1 # inline.m4
2 # serial 5
3 dnl Copyright (C) 2006, 2009-2026 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 actually inline 'static inline' functions when there are used. (All
14 dnl versions of gcc and clang actually drop the code of 'static inline'
15 dnl functions that are unused in the current compilation unit.)
16 AC_DEFUN([gl_INLINE],
17 [
18 AC_REQUIRE([AC_C_INLINE])
19 AC_CACHE_CHECK([whether the compiler generally respects inline],
20 [gl_cv_c_inline_effective],
21 [if test $ac_cv_c_inline = no; then
22 gl_cv_c_inline_effective=no
23 else
24 dnl GCC defines __NO_INLINE__ if not optimizing or if -fno-inline is
25 dnl specified.
26 dnl Use AC_COMPILE_IFELSE here, not AC_EGREP_CPP, because the result
27 dnl depends on optimization flags, which can be in CFLAGS.
28 dnl (AC_EGREP_CPP looks only at the CPPFLAGS.)
29 AC_COMPILE_IFELSE(
30 [AC_LANG_PROGRAM([[]],
31 [[#ifdef __NO_INLINE__
32 #error "inline is not effective"
33 #endif]])],
34 [gl_cv_c_inline_effective=yes],
35 [gl_cv_c_inline_effective=no])
36 fi
37 ])
38 if test $gl_cv_c_inline_effective = yes; then
39 AC_DEFINE([HAVE_INLINE], [1],
40 [Define to 1 if the compiler supports one of the keywords
41 'inline', '__inline__', '__inline' and effectively inlines
42 functions marked as such.])
43 fi
44 ])