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