The purpose of it is to tell us if we are compiling
liblxc or lxc test/tool/command.
This thing is needed to exclude unnecessary functions
from being compiled-in in the resulting executables
like lxc-start, lxc-attach, etc.
The problem is that lxc tools (lxc-start, lxc-stop, etc)
depend not only on the liblxc as a shared library, but also
require some non-exported symbols or helpers from liblxc
internals. So, we have to link these executables with some liblxc
object files directly which results in the dependency hell,
because linking one .c file from liblxc may end up having to
link with another one (what contains some dependency) and so on.
By using IN_LIBLXC in the liblxc internals we can selectively
omit some functions from being compiled in such cases.
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
install: true,
include_directories: liblxc_includes,
dependencies: [threads] + liblxc_dependency_headers,
- c_args: '-fvisibility=default')
+ c_args: ['-fvisibility=default', '-DIN_LIBLXC'])
lxc_functions = configure_file(
configuration: conf,
return -1;
}
+#ifdef IN_LIBLXC
+
lxc_state_t lxc_getstate(const char *name, const char *lxcpath, int timeout)
{
return lxc_cmd_get_state(name, lxcpath, timeout);
return 0;
}
+
+#endif /* IN_LIBLXC */
*/
extern bool btrfs_try_remove_subvol(const char *path);
+#ifdef IN_LIBLXC
+
static int _recursive_rmdir(const char *dirname, dev_t pdev,
const char *exclude, int level, bool onedev)
{
return _recursive_rmdir(path, mystat.st_dev, exclude, 0, onedev);
}
+#endif /* IN_LIBLXC */
+
/* borrowed from iproute2 */
extern int get_u16(unsigned short *val, const char *arg, int base)
{