Blame configure

Packit Service 3880ab
#!/bin/sh
Packit Service 3880ab
# SPDX-License-Identifier: GPL-2.0
Packit Service 3880ab
# This is not an autoconf generated configure
Packit Service 3880ab
#
Packit Bot 867fae
# Influential LIBBPF environment variables:
Packit Bot 867fae
#   LIBBPF_FORCE={on,off}   on: require link against libbpf;
Packit Bot 867fae
#                           off: disable libbpf probing
Packit Bot 867fae
#   LIBBPF_DIR              Path to libbpf DESTDIR to use
Packit Bot 867fae
Packit Service 3880ab
INCLUDE=${1:-"$PWD/include"}
Packit Service 3880ab
Packit Service 3880ab
# Output file which is input to Makefile
Packit Service 3880ab
CONFIG=config.mk
Packit Service 3880ab
Packit Service 3880ab
# Make a temp directory in build tree.
Packit Service 3880ab
TMPDIR=$(mktemp -d config.XXXXXX)
Packit Service 3880ab
trap 'status=$?; rm -rf $TMPDIR; exit $status' EXIT HUP INT QUIT TERM
Packit Service 3880ab
Packit Service 3880ab
check_toolchain()
Packit Service 3880ab
{
Packit Service 3880ab
    : ${PKG_CONFIG:=pkg-config}
Packit Service 3880ab
    : ${AR=ar}
Packit Service 3880ab
    : ${CC=gcc}
Packit Service 3880ab
    : ${YACC=bison}
Packit Service 3880ab
    echo "PKG_CONFIG:=${PKG_CONFIG}" >>$CONFIG
Packit Service 3880ab
    echo "AR:=${AR}" >>$CONFIG
Packit Service 3880ab
    echo "CC:=${CC}" >>$CONFIG
Packit Service 3880ab
    echo "YACC:=${YACC}" >>$CONFIG
Packit Service 3880ab
}
Packit Service 3880ab
Packit Service 3880ab
check_atm()
Packit Service 3880ab
{
Packit Service 3880ab
    cat >$TMPDIR/atmtest.c <
Packit Service 3880ab
#include <atm.h>
Packit Service 3880ab
int main(int argc, char **argv) {
Packit Service 3880ab
	struct atm_qos qos;
Packit Service 3880ab
	(void) text2qos("aal5,ubr:sdu=9180,rx:none",&qos,0);
Packit Service 3880ab
	return 0;
Packit Service 3880ab
}
Packit Service 3880ab
EOF
Packit Service 3880ab
Packit Service 3880ab
    if $CC -I$INCLUDE -o $TMPDIR/atmtest $TMPDIR/atmtest.c -latm >/dev/null 2>&1; then
Packit Service 3880ab
	echo "TC_CONFIG_ATM:=y" >>$CONFIG
Packit Service 3880ab
	echo yes
Packit Service 3880ab
    else
Packit Service 3880ab
	echo no
Packit Service 3880ab
    fi
Packit Service 3880ab
    rm -f $TMPDIR/atmtest.c $TMPDIR/atmtest
Packit Service 3880ab
}
Packit Service 3880ab
Packit Service 3880ab
check_xtables()
Packit Service 3880ab
{
Packit Service 3880ab
	if ! ${PKG_CONFIG} xtables --exists; then
Packit Service 3880ab
		echo "TC_CONFIG_NO_XT:=y" >>$CONFIG
Packit Service 3880ab
	fi
Packit Service 3880ab
}
Packit Service 3880ab
Packit Service 3880ab
check_xt()
Packit Service 3880ab
{
Packit Service 3880ab
    #check if we have xtables from iptables >= 1.4.5.
Packit Service 3880ab
    cat >$TMPDIR/ipttest.c <
Packit Service 3880ab
#include <xtables.h>
Packit Service 3880ab
#include <linux/netfilter.h>
Packit Service 3880ab
static struct xtables_globals test_globals = {
Packit Service 3880ab
	.option_offset = 0,
Packit Service 3880ab
	.program_name = "tc-ipt",
Packit Service 3880ab
	.program_version = XTABLES_VERSION,
Packit Service 3880ab
	.orig_opts = NULL,
Packit Service 3880ab
	.opts = NULL,
Packit Service 3880ab
	.exit_err = NULL,
Packit Service 3880ab
};
Packit Service 3880ab
Packit Service 3880ab
int main(int argc, char **argv)
Packit Service 3880ab
{
Packit Service 3880ab
	xtables_init_all(&test_globals, NFPROTO_IPV4);
Packit Service 3880ab
	return 0;
Packit Service 3880ab
}
Packit Service 3880ab
EOF
Packit Service 3880ab
Packit Service 3880ab
    if $CC -I$INCLUDE $IPTC -o $TMPDIR/ipttest $TMPDIR/ipttest.c $IPTL \
Packit Service 3880ab
	$(${PKG_CONFIG} xtables --cflags --libs) -ldl >/dev/null 2>&1; then
Packit Service 3880ab
	echo "TC_CONFIG_XT:=y" >>$CONFIG
Packit Service 3880ab
	echo "using xtables"
Packit Service 3880ab
    fi
Packit Service 3880ab
    rm -f $TMPDIR/ipttest.c $TMPDIR/ipttest
Packit Service 3880ab
}
Packit Service 3880ab
Packit Service 3880ab
check_xt_old()
Packit Service 3880ab
{
Packit Service 3880ab
    # bail if previous XT checks has already succeeded.
Packit Service 3880ab
    grep -q TC_CONFIG_XT $CONFIG && return
Packit Service 3880ab
Packit Service 3880ab
    #check if we don't need our internal header ..
Packit Service 3880ab
    cat >$TMPDIR/ipttest.c <
Packit Service 3880ab
#include <xtables.h>
Packit Service 3880ab
char *lib_dir;
Packit Service 3880ab
unsigned int global_option_offset = 0;
Packit Service 3880ab
const char *program_version = XTABLES_VERSION;
Packit Service 3880ab
const char *program_name = "tc-ipt";
Packit Service 3880ab
struct afinfo afinfo = {
Packit Service 3880ab
	.libprefix      = "libxt_",
Packit Service 3880ab
};
Packit Service 3880ab
Packit Service 3880ab
void exit_error(enum exittype status, const char *msg, ...)
Packit Service 3880ab
{
Packit Service 3880ab
}
Packit Service 3880ab
Packit Service 3880ab
int main(int argc, char **argv) {
Packit Service 3880ab
Packit Service 3880ab
	return 0;
Packit Service 3880ab
}
Packit Service 3880ab
Packit Service 3880ab
EOF
Packit Service 3880ab
Packit Service 3880ab
    if $CC -I$INCLUDE $IPTC -o $TMPDIR/ipttest $TMPDIR/ipttest.c $IPTL -ldl >/dev/null 2>&1; then
Packit Service 3880ab
	echo "TC_CONFIG_XT_OLD:=y" >>$CONFIG
Packit Service 3880ab
	echo "using old xtables (no need for xt-internal.h)"
Packit Service 3880ab
    fi
Packit Service 3880ab
    rm -f $TMPDIR/ipttest.c $TMPDIR/ipttest
Packit Service 3880ab
}
Packit Service 3880ab
Packit Service 3880ab
check_xt_old_internal_h()
Packit Service 3880ab
{
Packit Service 3880ab
    # bail if previous XT checks has already succeeded.
Packit Service 3880ab
    grep -q TC_CONFIG_XT $CONFIG && return
Packit Service 3880ab
Packit Service 3880ab
    #check if we need our own internal.h
Packit Service 3880ab
    cat >$TMPDIR/ipttest.c <
Packit Service 3880ab
#include <xtables.h>
Packit Service 3880ab
#include "xt-internal.h"
Packit Service 3880ab
char *lib_dir;
Packit Service 3880ab
unsigned int global_option_offset = 0;
Packit Service 3880ab
const char *program_version = XTABLES_VERSION;
Packit Service 3880ab
const char *program_name = "tc-ipt";
Packit Service 3880ab
struct afinfo afinfo = {
Packit Service 3880ab
	.libprefix      = "libxt_",
Packit Service 3880ab
};
Packit Service 3880ab
Packit Service 3880ab
void exit_error(enum exittype status, const char *msg, ...)
Packit Service 3880ab
{
Packit Service 3880ab
}
Packit Service 3880ab
Packit Service 3880ab
int main(int argc, char **argv) {
Packit Service 3880ab
Packit Service 3880ab
	return 0;
Packit Service 3880ab
}
Packit Service 3880ab
Packit Service 3880ab
EOF
Packit Service 3880ab
	if $CC -I$INCLUDE $IPTC -o $TMPDIR/ipttest $TMPDIR/ipttest.c $IPTL -ldl >/dev/null 2>&1; then
Packit Service 3880ab
	    echo "using old xtables with xt-internal.h"
Packit Service 3880ab
	    echo "TC_CONFIG_XT_OLD_H:=y" >>$CONFIG
Packit Service 3880ab
	fi
Packit Service 3880ab
	rm -f $TMPDIR/ipttest.c $TMPDIR/ipttest
Packit Service 3880ab
}
Packit Service 3880ab
Packit Service 3880ab
check_ipt()
Packit Service 3880ab
{
Packit Service 3880ab
	if ! grep TC_CONFIG_XT $CONFIG > /dev/null; then
Packit Service 3880ab
		echo "using iptables"
Packit Service 3880ab
	fi
Packit Service 3880ab
}
Packit Service 3880ab
Packit Service 3880ab
check_ipt_lib_dir()
Packit Service 3880ab
{
Packit Service 3880ab
	IPT_LIB_DIR=$(${PKG_CONFIG} --variable=xtlibdir xtables)
Packit Service 3880ab
	if [ -n "$IPT_LIB_DIR" ]; then
Packit Service 3880ab
		echo $IPT_LIB_DIR
Packit Service 3880ab
		echo "IPT_LIB_DIR:=$IPT_LIB_DIR" >> $CONFIG
Packit Service 3880ab
		return
Packit Service 3880ab
	fi
Packit Service 3880ab
Packit Service 3880ab
	for dir in /lib /usr/lib /usr/local/lib; do
Packit Service 3880ab
		for file in "xtables" "iptables"; do
Packit Service 3880ab
			file="$dir/$file/lib*t_*so"
Packit Service 3880ab
			if [ -f $file ]; then
Packit Service 3880ab
				echo ${file%/*}
Packit Service 3880ab
				echo "IPT_LIB_DIR:=${file%/*}" >> $CONFIG
Packit Service 3880ab
				return
Packit Service 3880ab
			fi
Packit Service 3880ab
		done
Packit Service 3880ab
	done
Packit Service 3880ab
	echo "not found!"
Packit Service 3880ab
}
Packit Service 3880ab
Packit Service 3880ab
check_setns()
Packit Service 3880ab
{
Packit Service 3880ab
    cat >$TMPDIR/setnstest.c <
Packit Service 3880ab
#include <sched.h>
Packit Service 3880ab
int main(int argc, char **argv)
Packit Service 3880ab
{
Packit Service 3880ab
	(void)setns(0,0);
Packit Service 3880ab
	return 0;
Packit Service 3880ab
}
Packit Service 3880ab
EOF
Packit Service 3880ab
    if $CC -I$INCLUDE -o $TMPDIR/setnstest $TMPDIR/setnstest.c >/dev/null 2>&1; then
Packit Service 3880ab
	echo "IP_CONFIG_SETNS:=y" >>$CONFIG
Packit Service 3880ab
	echo "yes"
Packit Service 3880ab
	echo "CFLAGS += -DHAVE_SETNS" >>$CONFIG
Packit Service 3880ab
    else
Packit Service 3880ab
	echo "no"
Packit Service 3880ab
    fi
Packit Service 3880ab
    rm -f $TMPDIR/setnstest.c $TMPDIR/setnstest
Packit Service 3880ab
}
Packit Service 3880ab
Packit Service 3880ab
check_ipset()
Packit Service 3880ab
{
Packit Service 3880ab
    cat >$TMPDIR/ipsettest.c <
Packit Service 3880ab
#include <linux/netfilter/ipset/ip_set.h>
Packit Service 3880ab
#ifndef IP_SET_INVALID
Packit Service 3880ab
#define IPSET_DIM_MAX 3
Packit Service 3880ab
typedef unsigned short ip_set_id_t;
Packit Service 3880ab
#endif
Packit Service 3880ab
#include <linux/netfilter/xt_set.h>
Packit Service 3880ab
Packit Service 3880ab
struct xt_set_info info;
Packit Service 3880ab
#if IPSET_PROTOCOL == 6 || IPSET_PROTOCOL == 7
Packit Service 3880ab
int main(void)
Packit Service 3880ab
{
Packit Service 3880ab
	return IPSET_MAXNAMELEN;
Packit Service 3880ab
}
Packit Service 3880ab
#else
Packit Service 3880ab
#error unknown ipset version
Packit Service 3880ab
#endif
Packit Service 3880ab
EOF
Packit Service 3880ab
Packit Service 3880ab
    if $CC -I$INCLUDE -o $TMPDIR/ipsettest $TMPDIR/ipsettest.c >/dev/null 2>&1; then
Packit Service 3880ab
	echo "TC_CONFIG_IPSET:=y" >>$CONFIG
Packit Service 3880ab
	echo "yes"
Packit Service 3880ab
    else
Packit Service 3880ab
	echo "no"
Packit Service 3880ab
    fi
Packit Service 3880ab
    rm -f $TMPDIR/ipsettest.c $TMPDIR/ipsettest
Packit Service 3880ab
}
Packit Service 3880ab
Packit Service 3880ab
check_elf()
Packit Service 3880ab
{
Packit Service 3880ab
    if ${PKG_CONFIG} libelf --exists; then
Packit Service 3880ab
	echo "HAVE_ELF:=y" >>$CONFIG
Packit Service 3880ab
	echo "yes"
Packit Service 3880ab
Packit Service 3880ab
	echo 'CFLAGS += -DHAVE_ELF' `${PKG_CONFIG} libelf --cflags` >> $CONFIG
Packit Service 3880ab
	echo 'LDLIBS += ' `${PKG_CONFIG} libelf --libs` >>$CONFIG
Packit Service 3880ab
    else
Packit Service 3880ab
	echo "no"
Packit Service 3880ab
    fi
Packit Service 3880ab
}
Packit Service 3880ab
Packit Bot 867fae
have_libbpf_basic()
Packit Bot 867fae
{
Packit Bot 867fae
    cat >$TMPDIR/libbpf_test.c <
Packit Bot 867fae
#include <bpf/libbpf.h>
Packit Bot 867fae
int main(int argc, char **argv) {
Packit Bot 867fae
    bpf_program__set_autoload(NULL, false);
Packit Bot 867fae
    bpf_map__ifindex(NULL);
Packit Bot 867fae
    bpf_map__set_pin_path(NULL, NULL);
Packit Bot 867fae
    bpf_object__open_file(NULL, NULL);
Packit Bot 867fae
    return 0;
Packit Bot 867fae
}
Packit Bot 867fae
EOF
Packit Bot 867fae
Packit Bot 867fae
    $CC -o $TMPDIR/libbpf_test $TMPDIR/libbpf_test.c $LIBBPF_CFLAGS $LIBBPF_LDLIBS >/dev/null 2>&1
Packit Bot 867fae
    local ret=$?
Packit Bot 867fae
Packit Bot 867fae
    rm -f $TMPDIR/libbpf_test.c $TMPDIR/libbpf_test
Packit Bot 867fae
    return $ret
Packit Bot 867fae
}
Packit Bot 867fae
Packit Bot 867fae
have_libbpf_sec_name()
Packit Bot 867fae
{
Packit Bot 867fae
    cat >$TMPDIR/libbpf_sec_test.c <
Packit Bot 867fae
#include <bpf/libbpf.h>
Packit Bot 867fae
int main(int argc, char **argv) {
Packit Bot 867fae
    void *ptr;
Packit Bot 867fae
    bpf_program__section_name(NULL);
Packit Bot 867fae
    return 0;
Packit Bot 867fae
}
Packit Bot 867fae
EOF
Packit Bot 867fae
Packit Bot 867fae
    $CC -o $TMPDIR/libbpf_sec_test $TMPDIR/libbpf_sec_test.c $LIBBPF_CFLAGS $LIBBPF_LDLIBS >/dev/null 2>&1
Packit Bot 867fae
    local ret=$?
Packit Bot 867fae
Packit Bot 867fae
    rm -f $TMPDIR/libbpf_sec_test.c $TMPDIR/libbpf_sec_test
Packit Bot 867fae
    return $ret
Packit Bot 867fae
}
Packit Bot 867fae
Packit Bot 867fae
check_force_libbpf_on()
Packit Bot 867fae
{
Packit Bot 867fae
    # if set LIBBPF_FORCE=on but no libbpf support, just exist the config
Packit Bot 867fae
    # process to make sure we don't build without libbpf.
Packit Bot 867fae
    if [ "$LIBBPF_FORCE" = on ]; then
Packit Bot 867fae
        echo "	LIBBPF_FORCE=on set, but couldn't find a usable libbpf"
Packit Bot 867fae
        exit 1
Packit Bot 867fae
    fi
Packit Bot 867fae
}
Packit Bot 867fae
Packit Bot 867fae
check_libbpf()
Packit Bot 867fae
{
Packit Bot 867fae
    # if set LIBBPF_FORCE=off, disable libbpf entirely
Packit Bot 867fae
    if [ "$LIBBPF_FORCE" = off ]; then
Packit Bot 867fae
        echo "no"
Packit Bot 867fae
        return
Packit Bot 867fae
    fi
Packit Bot 867fae
Packit Bot 867fae
    if ! ${PKG_CONFIG} libbpf --exists && [ -z "$LIBBPF_DIR" ] ; then
Packit Bot 867fae
        echo "no"
Packit Bot 867fae
        check_force_libbpf_on
Packit Bot 867fae
        return
Packit Bot 867fae
    fi
Packit Bot 867fae
Packit Bot 867fae
    if [ $(uname -m) = x86_64 ]; then
Packit Bot 867fae
        local LIBBPF_LIBDIR="${LIBBPF_DIR}/usr/lib64"
Packit Bot 867fae
    else
Packit Bot 867fae
        local LIBBPF_LIBDIR="${LIBBPF_DIR}/usr/lib"
Packit Bot 867fae
    fi
Packit Bot 867fae
Packit Bot 867fae
    if [ -n "$LIBBPF_DIR" ]; then
Packit Bot 867fae
        LIBBPF_CFLAGS="-I${LIBBPF_DIR}/usr/include"
Packit Bot 867fae
        LIBBPF_LDLIBS="${LIBBPF_LIBDIR}/libbpf.a -lz -lelf"
Packit Bot 867fae
        LIBBPF_VERSION=$(PKG_CONFIG_LIBDIR=${LIBBPF_LIBDIR}/pkgconfig ${PKG_CONFIG} libbpf --modversion)
Packit Bot 867fae
    else
Packit Bot 867fae
        LIBBPF_CFLAGS=$(${PKG_CONFIG} libbpf --cflags)
Packit Bot 867fae
        LIBBPF_LDLIBS=$(${PKG_CONFIG} libbpf --libs)
Packit Bot 867fae
        LIBBPF_VERSION=$(${PKG_CONFIG} libbpf --modversion)
Packit Bot 867fae
    fi
Packit Bot 867fae
Packit Bot 867fae
    if ! have_libbpf_basic; then
Packit Bot 867fae
        echo "no"
Packit Bot 867fae
        echo "	libbpf version $LIBBPF_VERSION is too low, please update it to at least 0.1.0"
Packit Bot 867fae
        check_force_libbpf_on
Packit Bot 867fae
        return
Packit Bot 867fae
    else
Packit Bot 867fae
        echo "HAVE_LIBBPF:=y" >> $CONFIG
Packit Bot 867fae
        echo 'CFLAGS += -DHAVE_LIBBPF ' $LIBBPF_CFLAGS >> $CONFIG
Packit Bot 867fae
        echo "CFLAGS += -DLIBBPF_VERSION=\\\"$LIBBPF_VERSION\\\"" >> $CONFIG
Packit Bot 867fae
        echo 'LDLIBS += ' $LIBBPF_LDLIBS >> $CONFIG
Packit Bot 867fae
Packit Bot 867fae
        if [ -z "$LIBBPF_DIR" ]; then
Packit Bot 867fae
            echo "CFLAGS += -DLIBBPF_DYNAMIC" >> $CONFIG
Packit Bot 867fae
        fi
Packit Bot 867fae
    fi
Packit Bot 867fae
Packit Bot 867fae
    # bpf_program__title() is deprecated since libbpf 0.2.0, use
Packit Bot 867fae
    # bpf_program__section_name() instead if we support
Packit Bot 867fae
    if have_libbpf_sec_name; then
Packit Bot 867fae
        echo "HAVE_LIBBPF_SECTION_NAME:=y" >> $CONFIG
Packit Bot 867fae
        echo 'CFLAGS += -DHAVE_LIBBPF_SECTION_NAME ' >> $CONFIG
Packit Bot 867fae
    fi
Packit Bot 867fae
Packit Bot 867fae
    echo "yes"
Packit Bot 867fae
    echo "	libbpf version $LIBBPF_VERSION"
Packit Bot 867fae
}
Packit Bot 867fae
Packit Service 3880ab
check_selinux()
Packit Service 3880ab
# SELinux is a compile time option in the ss utility
Packit Service 3880ab
{
Packit Service 3880ab
	if ${PKG_CONFIG} libselinux --exists; then
Packit Service 3880ab
		echo "HAVE_SELINUX:=y" >>$CONFIG
Packit Service 3880ab
		echo "yes"
Packit Service 3880ab
Packit Service 3880ab
		echo 'LDLIBS +=' `${PKG_CONFIG} --libs libselinux` >>$CONFIG
Packit Service 3880ab
		echo 'CFLAGS += -DHAVE_SELINUX' `${PKG_CONFIG} --cflags libselinux` >>$CONFIG
Packit Service 3880ab
	else
Packit Service 3880ab
		echo "no"
Packit Service 3880ab
	fi
Packit Service 3880ab
}
Packit Service 3880ab
Packit Service 3880ab
check_mnl()
Packit Service 3880ab
{
Packit Service 3880ab
	if ${PKG_CONFIG} libmnl --exists; then
Packit Service 3880ab
		echo "HAVE_MNL:=y" >>$CONFIG
Packit Service 3880ab
		echo "yes"
Packit Service 3880ab
Packit Service 3880ab
		echo 'CFLAGS += -DHAVE_LIBMNL' `${PKG_CONFIG} libmnl --cflags` >>$CONFIG
Packit Service 3880ab
		echo 'LDLIBS +=' `${PKG_CONFIG} libmnl --libs` >> $CONFIG
Packit Service 3880ab
	else
Packit Service 3880ab
		echo "no"
Packit Service 3880ab
	fi
Packit Service 3880ab
}
Packit Service 3880ab
Packit Service 3880ab
check_berkeley_db()
Packit Service 3880ab
{
Packit Service 3880ab
    cat >$TMPDIR/dbtest.c <
Packit Service 3880ab
#include <fcntl.h>
Packit Service 3880ab
#include <stdlib.h>
Packit Service 3880ab
#include <db_185.h>
Packit Service 3880ab
int main(int argc, char **argv) {
Packit Service 3880ab
	dbopen("/tmp/xxx_test_db.db", O_CREAT|O_RDWR, 0644, DB_HASH, NULL);
Packit Service 3880ab
	return 0;
Packit Service 3880ab
}
Packit Service 3880ab
EOF
Packit Service 3880ab
    if $CC -I$INCLUDE -o $TMPDIR/dbtest $TMPDIR/dbtest.c -ldb >/dev/null 2>&1; then
Packit Service 3880ab
	echo "HAVE_BERKELEY_DB:=y" >>$CONFIG
Packit Service 3880ab
	echo "yes"
Packit Service 3880ab
    else
Packit Service 3880ab
	echo "no"
Packit Service 3880ab
    fi
Packit Service 3880ab
    rm -f $TMPDIR/dbtest.c $TMPDIR/dbtest
Packit Service 3880ab
}
Packit Service 3880ab
Packit Service 3880ab
check_strlcpy()
Packit Service 3880ab
{
Packit Service 3880ab
    cat >$TMPDIR/strtest.c <
Packit Service 3880ab
#include <string.h>
Packit Service 3880ab
int main(int argc, char **argv) {
Packit Service 3880ab
	char dst[10];
Packit Service 3880ab
	strlcpy(dst, "test", sizeof(dst));
Packit Service 3880ab
	return 0;
Packit Service 3880ab
}
Packit Service 3880ab
EOF
Packit Service 3880ab
    if $CC -I$INCLUDE -o $TMPDIR/strtest $TMPDIR/strtest.c >/dev/null 2>&1; then
Packit Service 3880ab
	echo "no"
Packit Service 3880ab
    else
Packit Service 3880ab
	if ${PKG_CONFIG} libbsd --exists; then
Packit Service 3880ab
		echo 'CFLAGS += -DHAVE_LIBBSD' `${PKG_CONFIG} libbsd --cflags` >>$CONFIG
Packit Service 3880ab
		echo 'LDLIBS +=' `${PKG_CONFIG} libbsd --libs` >> $CONFIG
Packit Service 3880ab
		echo "no"
Packit Service 3880ab
	else
Packit Service 3880ab
		echo 'CFLAGS += -DNEED_STRLCPY' >>$CONFIG
Packit Service 3880ab
		echo "yes"
Packit Service 3880ab
	fi
Packit Service 3880ab
    fi
Packit Service 3880ab
    rm -f $TMPDIR/strtest.c $TMPDIR/strtest
Packit Service 3880ab
}
Packit Service 3880ab
Packit Service 3880ab
check_cap()
Packit Service 3880ab
{
Packit Service 3880ab
	if ${PKG_CONFIG} libcap --exists; then
Packit Service 3880ab
		echo "HAVE_CAP:=y" >>$CONFIG
Packit Service 3880ab
		echo "yes"
Packit Service 3880ab
Packit Service 3880ab
		echo 'CFLAGS += -DHAVE_LIBCAP' `${PKG_CONFIG} libcap --cflags` >>$CONFIG
Packit Service 3880ab
		echo 'LDLIBS +=' `${PKG_CONFIG} libcap --libs` >> $CONFIG
Packit Service 3880ab
	else
Packit Service 3880ab
		echo "no"
Packit Service 3880ab
	fi
Packit Service 3880ab
}
Packit Service 3880ab
Packit Service 3880ab
quiet_config()
Packit Service 3880ab
{
Packit Service 3880ab
	cat <
Packit Service 3880ab
# user can control verbosity similar to kernel builds (e.g., V=1)
Packit Service 3880ab
ifeq ("\$(origin V)", "command line")
Packit Service 3880ab
  VERBOSE = \$(V)
Packit Service 3880ab
endif
Packit Service 3880ab
ifndef VERBOSE
Packit Service 3880ab
  VERBOSE = 0
Packit Service 3880ab
endif
Packit Service 3880ab
ifeq (\$(VERBOSE),1)
Packit Service 3880ab
  Q =
Packit Service 3880ab
else
Packit Service 3880ab
  Q = @
Packit Service 3880ab
endif
Packit Service 3880ab
Packit Service 3880ab
ifeq (\$(VERBOSE), 0)
Packit Service 3880ab
    QUIET_CC       = @echo '    CC       '\$@;
Packit Service 3880ab
    QUIET_AR       = @echo '    AR       '\$@;
Packit Service 3880ab
    QUIET_LINK     = @echo '    LINK     '\$@;
Packit Service 3880ab
    QUIET_YACC     = @echo '    YACC     '\$@;
Packit Service 3880ab
    QUIET_LEX      = @echo '    LEX      '\$@;
Packit Service 3880ab
endif
Packit Service 3880ab
EOF
Packit Service 3880ab
}
Packit Service 3880ab
Packit Service 3880ab
echo "# Generated config based on" $INCLUDE >$CONFIG
Packit Service 3880ab
quiet_config >> $CONFIG
Packit Service 3880ab
Packit Service 3880ab
check_toolchain
Packit Service 3880ab
Packit Service 3880ab
echo "TC schedulers"
Packit Service 3880ab
Packit Service 3880ab
echo -n " ATM	"
Packit Service 3880ab
check_atm
Packit Service 3880ab
Packit Service 3880ab
check_xtables
Packit Service 3880ab
if ! grep -q TC_CONFIG_NO_XT $CONFIG; then
Packit Service 3880ab
	echo -n " IPT	"
Packit Service 3880ab
	check_xt
Packit Service 3880ab
	check_xt_old
Packit Service 3880ab
	check_xt_old_internal_h
Packit Service 3880ab
	check_ipt
Packit Service 3880ab
Packit Service 3880ab
	echo -n " IPSET  "
Packit Service 3880ab
	check_ipset
Packit Service 3880ab
fi
Packit Service 3880ab
Packit Service 3880ab
echo
Packit Service 3880ab
if ! grep -q TC_CONFIG_NO_XT $CONFIG; then
Packit Service 3880ab
	echo -n "iptables modules directory: "
Packit Service 3880ab
	check_ipt_lib_dir
Packit Service 3880ab
fi
Packit Service 3880ab
Packit Service 3880ab
echo -n "libc has setns: "
Packit Service 3880ab
check_setns
Packit Service 3880ab
Packit Service 3880ab
echo -n "SELinux support: "
Packit Service 3880ab
check_selinux
Packit Service 3880ab
Packit Bot 867fae
echo -n "libbpf support: "
Packit Bot 867fae
check_libbpf
Packit Bot 867fae
Packit Service 3880ab
echo -n "ELF support: "
Packit Service 3880ab
check_elf
Packit Service 3880ab
Packit Service 3880ab
echo -n "libmnl support: "
Packit Service 3880ab
check_mnl
Packit Service 3880ab
Packit Service 3880ab
echo -n "Berkeley DB: "
Packit Service 3880ab
check_berkeley_db
Packit Service 3880ab
Packit Service 3880ab
echo -n "need for strlcpy: "
Packit Service 3880ab
check_strlcpy
Packit Service 3880ab
Packit Service 3880ab
echo -n "libcap support: "
Packit Service 3880ab
check_cap
Packit Service 3880ab
Packit Service 3880ab
echo >> $CONFIG
Packit Service 3880ab
echo "%.o: %.c" >> $CONFIG
Packit Service 3880ab
echo '	$(QUIET_CC)$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CPPFLAGS) -c -o $@ $<' >> $CONFIG