netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iproute2: detect iptables modules dir in configure.
@ 2010-03-11 19:07 Andreas Henriksson
  2010-03-11 20:47 ` Andreas Henriksson
  2010-03-11 20:54 ` [PATCH v2] " Andreas Henriksson
  0 siblings, 2 replies; 3+ messages in thread
From: Andreas Henriksson @ 2010-03-11 19:07 UTC (permalink / raw)
  To: shemminger; +Cc: netdev

Try to automatically detect iptables modules directory.

Make the configure script look for iptables modules.
This also makes it possible to specify it on the
command line while building via "make IPT_LIB_DIR=/foo/bar".

Signed-off-by: Andreas Henriksson <andreas@fatal.se>

---

Possibly the ifndef check in include/iptables.h
should be turned into an #error to force the person
building to manually specify it instead of just silently
using a probably incorrect path.

diff --git a/configure b/configure
index 92a0b48..600fa96 100755
--- a/configure
+++ b/configure
@@ -3,6 +3,8 @@
 #
 INCLUDE=${1:-"$PWD/include"}
 
+TABLES=
+
 check_atm()
 {
 cat >/tmp/atmtest.c <<EOF
@@ -139,9 +141,28 @@ check_ipt()
 	if ! grep TC_CONFIG_XT Config > /dev/null
 	then
 		echo "using iptables"
+		TABLES="iptables"
+	else
+		TABLES="xtables"
 	fi
 }
 
+check_ipt_lib_dir()
+{
+	IPT_LIB_DIR=""
+	for dir in /lib /usr/lib /usr/local/lib
+	do
+		for file in $dir/$TABLES/lib*t_*so ; do
+			if [ -f $file ]; then
+				echo $dir/$TABLES
+				echo "IPT_LIB_DIR:=$dir/$TABLES" >> Config
+				return
+			fi
+		done
+	done
+	echo "not found!"
+}
+
 echo "# Generated config based on" $INCLUDE >Config
 
 echo "TC schedulers"
@@ -155,3 +176,5 @@ check_xt_old
 check_xt_old_internal_h
 check_ipt
 
+echo -n "iptables modules directory: "
+check_ipt_lib_dir
diff --git a/tc/Makefile b/tc/Makefile
index 0b5d7d3..6508ef3 100644
--- a/tc/Makefile
+++ b/tc/Makefile
@@ -77,6 +77,9 @@ TCLIB += tc_estimator.o
 TCLIB += tc_stab.o
 
 CFLAGS += -DCONFIG_GACT -DCONFIG_GACT_PROB
+ifneq ($(IPT_LIB_DIR),)
+	CFLAGS += -DIPT_LIB_DIR="$(IPT_LIB_DIR)"
+endif
 
 TCSO :=
 ifeq ($(TC_CONFIG_ATM),y)

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] iproute2: detect iptables modules dir in configure.
  2010-03-11 19:07 [PATCH] iproute2: detect iptables modules dir in configure Andreas Henriksson
@ 2010-03-11 20:47 ` Andreas Henriksson
  2010-03-11 20:54 ` [PATCH v2] " Andreas Henriksson
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Henriksson @ 2010-03-11 20:47 UTC (permalink / raw)
  To: shemminger; +Cc: netdev

On tor, 2010-03-11 at 20:07 +0100, Andreas Henriksson wrote:
[...]
> --- a/tc/Makefile
> +++ b/tc/Makefile
> @@ -77,6 +77,9 @@ TCLIB += tc_estimator.o
>  TCLIB += tc_stab.o
>  
>  CFLAGS += -DCONFIG_GACT -DCONFIG_GACT_PROB
> +ifneq ($(IPT_LIB_DIR),)
> +	CFLAGS += -DIPT_LIB_DIR="$(IPT_LIB_DIR)"
> +endif
>  

Sorry, I missed to escape the "'s above. I'll send a v2 in a few
seconds.



-- 
Regards,
Andreas Henriksson

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2] iproute2: detect iptables modules dir in configure.
  2010-03-11 19:07 [PATCH] iproute2: detect iptables modules dir in configure Andreas Henriksson
  2010-03-11 20:47 ` Andreas Henriksson
@ 2010-03-11 20:54 ` Andreas Henriksson
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Henriksson @ 2010-03-11 20:54 UTC (permalink / raw)
  To: shemminger; +Cc: netdev

Try to automatically detect iptables modules directory.

Make the configure script look for iptables modules.
This also makes it possible to specify it on the
command line while building via "make IPT_LIB_DIR=/foo/bar".

Signed-off-by: Andreas Henriksson <andreas@fatal.se>

---

Possibly the ifndef check in include/iptables.h
should be turned into an #error to force the person
building to manually specify it instead of just silently
using a probably incorrect path.

This is version 2 of the patch,
in v1 the escaping of the "'s in tc/Makefile was forgotten.


diff --git a/configure b/configure
index 92a0b48..600fa96 100755
--- a/configure
+++ b/configure
@@ -3,6 +3,8 @@
 #
 INCLUDE=${1:-"$PWD/include"}
 
+TABLES=
+
 check_atm()
 {
 cat >/tmp/atmtest.c <<EOF
@@ -139,9 +141,28 @@ check_ipt()
 	if ! grep TC_CONFIG_XT Config > /dev/null
 	then
 		echo "using iptables"
+		TABLES="iptables"
+	else
+		TABLES="xtables"
 	fi
 }
 
+check_ipt_lib_dir()
+{
+	IPT_LIB_DIR=""
+	for dir in /lib /usr/lib /usr/local/lib
+	do
+		for file in $dir/$TABLES/lib*t_*so ; do
+			if [ -f $file ]; then
+				echo $dir/$TABLES
+				echo "IPT_LIB_DIR:=$dir/$TABLES" >> Config
+				return
+			fi
+		done
+	done
+	echo "not found!"
+}
+
 echo "# Generated config based on" $INCLUDE >Config
 
 echo "TC schedulers"
@@ -155,3 +176,5 @@ check_xt_old
 check_xt_old_internal_h
 check_ipt
 
+echo -n "iptables modules directory: "
+check_ipt_lib_dir
diff --git a/tc/Makefile b/tc/Makefile
index 0b5d7d3..805c108 100644
--- a/tc/Makefile
+++ b/tc/Makefile
@@ -77,6 +77,9 @@ TCLIB += tc_estimator.o
 TCLIB += tc_stab.o
 
 CFLAGS += -DCONFIG_GACT -DCONFIG_GACT_PROB
+ifneq ($(IPT_LIB_DIR),)
+	CFLAGS += -DIPT_LIB_DIR=\"$(IPT_LIB_DIR)\"
+endif
 
 TCSO :=
 ifeq ($(TC_CONFIG_ATM),y)

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-03-11 21:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-11 19:07 [PATCH] iproute2: detect iptables modules dir in configure Andreas Henriksson
2010-03-11 20:47 ` Andreas Henriksson
2010-03-11 20:54 ` [PATCH v2] " Andreas Henriksson

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).