dpkg-build.m4 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # Copyright © 2010-2012 Guillem Jover <guillem@debian.org>
  2. # DPKG_BUILD_PROG(PROG)
  3. # ---------------
  4. # Allow disabling compilation and usage of specific programs.
  5. AC_DEFUN([DPKG_BUILD_PROG], [
  6. AC_MSG_CHECKING([whether to build $1])
  7. AC_ARG_ENABLE([$1],
  8. AS_HELP_STRING([--disable-$1], [do not build or use $1]),
  9. [build_]AS_TR_SH([$1])[=$enable_]AS_TR_SH([$1]),
  10. [build_]AS_TR_SH([$1])[=yes]
  11. )
  12. AM_CONDITIONAL([BUILD_]AS_TR_CPP([$1]),
  13. [test "x$build_]AS_TR_SH([$1])[" = "xyes"])
  14. AS_IF([test "x$build_]AS_TR_SH([$1])[" = "xyes"], [
  15. AC_DEFINE([BUILD_]AS_TR_CPP([$1]), 1, [Define to 1 if $1 is compiled.])
  16. ], [
  17. AC_DEFINE([BUILD_]AS_TR_CPP([$1]), 0)
  18. ])
  19. AC_MSG_RESULT([$build_]AS_TR_SH([$1]))
  20. ])# DPKG_BUILD_PROG
  21. # DPKG_WITH_DIR(DIR, DEFAULT, DESCRIPTION)
  22. # -------------
  23. # Allow specifying alternate directories.
  24. AC_DEFUN([DPKG_WITH_DIR], [
  25. $1="$2"
  26. AC_ARG_WITH([$1],
  27. AS_HELP_STRING([--with-$1=DIR], [$3]),
  28. AS_CASE([$with_$1],
  29. [""], [AC_MSG_ERROR([invalid $1 specified])],
  30. [$1="$with_$1"])
  31. )
  32. AC_SUBST([$1])
  33. AC_MSG_NOTICE([using directory $1 = '$$1'])
  34. ])# DPKG_WITH_DIR
  35. # DPKG_DIST_CHECK(COND, ERROR)
  36. # ---------------
  37. # Check if the condition is fulfilled when preparing a distribution tarball.
  38. AC_DEFUN([DPKG_DIST_CHECK], [
  39. AS_IF([test ! -f $srcdir/.dist-version && $1], [
  40. AC_ERROR([not building from distributed tarball, $2])
  41. ])
  42. ])# DPKG_DIST_CHECK