dpkg-query: Rename failures variables tracking no matches to misses
[dpkg.git] / m4 / dpkg-build.m4
blob74897f56537229e3f279c9a9cb470055ab378c2e
1 # serial 1
2 # Copyright © 2010-2014 Guillem Jover <guillem@debian.org>
4 # DPKG_BUILD_SHARED_LIBS()
5 # ----------------------
6 AC_DEFUN([DPKG_BUILD_SHARED_LIBS], [
7   AS_IF([test "$enable_shared" = "yes" && test -z "$AUTHOR_TESTING"], [
8     AC_MSG_ERROR([building libdpkg as a shared library is not supported])
9   ])
10 ])# DPKG_BUILD_SHARED_LIBS
12 # DPKG_BUILD_RELEASE_DATE()
13 # -----------------------
14 AC_DEFUN([DPKG_BUILD_RELEASE_DATE], [
15   AC_REQUIRE([DPKG_PROG_PERL])
16   TIMESTAMP=$(PERL=$PERL ${CONFIG_SHELL-/bin/sh} "$srcdir/build-aux/run-script" scripts/dpkg-parsechangelog.pl -l"$srcdir/debian/changelog" -STimestamp)
17   PACKAGE_RELEASE_DATE=$($PERL -MPOSIX -e "print POSIX::strftime('%Y-%m-%d', gmtime('$TIMESTAMP'));")
18   AC_SUBST([PACKAGE_RELEASE_DATE])
19 ])# DPKG_BUILD_RELEASE_DATE
21 # DPKG_BUILD_PROG(PROG)
22 # ---------------
23 # Allow disabling compilation and usage of specific programs.
24 AC_DEFUN([DPKG_BUILD_PROG], [
25   AC_MSG_CHECKING([whether to build $1])
26   AC_ARG_ENABLE([$1],
27     [AS_HELP_STRING([--disable-$1], [do not build or use $1])],
28     [AS_TR_SH([build_$1])=$AS_TR_SH([enable_$1])],
29     [AS_TR_SH([build_$1])=yes])
30   AM_CONDITIONAL(AS_TR_CPP([BUILD_$1]),
31     [test "x$AS_TR_SH([build_$1])" = "xyes"])
32   AS_IF([test "x$AS_TR_SH([build_$1])" = "xyes"], [
33     AC_DEFINE(AS_TR_CPP([BUILD_$1]), [1], [Define to 1 if $1 is compiled.])
34   ], [
35     AC_DEFINE(AS_TR_CPP([BUILD_$1]), [0])
36   ])
37   AC_MSG_RESULT([$AS_TR_SH([build_$1])])
38 ])# DPKG_BUILD_PROG
40 # DPKG_BUILD_DEVEL_DOCS()
41 # ---------------------
42 # Select what type of documentation to build. Either for development including
43 # all symbol references, and extracting everything, or production documentation.
44 AC_DEFUN([DPKG_BUILD_DEVEL_DOCS], [
45   AC_ARG_ENABLE([devel-docs],
46     [AS_HELP_STRING([--disable-devel-docs], [build release docs])],
47     [build_devel_docs=$enable_devel_docs],
48     [build_devel_docs=yes]
49   )
50   AS_IF([test "x$build_devel_docs" = "xyes"], [
51     AC_SUBST([BUILD_DEVEL_DOCS], [YES])
52   ], [
53     AC_SUBST([BUILD_DEVEL_DOCS], [NO])
54   ])
55 ])# DPKG_BUILD_DOCS_MODE
57 # DPKG_WITH_DIR(DIR, DEFAULT, DESCRIPTION)
58 # -------------
59 # Allow specifying alternate directories.
60 AC_DEFUN([DPKG_WITH_DIR], [
61   $1="$2"
62   AC_ARG_WITH([$1], [AS_HELP_STRING([--with-$1=DIR], [$3])], [
63     AS_CASE([$with_$1],
64       [""], [AC_MSG_ERROR([invalid $1 specified])],
65       [$1="$with_$1"])
66   ])
67   AC_SUBST([$1])
68 ])# DPKG_WITH_DIR
70 # DPKG_DEB_COMPRESSOR(COMP)
71 # -------------------
72 # Change default «dpkg-deb --build» compressor.
73 AC_DEFUN([DPKG_DEB_COMPRESSOR], [
74   AC_ARG_WITH([deb-compressor],
75     [AS_HELP_STRING([--with-deb-compressor=COMP],
76       [change default dpkg-deb build compressor])],
77     [with_deb_compressor=$withval], [with_deb_compressor=$1])
78   AS_CASE([$with_deb_compressor],
79     [gzip|xz], [:],
80     [AC_MSG_ERROR([unsupported default compressor $with_deb_compressor])])
81   AC_SUBST([DEB_DEFAULT_COMPRESSOR], [$with_deb_compressor])
82   AC_DEFINE_UNQUOTED([DEB_DEFAULT_COMPRESSOR],
83     [COMPRESSOR_TYPE_]AS_TR_CPP(${with_deb_compressor}),
84     [default dpkg-deb build compressor])
85 ]) # DPKG_DEB_COMPRESSOR
87 # DPKG_DIST_IS_RELEASE()
88 # --------------------
89 # Check whether we are preparing a distribution tarball for a release, and
90 # set PACKAGE_DIST_IS_RELEASE accordingly.
91 AC_DEFUN([DPKG_DIST_IS_RELEASE], [
92   AS_IF([echo $PACKAGE_VERSION | grep -q -v '[-]'], [
93     dpkg_dist_is_release=1
94   ], [
95     dpkg_dist_is_release=0
96   ])
97   AM_CONDITIONAL([PACKAGE_DIST_IS_RELEASE],
98     [test "$dpkg_dist_is_release" -eq 1])
99   AC_SUBST([PACKAGE_DIST_IS_RELEASE], [$dpkg_dist_is_release])
100 ])# DPKG_DIST_IS_RELEASE
102 # DPKG_DIST_CHECK(COND, ERROR)
103 # ---------------
104 # Check if the condition is fulfilled when preparing a distribution tarball.
105 AC_DEFUN([DPKG_DIST_CHECK], [
106   AS_IF([test ! -f "$srcdir/.dist-version" && $1], [
107     AC_MSG_ERROR([not building from distributed tarball, $2])
108   ])
109 ])# DPKG_DIST_CHECK