gentoo: use /var/run for new /run compatibility
[util-vserver.git] / m4 / ensc_dietlibc_compat.m4
1 dnl $Id$
2
3 dnl Copyright (C) 2004, 2005, 2009
4 dnl     Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
5 dnl
6 dnl This program is free software; you can redistribute it and/or modify
7 dnl it under the terms of the GNU General Public License as published by
8 dnl the Free Software Foundation; version 2 and/or 3 of the License.
9 dnl
10 dnl This program is distributed in the hope that it will be useful,
11 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 dnl GNU General Public License for more details.
14 dnl
15 dnl You should have received a copy of the GNU General Public License
16 dnl along with this program; if not, write to the Free Software
17 dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19 AC_DEFUN([ENSC_DIETLIBC_NEED_COMPAT],
20 [
21         AC_REQUIRE([ENSC_ENABLE_DIETLIBC])
22         AC_REQUIRE([ENSC_SYSCALL_ALTERNATIVE])
23         AC_CACHE_CHECK([whether dietlibc needs '-lcompat'], [ensc_cv_c_dietlibc_compat],
24         [
25                 AC_LANG_PUSH(C)
26                 ensc_dietlibc_need_compat_old_CC=$CC
27                 CC="${DIET:-diet} $CC"
28                 AC_LINK_IFELSE([
29                         AC_LANG_PROGRAM([
30 #include "$srcdir/lib/syscall-wrap.h"
31 #include <errno.h>
32
33 #define __NR_foo0               42
34 #define __NR_foo1               42
35 #define __NR_foo2               42
36 #define __NR_foo3               42
37 #define __NR_foo4               42
38 #define __NR_foo5               42
39 inline static _syscall0(int, foo0)
40 inline static _syscall1(int, foo1, int, a)
41 inline static _syscall2(int, foo2, int, a, int, b)
42 inline static _syscall3(int, foo3, int, a, int, b, int, c)
43 inline static _syscall4(int, foo4, int, a, int, b, int, c, int, d)
44 inline static _syscall5(int, foo5, int, a, int, b, int, c, int, d, int, e)
45 ],
46                         [foo0(); foo1(0); foo2(0,0); foo3(0,0,0); foo4(0,0,0,0); foo5(0,0,0,0,0);])],
47                         [ensc_cv_c_dietlibc_compat=no],
48                         [ensc_cv_c_dietlibc_compat=yes])
49                 CC=$ensc_dietlibc_need_compat_old_CC
50                 AC_LANG_POP
51         ])
52
53         if test x"$1" != x; then
54                 AM_CONDITIONAL($1, test x"$ensc_cv_c_dietlibc_compat" = xyes)
55         fi
56 ])