Debian Codegraph @

macros/ax_nagios_get_os

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