[dpkg] 07/187: build: Fix M4sh/Autoconf coding style
Reiner Herrmann
reiner at reiner-h.de
Sun Nov 6 12:46:18 UTC 2016
This is an automated email from the git hooks/post-receive script.
deki-guest pushed a commit to branch master
in repository dpkg.
commit 9aa458e8a34bdef30538a84e6cf74bc4ac5d4d6c
Author: Guillem Jover <guillem at debian.org>
Date: Sun Aug 28 18:59:03 2016 +0200
build: Fix M4sh/Autoconf coding style
Indent the code in a way that makes it easier to follow. Use AS_IF
instead of shell constructs. Quote all autoconf macro arguments.
Add a new section to coding-style.txt describing M4sh/Autoconf.
---
configure.ac | 128 ++++++++++++++++++++++++--------------
debian/changelog | 2 +
doc/coding-style.txt | 54 ++++++++++++++++
m4/dpkg-arch.m4 | 78 +++++++++++------------
m4/dpkg-build.m4 | 33 +++++-----
m4/dpkg-compiler.m4 | 45 +++++++-------
m4/dpkg-coverage.m4 | 79 ++++++++++++------------
m4/dpkg-funcs.m4 | 120 ++++++++++++++++++++----------------
m4/dpkg-libs.m4 | 171 +++++++++++++++++++++++++++------------------------
m4/dpkg-linker.m4 | 39 ++++++------
m4/dpkg-progs.m4 | 53 ++++++++--------
m4/dpkg-types.m4 | 58 +++++++++--------
m4/dpkg-unicode.m4 | 11 ++--
13 files changed, 492 insertions(+), 379 deletions(-)
diff --git a/configure.ac b/configure.ac
index 7f22d8e..9ab683b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,8 +16,11 @@ AM_SILENT_RULES([yes])
# Do not unconditionally use the following macro, as Debian jessie does not
# have a recent enough gettext.
-m4_ifdef([AM_GNU_GETTEXT_REQUIRE_VERSION],
- [AM_GNU_GETTEXT_REQUIRE_VERSION([0.19])])
+m4_ifdef([
+ AM_GNU_GETTEXT_REQUIRE_VERSION
+], [
+ AM_GNU_GETTEXT_REQUIRE_VERSION([0.19])
+])
# We cannot remove the following macro due to backwards compatibility reasons.
# In the future when the gettext version is bumped, we have to set the above
# macro unconditionally to the minimal version, and set the below to 0.19.6,
@@ -25,7 +28,7 @@ m4_ifdef([AM_GNU_GETTEXT_REQUIRE_VERSION],
AM_GNU_GETTEXT_VERSION([0.19])
AM_GNU_GETTEXT([external])
DPKG_DIST_CHECK([test "$GMSGFMT" = ":" && test "$USE_NLS" = "yes"],
- [gettext required when NLS support enabled])
+ [gettext required when NLS support enabled])
# Shared libraries are disabled on purpose, currently there is no ABI stability
# guarantee, and it will be broken at will. The infrastructure is in place just
@@ -44,13 +47,13 @@ DPKG_BUILD_DEVEL_DOCS
# Allow alternate directories
DPKG_WITH_DIR([devlibdir], [${libdir}],
- [dpkg development library directory [LIBDIR]])
+ [dpkg development library directory [LIBDIR]])
DPKG_WITH_DIR([pkgconfdir], [${sysconfdir}/${PACKAGE_NAME}],
- [dpkg configuration directory [SYSCONFDIR/dpkg]])
+ [dpkg configuration directory [SYSCONFDIR/dpkg]])
DPKG_WITH_DIR([admindir], [${localstatedir}/lib/${PACKAGE_NAME}],
- [dpkg database directory [LOCALSTATEDIR/lib/dpkg]])
+ [dpkg database directory [LOCALSTATEDIR/lib/dpkg]])
DPKG_WITH_DIR([logdir], [${localstatedir}/log],
- [system logging directory [LOCALSTATEDIR/log]])
+ [system logging directory [LOCALSTATEDIR/log]])
# Set default dpkg-deb values
DPKG_DEB_COMPRESSOR([xz])
@@ -77,19 +80,31 @@ DPKG_LIB_Z
DPKG_LIB_BZ2
DPKG_LIB_LZMA
DPKG_LIB_SELINUX
-if test "x$build_dselect" = "xyes"; then
- DPKG_LIB_CURSES
-fi
-if test "x$build_start_stop_daemon" = "xyes"; then
- DPKG_LIB_PS
- DPKG_LIB_KVM
-fi
+AS_IF([test "x$build_dselect" = "xyes"], [
+ DPKG_LIB_CURSES
+])
+AS_IF([test "x$build_start_stop_daemon" = "xyes"], [
+ DPKG_LIB_PS
+ DPKG_LIB_KVM
+])
# Checks for header files.
AC_HEADER_STDC
-AC_CHECK_HEADERS([stddef.h error.h err.h locale.h libintl.h kvm.h \
- sys/param.h sys/sysctl.h sys/syscall.h sys/user.h \
- sys/proc.h sys/pstat.h linux/fiemap.h])
+AC_CHECK_HEADERS([\
+ stddef.h \
+ error.h \
+ err.h \
+ locale.h \
+ libintl.h \
+ kvm.h \
+ sys/param.h \
+ sys/sysctl.h \
+ sys/syscall.h \
+ sys/user.h \
+ sys/proc.h \
+ sys/pstat.h \
+ linux/fiemap.h \
+])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_BIGENDIAN
@@ -118,45 +133,66 @@ DPKG_CHECK_DECL([F_ALLOCSP64], [fcntl.h])
DPKG_CHECK_DECL([F_PREALLOCATE], [fcntl.h])
DPKG_CHECK_DECL([P_tmpdir], [stdio.h])
DPKG_CHECK_PROGNAME
-DPKG_CHECK_COMPAT_FUNCS([getopt getopt_long obstack_free \
- strnlen strndup strerror strsignal asprintf \
- scandir alphasort unsetenv])
+DPKG_CHECK_COMPAT_FUNCS([\
+ getopt \
+ getopt_long \
+ obstack_free \
+ strnlen \
+ strndup \
+ strerror \
+ strsignal \
+ asprintf \
+ scandir \
+ alphasort \
+ unsetenv \
+])
AC_CHECK_FUNCS([memcpy lchown],
- [], [AC_MSG_ERROR([missing required function])])
-AC_CHECK_FUNCS([strtoimax isascii setsid getdtablesize \
- getprogname getexecname lutimes \
- fallocate posix_fallocate posix_fadvise])
+ [], [AC_MSG_ERROR([missing required function])])
+AC_CHECK_FUNCS([\
+ strtoimax \
+ isascii \
+ setsid \
+ getdtablesize \
+ getprogname \
+ getexecname \
+ lutimes \
+ fallocate \
+ posix_fallocate \
+ posix_fadvise \
+])
DPKG_MMAP
# Checks for the build machinery.
-AC_DEFINE(LIBDPKG_VOLATILE_API, 1, [Acknowledge the volatility of the API.])
+AC_DEFINE([LIBDPKG_VOLATILE_API], [1], [Acknowledge the volatility of the API.])
DPKG_COMPILER_WARNINGS
DPKG_COMPILER_OPTIMIZATIONS
DPKG_LINKER_OPTIMIZATIONS
DPKG_ARCHITECTURE
AC_DEFINE([PACKAGE_RELEASE], [PACKAGE_VERSION " (" ARCHITECTURE ")"],
- [Define the project release information, version and architecture])
-
-AC_CONFIG_FILES([ Makefile
- dpkg-deb/Makefile
- dpkg-split/Makefile
- dselect/Makefile
- dselect/methods/Makefile
- dselect/po/Makefile.in
- lib/Makefile
- lib/compat/Makefile
- lib/dpkg/Makefile
- lib/dpkg/libdpkg.pc
- lib/dpkg/t/Makefile
- doc/Doxyfile
- man/Makefile
- po/Makefile.in
- scripts/Makefile
- scripts/mk/Makefile
- scripts/po/Makefile.in
- src/Makefile
- utils/Makefile ])
+ [Define the project release information, version and architecture])
+
+AC_CONFIG_FILES([
+ Makefile
+ dpkg-deb/Makefile
+ dpkg-split/Makefile
+ dselect/Makefile
+ dselect/methods/Makefile
+ dselect/po/Makefile.in
+ lib/Makefile
+ lib/compat/Makefile
+ lib/dpkg/Makefile
+ lib/dpkg/libdpkg.pc
+ lib/dpkg/t/Makefile
+ doc/Doxyfile
+ man/Makefile
+ po/Makefile.in
+ scripts/Makefile
+ scripts/mk/Makefile
+ scripts/po/Makefile.in
+ src/Makefile
+ utils/Makefile
+])
AC_CONFIG_HEADERS([config.h])
AC_OUTPUT
diff --git a/debian/changelog b/debian/changelog
index 4001219..c250b4f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,8 @@ dpkg (1.18.11) UNRELEASED; urgency=medium
- Add support for profiling perl modules.
- Clean up compiler and linker automatic flag usage in configure.
- Fix the __progname check to avoid the optimizer discarding the symbol.
+ - Fix M4sh/Autoconf coding style. Add a new section to coding-style.txt
+ describing M4sh/Autoconf.
[ Updated manpages translations ]
* German (Helge Kreutzmann).
diff --git a/doc/coding-style.txt b/doc/coding-style.txt
index 06bf3b7..0e07806 100644
--- a/doc/coding-style.txt
+++ b/doc/coding-style.txt
@@ -14,6 +14,60 @@ Every new feature, option or behavior change needs to be documented with
the version introducing the change.
+Dpkg M4sh/Autoconf coding style 1016-09-05
+===============================
+
+General
+~~~~~~~
+
+All dpkg specific macros need to be prefixed with «DPKG_». Complex checks
+should be defined as new macros under m4/dpkg-<name>.m4, and those used
+in configure.ac which should look pretty simple.
+
+Quoting and indentation
+~~~~~~~~~~~~~~~~~~~~~~~
+
+Code and arguments that wrap into the next line are indented by two spaces.
+
+In principle all macro argument should always be quoted. Which gives brings
+one of the biggest readability issues with M4sh/Autoconf code, the amount of
+consecutive quotes and parenthesis pairs, which can make it very hard to
+notice if they are unbalanced. To avoid this we use a style that tries to
+avoid more than two consecutive blocks of «])».
+
+We can either use a style resembling very simple function calls, when the
+arguments are as well very simple, such as:
+
+ AC_DEFINE_UNQUOTED([SOME_VARIABLE],
+ [SOME_CONCOCTED_WAY_TO_GET_A_VALUE],
+ [Some descriptive text here])
+
+ AS_CASE([condition],
+ [case-a], [do-a],
+ [case-b], [do-b])
+
+Or one resembling curly-braced C-style blocks, such as this:
+
+ AS_IF([condition], [
+ DO_SOMETHING([here])
+ ], [
+ DO_OTHERWISE([there])
+ ])
+
+Except for AC_ARG_WITH, AC_ARG_ENABLE and AM_CONDITIONAL which need their
+second argument quoted tightly surrounding the code, like this:
+
+ AC_ARG_ENABLE([feature],
+ [AS_HELP_STRING([--disable-feature], [Disable feature])],
+ [], [enable_feature="yes"])
+
+ AM_CONDITIONAL([HAVE_SOME_FEATURE],
+ [test "x$ac_cv_have_some_feature" = "xyes" && \
+ test "x$ac_cv_have_some_feature" = "xyes"])
+
+or the output will get messed up.
+
+
Dpkg C/C++ coding style 2016-01-29
=======================
diff --git a/m4/dpkg-arch.m4 b/m4/dpkg-arch.m4
index aae223a..3744abc 100644
--- a/m4/dpkg-arch.m4
+++ b/m4/dpkg-arch.m4
@@ -6,61 +6,61 @@
# Use dpkg-architecture from the source tree to set sh_var using DEB_VAR for
# the target architecture, to avoid duplicating its logic.
AC_DEFUN([_DPKG_ARCHITECTURE], [
-AC_REQUIRE([DPKG_PROG_PERL])dnl
-AC_REQUIRE([AC_CANONICAL_HOST])dnl
-$2=$(PERL=$PERL $srcdir/run-script scripts/dpkg-architecture.pl -t$host -q$1 2>/dev/null)
+ AC_REQUIRE([DPKG_PROG_PERL])dnl
+ AC_REQUIRE([AC_CANONICAL_HOST])dnl
+ $2=$(PERL=$PERL $srcdir/run-script scripts/dpkg-architecture.pl -t$host -q$1 2>/dev/null)
])# _DPKG_ARCHITECURE
# DPKG_CPU_TYPE
# -------------
# Parse the host cpu name and check it against the cputable to determine
# the Debian name for it. Sets ARCHITECTURE_CPU.
-AC_DEFUN([DPKG_CPU_TYPE],
-[AC_MSG_CHECKING([dpkg cpu type])
-_DPKG_ARCHITECTURE([DEB_HOST_ARCH_CPU], [cpu_type])
-if test "x$cpu_type" = "x"; then
- cpu_type=$host_cpu
- AC_MSG_RESULT([$cpu_type])
- AC_MSG_WARN([$host_cpu not found in cputable])
-else
- AC_MSG_RESULT([$cpu_type])
-fi
-AC_DEFINE_UNQUOTED(ARCHITECTURE_CPU, "${cpu_type}",
- [Set this to the canonical dpkg CPU name.])
+AC_DEFUN([DPKG_CPU_TYPE], [
+ AC_MSG_CHECKING([dpkg cpu type])
+ _DPKG_ARCHITECTURE([DEB_HOST_ARCH_CPU], [cpu_type])
+ AS_IF([test "x$cpu_type" = "x"], [
+ cpu_type=$host_cpu
+ AC_MSG_RESULT([$cpu_type])
+ AC_MSG_WARN([$host_cpu not found in cputable])
+ ], [
+ AC_MSG_RESULT([$cpu_type])
+ ])
+ AC_DEFINE_UNQUOTED([ARCHITECTURE_CPU], ["${cpu_type}"],
+ [Set this to the canonical dpkg CPU name.])
])# DPKG_CPU_TYPE
# DPKG_OS_TYPE
# ------------
# Parse the host operating system name and check it against a list of
# special cases to determine what type it is. Sets ARCHITECTURE_OS.
-AC_DEFUN([DPKG_OS_TYPE],
-[AC_MSG_CHECKING([dpkg operating system type])
-_DPKG_ARCHITECTURE([DEB_HOST_ARCH_OS], [os_type])
-if test "x$os_type" = "x"; then
- os_type=$host_os
- AC_MSG_RESULT([$os_type])
- AC_MSG_WARN([$host_os not found in ostable])
-else
- AC_MSG_RESULT([$os_type])
-fi
-AC_DEFINE_UNQUOTED(ARCHITECTURE_OS, "${os_type}",
- [Set this to the canonical dpkg system name.])
+AC_DEFUN([DPKG_OS_TYPE], [
+ AC_MSG_CHECKING([dpkg operating system type])
+ _DPKG_ARCHITECTURE([DEB_HOST_ARCH_OS], [os_type])
+ AS_IF([test "x$os_type" = "x"], [
+ os_type=$host_os
+ AC_MSG_RESULT([$os_type])
+ AC_MSG_WARN([$host_os not found in ostable])
+ ], [
+ AC_MSG_RESULT([$os_type])
+ ])
+ AC_DEFINE_UNQUOTED([ARCHITECTURE_OS], ["${os_type}"],
+ [Set this to the canonical dpkg system name.])
])# DPKG_OS_TYPE
# DPKG_ARCHITECTURE
# ------------------------
# Determine the Debian name for the host operating system,
# sets ARCHITECTURE.
-AC_DEFUN([DPKG_ARCHITECTURE],
-[DPKG_CPU_TYPE
-DPKG_OS_TYPE
-AC_MSG_CHECKING([dpkg architecture name])
-_DPKG_ARCHITECTURE([DEB_HOST_ARCH], [dpkg_arch])
-if test "x$dpkg_arch" = "x"; then
- AC_MSG_ERROR([cannot determine host dpkg architecture])
-else
- AC_MSG_RESULT([$dpkg_arch])
-fi
-AC_DEFINE_UNQUOTED(ARCHITECTURE, "${dpkg_arch}",
- [Set this to the canonical dpkg architecture name.])
+AC_DEFUN([DPKG_ARCHITECTURE], [
+ DPKG_CPU_TYPE
+ DPKG_OS_TYPE
+ AC_MSG_CHECKING([dpkg architecture name])
+ _DPKG_ARCHITECTURE([DEB_HOST_ARCH], [dpkg_arch])
+ AS_IF([test "x$dpkg_arch" = "x"], [
+ AC_MSG_ERROR([cannot determine host dpkg architecture])
+ ], [
+ AC_MSG_RESULT([$dpkg_arch])
+ ])
+ AC_DEFINE_UNQUOTED([ARCHITECTURE], ["${dpkg_arch}"],
+ [Set this to the canonical dpkg architecture name.])
])# DPKG_ARCHITECTURE
diff --git a/m4/dpkg-build.m4 b/m4/dpkg-build.m4
index 828f182..bb766c9 100644
--- a/m4/dpkg-build.m4
+++ b/m4/dpkg-build.m4
@@ -4,8 +4,9 @@
# ----------------------
AC_DEFUN([DPKG_BUILD_SHARED_LIBS], [
m4_pattern_allow([DPKG_DEVEL_MODE])
- AS_IF([test "$enable_shared" = "yes" && test -z "$DPKG_DEVEL_MODE"],
- [AC_MSG_ERROR([building libdpkg as a shared library is not supported])])
+ AS_IF([test "$enable_shared" = "yes" && test -z "$DPKG_DEVEL_MODE"], [
+ AC_MSG_ERROR([building libdpkg as a shared library is not supported])
+ ])
AM_CONDITIONAL([BUILD_SHARED], [test "$enable_shared" = "yes"])
])# DPKG_BUILD_SHARED_LIBS
@@ -15,16 +16,15 @@ AC_DEFUN([DPKG_BUILD_SHARED_LIBS], [
AC_DEFUN([DPKG_BUILD_PROG], [
AC_MSG_CHECKING([whether to build $1])
AC_ARG_ENABLE([$1],
- AS_HELP_STRING([--disable-$1], [do not build or use $1]),
+ [AS_HELP_STRING([--disable-$1], [do not build or use $1])],
[build_]AS_TR_SH([$1])[=$enable_]AS_TR_SH([$1]),
- [build_]AS_TR_SH([$1])[=yes]
- )
+ [build_]AS_TR_SH([$1])[=yes])
AM_CONDITIONAL([BUILD_]AS_TR_CPP([$1]),
- [test "x$build_]AS_TR_SH([$1])[" = "xyes"])
+ [test "x$build_]AS_TR_SH([$1])[" = "xyes"])
AS_IF([test "x$build_]AS_TR_SH([$1])[" = "xyes"], [
- AC_DEFINE([BUILD_]AS_TR_CPP([$1]), 1, [Define to 1 if $1 is compiled.])
+ AC_DEFINE([BUILD_]AS_TR_CPP([$1]), [1], [Define to 1 if $1 is compiled.])
], [
- AC_DEFINE([BUILD_]AS_TR_CPP([$1]), 0)
+ AC_DEFINE([BUILD_]AS_TR_CPP([$1]), [0])
])
AC_MSG_RESULT([$build_]AS_TR_SH([$1]))
])# DPKG_BUILD_PROG
@@ -35,7 +35,7 @@ AC_DEFUN([DPKG_BUILD_PROG], [
# all symbol references, and extracting everything, or production documentation.
AC_DEFUN([DPKG_BUILD_DEVEL_DOCS], [
AC_ARG_ENABLE([devel-docs],
- AS_HELP_STRING([--disable-devel-docs], [build release docs]),
+ [AS_HELP_STRING([--disable-devel-docs], [build release docs])],
[build_devel_docs=$enable_devel_docs],
[build_devel_docs=yes]
)
@@ -51,12 +51,11 @@ AC_DEFUN([DPKG_BUILD_DEVEL_DOCS], [
# Allow specifying alternate directories.
AC_DEFUN([DPKG_WITH_DIR], [
$1="$2"
- AC_ARG_WITH([$1],
- AS_HELP_STRING([--with-$1=DIR], [$3]),
+ AC_ARG_WITH([$1], [AS_HELP_STRING([--with-$1=DIR], [$3])], [
AS_CASE([$with_$1],
- [""], [AC_MSG_ERROR([invalid $1 specified])],
- [$1="$with_$1"])
- )
+ [""], [AC_MSG_ERROR([invalid $1 specified])],
+ [$1="$with_$1"])
+ ])
AC_SUBST([$1])
])# DPKG_WITH_DIR
@@ -66,14 +65,14 @@ AC_DEFUN([DPKG_WITH_DIR], [
AC_DEFUN([DPKG_DEB_COMPRESSOR], [
AC_ARG_WITH([dpkg-deb-compressor],
[AS_HELP_STRING([--with-dpkg-deb-compressor=COMP],
- [change default dpkg-deb build compressor])],
+ [change default dpkg-deb build compressor])],
[with_dpkg_deb_compressor=$withval], [with_dpkg_deb_compressor=$1])
AS_CASE([$with_dpkg_deb_compressor],
[gzip|xz], [:],
[AC_MSG_ERROR([unsupported default compressor $with_dpkg_deb_compressor])])
AC_DEFINE_UNQUOTED([DPKG_DEB_DEFAULT_COMPRESSOR],
- [COMPRESSOR_TYPE_]AS_TR_CPP(${with_dpkg_deb_compressor}),
- [default dpkg-deb build compressor])
+ [COMPRESSOR_TYPE_]AS_TR_CPP(${with_dpkg_deb_compressor}),
+ [default dpkg-deb build compressor])
]) # DPKG_DEB_COMPRESSOR
# DPKG_DIST_CHECK(COND, ERROR)
diff --git a/m4/dpkg-compiler.m4 b/m4/dpkg-compiler.m4
index 15ff569..cca6a2a 100644
--- a/m4/dpkg-compiler.m4
+++ b/m4/dpkg-compiler.m4
@@ -31,8 +31,9 @@ AC_DEFUN([DPKG_CHECK_COMPILER_FLAG], [
])
AS_VAR_COPY([dpkg_varname], [dpkg_varname_save])
])
- AS_VAR_IF([dpkg_varname_cache], [yes],
- [AS_VAR_APPEND([dpkg_varname_export], [" $1"])])
+ AS_VAR_IF([dpkg_varname_cache], [yes], [
+ AS_VAR_APPEND([dpkg_varname_export], [" $1"])
+ ])
AS_VAR_POPDEF([dpkg_varname_cache])
])
@@ -83,13 +84,11 @@ AC_DEFUN([DPKG_CHECK_COMPILER_WARNINGS], [
# Add configure option to disable additional compiler warnings.
AC_DEFUN([DPKG_COMPILER_WARNINGS], [
AC_ARG_ENABLE([compiler-warnings],
- AS_HELP_STRING([--disable-compiler-warnings],
- [Disable (detected) additional compiler warnings]),
- [],
- [enable_compiler_warnings=yes]
- )
+ [AS_HELP_STRING([--disable-compiler-warnings],
+ [Disable (detected) additional compiler warnings])],
+ [], [enable_compiler_warnings=yes])
- if test "x$enable_compiler_warnings" = "xyes"; then
+ AS_IF([test "x$enable_compiler_warnings" = "xyes"], [
DPKG_CHECK_COMPILER_WARNINGS
AC_LANG_PUSH([C++])
DPKG_CHECK_COMPILER_WARNINGS
@@ -97,19 +96,17 @@ AC_DEFUN([DPKG_COMPILER_WARNINGS], [
CFLAGS="$COMPILER_CFLAGS $CFLAGS"
CXXFLAGS="$COMPILER_CXXFLAGS $CXXFLAGS"
- fi
+ ])
])
# DPKG_COMPILER_OPTIMIZATIONS
# ---------------------------
# Add configure option to disable optimizations.
AC_DEFUN([DPKG_COMPILER_OPTIMIZATIONS], [
- AC_ARG_ENABLE(compiler-optimizations,
- AS_HELP_STRING([--disable-compiler-optimizations],
- [Disable (detected) compiler optimizations]),
- [],
- [enable_compiler_optimizations=yes]
- )
+ AC_ARG_ENABLE([compiler-optimizations],
+ [AS_HELP_STRING([--disable-compiler-optimizations],
+ [Disable (detected) compiler optimizations])],
+ [], [enable_compiler_optimizations=yes])
AS_IF([test "x$enable_compiler_optimizations" = "xno"], [
CFLAGS=$(echo "$CFLAGS" | sed -e "s/ -O[[1-9]]*\b/ -O0/g")
@@ -119,16 +116,16 @@ AC_DEFUN([DPKG_COMPILER_OPTIMIZATIONS], [
# DPKG_TRY_C99([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
# ------------------------------------------------------
# Try compiling some C99 code to see whether it works
-AC_DEFUN([DPKG_TRY_C99],
-[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+AC_DEFUN([DPKG_TRY_C99], [
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
#include <inttypes.h>
#include <stdbool.h>
#include <stdio.h>
/* Variadic macro arguments. */
#define variadic_macro(foo, ...) printf(foo, __VA_ARGS__)
-]],
-[[
+ ]], [[
int rc;
/* Designated initializers. */
@@ -159,7 +156,8 @@ AC_DEFUN([DPKG_TRY_C99],
/* Magic __func__ variable. */
printf("%s", __func__);
-]])], [$1], [$2])dnl
+ ]])
+ ], [$1], [$2])dnl
])# DPKG_TRY_C99
# DPKG_C_C99
@@ -180,7 +178,8 @@ AC_DEFUN([DPKG_C_C99], [
CC="$dpkg_save_CC"
AS_IF([test "x$dpkg_arg_worked" = "xyes"], [
- dpkg_cv_c99_arg="$arg"; break
+ dpkg_cv_c99_arg="$arg"
+ break
])
done
])
@@ -203,10 +202,10 @@ AC_DEFUN([DPKG_TRY_CXX11], [
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
-]], [[
+ ]], [[
// Null pointer keyword.
void *ptr = nullptr;
-]])
+ ]])
], [$1], [$2])
AC_LANG_POP([C++])dnl
])# DPKG_TRY_CXX11
diff --git a/m4/dpkg-coverage.m4 b/m4/dpkg-coverage.m4
index f11fc3f..4e14b73 100644
--- a/m4/dpkg-coverage.m4
+++ b/m4/dpkg-coverage.m4
@@ -3,51 +3,48 @@
# DPKG_CODE_COVERAGE
# ------------------
# Add configuration option to enable code coverage support.
-AC_DEFUN([DPKG_CODE_COVERAGE],
-[
-AC_ARG_ENABLE(coverage,
- AS_HELP_STRING([--enable-coverage],
- [whether to enable code coverage]),
- [],
- [enable_coverage=no])
-AM_CONDITIONAL(COVERAGE_ENABLED, [test x$enable_coverage = xyes])
+AC_DEFUN([DPKG_CODE_COVERAGE], [
+ AC_ARG_ENABLE([coverage],
+ [AS_HELP_STRING([--enable-coverage], [whether to enable code coverage])],
+ [], [enable_coverage=no])
+ AM_CONDITIONAL([COVERAGE_ENABLED], [test x$enable_coverage = xyes])
-if test "x$enable_coverage" = "xyes"; then
- if test "x$GCC" = "xno"; then
- AC_MSG_ERROR([not compiling with gcc, which is required for C coverage support])
- fi
+ AS_IF([test "x$enable_coverage" = "xyes"], [
+ AS_IF([test "x$GCC" = "xno"], [
+ AC_MSG_ERROR([not compiling with gcc, which is required for C coverage support])
+ ])
- AC_CHECK_PROGS([GCOV], [gcov])
- if test -z "$GCOV"; then
- AC_MSG_ERROR([missing gcov, which is required for C coverage support])
- fi
+ AC_CHECK_PROGS([GCOV], [gcov])
+ AS_IF([test -z "$GCOV"], [
+ AC_MSG_ERROR([missing gcov, which is required for C coverage support])
+ ])
- AC_CHECK_PROGS([LCOV], [lcov])
- if test -z "$LCOV"; then
- AC_MSG_ERROR([missing lcov, which is required for C coverage support])
- fi
+ AC_CHECK_PROGS([LCOV], [lcov])
+ AS_IF([test -z "$LCOV"], [
+ AC_MSG_ERROR([missing lcov, which is required for C coverage support])
+ ])
- AC_CHECK_PROGS([LCOV_GENHTML], [genhtml])
- if test -z "$LCOV_GENHTML"; then
- AC_MSG_ERROR([missing genhtml, which is required for C coverage support])
- fi
+ AC_CHECK_PROGS([LCOV_GENHTML], [genhtml])
+ AS_IF([test -z "$LCOV_GENHTML"], [
+ AC_MSG_ERROR([missing genhtml, which is required for C coverage support])
+ ])
- CFLAGS="$CFLAGS --coverage"
- LDFLAGS="$LDFLAGS --coverage"
+ CFLAGS="$CFLAGS --coverage"
+ LDFLAGS="$LDFLAGS --coverage"
- AC_MSG_CHECKING([for Devel::Cover perl module])
- if $($PERL -e "require Devel::Cover;" 2>/dev/null); then
- PERL_COVERAGE="-MDevel::Cover"
- AC_SUBST(PERL_COVERAGE)
- AC_MSG_RESULT([ok])
- else
- AC_MSG_ERROR([Devel::Cover perl module is required for coverage support])
- fi
- AC_CHECK_PROGS([PERL_COVER], [cover])
- if test -z "$PERL_COVER"; then
- AC_MSG_ERROR([missing cover, which is required for perl coverage support])
- fi
-fi
-AC_MSG_CHECKING([whether to build with code coverage])
-AC_MSG_RESULT([$enable_coverage])
+ AC_MSG_CHECKING([for Devel::Cover perl module])
+ AS_IF([$($PERL -e "require Devel::Cover;" 2>/dev/null)], [
+ PERL_COVERAGE="-MDevel::Cover"
+ AC_SUBST(PERL_COVERAGE)
+ AC_MSG_RESULT([ok])
+ ], [
+ AC_MSG_ERROR([Devel::Cover perl module is required for coverage support])
+ ])
+ AC_CHECK_PROGS([PERL_COVER], [cover])
+ AS_IF([test -z "$PERL_COVER"], [
+ AC_MSG_ERROR([missing cover, which is required for perl coverage support])
+ ])
+ ])
+ AC_MSG_CHECKING([whether to build with code coverage])
+ AC_MSG_RESULT([$enable_coverage])
])
diff --git a/m4/dpkg-funcs.m4 b/m4/dpkg-funcs.m4
index 0d947c6..1feb7d1 100644
--- a/m4/dpkg-funcs.m4
+++ b/m4/dpkg-funcs.m4
@@ -6,14 +6,18 @@
# Define HAVE_VA_COPY if we have va_copy.
AC_DEFUN([DPKG_FUNC_VA_COPY], [
AC_CACHE_CHECK([for va_copy], [dpkg_cv_va_copy], [
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>]], [[
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+#include <stdarg.h>
+ ]], [[
va_list v1, v2;
va_copy(v1, v2);
-]]
- )],
- [dpkg_cv_va_copy=yes],
- [dpkg_cv_va_copy=no]
- )
+ ]])
+ ], [
+ dpkg_cv_va_copy=yes
+ ], [
+ dpkg_cv_va_copy=no
+ ])
])
AS_IF([test "x$dpkg_cv_va_copy" = "xyes"], [
AC_DEFINE([HAVE_VA_COPY], [1], [Define to 1 if the 'va_copy' macro exists])
@@ -23,9 +27,10 @@ va_copy(v1, v2);
# DPKG_FUNC_C99_SNPRINTF
# -----------------------
# Define HAVE_C99_SNPRINTF if we have C99 snprintf family semantics
-AC_DEFUN([DPKG_FUNC_C99_SNPRINTF],
-[AC_CACHE_CHECK([for C99 snprintf functions], [dpkg_cv_c99_snprintf],
- [AC_RUN_IFELSE([AC_LANG_SOURCE([[
+AC_DEFUN([DPKG_FUNC_C99_SNPRINTF], [
+ AC_CACHE_CHECK([for C99 snprintf functions], [dpkg_cv_c99_snprintf], [
+ AC_RUN_IFELSE([
+ AC_LANG_SOURCE([[
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
@@ -54,79 +59,90 @@ int main()
return 0;
}
- ]])],
- [dpkg_cv_c99_snprintf=yes],
- [dpkg_cv_c99_snprintf=no],
- [dpkg_cv_c99_snprintf=maybe])
+ ]])
+ ], [
+ dpkg_cv_c99_snprintf=yes
+ ], [
+ dpkg_cv_c99_snprintf=no
+ ], [
+ dpkg_cv_c99_snprintf=maybe
+ ])
- AS_IF([test "x$dpkg_cv_c99_snprintf" = "xmaybe"],
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+ AS_IF([test "x$dpkg_cv_c99_snprintf" = "xmaybe"], [
+ AC_COMPILE_IFELSE([
+ AC_LANG_SOURCE([[
#define _GNU_SOURCE 1
#include <unistd.h>
#if !defined(_XOPEN_VERSION) || _XOPEN_VERSION < 600
#error "snprintf() has conflicting semantics with C99 on SUSv2 and earlier"
#endif
-]]
- )],
- [dpkg_cv_c99_snprintf=yes],
- [dpkg_cv_c99_snprintf=no]
- )
- )
-])
-AS_IF([test "x$dpkg_cv_c99_snprintf" = "xyes"],
- [AC_DEFINE([HAVE_C99_SNPRINTF], 1,
- [Define to 1 if the 'snprintf' family is C99 conformant])],
- )
-AM_CONDITIONAL(HAVE_C99_SNPRINTF, [test "x$dpkg_cv_c99_snprintf" = "xyes"])
+ ]])
+ ], [
+ dpkg_cv_c99_snprintf=yes
+ ], [
+ dpkg_cv_c99_snprintf=no
+ ])
+ ])
+ ])
+ AS_IF([test "x$dpkg_cv_c99_snprintf" = "xyes"], [
+ AC_DEFINE([HAVE_C99_SNPRINTF], [1],
+ [Define to 1 if the 'snprintf' family is C99 conformant])
+ ])
+ AM_CONDITIONAL([HAVE_C99_SNPRINTF], [test "x$dpkg_cv_c99_snprintf" = "xyes"])
])# DPKG_FUNC_C99_SNPRINTF
# DPKG_MMAP
# ---------
# Define USE_MMAP if mmap() is available and it was requested
-AC_DEFUN([DPKG_MMAP],
-[
+AC_DEFUN([DPKG_MMAP], [
AC_ARG_ENABLE([mmap],
- AS_HELP_STRING([--enable-mmap],
- [enable usage of unrealiable mmap if available]),
- [],
- [enable_mmap=no])
+ [AS_HELP_STRING([--enable-mmap],
+ [enable usage of unrealiable mmap if available])],
+ [], [enable_mmap=no])
AS_IF([test "x$enable_mmap" = "xyes"], [
AC_CHECK_FUNCS([mmap])
- AC_DEFINE(USE_MMAP, 1, [Use unreliable mmap support])
+ AC_DEFINE([USE_MMAP], [1], [Use unreliable mmap support])
])
])
# DPKG_CHECK_PROGNAME
# -------------------
# Check for system implementations of program name tracking.
-AC_DEFUN([DPKG_CHECK_PROGNAME],
-[
+AC_DEFUN([DPKG_CHECK_PROGNAME], [
AC_MSG_CHECKING([for program_invocation_short_name])
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <errno.h>]],
- [[const char *p = program_invocation_short_name;]])],
- [AC_DEFINE([HAVE_PROGRAM_INVOCATION_SHORT_NAME], [1],
- [Define to 1 if you have program_invocation_short_name])
- AC_MSG_RESULT([yes])],
- [AC_MSG_RESULT([no])])
+ AC_LINK_IFELSE([
+ AC_LANG_PROGRAM(
+ [[#include <errno.h>]],
+ [[const char *p = program_invocation_short_name;]])
+ ], [
+ AC_DEFINE([HAVE_PROGRAM_INVOCATION_SHORT_NAME], [1],
+ [Define to 1 if you have program_invocation_short_name])
+ AC_MSG_RESULT([yes])
+ ], [
+ AC_MSG_RESULT([no])
+ ])
AC_MSG_CHECKING([for __progname])
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern char *__progname;]],
- [[printf("%s", __progname);]])],
- [AC_DEFINE([HAVE___PROGNAME], [1],
- [Define to 1 if you have __progname])
- AC_MSG_RESULT([yes])],
- [AC_MSG_RESULT([no])])
+ AC_LINK_IFELSE([
+ AC_LANG_PROGRAM(
+ [[extern char *__progname;]],
+ [[printf("%s", __progname);]])
+ ], [
+ AC_DEFINE([HAVE___PROGNAME], [1], [Define to 1 if you have __progname])
+ AC_MSG_RESULT([yes])
+ ], [
+ AC_MSG_RESULT([no])
+ ])
]) # DPKG_CHECK_PROGNAME
# DPKG_CHECK_COMPAT_FUNCS(LIST)
# -----------------------
# Check each function and define an automake conditional
-AC_DEFUN([DPKG_CHECK_COMPAT_FUNCS],
-[
+AC_DEFUN([DPKG_CHECK_COMPAT_FUNCS], [
AC_CHECK_FUNCS([$1])
m4_foreach_w([ac_func], [$1], [
- AM_CONDITIONAL(HAVE_[]AS_TR_CPP(ac_func),
- [test "x$ac_cv_func_[]AS_TR_SH(ac_func)" = "xyes"])
+ AM_CONDITIONAL([HAVE_]AS_TR_CPP(ac_func),
+ [test "x$ac_cv_func_[]AS_TR_SH(ac_func)" = "xyes"])
])
]) # DPKG_CHECK_COMPAT_FUNCS
diff --git a/m4/dpkg-libs.m4 b/m4/dpkg-libs.m4
index c04490e..08a1906 100644
--- a/m4/dpkg-libs.m4
+++ b/m4/dpkg-libs.m4
@@ -8,9 +8,9 @@
AC_DEFUN([DPKG_LIB_MD], [
AC_ARG_VAR([MD_LIBS], [linker flags for md library])
AC_ARG_WITH([libmd],
- AS_HELP_STRING([--with-libmd],
- [use libmd library for message digest functions]))
- if test "x$with_libmd" != "xno"; then
+ [AS_HELP_STRING([--with-libmd],
+ [use libmd library for message digest functions])])
+ AS_IF([test "x$with_libmd" != "xno"], [
AC_CHECK_HEADERS([md5.h], [
AC_CHECK_LIB([md], [MD5Init], [
with_libmd="yes"
@@ -18,7 +18,7 @@ AC_DEFUN([DPKG_LIB_MD], [
AC_MSG_FAILURE([md5 digest not found in libmd])
])
])
- fi
+ ])
AS_IF([test "x$with_libmd" = "xyes"], [MD_LIBS="-lmd"])
AM_CONDITIONAL([HAVE_LIBMD_MD5], [test "x$ac_cv_lib_md_MD5Init" = "xyes"])
])# DPKG_LIB_MD
@@ -28,32 +28,32 @@ AC_DEFUN([DPKG_LIB_MD], [
# Check for availability of a compression library.
AC_DEFUN([DPKG_WITH_COMPRESS_LIB], [
AC_ARG_VAR(AS_TR_CPP($1)[_LIBS], [linker flags for $1 library])
- AC_ARG_WITH([lib]$1,
- AS_HELP_STRING([--with-lib$1],
- [use $1 library for compression and decompression]))
- if test "x$with_lib$1" != "xno"; then
+ AC_ARG_WITH([lib$1],
+ [AS_HELP_STRING([--with-lib$1],
+ [use $1 library for compression and decompression])])
+ AS_IF([test "x$with_lib$1" != "xno"], [
AC_CHECK_LIB([$1], [$3], [
AC_DEFINE([WITH_LIB]AS_TR_CPP($1), 1,
- [Define to 1 to use $1 library rather than console tool])
- if test "x$with_lib$1" = "xstatic"; then
+ [Define to 1 to use $1 library rather than console tool])
+ AS_IF([test "x$with_lib$1" = "xstatic"], [
dpkg_$1_libs="-Wl,-Bstatic -l$1 -Wl,-Bdynamic"
- else
+ ], [
dpkg_$1_libs="-l$1"
- fi
+ ])
AS_TR_CPP($1)_LIBS="${AS_TR_CPP($1)_LIBS:+$AS_TR_CPP($1)_LIBS }$dpkg_$1_libs"
with_lib$1="yes"
], [
- if test -n "$with_lib$1"; then
+ AS_IF([test -n "$with_lib$1"], [
AC_MSG_FAILURE([$1 library not found])
- fi
+ ])
])
AC_CHECK_HEADER([$2], [], [
- if test -n "$with_lib$1"; then
+ AS_IF([test -n "$with_lib$1"], [
AC_MSG_FAILURE([lib$1 header not found])
- fi
+ ])
])
- fi
+ ])
])# DPKG_WITH_COMPRESS_LIB
# DPKG_LIB_Z
@@ -68,9 +68,9 @@ AC_DEFUN([DPKG_LIB_Z], [
# Check for lzma library.
AC_DEFUN([DPKG_LIB_LZMA], [
DPKG_WITH_COMPRESS_LIB([lzma], [lzma.h], [lzma_alone_decoder])
- AC_CHECK_LIB([lzma], [lzma_stream_encoder_mt],
- [AC_DEFINE([HAVE_LZMA_MT], [1],
- [xz multithreaded compression support])])
+ AC_CHECK_LIB([lzma], [lzma_stream_encoder_mt], [
+ AC_DEFINE([HAVE_LZMA_MT], [1], [xz multithreaded compression support])
+ ])
])# DPKG_LIB_LZMA
# DPKG_LIB_BZ2
@@ -84,81 +84,90 @@ AC_DEFUN([DPKG_LIB_BZ2], [
# ----------------
# Check for selinux library.
AC_DEFUN([DPKG_LIB_SELINUX], [
-AC_REQUIRE([PKG_PROG_PKG_CONFIG])
-m4_ifndef([PKG_PROG_PKG_CONFIG], [m4_fatal([missing pkg-config macros])])
-AC_ARG_VAR([SELINUX_LIBS], [linker flags for selinux library])dnl
-AC_ARG_WITH(libselinux,
- AS_HELP_STRING([--with-libselinux],
- [use selinux library to set security contexts]))
-if test "x$with_libselinux" != "xno"; then
- AC_CHECK_LIB([selinux], [is_selinux_enabled],
- [AC_DEFINE(WITH_LIBSELINUX, 1,
- [Define to 1 to compile in SELinux support])
- PKG_CHECK_EXISTS([libselinux], [
- if test "x$with_selinux" = "xstatic"; then
- dpkg_selinux_libs="-Wl,-Bstatic "$($PKG_CONFIG --static --libs libselinux)" -Wl,-Bdynamic"
- else
- dpkg_selinux_libs=$($PKG_CONFIG --libs libselinux)
- fi
- ], [
- if test "x$with_libselinux" = "xstatic"; then
- dpkg_selinux_libs="-Wl,-Bstatic -lselinux -lsepol -Wl,-Bdynamic"
- else
- dpkg_selinux_libs="-lselinux"
- fi
- ])
- SELINUX_LIBS="${SELINUX_LIBS:+$SELINUX_LIBS }$dpkg_selinux_libs"
- with_libselinux="yes"],
- [if test -n "$with_libselinux"; then
- AC_MSG_FAILURE([selinux library not found])
- fi])
- AC_CHECK_LIB([selinux], [setexecfilecon],
- [AC_DEFINE([HAVE_SETEXECFILECON], [1],
- [Define to 1 if SELinux setexecfilecon is present])
- ])
+ AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+ m4_ifndef([PKG_PROG_PKG_CONFIG], [m4_fatal([missing pkg-config macros])])
+ AC_ARG_VAR([SELINUX_LIBS], [linker flags for selinux library])dnl
+ AC_ARG_WITH([libselinux],
+ [AS_HELP_STRING([--with-libselinux],
+ [use selinux library to set security contexts])])
+ AS_IF([test "x$with_libselinux" != "xno"], [
+ AC_CHECK_LIB([selinux], [is_selinux_enabled], [
+ AC_DEFINE([WITH_LIBSELINUX], [1],
+ [Define to 1 to compile in SELinux support])
+ PKG_CHECK_EXISTS([libselinux], [
+ AS_IF([test "x$with_selinux" = "xstatic"], [
+ dpkg_selinux_libs="-Wl,-Bstatic "$($PKG_CONFIG --static --libs libselinux)" -Wl,-Bdynamic"
+ ], [
+ dpkg_selinux_libs=$($PKG_CONFIG --libs libselinux)
+ ])
+ ], [
+ AS_IF([test "x$with_libselinux" = "xstatic"], [
+ dpkg_selinux_libs="-Wl,-Bstatic -lselinux -lsepol -Wl,-Bdynamic"
+ ], [
+ dpkg_selinux_libs="-lselinux"
+ ])
+ ])
+ SELINUX_LIBS="${SELINUX_LIBS:+$SELINUX_LIBS }$dpkg_selinux_libs"
+ with_libselinux="yes"
+ ], [
+ AS_IF([test -n "$with_libselinux"], [
+ AC_MSG_FAILURE([selinux library not found])
+ ])
+ ])
+ AC_CHECK_LIB([selinux], [setexecfilecon], [
+ AC_DEFINE([HAVE_SETEXECFILECON], [1],
+ [Define to 1 if SELinux setexecfilecon is present])
+ ])
- AC_CHECK_HEADER([selinux/selinux.h],,
- [if test -n "$with_libselinux"; then
- AC_MSG_FAILURE([selinux header not found])
- fi])
-fi
-AM_CONDITIONAL(WITH_LIBSELINUX, [test "x$with_libselinux" = "xyes"])
-AM_CONDITIONAL(HAVE_SETEXECFILECON,
- [test "x$ac_cv_lib_selinux_setexecfilecon" = "xyes"])
+ AC_CHECK_HEADER([selinux/selinux.h], [], [
+ AS_IF([test -n "$with_libselinux"], [
+ AC_MSG_FAILURE([selinux header not found])
+ ])
+ ])
+ ])
+ AM_CONDITIONAL([WITH_LIBSELINUX], [test "x$with_libselinux" = "xyes"])
+ AM_CONDITIONAL([HAVE_SETEXECFILECON],
+ [test "x$ac_cv_lib_selinux_setexecfilecon" = "xyes"])
])# DPKG_LIB_SELINUX
# _DPKG_CHECK_LIB_CURSES_NARROW
# -----------------------------
# Check for narrow curses library.
AC_DEFUN([_DPKG_CHECK_LIB_CURSES_NARROW], [
-AC_CHECK_LIB([ncurses], [initscr],
- [CURSES_LIBS="${CURSES_LIBS:+$CURSES_LIBS }-lncurses"],
- [AC_CHECK_LIB([curses], [initscr],
- [CURSES_LIBS="${CURSES_LIBS:+$CURSES_LIBS }-lcurses"],
- [AC_MSG_ERROR([no curses library found])])])])
+ AC_CHECK_LIB([ncurses], [initscr], [
+ CURSES_LIBS="${CURSES_LIBS:+$CURSES_LIBS }-lncurses"
+ ], [
+ AC_CHECK_LIB([curses], [initscr], [
+ CURSES_LIBS="${CURSES_LIBS:+$CURSES_LIBS }-lcurses"
+ ], [
+ AC_MSG_ERROR([no curses library found])
+ ])
+ ])
])# DPKG_CHECK_LIB_CURSES_NARROW
# DPKG_LIB_CURSES
# ---------------
# Check for curses library.
AC_DEFUN([DPKG_LIB_CURSES], [
-AC_REQUIRE([DPKG_UNICODE])
-AC_ARG_VAR([CURSES_LIBS], [linker flags for curses library])dnl
-AC_CHECK_HEADERS([ncurses/ncurses.h ncurses.h curses.h ncurses/term.h term.h],
- [have_curses_header=yes])
-if test "x$USE_UNICODE" = "xyes"; then
- AC_CHECK_HEADERS([ncursesw/ncurses.h ncursesw/term.h],
+ AC_REQUIRE([DPKG_UNICODE])
+ AC_ARG_VAR([CURSES_LIBS], [linker flags for curses library])dnl
+ AC_CHECK_HEADERS([ncurses/ncurses.h ncurses.h curses.h ncurses/term.h term.h],
[have_curses_header=yes])
- AC_CHECK_LIB([ncursesw], [initscr],
- [CURSES_LIBS="${CURSES_LIBS:+$CURSES_LIBS }-lncursesw"],
- [_DPKG_CHECK_LIB_CURSES_NARROW()])
-else
- _DPKG_CHECK_LIB_CURSES_NARROW()
-fi
-if test "x$have_curses_header" != "xyes"; then
- AC_MSG_FAILURE([curses header not found])
-fi
-have_libcurses=yes
+ AS_IF([test "x$USE_UNICODE" = "xyes"], [
+ AC_CHECK_HEADERS([ncursesw/ncurses.h ncursesw/term.h],
+ [have_curses_header=yes])
+ AC_CHECK_LIB([ncursesw], [initscr], [
+ CURSES_LIBS="${CURSES_LIBS:+$CURSES_LIBS }-lncursesw"
+ ], [
+ _DPKG_CHECK_LIB_CURSES_NARROW()
+ ])
+ ], [
+ _DPKG_CHECK_LIB_CURSES_NARROW()
+ ])
+ AS_IF([test "x$have_curses_header" != "xyes"], [
+ AC_MSG_FAILURE([curses header not found])
+ ])
+ have_libcurses=yes
])# DPKG_LIB_CURSES
# DPKG_LIB_PS
diff --git a/m4/dpkg-linker.m4 b/m4/dpkg-linker.m4
index 7438a4c..e068a38 100644
--- a/m4/dpkg-linker.m4
+++ b/m4/dpkg-linker.m4
@@ -4,41 +4,42 @@
# DPKG_LINKER_OPTIMIZATIONS
# -------------------------
# Add configure option to disable linker optimizations.
-AC_DEFUN([DPKG_LINKER_OPTIMIZATIONS],
-[
+AC_DEFUN([DPKG_LINKER_OPTIMIZATIONS], [
AC_ARG_ENABLE([linker-optimizations],
- AS_HELP_STRING([--disable-linker-optimizations],
- [Disable (detected) linker optimizations]),
- [],
- [enable_linker_optimizations=yes]
- )
+ [AS_HELP_STRING([--disable-linker-optimizations],
+ [Disable (detected) linker optimizations])],
+ [], [enable_linker_optimizations=yes])
AS_IF([test "x$enable_linker_optimizations" = "xno"], [
LDFLAGS=$(echo "$LDFLAGS" | sed -e "s/ -Wl,-O[[0-9]]*\b//g")
], [
save_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,-O1"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
- [],
- [LDFLAGS="$save_LDFLAGS"])
+ AC_LINK_IFELSE([
+ AC_LANG_PROGRAM([[]], [[]])
+ ], [], [
+ LDFLAGS="$save_LDFLAGS"
+ ])
])
])
# DPKG_LINKER_VERSION_SCRIPT
# --------------------------
-AC_DEFUN([DPKG_LINKER_VERSION_SCRIPT],
-[
- AC_CACHE_CHECK([for --version-script linker flag],
- [dpkg_cv_version_script],
- [echo "{ global: symbol; local: *; };" >conftest.map
+AC_DEFUN([DPKG_LINKER_VERSION_SCRIPT], [
+ AC_CACHE_CHECK([for --version-script linker flag], [dpkg_cv_version_script], [
+ echo "{ global: symbol; local: *; };" >conftest.map
save_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
- [dpkg_cv_version_script=yes],
- [dpkg_cv_version_script=no])
+ AC_LINK_IFELSE([
+ AC_LANG_PROGRAM([], [])
+ ], [
+ dpkg_cv_version_script=yes
+ ], [
+ dpkg_cv_version_script=no
+ ])
LDFLAGS="$save_LDFLAGS"
rm -f conftest.map
])
AM_CONDITIONAL([HAVE_LINKER_VERSION_SCRIPT],
- [test "x$dpkg_cv_version_script" = "xyes"])
+ [test "x$dpkg_cv_version_script" = "xyes"])
])
diff --git a/m4/dpkg-progs.m4 b/m4/dpkg-progs.m4
index c59f595..97e87ae 100644
--- a/m4/dpkg-progs.m4
+++ b/m4/dpkg-progs.m4
@@ -5,39 +5,40 @@
# DPKG_PROG_PERL
# --------------
# Locate perl interpreter in the path
-AC_DEFUN([DPKG_PROG_PERL],
-[AC_ARG_VAR([PERL], [Perl interpreter])dnl
-AC_PATH_PROG([PERL], [perl], [no])
-if test "$PERL" = "no" || test ! -x "$PERL"; then
- AC_MSG_ERROR([cannot find the Perl interpreter])
-fi
-AC_ARG_VAR([PERL_LIBDIR], [Perl library directory])dnl
-# Let the user override the variable.
-if test -z "$PERL_LIBDIR"; then
-PERL_LIBDIR=$($PERL -MConfig -e 'my $r = $Config{vendorlibexp};
- $r =~ s/$Config{vendorprefixexp}/\$(prefix)/;
- print $r')
-fi
+AC_DEFUN([DPKG_PROG_PERL], [
+ AC_ARG_VAR([PERL], [Perl interpreter])dnl
+ AC_PATH_PROG([PERL], [perl], [no])
+ AS_IF([test "$PERL" = "no" || test ! -x "$PERL"], [
+ AC_MSG_ERROR([cannot find the Perl interpreter])
+ ])
+ AC_ARG_VAR([PERL_LIBDIR], [Perl library directory])dnl
+ # Let the user override the variable.
+ AS_IF([test -z "$PERL_LIBDIR"], [
+ PERL_LIBDIR=$($PERL -MConfig -e \
+ 'my $r = $Config{vendorlibexp};
+ $r =~ s/$Config{vendorprefixexp}/\$(prefix)/;
+ print $r')
+ ])
])# DPKG_PROG_PERL
# DPKG_PROG_PO4A
# --------------
AC_DEFUN([DPKG_PROG_PO4A], [
-AC_REQUIRE([AM_NLS])
-AC_CHECK_PROGS([PO4A], [po4a])
-if test "$USE_NLS" = "yes" && test -n "$PO4A"; then
- USE_PO4A=yes
-else
- USE_PO4A=no
-fi
-AC_SUBST([USE_PO4A])
+ AC_REQUIRE([AM_NLS])
+ AC_CHECK_PROGS([PO4A], [po4a])
+ AS_IF([test "$USE_NLS" = "yes" && test -n "$PO4A"], [
+ USE_PO4A=yes
+ ], [
+ USE_PO4A=no
+ ])
+ AC_SUBST([USE_PO4A])
])# DPKG_PROG_PO4A
# DPKG_PROG_POD2MAN
# --------------
AC_DEFUN([DPKG_PROG_POD2MAN], [
-AC_CHECK_PROGS([POD2MAN], [pod2man])
-AM_CONDITIONAL(BUILD_POD_DOC, [test "x$POD2MAN" != "x"])
+ AC_CHECK_PROGS([POD2MAN], [pod2man])
+ AM_CONDITIONAL([BUILD_POD_DOC], [test "x$POD2MAN" != "x"])
])# DPKG_PROG_POD2MAN
# DPKG_DEB_PROG_TAR
@@ -45,7 +46,7 @@ AM_CONDITIONAL(BUILD_POD_DOC, [test "x$POD2MAN" != "x"])
# Specify GNU tar program name to use by dpkg-deb. On GNU systems this is
# usually simply tar, on BSD systems this is usually gnutar or gtar.
AC_DEFUN([DPKG_DEB_PROG_TAR], [
-AC_ARG_VAR([TAR], [GNU tar program])
-AC_CHECK_PROGS([TAR], [gnutar gtar tar], [tar])
-AC_DEFINE_UNQUOTED([TAR], ["$TAR"], [GNU tar program])
+ AC_ARG_VAR([TAR], [GNU tar program])
+ AC_CHECK_PROGS([TAR], [gnutar gtar tar], [tar])
+ AC_DEFINE_UNQUOTED([TAR], ["$TAR"], [GNU tar program])
])# DPKG_DEB_PROG_TAR
diff --git a/m4/dpkg-types.m4 b/m4/dpkg-types.m4
index 253478c..7fbbd2a 100644
--- a/m4/dpkg-types.m4
+++ b/m4/dpkg-types.m4
@@ -4,27 +4,27 @@
# DPKG_TYPE_PTRDIFF_T
# -------------------
# Check for the ptrdiff_t type, defining to int if not defined
-AC_DEFUN([DPKG_TYPE_PTRDIFF_T],
-[AC_CHECK_TYPE([ptrdiff_t],,
- AC_DEFINE_UNQUOTED([ptrdiff_t], [int],
- [Define to 'int' if <malloc.h> does not define.]))dnl
+AC_DEFUN([DPKG_TYPE_PTRDIFF_T], [
+ AC_CHECK_TYPE([ptrdiff_t], [], [
+ AC_DEFINE_UNQUOTED([ptrdiff_t], [int],
+ [Define to 'int' if <malloc.h> does not define.])
+ ])
])# DPKG_TYPE_PTRDIFF_T
# DPKG_TYPE_U_INT_T(N)
# --------------------
# Check for u_intN_t BSD type, defining to C99 type if not.
-AC_DEFUN([DPKG_TYPE_U_INT_T],
-[
- AC_CHECK_TYPE([u_int$1_t], [],
- AC_DEFINE_UNQUOTED([u_int$1_t], [uint$1_t],
- [Define to 'uint$1_t' if not defined.]))
+AC_DEFUN([DPKG_TYPE_U_INT_T], [
+ AC_CHECK_TYPE([u_int$1_t], [], [
+ AC_DEFINE_UNQUOTED([u_int$1_t], [uint$1_t],
+ [Define to 'uint$1_t' if not defined.])
+ ])
])
# DPKG_TYPES_U_INT_T
# ------------------
# Check for u_int(8|16|32|64)_t BSD types, defining to C99 types if not.
-AC_DEFUN([DPKG_TYPES_U_INT_T],
-[
+AC_DEFUN([DPKG_TYPES_U_INT_T], [
DPKG_TYPE_U_INT_T([8])
DPKG_TYPE_U_INT_T([16])
DPKG_TYPE_U_INT_T([32])
@@ -34,40 +34,38 @@ AC_DEFUN([DPKG_TYPES_U_INT_T],
# DPKG_DECL_SYS_SIGLIST
# ---------------------
# Check for the sys_siglist variable in either signal.h or unistd.h
-AC_DEFUN([DPKG_DECL_SYS_SIGLIST],
-[AC_CHECK_HEADERS([unistd.h])
-AC_CHECK_DECLS([sys_siglist],,,
-[#include <signal.h>
+AC_DEFUN([DPKG_DECL_SYS_SIGLIST], [
+ AC_CHECK_HEADERS([unistd.h])
+ AC_CHECK_DECLS([sys_siglist], [], [], [[
+#include <signal.h>
/* NetBSD declares sys_siglist in unistd.h. */
#if HAVE_UNISTD_H
# include <unistd.h>
#endif
-])dnl
+ ]])
])# DPKG_DECL_SYS_SIGLIST
# DPKG_DECL_SYS_ERRLIST
# ---------------------
# Check for the sys_errlist and sys_nerr variables in either errno.h or
# stdio.h
-AC_DEFUN([DPKG_DECL_SYS_ERRLIST],
-[
- AC_CHECK_DECLS([sys_errlist, sys_nerr],,, [[
+AC_DEFUN([DPKG_DECL_SYS_ERRLIST], [
+ AC_CHECK_DECLS([sys_errlist, sys_nerr], [], [], [[
#include <errno.h>
/* glibc declares sys_errlist in stdio.h. */
#include <stdio.h>
-]])
-AM_CONDITIONAL([HAVE_SYS_ERRLIST],
- [test "x$ac_cv_have_decl_sys_errlist" = "xyes" && \
- test "x$ac_cv_have_decl_sys_nerr" = "xyes"])
+ ]])
+ AM_CONDITIONAL([HAVE_SYS_ERRLIST],
+ [test "x$ac_cv_have_decl_sys_errlist" = "xyes" && \
+ test "x$ac_cv_have_decl_sys_nerr" = "xyes"])
])# DPKG_DECL_SYS_SIGLIST
# DPKG_CHECK_DECL([DECL], [HEADER])
-# -----------------
+# ---------------
# Define HAVE_DECL to 1 if declared in HEADER
-AC_DEFUN([DPKG_CHECK_DECL],
-[
- AC_CHECK_DECL($1,
- [AC_DEFINE([HAVE_]AS_TR_CPP($1), 1,
- [Define to 1 if ']$1[' is declared in <$2>])],,
- [[#include <$2>]])
+AC_DEFUN([DPKG_CHECK_DECL], [
+ AC_CHECK_DECL([$1], [
+ AC_DEFINE([HAVE_]AS_TR_CPP($1), [1],
+ [Define to 1 if ']$1[' is declared in <$2>])
+ ], [], [[#include <$2>]])
])# DPKG_CHECK_DECL
diff --git a/m4/dpkg-unicode.m4 b/m4/dpkg-unicode.m4
index 1af7bf0..2cef2c7 100644
--- a/m4/dpkg-unicode.m4
+++ b/m4/dpkg-unicode.m4
@@ -7,15 +7,16 @@
# with or without modifications, as long as this notice is preserved.
# DPKG_UNICODE()
-# --------------
+# ------------
# Add configure option to disable Unicode support.
AC_DEFUN([DPKG_UNICODE], [
AC_MSG_CHECKING([whether Unicode is requested])
dnl Default: Unicode is enabled.
AC_ARG_ENABLE([unicode],
[AS_HELP_STRING([--disable-unicode],
- [do not use Unicode (wide chars) support])],
- [USE_UNICODE=$enableval], [USE_UNICODE=yes])
- AC_MSG_RESULT($USE_UNICODE)
- AC_SUBST(USE_UNICODE)
+ [do not use Unicode (wide chars) support])],
+ [USE_UNICODE=$enableval],
+ [USE_UNICODE=yes])
+ AC_MSG_RESULT([$USE_UNICODE])
+ AC_SUBST([USE_UNICODE])
]) # DPKG_UNICODE
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git
More information about the Reproducible-commits
mailing list