aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2012-02-03 23:16:28 -0600
committerRob Landley <rob@landley.net>2012-02-03 23:16:28 -0600
commit27f5779a7a3d71cd26107d26330c67445341e879 (patch)
tree4972135e57c3390a929d91a603359c80179088b8 /scripts
parentf83305e5fb4ab97df47825cd2c2ed4fad758e5b8 (diff)
downloadtoybox-27f5779a7a3d71cd26107d26330c67445341e879.tar.gz
Add autodetect for container support.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/genconfig.sh21
1 files changed, 17 insertions, 4 deletions
diff --git a/scripts/genconfig.sh b/scripts/genconfig.sh
index 126e52ef..1911efc6 100755
--- a/scripts/genconfig.sh
+++ b/scripts/genconfig.sh
@@ -4,16 +4,29 @@
# before menuconfig. (It's called again from scripts/make.sh just to be sure.)
mkdir -p generated
+OUTFILE=generated/Config.in
-function genconfig()
+genconfig()
{
- for i in $(echo toys/*.c | sort)
+ # Probe for container support on target
+
+ echo -e "# container support\nconfig TOYBOX_CONTAINER\n\tbool" || return 1
+ $CC -c -xc -o /dev/null - 2>/dev/null << EOF
+ #include <sched.h>
+ int x=CLONE_NEWNS|CLONE_NEWUTS|CLONE_NEWIPC|CLONE_NEWNET;
+EOF
+ [ $? -eq 0 ] && DEFAULT=y || DEFAULT=n
+ echo -e "\tdefault $DEFAULT\n" || return 1
+
+ # extract config stanzas from each command source file, in alphabetical order
+
+ for i in $(ls -1 toys/*.c)
do
# Grab the config block for Config.in
echo "# $i"
- sed -n '/^\*\//q;/^config [A-Z]/,$p' $i || exit 1
+ sed -n '/^\*\//q;/^config [A-Z]/,$p' $i || return 1
echo
done
}
-genconfig > generated/Config.in
+genconfig > generated/Config.in || rm "$OUTFILE"