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.

117 lines
4.1KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_perl_ext_flags.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_PERL_EXT_FLAGS([CFLAGS-VARIABLE], [LDFLAGS-VARIABLE], [EXTRA-MODULES])
  8. # AX_PERL_EXT_CFLAGS([CFLAGS-VARIABLE])
  9. # AX_PERL_EXT_LDFLAGS([LDFLAGS-VARIABLE], [EXTRA-MODULES])
  10. #
  11. # DESCRIPTION
  12. #
  13. # Fetches the linker flags and C compiler flags for compiling and linking
  14. # programs that embed a Perl interpreter. If the EXTRA-MODULES argument is
  15. # submitted, it is a space separated list of extra modules to link. The
  16. # flags will be stored in the provided variables.
  17. #
  18. # Examples:
  19. #
  20. # AX_PERL_EXT_FLAGS([PERLXS_CFLAGS], [PERLXS_LDFLAGS])
  21. # AC_SUBST([PERLXS_CFLAGS])
  22. # AC_SUBST([PERLXS_LDFLAGS])
  23. #
  24. # AX_PERL_EXT_CFLAGS([PERLXS_CFLAGS])
  25. # AC_SUBST([PERLXS_CFLAGS])
  26. #
  27. # AX_PERL_EXT_LDFLAGS([PERLXS_LDFLAGS], [-std Socket])
  28. #
  29. # LICENSE
  30. #
  31. # Copyright (c) 2009 Mats Kindahl of Sun Microsystems <mats@sun.com>
  32. #
  33. # Redistribution and use in source and binary forms, with or without
  34. # modification, are permitted provided that the following conditions are
  35. # met:
  36. #
  37. # 1. Redistributions of source code must retain the above copyright
  38. # notice, this list of conditions and the following disclaimer.
  39. #
  40. # 2. Redistributions in binary form must reproduce the above copyright
  41. # notice, this list of conditions and the following disclaimer in the
  42. # documentation and/or other materials provided with the distribution.
  43. #
  44. # 3. The name of the author may not be used to endorse or promote products
  45. # derived from this software without specific prior written permission.
  46. #
  47. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  48. # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  49. # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  50. # DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
  51. # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  52. # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  53. # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  54. # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  55. # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  56. # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  57. # POSSIBILITY OF SUCH DAMAGE.
  58. #serial 8
  59. AC_DEFUN([AX_PERL_EXT_CFLAGS],
  60. [AC_CHECK_PROG(PERL,perl,perl)
  61. _AX_PERL_EXT_MODULE_CHECK([ExtUtils::Embed], [have_embed=yes],
  62. [have_embed=no])
  63. AS_IF([test $have_embed = no],
  64. AC_MSG_ERROR([Require ExtUtils::Embed to proceed]))
  65. _AX_PERL_EXT_EMBED_CHECK([$1],[ccopts])
  66. ])
  67. AC_DEFUN([AX_PERL_EXT_LDFLAGS],
  68. [AC_CHECK_PROG(PERL,perl,perl)
  69. _AX_PERL_EXT_MODULE_CHECK([ExtUtils::Embed], [have_embed=yes],
  70. [have_embed=no])
  71. AS_IF([test $have_embed = no],
  72. AC_MSG_ERROR([Require ExtUtils::Embed to proceed]))
  73. _AX_PERL_EXT_EMBED_CHECK([$1],[ldopts],[$2])
  74. ])
  75. AC_DEFUN([AX_PERL_EXT_FLAGS],
  76. [AC_CHECK_PROG(PERL,perl,perl)
  77. _AX_PERL_EXT_MODULE_CHECK([ExtUtils::Embed], [have_embed=yes],
  78. [have_embed=no])
  79. AS_IF([test $have_embed = no],
  80. AC_MSG_ERROR([Require ExtUtils::Embed to proceed]))
  81. _AX_PERL_EXT_EMBED_CHECK([$1],[ccopts])
  82. _AX_PERL_EXT_EMBED_CHECK([$2],[ldopts],[$3])
  83. ])
  84. dnl _AX_PERL_EXT_MODULE_CHECK(MODULE-NAME, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
  85. dnl
  86. dnl Check for the existence of the perl module given by MODULE-NAME.
  87. dnl
  88. AC_DEFUN([_AX_PERL_EXT_MODULE_CHECK],
  89. [AC_MSG_CHECKING([for perl module $1])
  90. $PERL "-M$1" -e exit > /dev/null 2>&1
  91. AS_IF([test $? -eq 0],
  92. [AC_MSG_RESULT(yes)
  93. $2],
  94. [AC_MSG_RESULT(no)
  95. $3])
  96. ])
  97. dnl _AX_PERL_EXT_EMBED_CHECK(VARIABLE, COMMAND, [EXTRA-FLAGS]) Use
  98. dnl
  99. dnl ExtUtils::Embed fetch flags for embedding Perl in a C/C++
  100. dnl application
  101. dnl
  102. AC_DEFUN([_AX_PERL_EXT_EMBED_CHECK],
  103. [AC_MSG_CHECKING([for perl $2 embed flags])
  104. ax_c_perlxs_extras="$3"
  105. $1=`$PERL -MExtUtils::Embed -e $2 ${ax_c_perlxs_extras:+"-- $3"}`
  106. AC_MSG_RESULT($$1)
  107. ])