3 # This has to be a separate file from scripts/make.sh so it can be called
4 # before menuconfig. (It's called again from scripts/make.sh just to be sure.)
12 ${CROSS_COMPILE}${CC} $CFLAGS -xc -o /dev/null $1 -
15 # Probe for a single config symbol with a "compiles or not" test.
16 # Symbol name is first argument, flags second, feed C file to stdin
19 probecc $2 2>/dev/null && DEFAULT=y || DEFAULT=n
21 echo -e "config $1\n\tbool" || exit 1
22 echo -e "\tdefault $DEFAULT\n" || exit 1
28 # llvm produces its own really stupid warnings about things that aren't wrong,
29 # and although you can turn the warning off, gcc reacts badly to command line
30 # arguments it doesn't understand. So probe.
31 [ -z "$(probecc -Wno-string-plus-int <<< \#warn warn 2>&1 | grep string-plus-int)" ] &&
32 echo -Wno-string-plus-int >> generated/cflags
34 # Probe for container support on target
35 probesymbol TOYBOX_CONTAINER << EOF
36 #include <linux/sched.h>
37 int x=CLONE_NEWNS|CLONE_NEWUTS|CLONE_NEWIPC|CLONE_NEWNET;
39 int main(int argc, char *argv[]) { return unshare(x); }
42 probesymbol TOYBOX_FIFREEZE -c << EOF
49 # Work around some uClibc limitations
50 probesymbol TOYBOX_ICONV -c << EOF
53 probesymbol TOYBOX_FALLOCATE << EOF
56 int main(int argc, char *argv[]) { return posix_fallocate(0,0,0); }
59 # Android and some other platforms miss utmpx
60 probesymbol TOYBOX_UTMPX -c << EOF
65 int main(int argc, char *argv[]) {
67 if (0 != (a = getutxent())) return 0;
72 # Android is missing shadow.h
73 probesymbol TOYBOX_SHADOW -c << EOF
75 int main(int argc, char *argv[]) {
76 struct spwd *a = getspnam("root"); return 0;
80 # Some commands are android-specific
81 probesymbol TOYBOX_ON_ANDROID -c << EOF
88 probesymbol TOYBOX_FORK << EOF
90 int main(int argc, char *argv[]) { return fork(); }
96 # Reverse sort puts posix first, examples last.
97 for j in $(ls toys/*/README | sort -r)
101 [ $(ls "$DIR" | wc -l) -lt 2 ] && continue
103 echo "menu \"$(head -n 1 $j)\""
106 # extract config stanzas from each source file, in alphabetical order
107 for i in $(ls -1 $DIR/*.c)
109 # Grab the config block for Config.in
111 sed -n '/^\*\//q;/^config [A-Z]/,$p' $i || return 1
119 probeconfig > generated/Config.probed || rm generated/Config.probed
120 genconfig > generated/Config.in || rm generated/Config.in