]> git.proxmox.com Git - mirror_iproute2.git/blobdiff - configure
Drop capabilities if not running ip exec vrf with libcap
[mirror_iproute2.git] / configure
index 7be8fb113cc98cb8e006393f1c61be00875e6cb2..5ef5cd4cf9cde980c5951153594a9c93de3bf41c 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,4 +1,5 @@
 #! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
 # This is not an autoconf generated configure
 #
 INCLUDE=${1:-"$PWD/include"}
@@ -16,18 +17,6 @@ check_prog()
     command -v $1 >/dev/null 2>&1 && (echo "$3:=y" >> $CONFIG; echo "yes") || (echo "no"; return 1)
 }
 
-check_docs()
-{
-    if check_prog latex " latex: " HAVE_LATEX; then
-        check_prog pdflatex " pdflatex: " HAVE_PDFLATEX || echo " WARNING: no PDF docs can be built from LaTeX files"
-        check_prog sgml2latex " sgml2latex: " HAVE_SGML2LATEX || echo " WARNING: no LaTeX files can be build from SGML files"
-    else
-        echo " WARNING: no docs can be built from LaTeX files"
-    fi
-
-    check_prog sgml2html " sgml2html: " HAVE_SGML2HTML || echo " WARNING: no HTML docs can be built from SGML"
-}
-
 check_toolchain()
 {
     : ${PKG_CONFIG:=pkg-config}
@@ -326,6 +315,41 @@ EOF
     rm -f $TMPDIR/dbtest.c $TMPDIR/dbtest
 }
 
+check_strlcpy()
+{
+    cat >$TMPDIR/strtest.c <<EOF
+#include <string.h>
+int main(int argc, char **argv) {
+       char dst[10];
+       strlcpy(dst, "test", sizeof(dst));
+       return 0;
+}
+EOF
+    $CC -I$INCLUDE -o $TMPDIR/strtest $TMPDIR/strtest.c >/dev/null 2>&1
+    if [ $? -eq 0 ]
+    then
+       echo "no"
+    else
+       echo 'CFLAGS += -DNEED_STRLCPY' >>$CONFIG
+       echo "yes"
+    fi
+    rm -f $TMPDIR/strtest.c $TMPDIR/strtest
+}
+
+check_cap()
+{
+       if ${PKG_CONFIG} libcap --exists
+       then
+               echo "HAVE_CAP:=y" >>$CONFIG
+               echo "yes"
+
+               echo 'CFLAGS += -DHAVE_LIBCAP' `${PKG_CONFIG} libcap --cflags` >>$CONFIG
+               echo 'LDLIBS +=' `${PKG_CONFIG} libcap --libs` >> $CONFIG
+       else
+               echo "no"
+       fi
+}
+
 quiet_config()
 {
        cat <<EOF
@@ -397,10 +421,11 @@ check_mnl
 echo -n "Berkeley DB: "
 check_berkeley_db
 
-echo
-echo -n "docs:"
-check_docs
-echo
+echo -n "need for strlcpy: "
+check_strlcpy
+
+echo -n "libcap support: "
+check_cap
 
 echo >> $CONFIG
 echo "%.o: %.c" >> $CONFIG