Make installation of kernel uapi header files optional

The bundled kernel's uapi header files ("nilfs2_ondisk.h" and
"nilfs2_api.h") are included in kernel-related development packages
in modern Linux distributions, resulting in duplicate installations.

In order to eliminate this duplication, make the installation of these
files optional and not install them by default.

The utilities will continue to refer to the included uapi header files,
and will only allow installation on the system, which can be specified
using the "--enable-uapi-header-install" option in configure file
arguments.

This is a workaround for older environments and should normally be
disabled.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
This commit is contained in:
Ryusuke Konishi 2024-02-17 01:39:47 +09:00
parent 61b66f0043
commit 4d722cd3eb
3 changed files with 30 additions and 0 deletions

17
README
View File

@ -55,6 +55,23 @@ of selinux context mount options (-o context=<context>, etc):
For helpers built with mount library (libmount), support of the
context mount depends on the libmount that distro provides.
If you are having problems due to the missing nilfs2 disk format or
ioctl interface definition file (nilfs2_ondisk.h or nilfs2_api.h,
respectively), try installing the Linux kernel source or header file
package first.
If you still cannot install these files, or if you want to overwrite
them with files from this package, specify the
"--enable-uapi-header-install" option as an argument to the configure
script. This will install the uapi header files included in this
package:
$ ./configure --enable-uapi-header-install
Note that the utility package itself references bundled local header
files, so you don't need to install these files with this option to
build.
* How to get development sources

View File

@ -57,6 +57,12 @@ AC_ARG_WITH([blkid],
AS_HELP_STRING([--without-blkid], [compile without blkid support]),
[], with_blkid=yes)
AC_ARG_ENABLE([uapi_header_install],
AS_HELP_STRING([--enable-uapi-header-install],
[install kernel uapi header files]),
[enable_uapi_header_install="${enableval}"],
[enable_uapi_header_install=no])
# Checks for libraries.
AC_CHECK_LIB([uuid], [uuid_generate],
[AC_DEFINE([HAVE_LIBUUID], 1,
@ -139,6 +145,9 @@ if test "${with_selinux}" = "yes"; then
fi
AC_SUBST([LIB_SELINUX])
AM_CONDITIONAL(CONFIG_UAPI_HEADER_INSTALL,
[test "$enable_uapi_header_install" = yes])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE

View File

@ -5,4 +5,8 @@ noinst_HEADERS = realpath.h nls.h parser.h nilfs_feature.h \
vector.h nilfs_gc.h cnormap.h cleaner_msg.h cleaner_exec.h \
compat.h crc32.h pathnames.h segment.h util.h
if CONFIG_UAPI_HEADER_INSTALL
nobase_include_HEADERS = linux/nilfs2_api.h linux/nilfs2_ondisk.h
else
noinst_HEADERS += linux/nilfs2_api.h linux/nilfs2_ondisk.h
endif