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.

73 lines
2.6KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_check_user.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_CHECK_USER
  8. #
  9. # DESCRIPTION
  10. #
  11. # Check if the specified UNIX user exists, if yes set your environment
  12. # variable to that username else unset your environment variable
  13. #
  14. # Example:
  15. #
  16. # AX_CHECK_USER(USER, [gleensalmon])
  17. # if test x$USER = xgleensalmon; then
  18. # bla..bla..bla..
  19. # else
  20. # bla..bla..bla..
  21. # fi
  22. #
  23. # Besides checking existence, this macro also set these environment
  24. # variables upon completion:
  25. #
  26. # USER_HOME = home directory of user, written in /etc/passwd
  27. #
  28. # LICENSE
  29. #
  30. # Copyright (c) 2008 Gleen Salmon <gleensalmon@yahoo.com>
  31. #
  32. # This program is free software; you can redistribute it and/or modify it
  33. # under the terms of the GNU General Public License as published by the
  34. # Free Software Foundation; either version 2 of the License, or (at your
  35. # option) any later version.
  36. #
  37. # This program is distributed in the hope that it will be useful, but
  38. # WITHOUT ANY WARRANTY; without even the implied warranty of
  39. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
  40. # Public License for more details.
  41. #
  42. # You should have received a copy of the GNU General Public License along
  43. # with this program. If not, see <https://www.gnu.org/licenses/>.
  44. #
  45. # As a special exception, the respective Autoconf Macro's copyright owner
  46. # gives unlimited permission to copy, distribute and modify the configure
  47. # scripts that are the output of Autoconf when processing the Macro. You
  48. # need not follow the terms of the GNU General Public License when using
  49. # or distributing such scripts, even though portions of the text of the
  50. # Macro appear in them. The GNU General Public License (GPL) does govern
  51. # all other use of the material that constitutes the Autoconf Macro.
  52. #
  53. # This special exception to the GPL applies to versions of the Autoconf
  54. # Macro released by the Autoconf Archive. When you make and distribute a
  55. # modified version of the Autoconf Macro, you may extend this special
  56. # exception to the GPL to apply to your modified version as well.
  57. #serial 6
  58. AU_ALIAS([AC_CHECK_USER], [AX_CHECK_USER])
  59. AC_DEFUN([AX_CHECK_USER],[
  60. AC_MSG_CHECKING([for user $2])
  61. if grep ^$2: /etc/passwd > /dev/null; then
  62. $1=$2
  63. USER_HOME=`grep ^$2: /etc/passwd | sed "s/^\([[^:]]*:\)\{5\}\([[^:]]*\):[[^:]]*$/\2/"`
  64. AC_MSG_RESULT([yes])
  65. else
  66. unset $1
  67. unset USER_HOME
  68. AC_MSG_RESULT([no])
  69. fi;dnl
  70. ])