feature-tests.mak 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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_ELF_MMAP
  40. #include <libelf.h>
  41. int main(void)
  42. {
  43. Elf *elf = elf_begin(0, ELF_C_READ_MMAP, 0);
  44. return (long)elf;
  45. }
  46. endef
  47. ifndef NO_NEWT
  48. define SOURCE_NEWT
  49. #include <newt.h>
  50. int main(void)
  51. {
  52. newtInit();
  53. newtCls();
  54. return newtFinished();
  55. }
  56. endef
  57. endif
  58. ifndef NO_GTK2
  59. define SOURCE_GTK2
  60. #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
  61. #include <gtk/gtk.h>
  62. #pragma GCC diagnostic error \"-Wstrict-prototypes\"
  63. int main(int argc, char *argv[])
  64. {
  65. gtk_init(&argc, &argv);
  66. return 0;
  67. }
  68. endef
  69. define SOURCE_GTK2_INFOBAR
  70. #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
  71. #include <gtk/gtk.h>
  72. #pragma GCC diagnostic error \"-Wstrict-prototypes\"
  73. int main(void)
  74. {
  75. gtk_info_bar_new();
  76. return 0;
  77. }
  78. endef
  79. endif
  80. ifndef NO_LIBPERL
  81. define SOURCE_PERL_EMBED
  82. #include <EXTERN.h>
  83. #include <perl.h>
  84. int main(void)
  85. {
  86. perl_alloc();
  87. return 0;
  88. }
  89. endef
  90. endif
  91. ifndef NO_LIBPYTHON
  92. define SOURCE_PYTHON_VERSION
  93. #include <Python.h>
  94. #if PY_VERSION_HEX >= 0x03000000
  95. #error
  96. #endif
  97. int main(void){}
  98. endef
  99. define SOURCE_PYTHON_EMBED
  100. #include <Python.h>
  101. int main(void)
  102. {
  103. Py_Initialize();
  104. return 0;
  105. }
  106. endef
  107. endif
  108. define SOURCE_BFD
  109. #include <bfd.h>
  110. int main(void)
  111. {
  112. bfd_demangle(0, 0, 0);
  113. return 0;
  114. }
  115. endef
  116. define SOURCE_CPLUS_DEMANGLE
  117. extern char *cplus_demangle(const char *, int);
  118. int main(void)
  119. {
  120. cplus_demangle(0, 0);
  121. return 0;
  122. }
  123. endef
  124. define SOURCE_STRLCPY
  125. #include <stdlib.h>
  126. extern size_t strlcpy(char *dest, const char *src, size_t size);
  127. int main(void)
  128. {
  129. strlcpy(NULL, NULL, 0);
  130. return 0;
  131. }
  132. endef
  133. ifndef NO_LIBUNWIND
  134. define SOURCE_LIBUNWIND
  135. #include <libunwind.h>
  136. #include <stdlib.h>
  137. extern int UNW_OBJ(dwarf_search_unwind_table) (unw_addr_space_t as,
  138. unw_word_t ip,
  139. unw_dyn_info_t *di,
  140. unw_proc_info_t *pi,
  141. int need_unwind_info, void *arg);
  142. #define dwarf_search_unwind_table UNW_OBJ(dwarf_search_unwind_table)
  143. int main(void)
  144. {
  145. unw_addr_space_t addr_space;
  146. addr_space = unw_create_addr_space(NULL, 0);
  147. unw_init_remote(NULL, addr_space, NULL);
  148. dwarf_search_unwind_table(addr_space, 0, NULL, NULL, 0, NULL);
  149. return 0;
  150. }
  151. endef
  152. endif
  153. ifndef NO_BACKTRACE
  154. define SOURCE_BACKTRACE
  155. #include <execinfo.h>
  156. #include <stdio.h>
  157. int main(void)
  158. {
  159. backtrace(NULL, 0);
  160. backtrace_symbols(NULL, 0);
  161. return 0;
  162. }
  163. endef
  164. endif
  165. ifndef NO_LIBAUDIT
  166. define SOURCE_LIBAUDIT
  167. #include <libaudit.h>
  168. int main(void)
  169. {
  170. return audit_open();
  171. }
  172. endef
  173. endif