Mercurial > hg > toybox
comparison scripts/genconfig.sh @ 1260:0ce03bb85ebd draft
Probe for the existence of FIFREEZE and make fsfreeze depend on it.
author | Rob Landley <rob@landley.net> |
---|---|
date | Wed, 16 Apr 2014 07:49:32 -0500 |
parents | 565980862743 |
children | a302299dbb98 |
comparison
equal
deleted
inserted
replaced
1259:565980862743 | 1260:0ce03bb85ebd |
---|---|
5 | 5 |
6 mkdir -p generated | 6 mkdir -p generated |
7 | 7 |
8 source configure | 8 source configure |
9 | 9 |
10 # Probe for a single config symbol with a "compiles or not" test. | |
11 # Symbol name is first argument, flags second, feed C file to stdin | |
12 probesymbol() | |
13 { | |
14 ${CROSS_COMPILE}${CC} $CFLAGS -xc -o /dev/null $2 - 2>/dev/null | |
15 [ $? -eq 0 ] && DEFAULT=y || DEFAULT=n | |
16 rm a.out 2>/dev/null | |
17 echo -e "config $1\n\tbool" || exit 1 | |
18 echo -e "\tdefault $DEFAULT\n" || exit 1 | |
19 } | |
20 | |
10 probeconfig() | 21 probeconfig() |
11 { | 22 { |
12 # Probe for container support on target | 23 # Probe for container support on target |
13 | 24 probesymbol TOYBOX_CONTAINER << EOF |
14 echo -e "# container support\nconfig TOYBOX_CONTAINER\n\tbool" || return 1 | |
15 ${CROSS_COMPILE}${CC} $CFLAGS -xc -o /dev/null - 2>/dev/null << EOF | |
16 #include <linux/sched.h> | 25 #include <linux/sched.h> |
17 int x=CLONE_NEWNS|CLONE_NEWUTS|CLONE_NEWIPC|CLONE_NEWNET; | 26 int x=CLONE_NEWNS|CLONE_NEWUTS|CLONE_NEWIPC|CLONE_NEWNET; |
18 | 27 |
19 int main(int argc, char *argv[]) { return unshare(x); } | 28 int main(int argc, char *argv[]) { return unshare(x); } |
20 EOF | 29 EOF |
21 [ $? -eq 0 ] && DEFAULT=y || DEFAULT=n | 30 |
22 rm a.out 2>/dev/null | 31 probesymbol TOYBOX_FIFREEZE -c << EOF |
23 echo -e "\tdefault $DEFAULT\n" || return 1 | 32 #include <linux/fs.h> |
33 #ifndef FIFREEZE | |
34 #error nope | |
35 #endif | |
36 EOF | |
24 } | 37 } |
25 | 38 |
26 genconfig() | 39 genconfig() |
27 { | 40 { |
28 # I could query the directory here, but I want to control the order | 41 # I could query the directory here, but I want to control the order |