dpkg-build.m4 2.9 KB

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