Rob Landley | 2896480 | 2008-01-19 17:08:39 -0600 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
Rob Landley | 7c04f01 | 2008-01-20 19:00:16 -0600 | [diff] [blame] | 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.) |
| 5 | |
Rob Landley | 2896480 | 2008-01-19 17:08:39 -0600 | [diff] [blame] | 6 | mkdir -p generated |
Rob Landley | 27f5779 | 2012-02-03 23:16:28 -0600 | [diff] [blame] | 7 | OUTFILE=generated/Config.in |
Rob Landley | 2896480 | 2008-01-19 17:08:39 -0600 | [diff] [blame] | 8 | |
Rob Landley | 2bd3a5d | 2012-02-13 08:44:32 -0600 | [diff] [blame^] | 9 | source configure |
| 10 | |
Rob Landley | 27f5779 | 2012-02-03 23:16:28 -0600 | [diff] [blame] | 11 | genconfig() |
Rob Landley | 2896480 | 2008-01-19 17:08:39 -0600 | [diff] [blame] | 12 | { |
Rob Landley | 27f5779 | 2012-02-03 23:16:28 -0600 | [diff] [blame] | 13 | # Probe for container support on target |
| 14 | |
| 15 | echo -e "# container support\nconfig TOYBOX_CONTAINER\n\tbool" || return 1 |
Rob Landley | 2bd3a5d | 2012-02-13 08:44:32 -0600 | [diff] [blame^] | 16 | $CC -c -xc -o /dev/null - << EOF |
Rob Landley | 27f5779 | 2012-02-03 23:16:28 -0600 | [diff] [blame] | 17 | #include <sched.h> |
| 18 | int x=CLONE_NEWNS|CLONE_NEWUTS|CLONE_NEWIPC|CLONE_NEWNET; |
| 19 | EOF |
| 20 | [ $? -eq 0 ] && DEFAULT=y || DEFAULT=n |
| 21 | echo -e "\tdefault $DEFAULT\n" || return 1 |
| 22 | |
| 23 | # extract config stanzas from each command source file, in alphabetical order |
| 24 | |
| 25 | for i in $(ls -1 toys/*.c) |
Rob Landley | 2896480 | 2008-01-19 17:08:39 -0600 | [diff] [blame] | 26 | do |
| 27 | # Grab the config block for Config.in |
| 28 | echo "# $i" |
Rob Landley | 27f5779 | 2012-02-03 23:16:28 -0600 | [diff] [blame] | 29 | sed -n '/^\*\//q;/^config [A-Z]/,$p' $i || return 1 |
Rob Landley | 2896480 | 2008-01-19 17:08:39 -0600 | [diff] [blame] | 30 | echo |
| 31 | done |
| 32 | } |
| 33 | |
Rob Landley | 27f5779 | 2012-02-03 23:16:28 -0600 | [diff] [blame] | 34 | genconfig > generated/Config.in || rm "$OUTFILE" |