[PATCH] do not compile some address families when not available

Cong Wang xiyou.wangcong at gmail.com
Fri Nov 8 14:32:13 EST 2013


This fixes the following error while compiling libnl3 on CentOS5:

addr.c:1027: error: 'AF_RDS' undeclared here (not in a function)
addr.c:1033: error: 'AF_CAN' undeclared here (not in a function)
addr.c:1034: error: 'AF_TIPC' undeclared here (not in a function)
addr.c:1036: error: 'AF_IUCV' undeclared here (not in a function)
addr.c:1037: error: 'AF_RXRPC' undeclared here (not in a function)
addr.c:1038: error: 'AF_ISDN' undeclared here (not in a function)
addr.c:1039: error: 'AF_PHONET' undeclared here (not in a function)
make[2]: *** [addr.lo] Error 1

Signed-off-by: Cong Wang <xiyou.wangcong at gmail.com>
---
 lib/addr.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/lib/addr.c b/lib/addr.c
index 86e7e58..54d2b1d 100644
--- a/lib/addr.c
+++ b/lib/addr.c
@@ -1024,19 +1024,33 @@ static const struct trans_tbl afs[] = {
 	__ADD(AF_ASH,ash)
 	__ADD(AF_ECONET,econet)
 	__ADD(AF_ATMSVC,atmsvc)
+#ifdef AF_RDS
 	__ADD(AF_RDS,rds)
+#endif
 	__ADD(AF_SNA,sna)
 	__ADD(AF_IRDA,irda)
 	__ADD(AF_PPPOX,pppox)
 	__ADD(AF_WANPIPE,wanpipe)
 	__ADD(AF_LLC,llc)
+#ifdef AF_CAN
 	__ADD(AF_CAN,can)
+#endif
+#ifdef AF_TIPC
 	__ADD(AF_TIPC,tipc)
+#endif
 	__ADD(AF_BLUETOOTH,bluetooth)
+#ifdef AF_IUCV
 	__ADD(AF_IUCV,iucv)
+#endif
+#ifdef AF_RXRPC
 	__ADD(AF_RXRPC,rxrpc)
+#endif
+#ifdef AF_ISDN
 	__ADD(AF_ISDN,isdn)
+#endif
+#ifdef AF_PHONET
 	__ADD(AF_PHONET,phonet)
+#endif
 #ifdef AF_IEEE802154
 	__ADD(AF_IEEE802154,ieee802154)
 #endif
-- 
1.7.11.7




More information about the libnl mailing list