libnm: allow opt-out of including system headers in <NetworkManager.h>
In public libnm headers we include some libc/linux headers, although libnm doesn't strictly need them. The <linux/*.h> headers conflict with some network headers provided by libc and they need to be included in the right order. As <NetworkManager.h> drags in some linux headers, this makes it unnecessarily complicated. It also feels ugly to include headers we don't need, only for the sake of convenience. Allow to opt out. Also, for internal build, don't do this. When building NetworkManager we need control about the headers and their order of inclusion.
This commit is contained in:
@@ -11,7 +11,6 @@
|
||||
#endif
|
||||
|
||||
#include "nm-setting.h"
|
||||
#include <linux/if_vlan.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
@@ -12,12 +12,6 @@
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
/* For ETH_ALEN and INFINIBAND_ALEN */
|
||||
#include <linux/if_ether.h>
|
||||
#include <linux/if_infiniband.h>
|
||||
|
||||
#include "nm-core-enum-types.h"
|
||||
#include "nm-setting-sriov.h"
|
||||
#include "nm-setting-tc-config.h"
|
||||
|
@@ -115,6 +115,17 @@
|
||||
|
||||
#include "nm-autoptr.h"
|
||||
|
||||
#if !defined(NETWORKMANAGER_COMPILATION) \
|
||||
&& (!defined(NM_NO_INCLUDE_EXTRA_HEADERS) || !NM_NO_INCLUDE_EXTRA_HEADERS)
|
||||
/* historically, NetworkManager.h drags in the following system headers.
|
||||
* These are not strictly necessary and the user may wish to opt out from
|
||||
* including them. */
|
||||
#include <linux/if_ether.h>
|
||||
#include <linux/if_infiniband.h>
|
||||
#include <linux/if_vlan.h>
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#undef __NETWORKMANAGER_H_INSIDE__
|
||||
|
||||
#endif /* __NETWORKMANAGER_H__ */
|
||||
|
Reference in New Issue
Block a user