dpkg-build.m4 3.3 KB

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