feature-tests.mak 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. define SOURCE_HELLO
  2. #include <stdio.h>
  3. int main(void)
  4. {
  5. return puts(\"hi\");
  6. }
  7. endef
  8. ifndef NO_DWARF
  9. define SOURCE_DWARF
  10. #include <dwarf.h>
  11. #include <elfutils/libdw.h>
  12. #include <elfutils/version.h>
  13. #ifndef _ELFUTILS_PREREQ
  14. #error
  15. #endif
  16. int main(void)
  17. {
  18. Dwarf *dbg = dwarf_begin(0, DWARF_C_READ);
  19. return (long)dbg;
  20. }
  21. endef
  22. endif
  23. define SOURCE_LIBELF
  24. #include <libelf.h>
  25. int main(void)
  26. {
  27. Elf *elf = elf_begin(0, ELF_C_READ, 0);
  28. return (long)elf;
  29. }
  30. endef
  31. define SOURCE_GLIBC
  32. #include <gnu/libc-version.h>
  33. int main(void)
  34. {
  35. const char *version = gnu_get_libc_version();
  36. return (long)version;
  37. }
  38. endef
  39. define SOURCE_BIONIC
  40. #include <android/api-level.h>
  41. int main(void)
  42. {
  43. return __ANDROID_API__;
  44. }
  45. endef
  46. define SOURCE_ELF_MMAP
  47. #include <libelf.h>
  48. int main(void)
  49. {
  50. Elf *elf = elf_begin(0, ELF_C_READ_MMAP, 0);
  51. return (long)elf;
  52. }
  53. endef
  54. ifndef NO_NEWT
  55. define SOURCE_NEWT
  56. #include <newt.h>
  57. int main(void)
  58. {
  59. newtInit();
  60. newtCls();
  61. return newtFinished();
  62. }
  63. endef
  64. endif
  65. ifndef NO_GTK2
  66. define SOURCE_GTK2
  67. #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
  68. #include <gtk/gtk.h>
  69. #pragma GCC diagnostic error \"-Wstrict-prototypes\"
  70. int main(int argc, char *argv[])
  71. {
  72. gtk_init(&argc, &argv);
  73. return 0;
  74. }
  75. endef
  76. define SOURCE_GTK2_INFOBAR
  77. #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
  78. #include <gtk/gtk.h>
  79. #pragma GCC diagnostic error \"-Wstrict-prototypes\"
  80. int main(void)
  81. {
  82. gtk_info_bar_new();
  83. return 0;
  84. }
  85. endef
  86. endif
  87. ifndef NO_LIBPERL
  88. define SOURCE_PERL_EMBED
  89. #include <EXTERN.h>
  90. #include <perl.h>
  91. int main(void)
  92. {
  93. perl_alloc();
  94. return 0;
  95. }
  96. endef
  97. endif
  98. ifndef NO_LIBPYTHON
  99. define SOURCE_PYTHON_VERSION
  100. #include <Python.h>
  101. #if PY_VERSION_HEX >= 0x03000000
  102. #error
  103. #endif
  104. int main(void)
  105. {
  106. return 0;
  107. }
  108. endef
  109. define SOURCE_PYTHON_EMBED
  110. #include <Python.h>
  111. int main(void)
  112. {
  113. Py_Initialize();
  114. return 0;
  115. }
  116. endef
  117. endif
  118. define SOURCE_BFD
  119. #include <bfd.h>
  120. int main(void)
  121. {
  122. bfd_demangle(0, 0, 0);
  123. return 0;
  124. }
  125. endef
  126. define SOURCE_CPLUS_DEMANGLE
  127. extern char *cplus_demangle(const char *, int);
  128. int main(void)
  129. {
  130. cplus_demangle(0, 0);
  131. return 0;
  132. }
  133. endef
  134. define SOURCE_STRLCPY
  135. #include <stdlib.h>
  136. extern size_t strlcpy(char *dest, const char *src, size_t size);
  137. int main(void)
  138. {
  139. strlcpy(NULL, NULL, 0);
  140. return 0;
  141. }
  142. endef
  143. ifndef NO_LIBUNWIND
  144. define SOURCE_LIBUNWIND
  145. #include <libunwind.h>
  146. #include <stdlib.h>
  147. extern int UNW_OBJ(dwarf_search_unwind_table) (unw_addr_space_t as,
  148. unw_word_t ip,
  149. unw_dyn_info_t *di,
  150. unw_proc_info_t *pi,
  151. int need_unwind_info, void *arg);
  152. #define dwarf_search_unwind_table UNW_OBJ(dwarf_search_unwind_table)
  153. int main(void)
  154. {
  155. unw_addr_space_t addr_space;
  156. addr_space = unw_create_addr_space(NULL, 0);
  157. unw_init_remote(NULL, addr_space, NULL);
  158. dwarf_search_unwind_table(addr_space, 0, NULL, NULL, 0, NULL);
  159. return 0;
  160. }
  161. endef
  162. endif
  163. ifndef NO_BACKTRACE
  164. define SOURCE_BACKTRACE
  165. #include <execinfo.h>
  166. #include <stdio.h>
  167. int main(void)
  168. {
  169. backtrace(NULL, 0);
  170. backtrace_symbols(NULL, 0);
  171. return 0;
  172. }
  173. endef
  174. endif
  175. ifndef NO_LIBAUDIT
  176. define SOURCE_LIBAUDIT
  177. #include <libaudit.h>
  178. int main(void)
  179. {
  180. return audit_open();
  181. }
  182. endef
  183. endif
  184. define SOURCE_ON_EXIT
  185. #include <stdio.h>
  186. int main(void)
  187. {
  188. return on_exit(NULL, NULL);
  189. }
  190. endef
  191. define SOURCE_LIBNUMA
  192. #include <numa.h>
  193. #include <numaif.h>
  194. int main(void)
  195. {
  196. numa_available();
  197. return 0;
  198. }
  199. endef