NEWS.stable: log cherry-pick [e446f25]->[c092018] relocatable-shell: Update suggested...
[gnulib.git] / m4 / host-os.m4
1 # serial 9
2
3 # Copyright (C) 2001, 2003-2004, 2006, 2009-2014 Free Software Foundation, Inc.
4 # This file is free software; the Free Software Foundation
5 # gives unlimited permission to copy and/or distribute it,
6 # with or without modifications, as long as this notice is preserved.
7
8 # Written by Paul Eggert.
9
10 dnl From Paul Eggert.
11
12 # Define HOST_OPERATING_SYSTEM to a name for the host operating system.
13 AC_DEFUN([gl_HOST_OS],
14 [
15   AC_REQUIRE([AC_CANONICAL_HOST])dnl
16   AC_CACHE_CHECK([host operating system],
17     gl_cv_host_operating_system,
18
19     [[case $host_os in
20
21        # These operating system names do not use the default heuristic below.
22        # They are in reverse order, so that more-specific prefixes come first.
23        winnt*)          os='Windows NT';;
24        vos*)            os='VOS';;
25        sysv*)           os='Unix System V';;
26        superux*)        os='SUPER-UX';;
27        sunos*)          os='SunOS';;
28        stop*)           os='STOP';;
29        sco*)            os='SCO Unix';;
30        riscos*)         os='RISC OS';;
31        riscix*)         os='RISCiX';;
32        qnx*)            os='QNX';;
33        pw32*)           os='PW32';;
34        ptx*)            os='ptx';;
35        plan9*)          os='Plan 9';;
36        osf*)            os='Tru64';;
37        os2*)            os='OS/2';;
38        openbsd*)        os='OpenBSD';;
39        nsk*)            os='NonStop Kernel';;
40        nonstopux*)      os='NonStop-UX';;
41        netbsd*-gnu*)    os='GNU/NetBSD';; # NetBSD kernel+libc, GNU userland
42        netbsd*)         os='NetBSD';;
43        mirbsd*)         os='MirBSD';;
44        knetbsd*-gnu)    os='GNU/kNetBSD';; # NetBSD kernel, GNU libc+userland
45        kfreebsd*-gnu)   os='GNU/kFreeBSD';; # FreeBSD kernel, GNU libc+userland
46        msdosdjgpp*)     os='DJGPP';;
47        mpeix*)          os='MPE/iX';;
48        mint*)           os='MiNT';;
49        mingw*)          os='MinGW';;
50        lynxos*)         os='LynxOS';;
51        linux*)          os='GNU/Linux';;
52        hpux*)           os='HP-UX';;
53        hiux*)           os='HI-UX';;
54        gnu*)            os='GNU';;
55        freebsd*)        os='FreeBSD';;
56        dgux*)           os='DG/UX';;
57        bsdi*)           os='BSD/OS';;
58        bsd*)            os='BSD';;
59        beos*)           os='BeOS';;
60        aux*)            os='A/UX';;
61        atheos*)         os='AtheOS';;
62        amigaos*)        os='Amiga OS';;
63        aix*)            os='AIX';;
64
65        # The default heuristic takes the initial alphabetic string
66        # from $host_os, but capitalizes its first letter.
67        [A-Za-z]*)
68          os=`
69            expr "X$host_os" : 'X\([A-Za-z]\)' | LC_ALL=C tr '[a-z]' '[A-Z]'
70          ``
71            expr "X$host_os" : 'X.\([A-Za-z]*\)'
72          `
73          ;;
74
75        # If $host_os does not start with an alphabetic string, use it unchanged.
76        *)
77          os=$host_os;;
78      esac
79      gl_cv_host_operating_system=$os]])
80   AC_DEFINE_UNQUOTED([HOST_OPERATING_SYSTEM],
81     "$gl_cv_host_operating_system",
82     [The host operating system.])
83 ])