File: configure.ac

package info (click to toggle)
time 1.9-0.1
  • links: PTS
  • area: main
  • in suites: bullseye, sid
  • size: 2,856 kB
  • sloc: ansic: 10,793; sh: 5,505; makefile: 63
file content (144 lines) | stat: -rw-r--r-- 3,766 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
dnl Process this file with autoconf to produce a configure script.

dnl Minimum Autoconf version required.
AC_PREREQ([2.69])

AC_INIT([GNU Time],
        m4_esyscmd([build-aux/git-version-gen .tarball-version]),
        [bug-time@gnu.org], [],
        [https://www.gnu.org/software/time/])

AC_CONFIG_SRCDIR([src/time.c])

dnl Must come before AM_INIT_AUTOMAKE.
AC_CONFIG_AUX_DIR([build-aux])

dnl Where to generate output; srcdir location.
AC_CONFIG_HEADERS([config.h:config.in])

AM_INIT_AUTOMAKE([
	1.11.1
	subdir-objects
	color-tests
	parallel-tests
])



dnl Checks for programs.
AC_USE_SYSTEM_EXTENSIONS
AC_PROG_CC_STDC
AM_PROG_CC_C_O
AC_PROG_CPP
AC_PROG_GCC_TRADITIONAL
AC_PROG_INSTALL
AC_C_INLINE

# Since we use gnulib: gl_EARLY must be called as soon as possible after
# the C compiler is checked.  The others could be later, but we just
# keep everything together.
gl_EARLY
gl_INIT

# Add extra compilation warnings. These will only apply to src/*.c not to
# any gnulib modules). See $(WARN_CFLAGS) in Makefile.am
gl_WARN_ADD([-Wall])
gl_WARN_ADD([-Wextra])
gl_WARN_ADD([-Wformat-security])
gl_WARN_ADD([-Wswitch-enum])
gl_WARN_ADD([-Wswitch-default])
gl_WARN_ADD([-Wformat-nonliteral])
gl_WARN_ADD([-Wunused-parameter])
gl_WARN_ADD([-Wfloat-equal])
gl_WARN_ADD([-fdiagnostics-show-option])
gl_WARN_ADD([-funit-at-a-time])
gl_WARN_ADD([-Wmissing-format-attribute])
gl_WARN_ADD([-Wstrict-overflow])
gl_WARN_ADD([-Wsuggest-attribute=const])
gl_WARN_ADD([-Wsuggest-attribute=pure])
AC_SUBST([WARN_CFLAGS])

dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(time.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SIGNAL

dnl Checks for library functions.
AC_FUNC_VPRINTF
AC_FUNC_WAIT3
AC_CHECK_FUNCS(strerror)


# What memory units are reported by getrusage(2) ?
warn_getrusage_mem_units=
if test -z "$time_getrusage_mem_units" ; then
  # if envvar 'time_getrusage_mem_units' isn't set,
  # autodetect based on OS.
  case "$host_os" in
    minix*|aix*|*bsd*|linux*|gnu*)
                     time_getrusage_mem_units=kb ;;

    macos*|darwin*)  time_getrusage_mem_units=bytes ;;

    solaris*)        time_getrusage_mem_units=pages ;;

    # As a fallback, assume KB (the most common value).
    # Set the 'warn' variable to warn the user at the end
    # of ./configure
    *) time_getrusage_mem_units=kb
       warn_getrusage_mem_units=yes
       ;;
  esac
fi

# Define the configuration item
case $time_getrusage_mem_units in
  kb)
     AC_DEFINE([GETRUSAGE_RETURNS_KB],[1],
                [Define to 1 if getrusage(2) on this systems returns
                 ru_maxrss in kilobytes])
     ;;

  bytes)
     AC_DEFINE([GETRUSAGE_RETURNS_BYTES],[1],
               [Define to 1 if getrusage(2) on this systems returns
                ru_maxrss in bytes])
     ;;

  pages)
     AC_DEFINE([GETRUSAGE_RETURNS_PAGES],[1],
               [Define to 1 if getrusage(2) on this systems returns
                ru_maxrss in pages])
     ;;

  *) # should never happen
     AC_MSG_ERROR([invalid 'time_getrusage_mem_units' value
                   '$time_getrusage_mem_units'])
     ;;
esac


# This is needed when building outside the source dir
# with --disable-dependency-tracking.
# Inspired by sed's https://bugs.gnu.org/25371
AS_MKDIR_P([lib])
AS_MKDIR_P([src])
AS_MKDIR_P([doc])
AS_MKDIR_P([tests])

AC_CONFIG_FILES([Makefile])
AC_OUTPUT

# Warn the user if getrusage(2) behaviour on this OS is unknown
if test "$warn_getrusage_mem_units" ; then
  AC_MSG_WARN([unknown getrusage behavior on operating system '$host_os'.
               Assuming Kilobytes.
               please report this with the output of 'uname -a' to
               bug-time@gnu.org])
fi