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