configure: add the --libdir option
This commit allows users/packagers to choose a lib directory to store
iproute2 lib files.
At the moment iproute2 ship lib files in /usr/lib and offers no way to
modify this setting. However, according to the FHS, distros may choose
"one or more variants of the /lib directory on systems which support
more than one binary format" (e.g. /usr/lib64 on Fedora).
As Luca states in commit a3272b9372 ("configure: restore backward
compatibility"), packaging systems may assume that 'configure' is from
autotools, and try to pass it some parameters.
Allowing the '--libdir=/path/to/libdir' syntax, we can use this to our
advantage, and let the lib directory to be chosen by the distro
packaging system.
Note that LIBDIR uses "\${prefix}/lib" as default value because autoconf
allows this to be expanded to the --prefix value at configure runtime.
"\${prefix}" is replaced with the PREFIX value in check_lib_dir().
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
Acked-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: David Ahern <dsahern@kernel.org>
This commit is contained in:
parent
0ee1950b5c
commit
cee0cf84bd
7
Makefile
7
Makefile
|
|
@ -1,6 +1,8 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
# Top level Makefile for iproute2
|
# Top level Makefile for iproute2
|
||||||
|
|
||||||
|
-include config.mk
|
||||||
|
|
||||||
ifeq ("$(origin V)", "command line")
|
ifeq ("$(origin V)", "command line")
|
||||||
VERBOSE = $(V)
|
VERBOSE = $(V)
|
||||||
endif
|
endif
|
||||||
|
|
@ -13,7 +15,6 @@ MAKEFLAGS += --no-print-directory
|
||||||
endif
|
endif
|
||||||
|
|
||||||
PREFIX?=/usr
|
PREFIX?=/usr
|
||||||
LIBDIR?=$(PREFIX)/lib
|
|
||||||
SBINDIR?=/sbin
|
SBINDIR?=/sbin
|
||||||
CONFDIR?=/etc/iproute2
|
CONFDIR?=/etc/iproute2
|
||||||
NETNS_RUN_DIR?=/var/run/netns
|
NETNS_RUN_DIR?=/var/run/netns
|
||||||
|
|
@ -69,7 +70,7 @@ SUBDIRS=lib ip tc bridge misc netem genl tipc devlink rdma dcb man vdpa
|
||||||
LIBNETLINK=../lib/libutil.a ../lib/libnetlink.a
|
LIBNETLINK=../lib/libutil.a ../lib/libnetlink.a
|
||||||
LDLIBS += $(LIBNETLINK)
|
LDLIBS += $(LIBNETLINK)
|
||||||
|
|
||||||
all: config
|
all: config.mk
|
||||||
@set -e; \
|
@set -e; \
|
||||||
for i in $(SUBDIRS); \
|
for i in $(SUBDIRS); \
|
||||||
do echo; echo $$i; $(MAKE) -C $$i; done
|
do echo; echo $$i; $(MAKE) -C $$i; done
|
||||||
|
|
@ -89,7 +90,7 @@ help:
|
||||||
@echo "Make Arguments:"
|
@echo "Make Arguments:"
|
||||||
@echo " V=[0|1] - set build verbosity level"
|
@echo " V=[0|1] - set build verbosity level"
|
||||||
|
|
||||||
config:
|
config.mk:
|
||||||
@if [ ! -f config.mk -o configure -nt config.mk ]; then \
|
@if [ ! -f config.mk -o configure -nt config.mk ]; then \
|
||||||
sh configure $(KERNEL_INCLUDE); \
|
sh configure $(KERNEL_INCLUDE); \
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
INCLUDE="$PWD/include"
|
INCLUDE="$PWD/include"
|
||||||
PREFIX="/usr"
|
PREFIX="/usr"
|
||||||
|
LIBDIR="\${prefix}/lib"
|
||||||
|
|
||||||
# Output file which is input to Makefile
|
# Output file which is input to Makefile
|
||||||
CONFIG=config.mk
|
CONFIG=config.mk
|
||||||
|
|
@ -149,6 +150,15 @@ EOF
|
||||||
rm -f $TMPDIR/ipttest.c $TMPDIR/ipttest
|
rm -f $TMPDIR/ipttest.c $TMPDIR/ipttest
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_lib_dir()
|
||||||
|
{
|
||||||
|
LIBDIR=$(echo $LIBDIR | sed "s|\${prefix}|$PREFIX|")
|
||||||
|
|
||||||
|
echo -n "lib directory: "
|
||||||
|
echo "$LIBDIR"
|
||||||
|
echo "LIBDIR:=$LIBDIR" >> $CONFIG
|
||||||
|
}
|
||||||
|
|
||||||
check_ipt()
|
check_ipt()
|
||||||
{
|
{
|
||||||
if ! grep TC_CONFIG_XT $CONFIG > /dev/null; then
|
if ! grep TC_CONFIG_XT $CONFIG > /dev/null; then
|
||||||
|
|
@ -487,6 +497,7 @@ usage()
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
Usage: $0 [OPTIONS]
|
Usage: $0 [OPTIONS]
|
||||||
--include_dir <dir> Path to iproute2 include dir
|
--include_dir <dir> Path to iproute2 include dir
|
||||||
|
--libdir <dir> Path to iproute2 lib dir
|
||||||
--libbpf_dir <dir> Path to libbpf DESTDIR
|
--libbpf_dir <dir> Path to libbpf DESTDIR
|
||||||
--libbpf_force <on|off> Enable/disable libbpf by force. Available options:
|
--libbpf_force <on|off> Enable/disable libbpf by force. Available options:
|
||||||
on: require link against libbpf, quit config if no libbpf support
|
on: require link against libbpf, quit config if no libbpf support
|
||||||
|
|
@ -508,6 +519,11 @@ else
|
||||||
INCLUDE="$1" ;;
|
INCLUDE="$1" ;;
|
||||||
--include_dir=*)
|
--include_dir=*)
|
||||||
INCLUDE="${1#*=}" ;;
|
INCLUDE="${1#*=}" ;;
|
||||||
|
--libdir)
|
||||||
|
shift
|
||||||
|
LIBDIR="$1" ;;
|
||||||
|
--libdir=*)
|
||||||
|
LIBDIR="${1#*=}" ;;
|
||||||
--libbpf_dir)
|
--libbpf_dir)
|
||||||
shift
|
shift
|
||||||
LIBBPF_DIR="$1" ;;
|
LIBBPF_DIR="$1" ;;
|
||||||
|
|
@ -544,6 +560,7 @@ if [ "${LIBBPF_FORCE-unused}" != "unused" ]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
[ -z "$PREFIX" ] && usage 1
|
[ -z "$PREFIX" ] && usage 1
|
||||||
|
[ -z "$LIBDIR" ] && usage 1
|
||||||
|
|
||||||
echo "# Generated config based on" $INCLUDE >$CONFIG
|
echo "# Generated config based on" $INCLUDE >$CONFIG
|
||||||
quiet_config >> $CONFIG
|
quiet_config >> $CONFIG
|
||||||
|
|
@ -568,6 +585,7 @@ if ! grep -q TC_CONFIG_NO_XT $CONFIG; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
|
check_lib_dir
|
||||||
if ! grep -q TC_CONFIG_NO_XT $CONFIG; then
|
if ! grep -q TC_CONFIG_NO_XT $CONFIG; then
|
||||||
echo -n "iptables modules directory: "
|
echo -n "iptables modules directory: "
|
||||||
check_ipt_lib_dir
|
check_ipt_lib_dir
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue