Blame m4/inline.m4

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