Skip to contentSkip to conversation

iptables and NO_SHARED_LIBS/dlfcn.h

PATCH Applied Mike Frysinger 4 participants 5 messages Dec 19, 2007 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iptables and NO_SHARED_LIBS/dlfcn.h

if NO_SHARED_LIBS is defined, then iptables shouldnt even include dlfcn.h. otherwise you hit a build failure when using toolchains that do not provide dlfcn.h because they do not support shared objects.

---
i'd file a bug on the netfilter bugzilla, but looks like the system is hosed ...

iptables-save.c +4 -1
Index: iptables-save.c
===================================================================
@@ -11,12 +11,15 @@
 #include <fcntl.h>
 #include <stdlib.h>
 #include <string.h>
-#include <dlfcn.h>
 #include <time.h>
 #include <netdb.h>
 #include "libiptc/libiptc.h"
 #include "iptables.h"
 
+#ifndef NO_SHARED_LIBS
+#include <dlfcn.h>
+#endif
+
 static int binary = 0, counters = 0;
 
 static struct option options[] = {
xtables.c +4 -1
Index: xtables.c
===================================================================
@@ -16,7 +16,6 @@
  *	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <dlfcn.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <netdb.h>
@@ -31,6 +30,10 @@
 
 #include <xtables.h>
 
+#ifndef NO_SHARED_LIBS
+#include <dlfcn.h>
+#endif
+
 #define NPROTO	255
 
 #ifndef PROC_SYS_MODPROBE
ip6tables-save.c +4 -1
Index: ip6tables-save.c
===================================================================
@@ -11,13 +11,16 @@
 #include <fcntl.h>
 #include <stdlib.h>
 #include <string.h>
-#include <dlfcn.h>
 #include <time.h>
 #include <netdb.h>
 #include <arpa/inet.h>
 #include "libiptc/libip6tc.h"
 #include "ip6tables.h"
 
+#ifndef NO_SHARED_LIBS
+#include <dlfcn.h>
+#endif
+
 static int binary = 0, counters = 0;
 
 static struct option options[] = {
#1 lore raw
Quoted 5 lines · Mike Frysinger

if NO_SHARED_LIBS is defined, then iptables shouldnt even include dlfcn.h. otherwise you hit a build failure when using toolchains that do not provide dlfcn.h because they do not support shared objects.

Ideally such things would be done by autotools. Patch still floating :)

#2 lore raw
Quoted 7 lines · Jan Engelhardt
Quoted 4 lines · Mike Frysinger

if NO_SHARED_LIBS is defined, then iptables shouldnt even include dlfcn.h. otherwise you hit a build failure when using toolchains that do not provide dlfcn.h because they do not support shared objects.

Ideally such things would be done by autotools. Patch still floating :)

i agree 100%, but i work with what i've got, and what i've got is svn trunk which is still just a Makefile ;)
-mike

#3 lore raw
In reply to Mike Frysinger
Quoted 3 lines · Mike Frysinger

if NO_SHARED_LIBS is defined, then iptables shouldnt even include dlfcn.h. otherwise you hit a build failure when using toolchains that do not provide dlfcn.h because they do not support shared objects.

Applied, thanks. With some luck Pablo hasn't started preparing the 1.4.0 release yet :)

#4 lore raw
Quoted 7 lines · Patrick McHardy
Quoted 3 lines · Mike Frysinger

if NO_SHARED_LIBS is defined, then iptables shouldnt even include dlfcn.h. otherwise you hit a build failure when using toolchains that do not provide dlfcn.h because they do not support shared objects.

Applied, thanks. With some luck Pablo hasn't started preparing the 1.4.0 release yet :)

I didn't yet, I'll probably do tomorrow or friday. I forgot that this week is plenty of checkpoint exams :(