2e32329ae1cdc1791560be22bf0cdfde8919c082
[gnulib.git] / m4 / host-os.m4
1 #serial 5
2
3 # Copyright (C) 2001, 2003, 2004 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_CACHE_CHECK([host operating system],
16     gl_cv_host_operating_system,
17
18     [[case $host_os in
19
20        # These operating system names do not use the default heuristic below.
21        # They are in reverse order, so that more-specific prefixes come first.
22        winnt*)          os='Windows NT';;
23        vos*)            os='VOS';;
24        sysv*)           os='Unix System V';;
25        superux*)        os='SUPER-UX';;
26        sunos*)          os='SunOS';;
27        stop*)           os='STOP';;
28        sco*)            os='SCO Unix';;
29        riscos*)         os='RISC OS';;
30        riscix*)         os='RISCiX';;
31        qnx*)            os='QNX';;
32        pw32*)           os='PW32';;
33        ptx*)            os='ptx';;
34        plan9*)          os='Plan 9';;
35        osf*)            os='Tru64';;
36        os2*)            os='OS/2';;
37        openbsd*)        os='OpenBSD';;
38        nsk*)            os='NonStop Kernel';;
39        nonstopux*)      os='NonStop-UX';;
40        netbsd*-gnu*)    os='GNU/NetBSD';; # NetBSD kernel+libc, GNU userland
41        netbsd*)         os='NetBSD';;
42        knetbsd*-gnu)    os='GNU/kNetBSD';; # NetBSD kernel, GNU libc+userland
43        kfreebsd*-gnu)   os='GNU/kFreeBSD';; # FreeBSD kernel, GNU libc+userland
44        msdosdjgpp*)     os='DJGPP';;
45        mpeix*)          os='MPE/iX';;
46        mint*)           os='MiNT';;
47        mingw*)          os='MinGW';;
48        lynxos*)         os='LynxOS';;
49        linux*)          os='GNU/Linux';;
50        hpux*)           os='HP-UX';;
51        hiux*)           os='HI-UX';;
52        gnu*)            os='GNU';;
53        freebsd*)        os='FreeBSD';;
54        dgux*)           os='DG/UX';;
55        bsdi*)           os='BSD/OS';;
56        bsd*)            os='BSD';;
57        beos*)           os='BeOS';;
58        aux*)            os='A/UX';;
59        atheos*)         os='AtheOS';;
60        amigaos*)        os='Amiga OS';;
61        aix*)            os='AIX';;
62
63        # The default heuristic takes the initial alphabetic string
64        # from $host_os, but capitalizes its first letter.
65        [A-Za-z]*)
66          os=`
67            expr "X$host_os" : 'X\([A-Za-z]\)' | tr '[a-z]' '[A-Z]'
68          ``
69            expr "X$host_os" : 'X.\([A-Za-z]*\)'
70          `
71          ;;
72
73        # If $host_os does not start with an alphabetic string, use it unchanged.
74        *)
75          os=$host_os;;
76      esac
77      gl_cv_host_operating_system=$os]])
78   AC_DEFINE_UNQUOTED(HOST_OPERATING_SYSTEM,
79     "$gl_cv_host_operating_system",
80     [The host operating system.])
81 ])