[lxc-devel] [lxcfs/master] autotools: cleanup

brauner on Github lxc-bot at linuxcontainers.org
Wed Mar 4 21:57:43 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 365 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200304/a8b5a9f0/attachment-0001.bin>
-------------- next part --------------
From 38ea5f47bfffeaffb6d0c7ee82f531d31be3aced Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Wed, 4 Mar 2020 22:57:02 +0100
Subject: [PATCH] autotools: cleanup

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 Makefile.am                | 11 ++++---
 bootstrap.sh               | 10 +++---
 configure.ac               | 66 +++++++++++++++++++++++++-------------
 doc/Makefile.am            |  9 ++++++
 {man => doc}/lxcfs.man.add |  0
 src/Makefile.am            | 38 ----------------------
 6 files changed, 64 insertions(+), 70 deletions(-)
 create mode 100644 doc/Makefile.am
 rename {man => doc}/lxcfs.man.add (100%)

diff --git a/Makefile.am b/Makefile.am
index 1aa2052..0c0ae0b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,10 @@
-# Makefile.am
-
 ACLOCAL_AMFLAGS = -I m4
 
 LIBTOOL_DEPS = @LIBTOOL_DEPS@
-SUBDIRS = config share src tests 
-DIST_SUBDIRS = config share src tests 
+SUBDIRS = config share src tests doc
+DIST_SUBDIRS = config share src tests doc
+
+EXTRA_DIST = lxcfs.spec
+
+libtool: $(LIBTOOL_DEPS)
+	$(SHELL) ./config.status libtool
diff --git a/bootstrap.sh b/bootstrap.sh
index cb1d21d..c5701b0 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -25,8 +25,8 @@ set -x
 set -e
 
 test -d autom4te.cache && rm -rf autom4te.cache
-aclocal -I m4
-libtoolize
-autoheader
-autoconf
-automake --add-missing --copy
+libtoolize || exit 1
+aclocal -I m4 || exit 1
+autoheader || exit 1
+autoconf || exit 1
+automake --add-missing --copy || exit 1
diff --git a/configure.ac b/configure.ac
index 082f1f8..0633684 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,43 +1,65 @@
-# Process this file with autoconf to produce a configure script.
-
 AC_PREREQ([2.69])
+
 AC_INIT([lxcfs], [3.1.2], [lxc-devel at lists.linuxcontainers.org])
-AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
-AC_CONFIG_MACRO_DIR([m4])
+
+# We need pkg-config
+PKG_PROG_PKG_CONFIG
+
+AC_CONFIG_SRCDIR([configure.ac])
 AC_CONFIG_AUX_DIR([config])
 AC_CONFIG_HEADERS([config.h])
-AC_CONFIG_SRCDIR([configure.ac])
 
-AM_INIT_AUTOMAKE([subdir-objects -Wno-portability])
+AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
+AC_CONFIG_MACRO_DIR([m4])
+AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability subdir-objects])
+AC_CANONICAL_HOST
+AM_PROG_CC_C_O
+AC_USE_SYSTEM_EXTENSIONS
+
+# Test if we have a new enough compiler.
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#define GCC_VERSION \
+	(__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
+
+#define CLANG_VERSION \
+	(__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
+
+#if GCC_VERSION < 40700 && CLANG_VERSION < 10000
+#error Sorry, your compiler is too old - please upgrade it
+#endif
+	]])], [valid_compiler=yes], [valid_compiler=no])
+if test "x$valid_compiler" = "xno"; then
+	AC_MSG_ERROR([Sorry, your compiler is too old - please upgrade it])
+fi
+
+# libtool
+LT_INIT
+AC_SUBST([LIBTOOL_DEPS])
 
-AC_GNU_SOURCE
 AC_CONFIG_FILES([
 	Makefile
 	lxcfs.spec
+
 	config/Makefile
 	config/init/Makefile
 	config/init/systemd/Makefile
 	config/init/systemd/lxcfs.service
 	config/init/sysvinit/Makefile
 	config/init/upstart/Makefile
+
+	doc/Makefile
+
 	share/Makefile
 	share/00-lxcfs.conf
 	share/lxc.mount.hook
 	share/lxc.reboot.hook
+
 	src/Makefile
-	tests/Makefile ])
 
-LT_INIT
-AC_PROG_CC_C99
-AC_CANONICAL_HOST
-AM_PROG_CC_C_O
-AC_USE_SYSTEM_EXTENSIONS
+	tests/Makefile ])
 
 AC_CHECK_LIB(pthread, main)
 
-# We need pkg-config
-PKG_PROG_PKG_CONFIG
-
 PKG_CHECK_MODULES(FUSE, fuse)
 
 AC_PATH_PROG(HELP2MAN, help2man, false // No help2man //)
@@ -61,6 +83,7 @@ AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO], [Specify the Linux di
 if type lsb_release >/dev/null 2>&1 && test "z$with_distro" = "z"; then
 	with_distro=`lsb_release -is`
 fi
+
 if test "z$with_distro" = "z"; then
 	AC_CHECK_FILE(/etc/redhat-release,with_distro="redhat")
 	AC_CHECK_FILE(/etc/oracle-release,with_distro="oracle")
@@ -77,11 +100,13 @@ if test "z$with_distro" = "z"; then
 	AC_CHECK_FILE(/etc/pardus-release,with_distro="pardus")
 	AC_CHECK_FILE(/etc/pld-release,with_distro="pld")
 fi
+
 with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]'`
 
 if test "z$with_distro" = "z"; then
 	with_distro="unknown"
 fi
+
 case $with_distro in
 	ubuntu)
 		distroconf=default.conf.ubuntu
@@ -93,6 +118,7 @@ case $with_distro in
 		distroconf=default.conf.unknown
 		;;
 esac
+
 AC_MSG_RESULT([$with_distro])
 AM_CONDITIONAL([HAVE_DEBIAN], [test x"$with_distro" = "xdebian" -o x"$with_distro" = "xubuntu"])
 AM_CONDITIONAL([DISTRO_UBUNTU], [test "x$with_distro" = "xubuntu"])
@@ -174,18 +200,12 @@ AC_CHECK_FUNCS([strlcpy],
 	AM_CONDITIONAL(HAVE_STRLCPY, true)
 	AC_DEFINE(HAVE_STRLCPY,1,[Have strlcpy]),
 	AM_CONDITIONAL(HAVE_STRLCPY, false))
+
 AC_CHECK_FUNCS([strlcat],
 	AM_CONDITIONAL(HAVE_STRLCAT, true)
 	AC_DEFINE(HAVE_STRLCAT,1,[Have strlcat]),
 	AM_CONDITIONAL(HAVE_STRLCAT, false))
 
-AC_CHECK_TYPES([struct clone_args], [], [], [[#include <linux/sched.h>]])
-
-AC_CHECK_FUNCS([clone3],
-	AM_CONDITIONAL(HAVE_CLONE3, true)
-	AC_DEFINE(HAVE_CLONE3,1,[Supports clone3]),
-	AM_CONDITIONAL(HAVE_CLONE3, false))
-
 AC_CHECK_FUNCS([pidfd_open],
 	AM_CONDITIONAL(HAVE_PIDFD_OPEN, true)
 	AC_DEFINE(HAVE_PIDFD_OPEN,1,[Supports pidfd_open]),
diff --git a/doc/Makefile.am b/doc/Makefile.am
new file mode 100644
index 0000000..9248937
--- /dev/null
+++ b/doc/Makefile.am
@@ -0,0 +1,9 @@
+EXTRA_DIST = lxcfs.man.add \
+	     lxcfs.1
+
+if HAVE_HELP2MAN
+man_MANS = lxcfs.1
+
+lxcfs.1: ../src/lxcfs lxcfs.man.add
+	$(HELP2MAN) -n "System virtualization filesystem for containers" --no-discard-stderr -s 1 -I lxcfs.man.add -N ../src/lxcfs > lxcfs.1
+endif
diff --git a/man/lxcfs.man.add b/doc/lxcfs.man.add
similarity index 100%
rename from man/lxcfs.man.add
rename to doc/lxcfs.man.add
diff --git a/src/Makefile.am b/src/Makefile.am
index 3cf4a94..84c6528 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -88,16 +88,6 @@ lxcfs_CFLAGS = $(AM_CFLAGS)
 lxcfs_LDFLAGS = $(AM_LDFLAGS)
 bin_PROGRAMS = lxcfs
 
-EXTRA_DIST = $(top_srcdir)/man/lxcfs.man.add $(top_srcdir)/lxcfs.spec
-
-if HAVE_HELP2MAN
-
-dist_man_MANS = $(top_srcdir)/man/lxcfs.1
-
-lxcfs.1: lxcfs $(top_srcdir)/man/lxcfs.man.add
-	$(HELP2MAN) -n "System virtualization filesystem for containers" --no-discard-stderr -s 1 -I $(top_srcdir)/man/lxcfs.man.add -N ./lxcfs > $(top_srcdir)/man/lxcfs.1
-endif
-
 TEST_READ: tests/test-read.c
 	$(CC) -o tests/test-read \
 		tests/test-read.c
@@ -109,31 +99,3 @@ TEST_SYSCALLS: tests/test_syscalls.c
 	$(CC) -o tests/test_syscalls \
 		tests/test_syscalls.c
 tests: TEST_READ TEST_CPUSET TEST_SYSCALLS
-
-distclean:
-	rm -rf .deps/ \
-		INSTALL \
-		Makefile \
-		Makefile.in \
-		aclocal.m4 \
-		autom4te.cache/ \
-		compile \
-		config.guess \
-		config.h \
-		config.h.in \
-		config.log \
-		config.status \
-		config.sub \
-		configure \
-		depcomp \
-		install-sh \
-		libtool \
-		ltmain.sh \
-		lxcfs \
-		../man/lxcfs.1 \
-		lxcfs.o \
-		m4/ \
-		missing \
-		stamp-h1 \
-		tests/test_syscalls \
-		*.lo *.la


More information about the lxc-devel mailing list