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.

115 lines
3.3KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_python_config_var.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_PYTHON_CONFIG_VAR(PYTHON_VARIABLE, [SHELL_VARIABLE])
  8. # AX_PYTHON_CONFIG_H
  9. # AX_PYTHON_MAKEFILE
  10. #
  11. # DESCRIPTION
  12. #
  13. # AX_PYTHON_CONFIG_VAR:
  14. #
  15. # Using the Python module distutils.sysconfig[1], return a Python
  16. # configuration variable. PYTHON_VARIABLE is the name of the variable to
  17. # request from Python, and SHELL_VARIABLE is the name of the shell
  18. # variable into which the results should be deposited. If SHELL_VARIABLE
  19. # is not specified, the macro wil prefix PY_ to the PYTHON_VARIABLE, e.g.,
  20. # LIBS -> PY_LIBS.
  21. #
  22. # SHELL_VARIABLE is AC_SUBST'd. No action is taken if an error occurs.
  23. # Note if $PYTHON is not set, AC_CHECK_PROG(PYTHON, python, python) will
  24. # be run.
  25. #
  26. # Example:
  27. #
  28. # AX_PYTHON_CONFIG_VAR(LINKFORSHARED, PY_LFS)
  29. #
  30. # AX_PYTHON_CONFIG_H:
  31. #
  32. # Using the Python module distutils.sysconfig[1], put the full pathname of
  33. # the config.h file used to compile Python into the shell variable
  34. # PY_CONFIG_H. PY_CONFIG_H is AC_SUBST'd. Note if $PYTHON is not set,
  35. # AC_CHECK_PROG(PYTHON, python, python) will be run.
  36. #
  37. # AX_PYTHON_MAKEFILE:
  38. #
  39. # Using the Python module distutils.sysconfig[1], put the full pathname of
  40. # the Makefile file used to compile Python into the shell variable
  41. # PY_MAKEFILE. PY_MAKEFILE is AC_SUBST'd. Note if $PYTHON is not set,
  42. # AC_CHECK_PROG(PYTHON, python, python) will be run.
  43. #
  44. # [1]
  45. # http://www.python.org/doc/current/dist/module-distutils.sysconfig.html
  46. #
  47. # LICENSE
  48. #
  49. # Copyright (c) 2008 Dustin J. Mitchell <dustin@cs.uchicago.edu>
  50. #
  51. # Copying and distribution of this file, with or without modification, are
  52. # permitted in any medium without royalty provided the copyright notice
  53. # and this notice are preserved. This file is offered as-is, without any
  54. # warranty.
  55. #serial 10
  56. AC_DEFUN([AX_PYTHON_CONFIG_VAR],
  57. [
  58. AC_MSG_CHECKING(for Python config variable $1)
  59. if test -z "$PYTHON"
  60. then
  61. AC_CHECK_PROG(PYTHON,python,python)
  62. fi
  63. py_error="no"
  64. pyval=`$PYTHON -c "from distutils import sysconfig;dnl
  65. print sysconfig.get_config_var('$1')"` || py_error="yes"
  66. if test "$py_error" = "yes"
  67. then
  68. AC_MSG_RESULT(no - an error occurred)
  69. else
  70. AC_MSG_RESULT($pyval)
  71. m4_ifval([$2],[$2],[PY_$1])="$pyval"
  72. AC_SUBST(m4_ifval([$2],[$2],[PY_$1]))
  73. fi
  74. ])
  75. AC_DEFUN([AX_PYTHON_CONFIG_H],
  76. [
  77. AC_MSG_CHECKING(location of Python's config.h)
  78. if test -z "$PYTHON"
  79. then
  80. AC_CHECK_PROG(PYTHON,python,python)
  81. fi
  82. py_error="no"
  83. PY_CONFIG_H=`$PYTHON -c "from distutils import sysconfig;dnl
  84. print sysconfig.get_config_h_filename()"` || py_error = "yes"
  85. if test "$py_error" = "yes"
  86. then
  87. AC_MSG_RESULT(no - an error occurred)
  88. else
  89. AC_MSG_RESULT($PY_CONFIG_H)
  90. AC_SUBST(PY_CONFIG_H)
  91. fi
  92. ])
  93. AC_DEFUN([AX_PYTHON_MAKEFILE],
  94. [
  95. AC_MSG_CHECKING(location of Python's Makefile)
  96. if test -z "$PYTHON"
  97. then
  98. AC_CHECK_PROG(PYTHON,python,python)
  99. fi
  100. py_error="no"
  101. PY_MAKEFILE=`$PYTHON -c "from distutils import sysconfig;dnl
  102. print sysconfig.get_makefile_filename()"` || py_error = "yes"
  103. if test "$py_error" = "yes"
  104. then
  105. AC_MSG_RESULT(no - an error occurred)
  106. else
  107. AC_MSG_RESULT($PY_MAKEFILE)
  108. AC_SUBST(PY_MAKEFILE)
  109. fi
  110. ])