configure: add options ability
There are more and more global environment variables that land everywhere in configure, which is making user hard to know which one does what. Using command-line options would make it easier for users to learn or remember the config options. This patch converts the INCLUDE variable to command option first. Check if the first variable has '-' to compile with the old INCLUDE path setting method. Signed-off-by: Hangbin Liu <haliu@redhat.com> Signed-off-by: David Ahern <dsahern@kernel.org>
This commit is contained in:
parent
825bd5dacb
commit
a9c3d70d90
|
|
@ -7,7 +7,7 @@
|
||||||
# off: disable libbpf probing
|
# off: disable libbpf probing
|
||||||
# LIBBPF_DIR Path to libbpf DESTDIR to use
|
# LIBBPF_DIR Path to libbpf DESTDIR to use
|
||||||
|
|
||||||
INCLUDE=${1:-"$PWD/include"}
|
INCLUDE="$PWD/include"
|
||||||
|
|
||||||
# Output file which is input to Makefile
|
# Output file which is input to Makefile
|
||||||
CONFIG=config.mk
|
CONFIG=config.mk
|
||||||
|
|
@ -486,6 +486,35 @@ endif
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
usage()
|
||||||
|
{
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $0 [OPTIONS]
|
||||||
|
--include_dir Path to iproute2 include dir
|
||||||
|
-h | --help Show this usage info
|
||||||
|
EOF
|
||||||
|
exit $1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Compat with the old INCLUDE path setting method.
|
||||||
|
if [ $# -eq 1 ] && [ "$(echo $1 | cut -c 1)" != '-' ]; then
|
||||||
|
INCLUDE="$1"
|
||||||
|
else
|
||||||
|
while true; do
|
||||||
|
case "$1" in
|
||||||
|
--include_dir)
|
||||||
|
INCLUDE=$2
|
||||||
|
shift 2 ;;
|
||||||
|
-h | --help)
|
||||||
|
usage 0 ;;
|
||||||
|
"")
|
||||||
|
break ;;
|
||||||
|
*)
|
||||||
|
usage 1 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
echo "# Generated config based on" $INCLUDE >$CONFIG
|
echo "# Generated config based on" $INCLUDE >$CONFIG
|
||||||
quiet_config >> $CONFIG
|
quiet_config >> $CONFIG
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue