[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181215180044.22868-5-petr.vorel@gmail.com>
Date: Sat, 15 Dec 2018 19:00:42 +0100
From: Petr Vorel <petr.vorel@...il.com>
To: netdev@...r.kernel.org
Cc: Petr Vorel <petr.vorel@...il.com>,
Stephen Hemminger <stephen@...workplumber.org>
Subject: [PATCH RESENT iproute2 5/7] configure: Minor code cleanup
Signed-off-by: Petr Vorel <petr.vorel@...il.com>
---
configure | 71 ++++++++++++++++---------------------------------------
1 file changed, 20 insertions(+), 51 deletions(-)
diff --git a/configure b/configure
index c88247d8..b85eb58b 100755
--- a/configure
+++ b/configure
@@ -32,9 +32,7 @@ int main(int argc, char **argv) {
}
EOF
- $CC -I$INCLUDE -o $TMPDIR/atmtest $TMPDIR/atmtest.c -latm >/dev/null 2>&1
- if [ $? -eq 0 ]
- then
+ if $CC -I$INCLUDE -o $TMPDIR/atmtest $TMPDIR/atmtest.c -latm >/dev/null 2>&1; then
echo "TC_CONFIG_ATM:=y" >>$CONFIG
echo yes
else
@@ -45,8 +43,7 @@ EOF
check_xtables()
{
- if ! ${PKG_CONFIG} xtables --exists
- then
+ if ! ${PKG_CONFIG} xtables --exists; then
echo "TC_CONFIG_NO_XT:=y" >>$CONFIG
fi
}
@@ -74,8 +71,7 @@ int main(int argc, char **argv)
EOF
if $CC -I$INCLUDE $IPTC -o $TMPDIR/ipttest $TMPDIR/ipttest.c $IPTL \
- $(${PKG_CONFIG} xtables --cflags --libs) -ldl >/dev/null 2>&1
- then
+ $(${PKG_CONFIG} xtables --cflags --libs) -ldl >/dev/null 2>&1; then
echo "TC_CONFIG_XT:=y" >>$CONFIG
echo "using xtables"
fi
@@ -85,10 +81,7 @@ EOF
check_xt_old()
{
# bail if previous XT checks has already succeeded.
- if grep -q TC_CONFIG_XT $CONFIG
- then
- return
- fi
+ grep -q TC_CONFIG_XT $CONFIG && return
#check if we don't need our internal header ..
cat >$TMPDIR/ipttest.c <<EOF
@@ -112,9 +105,7 @@ int main(int argc, char **argv) {
EOF
- $CC -I$INCLUDE $IPTC -o $TMPDIR/ipttest $TMPDIR/ipttest.c $IPTL -ldl >/dev/null 2>&1
- if [ $? -eq 0 ]
- then
+ if $CC -I$INCLUDE $IPTC -o $TMPDIR/ipttest $TMPDIR/ipttest.c $IPTL -ldl >/dev/null 2>&1; then
echo "TC_CONFIG_XT_OLD:=y" >>$CONFIG
echo "using old xtables (no need for xt-internal.h)"
fi
@@ -124,10 +115,7 @@ EOF
check_xt_old_internal_h()
{
# bail if previous XT checks has already succeeded.
- if grep -q TC_CONFIG_XT $CONFIG
- then
- return
- fi
+ grep -q if grep -q TC_CONFIG_XT $CONFIG && return
#check if we need our own internal.h
cat >$TMPDIR/ipttest.c <<EOF
@@ -151,10 +139,7 @@ int main(int argc, char **argv) {
}
EOF
- $CC -I$INCLUDE $IPTC -o $TMPDIR/ipttest $TMPDIR/ipttest.c $IPTL -ldl >/dev/null 2>&1
-
- if [ $? -eq 0 ]
- then
+ if $CC -I$INCLUDE $IPTC -o $TMPDIR/ipttest $TMPDIR/ipttest.c $IPTL -ldl >/dev/null 2>&1; then
echo "using old xtables with xt-internal.h"
echo "TC_CONFIG_XT_OLD_H:=y" >>$CONFIG
fi
@@ -163,8 +148,7 @@ EOF
check_ipt()
{
- if ! grep TC_CONFIG_XT $CONFIG > /dev/null
- then
+ if ! grep TC_CONFIG_XT $CONFIG > /dev/null; then
echo "using iptables"
fi
}
@@ -178,8 +162,7 @@ check_ipt_lib_dir()
return
fi
- for dir in /lib /usr/lib /usr/local/lib
- do
+ for dir in /lib /usr/lib /usr/local/lib; do
for file in "xtables" "iptables"; do
file="$dir/$file/lib*t_*so"
if [ -f $file ]; then
@@ -202,9 +185,7 @@ int main(int argc, char **argv)
return 0;
}
EOF
- $CC -I$INCLUDE -o $TMPDIR/setnstest $TMPDIR/setnstest.c >/dev/null 2>&1
- if [ $? -eq 0 ]
- then
+ if $CC -I$INCLUDE -o $TMPDIR/setnstest $TMPDIR/setnstest.c >/dev/null 2>&1; then
echo "IP_CONFIG_SETNS:=y" >>$CONFIG
echo "yes"
echo "CFLAGS += -DHAVE_SETNS" >>$CONFIG
@@ -235,8 +216,7 @@ int main(void)
#endif
EOF
- if $CC -I$INCLUDE -o $TMPDIR/ipsettest $TMPDIR/ipsettest.c >/dev/null 2>&1
- then
+ if $CC -I$INCLUDE -o $TMPDIR/ipsettest $TMPDIR/ipsettest.c >/dev/null 2>&1; then
echo "TC_CONFIG_IPSET:=y" >>$CONFIG
echo "yes"
else
@@ -247,8 +227,7 @@ EOF
check_elf()
{
- if ${PKG_CONFIG} libelf --exists
- then
+ if ${PKG_CONFIG} libelf --exists; then
echo "HAVE_ELF:=y" >>$CONFIG
echo "yes"
@@ -262,8 +241,7 @@ check_elf()
check_selinux()
# SELinux is a compile time option in the ss utility
{
- if ${PKG_CONFIG} libselinux --exists
- then
+ if ${PKG_CONFIG} libselinux --exists; then
echo "HAVE_SELINUX:=y" >>$CONFIG
echo "yes"
@@ -276,8 +254,7 @@ check_selinux()
check_mnl()
{
- if ${PKG_CONFIG} libmnl --exists
- then
+ if ${PKG_CONFIG} libmnl --exists; then
echo "HAVE_MNL:=y" >>$CONFIG
echo "yes"
@@ -299,9 +276,7 @@ int main(int argc, char **argv) {
return 0;
}
EOF
- $CC -I$INCLUDE -o $TMPDIR/dbtest $TMPDIR/dbtest.c -ldb >/dev/null 2>&1
- if [ $? -eq 0 ]
- then
+ if $CC -I$INCLUDE -o $TMPDIR/dbtest $TMPDIR/dbtest.c -ldb >/dev/null 2>&1; then
echo "HAVE_BERKELEY_DB:=y" >>$CONFIG
echo "yes"
else
@@ -320,13 +295,10 @@ int main(int argc, char **argv) {
return 0;
}
EOF
- $CC -I$INCLUDE -o $TMPDIR/strtest $TMPDIR/strtest.c >/dev/null 2>&1
- if [ $? -eq 0 ]
- then
+ if $CC -I$INCLUDE -o $TMPDIR/strtest $TMPDIR/strtest.c >/dev/null 2>&1; then
echo "no"
else
- if ${PKG_CONFIG} libbsd --exists
- then
+ if ${PKG_CONFIG} libbsd --exists; then
echo 'CFLAGS += -DHAVE_LIBBSD' `${PKG_CONFIG} libbsd --cflags` >>$CONFIG
echo 'LDLIBS +=' `${PKG_CONFIG} libbsd --libs` >> $CONFIG
echo "no"
@@ -340,8 +312,7 @@ EOF
check_cap()
{
- if ${PKG_CONFIG} libcap --exists
- then
+ if ${PKG_CONFIG} libcap --exists; then
echo "HAVE_CAP:=y" >>$CONFIG
echo "yes"
@@ -389,8 +360,7 @@ echo -n " ATM "
check_atm
check_xtables
-if ! grep -q TC_CONFIG_NO_XT $CONFIG
-then
+if ! grep -q TC_CONFIG_NO_XT $CONFIG; then
echo -n " IPT "
check_xt
check_xt_old
@@ -402,8 +372,7 @@ then
fi
echo
-if ! grep -q TC_CONFIG_NO_XT $CONFIG
-then
+if ! grep -q TC_CONFIG_NO_XT $CONFIG; then
echo -n "iptables modules directory: "
check_ipt_lib_dir
fi
--
2.20.0
Powered by blists - more mailing lists