Blame m4/inline.m4

Packit 8f70b4
# inline.m4 serial 4
Packit 8f70b4
dnl Copyright (C) 2006, 2009-2018 Free Software Foundation, Inc.
Packit 8f70b4
dnl This file is free software; the Free Software Foundation
Packit 8f70b4
dnl gives unlimited permission to copy and/or distribute it,
Packit 8f70b4
dnl with or without modifications, as long as this notice is preserved.
Packit 8f70b4
Packit 8f70b4
dnl Test for the 'inline' keyword or equivalent.
Packit 8f70b4
dnl Define 'inline' to a supported equivalent, or to nothing if not supported,
Packit 8f70b4
dnl like AC_C_INLINE does.  Also, define HAVE_INLINE if 'inline' or an
Packit 8f70b4
dnl equivalent is effectively supported, i.e. if the compiler is likely to
Packit 8f70b4
dnl drop unused 'static inline' functions.
Packit 8f70b4
AC_DEFUN([gl_INLINE],
Packit 8f70b4
[
Packit 8f70b4
  AC_REQUIRE([AC_C_INLINE])
Packit 8f70b4
  AC_CACHE_CHECK([whether the compiler generally respects inline],
Packit 8f70b4
    [gl_cv_c_inline_effective],
Packit 8f70b4
    [if test $ac_cv_c_inline = no; then
Packit 8f70b4
       gl_cv_c_inline_effective=no
Packit 8f70b4
     else
Packit 8f70b4
       dnl GCC defines __NO_INLINE__ if not optimizing or if -fno-inline is
Packit 8f70b4
       dnl specified.
Packit 8f70b4
       dnl Use AC_COMPILE_IFELSE here, not AC_EGREP_CPP, because the result
Packit 8f70b4
       dnl depends on optimization flags, which can be in CFLAGS.
Packit 8f70b4
       dnl (AC_EGREP_CPP looks only at the CPPFLAGS.)
Packit 8f70b4
       AC_COMPILE_IFELSE(
Packit 8f70b4
         [AC_LANG_PROGRAM([[]],
Packit 8f70b4
           [[#ifdef __NO_INLINE__
Packit 8f70b4
               #error "inline is not effective"
Packit 8f70b4
             #endif]])],
Packit 8f70b4
         [gl_cv_c_inline_effective=yes],
Packit 8f70b4
         [gl_cv_c_inline_effective=no])
Packit 8f70b4
     fi
Packit 8f70b4
    ])
Packit 8f70b4
  if test $gl_cv_c_inline_effective = yes; then
Packit 8f70b4
    AC_DEFINE([HAVE_INLINE], [1],
Packit 8f70b4
      [Define to 1 if the compiler supports one of the keywords
Packit 8f70b4
       'inline', '__inline__', '__inline' and effectively inlines
Packit 8f70b4
       functions marked as such.])
Packit 8f70b4
  fi
Packit 8f70b4
])