[PATCH 2/2] build: move copy of linux headers to private directory

Thomas Haller thaller at redhat.com
Tue Sep 23 22:49:34 PDT 2014


libnl3 contains a private copy of some kernel header files.

Normally, users are be expected to install libnl and specify
-I$PREFIX/include/libnl3 as include path. As the private kernel
header files are not installed, this works fine.

However, it can be convenient to build against the libnl source
directory, without installing libnl. In this case, the private kernel
header files shaddow the system provided ones. This is undesired.

Move these files to a different directory to avoid this clash.

http://lists.infradead.org/pipermail/libnl/2014-September/001645.html

Signed-off-by: Thomas Haller <thaller at redhat.com>
---
 include/Makefile.am                                | 62 +++++++++++-----------
 include/{ => linux-private}/linux/can/netlink.h    |  0
 include/{ => linux-private}/linux/fib_rules.h      |  0
 include/{ => linux-private}/linux/gen_stats.h      |  0
 include/{ => linux-private}/linux/genetlink.h      |  0
 include/{ => linux-private}/linux/if.h             |  0
 include/{ => linux-private}/linux/if_addr.h        |  0
 include/{ => linux-private}/linux/if_arp.h         |  0
 include/{ => linux-private}/linux/if_bridge.h      |  0
 include/{ => linux-private}/linux/if_ether.h       |  0
 include/{ => linux-private}/linux/if_link.h        |  0
 include/{ => linux-private}/linux/if_tunnel.h      |  0
 include/{ => linux-private}/linux/if_vlan.h        |  0
 include/{ => linux-private}/linux/ip.h             |  0
 include/{ => linux-private}/linux/ip_mp_alg.h      |  0
 include/{ => linux-private}/linux/ipv6.h           |  0
 include/{ => linux-private}/linux/neighbour.h      |  0
 include/{ => linux-private}/linux/netfilter.h      |  0
 .../linux/netfilter/nf_conntrack_common.h          |  0
 .../linux/netfilter/nfnetlink.h                    |  0
 .../linux/netfilter/nfnetlink_compat.h             |  0
 .../linux/netfilter/nfnetlink_conntrack.h          |  0
 .../linux/netfilter/nfnetlink_log.h                |  0
 .../linux/netfilter/nfnetlink_queue.h              |  0
 include/{ => linux-private}/linux/netlink.h        |  0
 include/{ => linux-private}/linux/pkt_cls.h        |  0
 include/{ => linux-private}/linux/pkt_sched.h      |  0
 include/{ => linux-private}/linux/rtnetlink.h      |  0
 include/{ => linux-private}/linux/snmp.h           |  0
 .../{ => linux-private}/linux/tc_act/tc_mirred.h   |  0
 .../linux/tc_ematch/tc_em_meta.h                   |  0
 include/{ => linux-private}/linux/veth.h           |  0
 include/{ => linux-private}/linux/xfrm.h           |  0
 lib/Makefile.am                                    |  1 +
 src/Makefile.am                                    |  1 +
 src/lib/Makefile.am                                |  1 +
 tests/Makefile.am                                  |  1 +
 37 files changed, 35 insertions(+), 31 deletions(-)
 rename include/{ => linux-private}/linux/can/netlink.h (100%)
 rename include/{ => linux-private}/linux/fib_rules.h (100%)
 rename include/{ => linux-private}/linux/gen_stats.h (100%)
 rename include/{ => linux-private}/linux/genetlink.h (100%)
 rename include/{ => linux-private}/linux/if.h (100%)
 rename include/{ => linux-private}/linux/if_addr.h (100%)
 rename include/{ => linux-private}/linux/if_arp.h (100%)
 rename include/{ => linux-private}/linux/if_bridge.h (100%)
 rename include/{ => linux-private}/linux/if_ether.h (100%)
 rename include/{ => linux-private}/linux/if_link.h (100%)
 rename include/{ => linux-private}/linux/if_tunnel.h (100%)
 rename include/{ => linux-private}/linux/if_vlan.h (100%)
 rename include/{ => linux-private}/linux/ip.h (100%)
 rename include/{ => linux-private}/linux/ip_mp_alg.h (100%)
 rename include/{ => linux-private}/linux/ipv6.h (100%)
 rename include/{ => linux-private}/linux/neighbour.h (100%)
 rename include/{ => linux-private}/linux/netfilter.h (100%)
 rename include/{ => linux-private}/linux/netfilter/nf_conntrack_common.h (100%)
 rename include/{ => linux-private}/linux/netfilter/nfnetlink.h (100%)
 rename include/{ => linux-private}/linux/netfilter/nfnetlink_compat.h (100%)
 rename include/{ => linux-private}/linux/netfilter/nfnetlink_conntrack.h (100%)
 rename include/{ => linux-private}/linux/netfilter/nfnetlink_log.h (100%)
 rename include/{ => linux-private}/linux/netfilter/nfnetlink_queue.h (100%)
 rename include/{ => linux-private}/linux/netlink.h (100%)
 rename include/{ => linux-private}/linux/pkt_cls.h (100%)
 rename include/{ => linux-private}/linux/pkt_sched.h (100%)
 rename include/{ => linux-private}/linux/rtnetlink.h (100%)
 rename include/{ => linux-private}/linux/snmp.h (100%)
 rename include/{ => linux-private}/linux/tc_act/tc_mirred.h (100%)
 rename include/{ => linux-private}/linux/tc_ematch/tc_em_meta.h (100%)
 rename include/{ => linux-private}/linux/veth.h (100%)
 rename include/{ => linux-private}/linux/xfrm.h (100%)

diff --git a/include/Makefile.am b/include/Makefile.am
index 74bbd5a..82684a1 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -120,37 +120,37 @@ nobase_libnlinclude_HEADERS += \
 endif
 
 noinst_HEADERS = \
-	linux/fib_rules.h \
-	linux/genetlink.h \
-	linux/gen_stats.h \
-	linux/if_addr.h \
-	linux/if_arp.h \
-	linux/if_ether.h \
-	linux/if.h \
-	linux/if_bridge.h \
-	linux/if_link.h \
-	linux/if_tunnel.h \
-	linux/if_vlan.h \
-	linux/ip.h \
-	linux/ip_mp_alg.h \
-	linux/ipv6.h \
-	linux/can/netlink.h \
-	linux/neighbour.h \
-	linux/netfilter.h \
-	linux/netfilter/nf_conntrack_common.h \
-	linux/netfilter/nfnetlink_compat.h \
-	linux/netfilter/nfnetlink_conntrack.h \
-	linux/netfilter/nfnetlink.h \
-	linux/netfilter/nfnetlink_log.h \
-	linux/netfilter/nfnetlink_queue.h \
-	linux/netlink.h \
-	linux/pkt_cls.h \
-	linux/tc_act/tc_mirred.h \
-	linux/pkt_sched.h \
-	linux/rtnetlink.h \
-	linux/snmp.h \
-	linux/xfrm.h \
-	linux/tc_ematch/tc_em_meta.h \
+	linux-private/linux/fib_rules.h \
+	linux-private/linux/genetlink.h \
+	linux-private/linux/gen_stats.h \
+	linux-private/linux/if_addr.h \
+	linux-private/linux/if_arp.h \
+	linux-private/linux/if_ether.h \
+	linux-private/linux/if.h \
+	linux-private/linux/if_bridge.h \
+	linux-private/linux/if_link.h \
+	linux-private/linux/if_tunnel.h \
+	linux-private/linux/if_vlan.h \
+	linux-private/linux/ip.h \
+	linux-private/linux/ip_mp_alg.h \
+	linux-private/linux/ipv6.h \
+	linux-private/linux/can/netlink.h \
+	linux-private/linux/neighbour.h \
+	linux-private/linux/netfilter.h \
+	linux-private/linux/netfilter/nf_conntrack_common.h \
+	linux-private/linux/netfilter/nfnetlink_compat.h \
+	linux-private/linux/netfilter/nfnetlink_conntrack.h \
+	linux-private/linux/netfilter/nfnetlink.h \
+	linux-private/linux/netfilter/nfnetlink_log.h \
+	linux-private/linux/netfilter/nfnetlink_queue.h \
+	linux-private/linux/netlink.h \
+	linux-private/linux/pkt_cls.h \
+	linux-private/linux/tc_act/tc_mirred.h \
+	linux-private/linux/pkt_sched.h \
+	linux-private/linux/rtnetlink.h \
+	linux-private/linux/snmp.h \
+	linux-private/linux/xfrm.h \
+	linux-private/linux/tc_ematch/tc_em_meta.h \
 	netlink-private/genl.h \
 	netlink-private/netlink.h \
 	netlink-private/socket.h \
diff --git a/include/linux/can/netlink.h b/include/linux-private/linux/can/netlink.h
similarity index 100%
rename from include/linux/can/netlink.h
rename to include/linux-private/linux/can/netlink.h
diff --git a/include/linux/fib_rules.h b/include/linux-private/linux/fib_rules.h
similarity index 100%
rename from include/linux/fib_rules.h
rename to include/linux-private/linux/fib_rules.h
diff --git a/include/linux/gen_stats.h b/include/linux-private/linux/gen_stats.h
similarity index 100%
rename from include/linux/gen_stats.h
rename to include/linux-private/linux/gen_stats.h
diff --git a/include/linux/genetlink.h b/include/linux-private/linux/genetlink.h
similarity index 100%
rename from include/linux/genetlink.h
rename to include/linux-private/linux/genetlink.h
diff --git a/include/linux/if.h b/include/linux-private/linux/if.h
similarity index 100%
rename from include/linux/if.h
rename to include/linux-private/linux/if.h
diff --git a/include/linux/if_addr.h b/include/linux-private/linux/if_addr.h
similarity index 100%
rename from include/linux/if_addr.h
rename to include/linux-private/linux/if_addr.h
diff --git a/include/linux/if_arp.h b/include/linux-private/linux/if_arp.h
similarity index 100%
rename from include/linux/if_arp.h
rename to include/linux-private/linux/if_arp.h
diff --git a/include/linux/if_bridge.h b/include/linux-private/linux/if_bridge.h
similarity index 100%
rename from include/linux/if_bridge.h
rename to include/linux-private/linux/if_bridge.h
diff --git a/include/linux/if_ether.h b/include/linux-private/linux/if_ether.h
similarity index 100%
rename from include/linux/if_ether.h
rename to include/linux-private/linux/if_ether.h
diff --git a/include/linux/if_link.h b/include/linux-private/linux/if_link.h
similarity index 100%
rename from include/linux/if_link.h
rename to include/linux-private/linux/if_link.h
diff --git a/include/linux/if_tunnel.h b/include/linux-private/linux/if_tunnel.h
similarity index 100%
rename from include/linux/if_tunnel.h
rename to include/linux-private/linux/if_tunnel.h
diff --git a/include/linux/if_vlan.h b/include/linux-private/linux/if_vlan.h
similarity index 100%
rename from include/linux/if_vlan.h
rename to include/linux-private/linux/if_vlan.h
diff --git a/include/linux/ip.h b/include/linux-private/linux/ip.h
similarity index 100%
rename from include/linux/ip.h
rename to include/linux-private/linux/ip.h
diff --git a/include/linux/ip_mp_alg.h b/include/linux-private/linux/ip_mp_alg.h
similarity index 100%
rename from include/linux/ip_mp_alg.h
rename to include/linux-private/linux/ip_mp_alg.h
diff --git a/include/linux/ipv6.h b/include/linux-private/linux/ipv6.h
similarity index 100%
rename from include/linux/ipv6.h
rename to include/linux-private/linux/ipv6.h
diff --git a/include/linux/neighbour.h b/include/linux-private/linux/neighbour.h
similarity index 100%
rename from include/linux/neighbour.h
rename to include/linux-private/linux/neighbour.h
diff --git a/include/linux/netfilter.h b/include/linux-private/linux/netfilter.h
similarity index 100%
rename from include/linux/netfilter.h
rename to include/linux-private/linux/netfilter.h
diff --git a/include/linux/netfilter/nf_conntrack_common.h b/include/linux-private/linux/netfilter/nf_conntrack_common.h
similarity index 100%
rename from include/linux/netfilter/nf_conntrack_common.h
rename to include/linux-private/linux/netfilter/nf_conntrack_common.h
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux-private/linux/netfilter/nfnetlink.h
similarity index 100%
rename from include/linux/netfilter/nfnetlink.h
rename to include/linux-private/linux/netfilter/nfnetlink.h
diff --git a/include/linux/netfilter/nfnetlink_compat.h b/include/linux-private/linux/netfilter/nfnetlink_compat.h
similarity index 100%
rename from include/linux/netfilter/nfnetlink_compat.h
rename to include/linux-private/linux/netfilter/nfnetlink_compat.h
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux-private/linux/netfilter/nfnetlink_conntrack.h
similarity index 100%
rename from include/linux/netfilter/nfnetlink_conntrack.h
rename to include/linux-private/linux/netfilter/nfnetlink_conntrack.h
diff --git a/include/linux/netfilter/nfnetlink_log.h b/include/linux-private/linux/netfilter/nfnetlink_log.h
similarity index 100%
rename from include/linux/netfilter/nfnetlink_log.h
rename to include/linux-private/linux/netfilter/nfnetlink_log.h
diff --git a/include/linux/netfilter/nfnetlink_queue.h b/include/linux-private/linux/netfilter/nfnetlink_queue.h
similarity index 100%
rename from include/linux/netfilter/nfnetlink_queue.h
rename to include/linux-private/linux/netfilter/nfnetlink_queue.h
diff --git a/include/linux/netlink.h b/include/linux-private/linux/netlink.h
similarity index 100%
rename from include/linux/netlink.h
rename to include/linux-private/linux/netlink.h
diff --git a/include/linux/pkt_cls.h b/include/linux-private/linux/pkt_cls.h
similarity index 100%
rename from include/linux/pkt_cls.h
rename to include/linux-private/linux/pkt_cls.h
diff --git a/include/linux/pkt_sched.h b/include/linux-private/linux/pkt_sched.h
similarity index 100%
rename from include/linux/pkt_sched.h
rename to include/linux-private/linux/pkt_sched.h
diff --git a/include/linux/rtnetlink.h b/include/linux-private/linux/rtnetlink.h
similarity index 100%
rename from include/linux/rtnetlink.h
rename to include/linux-private/linux/rtnetlink.h
diff --git a/include/linux/snmp.h b/include/linux-private/linux/snmp.h
similarity index 100%
rename from include/linux/snmp.h
rename to include/linux-private/linux/snmp.h
diff --git a/include/linux/tc_act/tc_mirred.h b/include/linux-private/linux/tc_act/tc_mirred.h
similarity index 100%
rename from include/linux/tc_act/tc_mirred.h
rename to include/linux-private/linux/tc_act/tc_mirred.h
diff --git a/include/linux/tc_ematch/tc_em_meta.h b/include/linux-private/linux/tc_ematch/tc_em_meta.h
similarity index 100%
rename from include/linux/tc_ematch/tc_em_meta.h
rename to include/linux-private/linux/tc_ematch/tc_em_meta.h
diff --git a/include/linux/veth.h b/include/linux-private/linux/veth.h
similarity index 100%
rename from include/linux/veth.h
rename to include/linux-private/linux/veth.h
diff --git a/include/linux/xfrm.h b/include/linux-private/linux/xfrm.h
similarity index 100%
rename from include/linux/xfrm.h
rename to include/linux-private/linux/xfrm.h
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 2567323..f7e5a93 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -2,6 +2,7 @@
 
 AM_CPPFLAGS  =			 	\
 	-Wall \
+	-I${top_srcdir}/include/linux-private \
 	-I${top_srcdir}/include \
 	-I${top_builddir}/include \
 	-I${builddir}/route \
diff --git a/src/Makefile.am b/src/Makefile.am
index ea4bf45..624046f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,6 +3,7 @@
 SUBDIRS = lib
 
 AM_CPPFLAGS  = \
+	-I${top_srcdir}/include/linux-private \
 	-I${top_srcdir}/include \
 	-I${top_builddir}/include \
 	-D_GNU_SOURCE \
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index 4b9b4a9..27c74fd 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -1,6 +1,7 @@
 # -*- Makefile -*-
 
 AM_CPPFLAGS  = \
+	-I${top_srcdir}/include/linux-private \
 	-I${top_srcdir}/include \
 	-I${top_builddir}/include \
 	-D_GNU_SOURCE \
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c016bb8..8d1da59 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -7,6 +7,7 @@ if ENABLE_UNIT_TESTS
 
 AM_CPPFLAGS = \
 	-Wall \
+	-I${top_srcdir}/include/linux-private \
 	-I${top_srcdir}/include \
 	-I${top_builddir}/include \
 	-D_GNU_SOURCE \
-- 
1.9.3




More information about the libnl mailing list