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