netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Petr Vorel <petr.vorel@gmail.com>
To: netdev@vger.kernel.org
Cc: Petr Vorel <petr.vorel@gmail.com>,
	Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH iproute2 5/7] configure: Code cleanup
Date: Sat, 22 Sep 2018 23:24:49 +0200	[thread overview]
Message-ID: <20180922212451.327-6-petr.vorel@gmail.com> (raw)
In-Reply-To: <20180922212451.327-1-petr.vorel@gmail.com>

Signed-off-by: Petr Vorel <petr.vorel@gmail.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

  parent reply	other threads:[~2018-09-23  3:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-22 21:24 [PATCH iproute2 0/7] Minor shell code cleanup Petr Vorel
2018-09-22 21:24 ` [PATCH iproute2 1/7] man: rtpr: Rename s/bash/shell/ Petr Vorel
2018-09-22 21:24 ` [PATCH iproute2 2/7] tests: Use /bin/sh shebang Petr Vorel
2018-09-22 21:24 ` [PATCH iproute2 3/7] configure: Remove unused function check_prog() Petr Vorel
2018-09-22 21:24 ` [PATCH iproute2 4/7] configure: Remove non-posix shell expansion Petr Vorel
2018-09-22 21:24 ` Petr Vorel [this message]
2018-09-22 21:24 ` [PATCH iproute2 6/7] examples: Remove dhcp-client-script Petr Vorel
2018-09-22 21:24 ` [PATCH iproute2 7/7] examples: Remove cbq.init-v0.7.3 Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180922212451.327-6-petr.vorel@gmail.com \
    --to=petr.vorel@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).