All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/7] lscpu: fix shadow declaration [smatch scan]
@ 2013-07-28 21:11 Sami Kerola
  2013-07-28 21:11 ` [PATCH 2/7] setarch: prefer preprocessor rather than autotools check Sami Kerola
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Sami Kerola @ 2013-07-28 21:11 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

sys-utils/lscpu.c:572:22: warning: symbol 'fd' shadows an earlier one

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 sys-utils/lscpu.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index fbaaa31..98cee16 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -569,15 +569,15 @@ read_hypervisor(struct lscpu_desc *desc, struct lscpu_modifier *mod)
 
 	/* IBM PR/SM */
 	} else if (path_exist(_PATH_PROC_SYSINFO)) {
-		FILE *fd = path_fopen("r", 0, _PATH_PROC_SYSINFO);
+		FILE *sysinfo_fd = path_fopen("r", 0, _PATH_PROC_SYSINFO);
 		char buf[BUFSIZ];
 
-		if (!fd)
+		if (!sysinfo_fd)
 			return;
 		desc->hyper = HYPER_IBM;
 		desc->hypervisor = "PR/SM";
 		desc->virtype = VIRT_FULL;
-		while (fgets(buf, sizeof(buf), fd) != NULL) {
+		while (fgets(buf, sizeof(buf), sysinfo_fd) != NULL) {
 			char *str;
 
 			if (!strstr(buf, "Control Program:"))
@@ -601,7 +601,7 @@ read_hypervisor(struct lscpu_desc *desc, struct lscpu_modifier *mod)
 			while ((str = strstr(desc->hypervisor, "  ")))
 				memmove(str, str + 1, strlen(str));
 		}
-		fclose(fd);
+		fclose(sysinfo_fd);
 	}
 
 	/* OpenVZ/Virtuozzo - /proc/vz dir should exist
-- 
1.8.3.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/7] setarch: prefer preprocessor rather than autotools check
  2013-07-28 21:11 [PATCH 1/7] lscpu: fix shadow declaration [smatch scan] Sami Kerola
@ 2013-07-28 21:11 ` Sami Kerola
  2013-07-28 21:11 ` [PATCH 3/7] build-sys: use m4 quoting consistently Sami Kerola
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Sami Kerola @ 2013-07-28 21:11 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

It seems to be pointless to spend time in ./configure phase when
preprocessor has to perform #ifndef check anyway.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 configure.ac        | 12 ------------
 sys-utils/setarch.c | 22 +++++++++++-----------
 2 files changed, 11 insertions(+), 23 deletions(-)

diff --git a/configure.ac b/configure.ac
index 398aaf0..006de93 100644
--- a/configure.ac
+++ b/configure.ac
@@ -252,18 +252,6 @@ AC_CHECK_MEMBERS([struct termios.c_line],,,
 AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec],,,
 	[#include <sys/stat.h>])
 
-AC_CHECK_DECLS([
- UNAME26,
- ADDR_NO_RANDOMIZE,
- FDPIC_FUNCPTRS,
- MMAP_PAGE_ZERO,
- ADDR_COMPAT_LAYOUT,
- READ_IMPLIES_EXEC,
- ADDR_LIMIT_32BIT,
- WHOLE_SECONDS,
- STICKY_TIMEOUTS,
- ADDR_LIMIT_3GB], [], [], [#include <linux/personality.h>])
-
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
 [[
 #ifdef HAVE_SYS_SWAP_H
diff --git a/sys-utils/setarch.c b/sys-utils/setarch.c
index 051cbef..99724c6 100644
--- a/sys-utils/setarch.c
+++ b/sys-utils/setarch.c
@@ -53,37 +53,37 @@ enum {
 	} while(0)
 
 
-#if !HAVE_DECL_UNAME26
+#ifndef UNAME26
 # define UNAME26                 0x0020000
 #endif
-#if !HAVE_DECL_ADDR_NO_RANDOMIZE
+#ifndef ADDR_NO_RANDOMIZE
 # define ADDR_NO_RANDOMIZE       0x0040000
 #endif
-#if !HAVE_DECL_FDPIC_FUNCPTRS
+#ifndef FDPIC_FUNCPTRS
 # define FDPIC_FUNCPTRS          0x0080000
 #endif
-#if !HAVE_DECL_MMAP_PAGE_ZERO
+#ifndef MMAP_PAGE_ZERO
 # define MMAP_PAGE_ZERO          0x0100000
 #endif
-#if !HAVE_DECL_ADDR_COMPAT_LAYOUT
+#ifndef ADDR_COMPAT_LAYOUT
 # define ADDR_COMPAT_LAYOUT      0x0200000
 #endif
-#if !HAVE_DECL_READ_IMPLIES_EXEC
+#ifndef READ_IMPLIES_EXEC
 # define READ_IMPLIES_EXEC       0x0400000
 #endif
-#if !HAVE_DECL_ADDR_LIMIT_32BIT
+#ifndef ADDR_LIMIT_32BIT
 # define ADDR_LIMIT_32BIT        0x0800000
 #endif
-#if !HAVE_DECL_SHORT_INODE
+#ifndef SHORT_INODE
 # define SHORT_INODE             0x1000000
 #endif
-#if !HAVE_DECL_WHOLE_SECONDS
+#ifndef WHOLE_SECONDS
 # define WHOLE_SECONDS           0x2000000
 #endif
-#if !HAVE_DECL_STICKY_TIMEOUTS
+#ifndef STICKY_TIMEOUTS
 # define STICKY_TIMEOUTS         0x4000000
 #endif
-#if !HAVE_DECL_ADDR_LIMIT_3GB
+#ifndef ADDR_LIMIT_3GB
 # define ADDR_LIMIT_3GB          0x8000000
 #endif
 
-- 
1.8.3.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/7] build-sys: use m4 quoting consistently
  2013-07-28 21:11 [PATCH 1/7] lscpu: fix shadow declaration [smatch scan] Sami Kerola
  2013-07-28 21:11 ` [PATCH 2/7] setarch: prefer preprocessor rather than autotools check Sami Kerola
@ 2013-07-28 21:11 ` Sami Kerola
  2013-07-28 21:11 ` [PATCH 4/7] build-sys: prefer AS_CASE rather than shell 'case' Sami Kerola
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Sami Kerola @ 2013-07-28 21:11 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 configure.ac | 400 +++++++++++++++++++++++++++++------------------------------
 1 file changed, 200 insertions(+), 200 deletions(-)

diff --git a/configure.ac b/configure.ac
index 006de93..fc45a5e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,11 +1,11 @@
-AC_INIT(util-linux,
+AC_INIT([util-linux],
 	m4_esyscmd([tools/git-version-gen .tarball-version]),
 	[kzak@redhat.com],,
 	[http://www.kernel.org/pub/linux/utils/util-linux/])
 
-AC_PREREQ(2.60)
+AC_PREREQ([2.60])
 
-AC_CONFIG_AUX_DIR(config)
+AC_CONFIG_AUX_DIR([config])
 AC_CONFIG_MACRO_DIR([m4])
 dnl AC_USE_SYSTEM_EXTENSIONS must be called before any macros that run
 dnl the compiler (like AC_PROG_LIBTOOL) to avoid autoconf errors.
@@ -15,7 +15,7 @@ AM_INIT_AUTOMAKE([-Wall foreign 1.10 tar-pax dist-bzip2 no-dist-gzip dist-xz -Wn
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
 			    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
 
-AC_CONFIG_SRCDIR(sys-utils/mount.c)
+AC_CONFIG_SRCDIR([sys-utils/mount.c])
 AC_PREFIX_DEFAULT([/usr])
 
 dnl version details from <major>.<minor>[-<suffix>]
@@ -120,7 +120,7 @@ UL_WARN_ADD([-Wstrict-prototypes])
 UL_WARN_ADD([-Wformat-security])
 AC_SUBST([WARN_CFLAGS])
 
-UL_WARN_ADD([-Wno-clobbered], BSD_WARN_CFLAGS)
+UL_WARN_ADD([-Wno-clobbered], [BSD_WARN_CFLAGS])
 AC_SUBST([BSD_WARN_CFLAGS])
 
 dnl libtool-2
@@ -143,18 +143,18 @@ case ${host_os} in
     linux_os=yes
     ;;
 esac
-AM_CONDITIONAL([LINUX], test "x$linux_os" = xyes)
+AM_CONDITIONAL([LINUX], [test "x$linux_os" = xyes])
 
 dnl define ARCH_<NAME> conditionals
-UL_SET_ARCH(I86, i?86-*)
-UL_SET_ARCH(86_64, x86_64*)
-UL_SET_ARCH(IA64, ia64*)
-UL_SET_ARCH(S390, s390*)
-UL_SET_ARCH(SPARC, sparc*)
-UL_SET_ARCH(PPC, ppc*|powerpc*)
-UL_SET_ARCH(M68K, m68*)
-UL_SET_ARCH(MIPS, mips*)
-UL_SET_ARCH(HPPA, hppa*)
+UL_SET_ARCH([I86], [i?86-*])
+UL_SET_ARCH([86_64], [x86_64*])
+UL_SET_ARCH([IA64], [ia64*])
+UL_SET_ARCH([S390], [s390*])
+UL_SET_ARCH([SPARC], [sparc*])
+UL_SET_ARCH([PPC], [ppc*|powerpc*])
+UL_SET_ARCH([M68K], [m68*])
+UL_SET_ARCH([MIPS], [mips*])
+UL_SET_ARCH([HPPA], [hppa*])
 
 AC_SYS_LARGEFILE
 
@@ -243,7 +243,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
     if (a == -1)  /* false */
 	sleep(tm->tm_gmtoff);
 ]])],
-[AC_DEFINE(HAVE_TM_GMTOFF,1,[Does struct tm have a field tm_gmtoff?])
+[AC_DEFINE([HAVE_TM_GMTOFF], [1], [Does struct tm have a field tm_gmtoff?])
 ])
 
 AC_CHECK_MEMBERS([struct termios.c_line],,,
@@ -260,7 +260,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
 #include <unistd.h>
 ]],
 [[swapon("/dev/null", 0);]])],
-[AC_DEFINE(SWAPON_HAS_TWO_ARGS, 1, [Is swapon() declared with two parameters?])
+[AC_DEFINE([SWAPON_HAS_TWO_ARGS], [1], [Is swapon() declared with two parameters?])
 ],
 [AC_MSG_NOTICE([Your libc thinks that swapon has 1 arg only.])
 ])
@@ -269,13 +269,13 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
 AC_CHECK_DECLS([_NL_TIME_WEEK_1STDAY],[],[],[[#include <langinfo.h>]])
 
 AC_CHECK_DECL([llseek],
-	[AC_DEFINE(HAVE_LLSEEK_PROTOTYPE, 1,
+	[AC_DEFINE([HAVE_LLSEEK_PROTOTYPE], [1],
 			[Define to 1 if have llseek prototype])],
 	[],
 	[#include <unistd.h>])
 
 AC_CHECK_DECL([lseek64],
-	[AC_DEFINE(HAVE_LSEEK64_PROTOTYPE, 1,
+	[AC_DEFINE([HAVE_LSEEK64_PROTOTYPE], [1],
 			[Define to 1 if have lseek64 prototype])],
 	[],
 	[#define _LARGEFILE_SOURCE
@@ -283,12 +283,12 @@ AC_CHECK_DECL([lseek64],
 	 #include <unistd.h>])
 
 AC_CHECK_DECL([environ],
-	[AC_DEFINE(HAVE_ENVIRON_DECL, 1,
+	[AC_DEFINE([HAVE_ENVIRON_DECL], [1],
 		[Define to 1 if have **environ prototype])],
 )
 
 AC_CHECK_DECL([strsignal],
-	[AC_DEFINE(HAVE_STRSIGNAL_DECL, 1,
+	[AC_DEFINE([HAVE_STRSIGNAL_DECL], [1],
 		[Define to 1 if have strsignal function prototype])],
 )
 
@@ -336,8 +336,8 @@ AC_FUNC_FSEEKO
 AC_CHECK_FUNCS([openat fstatat unlinkat], [have_openat=yes], [have_openat=no])
 AC_CHECK_FUNCS([ioperm iopl], [have_io=yes])
 
-AC_CHECK_MEMBER(struct sockaddr.sa_len,
-		AC_DEFINE_UNQUOTED(HAVE_SA_LEN,1,[Define if struct sockaddr contains sa_len]),,
+AC_CHECK_MEMBER([struct sockaddr.sa_len],
+		AC_DEFINE_UNQUOTED([HAVE_SA_LEN], [1], [Define if struct sockaddr contains sa_len]), [],
 	[#include <sys/types.h>
 	 #include <sys/socket.h>])
 
@@ -389,9 +389,9 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 AC_MSG_CHECKING([whether __progname is defined])
 AC_LINK_IFELSE([AC_LANG_PROGRAM([extern char *__progname;],
 	   [if (*__progname == 0) return;])],
-	   AC_DEFINE(HAVE___PROGNAME, 1, [Define if __progname is defined])
-	   AC_MSG_RESULT(yes),
-	   AC_MSG_RESULT(no))
+	   AC_DEFINE([HAVE___PROGNAME], [1], [Define if __progname is defined])
+	   AC_MSG_RESULT([yes]),
+	   AC_MSG_RESULT([no]))
 
 dnl Static compilation
 m4_define([UL_STATIC_PROGRAMS], [losetup, mount, umount, fdisk, sfdisk, blkid])
@@ -402,7 +402,7 @@ AC_ARG_ENABLE([static-programs],
       supported for ]m4_defn([UL_STATIC_PROGRAMS])[)])])
 
 case $enable_static_programs in
-yes) enable_static_programs=m4_quote(UL_STATIC_PROGRAMS) ;;
+yes) enable_static_programs=m4_quote([UL_STATIC_PROGRAMS]) ;;
 no) enable_static_programs= ;;
 esac
 
@@ -475,13 +475,13 @@ as)
   ;;
 esac
 
-UL_CHECK_LIB(util, openpty)
-UL_CHECK_LIB(termcap, tgetnum)
+UL_CHECK_LIB([util], [openpty])
+UL_CHECK_LIB([termcap], [tgetnum])
 
 AC_CHECK_TYPES([union semun], [], [], [[
 #include <sys/sem.h>
 ]])
-AC_CHECK_TYPES(loff_t)
+AC_CHECK_TYPES([loff_t])
 
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 #include <wchar.h>
@@ -495,14 +495,14 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
   wc = w;
   fputwc(wc,stdout);
 ]])],
-[AC_DEFINE(HAVE_WIDECHAR,1,Do we have wide character support?)
+[AC_DEFINE([HAVE_WIDECHAR], [1], [Do we have wide character support?])
 ])
 
 AC_CHECK_TYPES([cpu_set_t], [have_cpu_set_t=yes], [], [[
 #include <sched.h>
 ]])
 
-AM_CONDITIONAL(HAVE_CPU_SET_T, [test "x$have_cpu_set_t" = xyes])
+AM_CONDITIONAL([HAVE_CPU_SET_T], [test "x$have_cpu_set_t" = xyes])
 
 AC_CHECK_DECLS([CPU_ALLOC], [], [], [[
 #include <sched.h>
@@ -533,27 +533,27 @@ char *c = crypt("abc","pw");
   ]], [[
   char *c = crypt("abc","pw");
   ]])],[
-  AC_DEFINE(HAVE_LIBCRYPT, 1, [Do we need -lcrypt?])
+  AC_DEFINE([HAVE_LIBCRYPT], [1], [Do we need -lcrypt?])
   have_libcrypt=yes
   ],[
   AC_MSG_ERROR([crypt() is not available])
   ])
 ])
-AM_CONDITIONAL(HAVE_LIBCRYPT, test "x$have_libcrypt" = xyes)
+AM_CONDITIONAL([HAVE_LIBCRYPT], [test "x$have_libcrypt" = xyes])
 
 
 AC_ARG_WITH([selinux],
   AS_HELP_STRING([--with-selinux], [compile with SELinux support]),
-  [], with_selinux=no
+  [], [with_selinux=no]
 )
 
 if test "x$with_selinux" = xno; then
-  AM_CONDITIONAL(HAVE_SELINUX, false)
+  AM_CONDITIONAL([HAVE_SELINUX], [false])
 else
   PKG_CHECK_MODULES([SELINUX], [libselinux >= 2.0],
-	[AC_DEFINE(HAVE_LIBSELINUX, 1, [Define if SELinux is available])
+	[AC_DEFINE([HAVE_LIBSELINUX], [1], [Define if SELinux is available])
 	 UL_PKG_STATIC([SELINUX_LIBS_STATIC], [libselinux])
-	 AM_CONDITIONAL(HAVE_SELINUX, true)
+	 AM_CONDITIONAL([HAVE_SELINUX], [true])
 	 have_selinux=yes],
 	[have_selinux=no])
 
@@ -573,13 +573,13 @@ AC_SUBST([SELINUX_LIBS_STATIC])
 
 AC_ARG_WITH([audit],
   AS_HELP_STRING([--with-audit], [compile with audit support]),
-  [], with_audit=no
+  [], [with_audit=no]
 )
 
 if test "x$with_audit" = xno; then
-  AM_CONDITIONAL(HAVE_AUDIT, false)
+  AM_CONDITIONAL([HAVE_AUDIT], [false])
 else
-  UL_CHECK_LIB(audit, audit_log_user_message)
+  UL_CHECK_LIB([audit], [audit_log_user_message])
   case "$with_audit:$have_audit" in
   yes:no)
    AC_MSG_ERROR([Audit selected but libaudit not found (or does not support audit_log_user_message())])
@@ -588,13 +588,13 @@ else
 fi
 
 AC_ARG_WITH([udev], AS_HELP_STRING([--without-udev], [compile without udev support]),
-  [], with_udev=auto
+  [], [with_udev=auto]
 )
 
 if test "x$with_udev" = xno; then
-  AM_CONDITIONAL(HAVE_UDEV, false)
+  AM_CONDITIONAL([HAVE_UDEV], [false])
 else
-  UL_CHECK_LIB(udev, udev_new)
+  UL_CHECK_LIB([udev], [udev_new])
   case "$with_udev:$have_udev" in
   yes:no)
    AC_MSG_ERROR([udev selected but libudev not found])
@@ -605,15 +605,15 @@ fi
 AC_ARG_WITH([ncurses],
   AS_HELP_STRING([--with-ncurses], [build with non-wide ncurses, default is wide version
 				    (--without-ncurses disables all ncurses(w) support)]),
-  [], with_ncurses=auto
+  [], [with_ncurses=auto]
 )
-AM_CONDITIONAL(HAVE_NCURSES, false)
+AM_CONDITIONAL([HAVE_NCURSES], [false])
 
 if test "x$with_ncurses" != xno; then
   have_ncurses=no
   AC_CHECK_HEADERS([ncurses.h ncurses/ncurses.h], [
     if test "x$with_ncurses" = xauto; then
-      UL_CHECK_LIB(ncursesw, initscr, ncurses)
+      UL_CHECK_LIB([ncursesw], [initscr], [ncurses])
       if test "x$have_ncurses" = xyes; then
 	AC_CHECK_HEADERS([ncursesw/ncurses.h])
 	NCURSES_LIBS="-lncursesw"
@@ -635,7 +635,7 @@ AC_SUBST([NCURSES_LIBS])
 
 AC_ARG_WITH([slang],
   AS_HELP_STRING([--with-slang], [compile cfdisk with slang]),
-  [], with_slang=no
+  [], [with_slang=no]
 )
 have_slang=no
 if test "x$with_slang" = xyes; then
@@ -652,35 +652,35 @@ if test "x$with_slang" = xyes; then
     AC_MSG_ERROR([slang selected but slcurses.h not found])
   fi
 fi
-AM_CONDITIONAL(HAVE_SLANG, test "x$have_slang" = xyes)
+AM_CONDITIONAL([HAVE_SLANG], [test "x$have_slang" = xyes])
 
 
-AM_CONDITIONAL(BUILD_CFDISK, test "x$have_slang" = xyes -o "x$have_ncurses" = xyes)
+AM_CONDITIONAL([BUILD_CFDISK], [test "x$have_slang" = xyes -o "x$have_ncurses" = xyes])
 
 
 have_tinfo=no
-AC_CHECK_LIB(tinfo, tgetent, [have_tinfo=yes])
-AM_CONDITIONAL(HAVE_TINFO, test "x$have_tinfo" = xyes)
+AC_CHECK_LIB([tinfo], [tgetent], [have_tinfo=yes])
+AM_CONDITIONAL([HAVE_TINFO], [test "x$have_tinfo" = xyes])
 
 
 AC_ARG_WITH([utempter],
   AS_HELP_STRING([--with-utempter], [compile script(1) with libutempter]),
-  [], with_utempter=no
+  [], [with_utempter=no]
 )
 
 if test "x$with_utempter" = xyes; then
-  UL_CHECK_LIB(utempter, utempter_add_record)
+  UL_CHECK_LIB([utempter], [utempter_add_record])
   if test "x$have_utempter" = xno; then
     AC_MSG_ERROR([utempter selected but libutempter not found])
   fi
 else
-  AM_CONDITIONAL(HAVE_UTEMPTER, false)
+  AM_CONDITIONAL([HAVE_UTEMPTER], [false])
 fi
 
 
 AC_ARG_ENABLE([most-builds],
   AS_HELP_STRING([--enable-most-builds], [build everything other than experimental code]),
-  [], enable_most_builds=no
+  [], [enable_most_builds=no]
 )
 if test "x$enable_most_builds" = xyes; then
   enable_chfn_chsh=yes
@@ -701,7 +701,7 @@ dnl libuuid
 dnl
 AC_ARG_ENABLE([libuuid],
   AS_HELP_STRING([--disable-libuuid], [do not build libuuid and uuid utilities]),
-  [], enable_libuuid=yes
+  [], [enable_libuuid=yes]
 )
 UL_BUILD_INIT([libuuid])
 AC_SUBST([LIBUUID_VERSION])
@@ -719,37 +719,37 @@ dnl libblkid
 dnl
 AC_ARG_ENABLE([libblkid],
   AS_HELP_STRING([--disable-libblkid], [do not build libblkid and many related utilities]),
-  [], enable_libblkid=yes
+  [], [enable_libblkid=yes]
 )
 UL_BUILD_INIT([libblkid])
 AC_SUBST([LIBBLKID_DATE])
 AC_SUBST([LIBBLKID_VERSION])
 AC_SUBST([LIBBLKID_VERSION_INFO])
-AC_DEFINE_UNQUOTED(LIBBLKID_VERSION, "$LIBBLKID_VERSION", [libblkid version string])
-AC_DEFINE_UNQUOTED(LIBBLKID_DATE, "$LIBBLKID_DATE", [libblkid date string])
+AC_DEFINE_UNQUOTED([LIBBLKID_VERSION], ["$LIBBLKID_VERSION"], [libblkid version string])
+AC_DEFINE_UNQUOTED([LIBBLKID_DATE], ["$LIBBLKID_DATE"], [libblkid date string])
 if test "x$build_libblkid" = xyes; then
-  AC_DEFINE(HAVE_LIBBLKID, 1, [Define to 1 if you have the -lblkid.])
+  AC_DEFINE([HAVE_LIBBLKID], [1], [Define to 1 if you have the -lblkid.])
 fi
-AM_CONDITIONAL(BUILD_LIBBLKID, test "x$build_libblkid" = xyes)
-AM_CONDITIONAL(BUILD_LIBBLKID_TESTS, test "x$build_libblkid" = xyes -a "x$enable_static" = xyes)
+AM_CONDITIONAL([BUILD_LIBBLKID], [test "x$build_libblkid" = xyes])
+AM_CONDITIONAL([BUILD_LIBBLKID_TESTS], [test "x$build_libblkid" = xyes -a "x$enable_static" = xyes])
 
 dnl
 dnl libmount
 dnl
 AC_ARG_ENABLE([libmount],
   AS_HELP_STRING([--disable-libmount], [do not build libmount]),
-  [], enable_libmount=check
+  [], [enable_libmount=check]
 )
 UL_BUILD_INIT([libmount])
 UL_REQUIRES_LINUX([libmount])
 UL_REQUIRES_BUILD([libmount], [libblkid])
 UL_REQUIRES_HAVE([libmount], [scanf_alloc_modifier], [scanf string alloc modifier])
-AM_CONDITIONAL(BUILD_LIBMOUNT, test "x$build_libmount" = xyes)
-AM_CONDITIONAL(BUILD_LIBMOUNT_TESTS, test "x$build_libmount" = xyes -a "x$enable_static" = xyes)
+AM_CONDITIONAL([BUILD_LIBMOUNT], [test "x$build_libmount" = xyes])
+AM_CONDITIONAL([BUILD_LIBMOUNT_TESTS], [test "x$build_libmount" = xyes -a "x$enable_static" = xyes])
 
 AC_SUBST([LIBMOUNT_VERSION])
 AC_SUBST([LIBMOUNT_VERSION_INFO])
-AC_DEFINE_UNQUOTED(LIBMOUNT_VERSION, "$LIBMOUNT_VERSION", [libmount version string])
+AC_DEFINE_UNQUOTED([LIBMOUNT_VERSION], ["$LIBMOUNT_VERSION"], [libmount version string])
 
 
 dnl
@@ -757,99 +757,99 @@ dnl libfdisk is enabled all time if possible
 dnl
 UL_BUILD_INIT([libfdisk], [check])
 UL_REQUIRES_BUILD([libfdisk], [libuuid])
-AM_CONDITIONAL(BUILD_LIBFDISK, test "x$build_libfdisk" = xyes)
+AM_CONDITIONAL([BUILD_LIBFDISK], [test "x$build_libfdisk" = xyes])
 
 UL_BUILD_INIT([fdisk], [check])
 UL_REQUIRES_BUILD([fdisk], [libfdisk])
-AM_CONDITIONAL(BUILD_FDISK, test "x$build_fdisk" = xyes)
+AM_CONDITIONAL([BUILD_FDISK], [test "x$build_fdisk" = xyes])
 
 
 AC_ARG_ENABLE([deprecated-mount],
   AS_HELP_STRING([--enable-deprecated-mount], [build old mount utilities]),
-  [], enable_deprecated_mount=no
+  [], [enable_deprecated_mount=no]
 )
 UL_BUILD_INIT([deprecated_mount])
 UL_REQUIRES_LINUX([deprecated_mount])
 UL_REQUIRES_BUILD([deprecated_mount], [libblkid])
-AM_CONDITIONAL(BUILD_DEPRECATED_MOUNT, test "x$build_deprecated_mount" = xyes)
+AM_CONDITIONAL([BUILD_DEPRECATED_MOUNT], [test "x$build_deprecated_mount" = xyes])
 
 
 AC_ARG_ENABLE([mount],
   AS_HELP_STRING([--disable-mount], [do not build mount(8) and umount(8)]),
-  [], enable_mount=check
+  [], [enable_mount=check]
 )
 UL_BUILD_INIT([mount])
 UL_REQUIRES_BUILD([mount], [libmount])
 UL_CONFLICTS_BUILD([mount], [deprecated_mount], [old deprecated mount version])
-AM_CONDITIONAL(BUILD_MOUNT, test "x$build_mount" = xyes)
+AM_CONDITIONAL([BUILD_MOUNT], [test "x$build_mount" = xyes])
 
 
 AC_ARG_ENABLE([losetup],
   AS_HELP_STRING([--disable-losetup], [do not build losetup]),
-  [], enable_losetup=check
+  [], [enable_losetup=check]
 )
 UL_BUILD_INIT([losetup])
 UL_REQUIRES_LINUX([losetup])
-AM_CONDITIONAL(BUILD_LOSETUP, test "x$build_losetup" = xyes)
+AM_CONDITIONAL([BUILD_LOSETUP], [test "x$build_losetup" = xyes])
 
 
 AC_ARG_ENABLE([cytune],
   AS_HELP_STRING([--disable-cytune], [do not build cytune]),
-  [], enable_cytune=check
+  [], [enable_cytune=check]
 )
 UL_BUILD_INIT([cytune])
 UL_REQUIRES_LINUX([cytune])
-AM_CONDITIONAL(BUILD_CYTUNE, test "x$build_cytune" = xyes)
+AM_CONDITIONAL([BUILD_CYTUNE], [test "x$build_cytune" = xyes])
 
 
 AC_ARG_ENABLE([fsck],
   AS_HELP_STRING([--disable-fsck], [do not build fsck]),
-  [], enable_fsck=check
+  [], [enable_fsck=check]
 )
 UL_BUILD_INIT([fsck])
 UL_REQUIRES_BUILD([fsck], [libmount])
-AM_CONDITIONAL(BUILD_FSCK, test "x$build_fsck" = xyes)
+AM_CONDITIONAL([BUILD_FSCK], [test "x$build_fsck" = xyes])
 
 
 AC_ARG_ENABLE([partx],
   AS_HELP_STRING([--disable-partx], [do not build addpart, delpart, partx]),
-  [], enable_partx=check
+  [], [enable_partx=check]
 )
 UL_BUILD_INIT([partx])
 UL_REQUIRES_LINUX([partx])
 UL_REQUIRES_BUILD([partx], [libblkid])
-AM_CONDITIONAL(BUILD_PARTX, test "x$build_partx" = xyes)
+AM_CONDITIONAL([BUILD_PARTX], [test "x$build_partx" = xyes])
 
 
 AC_ARG_ENABLE([uuidd],
   AS_HELP_STRING([--disable-uuidd], [do not build the uuid daemon]),
-  [], enable_uuidd=check
+  [], [enable_uuidd=check]
 )
 UL_BUILD_INIT([uuidd])
 UL_REQUIRES_BUILD([uuidd], [libuuid])
 if test "x$build_uuidd" = xyes; then
-  AC_DEFINE(HAVE_UUIDD, 1, [Define to 1 if you want to use uuid daemon.])
+  AC_DEFINE([HAVE_UUIDD], [1], [Define to 1 if you want to use uuid daemon.])
 fi
-AM_CONDITIONAL(BUILD_UUIDD, test "x$build_uuidd" = xyes)
+AM_CONDITIONAL([BUILD_UUIDD], [test "x$build_uuidd" = xyes])
 
 
 AC_ARG_ENABLE([mountpoint],
   AS_HELP_STRING([--disable-mountpoint], [do not build mountpoint]),
-  [], enable_mountpoint=check
+  [], [enable_mountpoint=check]
 )
 UL_BUILD_INIT([mountpoint])
 UL_REQUIRES_BUILD([mountpoint], [libmount])
-AM_CONDITIONAL(BUILD_MOUNTPOINT, test "x$build_mountpoint" = xyes)
+AM_CONDITIONAL([BUILD_MOUNTPOINT], [test "x$build_mountpoint" = xyes])
 
 
 AC_ARG_ENABLE([fallocate],
   AS_HELP_STRING([--disable-fallocate], [do not build fallocate]),
-  [], enable_fallocate=check
+  [], [enable_fallocate=check]
 )
 UL_BUILD_INIT([fallocate])
 UL_REQUIRES_LINUX([fallocate])
 UL_REQUIRES_SYSCALL_CHECK([fallocate], [UL_CHECK_SYSCALL([fallocate])])
-AM_CONDITIONAL(BUILD_FALLOCATE, test "x$build_fallocate" = xyes)
+AM_CONDITIONAL([BUILD_FALLOCATE], [test "x$build_fallocate" = xyes])
 
 if test "x$build_fallocate" = xyes; then
   dnl check for valid fallocate() function
@@ -880,29 +880,29 @@ if test "x$build_fallocate" = xyes; then
    }
    ]])],[
   AC_MSG_RESULT([yes])
-  AC_DEFINE(HAVE_FALLOCATE,1,[Have valid fallocate() function])],[
+  AC_DEFINE([HAVE_FALLOCATE], [1], [Have valid fallocate() function])],[
   AC_MSG_RESULT([no])])
 fi
 
 
 AC_ARG_ENABLE([unshare],
   AS_HELP_STRING([--disable-unshare], [do not build unshare]),
-  [], enable_unshare=check
+  [], [enable_unshare=check]
 )
 UL_BUILD_INIT([unshare])
 UL_REQUIRES_LINUX([unshare])
 UL_REQUIRES_SYSCALL_CHECK([unshare], [UL_CHECK_SYSCALL([unshare])])
-AM_CONDITIONAL(BUILD_UNSHARE, test "x$build_unshare" = xyes)
+AM_CONDITIONAL([BUILD_UNSHARE], [test "x$build_unshare" = xyes])
 AC_CHECK_FUNCS([unshare])
 
 AC_ARG_ENABLE([nsenter],
   AS_HELP_STRING([--disable-nsenter], [do not build nsenter]),
-  [], enable_nsenter=check
+  [], [enable_nsenter=check]
 )
 UL_BUILD_INIT([nsenter])
 UL_REQUIRES_LINUX([nsenter])
 UL_REQUIRES_SYSCALL_CHECK([nsenter], [UL_CHECK_SYSCALL([setns])], [setns])
-AM_CONDITIONAL(BUILD_NSENTER, test "x$build_nsenter" = xyes)
+AM_CONDITIONAL([BUILD_NSENTER], [test "x$build_nsenter" = xyes])
 AC_CHECK_FUNCS([setns])
 
 dnl setpriv depends on libcap-ng.  It would be possible to build
@@ -911,116 +911,116 @@ dnl but this isn't currently supported.
 UL_CHECK_LIB([cap-ng], [capng_apply], [cap_ng])
 AC_ARG_ENABLE([setpriv],
   AS_HELP_STRING([--disable-setpriv], [do not build setpriv]),
-  [], enable_setpriv=check
+  [], [enable_setpriv=check]
 )
 UL_BUILD_INIT([setpriv])
 UL_REQUIRES_LINUX([setpriv])
 UL_REQUIRES_HAVE([setpriv], [linux_securebits_h], [securebits.h header file])
 UL_REQUIRES_HAVE([setpriv], [cap_ng], [libcap-ng library])
-AM_CONDITIONAL(BUILD_SETPRIV, test "x$build_setpriv" = xyes)
+AM_CONDITIONAL([BUILD_SETPRIV], [test "x$build_setpriv" = xyes])
 
 
 AC_ARG_ENABLE([eject],
   AS_HELP_STRING([--disable-eject], [do not build eject]),
-  [], enable_eject=check
+  [], [enable_eject=check]
 )
 UL_BUILD_INIT([eject])
 UL_REQUIRES_LINUX([eject])
 UL_REQUIRES_BUILD([eject], [libmount])
-AM_CONDITIONAL(BUILD_EJECT, test "x$build_eject" = xyes)
+AM_CONDITIONAL([BUILD_EJECT], [test "x$build_eject" = xyes])
 
 
 AC_ARG_ENABLE([agetty],
   AS_HELP_STRING([--disable-agetty], [do not build agetty]),
-  [], enable_agetty=yes
+  [], [enable_agetty=yes]
 )
 UL_BUILD_INIT([agetty])
-AM_CONDITIONAL(BUILD_AGETTY, test "x$build_agetty" = xyes)
+AM_CONDITIONAL([BUILD_AGETTY], [test "x$build_agetty" = xyes])
 
 
 AC_ARG_ENABLE([cramfs],
   AS_HELP_STRING([--disable-cramfs], [do not build fsck.cramfs, mkfs.cramfs]),
-  [], enable_cramfs=check
+  [], [enable_cramfs=check]
 )
 UL_BUILD_INIT([cramfs])
-AC_CHECK_LIB(z, crc32, [have_z=yes], [have_z=no])
+AC_CHECK_LIB([z], [crc32], [have_z=yes], [have_z=no])
 UL_REQUIRES_HAVE([cramfs], [z], [z library])
-AM_CONDITIONAL(BUILD_CRAMFS, test "x$build_cramfs" = xyes)
+AM_CONDITIONAL([BUILD_CRAMFS], [test "x$build_cramfs" = xyes])
 
 
 AC_ARG_ENABLE([bfs],
   AS_HELP_STRING([--disable-bfs], [do not build mkfs.bfs]),
-  [], enable_bfs=yes
+  [], [enable_bfs=yes]
 )
 UL_BUILD_INIT([bfs])
-AM_CONDITIONAL(BUILD_BFS, test "x$build_bfs" = xyes)
+AM_CONDITIONAL([BUILD_BFS], [test "x$build_bfs" = xyes])
 
 
 AC_ARG_ENABLE([fdformat],
   AS_HELP_STRING([--disable-fdformat], [do not build fdformat]),
-  [], enable_fdformat=check
+  [], [enable_fdformat=check]
 )
 UL_BUILD_INIT([fdformat])
 UL_REQUIRES_LINUX([fdformat])
-AM_CONDITIONAL(BUILD_FDFORMAT, test "x$build_fdformat" = xyes)
+AM_CONDITIONAL([BUILD_FDFORMAT], [test "x$build_fdformat" = xyes])
 
 
 AC_ARG_ENABLE([hwclock],
   AS_HELP_STRING([--disable-hwclock], [do not build hwclock]),
-  [], enable_hwclock=check
+  [], [enable_hwclock=check]
 )
 have_linuxdummy=$linux_os
 
 UL_BUILD_INIT([hwclock])
 UL_REQUIRES_HAVE([hwclock], [io, linuxdummy], [ioperm iopl function or Linux])
-AM_CONDITIONAL(BUILD_HWCLOCK, test "x$build_hwclock" = xyes)
+AM_CONDITIONAL([BUILD_HWCLOCK], [test "x$build_hwclock" = xyes])
 
 
 UL_BUILD_INIT([swapon], [check])
 UL_REQUIRES_LINUX([swapon])
 UL_REQUIRES_BUILD([swapon], [libblkid])
 UL_REQUIRES_BUILD([swapon], [libmount])
-AM_CONDITIONAL(BUILD_SWAPON, test "x$build_swapon" = xyes)
+AM_CONDITIONAL([BUILD_SWAPON], [test "x$build_swapon" = xyes])
 
 
 UL_BUILD_INIT([lsblk], [check])
 UL_REQUIRES_LINUX([lsblk])
 UL_REQUIRES_BUILD([lsblk], [libblkid])
 UL_REQUIRES_BUILD([lsblk], [libmount])
-AM_CONDITIONAL(BUILD_LSBLK, test "x$build_lsblk" = xyes)
+AM_CONDITIONAL([BUILD_LSBLK], [test "x$build_lsblk" = xyes])
 
 
 UL_BUILD_INIT([lscpu], [check])
 UL_REQUIRES_LINUX([lscpu])
 UL_REQUIRES_HAVE([lscpu], [cpu_set_t], [cpu_set_t type])
-AM_CONDITIONAL(BUILD_LSCPU, test "x$build_lscpu" = xyes)
+AM_CONDITIONAL([BUILD_LSCPU], [test "x$build_lscpu" = xyes])
 
 
 UL_BUILD_INIT([chcpu], [check])
 UL_REQUIRES_LINUX([chcpu])
 UL_REQUIRES_HAVE([chcpu], [cpu_set_t], [cpu_set_t type])
-AM_CONDITIONAL(BUILD_CHCPU, test "x$build_chcpu" = xyes)
+AM_CONDITIONAL([BUILD_CHCPU], [test "x$build_chcpu" = xyes])
 
 
 AC_ARG_ENABLE([wdctl],
   AS_HELP_STRING([--disable-wdctl], [do not build wdctl]),
-  [], enable_wdctl=check
+  [], [enable_wdctl=check]
 )
 UL_BUILD_INIT([wdctl])
 UL_REQUIRES_LINUX([wdctl])
 UL_REQUIRES_HAVE([wdctl], [linux_watchdog_h], [linux/watchdog.h header file])
-AM_CONDITIONAL(BUILD_WDCTL, test "x$build_wdctl" = xyes)
+AM_CONDITIONAL([BUILD_WDCTL], [test "x$build_wdctl" = xyes])
 
 
 UL_BUILD_INIT([swaplabel], [check])
 UL_REQUIRES_BUILD([swaplabel], [libblkid])
-AM_CONDITIONAL(BUILD_SWAPLABEL, test "x$build_swaplabel" = xyes)
+AM_CONDITIONAL([BUILD_SWAPLABEL], [test "x$build_swaplabel" = xyes])
 
 
 UL_BUILD_INIT([prlimit], [check])
 UL_REQUIRES_LINUX([prlimit])
 UL_REQUIRES_SYSCALL_CHECK([prlimit], [UL_CHECK_SYSCALL([prlimit64])], [prlimit64])
-AM_CONDITIONAL(BUILD_PRLIMIT, test "x$build_prlimit" = xyes)
+AM_CONDITIONAL([BUILD_PRLIMIT], [test "x$build_prlimit" = xyes])
 if test "x$build_prlimit" = xyes; then
   AC_CHECK_FUNCS([prlimit])
 fi
@@ -1029,132 +1029,132 @@ fi
 UL_BUILD_INIT([lslocks], [check])
 UL_REQUIRES_LINUX([lslocks])
 UL_REQUIRES_BUILD([lslocks], [libmount])
-AM_CONDITIONAL(BUILD_LSLOCKS, test "x$build_lslocks" = xyes)
+AM_CONDITIONAL([BUILD_LSLOCKS], [test "x$build_lslocks" = xyes])
 
 
 AC_ARG_ENABLE([switch_root],
   AS_HELP_STRING([--disable-switch_root], [do not build switch_root]),
-  [], enable_switch_root=check
+  [], [enable_switch_root=check]
 )
 UL_BUILD_INIT([switch_root])
 UL_REQUIRES_LINUX([switch_root])
 UL_REQUIRES_HAVE([switch_root], [openat], [openat function])
-AM_CONDITIONAL(BUILD_SWITCH_ROOT, test "x$build_switch_root" = xyes)
+AM_CONDITIONAL([BUILD_SWITCH_ROOT], [test "x$build_switch_root" = xyes])
 
 
 AC_ARG_ENABLE([pivot_root],
   AS_HELP_STRING([--disable-pivot_root], [do not build pivot_root]),
-  [], enable_pivot_root=check
+  [], [enable_pivot_root=check]
 )
 UL_BUILD_INIT([pivot_root])
 UL_REQUIRES_LINUX([switch_root])
 UL_REQUIRES_SYSCALL_CHECK([pivot_root], [UL_CHECK_SYSCALL([pivot_root])])
-AM_CONDITIONAL(BUILD_PIVOT_ROOT, test "x$build_pivot_root" = xyes)
+AM_CONDITIONAL([BUILD_PIVOT_ROOT], [test "x$build_pivot_root" = xyes])
 
 
 AC_ARG_ENABLE([elvtune],
   AS_HELP_STRING([--enable-elvtune], [build elvtune (only works with 2.2 and 2.4 kernels)]),
-  [], enable_elvtune=no
+  [], [enable_elvtune=no]
 )
 UL_BUILD_INIT([elvtune])
 UL_REQUIRES_LINUX([elvtune])
-AM_CONDITIONAL(BUILD_ELVTUNE, test "x$build_elvtune" = xyes)
+AM_CONDITIONAL([BUILD_ELVTUNE], [test "x$build_elvtune" = xyes])
 
 
 AC_ARG_ENABLE([tunelp],
   AS_HELP_STRING([--enable-tunelp], [build tunelp]),
-  [], enable_tunelp=no
+  [], [enable_tunelp=no]
 )
 UL_BUILD_INIT([tunelp])
 UL_REQUIRES_LINUX([tunelp])
-AM_CONDITIONAL(BUILD_TUNELP, test "x$build_tunelp" = xyes)
+AM_CONDITIONAL([BUILD_TUNELP], [test "x$build_tunelp" = xyes])
 
 
 AC_ARG_ENABLE([kill],
   AS_HELP_STRING([--disable-kill], [do not build kill]),
-  [], enable_kill=check
+  [], [enable_kill=check]
 )
 UL_BUILD_INIT([kill])
 UL_REQUIRES_LINUX([kill])
-AM_CONDITIONAL(BUILD_KILL, test "x$build_kill" = xyes)
+AM_CONDITIONAL([BUILD_KILL], [test "x$build_kill" = xyes])
 
 
 AC_ARG_ENABLE([last],
   AS_HELP_STRING([--enable-last], [build last]),
-  [], enable_last=no
+  [], [enable_last=no]
 )
 UL_BUILD_INIT([last])
-AM_CONDITIONAL(BUILD_LAST, test "x$build_last" = xyes)
+AM_CONDITIONAL([BUILD_LAST], [test "x$build_last" = xyes])
 
 
 AC_ARG_ENABLE([utmpdump],
   AS_HELP_STRING([--disable-utmpdump], [do not build utmpdump]),
-  [], enable_utmpdump=yes
+  [], [enable_utmpdump=yes]
 )
 UL_BUILD_INIT([utmpdump])
-AM_CONDITIONAL(BUILD_UTMPDUMP, test "x$build_utmpdump" = xyes)
+AM_CONDITIONAL([BUILD_UTMPDUMP], [test "x$build_utmpdump" = xyes])
 
 
 AC_ARG_ENABLE([line],
   AS_HELP_STRING([--enable-line], [build line]),
-  [], enable_line=no
+  [], [enable_line=no]
 )
 UL_BUILD_INIT([line])
-AM_CONDITIONAL(BUILD_LINE, test "x$build_line" = xyes)
+AM_CONDITIONAL([BUILD_LINE], [test "x$build_line" = xyes])
 
 
 AC_ARG_ENABLE([mesg],
   AS_HELP_STRING([--enable-mesg], [build mesg]),
-  [], enable_mesg=no
+  [], [enable_mesg=no]
 )
 UL_BUILD_INIT([mesg])
-AM_CONDITIONAL(BUILD_MESG, test "x$build_mesg" = xyes)
+AM_CONDITIONAL([BUILD_MESG], [test "x$build_mesg" = xyes])
 
 
 AC_ARG_ENABLE([raw],
 	      AS_HELP_STRING([--disable-raw], [do not build raw]),
-  [], enable_raw=check
+  [], [enable_raw=check]
 )
 UL_BUILD_INIT([raw])
 UL_REQUIRES_LINUX([raw])
 UL_REQUIRES_HAVE([raw], [linux_raw_h], [raw.h header file])
-AM_CONDITIONAL(BUILD_RAW, test "x$build_raw" = xyes)
+AM_CONDITIONAL([BUILD_RAW], [test "x$build_raw" = xyes])
 
 
 AC_ARG_ENABLE([rename],
   AS_HELP_STRING([--disable-rename], [do not build rename]),
-  [], enable_rename=yes
+  [], [enable_rename=yes]
 )
 UL_BUILD_INIT([rename])
-AM_CONDITIONAL(BUILD_RENAME, test "x$build_rename" = xyes)
+AM_CONDITIONAL([BUILD_RENAME], [test "x$build_rename" = xyes])
 
 
 AC_ARG_ENABLE([reset],
   AS_HELP_STRING([--enable-reset], [build reset]),
-  [], enable_reset=no
+  [], [enable_reset=no]
 )
 UL_BUILD_INIT([reset])
-AM_CONDITIONAL(BUILD_RESET, test "x$build_reset" = xyes)
+AM_CONDITIONAL([BUILD_RESET], [test "x$build_reset" = xyes])
 
 
 AC_ARG_ENABLE([vipw],
   AS_HELP_STRING([--enable-vipw], [build vipw]),
-  [], enable_vipw=no
+  [], [enable_vipw=no]
 )
 UL_BUILD_INIT([vipw])
-AM_CONDITIONAL(BUILD_VIPW, test "x$build_vipw" = xyes)
+AM_CONDITIONAL([BUILD_VIPW], [test "x$build_vipw" = xyes])
 
 
 AC_ARG_ENABLE([newgrp],
   AS_HELP_STRING([--enable-newgrp], [build newgrp]),
-  [], enable_newgrp=no
+  [], [enable_newgrp=no]
 )
 UL_BUILD_INIT([newgrp])
-AM_CONDITIONAL(BUILD_NEWGRP, test "x$build_newgrp" = xyes)
+AM_CONDITIONAL([BUILD_NEWGRP], [test "x$build_newgrp" = xyes])
 
 
 AC_ARG_WITH([user], AS_HELP_STRING([--without-user], [compile without libuser (remote chsh)]),
-  [], with_user=check
+  [], [with_user=check]
 )
 have_user=no
 if test "x$with_user" != xno; then
@@ -1163,7 +1163,7 @@ if test "x$with_user" != xno; then
   yes:no)
    AC_MSG_ERROR([user selected but libuser not found]) ;;
   *:yes)
-   AC_DEFINE(HAVE_LIBUSER, 1, [Define if libuser is available]) ;;
+   AC_DEFINE([HAVE_LIBUSER], [1], [Define if libuser is available]) ;;
   esac
   # temporary solution, libuser has stupid .pc where are exported all
   # private dependencies to Requires: instead of Requires.private:
@@ -1171,25 +1171,25 @@ if test "x$with_user" != xno; then
     LIBUSER_LIBS=-luser
   fi
 fi
-AM_CONDITIONAL(HAVE_USER, test "x$have_user" = xyes)
+AM_CONDITIONAL([HAVE_USER], [test "x$have_user" = xyes])
 
 AC_ARG_ENABLE([chfn-chsh-password],
   AS_HELP_STRING([--disable-chfn-chsh-password], [do not require the user to enter the password in chfn and chsh]),
-  [], enable_chfn_chsh_password=yes
+  [], [enable_chfn_chsh_password=yes]
 )
 
 AC_ARG_ENABLE([chfn-chsh],
   AS_HELP_STRING([--enable-chfn-chsh], [build chfn and chsh]),
-  [], enable_chfn_chsh=no
+  [], [enable_chfn_chsh=no]
 )
 UL_BUILD_INIT([chfn_chsh])
 
 if test "x$enable_chfn_chsh_password" = xyes -o "x$have_user" = xyes; then
   UL_REQUIRES_HAVE([chfn_chsh], [security_pam_misc_h], [PAM header file])
-  AC_DEFINE(CHFN_CHSH_PASSWORD, 1, [Should chfn and chsh require the user to enter the password?])
+  AC_DEFINE([CHFN_CHSH_PASSWORD], [1], [Should chfn and chsh require the user to enter the password?])
 fi
-AM_CONDITIONAL(BUILD_CHFN_CHSH, test "x$build_chfn_chsh" = xyes)
-AM_CONDITIONAL(CHFN_CHSH_PASSWORD, test "x$enable_chfn_chsh_password" = xyes)
+AM_CONDITIONAL([BUILD_CHFN_CHSH], [test "x$build_chfn_chsh" = xyes])
+AM_CONDITIONAL([CHFN_CHSH_PASSWORD], [test "x$enable_chfn_chsh_password" = xyes])
 
 AC_ARG_ENABLE([chsh-only-listed],
 AS_HELP_STRING([--disable-chsh-only-listed], [chsh: allow shells not in /etc/shells]),
@@ -1197,106 +1197,106 @@ AS_HELP_STRING([--disable-chsh-only-listed], [chsh: allow shells not in /etc/she
 )
 
 if test "x$enable_chsh_only_listed" = xyes; then
-AC_DEFINE(ONLY_LISTED_SHELLS, 1, [Should chsh allow only shells in /etc/shells?])
+AC_DEFINE([ONLY_LISTED_SHELLS], [1], [Should chsh allow only shells in /etc/shells?])
 fi
 
 
 AC_ARG_ENABLE([login],
   AS_HELP_STRING([--disable-login], [do not build login]),
-  [], enable_login=check
+  [], [enable_login=check]
 )
 UL_BUILD_INIT([login])
 UL_REQUIRES_HAVE([login], [security_pam_misc_h], [PAM header file])
-AM_CONDITIONAL(BUILD_LOGIN, test "x$build_login" = xyes)
+AM_CONDITIONAL([BUILD_LOGIN], [test "x$build_login" = xyes])
 
 AC_ARG_ENABLE([login-chown-vcs],
   AS_HELP_STRING([--enable-login-chown-vcs], [let login chown /dev/vcsN]),
-  [], enable_login_chown_vcs=no
+  [], [enable_login_chown_vcs=no]
 )
 
 if test "x$enable_login_chown_vcs" = xyes; then
-  AC_DEFINE(LOGIN_CHOWN_VCS, 1, [Should login chown /dev/vcsN?])
+  AC_DEFINE([LOGIN_CHOWN_VCS], [1], [Should login chown /dev/vcsN?])
 fi
 
 AC_ARG_ENABLE([login-stat-mail],
   AS_HELP_STRING([--enable-login-stat-mail], [let login stat() the mailbox]),
-  [], enable_login_stat_mail=no
+  [], [enable_login_stat_mail=no]
 )
 
 if test "x$enable_login_stat_mail" = xyes; then
-  AC_DEFINE(LOGIN_STAT_MAIL, 1, [Should login stat() the mailbox?])
+  AC_DEFINE([LOGIN_STAT_MAIL], [1], [Should login stat() the mailbox?])
 fi
 
 
 AC_ARG_ENABLE([sulogin],
   AS_HELP_STRING([--disable-sulogin], [do not build sulogin]),
-  [], enable_sulogin=yes
+  [], [enable_sulogin=yes]
 )
 UL_BUILD_INIT([sulogin])
-AM_CONDITIONAL(BUILD_SULOGIN, test "x$build_sulogin" = xyes)
+AM_CONDITIONAL([BUILD_SULOGIN], [test "x$build_sulogin" = xyes])
 
 
 AC_ARG_ENABLE([su],
   AS_HELP_STRING([--disable-su], [do not build su]),
-  [], enable_su=check
+  [], [enable_su=check]
 )
 UL_BUILD_INIT([su])
 UL_REQUIRES_HAVE([su], [security_pam_misc_h], [PAM header file])
-AM_CONDITIONAL(BUILD_SU, test "x$build_su" = xyes)
+AM_CONDITIONAL([BUILD_SU], [test "x$build_su" = xyes])
 
 
 AC_ARG_ENABLE([runuser],
   AS_HELP_STRING([--disable-runuser], [do not build runuser]),
-  [], enable_runuser=check
+  [], [enable_runuser=check]
 )
 UL_BUILD_INIT([runuser])
 UL_REQUIRES_HAVE([runuser], [security_pam_misc_h], [PAM header file])
-AM_CONDITIONAL(BUILD_RUNUSER, test "x$build_runuser" = xyes)
+AM_CONDITIONAL([BUILD_RUNUSER], [test "x$build_runuser" = xyes])
 
 
 AC_ARG_ENABLE([ul],
   AS_HELP_STRING([--disable-ul], [do not build ul]),
-  [], enable_ul=check
+  [], [enable_ul=check]
 )
 UL_BUILD_INIT([ul])
 UL_REQUIRES_HAVE([ul], [ncurses, tinfo], [ncurses or tinfo libraries])
-AM_CONDITIONAL(BUILD_UL, test "x$build_ul" = xyes)
+AM_CONDITIONAL([BUILD_UL], [test "x$build_ul" = xyes])
 
 
 AC_ARG_ENABLE([more],
   AS_HELP_STRING([--disable-more], [do not build more]),
-  [], enable_more=check
+  [], [enable_more=check]
 )
 UL_BUILD_INIT([more])
 UL_REQUIRES_HAVE([more], [ncurses, tinfo, termcap], [ncurses, tinfo or termcap libraries])
-AM_CONDITIONAL(BUILD_MORE, test "x$build_more" = xyes)
+AM_CONDITIONAL([BUILD_MORE], [test "x$build_more" = xyes])
 
 
 AC_ARG_ENABLE([pg],
   AS_HELP_STRING([--disable-pg], [do not build pg]),
-  [], enable_pg=check
+  [], [enable_pg=check]
 )
 UL_BUILD_INIT([pg])
 UL_REQUIRES_HAVE([pg], [ncurses], [ncurses or ncursesw library])
-AM_CONDITIONAL(BUILD_PG, test "x$build_pg" = xyes)
+AM_CONDITIONAL([BUILD_PG], [test "x$build_pg" = xyes])
 
 
 AC_ARG_ENABLE([setterm],
   AS_HELP_STRING([--disable-setterm], [do not build setterm]),
-  [], enable_setterm=check
+  [], [enable_setterm=check]
 )
 UL_BUILD_INIT([setterm])
 UL_REQUIRES_LINUX([setterm])
 UL_REQUIRES_HAVE([setterm], [ncurses], [ncurses library])
-AM_CONDITIONAL(BUILD_SETTERM, test "x$build_setterm" = xyes)
+AM_CONDITIONAL([BUILD_SETTERM], [test "x$build_setterm" = xyes])
 
 
 AC_ARG_ENABLE([schedutils],
   AS_HELP_STRING([--disable-schedutils], [do not build chrt, ionice, taskset]),
-  [], enable_schedutils=yes
+  [], [enable_schedutils=yes]
 )
 UL_BUILD_INIT([schedutils])
-AM_CONDITIONAL(BUILD_SCHEDUTILS, test "x$build_schedutils" = xyes)
+AM_CONDITIONAL([BUILD_SCHEDUTILS], [test "x$build_schedutils" = xyes])
 
 UL_BUILD_INIT([ionice], [check])
 UL_REQUIRES_BUILD([ionice], [schedutils])
@@ -1324,7 +1324,7 @@ UL_REQUIRES_SYSCALL_CHECK([ionice],
 	  [x86_64*],	[252])],
 	[ioprio_get])
 
-AM_CONDITIONAL(BUILD_IONICE, test "x$build_ionice" = xyes)
+AM_CONDITIONAL([BUILD_IONICE], [test "x$build_ionice" = xyes])
 
 UL_BUILD_INIT([taskset], [check])
 UL_REQUIRES_BUILD([taskset], [schedutils])
@@ -1332,34 +1332,34 @@ UL_REQUIRES_HAVE([taskset], [cpu_set_t], [cpu_set_t type])
 UL_REQUIRES_SYSCALL_CHECK([taskset],
 	[UL_CHECK_SYSCALL([sched_getaffinity])],
 	[sched_getaffinity])
-AM_CONDITIONAL(BUILD_TASKSET, test "x$build_taskset" = xyes)
+AM_CONDITIONAL([BUILD_TASKSET], [test "x$build_taskset" = xyes])
 
 
 AC_ARG_ENABLE([wall],
   AS_HELP_STRING([--disable-wall], [do not build wall]),
-  [], enable_wall=yes
+  [], [enable_wall=yes]
 )
 UL_BUILD_INIT([wall])
-AM_CONDITIONAL(BUILD_WALL, test "x$build_wall" = xyes)
+AM_CONDITIONAL([BUILD_WALL], [test "x$build_wall" = xyes])
 
 
 AC_ARG_ENABLE([write],
   AS_HELP_STRING([--enable-write], [build write]),
-  [], enable_write=no
+  [], [enable_write=no]
 )
 UL_BUILD_INIT([write])
-AM_CONDITIONAL(BUILD_WRITE, test "x$build_write" = xyes)
+AM_CONDITIONAL([BUILD_WRITE], [test "x$build_write" = xyes])
 
 
 AC_ARG_ENABLE([socket-activation],
   AS_HELP_STRING([--enable-socket-activation], [build uuidd with support for systemd socket activation]),
-  [], enable_socket_activation=no
+  [], [enable_socket_activation=no]
 )
 
-AM_CONDITIONAL(USE_SOCKET_ACTIVATION, test "x$enable_socket_activation" = xyes)
+AM_CONDITIONAL([USE_SOCKET_ACTIVATION], [test "x$enable_socket_activation" = xyes])
 
 if test "x$enable_socket_activation" = xyes; then
-  AC_DEFINE(USE_SOCKET_ACTIVATION, 1, [Should uuidd support socket activation?])
+  AC_DEFINE([USE_SOCKET_ACTIVATION], [1], [Should uuidd support socket activation?])
 fi
 
 AC_ARG_WITH([systemdsystemunitdir],
@@ -1370,7 +1370,7 @@ if test "x$with_systemdsystemunitdir" != "xno"; then
   AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
 fi
 
-AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != "xno" ])
+AM_CONDITIONAL([HAVE_SYSTEMD], [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != "xno" ])
 
 
 AC_ARG_WITH([bashcompletiondir],
@@ -1386,19 +1386,19 @@ AC_SUBST([bashcompletiondir], [$with_bashcompletiondir])
 
 AC_ARG_ENABLE([bash-completion],
   AS_HELP_STRING([--disable-bash-completion], [do not install bash completion files]),
-  [], enable_bash_completion=yes
+  [], [enable_bash_completion=yes]
 )
 
-AM_CONDITIONAL(BUILD_BASH_COMPLETION, test "x$enable_bash_completion" = xyes)
+AM_CONDITIONAL([BUILD_BASH_COMPLETION], [test "x$enable_bash_completion" = xyes])
 
 
 AC_ARG_ENABLE([pg-bell],
   AS_HELP_STRING([--disable-pg-bell], [let pg not ring the bell on invalid keys]),
-  [], enable_pg_bell=yes
+  [], [enable_pg_bell=yes]
 )
 
 if test "x$enable_pg_bell" = xyes; then
-  AC_DEFINE(PG_BELL, 1, [Should pg ring the bell on invalid keys?])
+  AC_DEFINE([PG_BELL], [1], [Should pg ring the bell on invalid keys?])
 fi
 
 
@@ -1432,38 +1432,38 @@ AC_DEFINE_UNQUOTED([FS_SEARCH_PATH], "$fs_paths", [search path for fs helpers])
 
 AC_ARG_ENABLE([use-tty-group],
   AS_HELP_STRING([--disable-use-tty-group], [do not install wall and write setgid tty]),
-  [], enable_use_tty_group=yes
+  [], [enable_use_tty_group=yes]
 )
-AM_CONDITIONAL(USE_TTY_GROUP, test "x$enable_use_tty_group" = xyes)
+AM_CONDITIONAL([USE_TTY_GROUP], [test "x$enable_use_tty_group" = xyes])
 
 if test "x$enable_use_tty_group" = xyes; then
-  AC_DEFINE(USE_TTY_GROUP, 1, [Should wall and write be installed setgid tty?])
+  AC_DEFINE([USE_TTY_GROUP], [1], [Should wall and write be installed setgid tty?])
 fi
 
 
 AC_ARG_ENABLE([sulogin-emergency-mount],
   AS_HELP_STRING([--enable-sulogin-emergency-mount],
 		 [use emergency mount of /dev and /proc for sulogin]),
-  [], enable_sulogin_emergency_mount=no
+  [], [enable_sulogin_emergency_mount=no]
 )
 
 if test "x$enable_sulogin_emergency_mount" = xyes; then
-  AC_DEFINE(USE_SULOGIN_EMERGENCY_MOUNT, 1,
+  AC_DEFINE([USE_SULOGIN_EMERGENCY_MOUNT], [1],
 	    [Should sulogin use a emergency mount of /dev and /proc?])
 fi
 
 
 AC_ARG_ENABLE([makeinstall-chown],
   AS_HELP_STRING([--disable-makeinstall-chown], [do not do chown-like operations during "make install"]),
-  [], enable_makeinstall_chown=yes
+  [], [enable_makeinstall_chown=yes]
 )
-AM_CONDITIONAL(MAKEINSTALL_DO_CHOWN, test "x$enable_makeinstall_chown" = xyes)
+AM_CONDITIONAL([MAKEINSTALL_DO_CHOWN], [test "x$enable_makeinstall_chown" = xyes])
 
 AC_ARG_ENABLE([makeinstall-setuid],
   AS_HELP_STRING([--disable-makeinstall-setuid], [do not do setuid chmod operations during "make install"]),
-  [], enable_makeinstall_setuid=yes
+  [], [enable_makeinstall_setuid=yes]
 )
-AM_CONDITIONAL(MAKEINSTALL_DO_SETUID, test "x$enable_makeinstall_setuid" = xyes)
+AM_CONDITIONAL([MAKEINSTALL_DO_SETUID], [test "x$enable_makeinstall_setuid" = xyes])
 
 
 AC_ARG_VAR([SUID_CFLAGS],
@@ -1474,7 +1474,7 @@ AC_ARG_VAR([SUID_LDFLAGS],
 LIBS=""
 
 
-AC_CONFIG_HEADERS(config.h)
+AC_CONFIG_HEADERS([config.h])
 
 #
 # Don't use configure.ac to replace install paths! See Makefile PATHFILES for
-- 
1.8.3.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/7] build-sys: prefer AS_CASE rather than shell 'case'
  2013-07-28 21:11 [PATCH 1/7] lscpu: fix shadow declaration [smatch scan] Sami Kerola
  2013-07-28 21:11 ` [PATCH 2/7] setarch: prefer preprocessor rather than autotools check Sami Kerola
  2013-07-28 21:11 ` [PATCH 3/7] build-sys: use m4 quoting consistently Sami Kerola
@ 2013-07-28 21:11 ` Sami Kerola
  2013-07-28 21:11 ` [PATCH 5/7] build-sys: prefer AS_IF rather than shell 'if' Sami Kerola
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Sami Kerola @ 2013-07-28 21:11 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

References: http://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Limitations-of-Builtins.html#case
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 configure.ac | 161 ++++++++++++++++++++++++++---------------------------------
 1 file changed, 72 insertions(+), 89 deletions(-)

diff --git a/configure.ac b/configure.ac
index fc45a5e..5bf6f59 100644
--- a/configure.ac
+++ b/configure.ac
@@ -47,29 +47,21 @@ LIBMOUNT_LT_MICRO=0
 LIBMOUNT_VERSION_INFO=`expr $LIBMOUNT_LT_MAJOR + $LIBMOUNT_LT_MINOR`:$LIBMOUNT_LT_MICRO:$LIBMOUNT_LT_MINOR
 
 # Check whether exec_prefix=/usr:
-case $exec_prefix:$prefix in
-NONE:NONE | NONE:/usr | /usr:*)
-  AC_MSG_NOTICE([Default --exec-prefix detected.])
-  case $bindir in
-  '${exec_prefix}/bin') bindir=/bin
-    AC_MSG_NOTICE([  --bindir defaults to /bin]) ;;
-  esac
-  case $sbindir in
-  '${exec_prefix}/sbin') sbindir=/sbin
-    AC_MSG_NOTICE([  --sbindir defaults to /sbin]) ;;
-  esac
-  case $libdir in
-  '${exec_prefix}/lib') libdir=/lib
-    AC_MSG_NOTICE([  --libdir defaults to /lib]) ;;
-  esac ;;
-esac
-
-case $prefix:$localstatedir in
-  NONE:'${prefix}/var' | /usr:'${prefix}/var')
-    localstatedir=/run
-    AC_MSG_NOTICE([  --localstatedir defaults to /run])
-    ;;
-esac
+AS_CASE([$exec_prefix:$prefix],
+[NONE:NONE | NONE:/usr | /usr:*],
+  [AC_MSG_NOTICE([Default --exec-prefix detected.])
+   AS_CASE([$bindir],  [${exec_prefix}/bin],  [bindir=/bin;  AC_MSG_NOTICE([  --bindir defaults to /bin])  ])
+   AS_CASE([$sbindir], [${exec_prefix}/sbin], [bindir=/sbin; AC_MSG_NOTICE([  --sbindir defaults to /sbin])])
+   AS_CASE([$libdir],  [${exec_prefix}/lib],  [bindir=/lib;  AC_MSG_NOTICE([  --libdir defaults to /lib])  ])
+  ]
+)
+
+AS_CASE([$prefix:$localstatedir],
+  [NONE:${prefix}/var | /usr:${prefix}/var],
+    [localstatedir=/run
+     AC_MSG_NOTICE([  --localstatedir defaults to /run])
+    ]
+)
 AC_SUBST([localstatedir])
 
 
@@ -80,12 +72,11 @@ AC_SUBST([usrbin_execdir])
 usrsbin_execdir='${exec_prefix}/sbin'
 AC_SUBST([usrsbin_execdir])
 
-case $libdir in
- '${exec_prefix}/'* | '${prefix}/'* | /usr/*)
-    usrlib_execdir=$libdir ;;
- *)
-    usrlib_execdir='${exec_prefix}'$libdir ;;
-esac
+AS_CASE([$libdir],
+ [${exec_prefix}/* | ${prefix}/* | /usr/*],
+   [usrlib_execdir=$libdir],
+ [usrlib_execdir='${exec_prefix}'$libdir]
+)
 AC_SUBST([usrlib_execdir])
 
 
@@ -138,11 +129,7 @@ GTK_DOC_CHECK([1.10])
 AC_PATH_PROG([XSLTPROC], [xsltproc])
 
 linux_os=no
-case ${host_os} in
-  *linux*)
-    linux_os=yes
-    ;;
-esac
+AS_CASE([${host_os}], [*linux*], [linux_os=yes])
 AM_CONDITIONAL([LINUX], [test "x$linux_os" = xyes])
 
 dnl define ARCH_<NAME> conditionals
@@ -366,10 +353,10 @@ if test x"$have_dirfd" = xno ; then
 		 #include <dirent.h>])
 fi
 
-case "$have_dirfd:$have_ddfd" in
-no:no)
-  AC_MSG_ERROR([cannot find a method to get filedescriptor of directory]) ;;
-esac
+AS_CASE([$have_dirfd:$have_ddfd],
+  [no:no],
+    [AC_MSG_ERROR([cannot find a method to get filedescriptor of directory])]
+)
 
 
 AC_MSG_CHECKING([whether program_invocation_short_name is defined])
@@ -401,16 +388,18 @@ AC_ARG_ENABLE([static-programs],
       [link static the programs in LIST (comma-separated,
       supported for ]m4_defn([UL_STATIC_PROGRAMS])[)])])
 
-case $enable_static_programs in
-yes) enable_static_programs=m4_quote([UL_STATIC_PROGRAMS]) ;;
-no) enable_static_programs= ;;
-esac
+AS_CASE([$enable_static_programs],
+  [yes],
+    [enable_static_programs=m4_quote([UL_STATIC_PROGRAMS])],
+  [no],
+    [enable_static_programs=]
+)
 
 dnl Set all the individual AM_CONDITIONALs
 m4_foreach([UL_PRG], m4_defn([UL_STATIC_PROGRAMS]), [
-  case ,$enable_static_programs, in
-   *,UL_PRG,*) static_[]UL_PRG=yes ;;
-  esac
+  AS_CASE([,$enable_static_programs,],
+   [*,UL_PRG,*], [static_[]UL_PRG=yes]
+  )
   AM_CONDITIONAL([HAVE_STATIC_]m4_toupper(UL_PRG),
     [test "x$static_[]UL_PRG" = xyes])
 ])
@@ -458,22 +447,18 @@ AC_CACHE_VAL([scanf_cv_alloc_modifier],
 )
 
 AC_MSG_CHECKING([scanf string alloc modifiers])
-case "$scanf_cv_alloc_modifier" in
-ms)
-  AC_MSG_RESULT([(%ms) yes])
-  AC_DEFINE([HAVE_SCANF_MS_MODIFIER], [1], [scanf %ms modifier])
-  have_scanf_alloc_modifier=yes
-  ;;
-as)
-  AC_MSG_RESULT([(%as) yes])
-  have_scanf_alloc_modifier=yes
-  AC_DEFINE([HAVE_SCANF_AS_MODIFIER], [1], [scanf %as modifier])
-  ;;
-*)
-  AC_MSG_RESULT([no])
-  have_scanf_alloc_modifier=no
-  ;;
-esac
+AS_CASE([$scanf_cv_alloc_modifier],
+  [ms],
+    [AC_MSG_RESULT([(%ms) yes])
+     AC_DEFINE([HAVE_SCANF_MS_MODIFIER], [1], [scanf %ms modifier])
+     have_scanf_alloc_modifier=yes],
+  [as],
+    [AC_MSG_RESULT([(%as) yes])
+     have_scanf_alloc_modifier=yes
+     AC_DEFINE([HAVE_SCANF_AS_MODIFIER], [1], [scanf %as modifier])],
+  [AC_MSG_RESULT([no])
+   have_scanf_alloc_modifier=no]
+)
 
 UL_CHECK_LIB([util], [openpty])
 UL_CHECK_LIB([termcap], [tgetnum])
@@ -557,9 +542,9 @@ else
 	 have_selinux=yes],
 	[have_selinux=no])
 
-  case "$with_selinux:$have_selinux" in
-  yes:no) AC_MSG_ERROR([SELinux selected but libselinux not found or too old]);;
-  esac
+  AS_CASE([$with_selinux:$have_selinux],
+    [yes:no], [AC_MSG_ERROR([SELinux selected but libselinux not found or too old])]
+  )
 
   if test "x$have_selinux" = xyes; then
     UL_SET_FLAGS([], [], [$SELINUX_LIBS])
@@ -580,11 +565,10 @@ if test "x$with_audit" = xno; then
   AM_CONDITIONAL([HAVE_AUDIT], [false])
 else
   UL_CHECK_LIB([audit], [audit_log_user_message])
-  case "$with_audit:$have_audit" in
-  yes:no)
-   AC_MSG_ERROR([Audit selected but libaudit not found (or does not support audit_log_user_message())])
-   ;;
-  esac
+  AS_CASE([$with_audit:$have_audit],
+    [yes:no],
+      [AC_MSG_ERROR([Audit selected but libaudit not found (or does not support audit_log_user_message())])]
+  )
 fi
 
 AC_ARG_WITH([udev], AS_HELP_STRING([--without-udev], [compile without udev support]),
@@ -595,11 +579,10 @@ if test "x$with_udev" = xno; then
   AM_CONDITIONAL([HAVE_UDEV], [false])
 else
   UL_CHECK_LIB([udev], [udev_new])
-  case "$with_udev:$have_udev" in
-  yes:no)
-   AC_MSG_ERROR([udev selected but libudev not found])
-   ;;
-  esac
+  AS_CASE([$with_udev:$have_udev],
+    [yes:no],
+      [AC_MSG_ERROR([udev selected but libudev not found])]
+  )
 fi
 
 AC_ARG_WITH([ncurses],
@@ -1159,12 +1142,12 @@ AC_ARG_WITH([user], AS_HELP_STRING([--without-user], [compile without libuser (r
 have_user=no
 if test "x$with_user" != xno; then
   PKG_CHECK_MODULES(LIBUSER,[libuser >= 0.58], [have_user=yes], [have_user=no])
-  case "$with_user:$have_user" in
-  yes:no)
-   AC_MSG_ERROR([user selected but libuser not found]) ;;
-  *:yes)
-   AC_DEFINE([HAVE_LIBUSER], [1], [Define if libuser is available]) ;;
-  esac
+  AS_CASE([$with_user:$have_user],
+    [yes:no],
+      [AC_MSG_ERROR([user selected but libuser not found])],
+    [*:yes],
+      [AC_DEFINE([HAVE_LIBUSER], [1], [Define if libuser is available])]
+  )
   # temporary solution, libuser has stupid .pc where are exported all
   # private dependencies to Requires: instead of Requires.private:
   if test "x$have_user" = xyes; then
@@ -1405,19 +1388,19 @@ fi
 AC_DEFUN([FS_PATHS_DEFAULT], [/sbin:/sbin/fs.d:/sbin/fs])
 AC_ARG_ENABLE([fs-paths-default],
   AS_HELP_STRING([--enable-fs-paths-default=paths], [default search path for fs helpers @<:@FS_PATHS_DEFAULT@:>@]),
-  [case "$enableval" in
-     yes) fs_paths_defaults="FS_PATHS_DEFAULT" ;;
-      no) fs_paths_defaults="" ;;
-       *) fs_paths_defaults="$enableval" ;;
-   esac],
+  [AS_CASE([$enableval],
+    [yes], [fs_paths_defaults="FS_PATHS_DEFAULT"],
+    [no],  [fs_paths_defaults=""],
+    [fs_paths_defaults="$enableval"]
+  )],
   [fs_paths_defaults="FS_PATHS_DEFAULT"]
 )
 AC_ARG_ENABLE([fs-paths-extra],
   AS_HELP_STRING([--enable-fs-paths-extra=paths], [additional search paths for fs helpers]),
-  [case "$enableval" in
-     yes|no) fs_paths_extra="" ;;
-	  *) fs_paths_extra="$enableval" ;;
-    esac],
+  [AS_CASE([$enableval],
+     [yes|no], [fs_paths_extra=""],
+     [fs_paths_extra="$enableval"]
+  )],
   [fs_paths_extra=""]
 )
 fs_paths="$fs_paths_defaults"
-- 
1.8.3.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 5/7] build-sys: prefer AS_IF rather than shell 'if'
  2013-07-28 21:11 [PATCH 1/7] lscpu: fix shadow declaration [smatch scan] Sami Kerola
                   ` (2 preceding siblings ...)
  2013-07-28 21:11 ` [PATCH 4/7] build-sys: prefer AS_CASE rather than shell 'case' Sami Kerola
@ 2013-07-28 21:11 ` Sami Kerola
  2013-07-28 21:11 ` [PATCH 6/7] build-sys: use backticks rather than $() for commands in configure Sami Kerola
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Sami Kerola @ 2013-07-28 21:11 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 configure.ac | 170 +++++++++++++++++++++++++++++------------------------------
 1 file changed, 85 insertions(+), 85 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5bf6f59..6fae31e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -147,12 +147,12 @@ AC_SYS_LARGEFILE
 
 AM_GNU_GETTEXT_VERSION([0.14.1])
 AM_GNU_GETTEXT([external])
-if test -d "$srcdir/po"
-then
-    ALL_LINGUAS=`cd $srcdir/po > /dev/null && echo *.po | sed 's/\.po//g'`
-else
-    ALL_LINGUAS="af am ar as be bg bn_IN bn ca cs cy da de el en_GB es et eu_ES fa fi fr gl gu he hi hr hu hy id is it ja ka kn ko ku lo lt lv mk ml mr ms my nb nl nn no nso or pa pl pt_BR pt ro ru si sk sl sq sr@Latn sr sv ta te th tr uk ur vi zh_CN zh_TW zu"
-fi
+
+AS_IF([test -d "$srcdir/po"], [
+  ALL_LINGUAS=`cd $srcdir/po > /dev/null && echo *.po | sed 's/\.po//g'`
+], [
+  ALL_LINGUAS="af am ar as be bg bn_IN bn ca cs cy da de el en_GB es et eu_ES fa fi fr gl gu he hi hr hu hy id is it ja ka kn ko ku lo lt lv mk ml mr ms my nb nl nn no nso or pa pl pt_BR pt ro ru si sk sl sq sr@Latn sr sv ta te th tr uk ur vi zh_CN zh_TW zu"
+])
 
 AC_CHECK_HEADERS([linux/compiler.h linux/blkpg.h linux/major.h], [], [], [
 #ifdef HAVE_LINUX_COMPILER_H
@@ -330,28 +330,28 @@ AC_CHECK_MEMBER([struct sockaddr.sa_len],
 
 SOCKET_LIBS=
 AC_SEARCH_LIBS([socket], [socket],
-	[if test x"$ac_cv_search_socket" != x"none required"; then
-		SOCKET_LIBS="$SOCKET_LIBS -lsocket";
-	fi])
+	[AS_IF([test x"$ac_cv_search_socket" != x"none required"],
+		[SOCKET_LIBS="$SOCKET_LIBS -lsocket"])
+])
 AC_SUBST([SOCKET_LIBS])
 
 
 have_dirfd=no
 AC_CHECK_FUNCS([dirfd], [have_dirfd=yes], [have_dirfd=no])
-if test x"$have_dirfd" = xno ; then
+AS_IF([test x"$have_dirfd" = xno], [
 	AC_CHECK_DECLS([dirfd],
 		[have_dirfd=yes], [have_dirfd=no],
 		[#include <sys/types.h>
 		 #include <dirent.h>])
-fi
+])
 
 have_ddfd=no
-if test x"$have_dirfd" = xno ; then
+AS_IF([test x"$have_dirfd" = xno], [
 	AC_CHECK_MEMBERS([DIR.dd_fd],
 		[have_ddfd=yes], [have_ddfd=no],
 		[#include <sys/types.h>
 		 #include <dirent.h>])
-fi
+])
 
 AS_CASE([$have_dirfd:$have_ddfd],
   [no:no],
@@ -532,9 +532,9 @@ AC_ARG_WITH([selinux],
   [], [with_selinux=no]
 )
 
-if test "x$with_selinux" = xno; then
+AS_IF([test "x$with_selinux" = xno], [
   AM_CONDITIONAL([HAVE_SELINUX], [false])
-else
+], [
   PKG_CHECK_MODULES([SELINUX], [libselinux >= 2.0],
 	[AC_DEFINE([HAVE_LIBSELINUX], [1], [Define if SELinux is available])
 	 UL_PKG_STATIC([SELINUX_LIBS_STATIC], [libselinux])
@@ -546,13 +546,13 @@ else
     [yes:no], [AC_MSG_ERROR([SELinux selected but libselinux not found or too old])]
   )
 
-  if test "x$have_selinux" = xyes; then
+  AS_IF([test "x$have_selinux" = xyes], [
     UL_SET_FLAGS([], [], [$SELINUX_LIBS])
     # This function is missing in old libselinux 1.xx versions
     AC_CHECK_FUNCS([security_get_initial_context])
     UL_RESTORE_FLAGS
-  fi
-fi
+  ])
+])
 AC_SUBST([SELINUX_LIBS])
 AC_SUBST([SELINUX_LIBS_STATIC])
 
@@ -561,29 +561,29 @@ AC_ARG_WITH([audit],
   [], [with_audit=no]
 )
 
-if test "x$with_audit" = xno; then
+AS_IF([test "x$with_audit" = xno], [
   AM_CONDITIONAL([HAVE_AUDIT], [false])
-else
+], [
   UL_CHECK_LIB([audit], [audit_log_user_message])
   AS_CASE([$with_audit:$have_audit],
     [yes:no],
       [AC_MSG_ERROR([Audit selected but libaudit not found (or does not support audit_log_user_message())])]
   )
-fi
+])
 
 AC_ARG_WITH([udev], AS_HELP_STRING([--without-udev], [compile without udev support]),
   [], [with_udev=auto]
 )
 
-if test "x$with_udev" = xno; then
+AS_IF([test "x$with_udev" = xno], [
   AM_CONDITIONAL([HAVE_UDEV], [false])
-else
+], [
   UL_CHECK_LIB([udev], [udev_new])
   AS_CASE([$with_udev:$have_udev],
     [yes:no],
       [AC_MSG_ERROR([udev selected but libudev not found])]
   )
-fi
+])
 
 AC_ARG_WITH([ncurses],
   AS_HELP_STRING([--with-ncurses], [build with non-wide ncurses, default is wide version
@@ -592,27 +592,27 @@ AC_ARG_WITH([ncurses],
 )
 AM_CONDITIONAL([HAVE_NCURSES], [false])
 
-if test "x$with_ncurses" != xno; then
+AS_IF([test "x$with_ncurses" != xno], [
   have_ncurses=no
   AC_CHECK_HEADERS([ncurses.h ncurses/ncurses.h], [
-    if test "x$with_ncurses" = xauto; then
+    AS_IF([test "x$with_ncurses" = xauto], [
       UL_CHECK_LIB([ncursesw], [initscr], [ncurses])
-      if test "x$have_ncurses" = xyes; then
+      AS_IF([test "x$have_ncurses" = xyes], [
 	AC_CHECK_HEADERS([ncursesw/ncurses.h])
 	NCURSES_LIBS="-lncursesw"
-      fi
-    fi
-    if test "x$have_ncurses" = xno; then
+      ])
+    ])
+    AS_IF([test "x$have_ncurses" = xno], [
       UL_CHECK_LIB(ncurses, initscr)
-      if test "x$have_ncurses" = xyes; then
+      AS_IF([test "x$have_ncurses" = xyes], [
 	NCURSES_LIBS="-lncurses"
-      fi
-    fi
+      ])
+    ])
   ])
-  if test "x$have_ncurses" = xno; then
+  AS_IF([test "x$have_ncurses" = xno], [
     AC_MSG_ERROR([ncurses or ncursesw selected, but library not found (--without-ncurses to disable)])
-  fi
-fi
+  ])
+])
 AC_SUBST([NCURSES_LIBS])
 
 
@@ -621,7 +621,7 @@ AC_ARG_WITH([slang],
   [], [with_slang=no]
 )
 have_slang=no
-if test "x$with_slang" = xyes; then
+AS_IF([test "x$with_slang" = xyes], [
   AC_CHECK_HEADERS([slang.h slang/slang.h])
   AC_CHECK_HEADERS([slcurses.h slang/slcurses.h],
 		   [have_slang=yes], [], [
@@ -631,10 +631,10 @@ if test "x$with_slang" = xyes; then
 #include <slang/slang.h>
 #endif
 ])
-  if test "x$have_slang" = xno; then
+  AS_IF([test "x$have_slang" = xno], [
     AC_MSG_ERROR([slang selected but slcurses.h not found])
-  fi
-fi
+  ])
+])
 AM_CONDITIONAL([HAVE_SLANG], [test "x$have_slang" = xyes])
 
 
@@ -651,21 +651,21 @@ AC_ARG_WITH([utempter],
   [], [with_utempter=no]
 )
 
-if test "x$with_utempter" = xyes; then
+AS_IF([test "x$with_utempter" = xyes], [
   UL_CHECK_LIB([utempter], [utempter_add_record])
-  if test "x$have_utempter" = xno; then
+  AS_IF([test "x$have_utempter" = xno], [
     AC_MSG_ERROR([utempter selected but libutempter not found])
-  fi
-else
+  ])
+], [
   AM_CONDITIONAL([HAVE_UTEMPTER], [false])
-fi
+])
 
 
 AC_ARG_ENABLE([most-builds],
   AS_HELP_STRING([--enable-most-builds], [build everything other than experimental code]),
   [], [enable_most_builds=no]
 )
-if test "x$enable_most_builds" = xyes; then
+AS_IF([test "x$enable_most_builds" = xyes], [
   enable_chfn_chsh=yes
   enable_elvtune=check
   enable_last=yes
@@ -677,7 +677,7 @@ if test "x$enable_most_builds" = xyes; then
   enable_tunelp=yes
   enable_vipw=yes
   enable_write=yes
-fi
+])
 
 dnl
 dnl libuuid
@@ -691,11 +691,11 @@ AC_SUBST([LIBUUID_VERSION])
 AC_SUBST([LIBUUID_VERSION_INFO])
 AM_CONDITIONAL(BUILD_LIBUUID, test "x$build_libuuid" = xyes)
 
-if test "x$enable_libuuid" = xyes; then
+AS_IF([test "x$enable_libuuid" = xyes], [
   AC_DEFINE(HAVE_LIBUUID, 1, [Define to 1 if you have the -luuid.])
-else
+], [
   AC_MSG_WARN([uuid library is not found; mkswap(8) will not generate UUIDs])
-fi
+])
 
 dnl
 dnl libblkid
@@ -710,9 +710,9 @@ AC_SUBST([LIBBLKID_VERSION])
 AC_SUBST([LIBBLKID_VERSION_INFO])
 AC_DEFINE_UNQUOTED([LIBBLKID_VERSION], ["$LIBBLKID_VERSION"], [libblkid version string])
 AC_DEFINE_UNQUOTED([LIBBLKID_DATE], ["$LIBBLKID_DATE"], [libblkid date string])
-if test "x$build_libblkid" = xyes; then
+AS_IF([test "x$build_libblkid" = xyes], [
   AC_DEFINE([HAVE_LIBBLKID], [1], [Define to 1 if you have the -lblkid.])
-fi
+])
 AM_CONDITIONAL([BUILD_LIBBLKID], [test "x$build_libblkid" = xyes])
 AM_CONDITIONAL([BUILD_LIBBLKID_TESTS], [test "x$build_libblkid" = xyes -a "x$enable_static" = xyes])
 
@@ -810,9 +810,9 @@ AC_ARG_ENABLE([uuidd],
 )
 UL_BUILD_INIT([uuidd])
 UL_REQUIRES_BUILD([uuidd], [libuuid])
-if test "x$build_uuidd" = xyes; then
+AS_IF([test "x$build_uuidd" = xyes], [
   AC_DEFINE([HAVE_UUIDD], [1], [Define to 1 if you want to use uuid daemon.])
-fi
+])
 AM_CONDITIONAL([BUILD_UUIDD], [test "x$build_uuidd" = xyes])
 
 
@@ -834,7 +834,7 @@ UL_REQUIRES_LINUX([fallocate])
 UL_REQUIRES_SYSCALL_CHECK([fallocate], [UL_CHECK_SYSCALL([fallocate])])
 AM_CONDITIONAL([BUILD_FALLOCATE], [test "x$build_fallocate" = xyes])
 
-if test "x$build_fallocate" = xyes; then
+AS_IF([test "x$build_fallocate" = xyes], [
   dnl check for valid fallocate() function
   dnl with 32 bits glibc 2.10, fallocate() exists but not fallocate64()
   dnl when _FILE_OFFSET_BITS==64, fallocate() is redirect to fallocate64()
@@ -865,7 +865,7 @@ if test "x$build_fallocate" = xyes; then
   AC_MSG_RESULT([yes])
   AC_DEFINE([HAVE_FALLOCATE], [1], [Have valid fallocate() function])],[
   AC_MSG_RESULT([no])])
-fi
+])
 
 
 AC_ARG_ENABLE([unshare],
@@ -1004,9 +1004,9 @@ UL_BUILD_INIT([prlimit], [check])
 UL_REQUIRES_LINUX([prlimit])
 UL_REQUIRES_SYSCALL_CHECK([prlimit], [UL_CHECK_SYSCALL([prlimit64])], [prlimit64])
 AM_CONDITIONAL([BUILD_PRLIMIT], [test "x$build_prlimit" = xyes])
-if test "x$build_prlimit" = xyes; then
+AS_IF([test "x$build_prlimit" = xyes], [
   AC_CHECK_FUNCS([prlimit])
-fi
+])
 
 
 UL_BUILD_INIT([lslocks], [check])
@@ -1140,7 +1140,7 @@ AC_ARG_WITH([user], AS_HELP_STRING([--without-user], [compile without libuser (r
   [], [with_user=check]
 )
 have_user=no
-if test "x$with_user" != xno; then
+AS_IF([test "x$with_user" != xno], [
   PKG_CHECK_MODULES(LIBUSER,[libuser >= 0.58], [have_user=yes], [have_user=no])
   AS_CASE([$with_user:$have_user],
     [yes:no],
@@ -1150,10 +1150,10 @@ if test "x$with_user" != xno; then
   )
   # temporary solution, libuser has stupid .pc where are exported all
   # private dependencies to Requires: instead of Requires.private:
-  if test "x$have_user" = xyes; then
+  AS_IF([test "x$have_user" = xyes], [
     LIBUSER_LIBS=-luser
-  fi
-fi
+  ])
+])
 AM_CONDITIONAL([HAVE_USER], [test "x$have_user" = xyes])
 
 AC_ARG_ENABLE([chfn-chsh-password],
@@ -1167,10 +1167,10 @@ AC_ARG_ENABLE([chfn-chsh],
 )
 UL_BUILD_INIT([chfn_chsh])
 
-if test "x$enable_chfn_chsh_password" = xyes -o "x$have_user" = xyes; then
+AS_IF([test "x$enable_chfn_chsh_password" = xyes -o "x$have_user" = xyes], [
   UL_REQUIRES_HAVE([chfn_chsh], [security_pam_misc_h], [PAM header file])
   AC_DEFINE([CHFN_CHSH_PASSWORD], [1], [Should chfn and chsh require the user to enter the password?])
-fi
+])
 AM_CONDITIONAL([BUILD_CHFN_CHSH], [test "x$build_chfn_chsh" = xyes])
 AM_CONDITIONAL([CHFN_CHSH_PASSWORD], [test "x$enable_chfn_chsh_password" = xyes])
 
@@ -1179,9 +1179,9 @@ AS_HELP_STRING([--disable-chsh-only-listed], [chsh: allow shells not in /etc/she
 [], enable_chsh_only_listed=yes
 )
 
-if test "x$enable_chsh_only_listed" = xyes; then
-AC_DEFINE([ONLY_LISTED_SHELLS], [1], [Should chsh allow only shells in /etc/shells?])
-fi
+AS_IF([test "x$enable_chsh_only_listed" = xyes], [
+  AC_DEFINE([ONLY_LISTED_SHELLS], [1], [Should chsh allow only shells in /etc/shells?])
+])
 
 
 AC_ARG_ENABLE([login],
@@ -1197,18 +1197,18 @@ AC_ARG_ENABLE([login-chown-vcs],
   [], [enable_login_chown_vcs=no]
 )
 
-if test "x$enable_login_chown_vcs" = xyes; then
+AS_IF([test "x$enable_login_chown_vcs" = xyes], [
   AC_DEFINE([LOGIN_CHOWN_VCS], [1], [Should login chown /dev/vcsN?])
-fi
+])
 
 AC_ARG_ENABLE([login-stat-mail],
   AS_HELP_STRING([--enable-login-stat-mail], [let login stat() the mailbox]),
   [], [enable_login_stat_mail=no]
 )
 
-if test "x$enable_login_stat_mail" = xyes; then
+AS_IF([test "x$enable_login_stat_mail" = xyes], [
   AC_DEFINE([LOGIN_STAT_MAIL], [1], [Should login stat() the mailbox?])
-fi
+])
 
 
 AC_ARG_ENABLE([sulogin],
@@ -1341,17 +1341,17 @@ AC_ARG_ENABLE([socket-activation],
 
 AM_CONDITIONAL([USE_SOCKET_ACTIVATION], [test "x$enable_socket_activation" = xyes])
 
-if test "x$enable_socket_activation" = xyes; then
+AS_IF([test "x$enable_socket_activation" = xyes], [
   AC_DEFINE([USE_SOCKET_ACTIVATION], [1], [Should uuidd support socket activation?])
-fi
+])
 
 AC_ARG_WITH([systemdsystemunitdir],
   AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [directory for systemd service files]),
   [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
 
-if test "x$with_systemdsystemunitdir" != "xno"; then
+AS_IF([test "x$with_systemdsystemunitdir" != "xno"], [
   AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
-fi
+])
 
 AM_CONDITIONAL([HAVE_SYSTEMD], [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != "xno" ])
 
@@ -1380,9 +1380,9 @@ AC_ARG_ENABLE([pg-bell],
   [], [enable_pg_bell=yes]
 )
 
-if test "x$enable_pg_bell" = xyes; then
+AS_IF([test "x$enable_pg_bell" = xyes], [
   AC_DEFINE([PG_BELL], [1], [Should pg ring the bell on invalid keys?])
-fi
+])
 
 
 AC_DEFUN([FS_PATHS_DEFAULT], [/sbin:/sbin/fs.d:/sbin/fs])
@@ -1404,12 +1404,12 @@ AC_ARG_ENABLE([fs-paths-extra],
   [fs_paths_extra=""]
 )
 fs_paths="$fs_paths_defaults"
-if test "x$fs_paths_extra" != "x"; then
-  if test "x$fs_paths" != "x"; then
+AS_IF([test "x$fs_paths_extra" != "x"], [
+  AS_IF([test "x$fs_paths" != "x"], [
     fs_paths="${fs_paths}:"
-  fi
+  ])
   fs_paths="${fs_paths}${fs_paths_extra}"
-fi
+])
 AC_DEFINE_UNQUOTED([FS_SEARCH_PATH], "$fs_paths", [search path for fs helpers])
 
 
@@ -1419,9 +1419,9 @@ AC_ARG_ENABLE([use-tty-group],
 )
 AM_CONDITIONAL([USE_TTY_GROUP], [test "x$enable_use_tty_group" = xyes])
 
-if test "x$enable_use_tty_group" = xyes; then
+AS_IF([test "x$enable_use_tty_group" = xyes], [
   AC_DEFINE([USE_TTY_GROUP], [1], [Should wall and write be installed setgid tty?])
-fi
+])
 
 
 AC_ARG_ENABLE([sulogin-emergency-mount],
@@ -1430,10 +1430,10 @@ AC_ARG_ENABLE([sulogin-emergency-mount],
   [], [enable_sulogin_emergency_mount=no]
 )
 
-if test "x$enable_sulogin_emergency_mount" = xyes; then
+AS_IF([test "x$enable_sulogin_emergency_mount" = xyes], [
   AC_DEFINE([USE_SULOGIN_EMERGENCY_MOUNT], [1],
 	    [Should sulogin use a emergency mount of /dev and /proc?])
-fi
+])
 
 
 AC_ARG_ENABLE([makeinstall-chown],
-- 
1.8.3.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 6/7] build-sys: use backticks rather than $() for commands in configure
  2013-07-28 21:11 [PATCH 1/7] lscpu: fix shadow declaration [smatch scan] Sami Kerola
                   ` (3 preceding siblings ...)
  2013-07-28 21:11 ` [PATCH 5/7] build-sys: prefer AS_IF rather than shell 'if' Sami Kerola
@ 2013-07-28 21:11 ` Sami Kerola
  2013-07-28 21:11 ` [PATCH 7/7] rev: use string printing rather than character output Sami Kerola
  2013-08-01 11:41 ` [PATCH 1/7] lscpu: fix shadow declaration [smatch scan] Karel Zak
  6 siblings, 0 replies; 8+ messages in thread
From: Sami Kerola @ 2013-07-28 21:11 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

The configure had both backticks and $() in use.  These command
susbstitutions are mutually interchangeable, so one should pick only one
form.  In this case backticks were favored because they are known with
greater range of shells, making the backticks to be more portable.

References: https://www.gnu.org/software/autoconf/manual/autoconf-2.67/html_node/Shell-Substitutions.html#index-g_t_0024_0028_0040var_007bcommands_007d_0029-1632
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 configure.ac | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6fae31e..7252e9b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1347,7 +1347,7 @@ AS_IF([test "x$enable_socket_activation" = xyes], [
 
 AC_ARG_WITH([systemdsystemunitdir],
   AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [directory for systemd service files]),
-  [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
+  [], [with_systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd`])
 
 AS_IF([test "x$with_systemdsystemunitdir" != "xno"], [
   AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
@@ -1359,8 +1359,8 @@ AM_CONDITIONAL([HAVE_SYSTEMD], [test -n "$with_systemdsystemunitdir" -a "x$with_
 AC_ARG_WITH([bashcompletiondir],
   AS_HELP_STRING([--with-bashcompletiondir=DIR], [Bash completions directory]),
   [],
-  [AS_IF([$($PKG_CONFIG --exists bash-completion)], [
-    with_bashcompletiondir=$($PKG_CONFIG --variable=completionsdir bash-completion)
+  [AS_IF([`$PKG_CONFIG --exists bash-completion`], [
+    with_bashcompletiondir=`$PKG_CONFIG --variable=completionsdir bash-completion`
   ], [
     with_bashcompletiondir=${datadir}/bash-completion/completions
   ])
-- 
1.8.3.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 7/7] rev: use string printing rather than character output
  2013-07-28 21:11 [PATCH 1/7] lscpu: fix shadow declaration [smatch scan] Sami Kerola
                   ` (4 preceding siblings ...)
  2013-07-28 21:11 ` [PATCH 6/7] build-sys: use backticks rather than $() for commands in configure Sami Kerola
@ 2013-07-28 21:11 ` Sami Kerola
  2013-08-01 11:41 ` [PATCH 1/7] lscpu: fix shadow declaration [smatch scan] Karel Zak
  6 siblings, 0 replies; 8+ messages in thread
From: Sami Kerola @ 2013-07-28 21:11 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

Fliping a string in memory, and printing it with multibyte output
function makes the command about 1/3 quicker.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 text-utils/rev.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/text-utils/rev.c b/text-utils/rev.c
index 1c44036..85e1630 100644
--- a/text-utils/rev.c
+++ b/text-utils/rev.c
@@ -86,10 +86,20 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
 	exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
 }
 
+static void reverse_str(wchar_t *str, size_t n)
+{
+	size_t i;
+
+	for (i = 0; i < n / 2; ++i) {
+		wchar_t tmp = str[i];
+		str[i] = str[n - 1 - i];
+		str[n - 1 - i] = tmp;
+	}
+}
+
 int main(int argc, char *argv[])
 {
 	char *filename = "stdin";
-	wchar_t *t;
 	size_t len, bufsiz = BUFSIZ;
 	FILE *fp = stdin;
 	int ch, rval = EXIT_SUCCESS;
@@ -153,13 +163,8 @@ int main(int argc, char *argv[])
 
 				len = wcslen(buf);
 			}
-
-			if (*(t = buf + len - 1) == '\n')
-				--t;
-			for ( ; buf <= t; --t)
-				putwchar(*t);
-			if (!feof(fp))
-				putwchar('\n');
+			reverse_str(buf, len - 1);
+			fputws(buf, stdout);
 		}
 		if (ferror(fp)) {
 			warn("%s", filename);
-- 
1.8.3.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/7] lscpu: fix shadow declaration [smatch scan]
  2013-07-28 21:11 [PATCH 1/7] lscpu: fix shadow declaration [smatch scan] Sami Kerola
                   ` (5 preceding siblings ...)
  2013-07-28 21:11 ` [PATCH 7/7] rev: use string printing rather than character output Sami Kerola
@ 2013-08-01 11:41 ` Karel Zak
  6 siblings, 0 replies; 8+ messages in thread
From: Karel Zak @ 2013-08-01 11:41 UTC (permalink / raw)
  To: Sami Kerola; +Cc: util-linux

On Sun, Jul 28, 2013 at 10:11:15PM +0100, Sami Kerola wrote:
>  sys-utils/lscpu.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

 Applied all 7 patches, thanks!

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-08-01 11:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-28 21:11 [PATCH 1/7] lscpu: fix shadow declaration [smatch scan] Sami Kerola
2013-07-28 21:11 ` [PATCH 2/7] setarch: prefer preprocessor rather than autotools check Sami Kerola
2013-07-28 21:11 ` [PATCH 3/7] build-sys: use m4 quoting consistently Sami Kerola
2013-07-28 21:11 ` [PATCH 4/7] build-sys: prefer AS_CASE rather than shell 'case' Sami Kerola
2013-07-28 21:11 ` [PATCH 5/7] build-sys: prefer AS_IF rather than shell 'if' Sami Kerola
2013-07-28 21:11 ` [PATCH 6/7] build-sys: use backticks rather than $() for commands in configure Sami Kerola
2013-07-28 21:11 ` [PATCH 7/7] rev: use string printing rather than character output Sami Kerola
2013-08-01 11:41 ` [PATCH 1/7] lscpu: fix shadow declaration [smatch scan] Karel Zak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.