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
4.5KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_define_sub_path.html
  3. # ===========================================================================
  4. #
  5. # OBSOLETE MACRO
  6. #
  7. # This macro is obsolete because its been completely broken for several
  8. # years without anybody noticing, so apparently it's not used very much.
  9. #
  10. # SYNOPSIS
  11. #
  12. # AX_DEFINE_SUB_PATH(DEFNAME, varname, description)
  13. #
  14. # DESCRIPTION
  15. #
  16. # Look at varname and detect the subpath that it contains relative to
  17. # $prefix/$exec_prefix. If the path is indeed relative to
  18. # $prefix/$exec_prefix, then a single "./" (dotslash) is prepended,
  19. # otherwise it can be seen as an absolute path that cannot be moved, which
  20. # you possibly do for "/etc" files, or even those ending up in
  21. # "/lib/modules" or "/winnt/system".
  22. #
  23. # This macro is not very intelligent, it's just a first try in this
  24. # direction. It does currently just look into the current patterns, and
  25. # replaces a ${prefix} with a simple dot. Amazingly, it works quite well
  26. # for most packages.
  27. #
  28. # Example (configure.ac):
  29. #
  30. # AX_DEFINE_DIR([EPREFIX], [exec_prefix], [--exec-prefix or default])
  31. # AX_DEFINE_SUB_PATH([PATH_LIBDIR], [libdir], [--bindir subdir])
  32. # AC_DEFINE_UNQUOTED([PACKAGE],"$PACKAGE", [Name of package])
  33. #
  34. # Example (in C):
  35. #
  36. # static const char _libdir[] = PATH_LIBDIR; /* configure default */
  37. # char* libdir;
  38. # char* eprefix = getenv (PACKAGE "DIR");
  39. # if (! eprefix) eprefix = EPREFIX; /* default */
  40. # if (*_libdir != '.') libdir = strdup(_libdir);
  41. # else {
  42. # libdir = malloc(strlen(eprefix) + strlen(_libdir) + 2);
  43. # strcpy(libdir, eprefix);
  44. # strcat(libdir, PATH_DELIMITER_STRING);
  45. # strcat(libdir, _libdir);
  46. # }
  47. # ...
  48. # free (libdir);
  49. #
  50. # The AX_DEFINE_SUB_PATHS(varnames) macro looks for the given various
  51. # install-paths that largely depend on either ${prefix} or ${exec_prefix}.
  52. # Just cut out the prefix and ac_define the value. The value is uppercased
  53. # and PATH_ prepended ie. ax_define_sub_paths(bindir libdir pkgdatadir)
  54. # will create the defines PATH_BINDIR PATH_LIBDIR PATH_PKGDATADIR - see
  55. # posix' include/paths.h that creates _PATH_DEV and friends.
  56. #
  57. # LICENSE
  58. #
  59. # Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
  60. #
  61. # This program is free software; you can redistribute it and/or modify it
  62. # under the terms of the GNU General Public License as published by the
  63. # Free Software Foundation; either version 3 of the License, or (at your
  64. # option) any later version.
  65. #
  66. # This program is distributed in the hope that it will be useful, but
  67. # WITHOUT ANY WARRANTY; without even the implied warranty of
  68. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
  69. # Public License for more details.
  70. #
  71. # You should have received a copy of the GNU General Public License along
  72. # with this program. If not, see <https://www.gnu.org/licenses/>.
  73. #
  74. # As a special exception, the respective Autoconf Macro's copyright owner
  75. # gives unlimited permission to copy, distribute and modify the configure
  76. # scripts that are the output of Autoconf when processing the Macro. You
  77. # need not follow the terms of the GNU General Public License when using
  78. # or distributing such scripts, even though portions of the text of the
  79. # Macro appear in them. The GNU General Public License (GPL) does govern
  80. # all other use of the material that constitutes the Autoconf Macro.
  81. #
  82. # This special exception to the GPL applies to versions of the Autoconf
  83. # Macro released by the Autoconf Archive. When you make and distribute a
  84. # modified version of the Autoconf Macro, you may extend this special
  85. # exception to the GPL to apply to your modified version as well.
  86. #serial 11
  87. AU_ALIAS([AC_DEFINE_SUB_PATH], [AX_DEFINE_SUB_PATH])
  88. AC_DEFUN([AX_DEFINE_SUB_PATH],
  89. [dnl
  90. test "_$prefix" = _NONE && prefix="$ac_default_prefix"
  91. test "_$exec_prefix" = _NONE && exec_prefix='${prefix}'
  92. P=`echo ifelse( $2, , [$]$1, [$]$2) | sed -e 's:^\${[a-z_]*prefix}:.:'`
  93. ifelse($3, ,
  94. AC_DEFINE($1, $P, [sub path $2]),
  95. AC_DEFINE($1, $P, $3))
  96. ])
  97. AC_DEFUN([AX_DEFINE_SUB_PATHS],
  98. [dnl
  99. test "_$prefix" = _NONE && prefix="$ac_default_prefix"
  100. test "_$exec_prefix" = _NONE && exec_prefix='${prefix}'
  101. for i in $1 ; do
  102. P=`echo \$$i | sed -e 's:^\${[a-z_]*prefix}:.:'`
  103. V=`echo path_$i | sed -e 'y:abcdefghijklmnopqrstuvwxyz:ABCDEFGHIJKLMNOPQRSTUVWXYZ:'`
  104. AC_DEFINE($V, $P, [sub path $i]),
  105. ])