]> git.ipfire.org Git - thirdparty/bash.git/blame - portbash/syscalls.sh
Imported from ../bash-1.14.7.tar.gz.
[thirdparty/bash.git] / portbash / syscalls.sh
CommitLineData
726f6388
JA
1#! /bin/sh
2CC=cc
3export CC
4
5cat > x.c << EOF
6/*
7 * exit 0 if we have the getgroups system or library call.
8 */
9
10main()
11{
12 int g[100], ng;
13
14 ng = getgroups(100, g);
15 if (ng)
16 exit(0);
17 exit(1);
18}
19EOF
20if ${CC} x.c > /dev/null 2>&1 && ./a.out ; then
21 echo '#define HAVE_GETGROUPS'
22fi
23rm -f x.c x.o a.out
24
25cat > x.c << EOF
26extern int dup2();
27main()
28{
29 exit(dup2(1, 2) == -1);
30}
31EOF
32
33if ${CC} x.c > /dev/null 2>&1 && ./a.out ; then
34 echo '#define HAVE_DUP2'
35fi
36rm -f a.out x.c x.o
37
38cat > x.c << EOF
39extern int getpageesize();
40main()
41{
42 int n = getpagesize();
43}
44EOF
45
46if ${CC} x.c > /dev/null 2>&1
47then
48 echo '#define HAVE_GETPAGESIZE'
49fi
50rm -f a.out x.c x.o
51
52cat > x.c << EOF
53extern int getdtablesize();
54main()
55{
56 int n = getdtablesize();
57}
58EOF
59
60if ${CC} x.c > /dev/null 2>&1
61then
62 echo '#define HAVE_GETDTABLESIZE'
63fi
64rm -f a.out x.c x.o
65
66cat > x.c << EOF
67extern int setdtablesize();
68main()
69{
70 int n = setdtablesize(128);
71}
72EOF
73
74if ${CC} x.c > /dev/null 2>&1
75then
76 echo '#define HAVE_SETDTABLESIZE'
77fi
78rm -f a.out x.c x.o
79
80exit 0