Collection of DPF-based plugins for packaging
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
2.2KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_prog_perl_modules.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_PROG_PERL_MODULES([MODULES], [ACTION-IF-TRUE], [ACTION-IF-FALSE])
  8. #
  9. # DESCRIPTION
  10. #
  11. # Checks to see if the given perl modules are available. If true the shell
  12. # commands in ACTION-IF-TRUE are executed. If not the shell commands in
  13. # ACTION-IF-FALSE are run. Note if $PERL is not set (for example by
  14. # calling AC_CHECK_PROG, or AC_PATH_PROG), AC_CHECK_PROG(PERL, perl, perl)
  15. # will be run.
  16. #
  17. # MODULES is a space separated list of module names. To check for a
  18. # minimum version of a module, append the version number to the module
  19. # name, separated by an equals sign.
  20. #
  21. # Example:
  22. #
  23. # AX_PROG_PERL_MODULES( Text::Wrap Net::LDAP=1.0.3, ,
  24. # AC_MSG_WARN(Need some Perl modules)
  25. #
  26. # LICENSE
  27. #
  28. # Copyright (c) 2009 Dean Povey <povey@wedgetail.com>
  29. #
  30. # Copying and distribution of this file, with or without modification, are
  31. # permitted in any medium without royalty provided the copyright notice
  32. # and this notice are preserved. This file is offered as-is, without any
  33. # warranty.
  34. #serial 8
  35. AU_ALIAS([AC_PROG_PERL_MODULES], [AX_PROG_PERL_MODULES])
  36. AC_DEFUN([AX_PROG_PERL_MODULES],[dnl
  37. m4_define([ax_perl_modules])
  38. m4_foreach([ax_perl_module], m4_split(m4_normalize([$1])),
  39. [
  40. m4_append([ax_perl_modules],
  41. [']m4_bpatsubst(ax_perl_module,=,[ ])[' ])
  42. ])
  43. # Make sure we have perl
  44. if test -z "$PERL"; then
  45. AC_CHECK_PROG(PERL,perl,perl)
  46. fi
  47. if test "x$PERL" != x; then
  48. ax_perl_modules_failed=0
  49. for ax_perl_module in ax_perl_modules; do
  50. AC_MSG_CHECKING(for perl module $ax_perl_module)
  51. # Would be nice to log result here, but can't rely on autoconf internals
  52. $PERL -e "use $ax_perl_module; exit" > /dev/null 2>&1
  53. if test $? -ne 0; then
  54. AC_MSG_RESULT(no);
  55. ax_perl_modules_failed=1
  56. else
  57. AC_MSG_RESULT(ok);
  58. fi
  59. done
  60. # Run optional shell commands
  61. if test "$ax_perl_modules_failed" = 0; then
  62. :
  63. $2
  64. else
  65. :
  66. $3
  67. fi
  68. else
  69. AC_MSG_WARN(could not find perl)
  70. fi])dnl