ax_nagios_get_os 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. AC_SUBST(opsys)
  44. AC_SUBST(arch)
  45. #
  46. # Get user hints
  47. #
  48. AC_MSG_CHECKING(what the operating system is )
  49. AC_ARG_WITH(opsys, AC_HELP_STRING([--with-opsys=OS],
  50. [specify operating system (linux, osx, bsd, solaris, irix, cygwin,
  51. aix, hp-ux, etc.)]),
  52. [
  53. #
  54. # Run this if --with was specified
  55. #
  56. if test "x$withval" = x -o x$withval = xno; then
  57. opsys_wanted=yes
  58. else
  59. opsys_wanted=no
  60. opsys="$withval"
  61. AC_MSG_RESULT($opsys)
  62. fi
  63. ], [
  64. #
  65. # Run this if --with was not specified
  66. #
  67. opsys_wanted=yes
  68. ])
  69. if test x$opsys = xno; then
  70. opsys=""
  71. opsys_wanted=yes
  72. elif test x$opsys = xyes; then
  73. AC_MSG_ERROR([you must enter an O/S type if '--with-opsys' is specified])
  74. fi
  75. #
  76. # Determine operating system if it wasn't supplied
  77. #
  78. if test $opsys_wanted=yes; then
  79. opsys=`uname -s | tr ["[A-Z]" "[a-z]"]`
  80. if test x"$opsys" = "x"; then opsys="unknown"; fi
  81. AS_CASE([$opsys],
  82. [darwin*], opsys="osx",
  83. [*bsd*], opsys="bsd",
  84. [dragonfly], opsys="bsd",
  85. [sunos], opsys="solaris",
  86. [gnu/hurd], opsys="linux",
  87. [irix*], opsys="irix",
  88. [cygwin*], opsys="cygwin",
  89. [mingw*], opsys="mingw",
  90. [msys*], opsys="msys")
  91. fi
  92. arch=`uname -m | tr ["[A-Z]" "[a-z]"]`
  93. AC_MSG_RESULT($opsys)
  94. ])