1 dd038bc6 2021-09-21 thomas.ad # Process this file with autoconf to produce a configure script.
3 dd038bc6 2021-09-21 thomas.ad AC_PREREQ([2.69])
4 598139dd 2022-07-22 thomas AC_INIT([got-portable],
5 4b553fec 2022-08-20 thomas m4_esyscmd_s(util/got-portable-ver.sh),
6 598139dd 2022-07-22 thomas [thomas@xteddy.org])
7 dd038bc6 2021-09-21 thomas.ad AC_CONFIG_AUX_DIR(etc)
8 dd038bc6 2021-09-21 thomas.ad AC_CONFIG_SRCDIR([lib/rcsutil.h])
9 dd038bc6 2021-09-21 thomas.ad AM_INIT_AUTOMAKE([foreign subdir-objects])
11 47dc83f5 2023-03-08 thomas AC_CONFIG_HEADERS([include/got_compat.h])
13 4fccd2fe 2023-03-08 thomas AC_DEFINE_UNQUOTED(VERSION, $VERSION)
14 dd038bc6 2021-09-21 thomas.ad AC_SUBST(VERSION)
15 dd038bc6 2021-09-21 thomas.ad AC_SUBST(GOT_RELEASE)
17 4fccd2fe 2023-03-08 thomas AC_DEFINE_UNQUOTED([GOT_VERSION], VERSION, [GoT version string])
18 4fccd2fe 2023-03-08 thomas AC_DEFINE_UNQUOTED([GOT_VERSION_NUMBER], VERSION, [Got version number])
20 4859aafd 2022-11-05 thomas AC_USE_SYSTEM_EXTENSIONS
21 dd038bc6 2021-09-21 thomas.ad AC_CANONICAL_HOST
23 9981e8e3 2023-01-19 thomas AC_CONFIG_SUBDIRS([template])
25 dd038bc6 2021-09-21 thomas.ad # When CFLAGS isn't set at this stage and gcc is detected by the macro below,
26 dd038bc6 2021-09-21 thomas.ad # autoconf will automatically use CFLAGS="-O2 -g". Prevent that by using an
27 dd038bc6 2021-09-21 thomas.ad # empty default.
28 dd038bc6 2021-09-21 thomas.ad : ${CFLAGS=""}
30 dd038bc6 2021-09-21 thomas.ad # Save user CPPFLAGS, CFLAGS and LDFLAGS. We need to change them because
31 dd038bc6 2021-09-21 thomas.ad # AC_CHECK_HEADER doesn't give us any other way to update the include
32 dd038bc6 2021-09-21 thomas.ad # paths. But for Makefile.am we want to use AM_CPPFLAGS and friends.
33 dd038bc6 2021-09-21 thomas.ad SAVED_CFLAGS="$CFLAGS"
34 dd038bc6 2021-09-21 thomas.ad SAVED_CPPFLAGS="$CPPFLAGS"
35 dd038bc6 2021-09-21 thomas.ad SAVED_LDFLAGS="$LDFLAGS"
37 b29d689b 2023-02-11 thomas # YACC override
38 b29d689b 2023-02-11 thomas YACC_OVERRIDE="yes"
40 dd038bc6 2021-09-21 thomas.ad # Checks for programs.
41 dd038bc6 2021-09-21 thomas.ad AC_PROG_CC
42 dd038bc6 2021-09-21 thomas.ad AC_PROG_CPP
43 dd038bc6 2021-09-21 thomas.ad AC_PROG_INSTALL
44 dd038bc6 2021-09-21 thomas.ad AC_PROG_LN_S
45 dd038bc6 2021-09-21 thomas.ad AC_PROG_MAKE_SET
46 b29d689b 2023-02-11 thomas if test -z "$YACC"; then
47 b29d689b 2023-02-11 thomas YACC_OVERRIDE="no"
48 dd038bc6 2021-09-21 thomas.ad AC_PROG_YACC
50 47e5cb11 2022-11-05 thomas AM_PROG_AR
51 dd038bc6 2021-09-21 thomas.ad AC_PROG_RANLIB
52 dd038bc6 2021-09-21 thomas.ad PKG_PROG_PKG_CONFIG
54 b29d689b 2023-02-11 thomas if test "$YACC_OVERRIDE" = "yes"; then
55 b29d689b 2023-02-11 thomas AC_MSG_NOTICE("Using YACC set from environment: $YACC")
58 dd038bc6 2021-09-21 thomas.ad # Checks for header files.
59 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADERS([ \
60 dd038bc6 2021-09-21 thomas.ad fcntl.h \
61 dd038bc6 2021-09-21 thomas.ad langinfo.h \
62 d9b944c7 2023-03-08 thomas libutil.h \
63 dd038bc6 2021-09-21 thomas.ad limits.h \
64 97799ccd 2022-02-06 thomas linux/landlock.h \
65 dd038bc6 2021-09-21 thomas.ad locale.h \
66 dd038bc6 2021-09-21 thomas.ad netdb.h \
67 dd038bc6 2021-09-21 thomas.ad netinet/in.h \
68 dd038bc6 2021-09-21 thomas.ad paths.h \
73 98670ba7 2023-02-23 thomas sha256.h \
74 dd038bc6 2021-09-21 thomas.ad stddef.h \
75 dd038bc6 2021-09-21 thomas.ad stdint.h \
76 dd038bc6 2021-09-21 thomas.ad stdlib.h \
77 dd038bc6 2021-09-21 thomas.ad string.h \
78 dd038bc6 2021-09-21 thomas.ad sys/ioctl.h \
79 dd038bc6 2021-09-21 thomas.ad sys/param.h \
80 d24ddaa6 2022-02-26 thomas sys/poll.h \
81 19467d59 2022-07-16 thomas sys/queue.h \
82 d9b944c7 2023-03-08 thomas sys/select.h \
83 dd038bc6 2021-09-21 thomas.ad sys/socket.h \
84 dd038bc6 2021-09-21 thomas.ad sys/time.h \
85 dd038bc6 2021-09-21 thomas.ad sys/tree.h \
86 dd038bc6 2021-09-21 thomas.ad util.h \
87 dd038bc6 2021-09-21 thomas.ad unistd.h \
88 dd038bc6 2021-09-21 thomas.ad wchar.h \
91 d9b944c7 2023-03-08 thomas AC_HEADER_DIRENT
92 d9b944c7 2023-03-08 thomas AC_CHECK_DECL([F_CLOSEM],
93 d9b944c7 2023-03-08 thomas HAVE_FCNTL_CLOSEM
94 d9b944c7 2023-03-08 thomas AC_DEFINE([HAVE_FCNTL_CLOSEM], [1],
95 d9b944c7 2023-03-08 thomas [Use F_CLOSEM fcntl for closefrom]),
97 d9b944c7 2023-03-08 thomas [#include <limits.h>
98 d9b944c7 2023-03-08 thomas #include <fcntl.h>
102 d9b944c7 2023-03-08 thomas AC_MSG_CHECKING([for /proc/pid/fd directory])
103 d9b944c7 2023-03-08 thomas if test -d "/proc/$$/fd" ; then
104 d9b944c7 2023-03-08 thomas AC_DEFINE([HAVE_PROC_PID], [1], [Define if you have /proc/$pid/fd])
105 d9b944c7 2023-03-08 thomas AC_MSG_RESULT([yes])
107 d9b944c7 2023-03-08 thomas AC_MSG_RESULT([no])
110 d9b944c7 2023-03-08 thomas AC_MSG_CHECKING([whether program_invocation_short_name is defined])
111 d9b944c7 2023-03-08 thomas AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
112 d9b944c7 2023-03-08 thomas #include <argp.h>
114 d9b944c7 2023-03-08 thomas program_invocation_short_name = "test";
116 d9b944c7 2023-03-08 thomas AC_MSG_RESULT([yes])
117 d9b944c7 2023-03-08 thomas AC_DEFINE([HAVE_PROGRAM_INVOCATION_SHORT_NAME], [1],
118 d9b944c7 2023-03-08 thomas [Define if program_invocation_short_name is defined])
120 d9b944c7 2023-03-08 thomas AC_MSG_RESULT([no])
123 d9b944c7 2023-03-08 thomas # Look for prctl(PR_SET_NAME).
124 d9b944c7 2023-03-08 thomas AC_CHECK_DECL(
125 d9b944c7 2023-03-08 thomas [PR_SET_NAME],
126 d9b944c7 2023-03-08 thomas [AC_DEFINE([HAVE_PR_SET_NAME], [1], [Define if PR_SET_NAME is defined])],
128 d9b944c7 2023-03-08 thomas [#include <sys/prctl.h>]
131 d9b944c7 2023-03-08 thomas AM_CONDITIONAL([HAVE_SHA2], [test "x$ac_cv_header_sha2_h" = xyes])
133 d9b944c7 2023-03-08 thomas AC_CHECK_MEMBERS([struct pollfd.fd], [], [], [[
134 d9b944c7 2023-03-08 thomas #include <sys/types.h>
135 d9b944c7 2023-03-08 thomas #ifdef HAVE_POLL_H
136 d9b944c7 2023-03-08 thomas #include <poll.h>
138 d9b944c7 2023-03-08 thomas #ifdef HAVE_SYS_POLL_H
139 d9b944c7 2023-03-08 thomas #include <sys/poll.h>
143 dd038bc6 2021-09-21 thomas.ad # Checks for typ edefs, structures, and compiler characteristics.
144 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADER_STDBOOL
145 dd038bc6 2021-09-21 thomas.ad AC_C_INLINE
146 dd038bc6 2021-09-21 thomas.ad AC_TYPE_INT64_T
147 dd038bc6 2021-09-21 thomas.ad AC_TYPE_MODE_T
148 dd038bc6 2021-09-21 thomas.ad AC_TYPE_OFF_T
149 dd038bc6 2021-09-21 thomas.ad AC_TYPE_PID_T
150 dd038bc6 2021-09-21 thomas.ad AC_TYPE_SIZE_T
151 dd038bc6 2021-09-21 thomas.ad AC_TYPE_SSIZE_T
152 dd038bc6 2021-09-21 thomas.ad AC_TYPE_UINT16_T
153 dd038bc6 2021-09-21 thomas.ad AC_TYPE_UINT32_T
154 dd038bc6 2021-09-21 thomas.ad AC_TYPE_UINT64_T
155 dd038bc6 2021-09-21 thomas.ad AC_TYPE_UINT8_T
157 ff36aeea 2022-07-16 thomas # Check for ifgroupreq which is only available on BSD.
158 ff36aeea 2022-07-16 thomas AC_CHECK_TYPES([struct ifgroupreq])
160 75716fd6 2022-08-27 thomas # Check for sockaddr_storage. On some systems, ss_len is filled out, although
161 75716fd6 2022-08-27 thomas # this is not mandated by POSIX, and hence systems such as linux, don't have
163 75716fd6 2022-08-27 thomas AC_CHECK_TYPES([struct sockaddr_storage], [], [], [
164 75716fd6 2022-08-27 thomas #include <sys/types.h>
165 75716fd6 2022-08-27 thomas #include <sys/socket.h>
168 75716fd6 2022-08-27 thomas # Same thing as sockaddr_storage above, only now check if the member exists in
169 75716fd6 2022-08-27 thomas # the struct as well.
170 75716fd6 2022-08-27 thomas AC_CHECK_MEMBERS([struct sockaddr_storage.ss_len], , ,
171 75716fd6 2022-08-27 thomas [ #include <netdb.h>
172 75716fd6 2022-08-27 thomas #include <netinet/in.h>
173 75716fd6 2022-08-27 thomas #include <sys/socket.h> ]
176 75716fd6 2022-08-27 thomas AC_CHECK_MEMBERS([struct sockaddr.sa_len], , ,
177 75716fd6 2022-08-27 thomas [ #include <netdb.h>
178 75716fd6 2022-08-27 thomas #include <netinet/in.h>
179 75716fd6 2022-08-27 thomas #include <sys/socket.h> ]
182 75716fd6 2022-08-27 thomas # Both checks above will result in:
184 75716fd6 2022-08-27 thomas # HAVE_STRUCT_SOCKADDR_AS_LEN
187 75716fd6 2022-08-27 thomas # Either being defined or not.
189 dd038bc6 2021-09-21 thomas.ad # Look for library needed for flock.
190 dd038bc6 2021-09-21 thomas.ad AC_SEARCH_LIBS(flock, bsd)
192 dd038bc6 2021-09-21 thomas.ad # Checks for library functions.
193 dd038bc6 2021-09-21 thomas.ad AC_FUNC_FORK
194 dd038bc6 2021-09-21 thomas.ad AC_FUNC_FSEEKO
195 dd038bc6 2021-09-21 thomas.ad AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
196 dd038bc6 2021-09-21 thomas.ad AC_FUNC_MALLOC
197 dd038bc6 2021-09-21 thomas.ad AC_FUNC_MMAP
198 dd038bc6 2021-09-21 thomas.ad AC_FUNC_REALLOC
199 dd038bc6 2021-09-21 thomas.ad AC_FUNC_STRERROR_R
200 dd038bc6 2021-09-21 thomas.ad AC_FUNC_STRNLEN
201 dd038bc6 2021-09-21 thomas.ad AC_CHECK_FUNCS([ \
202 dd038bc6 2021-09-21 thomas.ad dup2 \
203 dd038bc6 2021-09-21 thomas.ad flock \
204 dd038bc6 2021-09-21 thomas.ad getcwd \
205 dd038bc6 2021-09-21 thomas.ad localtime_r \
206 dd038bc6 2021-09-21 thomas.ad memchr \
207 dd038bc6 2021-09-21 thomas.ad memmove \
208 dd038bc6 2021-09-21 thomas.ad memset \
209 4fccd2fe 2023-03-08 thomas mergesort \
210 dd038bc6 2021-09-21 thomas.ad mkdir \
211 dd038bc6 2021-09-21 thomas.ad munmap \
212 dd038bc6 2021-09-21 thomas.ad nl_langinfo \
213 dd038bc6 2021-09-21 thomas.ad realpath \
214 dd038bc6 2021-09-21 thomas.ad regcomp \
215 dd038bc6 2021-09-21 thomas.ad rmdir \
216 dd038bc6 2021-09-21 thomas.ad setlocale \
217 dd038bc6 2021-09-21 thomas.ad socket \
218 683ec58e 2022-07-16 thomas setresgid \
219 683ec58e 2022-07-16 thomas setresuid \
220 c4e2e0d0 2022-07-16 thomas setproctitle \
221 dd038bc6 2021-09-21 thomas.ad strcasecmp \
222 dd038bc6 2021-09-21 thomas.ad strchr \
223 dd038bc6 2021-09-21 thomas.ad strcspn \
224 dd038bc6 2021-09-21 thomas.ad strdup \
225 dd038bc6 2021-09-21 thomas.ad strerror \
226 dd038bc6 2021-09-21 thomas.ad strncasecmp \
227 dd038bc6 2021-09-21 thomas.ad strndup \
228 dd038bc6 2021-09-21 thomas.ad strrchr \
229 dd038bc6 2021-09-21 thomas.ad strspn \
230 dd038bc6 2021-09-21 thomas.ad strstr \
231 dd038bc6 2021-09-21 thomas.ad strtol \
232 dd038bc6 2021-09-21 thomas.ad strtoul \
233 d9b944c7 2023-03-08 thomas sysconf \
234 dd038bc6 2021-09-21 thomas.ad wcwidth \
237 c4e2e0d0 2022-07-16 thomas AM_CONDITIONAL([HAVE_SETPROCTITLE], [test "x$ac_cv_func_setproctitle" = xyes])
239 d9b944c7 2023-03-08 thomas if test "x$ac_cv_func_sysconf" = xyes; then
240 d9b944c7 2023-03-08 thomas AC_DEFINE([HAVE_SYSCONF], [1], [Define to 1 if sysconf() present])
243 ddd12270 2022-04-22 thomas # Siphash support.
244 ddd12270 2022-04-22 thomas AC_CHECK_FUNCS([SipHash])
245 ddd12270 2022-04-22 thomas AM_CONDITIONAL([HAVE_SIPHASH], [test "x$ac_cv_func_SipHash" = xyes])
247 dd038bc6 2021-09-21 thomas.ad # Check for functions with a compatibility implementation.
248 dd038bc6 2021-09-21 thomas.ad AC_REPLACE_FUNCS([ \
249 dd038bc6 2021-09-21 thomas.ad asprintf \
250 dd038bc6 2021-09-21 thomas.ad closefrom \
251 dd038bc6 2021-09-21 thomas.ad explicit_bzero \
252 dd038bc6 2021-09-21 thomas.ad fmt_scaled \
253 dd038bc6 2021-09-21 thomas.ad freezero \
254 dd038bc6 2021-09-21 thomas.ad getdtablecount \
255 dd038bc6 2021-09-21 thomas.ad getline \
256 dd038bc6 2021-09-21 thomas.ad getprogname \
257 dd038bc6 2021-09-21 thomas.ad recallocarray \
258 dd038bc6 2021-09-21 thomas.ad reallocarray \
259 dd038bc6 2021-09-21 thomas.ad strlcat \
260 dd038bc6 2021-09-21 thomas.ad strlcpy \
261 dd038bc6 2021-09-21 thomas.ad strndup \
262 d9b944c7 2023-03-08 thomas strnlen \
263 dd038bc6 2021-09-21 thomas.ad strsep \
264 dd038bc6 2021-09-21 thomas.ad strtonum \
266 4fccd2fe 2023-03-08 thomas AM_CONDITIONAL([HAVE_CLOSEFROM], [test "x$ac_cv_func_closefrom" = xyes])
268 dd038bc6 2021-09-21 thomas.ad # Always use our getopt because 1) glibc's doesn't enforce argument order 2)
269 dd038bc6 2021-09-21 thomas.ad # musl does not set optarg to NULL for flags without arguments (although it is
270 dd038bc6 2021-09-21 thomas.ad # not required to, but it is helpful) 3) there are probably other weird
271 dd038bc6 2021-09-21 thomas.ad # implementations.
272 dd038bc6 2021-09-21 thomas.ad AC_LIBOBJ(getopt)
274 206be139 2023-03-08 thomas # Check for b64_ntop. If we have b64_ntop, we assume b64_pton as well.
275 206be139 2023-03-08 thomas AC_MSG_CHECKING(for b64_ntop)
276 206be139 2023-03-08 thomas AC_LINK_IFELSE([AC_LANG_PROGRAM(
278 206be139 2023-03-08 thomas #include <sys/types.h>
279 206be139 2023-03-08 thomas #include <netinet/in.h>
280 206be139 2023-03-08 thomas #include <resolv.h>
283 206be139 2023-03-08 thomas b64_ntop(NULL, 0, NULL, 0);
285 206be139 2023-03-08 thomas found_b64_ntop=yes,
286 206be139 2023-03-08 thomas found_b64_ntop=no
288 206be139 2023-03-08 thomas AC_MSG_RESULT($found_b64_ntop)
289 206be139 2023-03-08 thomas libresolv_LIBS=""
290 206be139 2023-03-08 thomas if test "x$found_b64_ntop" = xno; then
291 206be139 2023-03-08 thomas AC_MSG_CHECKING(for b64_ntop with -lresolv)
292 206be139 2023-03-08 thomas LIBS="-lresolv"
293 206be139 2023-03-08 thomas AC_LINK_IFELSE([AC_LANG_PROGRAM(
295 206be139 2023-03-08 thomas #include <sys/types.h>
296 206be139 2023-03-08 thomas #include <netinet/in.h>
297 206be139 2023-03-08 thomas #include <resolv.h>
300 206be139 2023-03-08 thomas b64_ntop(NULL, 0, NULL, 0);
302 206be139 2023-03-08 thomas found_b64_ntop=yes,
303 206be139 2023-03-08 thomas found_b64_ntop=no
305 206be139 2023-03-08 thomas AC_MSG_RESULT($found_b64_ntop)
306 206be139 2023-03-08 thomas libresolv_LIBS="$LIBS"
308 206be139 2023-03-08 thomas if test "x$found_b64_ntop" = xno; then
309 206be139 2023-03-08 thomas AC_MSG_CHECKING(for b64_ntop with -lnetwork)
310 206be139 2023-03-08 thomas LIBS="-lresolv -lnetwork"
311 206be139 2023-03-08 thomas AC_LINK_IFELSE([AC_LANG_PROGRAM(
313 206be139 2023-03-08 thomas #include <sys/types.h>
314 206be139 2023-03-08 thomas #include <netinet/in.h>
315 206be139 2023-03-08 thomas #include <resolv.h>
318 206be139 2023-03-08 thomas b64_ntop(NULL, 0, NULL, 0);
320 206be139 2023-03-08 thomas found_b64_ntop=yes,
321 206be139 2023-03-08 thomas found_b64_ntop=no
323 206be139 2023-03-08 thomas AC_MSG_RESULT($found_b64_ntop)
324 206be139 2023-03-08 thomas libresolv_LIBS="$LIBS"
327 206be139 2023-03-08 thomas AM_CONDITIONAL([HAVE_B64], [test "x$found_b64_ntop" = xyes])
328 206be139 2023-03-08 thomas if test "x$found_b64_ntop" = xyes; then
329 206be139 2023-03-08 thomas AC_DEFINE([HAVE_B64_NTOP], [1], [define if b64_ntop is present])
330 206be139 2023-03-08 thomas AC_SUBST(libresolv_LIBS)
332 206be139 2023-03-08 thomas AC_LIBOBJ(base64)
335 92a9e85d 2021-09-24 thomas # Check the platform we're compiling on.
336 92a9e85d 2021-09-24 thomas AC_MSG_CHECKING(platform)
337 92a9e85d 2021-09-24 thomas case "$host_os" in
339 92a9e85d 2021-09-24 thomas AC_MSG_RESULT(linux)
340 92a9e85d 2021-09-24 thomas PLATFORM=linux
342 92a9e85d 2021-09-24 thomas *freebsd*)
343 92a9e85d 2021-09-24 thomas AC_MSG_RESULT(freebsd)
344 92a9e85d 2021-09-24 thomas PLATFORM=freebsd
346 d24ddaa6 2022-02-26 thomas *darwin*)
347 d24ddaa6 2022-02-26 thomas AC_MSG_RESULT(darwin)
348 d24ddaa6 2022-02-26 thomas PLATFORM=darwin
350 a3732bb6 2022-02-26 thomas *netbsd*)
351 a3732bb6 2022-02-26 thomas AC_MSG_RESULT(netbsd)
352 a3732bb6 2022-02-26 thomas PLATFORM=netbsd
354 01a22331 2023-02-26 thomas *openbsd*)
355 398ba35f 2023-02-26 thomas AC_MSG_RESULT(openbsd)
356 01a22331 2023-02-26 thomas PLATFORM=openbsd
358 b26177ad 2022-03-03 thomas *dragonfly*)
359 b26177ad 2022-03-03 thomas AC_MSG_RESULT(dragonfly)
360 b26177ad 2022-03-03 thomas PLATFORM=dragonflybsd
363 92a9e85d 2021-09-24 thomas AC_MSG_RESULT(unknown)
364 92a9e85d 2021-09-24 thomas PLATFORM=unknown
367 92a9e85d 2021-09-24 thomas AC_SUBST(PLATFORM)
368 92a9e85d 2021-09-24 thomas AM_CONDITIONAL([HOST_FREEBSD], [test "$PLATFORM" = "freebsd"])
369 92a9e85d 2021-09-24 thomas AM_CONDITIONAL([HOST_LINUX], [test "$PLATFORM" = "linux"])
370 d24ddaa6 2022-02-26 thomas AM_CONDITIONAL([HOST_DARWIN], [test "$PLATFORM" = "darwin"])
371 a3732bb6 2022-02-26 thomas AM_CONDITIONAL([HOST_NETBSD], [test "$PLATFORM" = "netbsd"])
372 01a22331 2023-02-26 thomas AM_CONDITIONAL([HOST_OPENBSD], [test "$PLATFORM" = "openbsd"])
373 b26177ad 2022-03-03 thomas AM_CONDITIONAL([HOST_DRAGONFLYBSD], [test "$PLATFORM" = "dragonflybsd"])
375 8cff5e95 2023-03-08 thomas # On OpenBSD, these functions are already defined, yet looking for them in
376 8cff5e95 2023-03-08 thomas # this way on OpenBSD breaks <sha2.h> inclusion.
377 8cff5e95 2023-03-08 thomas # FIXME: this needs addressing.
378 8cff5e95 2023-03-08 thomas if test "x$PLATFORM" != "xopenbsd"; then
379 8cff5e95 2023-03-08 thomas AC_CHECK_FUNCS([ \
380 8cff5e95 2023-03-08 thomas SHA256Update \
381 8cff5e95 2023-03-08 thomas SHA384Update \
382 8cff5e95 2023-03-08 thomas SHA512Update \
386 b29d689b 2023-02-11 thomas # Look for yacc.
387 b29d689b 2023-02-11 thomas if test "YACC_OVERRIDE" = "yes" && test -n "$YACC" \
388 b29d689b 2023-02-11 thomas && ! command -v "$YACC" >/dev/null 2>&1; then
389 b29d689b 2023-02-11 thomas AC_MSG_ERROR("yacc not found: $YACC")
392 51207398 2022-07-21 thomas if test x"$PLATFORM" = "xdarwin"; then
393 5baa5fe2 2022-09-05 thomas # Check for and/or set HOMEBREW_PREFIX. brew is a common way of
394 5baa5fe2 2022-09-05 thomas # installing applications. The other is MacPorts.
396 5baa5fe2 2022-09-05 thomas # Before Apple Silicon existed (M1 onward), the paths for applications
397 5baa5fe2 2022-09-05 thomas # installed via homebrew was typically /usr/local. However, with M1
398 5baa5fe2 2022-09-05 thomas # onward, this changed to a different path.
400 5baa5fe2 2022-09-05 thomas # Rather than hardcode this, check for HOMEBREW_PREFIX in the
401 8e396e19 2022-09-12 thomas # environment if it's already set, and use it. Otherwise, check for
402 5baa5fe2 2022-09-05 thomas # brew(1) and use that. If that fails, default to /usr/local
404 5baa5fe2 2022-09-05 thomas # This also means that MacPorts should continue to work.
406 8e396e19 2022-09-12 thomas # But with MacPorts, we should also check --prefix, and use that if it
407 8e396e19 2022-09-12 thomas # has been supplied.
409 8e396e19 2022-09-12 thomas # In both cases, the variable HOMEBREW_PREFIX is used for both.
410 8e396e19 2022-09-12 thomas HB_PREFIX=""
411 8e396e19 2022-09-12 thomas FOUND_BISON="no"
412 8e396e19 2022-09-12 thomas GNUBISON=""
413 8e396e19 2022-09-12 thomas if test -z "$HOMEBREW_PREFIX" -o "$HOMEBREW_PREFIX" = "NONE"; then
414 5baa5fe2 2022-09-05 thomas # HOMEBREW_PREFIX not set, check for brew(1)
415 8e396e19 2022-09-12 thomas if command -v brew >/dev/null 2>&1; then
416 8e396e19 2022-09-12 thomas AC_MSG_NOTICE("HOMEBREW_PREFIX set via 'brew --prefix'")
417 5baa5fe2 2022-09-05 thomas export HOMEBREW_PREFIX="$(brew --prefix)"
420 8e396e19 2022-09-12 thomas if test -z "$HOMEBREW_PREFIX" -o "$HOMEBREW_PREFIX" = "NONE"
422 5baa5fe2 2022-09-05 thomas # Default.
423 8e396e19 2022-09-12 thomas if test -z "${prefix}" -o "${prefix}" = "NONE"; then
424 8e396e19 2022-09-12 thomas export HOMEBREW_PREFIX="/usr/local"
425 8e396e19 2022-09-12 thomas HB_PREFIX="/usr/local"
426 8e396e19 2022-09-12 thomas AC_MSG_NOTICE("HOMEBREW_PREFIX defaulting to $HB_PREFIX")
428 8e396e19 2022-09-12 thomas HB_PREFIX="$(eval echo ${prefix})"
429 8e396e19 2022-09-12 thomas if test "$HB_PREFIX" = "NONE"; then
430 8e396e19 2022-09-12 thomas HB_PREFIX="/opt/local"
432 8e396e19 2022-09-12 thomas AC_MSG_NOTICE("HOMEBREW_PREFIX using --prefix")
434 8e396e19 2022-09-12 thomas export HOMEBREW_PREFIX="$HB_PREFIX"
439 8e396e19 2022-09-12 thomas AC_MSG_NOTICE("HOMEBREW_PREFIX determined as: $HOMEBREW_PREFIX")
441 b29d689b 2023-02-11 thomas if test "$YACC_OVERRIDE" = "no" && \
442 b29d689b 2023-02-11 thomas ! test -x "${HOMEBREW_PREFIX}/opt/bison/bin/bison"; then
443 8e396e19 2022-09-12 thomas AC_MSG_WARN([
444 8e396e19 2022-09-12 thomas "***********************************************************
445 8e396e19 2022-09-12 thomas GNU Bison not found: ${HOMEBREW_PREFIX}/opt/bison/bin/bison
446 8e396e19 2022-09-12 thomas ***********************************************************
448 8e396e19 2022-09-12 thomas Falling back to checking either /usr/local or \${prefix}"
451 8e396e19 2022-09-12 thomas FOUND_BISON="no"
452 8e396e19 2022-09-12 thomas AC_MSG_WARN("Trying ${HB_PREFIX}/opt/bison/bin/bison")
453 8e396e19 2022-09-12 thomas if test -x "${HB_PREFIX}/opt/bison/bin/bison"; then
454 8e396e19 2022-09-12 thomas export HOMEBREW_PREFIX="/usr/local"
455 8e396e19 2022-09-12 thomas FOUND_BISON="yes"
456 8e396e19 2022-09-12 thomas GNUBISON="${HB_PREFIX}/opt/bison/bin/bison"
459 8e396e19 2022-09-12 thomas if test "$FOUND_BISON" = "no"; then
460 8e396e19 2022-09-12 thomas HB_PREFIX="/opt/local"
461 8e396e19 2022-09-12 thomas AC_MSG_WARN("Trying ${HB_PREFIX}/bin/bison")
463 8e396e19 2022-09-12 thomas if test -x "${HB_PREFIX}/bin/bison"; then
464 8e396e19 2022-09-12 thomas export HOMEBREW_PREFIX="${HB_PREFIX}"
465 8e396e19 2022-09-12 thomas GNUBISON="${HB_PREFIX}/bin/bison"
466 8e396e19 2022-09-12 thomas FOUND_BISON="yes"
470 8e396e19 2022-09-12 thomas FOUND_BISON="yes"
471 8e396e19 2022-09-12 thomas GNUBISON="${HOMEBREW_PREFIX}/opt/bison/bin/bison"
474 b29d689b 2023-02-11 thomas if test "$FOUND_BISON" = "no" && test "$YACC_OVERRIDE" = "no"; then
475 8e396e19 2022-09-12 thomas AC_MSG_ERROR("*** Couldn't find GNU BISON ***")
478 51207398 2022-07-21 thomas # Override YACC here to point to the GNU version of bison.
479 b29d689b 2023-02-11 thomas if test "$YACC_OVERRIDE" = "yes"; then
480 b29d689b 2023-02-11 thomas export YACC="$YACC -y"
482 b29d689b 2023-02-11 thomas AC_MSG_NOTICE("Found GNU Bison as: $GNUBISON")
483 b29d689b 2023-02-11 thomas export YACC="${GNUBISON} -y"
485 8e396e19 2022-09-12 thomas export LDFLAGS="-L${HOMEBREW_PREFIX}/opt/ncurses/lib -L${HOMEBREW_PREFIX}/opt/openssl@3/lib $LDFLAGS"
486 5baa5fe2 2022-09-05 thomas export CPPFLAGS="-I${HOMEBREW_PREFIX}/opt/ncurses/include -I${HOMEBREW_PREFIX}/opt/openssl@3/include $CPPFLAGS"
487 5baa5fe2 2022-09-05 thomas export PKG_CONFIG_PATH="${HOMEBREW_PREFIX}/opt/ncurses/lib/pkgconfig"
488 5baa5fe2 2022-09-05 thomas export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:${HOMEBREW_PREFIX}/opt/openssl@3/lib/pkgconfig"
491 97799ccd 2022-02-06 thomas # Landlock detection.
492 97799ccd 2022-02-06 thomas AC_MSG_CHECKING([for landlock])
493 97799ccd 2022-02-06 thomas AM_CONDITIONAL([HAVE_LINUX_LANDLOCK],
494 97799ccd 2022-02-06 thomas [test "x$ac_cv_header_linux_landlock_h" = "xyes"])
495 97799ccd 2022-02-06 thomas if test "x$ac_cv_header_linux_landlock_h" = "xyes"; then
496 97799ccd 2022-02-06 thomas AC_MSG_RESULT(yes)
498 97799ccd 2022-02-06 thomas AC_MSG_RESULT(no)
501 dd038bc6 2021-09-21 thomas.ad # Clang sanitizers wrap reallocarray even if it isn't available on the target
502 dd038bc6 2021-09-21 thomas.ad # system. When compiled it always returns NULL and crashes the program. To
503 dd038bc6 2021-09-21 thomas.ad # detect this we need a more complicated test.
504 dd038bc6 2021-09-21 thomas.ad AC_MSG_CHECKING([for working reallocarray])
505 dd038bc6 2021-09-21 thomas.ad AC_RUN_IFELSE([AC_LANG_PROGRAM(
506 dd038bc6 2021-09-21 thomas.ad [#include <stdlib.h>],
507 dd038bc6 2021-09-21 thomas.ad [return (reallocarray(NULL, 1, 1) == NULL);]
509 dd038bc6 2021-09-21 thomas.ad AC_MSG_RESULT(yes),
510 7f20c2a8 2022-05-13 op [AC_LIBOBJ(reallocarray) AC_MSG_RESULT([no])],
511 dd038bc6 2021-09-21 thomas.ad [AC_LIBOBJ(reallocarray) AC_MSG_RESULT([no])]
513 dd038bc6 2021-09-21 thomas.ad AC_MSG_CHECKING([for working recallocarray])
514 dd038bc6 2021-09-21 thomas.ad AC_RUN_IFELSE([AC_LANG_PROGRAM(
515 dd038bc6 2021-09-21 thomas.ad [#include <stdlib.h>],
516 dd038bc6 2021-09-21 thomas.ad [return (recallocarray(NULL, 1, 1, 1) == NULL);]
518 dd038bc6 2021-09-21 thomas.ad AC_MSG_RESULT(yes),
519 7f20c2a8 2022-05-13 op [AC_LIBOBJ(recallocarray) AC_MSG_RESULT([no])],
520 dd038bc6 2021-09-21 thomas.ad [AC_LIBOBJ(recallocarray) AC_MSG_RESULT([no])]
523 dd038bc6 2021-09-21 thomas.ad # Look for imsg_init in libutil.
524 dd038bc6 2021-09-21 thomas.ad AC_SEARCH_LIBS(imsg_init, util, found_imsg_init=yes, found_imsg_init=no)
525 f600ad76 2023-01-06 thomas AM_CONDITIONAL([HAVE_IMSG], [test "x$found_imsg_init" = "xyes"])
526 4fccd2fe 2023-03-08 thomas if test "x$found_imsg_init" = "xyes"; then
527 d9b944c7 2023-03-08 thomas AC_DEFINE([HAVE_IMSG], [1], [Define to 1 if imsg is declared in libutil])
528 4fccd2fe 2023-03-08 thomas libutil_LIBS="$ac_cv_search_imsg_init"
529 4fccd2fe 2023-03-08 thomas AC_SUBST(libutil_LIBS)
532 ff36aeea 2022-07-16 thomas # libevent (for gotwebd). Lifted from tmux.
533 ff36aeea 2022-07-16 thomas # Look for libevent. Try libevent_core or libevent with pkg-config first then
534 ff36aeea 2022-07-16 thomas # look for the library.
535 4fccd2fe 2023-03-08 thomas found_libevent=no
536 ff36aeea 2022-07-16 thomas PKG_CHECK_MODULES(
537 ff36aeea 2022-07-16 thomas LIBEVENT_CORE,
538 ff36aeea 2022-07-16 thomas [libevent_core >= 2],
540 4fccd2fe 2023-03-08 thomas libevent_CFLAGS="$LIBEVENT_CORE_CFLAGS"
541 4fccd2fe 2023-03-08 thomas libevent_LIBS="$LIBEVENT_CORE_LIBS"
542 4fccd2fe 2023-03-08 thomas AC_SUBST(libevent_CFLAGS)
543 4fccd2fe 2023-03-08 thomas AC_SUBST(libevent_LIBS)
544 ff36aeea 2022-07-16 thomas found_libevent=yes
546 ff36aeea 2022-07-16 thomas found_libevent=no
548 ff36aeea 2022-07-16 thomas if test x$found_libevent = xno; then
549 ff36aeea 2022-07-16 thomas PKG_CHECK_MODULES(
550 ff36aeea 2022-07-16 thomas LIBEVENT,
551 ff36aeea 2022-07-16 thomas [libevent >= 2],
553 4fccd2fe 2023-03-08 thomas libevent_CFLAGS="$LIBEVENT_CFLAGS"
554 4fccd2fe 2023-03-08 thomas libevent_LIBS="$LIBEVENT_LIBS"
555 4fccd2fe 2023-03-08 thomas AC_SUBST(libevent_CFLAGS)
556 4fccd2fe 2023-03-08 thomas AC_SUBST(libevent_LIBS)
557 ff36aeea 2022-07-16 thomas found_libevent=yes
559 ff36aeea 2022-07-16 thomas found_libevent=no
562 ff36aeea 2022-07-16 thomas if test x$found_libevent = xno; then
563 ff36aeea 2022-07-16 thomas AC_SEARCH_LIBS(
564 ff36aeea 2022-07-16 thomas event_init,
565 ff36aeea 2022-07-16 thomas [event_core event event-1.4],
566 ff36aeea 2022-07-16 thomas found_libevent=yes,
567 ff36aeea 2022-07-16 thomas found_libevent=no
570 4fccd2fe 2023-03-08 thomas if test "x$found_libevent" = "xyes"; then
571 4fccd2fe 2023-03-08 thomas libevent_LIBS="$ac_cv_search_event_init"
572 4fccd2fe 2023-03-08 thomas AC_SUBST(libevent_LIBS)
576 4fccd2fe 2023-03-08 thomas if test x$found_libevent = xno; then
577 ff36aeea 2022-07-16 thomas AC_CHECK_HEADER(
578 ff36aeea 2022-07-16 thomas event2/event.h,
579 47dc83f5 2023-03-08 thomas AC_DEFINE([HAVE_EVENT2_EVENT_H], [1], [libevent2 has event.h]),
581 ff36aeea 2022-07-16 thomas AC_CHECK_HEADER(
583 47dc83f5 2023-03-08 thomas AC_DEFINE([HAVE_EVENT_H], [0], [libevent]),
584 ff36aeea 2022-07-16 thomas found_libevent=no
590 ff36aeea 2022-07-16 thomas if test "x$found_libevent" = xno; then
591 ff36aeea 2022-07-16 thomas AC_MSG_ERROR("libevent not found")
594 4fccd2fe 2023-03-08 thomas AC_CHECK_FUNC([uuid_create], [found_uuid=yes], [found_uuid=no])
596 d24ddaa6 2022-02-26 thomas # Don't define HAVE_BSD_UUID on darwin (Apple) as this breaks the BSD API.
597 d24ddaa6 2022-02-26 thomas # Instead, use the UUID implementation wrapper that's in compat/ plus uuid
599 d24ddaa6 2022-02-26 thomas if test "x$found_uuid" = "xyes" -a "x$PLATFORM" != "darwin"; then
600 47dc83f5 2023-03-08 thomas AC_DEFINE([HAVE_BSD_UUID], [1], [BSD UUID])
602 326237a6 2021-09-25 thomas PKG_CHECK_MODULES(
606 4fccd2fe 2023-03-08 thomas libuuid_CFLAGS="$LIBUUID_CFLAGS"
607 4fccd2fe 2023-03-08 thomas libuuid_LIBS="$LIBUUID_LIBS"
608 4fccd2fe 2023-03-08 thomas AC_SUBST(libuuid_CFLAGS)
609 4fccd2fe 2023-03-08 thomas AC_SUBST(libuuid_LIBS)
610 326237a6 2021-09-25 thomas found_libuuid=yes
613 326237a6 2021-09-25 thomas found_libuuid=no
617 326237a6 2021-09-25 thomas if test "x$found_libuuid" = "xno"; then
618 326237a6 2021-09-25 thomas AC_CHECK_HEADER(
620 326237a6 2021-09-25 thomas found_libuuid=yes,
621 326237a6 2021-09-25 thomas found_libuuid=no)
625 92a9e85d 2021-09-24 thomas if test "x$found_libuuid" = "xno"; then
626 92a9e85d 2021-09-24 thomas AC_MSG_ERROR("*** couldn't find uuid ***")
629 dd038bc6 2021-09-21 thomas.ad PKG_CHECK_MODULES(
633 4fccd2fe 2023-03-08 thomas zlib_CFLAGS="$ZLIB_CFLAGS"
634 4fccd2fe 2023-03-08 thomas zlib_LIBS="$ZLIB_LIBS"
635 4fccd2fe 2023-03-08 thomas AC_SUBST(zlib_CFLAGS)
636 4fccd2fe 2023-03-08 thomas AC_SUBST(zlib_LIBS)
637 dd038bc6 2021-09-21 thomas.ad found_zlib=yes
640 92a9e85d 2021-09-24 thomas found_zlib=no
644 92a9e85d 2021-09-24 thomas if test "x$found_zlib" = "xno"; then
645 92a9e85d 2021-09-24 thomas AC_CHECK_HEADER(
648 92a9e85d 2021-09-24 thomas found_zlib=no)
651 92a9e85d 2021-09-24 thomas if test "x$found_zlib" = "xno"; then
652 92a9e85d 2021-09-24 thomas AC_MSG_ERROR("*** couldn't find zlib ***")
655 92a9e85d 2021-09-24 thomas if test "$PLATFORM" = "linux"; then
656 92a9e85d 2021-09-24 thomas PKG_CHECK_MODULES(
658 92a9e85d 2021-09-24 thomas libbsd-overlay,
660 4fccd2fe 2023-03-08 thomas libbsd_CFLAGS="$LIBBSD_CFLAGS"
661 4fccd2fe 2023-03-08 thomas libbsd_LIBS="$LIBBSD_LIBS"
662 4fccd2fe 2023-03-08 thomas AC_SUBST(libbsd_CFLAGS)
663 4fccd2fe 2023-03-08 thomas AC_SUBST(libbsd_LIBS)
664 47dc83f5 2023-03-08 thomas AC_DEFINE([HAVE_LIBBSD], [1], [BSD UUID])
667 46384c6e 2022-09-13 thomas AC_MSG_ERROR("*** couldn't find libbsd-overlay via pkg-config")
672 4fccd2fe 2023-03-08 thomas # Add LIBBSD_{CFLAGS,LIBS} to the environment here, as libbsd puts its
673 4fccd2fe 2023-03-08 thomas # header files in a non-standard location, which means the overlay for
674 4fccd2fe 2023-03-08 thomas # <sys/tree.h> and <sys/queue.h> won't be found.
675 4fccd2fe 2023-03-08 thomas CFLAGS="$CFLAGS $LIBBSD_CFLAGS"
676 4fccd2fe 2023-03-08 thomas LIBS="$LIBS $LIBBSD_LIBS"
679 dd038bc6 2021-09-21 thomas.ad # Look for a suitable queue.h. We hope libbsd is enough, but that is missing
680 8dbd2d50 2022-08-12 thomas # some declarations.
681 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
682 dd038bc6 2021-09-21 thomas.ad TAILQ_CONCAT,
683 dd038bc6 2021-09-21 thomas.ad found_queue_h=yes,
684 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
685 8dbd2d50 2022-08-12 thomas [#include <sys/queue.h>]
687 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
688 dd038bc6 2021-09-21 thomas.ad TAILQ_PREV,
690 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
691 8dbd2d50 2022-08-12 thomas [#include <sys/queue.h>]
693 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
694 dd038bc6 2021-09-21 thomas.ad TAILQ_FOREACH_SAFE,
696 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
697 8dbd2d50 2022-08-12 thomas [#include <sys/queue.h>]
700 8dbd2d50 2022-08-12 thomas if test "x$found_queue_h" = xyes; then
701 47dc83f5 2023-03-08 thomas AC_DEFINE([HAVE_QUEUE_H], [1], [sys/queue.h])
703 46384c6e 2022-09-13 thomas AC_MSG_ERROR("*** sys/queue.h missing key defines ***)
706 c59427c5 2022-10-13 thomas AC_CHECK_DECL(
707 c59427c5 2022-10-13 thomas RB_GENERATE_STATIC,
708 c59427c5 2022-10-13 thomas found_sys_tree_h=yes,
709 c59427c5 2022-10-13 thomas found_sys_tree_h=no,
710 c59427c5 2022-10-13 thomas [#include <sys/tree.h>]
713 c59427c5 2022-10-13 thomas if test "x$found_sys_tree_h" = xyes; then
714 47dc83f5 2023-03-08 thomas AC_DEFINE([HAVE_TREE_H], [1], [sys/tree.h])
716 c59427c5 2022-10-13 thomas AC_MSG_NOTICE("Using compat/tree.h")
719 dd038bc6 2021-09-21 thomas.ad # Look for __progname.
720 dd038bc6 2021-09-21 thomas.ad AC_MSG_CHECKING(for __progname)
721 dd038bc6 2021-09-21 thomas.ad AC_LINK_IFELSE([AC_LANG_SOURCE(
723 dd038bc6 2021-09-21 thomas.ad #include <stdio.h>
724 dd038bc6 2021-09-21 thomas.ad #include <stdlib.h>
725 dd038bc6 2021-09-21 thomas.ad extern char *__progname;
726 dd038bc6 2021-09-21 thomas.ad int main(void) {
727 dd038bc6 2021-09-21 thomas.ad const char *cp = __progname;
728 dd038bc6 2021-09-21 thomas.ad printf("%s\n", cp);
729 dd038bc6 2021-09-21 thomas.ad exit(0);
732 47dc83f5 2023-03-08 thomas [AC_DEFINE([HAVE___PROGNAME], [1], [___progname]) AC_MSG_RESULT(yes)],
733 47dc83f5 2023-03-08 thomas [AC_MSG_RESULT(no)]
736 d9e4d43f 2022-03-03 thomas PKG_CHECK_MODULES(
737 d9e4d43f 2022-03-03 thomas LIBPANELW,
739 d3f1e38b 2023-03-08 thomas LIBPANELW_LIBS="$LIBPANELW_LIBS"
740 d9e4d43f 2022-03-03 thomas found_panel=yes,
741 d9e4d43f 2022-03-03 thomas found_panel=no
744 d3f1e38b 2023-03-08 thomas if test "x$found_panel" = "xno"; then
745 d9e4d43f 2022-03-03 thomas PKG_CHECK_MODULES(
746 d9e4d43f 2022-03-03 thomas LIBPANELW,
747 d9e4d43f 2022-03-03 thomas gnupanelw,
749 d3f1e38b 2023-03-08 thomas LIBPANELW_LIBS="$LIBPANELW_LIBS"
750 d3f1e38b 2023-03-08 thomas found_panel=yes
752 d9e4d43f 2022-03-03 thomas found_panel=no
756 d3f1e38b 2023-03-08 thomas if test "x$found_panel" = "xno"; then
757 b26177ad 2022-03-03 thomas PKG_CHECK_MODULES(
758 b26177ad 2022-03-03 thomas LIBPANELW,
761 d3f1e38b 2023-03-08 thomas LIBPANELW_LIBS="$LIBPANELW_LIBS"
762 d3f1e38b 2023-03-08 thomas found_panel=yes
764 b26177ad 2022-03-03 thomas found_panel=no
768 d9e4d43f 2022-03-03 thomas if test "x$found_panel" = "xno"; then
769 947fe78c 2023-01-06 thomas AC_CHECK_LIB(panelw, update_panels, [],
770 947fe78c 2023-01-06 thomas AC_MSG_ERROR([ "*** panelw not found for ncurses. ***"]),
771 947fe78c 2023-01-06 thomas [-lncurses]
776 acf52a76 2021-09-21 thomas.ad PKG_CHECK_MODULES(
777 acf52a76 2021-09-21 thomas.ad LIBNCURSES,
778 acf52a76 2021-09-21 thomas.ad ncursesw,
779 dd038bc6 2021-09-21 thomas.ad found_ncurses=yes,
780 dd038bc6 2021-09-21 thomas.ad found_ncurses=no
782 acf52a76 2021-09-21 thomas.ad if test "x$found_ncurses" = xyes; then
783 4fccd2fe 2023-03-08 thomas libncurses_CFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $LIBPANELW_CFLAGS"
784 4fccd2fe 2023-03-08 thomas libncurses_LIBS="$LIBNCURSES_LIBS $LIBTINFO_LIBS $LIBPANELW_LIBS"
785 4fccd2fe 2023-03-08 thomas AC_SUBST(libncurses_CFLAGS)
786 4fccd2fe 2023-03-08 thomas AC_SUBST(libncurses_LIBS)
788 4fccd2fe 2023-03-08 thomas AC_SEARCH_LIBS(
789 dd038bc6 2021-09-21 thomas.ad setupterm,
790 dd038bc6 2021-09-21 thomas.ad found_ncurses=yes,
791 dd038bc6 2021-09-21 thomas.ad found_ncurses=no
793 dd038bc6 2021-09-21 thomas.ad if test "x$found_ncurses" = xyes; then
794 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADER(
795 dd038bc6 2021-09-21 thomas.ad ncurses.h,
796 4fccd2fe 2023-03-08 thomas libncurses_CFLAGS="$LIBPANELW_CFLAGS $LIBPANEL_CFLAGS"
797 4fccd2fe 2023-03-08 thomas libncurses_LIBS="$LIBPANELW_LIBS -lncursesw"
798 4fccd2fe 2023-03-08 thomas AC_SUBST(libncurses_CFLAGS)
799 4fccd2fe 2023-03-08 thomas AC_SUBST(libncurses_LIBS)
803 dd038bc6 2021-09-21 thomas.ad if test "x$found_ncurses" = xyes; then
804 47dc83f5 2023-03-08 thomas AC_DEFINE([HAVE_NCURSES_H], [1], [NCurses])
806 dd038bc6 2021-09-21 thomas.ad # No ncurses, try curses.
807 4fccd2fe 2023-03-08 thomas AC_CHECK_FUNC(
808 dd038bc6 2021-09-21 thomas.ad setupterm,
809 dd038bc6 2021-09-21 thomas.ad found_curses=yes,
810 dd038bc6 2021-09-21 thomas.ad found_curses=no
812 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADER(
813 dd038bc6 2021-09-21 thomas.ad curses.h,
814 4fccd2fe 2023-03-08 thomas found_curses=yes,
815 dd038bc6 2021-09-21 thomas.ad found_curses=no)
816 dd038bc6 2021-09-21 thomas.ad if test "x$found_curses" = xyes; then
817 4fccd2fe 2023-03-08 thomas libncurses_CFLAGS="$LIBPANELW_CFLAGS $LIBPANEL_CFLAGS"
818 d3f1e38b 2023-03-08 thomas libncurses_LIBS="$LIBPANELW_LIBS -lncursesw -lpanelw"
819 4fccd2fe 2023-03-08 thomas AC_SUBST(libncurses_CFLAGS)
820 4fccd2fe 2023-03-08 thomas AC_SUBST(libncurses_LIBS)
821 47dc83f5 2023-03-08 thomas AC_DEFINE([HAVE_CURSES_H], [1], [Curses_h])
823 dd038bc6 2021-09-21 thomas.ad AC_MSG_ERROR("curses not found")
827 dd038bc6 2021-09-21 thomas.ad # Save our CFLAGS/CPPFLAGS/LDFLAGS for the Makefile and restore the old user
828 dd038bc6 2021-09-21 thomas.ad # variables.
829 dd038bc6 2021-09-21 thomas.ad AC_SUBST(AM_CPPFLAGS)
830 dd038bc6 2021-09-21 thomas.ad CPPFLAGS="$SAVED_CPPFLAGS"
831 dd038bc6 2021-09-21 thomas.ad AC_SUBST(AM_CFLAGS)
832 dd038bc6 2021-09-21 thomas.ad CFLAGS="$SAVED_CFLAGS"
833 dd038bc6 2021-09-21 thomas.ad AC_SUBST(AM_LDFLAGS)
834 dd038bc6 2021-09-21 thomas.ad LDFLAGS="$SAVED_LDFLAGS"
836 943e9ed2 2023-03-08 thomas # LIBS is designed to accumulate library dependencies as checks for them are
837 943e9ed2 2023-03-08 thomas # peformed, so that this can be included directly to ld(1).
839 943e9ed2 2023-03-08 thomas # However, this hinders the splitting up of the library dependencies so that
840 943e9ed2 2023-03-08 thomas # they're targetted just where they're needed. Flatting LIBS here ensures
841 943e9ed2 2023-03-08 thomas # that this happens appropriately.
844 47dc83f5 2023-03-08 thomas AH_BOTTOM([#include "got_compat2.h"])
846 dd038bc6 2021-09-21 thomas.ad AC_CONFIG_FILES([Makefile
847 dd038bc6 2021-09-21 thomas.ad compat/Makefile
848 dd038bc6 2021-09-21 thomas.ad libexec/Makefile
849 dd038bc6 2021-09-21 thomas.ad libexec/got-read-tree/Makefile
850 dd038bc6 2021-09-21 thomas.ad libexec/got-fetch-pack/Makefile
851 dd038bc6 2021-09-21 thomas.ad libexec/got-index-pack/Makefile
852 dd038bc6 2021-09-21 thomas.ad libexec/got-read-blob/Makefile
853 dd038bc6 2021-09-21 thomas.ad libexec/got-read-commit/Makefile
854 dd038bc6 2021-09-21 thomas.ad libexec/got-read-gitconfig/Makefile
855 dd038bc6 2021-09-21 thomas.ad libexec/got-read-gotconfig/Makefile
856 dd038bc6 2021-09-21 thomas.ad libexec/got-read-object/Makefile
857 dd038bc6 2021-09-21 thomas.ad libexec/got-read-pack/Makefile
858 973f3f6e 2022-03-07 thomas libexec/got-read-patch/Makefile
859 dd038bc6 2021-09-21 thomas.ad libexec/got-read-tag/Makefile
860 dd038bc6 2021-09-21 thomas.ad libexec/got-send-pack/Makefile
861 dd038bc6 2021-09-21 thomas.ad got/Makefile
862 2b0eee35 2021-09-21 thomas.ad gotadmin/Makefile
863 ff36aeea 2022-07-16 thomas gotwebd/Makefile
864 d3f2ad5e 2021-09-21 thomas.ad tog/Makefile
865 5a7ef102 2021-10-09 thomas Makefile.common:Makefile.common.in])
866 dd038bc6 2021-09-21 thomas.ad AC_OUTPUT
868 9ffe20fd 2022-09-10 thomas executables="$(eval echo ${exec_prefix}/bin)"
869 9ffe20fd 2022-09-10 thomas helpers="$(eval echo ${libexecdir})"
870 9ffe20fd 2022-09-10 thomas manpages="$(eval echo ${mandir})"
873 9ffe20fd 2022-09-10 thomas Configured got-portable with:
875 9ffe20fd 2022-09-10 thomas Version: $VERSION
877 9ffe20fd 2022-09-10 thomas Prefix: ${prefix}
878 9ffe20fd 2022-09-10 thomas Executables: ${executables}
879 b29d689b 2023-02-11 thomas Bison: $YACC
880 4fccd2fe 2023-03-08 thomas CFlags: $CFLAGS
881 9ffe20fd 2022-09-10 thomas Helpers: ${helpers}
882 9ffe20fd 2022-09-10 thomas Man pages: ${manpages}