]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
build-sys: do not require dirfd()
authorKarel Zak <kzak@redhat.com>
Wed, 24 Oct 2018 12:32:29 +0000 (14:32 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 3 Dec 2018 10:23:33 +0000 (11:23 +0100)
The dirfd() is required on many places, but it should not be required for
all utils by ./configure.ac.

Signed-off-by: Karel Zak <kzak@redhat.com>
configure.ac
lib/Makemodule.am

index f223adb9f0d61ce027fd5d40b4b73bf2ad4d4ad7..e6ba49553e5f6e7166aba9424c3a9a847a8f13ac 100644 (file)
@@ -600,10 +600,7 @@ AS_IF([test x"$have_dirfd" = xno], [
                 #include <dirent.h>])
 ])
 
-AS_CASE([$have_dirfd:$have_ddfd],
-  [no:no],
-    [AC_MSG_ERROR([cannot find a method to get filedescriptor of directory])]
-)
+AM_CONDITIONAL([HAVE_DIRFD], [test "x$have_dirfd" = xyes -o "x$have_ddfd" = xyes])
 
 
 AC_MSG_CHECKING([whether program_invocation_short_name is defined])
@@ -1071,6 +1068,7 @@ AC_ARG_ENABLE([libblkid],
 )
 UL_BUILD_INIT([libblkid])
 UL_REQUIRES_HAVE([libblkid], [openat], [openat functions])
+UL_REQUIRES_HAVE([libblkid], [dirfd,ddfd], [dirfd or ddfd function])
 AC_SUBST([LIBBLKID_DATE])
 AC_SUBST([LIBBLKID_VERSION])
 AC_SUBST([LIBBLKID_VERSION_INFO])
@@ -1092,6 +1090,7 @@ AC_ARG_ENABLE([libmount],
 UL_BUILD_INIT([libmount])
 UL_REQUIRES_BUILD([libmount], [libblkid])
 UL_REQUIRES_HAVE([libmount], [scanf_alloc_modifier], [scanf string alloc modifier])
+UL_REQUIRES_HAVE([libmount], [dirfd,ddfd], [dirfd or ddfd function])
 AM_CONDITIONAL([BUILD_LIBMOUNT], [test "x$build_libmount" = xyes])
 AM_CONDITIONAL([BUILD_LIBMOUNT_TESTS], [test "x$build_libmount" = xyes -a "x$enable_static" = xyes])
 AS_IF([test "x$build_libmount" = xyes], [
@@ -1168,6 +1167,7 @@ enable_cfdisk=$enable_fdisks
 
 UL_BUILD_INIT([fdisk])
 UL_REQUIRES_HAVE([fdisk], [openat], [openat functions])
+UL_REQUIRES_HAVE([fdisk], [dirfd,ddfd], [dirfd or ddfd function])
 UL_REQUIRES_BUILD([fdisk], [libfdisk])
 UL_REQUIRES_BUILD([fdisk], [libsmartcols])
 AM_CONDITIONAL([BUILD_FDISK], [test "x$build_fdisk" = xyes])
@@ -1175,6 +1175,7 @@ AM_CONDITIONAL([BUILD_FDISK], [test "x$build_fdisk" = xyes])
 
 UL_BUILD_INIT([sfdisk])
 UL_REQUIRES_HAVE([sfdisk], [openat], [openat functions])
+UL_REQUIRES_HAVE([sfdisk], [dirfd,ddfd], [dirfd or ddfd function])
 UL_REQUIRES_BUILD([sfdisk], [libfdisk])
 UL_REQUIRES_BUILD([sfdisk], [libsmartcols])
 AM_CONDITIONAL([BUILD_SFDISK], [test "x$build_sfdisk" = xyes])
@@ -1642,6 +1643,7 @@ AC_ARG_ENABLE([switch_root],
 UL_BUILD_INIT([switch_root])
 UL_REQUIRES_LINUX([switch_root])
 UL_REQUIRES_HAVE([switch_root], [openat], [openat function])
+UL_REQUIRES_HAVE([switch_root], [dirfd,ddfd], [dirfd or ddfd function])
 AM_CONDITIONAL([BUILD_SWITCH_ROOT], [test "x$build_switch_root" = xyes])
 
 
index 13b19f1512ce90cb03e84b59d855ddf9ceee59c7..862a06c17c4b50332916242315129370be1f64e0 100644 (file)
@@ -48,10 +48,12 @@ libcommon_la_SOURCES += lib/cpuset.c
 endif
 
 if HAVE_OPENAT
+if HAVE_DIRFD
 libcommon_la_SOURCES += lib/path.c
 libcommon_la_SOURCES += lib/procutils.c
 libcommon_la_SOURCES += lib/sysfs.c
 endif
+endif
 
 noinst_LTLIBRARIES += libtcolors.la
 libtcolors_la_CFLAGS = $(AM_CFLAGS)
@@ -96,9 +98,11 @@ check_PROGRAMS += \
 endif
 
 if HAVE_OPENAT
+if HAVE_DIRFD
 check_PROGRAMS += test_procutils
 check_PROGRAMS += test_path
 endif
+endif
 
 test_ttyutils_SOURCES = lib/ttyutils.c
 test_ttyutils_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM_TTYUTILS
@@ -126,11 +130,10 @@ test_randutils_SOURCES = lib/randutils.c
 test_randutils_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM_RANDUTILS
 
 if HAVE_OPENAT
+if HAVE_DIRFD
 test_procutils_SOURCES = lib/procutils.c
 test_procutils_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM_PROCUTILS
-endif
 
-if HAVE_OPENAT
 test_path_SOURCES = lib/path.c lib/fileutils.c
 if HAVE_CPU_SET_T
 test_path_SOURCES += lib/cpuset.c
@@ -138,6 +141,7 @@ endif
 test_path_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM_PATH
 test_path_LDADD = $(LDADD)
 endif
+endif
 
 if LINUX
 test_cpuset_SOURCES = lib/cpuset.c