[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180922212451.327-6-petr.vorel@gmail.com>
Date: Sat, 22 Sep 2018 23:24:49 +0200
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 iproute2 5/7] configure: Code cleanup
Signed-off-by: Petr Vorel <petr.vorel@...il.com>
---
configure | 65 +++++++++++++++----------------------------------------
1 file changed, 18 insertions(+), 47 deletions(-)
diff --git a/configure b/configure
index 8f4a7f1e..86c4cf58 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
}
@@ -85,10 +82,7 @@ EOF
check_xt_old()
{
# bail if previous XT checks has already succeded.
- if grep -q TC_CONFIG_XT $CONFIG
- then
- return
- fi
+ grep -q TC_CONFIG_XT $CONFIG && return
#check if we dont need our internal header ..
cat >$TMPDIR/ipttest.c <<EOF
@@ -112,9 +106,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 +116,7 @@ EOF
check_xt_old_internal_h()
{
# bail if previous XT checks has already succeded.
- if grep -q TC_CONFIG_XT $CONFIG
- then
- return
- fi
+ grep -q TC_CONFIG_XT $CONFIG && return
#check if we need our own internal.h
cat >$TMPDIR/ipttest.c <<EOF
@@ -151,10 +140,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 +149,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 +163,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 +186,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 +217,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 +228,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 +242,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 +255,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 +277,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,9 +296,7 @@ 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
echo 'CFLAGS += -DNEED_STRLCPY' >>$CONFIG
@@ -333,8 +307,7 @@ EOF
check_cap()
{
- if ${PKG_CONFIG} libcap --exists
- then
+ if ${PKG_CONFIG} libcap --exists; then
echo "HAVE_CAP:=y" >>$CONFIG
echo "yes"
@@ -382,8 +355,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
@@ -395,8 +367,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.19.0.rc2
Powered by blists - more mailing lists