X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=m4%2Fensc_syscallnr.m4;fp=m4%2Fensc_syscallnr.m4;h=ff01d04153cda22312b68dbfbcaf951dbcaf13ce;hb=05bfe19d376b0d44127dd3b9dc7dfc2ced0aaf3f;hp=0000000000000000000000000000000000000000;hpb=96b9bc3416686cb4080beb8bda4283edaefafbe2;p=util-vserver.git diff --git a/m4/ensc_syscallnr.m4 b/m4/ensc_syscallnr.m4 new file mode 100644 index 0000000..ff01d04 --- /dev/null +++ b/m4/ensc_syscallnr.m4 @@ -0,0 +1,62 @@ +dnl $Id: ensc_syscallnr.m4,v 1.1.2.5 2004/03/09 04:16:21 ensc Exp $ + +dnl Copyright (C) 2004 Enrico Scholz +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; version 2 of the License. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +dnl Usage: ENSC_SYSCALLNR(,) + +AC_DEFUN([ENSC_SYSCALLNR], +[ + AC_REQUIRE([AC_PROG_CPP]) + AC_REQUIRE([AC_PROG_EGREP]) + AC_REQUIRE([ENSC_KERNEL_HEADERS]) + + AC_CACHE_CHECK([for number of syscall '$1'], [ensc_cv_value_syscall_$1], + [ + AC_LANG_PUSH(C) + AC_LANG_CONFTEST([ +#include +#ifdef __NR_$1 +ensc_syscall_tmp_nr=__NR_$1; +ensc_syscall_tmp_src=ENSC_MARK +#endif +]) + ensc_syscall_tmp_nr= + ensc_syscall_tmp_src= + test "$ensc_syscall_tmp_nr" || \ + eval $($CPP $CPPFLAGS -D ENSC_MARK='glibc' conftest.c | $EGREP '^ensc_syscall_tmp_(nr=[[1-9]][[0-9]]*;|src=.*)$') + test "$ensc_syscall_tmp_nr" || \ + eval $($CPP $CPPFLAGS -D ENSC_MARK='kernel' -I $ensc_cv_path_kernelheaders conftest.c | $EGREP '^ensc_syscall_tmp_(nr=[[1-9]][[0-9]]*;|src=.*)$') + test "$ensc_syscall_tmp_nr" || { + ensc_syscall_tmp_nr=$2 + ensc_syscall_tmp_src=default + } + + if test x"$ensc_syscall_tmp_nr" = x; then + AC_MSG_ERROR( +[Can not determine value of __NR_$1; please verify your glibc/kernelheaders, and/or set CPPFLAGS='-D__NR_$1=' environment when calling configure.]) + fi + AC_LANG_POP + + ensc_cv_value_syscall_$1="$ensc_syscall_tmp_nr/$ensc_syscall_tmp_src" + ]) + + ensc_syscall_tmp_nr=${ensc_cv_value_syscall_$1%/*} + ensc_syscall_tmp_src=${ensc_cv_value_syscall_$1#*/} + + if test x"$ensc_syscall_tmp_src" != x'glibc'; then + AC_DEFINE_UNQUOTED(ENSC_SYSCALL__NR_$1, $ensc_syscall_tmp_nr, [The number of the $1 syscall]) + fi +])