3 # Copyright (C) 2001, 2003-2004, 2006, 2009-2020 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.
8 # Written by Paul Eggert.
12 # Define HOST_OPERATING_SYSTEM to a name for the host operating system.
13 AC_DEFUN([gl_HOST_OS],
15 AC_REQUIRE([AC_CANONICAL_HOST])dnl
16 AC_CACHE_CHECK([host operating system],
17 [gl_cv_host_operating_system],
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';;
25 sysv*) os='Unix System V';;
26 superux*) os='SUPER-UX';;
30 riscos*) os='RISC OS';;
31 riscix*) os='RISCiX';;
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';;
50 lynxos*) os='LynxOS';;
51 linux*) os='GNU/Linux';;
55 freebsd*) os='FreeBSD';;
61 atheos*) os='AtheOS';;
62 amigaos*) os='Amiga OS';;
65 # The default heuristic takes the initial alphabetic string
66 # from $host_os, but capitalizes its first letter.
69 expr "X$host_os" : 'X\([A-Za-z]\)' | LC_ALL=C tr '[a-z]' '[A-Z]'
71 expr "X$host_os" : 'X.\([A-Za-z]*\)'
75 # If $host_os does not start with an alphabetic string, use it unchanged.
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.])