Collection of DPF-based plugins for packaging
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.9KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_c99_inline.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_C99_INLINE
  8. #
  9. # DESCRIPTION
  10. #
  11. # This macro defines HAVE_C99_INLINE if the C compiler supports "inline"
  12. # and "extern inline" correctly. An application may replace "inline" with
  13. # "static inline" as a workaround for older compilers.
  14. #
  15. # LICENSE
  16. #
  17. # Copyright (c) 2009 Michael McMaster <email@michaelmcmaster.name>
  18. #
  19. # Copying and distribution of this file, with or without modification, are
  20. # permitted in any medium without royalty provided the copyright notice
  21. # and this notice are preserved. This file is offered as-is, without any
  22. # warranty.
  23. #serial 8
  24. AC_DEFUN([AX_C99_INLINE], [
  25. AC_MSG_CHECKING([whether the compiler supports C99 inline functions])
  26. AC_REQUIRE([AC_PROG_CC_C99])
  27. AC_LANG_PUSH([C])
  28. dnl In a conforming C99 implementation a function marked "inline" will not
  29. dnl be compiled into the translation unit if the compiler was not able to
  30. dnl inline the function.
  31. dnl GCC versions before 4.3 would output the inline functions into all
  32. dnl translation units that could require the definition.
  33. AC_LINK_IFELSE(
  34. AC_LANG_SOURCE([
  35. inline void* foo() { foo(); return &foo; }
  36. int main() { return foo() != 0;}
  37. ]),
  38. dnl the invalid source compiled, so the inline keyword does not work
  39. dnl correctly.
  40. AC_MSG_RESULT([no]),
  41. dnl Secondary test of valid source.
  42. AC_LINK_IFELSE(
  43. AC_LANG_SOURCE([
  44. extern inline void* foo() { foo(); return &foo; }
  45. int main() { return foo() != 0;}
  46. ]),
  47. AC_MSG_RESULT([yes])
  48. AC_DEFINE([HAVE_C99_INLINE], [1],
  49. [Define to 1 if the "extern" keyword controls whether an inline function appears in a translation unit.]),
  50. dnl Perhaps inline functions aren't supported at all ?
  51. AC_MSG_RESULT([no])
  52. )
  53. )
  54. AC_LANG_POP([C])
  55. ]);