Use a saner variant for computing the number of groups in cpuctl tests
[ltp-debian.git] / m4 / ltp-swaponoff.m4
blob8133db4fe2ce3979722853219d6ad6515e020417
1 dnl
2 dnl Copyright (c) Cisco Systems Inc., 2009
3 dnl
4 dnl This program is free software;  you can redistribute it and/or modify
5 dnl it under the terms of the GNU General Public License as published by
6 dnl the Free Software Foundation; either version 2 of the License, or
7 dnl (at your option) any later version.
8 dnl
9 dnl This program is distributed in the hope that it will be useful,
10 dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
12 dnl the GNU General Public License for more details.
13 dnl
14 dnl You should have received a copy of the GNU General Public License
15 dnl along with this program;  if not, write to the Free Software
16 dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 dnl
18 dnl Author: Garrett Cooper <yanegomi@gmail.com>
19 dnl
21 dnl
22 dnl LTP_CHECK_CAPABILITY_SUPPORT
23 dnl ----------------------------
24 dnl
25 AC_DEFUN([LTP_CHECK_SYSCALL_SWAPONOFF],[
26 AC_MSG_CHECKING([for swapon / swapoff implementation])
27 AC_TRY_COMPILE([#include <unistd.h>
28                 #include <sys/swap.h>],
29                 [swapon("/foo", 0); swapoff("/foo"); return 0;],
30                 [swaponoff_impl="2.6"],
31                 [AC_TRY_COMPILE([#include <unistd.h>
32                                  #include <sys/swap.h>
33                                  #include <linux/swap.h>],
34                                  [swapon("/foo", 0); swapoff("/foo"); return 0;],
35                                  [swaponoff_impl="2.4"],
36                 )]
38 if test "x$swaponoff_impl" = "x2.4" ; then
39     AC_MSG_RESULT(2.6)
40     AC_DEFINE([HAVE_OLD_SWAPONOFF],[],[2.4 version of swapon/swapoff])
41 elif test "x$swaponoff_impl" = "x2.6" ; then
42     AC_MSG_RESULT(2.6)
43     AC_DEFINE([HAVE_NEW_SWAPONOFF],[],[2.6 version of swapon/swapoff])
44 else
45     AC_MSG_RESULT(unknown)
46     AC_MSG_WARN(Couldn't determine swapon / swapoff implementation)