mirror of
https://github.com/NixOS/nix
synced 2025-07-01 16:41:47 +02:00
There are two big changes:
1. Public and private config is now separated. Configuration variables
that are only used internally do not go in a header which is
installed.
(Additionally, libutil has a unix-specific private config header,
which should only be used in unix-specific code. This keeps things a
bit more organized, in a purely private implementation-internal way.)
2. Secondly, there is no more `-include`. There are very few config
items that need to be publically exposed, so now it is feasible to
just make the headers that need them just including the (public)
configuration header.
And there are also a few more small cleanups on top of those:
- The configuration files have better names.
- The few CPP variables that remain exposed in the public headers are
now also renamed to always start with `NIX_`. This ensures they should
not conflict with variables defined elsewhere.
- We now always use `#if` and not `#ifdef`/`#ifndef` for our
configuration variables, which helps avoid bugs by requiring that
variables must be defined in all cases.
(cherry picked from commit c204e307ac
)
63 lines
1.5 KiB
Meson
63 lines
1.5 KiB
Meson
include_dirs += include_directories('.')
|
|
|
|
configdata_unix = configuration_data()
|
|
|
|
configdata_unix.set(
|
|
'HAVE_DECL_AT_SYMLINK_NOFOLLOW',
|
|
cxx.has_header_symbol('fcntl.h', 'AT_SYMLINK_NOFOLLOW').to_int(),
|
|
description : 'Optionally used for changing the files and symlinks.'
|
|
)
|
|
|
|
# Check for each of these functions, and create a define like `#define
|
|
# HAVE_CLOSE_RANGE 1`.
|
|
check_funcs_unix = [
|
|
[
|
|
'close_range',
|
|
'For closing many file descriptors after forking.',
|
|
],
|
|
[
|
|
'lutimes',
|
|
'Optionally used for changing the mtime of symlinks.',
|
|
],
|
|
[
|
|
'pipe2',
|
|
'Optionally used for creating pipes on Unix.',
|
|
],
|
|
[
|
|
'strsignal',
|
|
'Optionally used to get more information about processes failing due to a signal on Unix.',
|
|
],
|
|
[
|
|
'sysconf',
|
|
'Optionally used to try to close more file descriptors (e.g. before forking) on Unix.',
|
|
],
|
|
[
|
|
'utimensat',
|
|
'Optionally used for changing the mtime of files and symlinks.',
|
|
],
|
|
]
|
|
foreach funcspec : check_funcs_unix
|
|
define_name = 'HAVE_' + funcspec[0].underscorify().to_upper()
|
|
define_value = cxx.has_function(funcspec[0]).to_int()
|
|
configdata_unix.set(define_name, define_value, description: funcspec[1])
|
|
endforeach
|
|
|
|
config_unix_priv_h = configure_file(
|
|
configuration : configdata_unix,
|
|
output : 'util-unix-config-private.hh',
|
|
)
|
|
sources += config_unix_priv_h
|
|
|
|
sources += files(
|
|
'environment-variables.cc',
|
|
'file-descriptor.cc',
|
|
'file-path.cc',
|
|
'file-system.cc',
|
|
'muxable-pipe.cc',
|
|
'os-string.cc',
|
|
'processes.cc',
|
|
'signals.cc',
|
|
'users.cc',
|
|
)
|
|
|
|
subdir('include/nix')
|