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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
# Process this file with autoconf to produce a configure script.
#
# Copyright (C) 2013, 2017, 2019, 2021, 2022 P. J. McDermott
#
# This file is part of @
#
# @ is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# @ is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with @. If not, see <http://www.gnu.org/licenses/>.
AC_INIT([@], [1.0.0], [mailto:pj@pehjota.net], [atsign])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([src/main.c])
AM_INIT_AUTOMAKE([gnu check-news dist-bzip2 dist-xz subdir-objects])
AM_SILENT_RULES([yes])
AM_CONDITIONAL([IN_GIT],
[test -d "${srcdir}/.git" && command -v git >/dev/null 2>&1])
AM_CONDITIONAL([OUT_OF_TREE], [test x"${srcdir}" != x'.' ])
AM_CONDITIONAL([CROSS_COMPILING], [! test x"${build_alias}" = x"${host_alias}"])
GETTEXT_PACKAGE="${PACKAGE}"
AC_SUBST([GETTEXT_PACKAGE])
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["${GETTEXT_PACKAGE}"],
[Define the gettext package to be used.])
AM_GNU_GETTEXT([external])
save_CFLAGS="${CFLAGS-}"
AC_PROG_CC()
AM_PROG_CC_C_O()
test -d "${srcdir}/.git" || CFLAGS="${save_CFLAGS}"
funcs_missing=false
AC_CHECK_FUNCS(
[\
calloc difftime fprintf fputs free isspace localtime mktime \
printf realloc setvbuf sleep strerror strlen strftime strptime \
time
],
[],
[funcs_missing=true])
AC_CHECK_FUNCS(
[getopt_long],
[],
[
AC_CHECK_FUNCS([getopt], [], [funcs_missing=true])
])
if ${funcs_missing}; then
AC_MSG_ERROR([required functions are missing])
fi
AC_PROG_LN_S()
AC_ARG_ENABLE([symlink],
[AS_HELP_STRING([--disable-symlink],
[don't install \`@' symbolic link])],
[case "${enableval}" in yes|no) symlink=${enableval};;
*) AC_MSG_ERROR(
[bad value ${enableval} for symlink option]);;
esac],
[symlink=yes]
)
AM_CONDITIONAL([ENABLE_SYMLINK], [test x"${symlink}" = x'yes'])
AC_ARG_ENABLE([tests],
[AS_HELP_STRING([--disable-tests],
[exclude test suite support from executable])],
[case "${enableval}" in yes|no) tests=${enableval};;
*) AC_MSG_ERROR(
[bad value ${enableval} for tests option]);;
esac],
[tests=yes]
)
if test x"${tests}" = x'yes'; then
AC_DEFINE([ENABLE_TESTS], [1],
[Define to 1 to include test suite support])
AC_CHECK_FUNCS(
[sscanf],
[],
[AC_MSG_ERROR([required functions are missing])])
else
AC_DEFINE([ENABLE_TESTS], [0],
[Define to 1 to include test suite support])
fi
AM_CONDITIONAL([ENABLE_TESTS], [test x"${tests}" = x'yes'])
AX_CFLAGS_WARN_ALL() dnl Adds -Wall or equivalent
AX_CHECK_COMPILE_FLAG([-Wpedantic], [AX_APPEND_FLAG([-Wpedantic])])
AX_CHECK_COMPILE_FLAG([-Wextra], [AX_APPEND_FLAG([-Wextra])])
AC_ARG_ENABLE([gcc-warnings],
[AS_HELP_STRING([--enable-gcc-warnings], [turn on many GCC warnings])],
[case "${enableval}" in yes|no) gcc_warnings=${enableval};;
*) AC_MSG_ERROR(
[bad value ${enableval} for gcc-warnings option]);;
esac],
[
gcc_warnings=no
test -d "${srcdir}/.git" && gcc_warnings=yes
]
)
if test "x${gcc_warnings}" = 'xyes'; then
nowarns=''
nowarns="${nowarns} -Wsystem-headers"
gl_MANYWARN_ALL_GCC([warns])
gl_MANYWARN_COMPLEMENT([warns], [${warns}], [${nowarns}])
for warn in ${warns}; do
gl_WARN_ADD([${warn}])
done
AC_SUBST([WARN_CFLAGS])
fi
AX_CHECK_COMPILE_FLAG([-fdiagnostics-color=auto],
[AX_APPEND_FLAG([-fdiagnostics-color=auto])])
AC_ARG_ENABLE([address-sanitization],
[AS_HELP_STRING([--enable-address-sanitization],
[turn on AddressSanitizer (if available)])],
[case "${enableval}" in yes|no) address_sanitization=${enableval};;
*) AC_MSG_ERROR(
[bad value ${enableval} for address-sanitization option]
);;
esac],
[
address_sanitization=no
gl_GCC_VERSION_IFELSE([4], [8],
[test -d "${srcdir}/.git" && address_sanitization=yes])
]
)
if test "x${address_sanitization}" = 'xyes'; then
AX_CHECK_COMPILE_FLAG([-fsanitize=address],
[AX_APPEND_FLAG([-fsanitize=address], [ASAN_CFLAGS])])
AX_CHECK_COMPILE_FLAG([-fno-omit-frame-pointer],
[AX_APPEND_FLAG([-fno-omit-frame-pointer], [ASAN_CFLAGS])])
AC_SUBST([ASAN_CFLAGS])
fi
if ! test -d "${srcdir}/.git"; then
AX_CHECK_COMPILE_FLAG([-s], [AX_APPEND_FLAG([-s])])
fi
for flag in -Os -fno-unwind-tables -fno-asynchronous-unwind-tables \
-ffunction-sections -fdata-sections -Wl,--gc-sections \
-fstack-protector-strong -flto \
-Wl,-z,now -Wl,--hash-style=sysv -Wl,--build-id=none; do
AX_CHECK_COMPILE_FLAG([${flag}], [AX_APPEND_FLAG([${flag}])])
done
AC_CONFIG_FILES([Makefile po/Makefile.in])
AC_CONFIG_HEADERS([config.h])
AC_OUTPUT()
|