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.

109 lines
3.5KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_sip_devel.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_SIP_DEVEL([<min_version>])
  8. #
  9. # DESCRIPTION
  10. #
  11. # Searches for the sip executable and the sip include path. The sip
  12. # include path consists of two components, one which contains the file
  13. # qt/qtmod.sip and the other one the path to sip.h, which should be found
  14. # in the include/pythonX.Y directory.
  15. #
  16. # The macro bails out if the executable or the file cannot be located.
  17. # Otherwise it defines:
  18. #
  19. # SIP the path to the sip executable
  20. # SIP_CPPFLAGS include path: -I<path-to-qt/qtmod.sip> -I<path-to-sip.h-dir>
  21. #
  22. # Example:
  23. #
  24. # AX_SIP_DEVEL
  25. # AX_SIP_DEVEL([4.1])
  26. #
  27. # Requires: perl (for version string comparison)
  28. #
  29. # FIXME: Use AX_COMPARE_VERSION instead.
  30. #
  31. # LICENSE
  32. #
  33. # Copyright (c) 2008 Uwe Mayer <merkosh@hadiko.de>
  34. #
  35. # Copying and distribution of this file, with or without modification, are
  36. # permitted in any medium without royalty provided the copyright notice
  37. # and this notice are preserved. This file is offered as-is, without any
  38. # warranty.
  39. #serial 10
  40. AU_ALIAS([MERK_SIP_DEVEL], [AX_SIP_DEVEL])
  41. AC_DEFUN([AX_SIP_DEVEL],[
  42. #-- provide --with-sip=PATH command line argument
  43. AC_ARG_WITH([sip],
  44. AS_HELP_STRING([--with-sip=PATH], [specify the location of the qt/qtmod.sip file]),
  45. [sip_search_dir="$withval"],
  46. [sip_search_dir=""])
  47. #-- check for sip executable
  48. AC_PATH_PROG([SIP], [sip], [no])
  49. if test x"$SIP" == x"no"; then
  50. AC_MSG_ERROR([failed to find required command sip])
  51. fi
  52. AC_SUBST([SIP])
  53. #-- check for minimum sip version
  54. if test x"$1" != x""; then
  55. AC_CHECK_PROG([PERL], [perl], [$(which perl)])
  56. if test x"$PERL" == x""; then
  57. AC_MSG_ERROR([perl required for checking sip version])
  58. fi
  59. AC_MSG_CHECKING([sip version >= $1])
  60. sip_version=$($SIP -V |cut -f 1 -d " ")
  61. ax_sip_devel_result=$(echo "$sip_version" |perl -e '("$1" lt <STDIN>) && print "ok"')
  62. if test x"$ax_sip_devel_result" == x""; then
  63. AC_MSG_RESULT([$sip_version])
  64. AC_MSG_ERROR([a newer version of sip is required])
  65. else
  66. AC_MSG_RESULT([ok])
  67. fi
  68. fi
  69. #-- Check for SIP include path
  70. AC_MSG_CHECKING([for sip include path])
  71. # check for qt/qtmod.sip
  72. for i in "$sip_search_dir" "/usr/share/sip"; do
  73. sip_path1=`find $i -type f -name qtmod.sip -print | sed "1q"`
  74. if test -n "$sip_path1"; then
  75. break
  76. fi
  77. done
  78. sip_path1=`echo "$sip_path1" | sed 's,/qt/qtmod.sip,,'`
  79. if test -z "$sip_path1" ; then
  80. AC_MSG_ERROR([cannot find qt/qtmod.sip; try --with-sip=PATH])
  81. fi
  82. # check for sip.h
  83. dnl this part of the code to detect python version and include path
  84. dnl was taken from AX_PYTHON_DEVEL macro, (rev. 2008-04-12)
  85. python_path=`echo $PYTHON | sed "s,/bin.*$,,"`
  86. for i in "$python_path/include/python$PYTHON_VERSION/" "$python_path/include/python/" "$python_path/" ; do
  87. python_path=`find $i -type f -name Python.h -print | sed "1q"`
  88. if test -n "$python_path" ; then
  89. break
  90. fi
  91. done
  92. sip_path2=`echo $python_path | sed "s,/Python.h$,,"`
  93. if ! test -f "$sip_path2/sip.h"; then
  94. AC_MSG_ERROR([cannot find include path to sip.h])
  95. fi
  96. AC_MSG_RESULT([$sip_path1,$sip_path2])
  97. AC_SUBST([SIP_CPPFLAGS],["-I$sip_path1 -I$sip_path2"])
  98. ])