2020-12-23 21:21:36 +00:00
# SPDX-License-Identifier: LGPL-2.1-or-later
2020-01-14 09:42:24 +00:00
2017-11-25 10:39:06 +00:00
project (
'NetworkManager' , 'c' ,
2018-01-23 11:24:29 +00:00
# NOTE: When incrementing version also:
2018-01-16 15:08:13 +00:00
# - add corresponding NM_VERSION_x_y_z macros in
2021-02-24 08:02:49 +00:00
# "src/libnm-core-public/nm-version-macros.h.in"
2018-01-16 15:08:13 +00:00
# - update number in configure.ac
2023-11-01 17:24:55 +00:00
version : '1.45.6' ,
2017-11-25 10:39:06 +00:00
license : 'GPL2+' ,
default_options : [
'buildtype=debugoptimized' ,
2019-02-09 06:10:02 +00:00
'c_std=gnu11' ,
2017-11-25 10:39:06 +00:00
] ,
build/meson: bump minimal required meson version
The build for 0.46.0 probably isn't working anymore. Also, I'd like to
use dictionaries, which might not be available in such old meson
versions.
Anyway, it's not a problem. We in general aim to build on ancient
distros, like CentOS-7.5 and Ubuntu-16.04. But on those systems we
install meson using `pip3 install` anyway, where we get a recent meson
version.
Note that on Ubuntu 16.04, `pip3 install meson` would currently give us
meson 0.54.2. However, that meson requires a newer Python 3 version than
we have available. Hence, on Ubuntu 16.04 we actually want to install
`pip3 install meson==0.53.2`. See commit 5feba97cd186 ('gitlab-ci: use
old meson version on Ubuntu 16.04 to work with ninja-1.5.1').
We also still build on Fedora 28, which installs meson 0.47.2 from
packaging system. So, let's stick to 0.47.2 for now.
2020-05-28 12:51:11 +00:00
meson_version : '>= 0.47.2' ,
2017-11-25 10:39:06 +00:00
)
nm_name = meson . project_name ( )
nm_version = meson . project_version ( )
version_array = nm_version . split ( '.' )
nm_major_version = version_array [ 0 ] . to_int ( )
nm_minor_version = version_array [ 1 ] . to_int ( )
nm_micro_version = version_array [ 2 ] . to_int ( )
nm_id_prefix = 'NM'
nm_gir_version = '1.0'
2018-03-18 19:38:49 +00:00
# Distribution version string
dist_version = get_option ( 'dist_version' )
if dist_version == ''
dist_version = nm_version
endif
2017-11-25 10:39:06 +00:00
nm_prefix = get_option ( 'prefix' )
nm_bindir = join_paths ( nm_prefix , get_option ( 'bindir' ) )
nm_datadir = join_paths ( nm_prefix , get_option ( 'datadir' ) )
nm_includedir = join_paths ( nm_prefix , get_option ( 'includedir' ) )
nm_libdir = join_paths ( nm_prefix , get_option ( 'libdir' ) )
nm_libexecdir = join_paths ( nm_prefix , get_option ( 'libexecdir' ) )
nm_localedir = join_paths ( nm_prefix , get_option ( 'localedir' ) )
nm_localstatedir = join_paths ( nm_prefix , get_option ( 'localstatedir' ) )
nm_mandir = join_paths ( nm_prefix , get_option ( 'mandir' ) )
nm_runstatedir = join_paths ( nm_localstatedir , 'run' )
nm_sbindir = join_paths ( nm_prefix , get_option ( 'sbindir' ) )
nm_sysconfdir = join_paths ( nm_prefix , get_option ( 'sysconfdir' ) )
nm_pkgsbindir = join_paths ( nm_sbindir , nm_name )
nm_pkgconfdir = join_paths ( nm_sysconfdir , nm_name )
nm_pkgdatadir = join_paths ( nm_datadir , nm_name )
nm_pkgincludedir = join_paths ( nm_includedir , nm_name )
2018-03-18 20:19:41 +00:00
nm_pkglibdir = join_paths ( nm_prefix , 'lib' , nm_name )
2017-11-25 10:39:06 +00:00
nm_pkgrundir = join_paths ( nm_runstatedir , nm_name )
2018-09-11 12:58:56 +00:00
nm_pkgstatedir = join_paths ( nm_localstatedir , 'lib' , nm_name )
2018-03-18 19:38:49 +00:00
nm_vpndir = join_paths ( nm_libdir , nm_name )
nm_plugindir = join_paths ( nm_libdir , nm_name , dist_version )
2017-11-25 10:39:06 +00:00
2021-01-27 15:27:11 +00:00
introspection_extra_cflags = [
'-Wno-incompatible-pointer-types-discards-qualifiers' ,
]
introspection: avoid compiler warning in generated introspection files
Disable "-Wincompatible-pointer-types-discards-qualifiers" warning, as
this breaks build of the gdbus-codegen files.
With glib2-2.67.0-1.fc34.x86_64.rpm, clang-11.0.0-2.fc34.x86_64.rpm, we
get a failure to build generated code:
introspection/org.freedesktop.NetworkManager.AccessPoint.c:438:1: error: passing 'typeof (*(&g_define_type_id__volatile)) *' (aka 'volatile unsigned long *') to parameter of type 'gsize *' (aka 'unsigned long *') discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
G_DEFINE_INTERFACE (NMDBusAccessPoint, nmdbus_access_point, G_TYPE_OBJECT)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/glib-2.0/gobject/gtype.h:1784:47: note: expanded from macro 'G_DEFINE_INTERFACE'
#define G_DEFINE_INTERFACE(TN, t_n, T_P) G_DEFINE_INTERFACE_WITH_CODE(TN, t_n, T_P, ;)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/glib-2.0/gobject/gtype.h:1803:61: note: expanded from macro 'G_DEFINE_INTERFACE_WITH_CODE'
#define G_DEFINE_INTERFACE_WITH_CODE(TN, t_n, T_P, _C_) _G_DEFINE_INTERFACE_EXTENDED_BEGIN(TN, t_n, T_P) {_C_;} _G_DEFINE_INTERFACE_EXTENDED_END()
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/glib-2.0/gobject/gtype.h:2042:7: note: expanded from macro '_G_DEFINE_INTERFACE_EXTENDED_BEGIN'
if (g_once_init_enter (&g_define_type_id__volatile)) \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/glib-2.0/glib/gthread.h:260:7: note: expanded from macro 'g_once_init_enter'
(!g_atomic_pointer_get (location) && \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/glib-2.0/glib/gatomic.h:112:38: note: expanded from macro 'g_atomic_pointer_get'
__atomic_load (gapg_temp_atomic, &gapg_temp_newval, __ATOMIC_SEQ_CST); \
^~~~~~~~~~~~~~~~~
introspection/org.freedesktop.NetworkManager.AccessPoint.c:944:1: error: passing 'typeof (*(&g_define_type_id__volatile)) *' (aka 'volatile unsigned long *') to parameter of type 'gsize *' (aka 'unsigned long *') discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
G_DEFINE_TYPE_WITH_CODE (NMDBusAccessPointProxy, nmdbus_access_point_proxy, G_TYPE_DBUS_PROXY,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/glib-2.0/gobject/gtype.h:1615:56: note: expanded from macro 'G_DEFINE_TYPE_WITH_CODE'
#define G_DEFINE_TYPE_WITH_CODE(TN, t_n, T_P, _C_) _G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, 0) {_C_;} _G_DEFINE_TYPE_EXTENDED_END()
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/glib-2.0/gobject/gtype.h:2032:3: note: expanded from macro '_G_DEFINE_TYPE_EXTENDED_BEGIN'
_G_DEFINE_TYPE_EXTENDED_BEGIN_REGISTER(TypeName, type_name, TYPE_PARENT, flags) \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/glib-2.0/gobject/gtype.h:2000:7: note: expanded from macro '_G_DEFINE_TYPE_EXTENDED_BEGIN_REGISTER'
if (g_once_init_enter (&g_define_type_id__volatile)) \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/glib-2.0/glib/gthread.h:260:7: note: expanded from macro 'g_once_init_enter'
(!g_atomic_pointer_get (location) && \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/glib-2.0/glib/gatomic.h:112:38: note: expanded from macro 'g_atomic_pointer_get'
__atomic_load (gapg_temp_atomic, &gapg_temp_newval, __ATOMIC_SEQ_CST); \
^~~~~~~~~~~~~~~~~
introspection/org.freedesktop.NetworkManager.AccessPoint.c:1729:1: error: passing 'typeof (*(&g_define_type_id__volatile)) *' (aka 'volatile unsigned long *') to parameter of type 'gsize *' (aka 'unsigned long *') discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
G_DEFINE_TYPE_WITH_CODE (NMDBusAccessPointSkeleton, nmdbus_access_point_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/glib-2.0/gobject/gtype.h:1615:56: note: expanded from macro 'G_DEFINE_TYPE_WITH_CODE'
#define G_DEFINE_TYPE_WITH_CODE(TN, t_n, T_P, _C_) _G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, 0) {_C_;} _G_DEFINE_TYPE_EXTENDED_END()
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/glib-2.0/gobject/gtype.h:2032:3: note: expanded from macro '_G_DEFINE_TYPE_EXTENDED_BEGIN'
_G_DEFINE_TYPE_EXTENDED_BEGIN_REGISTER(TypeName, type_name, TYPE_PARENT, flags) \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/glib-2.0/gobject/gtype.h:2000:7: note: expanded from macro '_G_DEFINE_TYPE_EXTENDED_BEGIN_REGISTER'
if (g_once_init_enter (&g_define_type_id__volatile)) \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/glib-2.0/glib/gthread.h:260:7: note: expanded from macro 'g_once_init_enter'
(!g_atomic_pointer_get (location) && \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/glib-2.0/glib/gatomic.h:112:38: note: expanded from macro 'g_atomic_pointer_get'
__atomic_load (gapg_temp_atomic, &gapg_temp_newval, __ATOMIC_SEQ_CST); \
^~~~~~~~~~~~~~~~~
(cherry picked from commit 03d9ec27face7f54e15f6fe6532c59f8b66bb6b4)
2020-11-02 08:12:10 +00:00
2018-01-09 07:05:15 +00:00
libnm_name = 'libnm'
2017-11-25 10:39:06 +00:00
current = 1
revision = 0
age = 1
libnm_version = '@0@.@1@.@2@' . format ( current - age , age , revision )
2018-01-09 07:05:15 +00:00
libnm_pkgincludedir = join_paths ( nm_includedir , libnm_name )
2019-08-28 09:44:05 +00:00
gnome = import ( 'gnome' )
i18n = import ( 'i18n' )
pkg = import ( 'pkgconfig' )
2019-08-28 09:54:11 +00:00
source_root = meson . current_source_dir ( )
build_root = meson . current_build_dir ( )
2019-08-28 09:44:05 +00:00
po_dir = join_paths ( meson . source_root ( ) , 'po' )
top_inc = include_directories ( '.' )
perl = find_program ( 'perl' )
xsltproc = find_program ( 'xsltproc' )
2019-08-28 09:54:11 +00:00
check_exports = find_program ( join_paths ( source_root , 'tools' , 'check-exports.sh' ) )
2019-08-28 09:44:05 +00:00
2017-11-25 10:39:06 +00:00
cc = meson . get_compiler ( 'c' )
config_h = configuration_data ( )
# defines
set_defines = [
[ 'GETTEXT_PACKAGE' , nm_name ] ,
[ 'PACKAGE_STRING' , '@0@ @1@' . format ( nm_name , nm_version ) ] ,
2018-10-18 10:50:20 +00:00
[ 'VERSION' , nm_version ] ,
2017-11-25 10:39:06 +00:00
]
meson: increase "default_test_timeout" to 3 minutes
Obviously, it would be nice if our unit tests are fast. However, with
valgrind and a busy machine, some of the tests can take a relatively
long time. In particular those, that are marked as "slow" (if you want
to skip them during development, do so via "NMTST_DEBUG=quick"
environment, or "CFLAGS=-DNMTST_TEST_QUICK=TRUE", see
"nm-test-utils.h").
Anyway. Our tests almost never hit the timeout, and if they do, the most
likely reason is that something was just slower then expected, and the
timeout is a bogus error.
Timeouts only act as last fail safe. It more important to avoid a false
(premature) timeout failure, than to minimize the wait time when the
test really hangs. Because a real hang is a bug anyway, that we will
discover and need to fix.
Increase the default test timeout for meson tests to 3 minutes.
Also, "test-route-linux" is known to take a long time. Increase that
timeout even further.
(cherry picked from commit 9ee42c0979d3889655a4394129c41133f7651b49)
2023-01-20 07:12:51 +00:00
default_test_timeout = 180
2019-02-22 07:38:54 +00:00
2017-11-25 10:39:06 +00:00
foreach define : set_defines
config_h . set_quoted ( define [ 0 ] , define [ 1 ] )
endforeach
# headers
config_h . set10 ( 'HAVE_SYS_AUXV_H' , cc . has_header ( 'sys/auxv.h' ) )
2023-06-26 14:54:28 +00:00
config_h . set10 ( 'HAVE_THREADS_H' , cc . has_header ( 'threads.h' ) )
2017-11-25 10:39:06 +00:00
2018-04-04 13:44:05 +00:00
use_sys_random = cc . has_function ( 'getrandom' , prefix : '#include <sys/random.h>' )
2017-11-25 10:39:06 +00:00
config_h . set10 ( 'USE_SYS_RANDOM_H' , use_sys_random )
2018-04-04 13:44:05 +00:00
config_h . set10 ( 'HAVE_GETRANDOM' , use_sys_random or cc . has_function ( 'getrandom' , prefix : '#include <linux/random.h>' ) )
2017-11-25 10:39:06 +00:00
2019-12-15 13:28:45 +00:00
config_h . set10 ( 'HAVE_PIDFD_OPEN' , cc . has_function ( 'pidfd_open' , prefix : '' ' #include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <sys/wait.h>'''))
config_h . set10 ( 'HAVE_PIDFD_SEND_SIGNAL' , cc . has_function ( 'pidfd_send_signal' , prefix : '' ' #include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <sys/wait.h>'''))
config_h . set10 ( 'HAVE_RT_SIGQUEUEINFO' , cc . has_function ( 'rt_sigqueueinfo' , prefix : '' ' #include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <sys/wait.h>'''))
2017-11-25 10:39:06 +00:00
config_h . set ( 'HAVE_SECURE_GETENV' , cc . has_function ( 'secure_getenv' ) )
config_h . set ( 'HAVE___SECURE_GETENV' , cc . has_function ( '__secure_getenv' ) )
2020-12-10 10:58:32 +00:00
config_h . set10 ( 'HAVE_DECL_REALLOCARRAY' , cc . has_function ( 'reallocarray' , prefix : '' ' #include <malloc.h>
#include <stdlib.h>'''))
2018-04-04 13:44:05 +00:00
config_h . set10 ( 'HAVE_DECL_EXPLICIT_BZERO' , cc . has_function ( 'explicit_bzero' , prefix : '#include <string.h>' ) )
2018-09-11 14:06:25 +00:00
config_h . set10 ( 'HAVE_DECL_MEMFD_CREATE' , cc . has_function ( 'memfd_create' , prefix : '#include <sys/mman.h>' ) )
2017-11-25 10:39:06 +00:00
# types
2019-07-05 07:11:40 +00:00
config_h . set ( 'SIZEOF_PID_T' , cc . sizeof ( 'pid_t' , prefix : '#include <sys/types.h>' ) )
config_h . set ( 'SIZEOF_UID_T' , cc . sizeof ( 'uid_t' , prefix : '#include <sys/types.h>' ) )
config_h . set ( 'SIZEOF_GID_T' , cc . sizeof ( 'gid_t' , prefix : '#include <sys/types.h>' ) )
config_h . set ( 'SIZEOF_DEV_T' , cc . sizeof ( 'dev_t' , prefix : '#include <sys/types.h>' ) )
config_h . set ( 'SIZEOF_INO_T' , cc . sizeof ( 'ino_t' , prefix : '#include <sys/types.h>' ) )
config_h . set ( 'SIZEOF_TIME_T' , cc . sizeof ( 'time_t' , prefix : '#include <sys/time.h>' ) )
config_h . set ( 'SIZEOF_RLIM_T' , cc . sizeof ( 'rlim_t' , prefix : '#include <sys/resource.h>' ) )
2017-11-25 10:39:06 +00:00
# compiler flags
common_flags = [ ]
common_ldflags = [ ]
enable_ld_gc = get_option ( 'ld_gc' )
if enable_ld_gc
2019-09-11 09:10:08 +00:00
test_c_flags = [
2017-11-25 10:39:06 +00:00
'-fdata-sections' ,
'-ffunction-sections' ,
]
test_ldflags = [ '-Wl,--gc-sections' ]
2019-12-19 08:25:02 +00:00
foreach cflag : test_c_flags
2017-11-25 10:39:06 +00:00
assert ( cc . has_argument ( cflag ) , 'Unused symbol eviction requested but not supported. Use -Dld_gc=false to build without it.' )
endforeach
2019-12-19 08:25:02 +00:00
foreach ldflag : test_ldflags
assert ( cc . has_link_argument ( ldflag ) , 'Linker garbage collection requested but not supported. Use -Dld_gc=false to build without it.' )
endforeach
2019-09-11 09:10:08 +00:00
common_flags + = test_c_flags
2017-11-25 10:39:06 +00:00
common_ldflags + = test_ldflags
endif
2019-02-02 14:57:01 +00:00
enable_lto = get_option ( 'b_lto' )
if enable_lto
# meson already adds '-flto'
lto_flag = '-flto-partition=none'
assert ( cc . has_argument ( lto_flag ) , '-flto-partition=none not supported. Disable link-time optimization with -Db_lto=false.' )
common_flags + = lto_flag
common_ldflags + = lto_flag
endif
2020-11-23 17:47:54 +00:00
common_flags + = cc . get_supported_arguments ( [
'-Wall' ,
'-Wextra' ,
2022-12-01 12:43:48 +00:00
'-Wcast-align=strict' ,
2020-11-23 17:47:54 +00:00
'-Wdeclaration-after-statement' ,
'-Wfloat-equal' ,
'-Wformat-nonliteral' ,
'-Wformat-security' ,
'-Wimplicit-function-declaration' ,
2022-11-03 09:16:10 +00:00
'-Wimplicit-int' ,
2020-11-23 17:47:54 +00:00
'-Winit-self' ,
2022-11-03 09:16:10 +00:00
'-Wint-conversion' ,
2020-11-23 17:47:54 +00:00
'-Wlogical-op' ,
'-Wmissing-declarations' ,
'-Wmissing-include-dirs' ,
'-Wmissing-prototypes' ,
2022-11-03 09:16:10 +00:00
'-Wold-style-definition' ,
2022-11-03 09:18:04 +00:00
'-Wparentheses-equality' ,
2020-11-23 17:47:54 +00:00
'-Wpointer-arith' ,
'-Wshadow' ,
'-Wshift-negative-value' ,
'-Wstrict-prototypes' ,
2022-11-03 09:18:04 +00:00
'-Wtypedef-redefinition' ,
2020-11-23 17:47:54 +00:00
'-Wundef' ,
2022-11-03 09:18:04 +00:00
'-Wunknown-attributes' ,
2020-11-23 17:47:54 +00:00
'-Wvla' ,
'-Wno-duplicate-decl-specifier' ,
'-Wno-format-truncation' ,
'-Wno-format-y2k' ,
'-Wno-gnu-variable-sized-type-not-at-end' ,
'-Wno-missing-field-initializers' ,
'-Wno-pragmas' ,
'-Wno-sign-compare' ,
'-Wno-tautological-constant-out-of-range-compare' ,
'-Wno-unknown-pragmas' ,
'-Wno-unused-parameter' ,
'-fno-strict-aliasing' ,
] )
if cc . has_argument ( '-Wimplicit-fallthrough' )
if cc . compiles ( '' '
int main ( int argc , char * * argv ) {
int r = 0 ;
switch ( argc ) {
case 0 :
r + + ;
/ * fall - through * /
case 1 :
r + + ;
break ;
}
return r ;
}
'' ' ,
args : '-Werror=implicit-fallthrough' ,
name : '-Werror=implicit-fallthrough' )
common_flags + = '-Wimplicit-fallthrough'
2020-02-21 12:22:23 +00:00
endif
2017-11-25 10:39:06 +00:00
endif
add_project_arguments ( common_flags , language : 'c' )
add_project_link_arguments ( common_ldflags , language : 'c' )
2019-08-28 09:54:11 +00:00
linker_script_binary = join_paths ( source_root , 'linker-script-binary.ver' )
linker_script_devices = join_paths ( source_root , 'linker-script-devices.ver' )
linker_script_settings = join_paths ( source_root , 'linker-script-settings.ver' )
2017-11-25 10:39:06 +00:00
2018-01-11 11:34:40 +00:00
ldflags_linker_script_binary = [ '-Wl,--version-script,@0@' . format ( linker_script_binary ) ]
ldflags_linker_script_devices = [ '-Wl,--version-script,@0@' . format ( linker_script_devices ) ]
ldflags_linker_script_settings = [ '-Wl,--version-script,@0@' . format ( linker_script_settings ) ]
2017-11-25 10:39:06 +00:00
uuid_dep = dependency ( 'uuid' )
libelogind_dep = dependency ( 'libelogind' , version : '>= 219' , required : false )
libudev_dep = dependency ( 'libudev' , version : '>= 175' )
dbus_dep = dependency ( 'dbus-1' , version : '>= 1.1' )
libndp_dep = dependency ( 'libndp' )
2020-07-01 21:39:53 +00:00
jansson_dep = dependency ( 'jansson' , version : '>= 2.7' , required : false )
2017-11-25 10:39:06 +00:00
config_h . set10 ( 'WITH_JANSSON' , jansson_dep . found ( ) )
libnm: always build libnm with JSON validation
We anyway load libjansson with dlopen(), and already before it could
happen that libjansson is not available. In that case, we would not
crash, but simply proceed without json validation.
Since libnm-core no longer uses libjansson directly, but only via
"nm-glib-aux/nm-json.h", we can just always compile with that, and use
it at runtime. That means, libjansson is not a build dependency for
libnm anymore, so we don't need a compile time check.
Note that if you build without libjansson, then JANSSON_SONAME is
undefined, and loading it will still fail at runtime. So, even if
we now always build with all our code enabled, it only works if you
actually build with libjansson. Still, it's simpler to drop the
conditional build, as the only benefit is a (minimally) smaller
build.
2020-07-01 16:38:22 +00:00
jansson_msg = 'no'
2017-12-26 08:28:54 +00:00
if jansson_dep . found ( )
jansson_libdir = jansson_dep . get_pkgconfig_variable ( 'libdir' )
2018-01-11 16:02:11 +00:00
res = run_command ( find_program ( 'eu-readelf' , 'readelf' ) , '-d' , join_paths ( jansson_libdir , 'libjansson.so' ) )
2017-12-26 08:28:54 +00:00
jansson_soname = ''
foreach line : res . stdout ( ) . split ( '\n' )
if line . strip ( ) . contains ( 'SONAME' )
jansson_soname = line . split ( '[' ) [ 1 ] . split ( ']' ) [ 0 ]
endif
endforeach
assert ( jansson_soname != '' , 'Unable to determine Jansson SONAME' )
config_h . set_quoted ( 'JANSSON_SONAME' , jansson_soname )
libnm: always build libnm with JSON validation
We anyway load libjansson with dlopen(), and already before it could
happen that libjansson is not available. In that case, we would not
crash, but simply proceed without json validation.
Since libnm-core no longer uses libjansson directly, but only via
"nm-glib-aux/nm-json.h", we can just always compile with that, and use
it at runtime. That means, libjansson is not a build dependency for
libnm anymore, so we don't need a compile time check.
Note that if you build without libjansson, then JANSSON_SONAME is
undefined, and loading it will still fail at runtime. So, even if
we now always build with all our code enabled, it only works if you
actually build with libjansson. Still, it's simpler to drop the
conditional build, as the only benefit is a (minimally) smaller
build.
2020-07-01 16:38:22 +00:00
jansson_msg = 'yes (soname: ' + jansson_soname + ')'
2017-12-26 08:28:54 +00:00
endif
2017-11-25 10:39:06 +00:00
libsystemd_dep = dependency ( 'libsystemd' , version : '>= 209' , required : false )
2018-08-26 18:42:03 +00:00
libsystemd_login_dep = dependency ( 'libsystemd-login' , version : '>= 183' , required : false )
2017-11-25 10:39:06 +00:00
config_h . set10 ( 'HAVE_LIBSYSTEMD' , libsystemd_dep . found ( ) )
systemd_dep = dependency ( 'systemd' , required : false )
have_systemd_200 = systemd_dep . found ( ) and systemd_dep . version ( ) . version_compare ( '>= 200' )
2018-02-16 12:01:12 +00:00
gio_unix_dep = dependency ( 'gio-unix-2.0' , version : '>= 2.40' )
2017-11-25 10:39:06 +00:00
glib_dep = declare_dependency (
dependencies : [
gio_unix_dep ,
2018-10-18 10:50:20 +00:00
dependency ( 'gmodule-2.0' ) ,
2017-11-25 10:39:06 +00:00
] ,
compile_args : [
2018-02-16 12:01:12 +00:00
'-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_40' ,
2018-10-18 10:50:20 +00:00
'-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_40' ,
2017-11-25 10:39:06 +00:00
]
)
2022-07-22 11:04:52 +00:00
enable_ifcfg_rh = get_option ( 'ifcfg_rh' )
2017-11-25 10:39:06 +00:00
2023-07-24 12:20:04 +00:00
config_migrate_ifcfg_rh_default = get_option ( 'config_migrate_ifcfg_rh_default' ) . to_string ( )
if config_migrate_ifcfg_rh_default == 'true'
assert ( enable_ifcfg_rh , 'ifcfg-rh migration can be enabled by default only when the ifcfg-rh plugin is enabled' )
endif
config_h . set_quoted ( 'NM_CONFIG_DEFAULT_MAIN_MIGRATE_IFCFG_RH' , config_migrate_ifcfg_rh_default )
2022-07-22 11:04:52 +00:00
enable_ifupdown = get_option ( 'ifupdown' )
if enable_ifupdown == 'auto'
enable_ifupdown = ( run_command ( 'test' , '-e' , '/etc/debian_version' ) . returncode ( ) == 0 )
else
enable_ifupdown = ( enable_ifupdown != 'false' )
endif
2017-11-25 10:39:06 +00:00
config_plugins_default = get_option ( 'config_plugins_default' )
config_h . set_quoted ( 'NM_CONFIG_DEFAULT_MAIN_PLUGINS' , config_plugins_default )
2022-02-22 15:58:46 +00:00
config_h . set10 ( 'WITH_CONFIG_PLUGIN_IFCFG_RH' , enable_ifcfg_rh )
config_h . set10 ( 'WITH_CONFIG_PLUGIN_IFUPDOWN' , enable_ifupdown )
2018-03-18 19:38:49 +00:00
config_h . set_quoted ( 'NM_DIST_VERSION' , dist_version )
2017-11-25 10:39:06 +00:00
enable_wifi = get_option ( 'wifi' )
enable_iwd = get_option ( 'iwd' )
2019-08-28 20:31:29 +00:00
assert ( ( not enable_iwd ) or enable_wifi , 'Enabling iwd support requires Wi-Fi support as well' )
2017-11-25 10:39:06 +00:00
config_h . set10 ( 'WITH_IWD' , enable_iwd )
enable_wext = get_option ( 'wext' )
config_h . set10 ( 'HAVE_WEXT' , enable_wext )
# Checks for libdl - on certain platforms its part of libc
dl_dep = cc . find_library ( 'dl' )
'' '
dl_deps = [ ]
dl_dep = cc . find_library ( 'dl' )
if dl_dep . found ( ) and cc . has_function ( 'dlopen' )
dl_deps + = dl_dep
else
dl_dep = dependency ( 'dl' , required : false )
if dl_dep . found ( ) and cc . has_function ( 'dlopen' , dependencies : dl_dep )
dl_deps + = dl_dep
else
dld_dep = dependency ( 'dld' , required : false )
if dld_dep . found ( ) and cc . has_function ( 'dlopen' , dependencies : dld_dep )
dl_deps + = dld_dep
endif
endif
endif
'' '
# introspection support
enable_introspection = get_option ( 'introspection' )
if enable_introspection
gir_dep = dependency ( 'gobject-introspection-1.0' , version : '>= 0.9.6' , required : false )
assert ( gir_dep . found ( ) , 'introspection support was requested, but the gobject-introspection library is not available. Use -Dintrospection=false to build without it.' )
endif
2019-08-29 06:09:09 +00:00
udev_udevdir = get_option ( 'udev_dir' )
2022-05-11 08:27:35 +00:00
if udev_udevdir == 'no'
install_udevdir = false
else
install_udevdir = true
if ( udev_udevdir == '' or udev_udevdir == 'yes' )
udev_udevdir = join_paths ( nm_prefix , 'lib/udev' )
endif
assert ( udev_udevdir . startswith ( '/' ) , 'udev_dir must be an absolute path, but is ' + udev_udevdir )
2017-11-25 10:39:06 +00:00
endif
2019-08-29 06:09:09 +00:00
systemd_systemdsystemunitdir = get_option ( 'systemdsystemunitdir' )
install_systemdunitdir = ( systemd_systemdsystemunitdir != 'no' )
2017-11-25 10:39:06 +00:00
2019-08-29 06:09:09 +00:00
if install_systemdunitdir and systemd_systemdsystemunitdir == ''
2017-11-25 10:39:06 +00:00
assert ( systemd_dep . found ( ) , 'systemd required but not found, please provide a valid systemd user unit dir or disable it' )
2022-05-11 13:23:25 +00:00
systemd_systemdsystemunitdir = systemd_dep . get_pkgconfig_variable ( 'systemdsystemunitdir' , define_variable : [ 'rootprefix' , nm_prefix ] )
2017-11-25 10:39:06 +00:00
endif
enable_systemd_journal = get_option ( 'systemd_journal' )
if enable_systemd_journal
assert ( libsystemd_dep . found ( ) , 'Missing systemd-journald support' )
endif
config_h . set10 ( 'SYSTEMD_JOURNAL' , enable_systemd_journal )
config_logging_backend_default = get_option ( 'config_logging_backend_default' )
if config_logging_backend_default == 'default'
config_logging_backend_default = ( enable_systemd_journal ? 'journal' : 'syslog' )
endif
config_h . set_quoted ( 'NM_CONFIG_DEFAULT_LOGGING_BACKEND' , config_logging_backend_default )
2021-12-03 01:34:10 +00:00
config_wifi_backend_default = get_option ( 'config_wifi_backend_default' )
if config_wifi_backend_default == 'default'
config_wifi_backend_default = 'wpa_supplicant'
elif config_wifi_backend_default == 'iwd'
assert ( enable_iwd , 'Setting the default Wi-Fi backend to iwd requires iwd support.' )
endif
config_h . set_quoted ( 'NM_CONFIG_DEFAULT_WIFI_BACKEND' , config_wifi_backend_default )
2017-11-25 10:39:06 +00:00
session_tracking = get_option ( 'session_tracking' )
session_trackers = [ ]
2018-08-26 18:14:35 +00:00
if session_tracking == 'systemd'
logind_dep = libsystemd_dep
if not logind_dep . found ( )
logind_dep = dependency ( 'libsystemd-login' , required : false )
assert ( logind_dep . found ( ) , 'You must have libsystemd or libsystemd-login installed to build with systemd-logind support' )
2017-11-25 10:39:06 +00:00
endif
2018-08-26 18:14:35 +00:00
session_trackers + = 'systemd-logind'
config_h . set10 ( 'SESSION_TRACKING_SYSTEMD' , true )
config_h . set10 ( 'SESSION_TRACKING_ELOGIND' , false )
elif session_tracking == 'elogind'
logind_dep = libelogind_dep
assert ( logind_dep . found ( ) and libelogind_dep . version ( ) . version_compare ( '>= 229' ) , 'You must have libelogind installed to build with elogind support.' )
session_trackers + = 'elogind'
config_h . set10 ( 'SESSION_TRACKING_SYSTEMD' , false )
config_h . set10 ( 'SESSION_TRACKING_ELOGIND' , true )
else
2019-02-05 08:48:21 +00:00
config_h . set10 ( 'SESSION_TRACKING_SYSTEMD' , false )
config_h . set10 ( 'SESSION_TRACKING_ELOGIND' , false )
2018-08-26 18:14:35 +00:00
logind_dep = dependency ( '' , required : false )
endif
2017-11-25 10:39:06 +00:00
2018-08-26 18:14:35 +00:00
session_tracking_consolekit = get_option ( 'session_tracking_consolekit' )
if session_tracking_consolekit
session_trackers + = 'consolekit'
2017-11-25 10:39:06 +00:00
endif
2018-08-26 18:14:35 +00:00
config_h . set10 ( 'SESSION_TRACKING_CONSOLEKIT' , session_tracking_consolekit )
2017-11-25 10:39:06 +00:00
hostname_persist = get_option ( 'hostname_persist' )
config_h . set ( 'HOSTNAME_PERSIST_SUSE' , ( hostname_persist == 'suse' ) )
config_h . set ( 'HOSTNAME_PERSIST_GENTOO' , ( hostname_persist == 'gentoo' ) )
config_h . set ( 'HOSTNAME_PERSIST_SLACKWARE' , ( hostname_persist == 'slackware' ) )
2018-08-26 18:42:03 +00:00
suspend_resume = get_option ( 'suspend_resume' )
2017-11-25 10:39:06 +00:00
2018-08-26 18:42:03 +00:00
if suspend_resume == 'auto'
if libsystemd_dep . found ( ) or libsystemd_login_dep . found ( )
suspend_resume = 'systemd'
elif libelogind_dep . found ( )
suspend_resume = 'elogind'
elif session_tracking_consolekit
suspend_resume = 'consolekit'
else
suspend_resume = 'upower'
endif
endif
if suspend_resume == 'systemd'
2017-11-25 10:39:06 +00:00
if libsystemd_dep . found ( )
system_inhibit_dep = libsystemd_dep
2018-08-26 18:42:03 +00:00
elif libsystemd_login_dep . found ( )
system_inhibit_dep = libsystemd_login_dep
2017-11-25 10:39:06 +00:00
else
2018-08-26 18:42:03 +00:00
error ( 'Need libsystemd for suspend_resume=systemd' )
2017-11-25 10:39:06 +00:00
endif
2018-08-26 18:42:03 +00:00
config_h . set ( 'SUSPEND_RESUME_SYSTEMD' , true )
elif suspend_resume == 'elogind'
assert ( libelogind_dep . found ( ) , 'Need libelogind for suspend_resume=elogind' )
system_inhibit_dep = libelogind_dep
config_h . set ( 'SUSPEND_RESUME_ELOGIND' , true )
elif suspend_resume == 'consolekit'
config_h . set ( 'SUSPEND_RESUME_CONSOLEKIT' , true )
elif suspend_resume == 'upower'
config_h . set ( 'SUSPEND_RESUME_UPOWER' , true )
else
error ( 'bug' )
2017-11-25 10:39:06 +00:00
endif
# SELinux support
enable_selinux = get_option ( 'selinux' )
if enable_selinux
selinux_dep = dependency ( 'libselinux' , required : false )
assert ( selinux_dep . found ( ) , 'You must have libselinux installed to build. Use -Dselinux=false to disable it' )
endif
config_h . set10 ( 'HAVE_SELINUX' , enable_selinux )
2018-09-19 14:38:38 +00:00
# eBPF support
ebpf_opt = get_option ( 'ebpf' )
2019-04-09 15:24:59 +00:00
# 'auto' means 'false', because there are still issues.
if ebpf_opt != 'true'
2018-09-19 14:38:38 +00:00
enable_ebpf = false
else
enable_ebpf = true
if not cc . has_header ( 'linux/bpf.h' )
assert ( ebpf_opt != 'true' , 'eBPF requires kernel support' )
enable_ebpf = false
endif
endif
2017-11-25 10:39:06 +00:00
# libaudit support
libaudit = get_option ( 'libaudit' )
enable_libaudit = libaudit . contains ( 'yes' )
if enable_libaudit
libaudit_dep = dependency ( 'audit' , required : false )
2018-12-13 19:49:14 +00:00
assert ( libaudit_dep . found ( ) , 'You must have libaudit installed to build. Use -Dlibaudit=no to disable it' )
2017-11-25 10:39:06 +00:00
endif
config_default_logging_audit = ( libaudit == 'yes' ) . to_string ( )
config_h . set_quoted ( 'NM_CONFIG_DEFAULT_LOGGING_AUDIT' , config_default_logging_audit )
config_h . set10 ( 'HAVE_LIBAUDIT' , enable_libaudit )
# Teamd control checks
enable_teamdctl = get_option ( 'teamdctl' )
if enable_teamdctl
assert ( jansson_dep . found ( ) , 'You must have jansson installed to build. Use -Dteamdctl=false to disable it' )
libteamdctl_dep = dependency ( 'libteamdctl' , version : '>= 1.9' )
assert ( libteamdctl_dep . found ( ) , 'You must have libteamdctl installed to build. Use -Dteamdctl=false to disable it' )
endif
# polkit
2018-10-16 05:31:56 +00:00
enable_polkit = get_option ( 'polkit' )
2017-11-25 10:39:06 +00:00
if enable_polkit
2018-10-12 07:59:25 +00:00
# FIXME: policydir should be relative to `datadir`, not `prefix`. Fixed in https://gitlab.freedesktop.org/polkit/polkit/merge_requests/2
2019-08-29 06:09:09 +00:00
polkit_gobject_policydir = dependency ( 'polkit-gobject-1' ) . get_pkgconfig_variable ( 'policydir' , define_variable : [ 'prefix' , nm_prefix ] )
2017-11-25 10:39:06 +00:00
endif
2019-12-10 09:01:24 +00:00
config_auth_polkit_default = get_option ( 'config_auth_polkit_default' )
if config_auth_polkit_default == 'default'
config_auth_polkit_default = ( enable_polkit ? 'true' : 'false' )
endif
config_h . set_quoted ( 'NM_CONFIG_DEFAULT_MAIN_AUTH_POLKIT' , config_auth_polkit_default )
2017-11-25 10:39:06 +00:00
enable_modify_system = get_option ( 'modify_system' )
2021-02-16 20:33:30 +00:00
polkit_agent_helper_1_path = get_option ( 'polkit_agent_helper_1' )
2021-02-12 09:17:41 +00:00
foreach p : [ '/usr/libexec/polkit-agent-helper-1' ,
'/usr/lib/polkit-1/polkit-agent-helper-1' ,
'/usr/lib/policykit-1/polkit-agent-helper-1' ]
if polkit_agent_helper_1_path == '' and run_command ( 'test' , '-f' , p ) . returncode ( ) == 0
polkit_agent_helper_1_path = p
endif
endforeach
if polkit_agent_helper_1_path == ''
polkit_agent_helper_1_path = '/usr/lib/polkit-1/polkit-agent-helper-1'
2017-11-25 10:39:06 +00:00
endif
2021-02-16 20:33:30 +00:00
if polkit_agent_helper_1_path [ 0 ] != '/'
error ( 'polkit_agent_helper_1 must be an absolute path, but is ' + polkit_agent_helper_1_path )
endif
2021-02-12 09:17:41 +00:00
config_h . set_quoted ( 'POLKIT_AGENT_HELPER_1_PATH' , polkit_agent_helper_1_path )
2017-11-25 10:39:06 +00:00
2021-02-17 15:03:23 +00:00
crypto_nss_dep = dependency (
'nss' ,
required : false ,
)
crypto_gnutls_dep = dependency (
'gnutls' ,
version : '>= 2.12' ,
required : false ,
)
2017-11-25 10:39:06 +00:00
crypto = get_option ( 'crypto' )
if crypto == 'nss'
2021-02-17 15:03:23 +00:00
assert ( crypto_nss_dep . found ( ) , 'Requires nss crypto support' )
crypto_dep = crypto_nss_dep
2022-01-31 13:42:21 +00:00
elif crypto == 'gnutls'
2021-02-17 15:03:23 +00:00
assert ( crypto_gnutls_dep . found ( ) , 'Requires gnutls crypto support' )
crypto_dep = crypto_gnutls_dep
2022-01-31 13:42:21 +00:00
else
assert ( crypto == 'null' , 'Unexpected setting "crypto=' + crypto + '"' )
2017-11-25 10:39:06 +00:00
endif
dbus_conf_dir = get_option ( 'dbus_conf_dir' )
if dbus_conf_dir == ''
assert ( dbus_dep . found ( ) , 'D-Bus required but not found, please provide a valid system bus config dir' )
2022-05-13 13:36:42 +00:00
dbus_conf_dir = join_paths ( dbus_dep . get_pkgconfig_variable ( 'datarootdir' , define_variable : [ 'prefix' , nm_prefix ] ) , 'dbus-1' , 'system.d' )
2017-11-25 10:39:06 +00:00
endif
2019-08-29 06:09:09 +00:00
dbus_interfaces_dir = dbus_dep . get_pkgconfig_variable ( 'interfaces_dir' , define_variable : [ 'datadir' , nm_datadir ] )
dbus_system_bus_services_dir = dbus_dep . get_pkgconfig_variable ( 'system_bus_services_dir' , define_variable : [ 'datadir' , nm_datadir ] )
2017-11-25 10:39:06 +00:00
2020-05-08 07:09:25 +00:00
enable_firewalld_zone = get_option ( 'firewalld_zone' )
config_h . set10 ( 'WITH_FIREWALLD_ZONE' , enable_firewalld_zone )
2017-11-25 10:39:06 +00:00
# pppd
enable_ppp = get_option ( 'ppp' )
ppp: detect the ppp version in the configure script
Previously, the ppp version was only detected (and used) at one place,
in "nm-pppd-compat.c", after including the ppp headers. That was nice
and easy.
However, with that way, we could only detect it after including ppp
headers, and given the ugliness of ppp headers, we only want to include
them in "nm-pppd-compat.c" (and nowhere else).
In particular, 'nm-pppd-compat.c" uses symbols from the ppp daemon, it
thus can only be linked into a ppp plugin, not in NetworkManager core
itself. But at some places we will need to know the ppp version, outside
of the ppp plugin and "nm-pppd-compat.c".
Additionally, detect it at configure time and place it in "config.h".
There is a static assert that we are in agreement with the two ways of
detection.
2023-06-14 12:14:31 +00:00
NM_PPP_VERSION_2_5_OR_NEWER = 0
2017-11-25 10:39:06 +00:00
if enable_ppp
2023-03-04 22:26:00 +00:00
pppd_dep = dependency ( 'pppd' , required : false )
if ( pppd_dep . found ( ) )
pppd_version = pppd_dep . version ( )
ppp: detect the ppp version in the configure script
Previously, the ppp version was only detected (and used) at one place,
in "nm-pppd-compat.c", after including the ppp headers. That was nice
and easy.
However, with that way, we could only detect it after including ppp
headers, and given the ugliness of ppp headers, we only want to include
them in "nm-pppd-compat.c" (and nowhere else).
In particular, 'nm-pppd-compat.c" uses symbols from the ppp daemon, it
thus can only be linked into a ppp plugin, not in NetworkManager core
itself. But at some places we will need to know the ppp version, outside
of the ppp plugin and "nm-pppd-compat.c".
Additionally, detect it at configure time and place it in "config.h".
There is a static assert that we are in agreement with the two ways of
detection.
2023-06-14 12:14:31 +00:00
NM_PPP_VERSION_2_5_OR_NEWER = 1
2023-03-04 22:26:00 +00:00
else
2023-04-16 13:31:54 +00:00
assert ( cc . has_header ( 'pppd/pppd.h' ) , 'couldn\'t find pppd.h. pppd development headers are required' )
2023-03-04 22:26:00 +00:00
pppd_version = '2.4.9'
endif
2018-09-07 14:52:59 +00:00
pppd_path = get_option ( 'pppd' )
if pppd_path == ''
pppd = find_program ( 'pppd' , '/sbin/pppd' , '/usr/sbin/pppd' , required : false )
assert ( pppd . found ( ) , 'pppd required but not found, please provide a valid pppd path or use -Dppp=false to disable it' )
pppd_path = pppd . path ( )
endif
2017-11-25 10:39:06 +00:00
2018-09-07 14:52:59 +00:00
config_h . set_quoted ( 'PPPD_PATH' , pppd_path )
2018-07-05 18:15:56 +00:00
2017-11-25 10:39:06 +00:00
pppd_plugin_dir = get_option ( 'pppd_plugin_dir' )
if pppd_plugin_dir == ''
2023-03-04 22:26:00 +00:00
pppd_plugin_dir = join_paths ( nm_libdir , 'pppd' , pppd_version )
2017-11-25 10:39:06 +00:00
endif
endif
config_h . set10 ( 'WITH_PPP' , enable_ppp )
ppp: detect the ppp version in the configure script
Previously, the ppp version was only detected (and used) at one place,
in "nm-pppd-compat.c", after including the ppp headers. That was nice
and easy.
However, with that way, we could only detect it after including ppp
headers, and given the ugliness of ppp headers, we only want to include
them in "nm-pppd-compat.c" (and nowhere else).
In particular, 'nm-pppd-compat.c" uses symbols from the ppp daemon, it
thus can only be linked into a ppp plugin, not in NetworkManager core
itself. But at some places we will need to know the ppp version, outside
of the ppp plugin and "nm-pppd-compat.c".
Additionally, detect it at configure time and place it in "config.h".
There is a static assert that we are in agreement with the two ways of
detection.
2023-06-14 12:14:31 +00:00
config_h . set10 ( 'NM_PPP_VERSION_2_5_OR_NEWER' , NM_PPP_VERSION_2_5_OR_NEWER )
2017-11-25 10:39:06 +00:00
# ModemManager1 with libmm-glib
enable_modem_manager = get_option ( 'modem_manager' )
if enable_modem_manager
mm_glib_dep = dependency ( 'mm-glib' , version : '>= 0.7.991' )
2019-03-18 14:01:38 +00:00
2023-01-27 21:38:42 +00:00
mobile_broadband_provider_info_database = get_option ( 'mobile_broadband_provider_info_database' )
if mobile_broadband_provider_info_database == ''
mobile_broadband_provider_info_database = dependency ( 'mobile-broadband-provider-info' ) . get_pkgconfig_variable ( 'database' )
endif
2019-08-29 06:09:09 +00:00
config_h . set_quoted ( 'MOBILE_BROADBAND_PROVIDER_INFO_DATABASE' , mobile_broadband_provider_info_database )
2017-11-25 10:39:06 +00:00
endif
# Bluez5 DUN support
enable_bluez5_dun = get_option ( 'bluez5_dun' )
if enable_bluez5_dun
bluez5_dep = dependency ( 'bluez' , version : '>= 5' , required : false )
assert ( bluez5_dep . found ( ) , 'Bluez 5.x development headers are required' )
2021-01-28 07:57:23 +00:00
else
bluez5_dep = declare_dependency ( )
2017-11-25 10:39:06 +00:00
endif
config_h . set10 ( 'WITH_BLUEZ5_DUN' , enable_bluez5_dun )
# OFONO
enable_ofono = get_option ( 'ofono' )
config_h . set10 ( 'WITH_OFONO' , enable_ofono )
# DHCP client support
config_dhcp_default = get_option ( 'config_dhcp_default' )
config_h . set_quoted ( 'NM_CONFIG_DEFAULT_MAIN_DHCP' , config_dhcp_default )
2018-09-07 15:02:59 +00:00
dhcp_summary = ''
foreach client : [ 'dhclient' , 'dhcpcd' , 'dhcpcanon' ]
client_path = get_option ( client )
client_enable = ( client_path != 'no' )
if client_enable
if client_path == ''
client_prog = find_program ( client ,
'/sbin/' + client ,
'/usr/sbin/pppd/' + client ,
'/usr/local/sbin/' + client ,
required : false )
if client_prog . found ( )
client_path = client_prog . path ( )
else
client_path = '/usr/sbin/' + client
message ( '@0@ not found, assume path @1@' . format ( client , client_path ) )
endif
endif
config_h . set_quoted ( client . to_upper ( ) + '_PATH' , client_path )
endif
if config_dhcp_default == client and not client_enable
error ( client + ' has not been enabled. Please don\'t disable it or use another configuration option for main.dhcp setting' )
endif
config_h . set10 ( 'WITH_' + client . to_upper ( ) , client_enable )
dhcp_summary + = ( ' ' + client + ': ' + client_enable . to_string ( ) )
if ( client_enable )
dhcp_summary + = ( ' ' + client_path )
endif
dhcp_summary + = '\n'
endforeach
2017-11-25 10:39:06 +00:00
2018-11-28 08:58:44 +00:00
# Open vSwitch integration
2017-11-25 10:39:06 +00:00
enable_ovs = get_option ( 'ovs' )
if enable_ovs
2018-11-28 08:58:44 +00:00
assert ( jansson_dep . found ( ) , 'jansson is needed for Open vSwitch integration. Use -Dovs=false to disable it' )
2017-11-25 10:39:06 +00:00
endif
2021-08-31 11:27:41 +00:00
config_h . set10 ( 'WITH_OPENVSWITCH' , enable_ovs )
2017-11-25 10:39:06 +00:00
2018-09-07 15:12:31 +00:00
# DNS resolv.conf managers
config_dns_rc_manager_default = get_option ( 'config_dns_rc_manager_default' )
config_h . set_quoted ( 'NM_CONFIG_DEFAULT_MAIN_RC_MANAGER' , config_dns_rc_manager_default )
resolv_conf_summary = ''
foreach prog_name : [ 'resolvconf' , 'netconfig' ]
prog_path = get_option ( prog_name )
prog_enable = ( prog_path != 'no' )
if prog_enable
if prog_path == ''
prog = find_program ( prog_name ,
'/usr/' + prog_name ,
'/usr/sbin/' + prog_name ,
2020-01-28 14:19:53 +00:00
'/usr/local/sbin/' + prog_name ,
2018-09-07 15:12:31 +00:00
required : false )
if prog . found ( )
prog_path = prog . path ( )
else
prog_enable = false
endif
endif
2017-11-25 10:39:06 +00:00
endif
2017-12-18 19:33:30 +00:00
2018-09-07 15:12:31 +00:00
if prog_enable
config_h . set_quoted ( prog_name . to_upper ( ) + '_PATH' , prog_path )
elif config_dns_rc_manager_default == prog_name
error ( prog_name + ' has not been enabled. Please don\'t disable it or use another configuration option for main.rc-manager setting' )
2017-12-18 19:33:30 +00:00
endif
2017-11-25 10:39:06 +00:00
2018-09-07 15:12:31 +00:00
resolv_conf_summary + = ' ' + prog_name + ': ' + prog_enable . to_string ( )
if prog_enable
resolv_conf_summary + = ' ' + prog_path
endif
resolv_conf_summary + = '\n'
endforeach
2017-11-25 10:39:06 +00:00
2018-09-07 14:52:09 +00:00
# external misc tools paths
default_paths = [ '/sbin' , '/usr/sbin' ]
2018-09-12 13:53:13 +00:00
# 0: cmdline option, 1: paths, 2: fallback
2022-04-12 09:59:56 +00:00
progs = [ [ 'iptables' , default_paths , '/usr/sbin/iptables' ] ,
[ 'nft' , default_paths , '/usr/sbin/nft' ] ,
[ 'dnsmasq' , default_paths , '' ] ,
2023-07-10 09:05:42 +00:00
[ 'modprobe' , default_paths , '/sbin/modprobe' ]
2018-09-07 14:52:09 +00:00
]
foreach prog : progs
path = get_option ( prog [ 0 ] )
if path == ''
search_paths = [ prog [ 0 ] ]
foreach path : prog [ 1 ]
search_paths + = ( path + '/' + prog [ 0 ] )
endforeach
exe = find_program ( search_paths , required : false )
path = exe . found ( ) ? exe . path ( ) : prog [ 2 ]
endif
2018-09-12 13:53:13 +00:00
name = prog [ 0 ] . to_upper ( ) + '_PATH'
2018-09-07 14:52:09 +00:00
config_h . set_quoted ( name , path )
endforeach
2017-11-25 10:39:06 +00:00
# system CA certificates path
system_ca_path = get_option ( 'system_ca_path' )
config_h . set_quoted ( 'SYSTEM_CA_PATH' , system_ca_path )
# kernel firmware dir
kernel_firmware_dir = get_option ( 'kernel_firmware_dir' )
config_h . set_quoted ( 'KERNEL_FIRMWARE_DIR' , kernel_firmware_dir )
enable_libpsl = get_option ( 'libpsl' )
if enable_libpsl
libpsl_dep = dependency ( 'libpsl' , version : '>= 0.1' )
endif
config_h . set10 ( 'WITH_LIBPSL' , enable_libpsl )
2019-11-12 14:54:22 +00:00
libcurl_dep = dependency ( 'libcurl' , version : '>= 7.24.0' , required : false )
2017-11-25 10:39:06 +00:00
enable_concheck = get_option ( 'concheck' )
if enable_concheck
assert ( libcurl_dep . found ( ) , 'concheck requires libcurl library. Use -Dconcheck=false to disable it' )
endif
config_h . set10 ( 'WITH_CONCHECK' , enable_concheck )
2021-04-05 14:07:53 +00:00
config_h . set10 ( 'HAVE_READLINE_HISTORY' , false )
config_h . set10 ( 'HAVE_EDITLINE_READLINE' , false )
2021-07-15 15:33:09 +00:00
with_readline = get_option ( 'readline' )
if with_readline != 'none'
if with_readline == 'libreadline' or with_readline == 'auto'
readline = cc . find_library ( 'readline' , required : false )
2021-04-05 14:07:53 +00:00
if readline . found ( )
readline_dep = declare_dependency ( link_args : '-lreadline' )
config_h . set10 ( 'HAVE_READLINE_HISTORY' , true )
2021-07-15 15:33:09 +00:00
with_readline = 'libreadline'
2021-04-05 14:07:53 +00:00
else
2021-07-15 15:33:09 +00:00
assert ( with_readline == 'auto' , 'libreadline was not found' )
2021-04-05 14:07:53 +00:00
endif
endif
2021-07-15 15:33:09 +00:00
if with_readline == 'libedit' or with_readline == 'auto'
edit = dependency ( 'libedit' , required : false )
2021-04-05 14:07:53 +00:00
if edit . found ( )
readline_dep = declare_dependency ( link_args : '-ledit' )
config_h . set10 ( 'HAVE_EDITLINE_READLINE' , true )
2021-07-15 15:33:09 +00:00
with_readline = 'libedit'
2021-04-05 14:07:53 +00:00
else
2021-07-15 15:33:09 +00:00
assert ( with_readline == 'auto' , 'libedit was not found' )
with_readline = 'none'
2021-04-05 14:07:53 +00:00
endif
endif
endif
2017-11-25 10:39:06 +00:00
enable_nmcli = get_option ( 'nmcli' )
if enable_nmcli
2021-07-15 15:33:09 +00:00
assert ( with_readline != 'none' , 'nmcli requires readline library (-Dnmcli=false or -Dreadline=auto|libreadline|libedit|none)' )
2017-11-25 10:39:06 +00:00
endif
enable_nmtui = get_option ( 'nmtui' )
if enable_nmtui
newt_dep = dependency ( 'libnewt' , version : '>= 0.52.15' , required : false )
assert ( newt_dep . found ( ) , 'You must have libnewt installed to build nmtui. Use -Dnmtui=false to disable it' )
endif
2019-11-12 14:54:22 +00:00
enable_nm_cloud_setup = get_option ( 'nm_cloud_setup' )
if enable_nm_cloud_setup
assert ( libcurl_dep . found ( ) , 'nm-cloud-setup requires libcurl library. Use -Dnm_cloud_setup=false to disable it' )
endif
2020-11-01 17:38:54 +00:00
enable_docs = get_option ( 'docs' )
2017-11-25 10:39:06 +00:00
more_asserts = get_option ( 'more_asserts' )
2020-09-08 16:35:56 +00:00
if more_asserts == 'auto'
if nm_minor_version % 2 == 0
more_asserts = 'no'
else
more_asserts = 'all'
endif
endif
2017-11-25 10:39:06 +00:00
if more_asserts == 'no'
more_asserts = 0
elif more_asserts == 'all'
more_asserts = 100
else
more_asserts = more_asserts . to_int ( )
endif
config_h . set ( 'NM_MORE_ASSERTS' , more_asserts )
more_logging = get_option ( 'more_logging' )
config_h . set10 ( 'NM_MORE_LOGGING' , more_logging )
2021-03-22 12:10:02 +00:00
config_h . set10 ( '_NM_CC_SUPPORT_GENERIC' ,
cc . compiles (
'int foo(void); static const char *const buf[1] = { "a" }; int foo() { int a = 0; int b = _Generic (a, int: 4) + _Generic(buf, const char *const*: 5); return b + a; }'
)
)
2017-11-25 10:39:06 +00:00
2021-03-22 12:10:02 +00:00
config_h . set10 ( '_NM_CC_SUPPORT_AUTO_TYPE' ,
cc . compiles (
'int main() { int a = 0; __auto_type b = a; return b + a; };'
)
)
2017-11-25 10:39:06 +00:00
# Vala bindings
2018-09-14 13:33:47 +00:00
vapi_opt = get_option ( 'vapi' )
if vapi_opt == 'false'
enable_vapi = false
else
2017-11-25 10:39:06 +00:00
vala_req_version = '>= 0.17.1.24'
2018-09-14 13:33:47 +00:00
enable_vapi = true
if not enable_introspection
assert ( vapi_opt != 'true' , 'vala api require GObject introspection. Use -Dvapi=false to disable it' )
enable_vapi = false
endif
if enable_vapi and not add_languages ( 'vala' , required : false )
assert ( vapi_opt != 'true' , 'vala is required to build. Use -Dvapi=false to disable it' )
enable_vapi = false
endif
if enable_vapi and not meson . get_compiler ( 'vala' ) . version ( ) . version_compare ( vala_req_version )
assert ( vapi_opt != 'true' , 'vala ' + vala_req_version + ' is required to build. Use -Dvapi=false to disable it' )
enable_vapi = false
endif
2017-11-25 10:39:06 +00:00
endif
2020-11-17 08:58:27 +00:00
test (
'check-local-gitlab-ci' ,
find_program ( join_paths ( source_root , 'tools' , 'check-gitlab-ci.sh' ) ) ,
args : [ source_root ] ,
)
2021-02-07 09:23:00 +00:00
test (
'check-tree' ,
find_program ( join_paths ( source_root , 'tools' , 'check-tree.sh' ) ) ,
)
2017-11-25 10:39:06 +00:00
# Tests, utilities and documentation
tests = get_option ( 'tests' )
enable_tests = ( tests != 'no' )
require_root_tests = ( tests == 'root' )
2019-08-28 09:54:11 +00:00
test_script = find_program ( join_paths ( source_root , 'tools' , 'run-nm-test.sh' ) )
2017-11-25 10:39:06 +00:00
# valgrind
2017-12-18 19:33:30 +00:00
locations = get_option ( 'valgrind' )
enable_valgrind = ( locations != [ 'no' ] )
if enable_valgrind
valgrind = find_program ( locations , required : false )
enable_valgrind = valgrind . found ( )
2017-11-25 10:39:06 +00:00
endif
if enable_valgrind
valgrind_suppressions_path = get_option ( 'valgrind_suppressions' )
if valgrind_suppressions_path == ''
2019-08-28 09:54:11 +00:00
valgrind_suppressions_path = join_paths ( source_root , 'valgrind.suppressions' )
2017-11-25 10:39:06 +00:00
endif
endif
2018-04-11 08:49:33 +00:00
test_args = [
'--called-from-make' ,
2019-08-28 09:54:11 +00:00
build_root ,
2018-04-11 08:49:33 +00:00
'' ,
enable_valgrind ? valgrind . path ( ) : '' ,
enable_valgrind ? valgrind_suppressions_path : '' ,
2018-10-18 10:50:20 +00:00
'--launch-dbus=auto' ,
2018-04-11 08:49:33 +00:00
]
2017-11-25 10:39:06 +00:00
py3 = import ( 'python3' )
python = py3 . find_python ( )
if python . found ( )
config_h . set_quoted ( 'TEST_NM_PYTHON' , python . path ( ) )
endif
2019-11-21 14:27:21 +00:00
data_conf = configuration_data ( )
data_conf . set ( 'DISTRO_NETWORK_SERVICE' , ( enable_ifcfg_rh ? 'network.service' : '' ) )
data_conf . set ( 'NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT' , config_default_logging_audit )
data_conf . set ( 'NM_CONFIG_DEFAULT_LOGGING_BACKEND_TEXT' , config_logging_backend_default )
2019-12-10 09:01:24 +00:00
data_conf . set ( 'NM_CONFIG_DEFAULT_MAIN_AUTH_POLKIT_TEXT' , config_auth_polkit_default )
2019-11-21 14:27:21 +00:00
data_conf . set ( 'NM_CONFIG_DEFAULT_MAIN_DHCP' , config_dhcp_default )
data_conf . set ( 'NM_CONFIG_DEFAULT_MAIN_RC_MANAGER' , config_dns_rc_manager_default )
2023-07-24 12:20:04 +00:00
data_conf . set ( 'NM_CONFIG_DEFAULT_MAIN_MIGRATE_IFCFG_RH_TEXT' , config_migrate_ifcfg_rh_default )
2021-12-03 01:34:10 +00:00
data_conf . set ( 'NM_CONFIG_DEFAULT_WIFI_BACKEND_TEXT' , config_wifi_backend_default )
2019-11-21 14:27:21 +00:00
data_conf . set ( 'NM_MAJOR_VERSION' , nm_major_version )
data_conf . set ( 'NM_MICRO_VERSION' , nm_micro_version )
data_conf . set ( 'NM_MINOR_VERSION' , nm_minor_version )
data_conf . set ( 'NM_MODIFY_SYSTEM_POLICY' , ( enable_modify_system ? 'yes' : 'auth_admin_keep' ) )
data_conf . set ( 'NM_VERSION' , nm_version )
data_conf . set ( 'VERSION' , nm_version )
data_conf . set ( 'bindir' , nm_bindir )
data_conf . set ( 'libexecdir' , nm_libexecdir )
data_conf . set ( 'localstatedir' , nm_localstatedir )
data_conf . set ( 'nmrundir' , nm_pkgrundir )
data_conf . set ( 'nmstatedir' , nm_pkgstatedir )
data_conf . set ( 'sbindir' , nm_sbindir )
data_conf . set ( 'sysconfdir' , nm_sysconfdir )
2017-11-25 10:39:06 +00:00
# check if we can build setting property documentation
'' '
build_docs = no
if test - n " $ INTROSPECTION_MAKEFILE " ; then
# If g-i is installed we know we have python, but we might not have pygobject
if ! " $ PYTHON " - c 'from gi.repository import GObject' > & / dev / null ; then
AC_MSG_ERROR ( [ " - - enable - introspection aims to build the settings documentation . This requires GObject introspection for python ( pygobject ) ] )
fi
AC_PATH_PROG ( PERL , perl )
if test - z " $ PERL " ; then
AC_MSG_ERROR ( [ - - enable - introspection requires perl ] )
fi
AC_PATH_PROG ( XSLTPROC , xsltproc )
if test - z " $ XSLTPROC " ; then
AC_MSG_ERROR ( [ - - enable - introspection requires xsltproc ] )
fi
have_introspection = yes
if test " $ enable_gtk_doc " = " yes " ; then
build_docs = yes
fi
else
if test " $ enable_gtk_doc " = " yes " ; then
# large parts of the documentation require introspection/pygobject to extract
# the documentation out of the source files. You cannot enable gtk-doc without alone.
AC_MSG_ERROR ( [ " - - with - gtk - doc requires - - enable - introspection " ] )
fi
have_introspection = no
fi
'' '
content_files = [ ]
subdir ( 'introspection' )
2021-02-12 14:01:09 +00:00
subdir ( 'src' )
2017-11-25 10:39:06 +00:00
subdir ( 'data' )
subdir ( 'po' )
if enable_vapi
subdir ( 'vapi' )
endif
2023-02-28 06:51:07 +00:00
test (
'check-vapi' ,
find_program ( join_paths ( source_root , 'tools' , 'check-vapi.sh' ) ) ,
)
2023-02-28 15:22:13 +00:00
test (
'check-nm-autoptr' ,
find_program ( join_paths ( source_root , 'tools' , 'check-nm-autoptr.sh' ) ) ,
)
2017-11-25 10:39:06 +00:00
subdir ( 'examples/C/glib' )
enable_qt = get_option ( 'qt' )
if enable_qt
add_languages ( 'cpp' )
2019-09-11 11:00:54 +00:00
qt_core_dep = dependency ( 'QtCore' , version : '>= 4' )
qt_dbus_dep = dependency ( 'QtDBus' )
qt_network_dep = dependency ( 'QtNetwork' )
2017-11-25 10:39:06 +00:00
subdir ( 'examples/C/qt' )
endif
if enable_docs
2018-09-18 12:56:59 +00:00
assert ( enable_introspection , '-Ddocs=true requires -Dintrospection=true' )
2018-09-23 14:30:18 +00:00
assert ( meson . version ( ) . version_compare ( '>= 0.46.0' ) , '-Ddocs requires meson >= 0.46' )
2017-11-25 10:39:06 +00:00
subdir ( 'man' )
subdir ( 'docs' )
endif
configure_file (
2019-08-28 08:40:46 +00:00
input : 'config.h.meson' ,
output : '@BASENAME@' ,
2018-10-18 10:50:20 +00:00
configuration : config_h ,
2017-11-25 10:39:06 +00:00
)
build: create "config-extra.h" header instead of passing directory variables via CFLAGS
1) the command line gets shorter. I frequently run `make V=1` to see
the command line arguments for the compiler, and there is a lot
of noise.
2) define each of these variables at one place. This makes it easy
to verify that for all compilation units, a particular
define has the same value. Previously that was not obvious or
even not the case (see commit e5d1a71396e107d1909744d26ad401f206c0c915
and commit d63cf1ef2faba57595112a82e962b9643cce4718).
The point is to avoid redundancy.
3) not all compilation units need all defines. In fact, most modules
would only need a few of these defines. We aimed to pass the necessary
minium of defines to each compilation unit, but that was non-obvious
to get right and often we set a define that wasn't used. See for example
"src_settings_plugins_ibft_cppflags" which needlessly had "-DSYSCONFDIR".
This question is now entirely avoided by just defining all variables in
a header. We don't care to find the minimum, because every component
gets anyway all defines from the header.
4) this also avoids the situation, where a module that previously did
not use a particular define gets modified to require it. Previously,
that would have required to identify the missing define, and add
it to the CFLAGS of the complation unit. Since every compilation
now includes "config-extra.h", all defines are available everywhere.
5) the fact that each define is now available in all compilation units
could be perceived as a downside. But it isn't, because these defines
should have a unique name and one specific value. Defining the same
name with different values, or refer to the same value by different
names is a bug, not a desirable feature. Since these defines should
be unique accross the entire tree, there is no problem in providing
them to every compilation unit.
6) the reason why we generate "config-extra.h" this way, instead of using
AC_DEFINE() in configure.ac, is due to the particular handling of
autoconf for directory variables. See [1].
With meson, it would be trivial to put them into "config.h.meson".
While that is not easy with autoconf, the "config-extra.h" workaround
seems still preferable to me.
[1] https://www.gnu.org/software/autoconf/manual/autoconf-2.63/html_node/Installation-Directory-Variables.html
2018-07-12 08:58:23 +00:00
config_extra_h = configuration_data ( )
config_extra_h . set_quoted ( 'BINDIR' , nm_bindir )
config_extra_h . set_quoted ( 'DATADIR' , nm_datadir )
config_extra_h . set_quoted ( 'LIBEXECDIR' , nm_libexecdir )
config_extra_h . set_quoted ( 'LOCALSTATEDIR' , nm_localstatedir )
config_extra_h . set_quoted ( 'NMCONFDIR' , nm_pkgconfdir )
config_extra_h . set_quoted ( 'NMLIBDIR' , nm_pkglibdir )
config_extra_h . set_quoted ( 'NMLOCALEDIR' , nm_localedir )
config_extra_h . set_quoted ( 'NMPLUGINDIR' , nm_plugindir )
config_extra_h . set_quoted ( 'NMRUNDIR' , nm_pkgrundir )
config_extra_h . set_quoted ( 'NMSTATEDIR' , nm_pkgstatedir )
config_extra_h . set_quoted ( 'NMVPNDIR' , nm_vpndir )
2019-08-28 09:54:11 +00:00
config_extra_h . set_quoted ( 'NM_BUILD_BUILDDIR' , build_root )
config_extra_h . set_quoted ( 'NM_BUILD_SRCDIR' , source_root )
2018-08-09 19:47:35 +00:00
if enable_ppp
2019-05-14 08:14:43 +00:00
config_extra_h . set_quoted ( 'PPPD_PLUGIN_DIR' , pppd_plugin_dir )
2018-08-09 19:47:35 +00:00
endif
build: create "config-extra.h" header instead of passing directory variables via CFLAGS
1) the command line gets shorter. I frequently run `make V=1` to see
the command line arguments for the compiler, and there is a lot
of noise.
2) define each of these variables at one place. This makes it easy
to verify that for all compilation units, a particular
define has the same value. Previously that was not obvious or
even not the case (see commit e5d1a71396e107d1909744d26ad401f206c0c915
and commit d63cf1ef2faba57595112a82e962b9643cce4718).
The point is to avoid redundancy.
3) not all compilation units need all defines. In fact, most modules
would only need a few of these defines. We aimed to pass the necessary
minium of defines to each compilation unit, but that was non-obvious
to get right and often we set a define that wasn't used. See for example
"src_settings_plugins_ibft_cppflags" which needlessly had "-DSYSCONFDIR".
This question is now entirely avoided by just defining all variables in
a header. We don't care to find the minimum, because every component
gets anyway all defines from the header.
4) this also avoids the situation, where a module that previously did
not use a particular define gets modified to require it. Previously,
that would have required to identify the missing define, and add
it to the CFLAGS of the complation unit. Since every compilation
now includes "config-extra.h", all defines are available everywhere.
5) the fact that each define is now available in all compilation units
could be perceived as a downside. But it isn't, because these defines
should have a unique name and one specific value. Defining the same
name with different values, or refer to the same value by different
names is a bug, not a desirable feature. Since these defines should
be unique accross the entire tree, there is no problem in providing
them to every compilation unit.
6) the reason why we generate "config-extra.h" this way, instead of using
AC_DEFINE() in configure.ac, is due to the particular handling of
autoconf for directory variables. See [1].
With meson, it would be trivial to put them into "config.h.meson".
While that is not easy with autoconf, the "config-extra.h" workaround
seems still preferable to me.
[1] https://www.gnu.org/software/autoconf/manual/autoconf-2.63/html_node/Installation-Directory-Variables.html
2018-07-12 08:58:23 +00:00
config_extra_h . set_quoted ( 'PREFIX' , nm_prefix )
config_extra_h . set_quoted ( 'RUNSTATEDIR' , nm_runstatedir )
config_extra_h . set_quoted ( 'SYSCONFDIR' , nm_sysconfdir )
configure_file (
input : 'config-extra.h.meson' ,
2019-08-28 08:40:46 +00:00
output : '@BASENAME@' ,
2018-10-18 10:50:20 +00:00
configuration : config_extra_h ,
build: create "config-extra.h" header instead of passing directory variables via CFLAGS
1) the command line gets shorter. I frequently run `make V=1` to see
the command line arguments for the compiler, and there is a lot
of noise.
2) define each of these variables at one place. This makes it easy
to verify that for all compilation units, a particular
define has the same value. Previously that was not obvious or
even not the case (see commit e5d1a71396e107d1909744d26ad401f206c0c915
and commit d63cf1ef2faba57595112a82e962b9643cce4718).
The point is to avoid redundancy.
3) not all compilation units need all defines. In fact, most modules
would only need a few of these defines. We aimed to pass the necessary
minium of defines to each compilation unit, but that was non-obvious
to get right and often we set a define that wasn't used. See for example
"src_settings_plugins_ibft_cppflags" which needlessly had "-DSYSCONFDIR".
This question is now entirely avoided by just defining all variables in
a header. We don't care to find the minimum, because every component
gets anyway all defines from the header.
4) this also avoids the situation, where a module that previously did
not use a particular define gets modified to require it. Previously,
that would have required to identify the missing define, and add
it to the CFLAGS of the complation unit. Since every compilation
now includes "config-extra.h", all defines are available everywhere.
5) the fact that each define is now available in all compilation units
could be perceived as a downside. But it isn't, because these defines
should have a unique name and one specific value. Defining the same
name with different values, or refer to the same value by different
names is a bug, not a desirable feature. Since these defines should
be unique accross the entire tree, there is no problem in providing
them to every compilation unit.
6) the reason why we generate "config-extra.h" this way, instead of using
AC_DEFINE() in configure.ac, is due to the particular handling of
autoconf for directory variables. See [1].
With meson, it would be trivial to put them into "config.h.meson".
While that is not easy with autoconf, the "config-extra.h" workaround
seems still preferable to me.
[1] https://www.gnu.org/software/autoconf/manual/autoconf-2.63/html_node/Installation-Directory-Variables.html
2018-07-12 08:58:23 +00:00
)
2017-11-25 10:39:06 +00:00
meson . add_install_script (
2018-09-13 15:24:58 +00:00
join_paths ( 'tools' , 'meson-post-install.sh' ) ,
2017-11-25 10:39:06 +00:00
nm_datadir ,
nm_bindir ,
nm_pkgconfdir ,
nm_pkglibdir ,
2018-09-23 14:57:14 +00:00
nm_pkgstatedir ,
2018-10-18 10:50:20 +00:00
nm_mandir ,
2019-09-11 06:59:12 +00:00
nm_sysconfdir ,
2019-11-22 14:59:11 +00:00
enable_docs ? '1' : '0' ,
enable_ifcfg_rh ? '1' : '0' ,
2019-11-12 14:54:22 +00:00
enable_nm_cloud_setup ? '1' : '0' ,
install_systemdunitdir ? '1' : '0' ,
2017-11-25 10:39:06 +00:00
)
output = '\nSystem paths:\n'
output + = ' prefix: ' + nm_prefix + '\n'
output + = ' exec_prefix: ' + nm_prefix + '\n'
2019-08-29 06:09:09 +00:00
output + = ' systemdunitdir: ' + systemd_systemdsystemunitdir + '\n'
2022-05-11 20:29:06 +00:00
output + = ' udev_dir: ' + udev_udevdir + '\n'
2017-11-25 10:39:06 +00:00
output + = ' nmbinary: ' + nm_pkgsbindir + '\n'
output + = ' nmconfdir: ' + nm_pkgconfdir + '\n'
output + = ' nmlibdir: ' + nm_pkglibdir + '\n'
output + = ' nmdatadir: ' + nm_pkgdatadir + '\n'
output + = ' nmstatedir: ' + nm_pkgstatedir + '\n'
output + = ' nmrundir: ' + nm_pkgrundir + '\n'
2018-03-18 19:38:49 +00:00
output + = ' nmvpndir: ' + nm_vpndir + '\n'
2018-03-18 20:19:41 +00:00
output + = ' nmplugindir: ' + nm_plugindir + '\n'
2022-05-13 13:36:42 +00:00
output + = ' system_ca_path: ' + system_ca_path + '\n'
output + = ' dbus_conf_dir: ' + dbus_conf_dir + '\n'
2017-11-25 10:39:06 +00:00
output + = '\nPlatform:\n'
output + = ' session tracking: ' + ',' . join ( session_trackers ) + '\n'
output + = ' suspend/resume: ' + suspend_resume + '\n'
2019-12-10 09:01:24 +00:00
output + = ' policykit: ' + enable_polkit . to_string ( ) + ' (default: ' + config_auth_polkit_default + ')'
2017-11-25 10:39:06 +00:00
if enable_polkit
2019-12-13 12:41:42 +00:00
output + = ' ('
if enable_modify_system
output + = 'permissive'
else
output + = 'restrictive'
endif
output + = ' modify.system)'
2017-11-25 10:39:06 +00:00
endif
output + = '\n'
2021-02-12 09:17:41 +00:00
output + = ' polkit-agent-helper-1: ' + polkit_agent_helper_1_path + '\n'
2017-11-25 10:39:06 +00:00
output + = ' selinux: ' + enable_selinux . to_string ( ) + '\n'
output + = ' systemd-journald: ' + enable_systemd_journal . to_string ( ) + ' (default: logging.backend=' + config_logging_backend_default + ')\n'
output + = ' hostname persist: ' + hostname_persist + '\n'
output + = ' libaudit: ' + enable_libaudit . to_string ( ) + ' (default: logging.audit=' + config_default_logging_audit + ')\n'
output + = '\nFeatures:\n'
output + = ' wext: ' + enable_wext . to_string ( ) + '\n'
output + = ' wifi: ' + enable_wifi . to_string ( ) + '\n'
output + = ' iwd: ' + enable_iwd . to_string ( ) + '\n'
output + = ' pppd: ' + enable_ppp . to_string ( )
if enable_ppp
2018-09-11 13:05:03 +00:00
output + = ' ' + pppd_path + ' plugins:' + pppd_plugin_dir
2017-11-25 10:39:06 +00:00
endif
output + = '\n'
libnm: always build libnm with JSON validation
We anyway load libjansson with dlopen(), and already before it could
happen that libjansson is not available. In that case, we would not
crash, but simply proceed without json validation.
Since libnm-core no longer uses libjansson directly, but only via
"nm-glib-aux/nm-json.h", we can just always compile with that, and use
it at runtime. That means, libjansson is not a build dependency for
libnm anymore, so we don't need a compile time check.
Note that if you build without libjansson, then JANSSON_SONAME is
undefined, and loading it will still fail at runtime. So, even if
we now always build with all our code enabled, it only works if you
actually build with libjansson. Still, it's simpler to drop the
conditional build, as the only benefit is a (minimally) smaller
build.
2020-07-01 16:38:22 +00:00
output + = ' jansson: ' + jansson_msg + '\n'
2021-05-06 14:50:25 +00:00
output + = ' iptables: ' + config_h . get ( 'IPTABLES_PATH' ) + '\n'
output + = ' nft: ' + config_h . get ( 'NFT_PATH' ) + '\n'
2023-07-10 09:05:42 +00:00
output + = ' modprobe: ' + config_h . get ( 'MODPROBE_PATH' ) + '\n'
2017-11-25 10:39:06 +00:00
output + = ' modemmanager-1: ' + enable_modem_manager . to_string ( ) + '\n'
2023-02-21 12:03:00 +00:00
if enable_modem_manager
output + = ' mobile-broadband-provider-info-database: ' + mobile_broadband_provider_info_database + '\n'
endif
2017-11-25 10:39:06 +00:00
output + = ' ofono: ' + enable_ofono . to_string ( ) + '\n'
output + = ' concheck: ' + enable_concheck . to_string ( ) + '\n'
output + = ' libteamdctl: ' + enable_teamdctl . to_string ( ) + '\n'
output + = ' ovs: ' + enable_ovs . to_string ( ) + '\n'
output + = ' nmcli: ' + enable_nmcli . to_string ( ) + '\n'
output + = ' nmtui: ' + enable_nmtui . to_string ( ) + '\n'
2019-11-12 14:54:22 +00:00
output + = ' nm-cloud-setup: ' + enable_nm_cloud_setup . to_string ( ) + '\n'
2017-11-25 10:39:06 +00:00
output + = '\nConfiguration_plugins (main.plugins=' + config_plugins_default + ')\n'
output + = ' ifcfg-rh: ' + enable_ifcfg_rh . to_string ( ) + '\n'
2023-07-24 12:20:04 +00:00
output + = ' default value of main.migrate-ifcfg-rh: ' + config_migrate_ifcfg_rh_default + '\n'
2017-11-25 10:39:06 +00:00
output + = ' ifupdown: ' + enable_ifupdown . to_string ( ) + '\n'
2018-09-07 15:12:31 +00:00
output + = '\nHandlers for /etc/resolv.conf:\n' + resolv_conf_summary
2017-11-25 10:39:06 +00:00
output + = '\n'
output + = ' config-dns-rc-manager-default: ' + config_dns_rc_manager_default + '\n'
2018-09-07 15:02:59 +00:00
output + = '\nDHCP clients (default ' + config_dhcp_default + '):\n' + dhcp_summary
2017-11-25 10:39:06 +00:00
output + = '\n'
output + = '\nMiscellaneous:\n'
output + = ' have introspection: ' + enable_introspection . to_string ( ) + '\n'
output + = ' build documentation and manpages: ' + enable_docs . to_string ( ) + '\n'
2020-05-08 07:09:25 +00:00
output + = ' firewalld zone for shared mode: ' + enable_firewalld_zone . to_string ( ) + '\n'
2017-11-25 10:39:06 +00:00
# FIXME
#output += ' install pregenerated documentation and manpages: no
output + = ' tests: ' + tests + '\n'
output + = ' more-asserts: @0@\n' . format ( more_asserts )
output + = ' more-logging: ' + more_logging . to_string ( ) + '\n'
output + = ' warning-level: ' + get_option ( 'warning_level' ) + '\n'
2017-12-18 19:33:30 +00:00
output + = ' valgrind: ' + enable_valgrind . to_string ( )
if enable_valgrind
output + = ' ' + valgrind . path ( )
endif
output + = '\n'
2017-11-25 10:39:06 +00:00
output + = ' code coverage: ' + get_option ( 'b_coverage' ) . to_string ( ) + '\n'
2019-02-02 14:57:01 +00:00
output + = ' LTO: ' + enable_lto . to_string ( ) + '\n'
2017-11-25 10:39:06 +00:00
output + = ' Linker garbage collection: ' + enable_ld_gc . to_string ( ) + '\n'
2022-03-18 19:14:04 +00:00
output + = ' crypto: ' + crypto + ' ('
output + = 'have-gnutls: ' + crypto_gnutls_dep . found ( ) . to_string ( ) + ', '
output + = 'have-nss: ' + crypto_nss_dep . found ( ) . to_string ( ) + ')\n'
2017-11-25 10:39:06 +00:00
output + = ' sanitizers: ' + get_option ( 'b_sanitize' ) + '\n'
output + = ' Mozilla Public Suffix List: ' + enable_libpsl . to_string ( ) + '\n'
2018-09-14 13:33:47 +00:00
output + = ' vapi: ' + enable_vapi . to_string ( ) + '\n'
2018-09-19 14:38:38 +00:00
output + = ' ebpf: ' + enable_ebpf . to_string ( ) + '\n'
2021-07-15 15:33:09 +00:00
output + = ' readline: ' + with_readline + '\n'
2017-11-25 10:39:06 +00:00
message ( output )