84b781f85ec96e66ac4875e63daddb7270562f1d
[gnulib.git] / m4 / sys_utsname_h.m4
1 # sys_utsname_h.m4 serial 2
2 dnl Copyright (C) 2009 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
6
7 dnl Written by Bruno Haible.
8
9 AC_DEFUN([gl_SYS_UTSNAME_H],
10 [
11   dnl Use AC_REQUIRE here, so that the default behavior below is expanded
12   dnl once only, before all statements that occur in other macros.
13   AC_REQUIRE([gl_SYS_UTSNAME_H_DEFAULTS])
14
15   gl_CHECK_NEXT_HEADERS([sys/utsname.h])
16   AC_CHECK_HEADERS_ONCE([sys/utsname.h])
17   if test $ac_cv_header_sys_utsname_h != yes; then
18     SYS_UTSNAME_H='sys/utsname.h'
19     HAVE_SYS_UTSNAME_H=0
20     HAVE_STRUCT_UTSNAME=0
21   else
22     HAVE_SYS_UTSNAME_H=1
23     AC_CHECK_TYPES([struct utsname], [], [HAVE_STRUCT_UTSNAME=0], [[
24 #include <sys/utsname.h>
25       ]])
26   fi
27   AC_SUBST([HAVE_SYS_UTSNAME_H])
28 ])
29
30 AC_DEFUN([gl_SYS_UTSNAME_MODULE_INDICATOR],
31 [
32   dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
33   AC_REQUIRE([gl_SYS_UTSNAME_H_DEFAULTS])
34   GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
35 ])
36
37 AC_DEFUN([gl_SYS_UTSNAME_H_DEFAULTS],
38 [
39   GNULIB_UNAME=0;         AC_SUBST([GNULIB_UNAME])
40   dnl Assume proper GNU behavior unless another module says otherwise.
41   HAVE_UNAME=1;           AC_SUBST([HAVE_UNAME])
42   HAVE_STRUCT_UTSNAME=1;  AC_SUBST([HAVE_STRUCT_UTSNAME])
43   SYS_UTSNAME_H='';       AC_SUBST([SYS_UTSNAME_H])
44 ])