systemd/build: use separate NETWORKMANAGER_COMPILATION define for systemd build

This commit is contained in:
Thomas Haller 2015-09-16 15:49:02 +02:00
parent c05557971c
commit 3ba1c8e297
4 changed files with 34 additions and 25 deletions

View file

@ -27,6 +27,7 @@
#define NM_NETWORKMANAGER_COMPILATION_DEFAULT 0x0001
#define NM_NETWORKMANAGER_COMPILATION_INSIDE_DAEMON 0x0002
#define NM_NETWORKMANAGER_COMPILATION_LIB 0x0004
#define NM_NETWORKMANAGER_COMPILATION_SYSTEMD 0x0008
#ifndef NETWORKMANAGER_COMPILATION
/* For convenience, we don't require our Makefile.am to define
@ -57,7 +58,7 @@
/*****************************************************************************/
#if (NETWORKMANAGER_COMPILATION) == NM_NETWORKMANAGER_COMPILATION_INSIDE_DAEMON
#if (NETWORKMANAGER_COMPILATION) == NM_NETWORKMANAGER_COMPILATION_INSIDE_DAEMON || (NETWORKMANAGER_COMPILATION) == NM_NETWORKMANAGER_COMPILATION_SYSTEMD
/* the header is used inside src/, where additional
* headers are available. */

View file

@ -62,8 +62,7 @@ SYSTEMD_NM_CFLAGS = \
-I$(top_srcdir)/src/systemd/src/shared \
-I$(top_srcdir)/src/systemd \
-I$(top_srcdir)/libnm-core \
-I$(top_builddir)/libnm-core \
-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_INSIDE_DAEMON
-I$(top_builddir)/libnm-core
libsystemd_nm_la_SOURCES = \
systemd/nm-sd-adapt.c \
@ -135,6 +134,7 @@ libsystemd_nm_la_SOURCES = \
libsystemd_nm_la_CPPFLAGS = \
-I$(top_srcdir)/include \
$(SYSTEMD_NM_CFLAGS) \
-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_SYSTEMD \
$(GLIB_CFLAGS)
libsystemd_nm_la_LIBADD = \

View file

@ -35,8 +35,6 @@
#include "NetworkManagerUtils.h"
#include "nm-platform.h"
#include "nm-sd-adapt.h"
#include "sd-dhcp-client.h"
#include "sd-dhcp6-client.h"
#include "dhcp-protocol.h"

View file

@ -13,7 +13,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright (C) 2014 Red Hat, Inc.
* Copyright (C) 2014 - 2015 Red Hat, Inc.
*/
#ifndef NM_SD_ADAPT_H
@ -21,30 +21,13 @@
#include "config.h"
#include <glib.h>
#include <netinet/in.h>
#include <stdbool.h>
#include <syslog.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <elf.h>
#ifdef HAVE_SYS_AUXV_H
#include <sys/auxv.h>
#endif
#include <unistd.h>
#include <sys/syscall.h>
#include <net/if_arp.h>
#include <sys/resource.h>
#include "nm-default.h"
/* Missing in Linux 3.2.0, in Ubuntu 12.04 */
#ifndef BPF_XOR
#define BPF_XOR 0xa0
#endif
#define noreturn G_GNUC_NORETURN
/*****************************************************************************/
@ -92,6 +75,32 @@ G_STMT_START { \
(void) 0; \
})
/*****************************************************************************
* The remainder of the header is only enabled when building the systemd code
* itself.
*****************************************************************************/
#if (NETWORKMANAGER_COMPILATION) == NM_NETWORKMANAGER_COMPILATION_SYSTEMD
#include <netinet/in.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <elf.h>
#ifdef HAVE_SYS_AUXV_H
#include <sys/auxv.h>
#endif
#include <unistd.h>
#include <sys/syscall.h>
#include <net/if_arp.h>
/* Missing in Linux 3.2.0, in Ubuntu 12.04 */
#ifndef BPF_XOR
#define BPF_XOR 0xa0
#endif
/*****************************************************************************/
/* Can't include both net/if.h and linux/if.h; so have to define this here */
@ -103,7 +112,6 @@ G_STMT_START { \
#define MAX_HANDLE_SZ 128
#endif
#define noreturn G_GNUC_NORETURN
/*
* Some toolchains (E.G. uClibc 0.9.33 and earlier) don't export
@ -123,5 +131,7 @@ static inline pid_t gettid(void) {
return (pid_t) syscall(SYS_gettid);
}
#endif /* (NETWORKMANAGER_COMPILATION) == NM_NETWORKMANAGER_COMPILATION_SYSTEMD */
#endif /* NM_SD_ADAPT_H */