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.

162 lines
6.7KB

  1. # =================================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_warning_default_pkgconfig.html
  3. # =================================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_WARNING_DEFAULT_PKGCONFIGDIR [(dirvariable [,[defsetting][,[A][,[N/A]]]])]
  8. # AX_ENABLE_DEFAULT_PKGCONFIGDIR [(dirvariable [,defsetting])]
  9. #
  10. # DESCRIPTION
  11. #
  12. # print a warning message if the $(datadir)/aclocal directory is not in
  13. # the dirlist searched by the aclocal tool. This macro is useful if some
  14. # `make install` would target $(datadir)/aclocal to install an autoconf m4
  15. # file of your project to be picked up by other projects.
  16. #
  17. # default $1 dirvariable = pkgconfigdir
  18. # default $2 defsetting = ${libdir}/pkgconfig
  19. # default $3 action = nothing to do
  20. # default $4 action = warn the user about mismatch
  21. #
  22. # In the _WARNING_ variant, the defsetting is not placed in dirvariable
  23. # nor is it ac_subst'ed in any way. The default fail-action $4 is to send
  24. # a warning message to the user, and the default accept-action $3 is
  25. # nothing. It is expected that a Makefile is generated with
  26. # pkgconfigdir=${libdir}/pkgconfig
  27. #
  28. # The _ENABLE_ variant however will set not only the $pkgconfigdir shell
  29. # var of the script, but it is also AC-SUBST'ed on default - and
  30. # furthermore a configure option "--enable-default-pkgconfigdir" is
  31. # provided. Only if that option is set then $2 default is not set to the
  32. # canonic default in the a $prefix subpath but instead $2 default is set
  33. # to the primary path where `pkg-config` looks for .pc files. The user may
  34. # also override the default on the command line.
  35. #
  36. # LICENSE
  37. #
  38. # Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
  39. #
  40. # This program is free software; you can redistribute it and/or modify it
  41. # under the terms of the GNU General Public License as published by the
  42. # Free Software Foundation; either version 3 of the License, or (at your
  43. # option) any later version.
  44. #
  45. # This program is distributed in the hope that it will be useful, but
  46. # WITHOUT ANY WARRANTY; without even the implied warranty of
  47. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
  48. # Public License for more details.
  49. #
  50. # You should have received a copy of the GNU General Public License along
  51. # with this program. If not, see <https://www.gnu.org/licenses/>.
  52. #
  53. # As a special exception, the respective Autoconf Macro's copyright owner
  54. # gives unlimited permission to copy, distribute and modify the configure
  55. # scripts that are the output of Autoconf when processing the Macro. You
  56. # need not follow the terms of the GNU General Public License when using
  57. # or distributing such scripts, even though portions of the text of the
  58. # Macro appear in them. The GNU General Public License (GPL) does govern
  59. # all other use of the material that constitutes the Autoconf Macro.
  60. #
  61. # This special exception to the GPL applies to versions of the Autoconf
  62. # Macro released by the Autoconf Archive. When you make and distribute a
  63. # modified version of the Autoconf Macro, you may extend this special
  64. # exception to the GPL to apply to your modified version as well.
  65. #serial 8
  66. AC_DEFUN([AX_WARNING_DEFAULT_PKGCONFIGDIR],[dnl
  67. AC_REQUIRE([AX_EXPAND_PREFIX])dnl
  68. AS_VAR_PUSHDEF([DIR],[ax_warning_default_pkgconfig_dir])dnl
  69. AS_VAR_PUSHDEF([BIN],[ax_warning_default_pkgconfig_bin])dnl
  70. AS_VAR_PUSHDEF([LOC],[ax_warning_default_pkgconfig_loc])dnl
  71. LOC='m4_if([$2],,[${libdir}/pkgconfig],[$2])'
  72. m4_ifval([$1],[test ".$[]$1" != "." && LOC="$[]$1"])
  73. if test ".$PKG_CONFIG" = "." ; then # we use the same default as in pkg.m4
  74. AC_PATH_PROG([PKG_CONFIG],[pkg-config],[no])
  75. fi
  76. if test "$PKG_CONFIG" = "no"
  77. then DIR="/" ; test -d "/usr/lib/pkgconfig" && DIR="/usr/lib/pkgconfig"
  78. else BIN=`AS_DIRNAME(["$DIR"])` ;
  79. if test -d "$BIN/lib/pkgconfig" ; then
  80. DIR="$BIN/lib/pkgconfig"
  81. else BIN=`AS_DIRNAME(["$DIR"])`
  82. if test -d "$BIN/lib/pkgconfig" ; then
  83. DIR="$BIN/lib/pkgconfig"
  84. else
  85. if test -d "/usr/lib/pkgconfig" ; then
  86. DIR="/usr/lib/pkgconfig"
  87. else
  88. DIR="/"
  89. fi fi fi
  90. fi
  91. AC_RUN_LOG([: last pkgconfig dir is assumed as "$DIR"])
  92. DIR=`eval "echo $DIR"`
  93. DIR=`eval "echo $DIR"`
  94. LOC=`eval "echo $LOC"`
  95. LOC=`eval "echo $LOC"`
  96. LOC=`eval "echo $LOC"`
  97. LOC=`eval "echo $LOC"`
  98. for DIR in `echo "$PKG_CONFIG_PATH:$DIR" | sed -e 's,:, ,g'` ; do
  99. AC_RUN_LOG([: test ".$LOC" = ".$DIR"])
  100. test ".$LOC" = ".$DIR" && break
  101. done
  102. if test "$LOC" != "$DIR" ; then
  103. m4_ifval([$4],[$4],[dnl
  104. AC_MSG_NOTICE([warning: m4_if([$1],,[pkgconfigdir],[$1])=$LOC dnl
  105. (see config.log)])
  106. AC_MSG_NOTICE([perhaps: make install m4_if([$1],,[pkgconfigdir],[$1])=$DIR])
  107. cat m4_ifset([AS_MESSAGE_LOG_FD],[>&AS_MESSAGE_LOG_FD],[>>config.log]) <<EOF
  108. pkgconfigdir: the m4_if([$1],,[default pkgconfigdir],[$1 value]) of $LOC
  109. pkgconfigdir: is not listed in the dirlist where pkg-config will look for
  110. pkgconfigdir: package-configs - you can override the install-path using
  111. pkgconfigdir: make install m4_if([$1],,[pkgconfigdir],[$1])=$DIR
  112. pkgconfigdir: or set/append the directory to the environment variable
  113. pkgconfigdir: PKG_CONFIG_PATH="$LOC"
  114. EOF
  115. m4_ifvaln([$5],[$5])])dnl
  116. m4_ifvaln([$3],[else $3])dnl
  117. fi
  118. AS_VAR_POPDEF([LOC])dnl
  119. AS_VAR_POPDEF([BIN])dnl
  120. AS_VAR_POPDEF([DIR])dnl
  121. ])
  122. AC_DEFUN([AX_ENABLE_DEFAULT_PKGCONFIGDIR],[dnl
  123. AS_VAR_PUSHDEF([BIN],[ax_warning_default_pkgconfig_bin])dnl
  124. AS_VAR_PUSHDEF([DIR],[ax_warning_default_pkgconfig_def])dnl
  125. AS_VAR_PUSHDEF([DEF],[ax_warning_default_pkgconfig_def])dnl
  126. AC_ARG_ENABLE([enable-default-pkgconfigdir],
  127. [ --enable-default-pkgconfigdir(=PATH) override the libdir/pkgconfig default])
  128. test ".$enable_default_pkgconfigdir" = "." && enable_default_pkgconfigdir="no"
  129. case ".$enable_default_pkgconfigdir" in
  130. .no) DIR='m4_if([$2],,[${libdir}/pkgconfig],[$2])' ;;
  131. .yes) # autodetect
  132. if test ".$PKG_CONFIG" = "." ; then # we use the same default as in pkg.m4
  133. AC_PATH_PROG([PKG_CONFIG],[pkg-config],[no])
  134. fi
  135. if test "$PKG_CONFIG" = "no"
  136. then DIR="/tmp" ; test -d "/usr/lib/pkgconfig" && DIR="/usr/lib/pkgconfig"
  137. else BIN=`AS_DIRNAME(["$DIR"])` ;
  138. if test -d "$BIN/lib/pkgconfig" ; then
  139. DIR="$BIN/lib/pkgconfig"
  140. else BIN=`AS_DIRNAME(["$DIR"])`
  141. if test -d "$BIN/lib/pkgconfig" ; then
  142. DIR="$BIN/lib/pkgconfig"
  143. else
  144. if test -d "/usr/lib/pkgconfig" ; then
  145. DIR="/usr/lib/pkgconfig"
  146. else
  147. DIR="/tmp"
  148. fi fi fi
  149. fi ;;
  150. *) DIR="$enable_default_pkgconfigdir" ;;
  151. esac
  152. AX_WARNING_DEFAULT_PKGCONFIGDIR([$1],[$DEF],[$3],[$4],[$5])
  153. m4_if([$1],,[pkgconfigdir],[$1])="$ax_warning_default_pkgconfig_dir"
  154. AC_SUBST(m4_if([$1],,[pkgconfigdir],[$1]))
  155. AS_VAR_POPDEF([DEF])dnl
  156. AS_VAR_POPDEF([DIR])dnl
  157. AS_VAR_POPDEF([BIN])dnl
  158. ])