blob: 1911efc6a41340eaa5f83193791b576f57e9e490 [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 Landley27f57792012-02-03 23:16:28 -06009genconfig()
Rob Landley28964802008-01-19 17:08:39 -060010{
Rob Landley27f57792012-02-03 23:16:28 -060011 # Probe for container support on target
12
13 echo -e "# container support\nconfig TOYBOX_CONTAINER\n\tbool" || return 1
14 $CC -c -xc -o /dev/null - 2>/dev/null << EOF
15 #include <sched.h>
16 int x=CLONE_NEWNS|CLONE_NEWUTS|CLONE_NEWIPC|CLONE_NEWNET;
17EOF
18 [ $? -eq 0 ] && DEFAULT=y || DEFAULT=n
19 echo -e "\tdefault $DEFAULT\n" || return 1
20
21 # extract config stanzas from each command source file, in alphabetical order
22
23 for i in $(ls -1 toys/*.c)
Rob Landley28964802008-01-19 17:08:39 -060024 do
25 # Grab the config block for Config.in
26 echo "# $i"
Rob Landley27f57792012-02-03 23:16:28 -060027 sed -n '/^\*\//q;/^config [A-Z]/,$p' $i || return 1
Rob Landley28964802008-01-19 17:08:39 -060028 echo
29 done
30}
31
Rob Landley27f57792012-02-03 23:16:28 -060032genconfig > generated/Config.in || rm "$OUTFILE"