blob: 30c7eba17a5caae44cf4107a80920c97a59418f8 [file] [log] [blame]
Rob Landley28964802008-01-19 17:08:39 -06001#!/bin/bash
2
Rob Landley7c04f012008-01-20 19:00:16 -06003# 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 Landley28964802008-01-19 17:08:39 -06006mkdir -p generated
Rob Landley27f57792012-02-03 23:16:28 -06007OUTFILE=generated/Config.in
Rob Landley28964802008-01-19 17:08:39 -06008
Rob Landley2bd3a5d2012-02-13 08:44:32 -06009source configure
10
Rob Landley27f57792012-02-03 23:16:28 -060011genconfig()
Rob Landley28964802008-01-19 17:08:39 -060012{
Rob Landley27f57792012-02-03 23:16:28 -060013 # Probe for container support on target
14
15 echo -e "# container support\nconfig TOYBOX_CONTAINER\n\tbool" || return 1
Rob Landley2bd3a5d2012-02-13 08:44:32 -060016 $CC -c -xc -o /dev/null - << EOF
Rob Landley27f57792012-02-03 23:16:28 -060017 #include <sched.h>
18 int x=CLONE_NEWNS|CLONE_NEWUTS|CLONE_NEWIPC|CLONE_NEWNET;
19EOF
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 Landley28964802008-01-19 17:08:39 -060026 do
27 # Grab the config block for Config.in
28 echo "# $i"
Rob Landley27f57792012-02-03 23:16:28 -060029 sed -n '/^\*\//q;/^config [A-Z]/,$p' $i || return 1
Rob Landley28964802008-01-19 17:08:39 -060030 echo
31 done
32}
33
Rob Landley27f57792012-02-03 23:16:28 -060034genconfig > generated/Config.in || rm "$OUTFILE"