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 8d60d668 2023-03-16 thomas getopt.h \
62 dd038bc6 2021-09-21 thomas.ad langinfo.h \
63 d9b944c7 2023-03-08 thomas libutil.h \
64 dd038bc6 2021-09-21 thomas.ad limits.h \
65 97799ccd 2022-02-06 thomas linux/landlock.h \
66 dd038bc6 2021-09-21 thomas.ad locale.h \
67 dd038bc6 2021-09-21 thomas.ad netdb.h \
68 dd038bc6 2021-09-21 thomas.ad netinet/in.h \
69 dd038bc6 2021-09-21 thomas.ad paths.h \
74 98670ba7 2023-02-23 thomas sha256.h \
75 dd038bc6 2021-09-21 thomas.ad stddef.h \
76 dd038bc6 2021-09-21 thomas.ad stdint.h \
77 dd038bc6 2021-09-21 thomas.ad stdlib.h \
78 dd038bc6 2021-09-21 thomas.ad string.h \
79 dd038bc6 2021-09-21 thomas.ad sys/ioctl.h \
80 dd038bc6 2021-09-21 thomas.ad sys/param.h \
81 d24ddaa6 2022-02-26 thomas sys/poll.h \
82 19467d59 2022-07-16 thomas sys/queue.h \
83 d9b944c7 2023-03-08 thomas sys/select.h \
84 dd038bc6 2021-09-21 thomas.ad sys/socket.h \
85 dd038bc6 2021-09-21 thomas.ad sys/time.h \
86 dd038bc6 2021-09-21 thomas.ad sys/tree.h \
87 dd038bc6 2021-09-21 thomas.ad util.h \
88 dd038bc6 2021-09-21 thomas.ad unistd.h \
89 dd038bc6 2021-09-21 thomas.ad wchar.h \
92 d9b944c7 2023-03-08 thomas AC_HEADER_DIRENT
93 d9b944c7 2023-03-08 thomas AC_CHECK_DECL([F_CLOSEM],
94 d9b944c7 2023-03-08 thomas HAVE_FCNTL_CLOSEM
95 d9b944c7 2023-03-08 thomas AC_DEFINE([HAVE_FCNTL_CLOSEM], [1],
96 d9b944c7 2023-03-08 thomas [Use F_CLOSEM fcntl for closefrom]),
98 d9b944c7 2023-03-08 thomas [#include <limits.h>
99 d9b944c7 2023-03-08 thomas #include <fcntl.h>
103 d9b944c7 2023-03-08 thomas AC_MSG_CHECKING([for /proc/pid/fd directory])
104 d9b944c7 2023-03-08 thomas if test -d "/proc/$$/fd" ; then
105 d9b944c7 2023-03-08 thomas AC_DEFINE([HAVE_PROC_PID], [1], [Define if you have /proc/$pid/fd])
106 d9b944c7 2023-03-08 thomas AC_MSG_RESULT([yes])
108 d9b944c7 2023-03-08 thomas AC_MSG_RESULT([no])
111 d9b944c7 2023-03-08 thomas AC_MSG_CHECKING([whether program_invocation_short_name is defined])
112 d9b944c7 2023-03-08 thomas AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
113 d9b944c7 2023-03-08 thomas #include <argp.h>
115 d9b944c7 2023-03-08 thomas program_invocation_short_name = "test";
117 d9b944c7 2023-03-08 thomas AC_MSG_RESULT([yes])
118 d9b944c7 2023-03-08 thomas AC_DEFINE([HAVE_PROGRAM_INVOCATION_SHORT_NAME], [1],
119 d9b944c7 2023-03-08 thomas [Define if program_invocation_short_name is defined])
121 d9b944c7 2023-03-08 thomas AC_MSG_RESULT([no])
124 d9b944c7 2023-03-08 thomas # Look for prctl(PR_SET_NAME).
125 d9b944c7 2023-03-08 thomas AC_CHECK_DECL(
126 d9b944c7 2023-03-08 thomas [PR_SET_NAME],
127 d9b944c7 2023-03-08 thomas [AC_DEFINE([HAVE_PR_SET_NAME], [1], [Define if PR_SET_NAME is defined])],
129 d9b944c7 2023-03-08 thomas [#include <sys/prctl.h>]
132 b1ec8cee 2023-02-25 thomas AM_CONDITIONAL([HAVE_SHA2], [test "x$ac_cv_header_sha2_h" = xyes])
134 8d60d668 2023-03-16 thomas AC_CACHE_CHECK([whether getopt has optreset support],
135 8d60d668 2023-03-16 thomas ac_cv_have_getopt_optreset, [
136 8d60d668 2023-03-16 thomas AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <getopt.h> ]],
137 8d60d668 2023-03-16 thomas [[ extern int optreset; optreset = 0; ]])],
138 8d60d668 2023-03-16 thomas [ ac_cv_have_getopt_optreset="yes" ],
139 8d60d668 2023-03-16 thomas [ ac_cv_have_getopt_optreset="no"
143 8d60d668 2023-03-16 thomas AM_CONDITIONAL([HAVE_GETOPT], [test "x$ac_cv_have_getopt_optreset" = "xyes"])
144 8d60d668 2023-03-16 thomas if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
145 8d60d668 2023-03-16 thomas AC_DEFINE([HAVE_GETOPT_OPTRESET], [1],
146 8d60d668 2023-03-16 thomas [Define if your getopt(3) defines and uses optreset])
149 d9b944c7 2023-03-08 thomas AC_CHECK_MEMBERS([struct pollfd.fd], [], [], [[
150 d9b944c7 2023-03-08 thomas #include <sys/types.h>
151 d9b944c7 2023-03-08 thomas #ifdef HAVE_POLL_H
152 d9b944c7 2023-03-08 thomas #include <poll.h>
154 d9b944c7 2023-03-08 thomas #ifdef HAVE_SYS_POLL_H
155 d9b944c7 2023-03-08 thomas #include <sys/poll.h>
159 dd038bc6 2021-09-21 thomas.ad # Checks for typ edefs, structures, and compiler characteristics.
160 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADER_STDBOOL
161 dd038bc6 2021-09-21 thomas.ad AC_C_INLINE
162 dd038bc6 2021-09-21 thomas.ad AC_TYPE_INT64_T
163 dd038bc6 2021-09-21 thomas.ad AC_TYPE_MODE_T
164 dd038bc6 2021-09-21 thomas.ad AC_TYPE_OFF_T
165 dd038bc6 2021-09-21 thomas.ad AC_TYPE_PID_T
166 dd038bc6 2021-09-21 thomas.ad AC_TYPE_SIZE_T
167 dd038bc6 2021-09-21 thomas.ad AC_TYPE_SSIZE_T
168 dd038bc6 2021-09-21 thomas.ad AC_TYPE_UINT16_T
169 dd038bc6 2021-09-21 thomas.ad AC_TYPE_UINT32_T
170 dd038bc6 2021-09-21 thomas.ad AC_TYPE_UINT64_T
171 dd038bc6 2021-09-21 thomas.ad AC_TYPE_UINT8_T
173 ff36aeea 2022-07-16 thomas # Check for ifgroupreq which is only available on BSD.
174 ff36aeea 2022-07-16 thomas AC_CHECK_TYPES([struct ifgroupreq])
176 75716fd6 2022-08-27 thomas # Check for sockaddr_storage. On some systems, ss_len is filled out, although
177 75716fd6 2022-08-27 thomas # this is not mandated by POSIX, and hence systems such as linux, don't have
179 75716fd6 2022-08-27 thomas AC_CHECK_TYPES([struct sockaddr_storage], [], [], [
180 75716fd6 2022-08-27 thomas #include <sys/types.h>
181 75716fd6 2022-08-27 thomas #include <sys/socket.h>
184 75716fd6 2022-08-27 thomas # Same thing as sockaddr_storage above, only now check if the member exists in
185 75716fd6 2022-08-27 thomas # the struct as well.
186 75716fd6 2022-08-27 thomas AC_CHECK_MEMBERS([struct sockaddr_storage.ss_len], , ,
187 75716fd6 2022-08-27 thomas [ #include <netdb.h>
188 75716fd6 2022-08-27 thomas #include <netinet/in.h>
189 75716fd6 2022-08-27 thomas #include <sys/socket.h> ]
192 75716fd6 2022-08-27 thomas AC_CHECK_MEMBERS([struct sockaddr.sa_len], , ,
193 75716fd6 2022-08-27 thomas [ #include <netdb.h>
194 75716fd6 2022-08-27 thomas #include <netinet/in.h>
195 75716fd6 2022-08-27 thomas #include <sys/socket.h> ]
198 75716fd6 2022-08-27 thomas # Both checks above will result in:
200 75716fd6 2022-08-27 thomas # HAVE_STRUCT_SOCKADDR_AS_LEN
203 75716fd6 2022-08-27 thomas # Either being defined or not.
205 dd038bc6 2021-09-21 thomas.ad # Look for library needed for flock.
206 dd038bc6 2021-09-21 thomas.ad AC_SEARCH_LIBS(flock, bsd)
208 dd038bc6 2021-09-21 thomas.ad # Checks for library functions.
209 dd038bc6 2021-09-21 thomas.ad AC_FUNC_FORK
210 dd038bc6 2021-09-21 thomas.ad AC_FUNC_FSEEKO
211 dd038bc6 2021-09-21 thomas.ad AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
212 dd038bc6 2021-09-21 thomas.ad AC_FUNC_MALLOC
213 dd038bc6 2021-09-21 thomas.ad AC_FUNC_MMAP
214 dd038bc6 2021-09-21 thomas.ad AC_FUNC_REALLOC
215 dd038bc6 2021-09-21 thomas.ad AC_FUNC_STRERROR_R
216 dd038bc6 2021-09-21 thomas.ad AC_FUNC_STRNLEN
217 dd038bc6 2021-09-21 thomas.ad AC_CHECK_FUNCS([ \
218 dd038bc6 2021-09-21 thomas.ad dup2 \
219 dd038bc6 2021-09-21 thomas.ad flock \
220 dd038bc6 2021-09-21 thomas.ad getcwd \
221 dd038bc6 2021-09-21 thomas.ad localtime_r \
222 dd038bc6 2021-09-21 thomas.ad memchr \
223 dd038bc6 2021-09-21 thomas.ad memmove \
224 dd038bc6 2021-09-21 thomas.ad memset \
225 4fccd2fe 2023-03-08 thomas mergesort \
226 dd038bc6 2021-09-21 thomas.ad mkdir \
227 dd038bc6 2021-09-21 thomas.ad munmap \
228 dd038bc6 2021-09-21 thomas.ad nl_langinfo \
229 dd038bc6 2021-09-21 thomas.ad realpath \
230 dd038bc6 2021-09-21 thomas.ad regcomp \
231 dd038bc6 2021-09-21 thomas.ad rmdir \
232 dd038bc6 2021-09-21 thomas.ad setlocale \
233 dd038bc6 2021-09-21 thomas.ad socket \
234 683ec58e 2022-07-16 thomas setresgid \
235 683ec58e 2022-07-16 thomas setresuid \
236 c4e2e0d0 2022-07-16 thomas setproctitle \
237 dd038bc6 2021-09-21 thomas.ad strcasecmp \
238 dd038bc6 2021-09-21 thomas.ad strchr \
239 dd038bc6 2021-09-21 thomas.ad strcspn \
240 dd038bc6 2021-09-21 thomas.ad strdup \
241 dd038bc6 2021-09-21 thomas.ad strerror \
242 dd038bc6 2021-09-21 thomas.ad strncasecmp \
243 dd038bc6 2021-09-21 thomas.ad strndup \
244 dd038bc6 2021-09-21 thomas.ad strrchr \
245 dd038bc6 2021-09-21 thomas.ad strspn \
246 dd038bc6 2021-09-21 thomas.ad strstr \
247 dd038bc6 2021-09-21 thomas.ad strtol \
248 dd038bc6 2021-09-21 thomas.ad strtoul \
249 d9b944c7 2023-03-08 thomas sysconf \
250 dd038bc6 2021-09-21 thomas.ad wcwidth \
253 c4e2e0d0 2022-07-16 thomas AM_CONDITIONAL([HAVE_SETPROCTITLE], [test "x$ac_cv_func_setproctitle" = xyes])
255 d9b944c7 2023-03-08 thomas if test "x$ac_cv_func_sysconf" = xyes; then
256 d9b944c7 2023-03-08 thomas AC_DEFINE([HAVE_SYSCONF], [1], [Define to 1 if sysconf() present])
259 ddd12270 2022-04-22 thomas # Siphash support.
260 ddd12270 2022-04-22 thomas AC_CHECK_FUNCS([SipHash])
261 ddd12270 2022-04-22 thomas AM_CONDITIONAL([HAVE_SIPHASH], [test "x$ac_cv_func_SipHash" = xyes])
263 dd038bc6 2021-09-21 thomas.ad # Check for functions with a compatibility implementation.
264 dd038bc6 2021-09-21 thomas.ad AC_REPLACE_FUNCS([ \
265 dd038bc6 2021-09-21 thomas.ad asprintf \
266 dd038bc6 2021-09-21 thomas.ad closefrom \
267 dd038bc6 2021-09-21 thomas.ad explicit_bzero \
268 dd038bc6 2021-09-21 thomas.ad fmt_scaled \
269 dd038bc6 2021-09-21 thomas.ad freezero \
270 dd038bc6 2021-09-21 thomas.ad getdtablecount \
271 dd038bc6 2021-09-21 thomas.ad getline \
272 dd038bc6 2021-09-21 thomas.ad getprogname \
273 dd038bc6 2021-09-21 thomas.ad recallocarray \
274 dd038bc6 2021-09-21 thomas.ad reallocarray \
275 dd038bc6 2021-09-21 thomas.ad strlcat \
276 dd038bc6 2021-09-21 thomas.ad strlcpy \
277 dd038bc6 2021-09-21 thomas.ad strndup \
278 d9b944c7 2023-03-08 thomas strnlen \
279 dd038bc6 2021-09-21 thomas.ad strsep \
280 dd038bc6 2021-09-21 thomas.ad strtonum \
282 4fccd2fe 2023-03-08 thomas AM_CONDITIONAL([HAVE_CLOSEFROM], [test "x$ac_cv_func_closefrom" = xyes])
284 dd038bc6 2021-09-21 thomas.ad # Always use our getopt because 1) glibc's doesn't enforce argument order 2)
285 dd038bc6 2021-09-21 thomas.ad # musl does not set optarg to NULL for flags without arguments (although it is
286 dd038bc6 2021-09-21 thomas.ad # not required to, but it is helpful) 3) there are probably other weird
287 dd038bc6 2021-09-21 thomas.ad # implementations.
288 dd038bc6 2021-09-21 thomas.ad AC_LIBOBJ(getopt)
290 206be139 2023-03-08 thomas # Check for b64_ntop. If we have b64_ntop, we assume b64_pton as well.
291 206be139 2023-03-08 thomas AC_MSG_CHECKING(for b64_ntop)
292 206be139 2023-03-08 thomas AC_LINK_IFELSE([AC_LANG_PROGRAM(
294 206be139 2023-03-08 thomas #include <sys/types.h>
295 206be139 2023-03-08 thomas #include <netinet/in.h>
296 206be139 2023-03-08 thomas #include <resolv.h>
299 206be139 2023-03-08 thomas b64_ntop(NULL, 0, NULL, 0);
301 206be139 2023-03-08 thomas found_b64_ntop=yes,
302 206be139 2023-03-08 thomas found_b64_ntop=no
304 206be139 2023-03-08 thomas AC_MSG_RESULT($found_b64_ntop)
305 206be139 2023-03-08 thomas libresolv_LIBS=""
306 206be139 2023-03-08 thomas if test "x$found_b64_ntop" = xno; then
307 206be139 2023-03-08 thomas AC_MSG_CHECKING(for b64_ntop with -lresolv)
308 206be139 2023-03-08 thomas LIBS="-lresolv"
309 206be139 2023-03-08 thomas AC_LINK_IFELSE([AC_LANG_PROGRAM(
311 206be139 2023-03-08 thomas #include <sys/types.h>
312 206be139 2023-03-08 thomas #include <netinet/in.h>
313 206be139 2023-03-08 thomas #include <resolv.h>
316 206be139 2023-03-08 thomas b64_ntop(NULL, 0, NULL, 0);
318 206be139 2023-03-08 thomas found_b64_ntop=yes,
319 206be139 2023-03-08 thomas found_b64_ntop=no
321 206be139 2023-03-08 thomas AC_MSG_RESULT($found_b64_ntop)
322 206be139 2023-03-08 thomas libresolv_LIBS="$LIBS"
324 206be139 2023-03-08 thomas if test "x$found_b64_ntop" = xno; then
325 206be139 2023-03-08 thomas AC_MSG_CHECKING(for b64_ntop with -lnetwork)
326 206be139 2023-03-08 thomas LIBS="-lresolv -lnetwork"
327 206be139 2023-03-08 thomas AC_LINK_IFELSE([AC_LANG_PROGRAM(
329 206be139 2023-03-08 thomas #include <sys/types.h>
330 206be139 2023-03-08 thomas #include <netinet/in.h>
331 206be139 2023-03-08 thomas #include <resolv.h>
334 206be139 2023-03-08 thomas b64_ntop(NULL, 0, NULL, 0);
336 206be139 2023-03-08 thomas found_b64_ntop=yes,
337 206be139 2023-03-08 thomas found_b64_ntop=no
339 206be139 2023-03-08 thomas AC_MSG_RESULT($found_b64_ntop)
340 206be139 2023-03-08 thomas libresolv_LIBS="$LIBS"
343 206be139 2023-03-08 thomas AM_CONDITIONAL([HAVE_B64], [test "x$found_b64_ntop" = xyes])
344 206be139 2023-03-08 thomas if test "x$found_b64_ntop" = xyes; then
345 206be139 2023-03-08 thomas AC_DEFINE([HAVE_B64_NTOP], [1], [define if b64_ntop is present])
346 206be139 2023-03-08 thomas AC_SUBST(libresolv_LIBS)
348 206be139 2023-03-08 thomas AC_LIBOBJ(base64)
351 92a9e85d 2021-09-24 thomas # Check the platform we're compiling on.
352 92a9e85d 2021-09-24 thomas AC_MSG_CHECKING(platform)
353 92a9e85d 2021-09-24 thomas case "$host_os" in
355 92a9e85d 2021-09-24 thomas AC_MSG_RESULT(linux)
356 92a9e85d 2021-09-24 thomas PLATFORM=linux
358 92a9e85d 2021-09-24 thomas *freebsd*)
359 92a9e85d 2021-09-24 thomas AC_MSG_RESULT(freebsd)
360 92a9e85d 2021-09-24 thomas PLATFORM=freebsd
362 d24ddaa6 2022-02-26 thomas *darwin*)
363 d24ddaa6 2022-02-26 thomas AC_MSG_RESULT(darwin)
364 d24ddaa6 2022-02-26 thomas PLATFORM=darwin
366 a3732bb6 2022-02-26 thomas *netbsd*)
367 a3732bb6 2022-02-26 thomas AC_MSG_RESULT(netbsd)
368 a3732bb6 2022-02-26 thomas PLATFORM=netbsd
370 01a22331 2023-02-26 thomas *openbsd*)
371 398ba35f 2023-02-26 thomas AC_MSG_RESULT(openbsd)
372 01a22331 2023-02-26 thomas PLATFORM=openbsd
374 b26177ad 2022-03-03 thomas *dragonfly*)
375 b26177ad 2022-03-03 thomas AC_MSG_RESULT(dragonfly)
376 b26177ad 2022-03-03 thomas PLATFORM=dragonflybsd
379 92a9e85d 2021-09-24 thomas AC_MSG_RESULT(unknown)
380 92a9e85d 2021-09-24 thomas PLATFORM=unknown
383 92a9e85d 2021-09-24 thomas AC_SUBST(PLATFORM)
384 92a9e85d 2021-09-24 thomas AM_CONDITIONAL([HOST_FREEBSD], [test "$PLATFORM" = "freebsd"])
385 92a9e85d 2021-09-24 thomas AM_CONDITIONAL([HOST_LINUX], [test "$PLATFORM" = "linux"])
386 d24ddaa6 2022-02-26 thomas AM_CONDITIONAL([HOST_DARWIN], [test "$PLATFORM" = "darwin"])
387 a3732bb6 2022-02-26 thomas AM_CONDITIONAL([HOST_NETBSD], [test "$PLATFORM" = "netbsd"])
388 01a22331 2023-02-26 thomas AM_CONDITIONAL([HOST_OPENBSD], [test "$PLATFORM" = "openbsd"])
389 b26177ad 2022-03-03 thomas AM_CONDITIONAL([HOST_DRAGONFLYBSD], [test "$PLATFORM" = "dragonflybsd"])
391 8cff5e95 2023-03-08 thomas # On OpenBSD, these functions are already defined, yet looking for them in
392 8cff5e95 2023-03-08 thomas # this way on OpenBSD breaks <sha2.h> inclusion.
393 8cff5e95 2023-03-08 thomas # FIXME: this needs addressing.
394 8cff5e95 2023-03-08 thomas if test "x$PLATFORM" != "xopenbsd"; then
395 8cff5e95 2023-03-08 thomas AC_CHECK_FUNCS([ \
396 8cff5e95 2023-03-08 thomas SHA256Update \
397 8cff5e95 2023-03-08 thomas SHA384Update \
398 8cff5e95 2023-03-08 thomas SHA512Update \
402 b29d689b 2023-02-11 thomas # Look for yacc.
403 b29d689b 2023-02-11 thomas if test "YACC_OVERRIDE" = "yes" && test -n "$YACC" \
404 b29d689b 2023-02-11 thomas && ! command -v "$YACC" >/dev/null 2>&1; then
405 b29d689b 2023-02-11 thomas AC_MSG_ERROR("yacc not found: $YACC")
408 51207398 2022-07-21 thomas if test x"$PLATFORM" = "xdarwin"; then
409 5baa5fe2 2022-09-05 thomas # Check for and/or set HOMEBREW_PREFIX. brew is a common way of
410 5baa5fe2 2022-09-05 thomas # installing applications. The other is MacPorts.
412 5baa5fe2 2022-09-05 thomas # Before Apple Silicon existed (M1 onward), the paths for applications
413 5baa5fe2 2022-09-05 thomas # installed via homebrew was typically /usr/local. However, with M1
414 5baa5fe2 2022-09-05 thomas # onward, this changed to a different path.
416 5baa5fe2 2022-09-05 thomas # Rather than hardcode this, check for HOMEBREW_PREFIX in the
417 8e396e19 2022-09-12 thomas # environment if it's already set, and use it. Otherwise, check for
418 5baa5fe2 2022-09-05 thomas # brew(1) and use that. If that fails, default to /usr/local
420 5baa5fe2 2022-09-05 thomas # This also means that MacPorts should continue to work.
422 8e396e19 2022-09-12 thomas # But with MacPorts, we should also check --prefix, and use that if it
423 8e396e19 2022-09-12 thomas # has been supplied.
425 8e396e19 2022-09-12 thomas # In both cases, the variable HOMEBREW_PREFIX is used for both.
426 8e396e19 2022-09-12 thomas HB_PREFIX=""
427 8e396e19 2022-09-12 thomas FOUND_BISON="no"
428 8e396e19 2022-09-12 thomas GNUBISON=""
429 8e396e19 2022-09-12 thomas if test -z "$HOMEBREW_PREFIX" -o "$HOMEBREW_PREFIX" = "NONE"; then
430 5baa5fe2 2022-09-05 thomas # HOMEBREW_PREFIX not set, check for brew(1)
431 8e396e19 2022-09-12 thomas if command -v brew >/dev/null 2>&1; then
432 8e396e19 2022-09-12 thomas AC_MSG_NOTICE("HOMEBREW_PREFIX set via 'brew --prefix'")
433 5baa5fe2 2022-09-05 thomas export HOMEBREW_PREFIX="$(brew --prefix)"
436 8e396e19 2022-09-12 thomas if test -z "$HOMEBREW_PREFIX" -o "$HOMEBREW_PREFIX" = "NONE"
438 5baa5fe2 2022-09-05 thomas # Default.
439 8e396e19 2022-09-12 thomas if test -z "${prefix}" -o "${prefix}" = "NONE"; then
440 8e396e19 2022-09-12 thomas export HOMEBREW_PREFIX="/usr/local"
441 8e396e19 2022-09-12 thomas HB_PREFIX="/usr/local"
442 8e396e19 2022-09-12 thomas AC_MSG_NOTICE("HOMEBREW_PREFIX defaulting to $HB_PREFIX")
444 8e396e19 2022-09-12 thomas HB_PREFIX="$(eval echo ${prefix})"
445 8e396e19 2022-09-12 thomas if test "$HB_PREFIX" = "NONE"; then
446 8e396e19 2022-09-12 thomas HB_PREFIX="/opt/local"
448 8e396e19 2022-09-12 thomas AC_MSG_NOTICE("HOMEBREW_PREFIX using --prefix")
450 8e396e19 2022-09-12 thomas export HOMEBREW_PREFIX="$HB_PREFIX"
455 8e396e19 2022-09-12 thomas AC_MSG_NOTICE("HOMEBREW_PREFIX determined as: $HOMEBREW_PREFIX")
457 b29d689b 2023-02-11 thomas if test "$YACC_OVERRIDE" = "no" && \
458 b29d689b 2023-02-11 thomas ! test -x "${HOMEBREW_PREFIX}/opt/bison/bin/bison"; then
459 8e396e19 2022-09-12 thomas AC_MSG_WARN([
460 8e396e19 2022-09-12 thomas "***********************************************************
461 8e396e19 2022-09-12 thomas GNU Bison not found: ${HOMEBREW_PREFIX}/opt/bison/bin/bison
462 8e396e19 2022-09-12 thomas ***********************************************************
464 8e396e19 2022-09-12 thomas Falling back to checking either /usr/local or \${prefix}"
467 8e396e19 2022-09-12 thomas FOUND_BISON="no"
468 8e396e19 2022-09-12 thomas AC_MSG_WARN("Trying ${HB_PREFIX}/opt/bison/bin/bison")
469 8e396e19 2022-09-12 thomas if test -x "${HB_PREFIX}/opt/bison/bin/bison"; then
470 8e396e19 2022-09-12 thomas export HOMEBREW_PREFIX="/usr/local"
471 8e396e19 2022-09-12 thomas FOUND_BISON="yes"
472 8e396e19 2022-09-12 thomas GNUBISON="${HB_PREFIX}/opt/bison/bin/bison"
475 8e396e19 2022-09-12 thomas if test "$FOUND_BISON" = "no"; then
476 8e396e19 2022-09-12 thomas HB_PREFIX="/opt/local"
477 8e396e19 2022-09-12 thomas AC_MSG_WARN("Trying ${HB_PREFIX}/bin/bison")
479 8e396e19 2022-09-12 thomas if test -x "${HB_PREFIX}/bin/bison"; then
480 8e396e19 2022-09-12 thomas export HOMEBREW_PREFIX="${HB_PREFIX}"
481 8e396e19 2022-09-12 thomas GNUBISON="${HB_PREFIX}/bin/bison"
482 8e396e19 2022-09-12 thomas FOUND_BISON="yes"
486 8e396e19 2022-09-12 thomas FOUND_BISON="yes"
487 8e396e19 2022-09-12 thomas GNUBISON="${HOMEBREW_PREFIX}/opt/bison/bin/bison"
490 b29d689b 2023-02-11 thomas if test "$FOUND_BISON" = "no" && test "$YACC_OVERRIDE" = "no"; then
491 8e396e19 2022-09-12 thomas AC_MSG_ERROR("*** Couldn't find GNU BISON ***")
494 51207398 2022-07-21 thomas # Override YACC here to point to the GNU version of bison.
495 b29d689b 2023-02-11 thomas if test "$YACC_OVERRIDE" = "yes"; then
496 b29d689b 2023-02-11 thomas export YACC="$YACC -y"
498 b29d689b 2023-02-11 thomas AC_MSG_NOTICE("Found GNU Bison as: $GNUBISON")
499 b29d689b 2023-02-11 thomas export YACC="${GNUBISON} -y"
501 8e396e19 2022-09-12 thomas export LDFLAGS="-L${HOMEBREW_PREFIX}/opt/ncurses/lib -L${HOMEBREW_PREFIX}/opt/openssl@3/lib $LDFLAGS"
502 5baa5fe2 2022-09-05 thomas export CPPFLAGS="-I${HOMEBREW_PREFIX}/opt/ncurses/include -I${HOMEBREW_PREFIX}/opt/openssl@3/include $CPPFLAGS"
503 5baa5fe2 2022-09-05 thomas export PKG_CONFIG_PATH="${HOMEBREW_PREFIX}/opt/ncurses/lib/pkgconfig"
504 5baa5fe2 2022-09-05 thomas export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:${HOMEBREW_PREFIX}/opt/openssl@3/lib/pkgconfig"
507 97799ccd 2022-02-06 thomas # Landlock detection.
508 97799ccd 2022-02-06 thomas AC_MSG_CHECKING([for landlock])
509 97799ccd 2022-02-06 thomas AM_CONDITIONAL([HAVE_LINUX_LANDLOCK],
510 97799ccd 2022-02-06 thomas [test "x$ac_cv_header_linux_landlock_h" = "xyes"])
511 97799ccd 2022-02-06 thomas if test "x$ac_cv_header_linux_landlock_h" = "xyes"; then
512 97799ccd 2022-02-06 thomas AC_MSG_RESULT(yes)
514 97799ccd 2022-02-06 thomas AC_MSG_RESULT(no)
517 dd038bc6 2021-09-21 thomas.ad # Clang sanitizers wrap reallocarray even if it isn't available on the target
518 dd038bc6 2021-09-21 thomas.ad # system. When compiled it always returns NULL and crashes the program. To
519 dd038bc6 2021-09-21 thomas.ad # detect this we need a more complicated test.
520 dd038bc6 2021-09-21 thomas.ad AC_MSG_CHECKING([for working reallocarray])
521 dd038bc6 2021-09-21 thomas.ad AC_RUN_IFELSE([AC_LANG_PROGRAM(
522 dd038bc6 2021-09-21 thomas.ad [#include <stdlib.h>],
523 dd038bc6 2021-09-21 thomas.ad [return (reallocarray(NULL, 1, 1) == NULL);]
525 dd038bc6 2021-09-21 thomas.ad AC_MSG_RESULT(yes),
526 7f20c2a8 2022-05-13 op [AC_LIBOBJ(reallocarray) AC_MSG_RESULT([no])],
527 dd038bc6 2021-09-21 thomas.ad [AC_LIBOBJ(reallocarray) AC_MSG_RESULT([no])]
529 dd038bc6 2021-09-21 thomas.ad AC_MSG_CHECKING([for working recallocarray])
530 dd038bc6 2021-09-21 thomas.ad AC_RUN_IFELSE([AC_LANG_PROGRAM(
531 dd038bc6 2021-09-21 thomas.ad [#include <stdlib.h>],
532 dd038bc6 2021-09-21 thomas.ad [return (recallocarray(NULL, 1, 1, 1) == NULL);]
534 dd038bc6 2021-09-21 thomas.ad AC_MSG_RESULT(yes),
535 7f20c2a8 2022-05-13 op [AC_LIBOBJ(recallocarray) AC_MSG_RESULT([no])],
536 dd038bc6 2021-09-21 thomas.ad [AC_LIBOBJ(recallocarray) AC_MSG_RESULT([no])]
539 dd038bc6 2021-09-21 thomas.ad # Look for imsg_init in libutil.
540 dd038bc6 2021-09-21 thomas.ad AC_SEARCH_LIBS(imsg_init, util, found_imsg_init=yes, found_imsg_init=no)
541 f600ad76 2023-01-06 thomas AM_CONDITIONAL([HAVE_IMSG], [test "x$found_imsg_init" = "xyes"])
542 4fccd2fe 2023-03-08 thomas if test "x$found_imsg_init" = "xyes"; then
543 d9b944c7 2023-03-08 thomas AC_DEFINE([HAVE_IMSG], [1], [Define to 1 if imsg is declared in libutil])
544 4fccd2fe 2023-03-08 thomas libutil_LIBS="$ac_cv_search_imsg_init"
545 4fccd2fe 2023-03-08 thomas AC_SUBST(libutil_LIBS)
548 ff36aeea 2022-07-16 thomas # libevent (for gotwebd). Lifted from tmux.
549 ff36aeea 2022-07-16 thomas # Look for libevent. Try libevent_core or libevent with pkg-config first then
550 ff36aeea 2022-07-16 thomas # look for the library.
551 4fccd2fe 2023-03-08 thomas found_libevent=no
552 ff36aeea 2022-07-16 thomas PKG_CHECK_MODULES(
553 ff36aeea 2022-07-16 thomas LIBEVENT_CORE,
554 ff36aeea 2022-07-16 thomas [libevent_core >= 2],
556 4fccd2fe 2023-03-08 thomas libevent_CFLAGS="$LIBEVENT_CORE_CFLAGS"
557 4fccd2fe 2023-03-08 thomas libevent_LIBS="$LIBEVENT_CORE_LIBS"
558 4fccd2fe 2023-03-08 thomas AC_SUBST(libevent_CFLAGS)
559 4fccd2fe 2023-03-08 thomas AC_SUBST(libevent_LIBS)
560 ff36aeea 2022-07-16 thomas found_libevent=yes
562 ff36aeea 2022-07-16 thomas found_libevent=no
564 ff36aeea 2022-07-16 thomas if test x$found_libevent = xno; then
565 ff36aeea 2022-07-16 thomas PKG_CHECK_MODULES(
566 ff36aeea 2022-07-16 thomas LIBEVENT,
567 ff36aeea 2022-07-16 thomas [libevent >= 2],
569 4fccd2fe 2023-03-08 thomas libevent_CFLAGS="$LIBEVENT_CFLAGS"
570 4fccd2fe 2023-03-08 thomas libevent_LIBS="$LIBEVENT_LIBS"
571 4fccd2fe 2023-03-08 thomas AC_SUBST(libevent_CFLAGS)
572 4fccd2fe 2023-03-08 thomas AC_SUBST(libevent_LIBS)
573 ff36aeea 2022-07-16 thomas found_libevent=yes
575 ff36aeea 2022-07-16 thomas found_libevent=no
578 ff36aeea 2022-07-16 thomas if test x$found_libevent = xno; then
579 ff36aeea 2022-07-16 thomas AC_SEARCH_LIBS(
580 ff36aeea 2022-07-16 thomas event_init,
581 ff36aeea 2022-07-16 thomas [event_core event event-1.4],
582 ff36aeea 2022-07-16 thomas found_libevent=yes,
583 ff36aeea 2022-07-16 thomas found_libevent=no
586 4fccd2fe 2023-03-08 thomas if test "x$found_libevent" = "xyes"; then
587 4fccd2fe 2023-03-08 thomas libevent_LIBS="$ac_cv_search_event_init"
588 4fccd2fe 2023-03-08 thomas AC_SUBST(libevent_LIBS)
592 4fccd2fe 2023-03-08 thomas if test x$found_libevent = xno; then
593 ff36aeea 2022-07-16 thomas AC_CHECK_HEADER(
594 ff36aeea 2022-07-16 thomas event2/event.h,
595 47dc83f5 2023-03-08 thomas AC_DEFINE([HAVE_EVENT2_EVENT_H], [1], [libevent2 has event.h]),
597 ff36aeea 2022-07-16 thomas AC_CHECK_HEADER(
599 47dc83f5 2023-03-08 thomas AC_DEFINE([HAVE_EVENT_H], [0], [libevent]),
600 ff36aeea 2022-07-16 thomas found_libevent=no
606 ff36aeea 2022-07-16 thomas if test "x$found_libevent" = xno; then
607 ff36aeea 2022-07-16 thomas AC_MSG_ERROR("libevent not found")
610 4fccd2fe 2023-03-08 thomas AC_CHECK_FUNC([uuid_create], [found_uuid=yes], [found_uuid=no])
612 d24ddaa6 2022-02-26 thomas # Don't define HAVE_BSD_UUID on darwin (Apple) as this breaks the BSD API.
613 d24ddaa6 2022-02-26 thomas # Instead, use the UUID implementation wrapper that's in compat/ plus uuid
615 d24ddaa6 2022-02-26 thomas if test "x$found_uuid" = "xyes" -a "x$PLATFORM" != "darwin"; then
616 47dc83f5 2023-03-08 thomas AC_DEFINE([HAVE_BSD_UUID], [1], [BSD UUID])
618 326237a6 2021-09-25 thomas PKG_CHECK_MODULES(
622 4fccd2fe 2023-03-08 thomas libuuid_CFLAGS="$LIBUUID_CFLAGS"
623 4fccd2fe 2023-03-08 thomas libuuid_LIBS="$LIBUUID_LIBS"
624 4fccd2fe 2023-03-08 thomas AC_SUBST(libuuid_CFLAGS)
625 4fccd2fe 2023-03-08 thomas AC_SUBST(libuuid_LIBS)
626 326237a6 2021-09-25 thomas found_libuuid=yes
629 326237a6 2021-09-25 thomas found_libuuid=no
633 326237a6 2021-09-25 thomas if test "x$found_libuuid" = "xno"; then
634 326237a6 2021-09-25 thomas AC_CHECK_HEADER(
636 326237a6 2021-09-25 thomas found_libuuid=yes,
637 326237a6 2021-09-25 thomas found_libuuid=no)
641 92a9e85d 2021-09-24 thomas if test "x$found_libuuid" = "xno"; then
642 92a9e85d 2021-09-24 thomas AC_MSG_ERROR("*** couldn't find uuid ***")
645 dd038bc6 2021-09-21 thomas.ad PKG_CHECK_MODULES(
649 4fccd2fe 2023-03-08 thomas zlib_CFLAGS="$ZLIB_CFLAGS"
650 4fccd2fe 2023-03-08 thomas zlib_LIBS="$ZLIB_LIBS"
651 4fccd2fe 2023-03-08 thomas AC_SUBST(zlib_CFLAGS)
652 4fccd2fe 2023-03-08 thomas AC_SUBST(zlib_LIBS)
653 dd038bc6 2021-09-21 thomas.ad found_zlib=yes
656 92a9e85d 2021-09-24 thomas found_zlib=no
660 92a9e85d 2021-09-24 thomas if test "x$found_zlib" = "xno"; then
661 92a9e85d 2021-09-24 thomas AC_CHECK_HEADER(
664 92a9e85d 2021-09-24 thomas found_zlib=no)
667 92a9e85d 2021-09-24 thomas if test "x$found_zlib" = "xno"; then
668 92a9e85d 2021-09-24 thomas AC_MSG_ERROR("*** couldn't find zlib ***")
671 92a9e85d 2021-09-24 thomas if test "$PLATFORM" = "linux"; then
672 92a9e85d 2021-09-24 thomas PKG_CHECK_MODULES(
674 92a9e85d 2021-09-24 thomas libbsd-overlay,
676 4fccd2fe 2023-03-08 thomas libbsd_CFLAGS="$LIBBSD_CFLAGS"
677 4fccd2fe 2023-03-08 thomas libbsd_LIBS="$LIBBSD_LIBS"
678 4fccd2fe 2023-03-08 thomas AC_SUBST(libbsd_CFLAGS)
679 4fccd2fe 2023-03-08 thomas AC_SUBST(libbsd_LIBS)
680 47dc83f5 2023-03-08 thomas AC_DEFINE([HAVE_LIBBSD], [1], [BSD UUID])
683 46384c6e 2022-09-13 thomas AC_MSG_ERROR("*** couldn't find libbsd-overlay via pkg-config")
688 4fccd2fe 2023-03-08 thomas # Add LIBBSD_{CFLAGS,LIBS} to the environment here, as libbsd puts its
689 4fccd2fe 2023-03-08 thomas # header files in a non-standard location, which means the overlay for
690 4fccd2fe 2023-03-08 thomas # <sys/tree.h> and <sys/queue.h> won't be found.
691 4fccd2fe 2023-03-08 thomas CFLAGS="$CFLAGS $LIBBSD_CFLAGS"
692 4fccd2fe 2023-03-08 thomas LIBS="$LIBS $LIBBSD_LIBS"
694 5007bd0d 2023-04-14 thomas PKG_CHECK_MODULES(
698 5007bd0d 2023-04-14 thomas libmd_CFLAGS="$LIBMD_CFLAGS"
699 5007bd0d 2023-04-14 thomas libmd_LIBS="$LIBMD_LIBS"
700 5007bd0d 2023-04-14 thomas AC_SUBST(libmd_CFLAGS)
701 5007bd0d 2023-04-14 thomas AC_SUBST(libmd_LIBS)
704 5007bd0d 2023-04-14 thomas CFLAGS="$CFLAGS $LIBMD_CFLAGS"
705 5007bd0d 2023-04-14 thomas LIBS="$LIBS $LIBMD_LIBS"
709 dd038bc6 2021-09-21 thomas.ad # Look for a suitable queue.h. We hope libbsd is enough, but that is missing
710 8dbd2d50 2022-08-12 thomas # some declarations.
711 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
712 dd038bc6 2021-09-21 thomas.ad TAILQ_CONCAT,
713 dd038bc6 2021-09-21 thomas.ad found_queue_h=yes,
714 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
715 8dbd2d50 2022-08-12 thomas [#include <sys/queue.h>]
717 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
718 dd038bc6 2021-09-21 thomas.ad TAILQ_PREV,
720 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
721 8dbd2d50 2022-08-12 thomas [#include <sys/queue.h>]
723 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
724 dd038bc6 2021-09-21 thomas.ad TAILQ_FOREACH_SAFE,
726 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
727 8dbd2d50 2022-08-12 thomas [#include <sys/queue.h>]
730 8dbd2d50 2022-08-12 thomas if test "x$found_queue_h" = xyes; then
731 47dc83f5 2023-03-08 thomas AC_DEFINE([HAVE_QUEUE_H], [1], [sys/queue.h])
733 46384c6e 2022-09-13 thomas AC_MSG_ERROR("*** sys/queue.h missing key defines ***)
736 c59427c5 2022-10-13 thomas AC_CHECK_DECL(
737 c59427c5 2022-10-13 thomas RB_GENERATE_STATIC,
738 c59427c5 2022-10-13 thomas found_sys_tree_h=yes,
739 c59427c5 2022-10-13 thomas found_sys_tree_h=no,
740 c59427c5 2022-10-13 thomas [#include <sys/tree.h>]
743 c59427c5 2022-10-13 thomas if test "x$found_sys_tree_h" = xyes; then
744 47dc83f5 2023-03-08 thomas AC_DEFINE([HAVE_TREE_H], [1], [sys/tree.h])
746 c59427c5 2022-10-13 thomas AC_MSG_NOTICE("Using compat/tree.h")
749 dd038bc6 2021-09-21 thomas.ad # Look for __progname.
750 dd038bc6 2021-09-21 thomas.ad AC_MSG_CHECKING(for __progname)
751 dd038bc6 2021-09-21 thomas.ad AC_LINK_IFELSE([AC_LANG_SOURCE(
753 dd038bc6 2021-09-21 thomas.ad #include <stdio.h>
754 dd038bc6 2021-09-21 thomas.ad #include <stdlib.h>
755 dd038bc6 2021-09-21 thomas.ad extern char *__progname;
756 dd038bc6 2021-09-21 thomas.ad int main(void) {
757 dd038bc6 2021-09-21 thomas.ad const char *cp = __progname;
758 dd038bc6 2021-09-21 thomas.ad printf("%s\n", cp);
759 dd038bc6 2021-09-21 thomas.ad exit(0);
762 47dc83f5 2023-03-08 thomas [AC_DEFINE([HAVE___PROGNAME], [1], [___progname]) AC_MSG_RESULT(yes)],
763 47dc83f5 2023-03-08 thomas [AC_MSG_RESULT(no)]
766 d9e4d43f 2022-03-03 thomas PKG_CHECK_MODULES(
767 d9e4d43f 2022-03-03 thomas LIBPANELW,
769 d3f1e38b 2023-03-08 thomas LIBPANELW_LIBS="$LIBPANELW_LIBS"
770 d9e4d43f 2022-03-03 thomas found_panel=yes,
771 d9e4d43f 2022-03-03 thomas found_panel=no
774 d3f1e38b 2023-03-08 thomas if test "x$found_panel" = "xno"; then
775 d9e4d43f 2022-03-03 thomas PKG_CHECK_MODULES(
776 d9e4d43f 2022-03-03 thomas LIBPANELW,
777 d9e4d43f 2022-03-03 thomas gnupanelw,
779 d3f1e38b 2023-03-08 thomas LIBPANELW_LIBS="$LIBPANELW_LIBS"
780 d3f1e38b 2023-03-08 thomas found_panel=yes
782 d9e4d43f 2022-03-03 thomas found_panel=no
786 d3f1e38b 2023-03-08 thomas if test "x$found_panel" = "xno"; then
787 b26177ad 2022-03-03 thomas PKG_CHECK_MODULES(
788 b26177ad 2022-03-03 thomas LIBPANELW,
791 d3f1e38b 2023-03-08 thomas LIBPANELW_LIBS="$LIBPANELW_LIBS"
792 d3f1e38b 2023-03-08 thomas found_panel=yes
794 b26177ad 2022-03-03 thomas found_panel=no
798 d9e4d43f 2022-03-03 thomas if test "x$found_panel" = "xno"; then
799 947fe78c 2023-01-06 thomas AC_CHECK_LIB(panelw, update_panels, [],
800 947fe78c 2023-01-06 thomas AC_MSG_ERROR([ "*** panelw not found for ncurses. ***"]),
801 947fe78c 2023-01-06 thomas [-lncurses]
806 acf52a76 2021-09-21 thomas.ad PKG_CHECK_MODULES(
807 acf52a76 2021-09-21 thomas.ad LIBNCURSES,
808 acf52a76 2021-09-21 thomas.ad ncursesw,
809 dd038bc6 2021-09-21 thomas.ad found_ncurses=yes,
810 dd038bc6 2021-09-21 thomas.ad found_ncurses=no
812 acf52a76 2021-09-21 thomas.ad if test "x$found_ncurses" = xyes; then
813 4fccd2fe 2023-03-08 thomas libncurses_CFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $LIBPANELW_CFLAGS"
814 4fccd2fe 2023-03-08 thomas libncurses_LIBS="$LIBNCURSES_LIBS $LIBTINFO_LIBS $LIBPANELW_LIBS"
815 4fccd2fe 2023-03-08 thomas AC_SUBST(libncurses_CFLAGS)
816 4fccd2fe 2023-03-08 thomas AC_SUBST(libncurses_LIBS)
818 4fccd2fe 2023-03-08 thomas AC_SEARCH_LIBS(
819 dd038bc6 2021-09-21 thomas.ad setupterm,
820 dd038bc6 2021-09-21 thomas.ad found_ncurses=yes,
821 dd038bc6 2021-09-21 thomas.ad found_ncurses=no
823 dd038bc6 2021-09-21 thomas.ad if test "x$found_ncurses" = xyes; then
824 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADER(
825 dd038bc6 2021-09-21 thomas.ad ncurses.h,
826 4fccd2fe 2023-03-08 thomas libncurses_CFLAGS="$LIBPANELW_CFLAGS $LIBPANEL_CFLAGS"
827 4fccd2fe 2023-03-08 thomas libncurses_LIBS="$LIBPANELW_LIBS -lncursesw"
828 4fccd2fe 2023-03-08 thomas AC_SUBST(libncurses_CFLAGS)
829 4fccd2fe 2023-03-08 thomas AC_SUBST(libncurses_LIBS)
833 dd038bc6 2021-09-21 thomas.ad if test "x$found_ncurses" = xyes; then
834 47dc83f5 2023-03-08 thomas AC_DEFINE([HAVE_NCURSES_H], [1], [NCurses])
836 dd038bc6 2021-09-21 thomas.ad # No ncurses, try curses.
837 4fccd2fe 2023-03-08 thomas AC_CHECK_FUNC(
838 dd038bc6 2021-09-21 thomas.ad setupterm,
839 dd038bc6 2021-09-21 thomas.ad found_curses=yes,
840 dd038bc6 2021-09-21 thomas.ad found_curses=no
842 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADER(
843 dd038bc6 2021-09-21 thomas.ad curses.h,
844 4fccd2fe 2023-03-08 thomas found_curses=yes,
845 dd038bc6 2021-09-21 thomas.ad found_curses=no)
846 dd038bc6 2021-09-21 thomas.ad if test "x$found_curses" = xyes; then
847 4fccd2fe 2023-03-08 thomas libncurses_CFLAGS="$LIBPANELW_CFLAGS $LIBPANEL_CFLAGS"
848 d3f1e38b 2023-03-08 thomas libncurses_LIBS="$LIBPANELW_LIBS -lncursesw -lpanelw"
849 4fccd2fe 2023-03-08 thomas AC_SUBST(libncurses_CFLAGS)
850 4fccd2fe 2023-03-08 thomas AC_SUBST(libncurses_LIBS)
851 47dc83f5 2023-03-08 thomas AC_DEFINE([HAVE_CURSES_H], [1], [Curses_h])
853 dd038bc6 2021-09-21 thomas.ad AC_MSG_ERROR("curses not found")
857 dd038bc6 2021-09-21 thomas.ad # Save our CFLAGS/CPPFLAGS/LDFLAGS for the Makefile and restore the old user
858 dd038bc6 2021-09-21 thomas.ad # variables.
859 dd038bc6 2021-09-21 thomas.ad AC_SUBST(AM_CPPFLAGS)
860 dd038bc6 2021-09-21 thomas.ad CPPFLAGS="$SAVED_CPPFLAGS"
861 dd038bc6 2021-09-21 thomas.ad AC_SUBST(AM_CFLAGS)
862 dd038bc6 2021-09-21 thomas.ad CFLAGS="$SAVED_CFLAGS"
863 dd038bc6 2021-09-21 thomas.ad AC_SUBST(AM_LDFLAGS)
864 dd038bc6 2021-09-21 thomas.ad LDFLAGS="$SAVED_LDFLAGS"
866 943e9ed2 2023-03-08 thomas # LIBS is designed to accumulate library dependencies as checks for them are
867 943e9ed2 2023-03-08 thomas # peformed, so that this can be included directly to ld(1).
869 943e9ed2 2023-03-08 thomas # However, this hinders the splitting up of the library dependencies so that
870 943e9ed2 2023-03-08 thomas # they're targetted just where they're needed. Flatting LIBS here ensures
871 943e9ed2 2023-03-08 thomas # that this happens appropriately.
874 47dc83f5 2023-03-08 thomas AH_BOTTOM([#include "got_compat2.h"])
876 dd038bc6 2021-09-21 thomas.ad AC_CONFIG_FILES([Makefile
877 dd038bc6 2021-09-21 thomas.ad compat/Makefile
878 dd038bc6 2021-09-21 thomas.ad libexec/Makefile
879 dd038bc6 2021-09-21 thomas.ad libexec/got-read-tree/Makefile
880 dd038bc6 2021-09-21 thomas.ad libexec/got-fetch-pack/Makefile
881 dd038bc6 2021-09-21 thomas.ad libexec/got-index-pack/Makefile
882 dd038bc6 2021-09-21 thomas.ad libexec/got-read-blob/Makefile
883 dd038bc6 2021-09-21 thomas.ad libexec/got-read-commit/Makefile
884 dd038bc6 2021-09-21 thomas.ad libexec/got-read-gitconfig/Makefile
885 dd038bc6 2021-09-21 thomas.ad libexec/got-read-gotconfig/Makefile
886 dd038bc6 2021-09-21 thomas.ad libexec/got-read-object/Makefile
887 dd038bc6 2021-09-21 thomas.ad libexec/got-read-pack/Makefile
888 973f3f6e 2022-03-07 thomas libexec/got-read-patch/Makefile
889 dd038bc6 2021-09-21 thomas.ad libexec/got-read-tag/Makefile
890 dd038bc6 2021-09-21 thomas.ad libexec/got-send-pack/Makefile
891 dd038bc6 2021-09-21 thomas.ad got/Makefile
892 2b0eee35 2021-09-21 thomas.ad gotadmin/Makefile
893 ff36aeea 2022-07-16 thomas gotwebd/Makefile
894 d3f2ad5e 2021-09-21 thomas.ad tog/Makefile
895 5a7ef102 2021-10-09 thomas Makefile.common:Makefile.common.in])
896 dd038bc6 2021-09-21 thomas.ad AC_OUTPUT
898 9ffe20fd 2022-09-10 thomas executables="$(eval echo ${exec_prefix}/bin)"
899 9ffe20fd 2022-09-10 thomas helpers="$(eval echo ${libexecdir})"
900 9ffe20fd 2022-09-10 thomas manpages="$(eval echo ${mandir})"
903 9ffe20fd 2022-09-10 thomas Configured got-portable with:
905 9ffe20fd 2022-09-10 thomas Version: $VERSION
907 9ffe20fd 2022-09-10 thomas Prefix: ${prefix}
908 9ffe20fd 2022-09-10 thomas Executables: ${executables}
909 b29d689b 2023-02-11 thomas Bison: $YACC
910 4fccd2fe 2023-03-08 thomas CFlags: $CFLAGS
911 9ffe20fd 2022-09-10 thomas Helpers: ${helpers}
912 9ffe20fd 2022-09-10 thomas Man pages: ${manpages}