From a0383336de400a024c8ded9fc4655e79c2615931 Mon Sep 17 00:00:00 2001 From: wifiextender Date: Thu, 25 Aug 2016 14:53:22 +0200 Subject: [PATCH] Add more m4 tests --- m4/the_rest_funcs.m4 | 45 +++++++++++++++++++++++++++++++++++++++++++++ m4/typez.m4 | 4 ++++ 2 files changed, 49 insertions(+) diff --git a/m4/the_rest_funcs.m4 b/m4/the_rest_funcs.m4 index b7bcce6..874877d 100644 --- a/m4/the_rest_funcs.m4 +++ b/m4/the_rest_funcs.m4 @@ -115,6 +115,7 @@ AC_DEFUN([TEST_SOME_FUNCS],[ ]) + NOTIFY([openNreadFile]) AC_COMPILE_IFELSE([ AC_LANG_SOURCE([[ @@ -150,6 +151,7 @@ AC_DEFUN([TEST_SOME_FUNCS],[ ] ) + ifdef([ITS_BSD],[],[ NOTIFY([glob]) AC_COMPILE_IFELSE([ @@ -167,6 +169,7 @@ AC_DEFUN([TEST_SOME_FUNCS],[ ]) + NOTIFY([sysconf]) AC_COMPILE_IFELSE([ AC_LANG_SOURCE([[ @@ -376,6 +379,48 @@ AC_DEFUN([TEST_SOME_FUNCS],[ ]) + NOTIFY([xswdev-swap]) + AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([[ + #include + #include + #include + #include + #include + #include + #include + #include + #include + int main(void) { + struct xswdev xsw; + u_int pagesize = 4096, dummy = 0; + uintmax_t total = 0, used = 0, pz = 0; + int mib[20]; + memset(mib, 0, sizeof(mib)); + size_t mibi = sizeof(mib) / sizeof(mib[0]); + size_t len = sizeof(dummy), sisi = sizeof(struct xswdev); + + pz = (uintmax_t)pagesize; + if (0 != (sysctlnametomib("vm.swap_info", mib, &mibi))) { + return 0; + } + if (0 != (sysctl(mib, (u_int)(mibi + 1), &xsw, &sisi, NULL, 0))) { + return 0; + } + if (xsw.xsw_version != XSWDEV_VERSION) { + return 0; + } + used = (uintmax_t)xsw.xsw_used; + total = (uintmax_t)xsw.xsw_nblks; + + return 0; + } + ]]) + ],[],[ + COMPILE_FAILED([xswdev-swap]) + ] + ) + ], []) diff --git a/m4/typez.m4 b/m4/typez.m4 index f879541..c6f670c 100644 --- a/m4/typez.m4 +++ b/m4/typez.m4 @@ -93,6 +93,9 @@ AC_DEFUN([TEST_TYPEZ],[ AC_CHECK_HEADERS([ \ sys/types.h \ sys/sysctl.h \ + sys/param.h \ + sys/stat.h \ + vm/vm_param.h \ ],[],[ ERR([Missing core header files.]) ]) @@ -135,6 +138,7 @@ AC_DEFUN([TEST_TYPEZ],[ AC_CHECK_FUNCS([ \ sysctl \ sysctlbyname \ + sysctlnametomib \ getloadavg \ malloc \ free \ -- 2.11.0