ax_c99_features.m4 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. # @synopsis AX_C99_FLEXIBLE_ARRAY
  2. #
  3. # Does the compiler support the 1999 ISO C Standard "struct hack".
  4. # @version 1.1 Mar 15 2004
  5. # @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
  6. #
  7. # Permission to use, copy, modify, distribute, and sell this file for any
  8. # purpose is hereby granted without fee, provided that the above copyright
  9. # and this permission notice appear in all copies. No representations are
  10. # made about the suitability of this software for any purpose. It is
  11. # provided "as is" without express or implied warranty.
  12. AC_DEFUN([AX_C99_FLEXIBLE_ARRAY],
  13. [AC_CACHE_CHECK(if have C99 struct flexible array support,
  14. ac_cv_c99_flexible_array,
  15. # Initialize to unknown
  16. ac_cv_c99_flexible_array=no
  17. AC_TRY_LINK([[
  18. #include <stdlib.h>
  19. typedef struct {
  20. int k;
  21. char buffer [] ;
  22. } MY_STRUCT ;
  23. ]],
  24. [ MY_STRUCT *p = calloc (1, sizeof (MY_STRUCT) + 42); ],
  25. ac_cv_c99_flexible_array=yes,
  26. ac_cv_c99_flexible_array=no
  27. ))]
  28. ) # AX_C99_FLEXIBLE_ARRAY
  29. # @synopsis AX_C99_FUNC_LRINT
  30. #
  31. # Check whether C99's lrint function is available.
  32. # @version 1.3 Feb 12 2002
  33. # @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
  34. #
  35. # Permission to use, copy, modify, distribute, and sell this file for any
  36. # purpose is hereby granted without fee, provided that the above copyright
  37. # and this permission notice appear in all copies. No representations are
  38. # made about the suitability of this software for any purpose. It is
  39. # provided "as is" without express or implied warranty.
  40. #
  41. AC_DEFUN([AX_C99_FUNC_LRINT],
  42. [AC_CACHE_CHECK(for lrint,
  43. ac_cv_c99_lrint,
  44. [
  45. lrint_save_LIBS=$LIBS
  46. LIBS="-lm"
  47. AC_TRY_LINK([
  48. #define _ISOC9X_SOURCE 1
  49. #define _ISOC99_SOURCE 1
  50. #define __USE_ISOC99 1
  51. #define __USE_ISOC9X 1
  52. #include <math.h>
  53. ], if (!lrint(3.14159)) lrint(2.7183);, ac_cv_c99_lrint=yes, ac_cv_c99_lrint=no)
  54. LIBS=$lrint_save_LIBS
  55. ])
  56. if test "$ac_cv_c99_lrint" = yes; then
  57. AC_DEFINE(HAVE_LRINT, 1,
  58. [Define if you have C99's lrint function.])
  59. fi
  60. ])# AX_C99_FUNC_LRINT
  61. # @synopsis AX_C99_FUNC_LRINTF
  62. #
  63. # Check whether C99's lrintf function is available.
  64. # @version 1.3 Feb 12 2002
  65. # @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
  66. #
  67. # Permission to use, copy, modify, distribute, and sell this file for any
  68. # purpose is hereby granted without fee, provided that the above copyright
  69. # and this permission notice appear in all copies. No representations are
  70. # made about the suitability of this software for any purpose. It is
  71. # provided "as is" without express or implied warranty.
  72. #
  73. AC_DEFUN([AX_C99_FUNC_LRINTF],
  74. [AC_CACHE_CHECK(for lrintf,
  75. ac_cv_c99_lrintf,
  76. [
  77. lrintf_save_LIBS=$LIBS
  78. LIBS="-lm"
  79. AC_TRY_LINK([
  80. #define _ISOC9X_SOURCE 1
  81. #define _ISOC99_SOURCE 1
  82. #define __USE_ISOC99 1
  83. #define __USE_ISOC9X 1
  84. #include <math.h>
  85. ], if (!lrintf(3.14159)) lrintf(2.7183);, ac_cv_c99_lrintf=yes, ac_cv_c99_lrintf=no)
  86. LIBS=$lrintf_save_LIBS
  87. ])
  88. if test "$ac_cv_c99_lrintf" = yes; then
  89. AC_DEFINE(HAVE_LRINTF, 1,
  90. [Define if you have C99's lrintf function.])
  91. fi
  92. ])# AX_C99_FUNC_LRINTF
  93. # @synopsis AX_C99_FUNC_LLRINT
  94. #
  95. # Check whether C99's llrint function is available.
  96. # @version 1.1 Sep 30 2002
  97. # @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
  98. #
  99. # Permission to use, copy, modify, distribute, and sell this file for any
  100. # purpose is hereby granted without fee, provided that the above copyright
  101. # and this permission notice appear in all copies. No representations are
  102. # made about the suitability of this software for any purpose. It is
  103. # provided "as is" without express or implied warranty.
  104. #
  105. AC_DEFUN([AX_C99_FUNC_LLRINT],
  106. [AC_CACHE_CHECK(for llrint,
  107. ac_cv_c99_llrint,
  108. [
  109. llrint_save_LIBS=$LIBS
  110. LIBS="-lm"
  111. AC_TRY_LINK([
  112. #define ISOC9X_SOURCE 1
  113. #define _ISOC99_SOURCE 1
  114. #define __USE_ISOC99 1
  115. #define __USE_ISOC9X 1
  116. #include <math.h>
  117. ], long long int x ; x = llrint(3.14159) ;, ac_cv_c99_llrint=yes, ac_cv_c99_llrint=no)
  118. LIBS=$llrint_save_LIBS
  119. ])
  120. if test "$ac_cv_c99_llrint" = yes; then
  121. AC_DEFINE(HAVE_LLRINT, 1,
  122. [Define if you have C99's llrint function.])
  123. fi
  124. ])# AX_C99_FUNC_LLRINT
  125. # @synopsis AX_C99_FUNC_LLRINTF
  126. #
  127. # Check whether C99's llrintf function is available.
  128. # @version 1.1 Sep 30 2002
  129. # @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
  130. #
  131. # Permission to use, copy, modify, distribute, and sell this file for any
  132. # purpose is hereby granted without fee, provided that the above copyright
  133. # and this permission notice appear in all copies. No representations are
  134. # made about the suitability of this software for any purpose. It is
  135. # provided "as is" without express or implied warranty.
  136. #
  137. AC_DEFUN([AX_C99_FUNC_LLRINTF],
  138. [AC_CACHE_CHECK(for llrintf,
  139. ac_cv_c99_llrintf,
  140. [
  141. llrintf_save_LIBS=$LIBS
  142. LIBS="-lm"
  143. AC_TRY_LINK([
  144. #define _ISOC9X_SOURCE 1
  145. #define _ISOC99_SOURCE 1
  146. #define __USE_ISOC99 1
  147. #define __USE_ISOC9X 1
  148. #include <math.h>
  149. ], long long int x ; x = llrintf(3.14159) ;, ac_cv_c99_llrintf=yes, ac_cv_c99_llrintf=no)
  150. LIBS=$llrintf_save_LIBS
  151. ])
  152. if test "$ac_cv_c99_llrintf" = yes; then
  153. AC_DEFINE(HAVE_LLRINTF, 1,
  154. [Define if you have C99's llrintf function.])
  155. fi
  156. ])# AX_C99_FUNC_LLRINTF