build-sys: add and use openat build conditionals
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
This commit is contained in:
parent
e0dfdfeca0
commit
dc0495166f
|
@ -402,6 +402,8 @@ AC_CHECK_FUNCS([inotify_init1], [have_inotify_init1=yes])
|
|||
AC_CHECK_FUNCS([open_memstream], [have_open_memstream=yes],[have_open_memstream=no])
|
||||
AC_CHECK_FUNCS([reboot], [have_reboot=yes],[have_reboot=no])
|
||||
|
||||
AM_CONDITIONAL([HAVE_OPENAT], [test "x$have_openat" = xyes])
|
||||
|
||||
dnl lib/mononotic.c may require -lrt
|
||||
AC_CHECK_FUNCS([clock_gettime], [],
|
||||
[AC_CHECK_LIB([rt], [clock_gettime], [REALTIME_LIBS="-lrt"])]
|
||||
|
@ -915,9 +917,10 @@ dnl libblkid
|
|||
dnl
|
||||
AC_ARG_ENABLE([libblkid],
|
||||
AS_HELP_STRING([--disable-libblkid], [do not build libblkid and many related utilities]),
|
||||
[], [UL_DEFAULT_ENABLE([libblkid], [yes])]
|
||||
[], [UL_DEFAULT_ENABLE([libblkid], [check])]
|
||||
)
|
||||
UL_BUILD_INIT([libblkid])
|
||||
UL_REQUIRES_HAVE([libblkid], [openat], [openat functions])
|
||||
AC_SUBST([LIBBLKID_DATE])
|
||||
AC_SUBST([LIBBLKID_VERSION])
|
||||
AC_SUBST([LIBBLKID_VERSION_INFO])
|
||||
|
@ -1002,12 +1005,14 @@ AC_DEFINE_UNQUOTED([LIBFDISK_VERSION], ["$LIBFDISK_VERSION"], [libfdisk version
|
|||
|
||||
|
||||
UL_BUILD_INIT([fdisk], [check])
|
||||
UL_REQUIRES_HAVE([fdisk], [openat], [openat functions])
|
||||
UL_REQUIRES_BUILD([fdisk], [libfdisk])
|
||||
UL_REQUIRES_BUILD([fdisk], [libsmartcols])
|
||||
AM_CONDITIONAL([BUILD_FDISK], [test "x$build_fdisk" = xyes])
|
||||
|
||||
|
||||
UL_BUILD_INIT([sfdisk], [check])
|
||||
UL_REQUIRES_HAVE([sfdisk], [openat], [openat functions])
|
||||
UL_REQUIRES_BUILD([sfdisk], [libfdisk])
|
||||
UL_REQUIRES_BUILD([sfdisk], [libsmartcols])
|
||||
AM_CONDITIONAL([BUILD_SFDISK], [test "x$build_sfdisk" = xyes])
|
||||
|
|
|
@ -28,6 +28,7 @@ static inline FILE *xfmkstemp(char **tmpname, const char *dir, const char *prefi
|
|||
return ret;
|
||||
}
|
||||
|
||||
#ifdef HAVE_OPENAT
|
||||
static inline FILE *fopen_at(int dir, const char *filename,
|
||||
int flags, const char *mode)
|
||||
{
|
||||
|
@ -37,6 +38,7 @@ static inline FILE *fopen_at(int dir, const char *filename,
|
|||
|
||||
return fdopen(fd, mode);
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline int is_same_inode(const int fd, const struct stat *st)
|
||||
{
|
||||
|
|
|
@ -17,11 +17,9 @@ libcommon_la_SOURCES = \
|
|||
lib/md5.c \
|
||||
lib/pager.c \
|
||||
lib/path.c \
|
||||
lib/procutils.c \
|
||||
lib/randutils.c \
|
||||
lib/setproctitle.c \
|
||||
lib/strutils.c \
|
||||
lib/sysfs.c \
|
||||
lib/timeutils.c \
|
||||
lib/ttyutils.c \
|
||||
lib/exec_shell.c \
|
||||
|
@ -41,6 +39,10 @@ if HAVE_CPU_SET_T
|
|||
libcommon_la_SOURCES += lib/cpuset.c
|
||||
endif
|
||||
|
||||
if HAVE_OPENAT
|
||||
libcommon_la_SOURCES += lib/procutils.c
|
||||
libcommon_la_SOURCES += lib/sysfs.c
|
||||
endif
|
||||
|
||||
noinst_LTLIBRARIES += libtcolors.la
|
||||
libtcolors_la_CFLAGS = $(AM_CFLAGS) $(TINFO_CFLAGS)
|
||||
|
@ -57,14 +59,12 @@ check_PROGRAMS += \
|
|||
test_fileutils \
|
||||
test_ismounted \
|
||||
test_mangle \
|
||||
test_procutils \
|
||||
test_randutils \
|
||||
test_strutils \
|
||||
test_ttyutils
|
||||
|
||||
|
||||
|
||||
|
||||
if LINUX
|
||||
if HAVE_CPU_SET_T
|
||||
check_PROGRAMS += test_cpuset
|
||||
|
@ -74,6 +74,10 @@ check_PROGRAMS += \
|
|||
test_pager
|
||||
endif
|
||||
|
||||
if HAVE_OPENAT
|
||||
check_PROGRAMS += test_procutils
|
||||
endif
|
||||
|
||||
test_ttyutils_SOURCES = lib/ttyutils.c
|
||||
test_ttyutils_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM
|
||||
test_ttyutils_LDADD = $(LDADD) libcommon.la
|
||||
|
@ -99,8 +103,10 @@ test_colors_LDADD = $(LDADD) $(TINFO_LIBS)
|
|||
test_randutils_SOURCES = lib/randutils.c
|
||||
test_randutils_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM
|
||||
|
||||
if HAVE_OPENAT
|
||||
test_procutils_SOURCES = lib/procutils.c
|
||||
test_procutils_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM
|
||||
endif
|
||||
|
||||
if LINUX
|
||||
test_cpuset_SOURCES = lib/cpuset.c
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
|
||||
check_PROGRAMS += \
|
||||
sample-scols-tree \
|
||||
sample-scols-title \
|
||||
sample-scols-wrap \
|
||||
sample-scols-continuous
|
||||
|
@ -9,9 +8,12 @@ sample_scols_cflags = $(AM_CFLAGS) $(NO_UNUSED_WARN_CFLAGS) \
|
|||
-I$(ul_libsmartcols_incdir)
|
||||
sample_scols_ldadd = $(LDADD) libsmartcols.la
|
||||
|
||||
if HAVE_OPENAT
|
||||
check_PROGRAMS += sample-scols-tree
|
||||
sample_scols_tree_SOURCES = libsmartcols/samples/tree.c
|
||||
sample_scols_tree_LDADD = $(sample_scols_ldadd) libcommon.la
|
||||
sample_scols_tree_CFLAGS = $(sample_scols_cflags)
|
||||
endif
|
||||
|
||||
sample_scols_title_SOURCES = libsmartcols/samples/title.c
|
||||
sample_scols_title_LDADD = $(sample_scols_ldadd)
|
||||
|
|
Loading…
Reference in New Issue