dpkg-build.m4 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. AM_CONDITIONAL([BUILD_SHARED], [test "$enable_shared" = "yes"])
  9. ])# DPKG_BUILD_SHARED_LIBS
  10. # DPKG_BUILD_PROG(PROG)
  11. # ---------------
  12. # Allow disabling compilation and usage of specific programs.
  13. AC_DEFUN([DPKG_BUILD_PROG], [
  14. AC_MSG_CHECKING([whether to build $1])
  15. AC_ARG_ENABLE([$1],
  16. AS_HELP_STRING([--disable-$1], [do not build or use $1]),
  17. [build_]AS_TR_SH([$1])[=$enable_]AS_TR_SH([$1]),
  18. [build_]AS_TR_SH([$1])[=yes]
  19. )
  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_DEFINE([BUILD_DEVEL_DOCS], [YES], [Define to YES if building devel docs.])
  41. ], [
  42. AC_DEFINE([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],
  51. AS_HELP_STRING([--with-$1=DIR], [$3]),
  52. AS_CASE([$with_$1],
  53. [""], [AC_MSG_ERROR([invalid $1 specified])],
  54. [$1="$with_$1"])
  55. )
  56. AC_SUBST([$1])
  57. AC_MSG_NOTICE([using directory $1 = '$$1'])
  58. ])# DPKG_WITH_DIR
  59. # DPKG_DEB_COMPRESSOR(COMP)
  60. # -------------------
  61. # Change default «dpkg-deb --build» compressor.
  62. AC_DEFUN([DPKG_DEB_COMPRESSOR], [
  63. AC_ARG_WITH([dpkg-deb-compressor],
  64. [AS_HELP_STRING([--with-dpkg-deb-compressor=COMP],
  65. [change default dpkg-deb build compressor])],
  66. [with_dpkg_deb_compressor=$withval], [with_dpkg_deb_compressor=$1])
  67. AS_CASE([$with_dpkg_deb_compressor],
  68. [gzip|xz|bzip2], [:],
  69. [AC_MSG_ERROR([unsupported default compressor $with_dpkg_deb_compressor])])
  70. AC_DEFINE_UNQUOTED([DPKG_DEB_DEFAULT_COMPRESSOR],
  71. [COMPRESSOR_TYPE_]AS_TR_CPP(${with_dpkg_deb_compressor}),
  72. [default dpkg-deb build compressor])
  73. AC_MSG_NOTICE([using default dpkg-deb compressor = $with_dpkg_deb_compressor])
  74. ]) # DPKG_DEB_COMPRESSOR
  75. # DPKG_DIST_CHECK(COND, ERROR)
  76. # ---------------
  77. # Check if the condition is fulfilled when preparing a distribution tarball.
  78. AC_DEFUN([DPKG_DIST_CHECK], [
  79. AS_IF([test ! -f $srcdir/.dist-version && $1], [
  80. AC_MSG_ERROR([not building from distributed tarball, $2])
  81. ])
  82. ])# DPKG_DIST_CHECK