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.

147 lines
6.2KB

  1. # ==================================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_warning_default_aclocaldir.html
  3. # ==================================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_WARNING_DEFAULT_ACLOCALDIR [(dirvariable [,[defsetting][,[A][,[N/A]]]])]
  8. # AX_ENABLE_DEFAULT_ACLOCALDIR [(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 = aclocaldir
  18. # default $2 defsetting = ${datadir}/aclocal
  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. # aclocaldir=${datadir}/aclocal
  27. #
  28. # The _ENABLE_ variant however will set not only the $aclocaldir shell var
  29. # of the script, but it is also AC-SUBST'ed on default - and furthermore a
  30. # configure option "--enable-default-aclocaldir" is provided. Only if that
  31. # option is set then $2 default is not set to the canonic default in the a
  32. # $prefix subpath but instead $2 default is set to the primary path where
  33. # `aclocal` looks for macros. The user may also override the default on
  34. # 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 9
  66. AC_DEFUN([AX_WARNING_DEFAULT_ACLOCALDIR],[dnl
  67. AC_REQUIRE([AX_EXPAND_PREFIX])dnl
  68. AS_VAR_PUSHDEF([DIR],[ax_warning_default_aclocal_dir])dnl
  69. AS_VAR_PUSHDEF([BIN],[ax_warning_default_aclocal_bin])dnl
  70. AS_VAR_PUSHDEF([LOC],[ax_warning_default_aclocal_loc])dnl
  71. LOC='m4_if([$2],,[${datadir}/aclocal],[$2])'
  72. m4_ifval([$1],[test ".$[]$1" != "." && LOC="$[]$1"])
  73. if test ".$ACLOCAL" = "." ; then
  74. AC_PATH_PROG([ACLOCAL],[aclocal],[:])
  75. fi
  76. BIN="$ACLOCAL"
  77. test ".$BIN" = "." && BIN="aclocal"
  78. DIR=`test ".$SHELL" = "." && SHELL="'sh'" ; eval "$BIN --print-ac-dir"`
  79. test ".$DIR" = "." && test -d "/usr/share/aclocal" && DIR="/usr/share/aclocal"
  80. test ".$DIR" = "." && DIR="/tmp"
  81. DIR=`eval "echo $DIR"` # we need to expand
  82. DIR=`eval "echo $DIR"`
  83. LOC=`eval "echo $LOC"`
  84. LOC=`eval "echo $LOC"`
  85. LOC=`eval "echo $LOC"`
  86. LOC=`eval "echo $LOC"`
  87. AC_RUN_LOG([: test "$LOC" = "$DIR"])
  88. if test "$LOC" != "$DIR" ; then
  89. if test -f "$DIR/dirlist" ; then
  90. for DIR in `cat $DIR/dirlist` $DIR ; do
  91. AC_RUN_LOG([: test "$LOC" = "$DIR"])
  92. test "$LOC" = "$DIR" && break
  93. done
  94. fi
  95. if test "$LOC" != "$DIR" ; then
  96. m4_ifval([$4],[$4],[dnl
  97. AC_MSG_NOTICE([warning: m4_if([$1],,[aclocaldir],[$1])=$LOC dnl
  98. (see config.log)])
  99. AC_MSG_NOTICE([perhaps: make install m4_if([$1],,[aclocaldir],[$1])=$DIR])
  100. cat m4_ifset([AS_MESSAGE_LOG_FD],[>&AS_MESSAGE_LOG_FD],[>>config.log]) <<EOF
  101. aclocaldir: the m4_if([$1],,[default aclocaldir],[$1 value]) of $LOC
  102. aclocaldir: is not listed in the dirlist where aclocal will look
  103. aclocaldir: for macros - you can override the install-path using
  104. aclocaldir: make install aclocaldir=$DIR
  105. aclocaldir: or append the directory to aclocal reconfigures later as
  106. aclocaldir: aclocal -I $LOC
  107. aclocaldir: when an autoconf macro is needed from that directory
  108. EOF
  109. m4_ifvaln([$5],[$5])])dnl
  110. m4_ifvaln([$3],[else $3])dnl
  111. fi
  112. fi
  113. AS_VAR_POPDEF([LOC])dnl
  114. AS_VAR_POPDEF([BIN])dnl
  115. AS_VAR_POPDEF([DIR])dnl
  116. ])
  117. AC_DEFUN([AX_ENABLE_DEFAULT_ACLOCALDIR],[dnl
  118. AS_VAR_PUSHDEF([BIN],[ax_warning_default_aclocal_bin])dnl
  119. AS_VAR_PUSHDEF([DIR],[ax_warning_default_aclocal_def])dnl
  120. AS_VAR_PUSHDEF([DEF],[ax_warning_default_aclocal_def])dnl
  121. AC_ARG_ENABLE([default-aclocaldir],
  122. [AS_HELP_STRING([--enable-default-aclocaldir@<:@=PATH@:>@], [override the datadir/aclocal default])])
  123. test ".$enable_default_aclocaldir" = "." && enable_default_aclocaldir="no"
  124. case ".$enable_default_aclocaldir" in
  125. .no) DIR='m4_if([$2],,[${datadir}/aclocal],[$2])' ;;
  126. .yes) # autodetect
  127. if test ".$ACLOCAL" = "." ; then
  128. AC_PATH_PROG([ACLOCAL],[aclocal],[:])
  129. fi
  130. BIN="$ACLOCAL"
  131. test ".$BIN" = "." && BIN="aclocal"
  132. DIR=`test ".$SHELL" = "." && SHELL="'sh'" ; eval "$BIN --print-ac-dir"`
  133. test ".$DIR" = "." && test -d "/usr/share/aclocal" && DIR="/usr/share/aclocal"
  134. test ".$DIR" = "." && DIR="/tmp" ;;
  135. *) DIR="$enable_default_aclocaldir" ;;
  136. esac
  137. AX_WARNING_DEFAULT_ACLOCALDIR([$1],[$DEF],[$3],[$4],[$5])
  138. m4_if([$1],,[aclocaldir],[$1])="$ax_warning_default_aclocal_dir"
  139. AC_SUBST(m4_if([$1],,[aclocaldir],[$1]))
  140. AS_VAR_POPDEF([DEF])dnl
  141. AS_VAR_POPDEF([DIR])dnl
  142. AS_VAR_POPDEF([BIN])dnl
  143. ])