dpkg-build.m4 3.3 KB

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