4
0

ax_nagios_get_os 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. # ===========================================================================
  2. # SYNOPSIS
  3. #
  4. # AX_NAGIOS_GET_OS
  5. #
  6. # DESCRIPTION
  7. #
  8. # This macro determines the operating system of the computer it is run on.
  9. #
  10. # LICENSE
  11. #
  12. # Copyright (c) 2016 Nagios Core Development Team
  13. #
  14. # This program is free software; you can redistribute it and/or modify it
  15. # under the terms of the GNU General Public License as published by the
  16. # Free Software Foundation; either version 2 of the License, or (at your
  17. # option) any later version.
  18. #
  19. # This program is distributed in the hope that it will be useful, but
  20. # WITHOUT ANY WARRANTY; without even the implied warranty of
  21. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
  22. # Public License for more details.
  23. #
  24. # You should have received a copy of the GNU General Public License along
  25. # with this program. If not, see <http://www.gnu.org/licenses/>.
  26. #
  27. # As a special exception, the respective Autoconf Macro's copyright owner
  28. # gives unlimited permission to copy, distribute and modify the configure
  29. # scripts that are the output of Autoconf when processing the Macro. You
  30. # need not follow the terms of the GNU General Public License when using
  31. # or distributing such scripts, even though portions of the text of the
  32. # Macro appear in them. The GNU General Public License (GPL) does govern
  33. # all other use of the material that constitutes the Autoconf Macro.
  34. #
  35. # This special exception to the GPL applies to versions of the Autoconf
  36. # Macro released by the Autoconf Archive. When you make and distribute a
  37. # modified version of the Autoconf Macro, you may extend this special
  38. # exception to the GPL to apply to your modified version as well.
  39. # ===========================================================================
  40. AU_ALIAS([AC_NAGIOS_GET_OS], [AX_NAGIOS_GET_OS])
  41. AC_DEFUN([AX_NAGIOS_GET_OS],
  42. [
  43. #
  44. # Get user hints
  45. #
  46. AC_MSG_CHECKING(what the operating system is )
  47. AC_ARG_WITH(opsys, AC_HELP_STRING([--with-opsys=OS],
  48. [specify operating system (linux, osx, bsd, solaris, irix, cygwin,
  49. aix, hp-ux, etc.)]),
  50. [
  51. #
  52. # Run this if --with was specified
  53. #
  54. if test "x$withval" = x -o x$withval = xno; then
  55. opsys_wanted=yes
  56. else
  57. opsys_wanted=no
  58. opsys="$withval"
  59. AC_MSG_RESULT($opsys)
  60. fi
  61. ], [
  62. #
  63. # Run this if --with was not specified
  64. #
  65. opsys_wanted=yes
  66. ])
  67. if test x$opsys = xno; then
  68. opsys=""
  69. opsys_wanted=yes
  70. elif test x$opsys = xyes; then
  71. AC_MSG_ERROR([you must enter an O/S type if '--with-opsys' is specified])
  72. fi
  73. #
  74. # Determine operating system if it wasn't supplied
  75. #
  76. if test $opsys_wanted=yes; then
  77. opsys=`uname -s | tr ["[A-Z]" "[a-z]"]`
  78. if test x"$opsys" = "x"; then opsys="unknown"; fi
  79. AS_CASE([$opsys],
  80. [darwin*], opsys="osx",
  81. [*bsd*], opsys="bsd",
  82. [dragonfly], opsys="bsd",
  83. [sunos], opsys="solaris",
  84. [gnu/hurd], opsys="linux",
  85. [irix*], opsys="irix",
  86. [cygwin*], opsys="cygwin",
  87. [mingw*], opsys="mingw",
  88. [msys*], opsys="msys")
  89. fi
  90. arch=`uname -m | tr ["[A-Z]" "[a-z]"]`
  91. AC_MSG_RESULT($opsys)
  92. ])