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])
24 2f1efc18 2023-08-29 thomas AC_ARG_ENABLE([gotd],
25 2f1efc18 2023-08-29 thomas AS_HELP_STRING([--enable gotd], [build gotd and gotsh]))
27 dd038bc6 2021-09-21 thomas.ad # When CFLAGS isn't set at this stage and gcc is detected by the macro below,
28 dd038bc6 2021-09-21 thomas.ad # autoconf will automatically use CFLAGS="-O2 -g". Prevent that by using an
29 dd038bc6 2021-09-21 thomas.ad # empty default.
30 dd038bc6 2021-09-21 thomas.ad : ${CFLAGS=""}
32 dd038bc6 2021-09-21 thomas.ad # Save user CPPFLAGS, CFLAGS and LDFLAGS. We need to change them because
33 dd038bc6 2021-09-21 thomas.ad # AC_CHECK_HEADER doesn't give us any other way to update the include
34 dd038bc6 2021-09-21 thomas.ad # paths. But for Makefile.am we want to use AM_CPPFLAGS and friends.
35 dd038bc6 2021-09-21 thomas.ad SAVED_CFLAGS="$CFLAGS"
36 dd038bc6 2021-09-21 thomas.ad SAVED_CPPFLAGS="$CPPFLAGS"
37 dd038bc6 2021-09-21 thomas.ad SAVED_LDFLAGS="$LDFLAGS"
39 b29d689b 2023-02-11 thomas # YACC override
40 b29d689b 2023-02-11 thomas YACC_OVERRIDE="yes"
42 dd038bc6 2021-09-21 thomas.ad # Checks for programs.
43 dd038bc6 2021-09-21 thomas.ad AC_PROG_CC
44 dd038bc6 2021-09-21 thomas.ad AC_PROG_CPP
45 dd038bc6 2021-09-21 thomas.ad AC_PROG_INSTALL
46 dd038bc6 2021-09-21 thomas.ad AC_PROG_LN_S
47 dd038bc6 2021-09-21 thomas.ad AC_PROG_MAKE_SET
48 b29d689b 2023-02-11 thomas if test -z "$YACC"; then
49 b29d689b 2023-02-11 thomas YACC_OVERRIDE="no"
50 dd038bc6 2021-09-21 thomas.ad AC_PROG_YACC
52 47e5cb11 2022-11-05 thomas AM_PROG_AR
53 dd038bc6 2021-09-21 thomas.ad AC_PROG_RANLIB
54 dd038bc6 2021-09-21 thomas.ad PKG_PROG_PKG_CONFIG
56 b29d689b 2023-02-11 thomas if test "$YACC_OVERRIDE" = "yes"; then
57 b29d689b 2023-02-11 thomas AC_MSG_NOTICE("Using YACC set from environment: $YACC")
60 dd038bc6 2021-09-21 thomas.ad # Checks for header files.
61 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADERS([ \
62 dd038bc6 2021-09-21 thomas.ad fcntl.h \
63 8d60d668 2023-03-16 thomas getopt.h \
64 dd038bc6 2021-09-21 thomas.ad langinfo.h \
65 d9b944c7 2023-03-08 thomas libutil.h \
66 dd038bc6 2021-09-21 thomas.ad limits.h \
67 97799ccd 2022-02-06 thomas linux/landlock.h \
68 dd038bc6 2021-09-21 thomas.ad locale.h \
69 dd038bc6 2021-09-21 thomas.ad netdb.h \
70 dd038bc6 2021-09-21 thomas.ad netinet/in.h \
71 dd038bc6 2021-09-21 thomas.ad paths.h \
76 98670ba7 2023-02-23 thomas sha256.h \
77 dd038bc6 2021-09-21 thomas.ad stddef.h \
78 dd038bc6 2021-09-21 thomas.ad stdint.h \
79 dd038bc6 2021-09-21 thomas.ad stdlib.h \
80 dd038bc6 2021-09-21 thomas.ad string.h \
81 dd038bc6 2021-09-21 thomas.ad sys/ioctl.h \
82 dd038bc6 2021-09-21 thomas.ad sys/param.h \
83 d24ddaa6 2022-02-26 thomas sys/poll.h \
84 19467d59 2022-07-16 thomas sys/queue.h \
85 d9b944c7 2023-03-08 thomas sys/select.h \
86 dd038bc6 2021-09-21 thomas.ad sys/socket.h \
87 dd038bc6 2021-09-21 thomas.ad sys/time.h \
88 dd038bc6 2021-09-21 thomas.ad sys/tree.h \
89 dd038bc6 2021-09-21 thomas.ad util.h \
90 dd038bc6 2021-09-21 thomas.ad unistd.h \
91 dd038bc6 2021-09-21 thomas.ad wchar.h \
94 d9b944c7 2023-03-08 thomas AC_HEADER_DIRENT
95 d9b944c7 2023-03-08 thomas AC_CHECK_DECL([F_CLOSEM],
96 d9b944c7 2023-03-08 thomas HAVE_FCNTL_CLOSEM
97 d9b944c7 2023-03-08 thomas AC_DEFINE([HAVE_FCNTL_CLOSEM], [1],
98 d9b944c7 2023-03-08 thomas [Use F_CLOSEM fcntl for closefrom]),
100 d9b944c7 2023-03-08 thomas [#include <limits.h>
101 d9b944c7 2023-03-08 thomas #include <fcntl.h>
105 d9b944c7 2023-03-08 thomas AC_MSG_CHECKING([for /proc/pid/fd directory])
106 d9b944c7 2023-03-08 thomas if test -d "/proc/$$/fd" ; then
107 d9b944c7 2023-03-08 thomas AC_DEFINE([HAVE_PROC_PID], [1], [Define if you have /proc/$pid/fd])
108 d9b944c7 2023-03-08 thomas AC_MSG_RESULT([yes])
110 d9b944c7 2023-03-08 thomas AC_MSG_RESULT([no])
113 d9b944c7 2023-03-08 thomas AC_MSG_CHECKING([whether program_invocation_short_name is defined])
114 d9b944c7 2023-03-08 thomas AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
115 d9b944c7 2023-03-08 thomas #include <argp.h>
117 d9b944c7 2023-03-08 thomas program_invocation_short_name = "test";
119 d9b944c7 2023-03-08 thomas AC_MSG_RESULT([yes])
120 d9b944c7 2023-03-08 thomas AC_DEFINE([HAVE_PROGRAM_INVOCATION_SHORT_NAME], [1],
121 d9b944c7 2023-03-08 thomas [Define if program_invocation_short_name is defined])
123 d9b944c7 2023-03-08 thomas AC_MSG_RESULT([no])
126 d9b944c7 2023-03-08 thomas # Look for prctl(PR_SET_NAME).
127 d9b944c7 2023-03-08 thomas AC_CHECK_DECL(
128 d9b944c7 2023-03-08 thomas [PR_SET_NAME],
129 d9b944c7 2023-03-08 thomas [AC_DEFINE([HAVE_PR_SET_NAME], [1], [Define if PR_SET_NAME is defined])],
131 d9b944c7 2023-03-08 thomas [#include <sys/prctl.h>]
134 b1ec8cee 2023-02-25 thomas AM_CONDITIONAL([HAVE_SHA2], [test "x$ac_cv_header_sha2_h" = xyes])
136 8d60d668 2023-03-16 thomas AC_CACHE_CHECK([whether getopt has optreset support],
137 8d60d668 2023-03-16 thomas ac_cv_have_getopt_optreset, [
138 8d60d668 2023-03-16 thomas AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <getopt.h> ]],
139 8d60d668 2023-03-16 thomas [[ extern int optreset; optreset = 0; ]])],
140 8d60d668 2023-03-16 thomas [ ac_cv_have_getopt_optreset="yes" ],
141 8d60d668 2023-03-16 thomas [ ac_cv_have_getopt_optreset="no"
145 8d60d668 2023-03-16 thomas AM_CONDITIONAL([HAVE_GETOPT], [test "x$ac_cv_have_getopt_optreset" = "xyes"])
146 8d60d668 2023-03-16 thomas if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
147 8d60d668 2023-03-16 thomas AC_DEFINE([HAVE_GETOPT_OPTRESET], [1],
148 8d60d668 2023-03-16 thomas [Define if your getopt(3) defines and uses optreset])
151 d9b944c7 2023-03-08 thomas AC_CHECK_MEMBERS([struct pollfd.fd], [], [], [[
152 d9b944c7 2023-03-08 thomas #include <sys/types.h>
153 d9b944c7 2023-03-08 thomas #ifdef HAVE_POLL_H
154 d9b944c7 2023-03-08 thomas #include <poll.h>
156 d9b944c7 2023-03-08 thomas #ifdef HAVE_SYS_POLL_H
157 d9b944c7 2023-03-08 thomas #include <sys/poll.h>
161 dd038bc6 2021-09-21 thomas.ad # Checks for typ edefs, structures, and compiler characteristics.
162 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADER_STDBOOL
163 dd038bc6 2021-09-21 thomas.ad AC_C_INLINE
164 dd038bc6 2021-09-21 thomas.ad AC_TYPE_INT64_T
165 dd038bc6 2021-09-21 thomas.ad AC_TYPE_MODE_T
166 dd038bc6 2021-09-21 thomas.ad AC_TYPE_OFF_T
167 dd038bc6 2021-09-21 thomas.ad AC_TYPE_PID_T
168 dd038bc6 2021-09-21 thomas.ad AC_TYPE_SIZE_T
169 dd038bc6 2021-09-21 thomas.ad AC_TYPE_SSIZE_T
170 dd038bc6 2021-09-21 thomas.ad AC_TYPE_UINT16_T
171 dd038bc6 2021-09-21 thomas.ad AC_TYPE_UINT32_T
172 dd038bc6 2021-09-21 thomas.ad AC_TYPE_UINT64_T
173 dd038bc6 2021-09-21 thomas.ad AC_TYPE_UINT8_T
175 ff36aeea 2022-07-16 thomas # Check for ifgroupreq which is only available on BSD.
176 ff36aeea 2022-07-16 thomas AC_CHECK_TYPES([struct ifgroupreq])
178 75716fd6 2022-08-27 thomas # Check for sockaddr_storage. On some systems, ss_len is filled out, although
179 75716fd6 2022-08-27 thomas # this is not mandated by POSIX, and hence systems such as linux, don't have
181 75716fd6 2022-08-27 thomas AC_CHECK_TYPES([struct sockaddr_storage], [], [], [
182 75716fd6 2022-08-27 thomas #include <sys/types.h>
183 75716fd6 2022-08-27 thomas #include <sys/socket.h>
186 75716fd6 2022-08-27 thomas # Same thing as sockaddr_storage above, only now check if the member exists in
187 75716fd6 2022-08-27 thomas # the struct as well.
188 75716fd6 2022-08-27 thomas AC_CHECK_MEMBERS([struct sockaddr_storage.ss_len], , ,
189 75716fd6 2022-08-27 thomas [ #include <netdb.h>
190 75716fd6 2022-08-27 thomas #include <netinet/in.h>
191 75716fd6 2022-08-27 thomas #include <sys/socket.h> ]
194 75716fd6 2022-08-27 thomas AC_CHECK_MEMBERS([struct sockaddr.sa_len], , ,
195 75716fd6 2022-08-27 thomas [ #include <netdb.h>
196 75716fd6 2022-08-27 thomas #include <netinet/in.h>
197 75716fd6 2022-08-27 thomas #include <sys/socket.h> ]
200 75716fd6 2022-08-27 thomas # Both checks above will result in:
202 75716fd6 2022-08-27 thomas # HAVE_STRUCT_SOCKADDR_AS_LEN
205 75716fd6 2022-08-27 thomas # Either being defined or not.
207 dd038bc6 2021-09-21 thomas.ad # Look for library needed for flock.
208 dd038bc6 2021-09-21 thomas.ad AC_SEARCH_LIBS(flock, bsd)
210 dd038bc6 2021-09-21 thomas.ad # Checks for library functions.
211 dd038bc6 2021-09-21 thomas.ad AC_FUNC_FORK
212 dd038bc6 2021-09-21 thomas.ad AC_FUNC_FSEEKO
213 dd038bc6 2021-09-21 thomas.ad AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
214 dd038bc6 2021-09-21 thomas.ad AC_FUNC_MALLOC
215 dd038bc6 2021-09-21 thomas.ad AC_FUNC_MMAP
216 dd038bc6 2021-09-21 thomas.ad AC_FUNC_REALLOC
217 dd038bc6 2021-09-21 thomas.ad AC_FUNC_STRERROR_R
218 dd038bc6 2021-09-21 thomas.ad AC_FUNC_STRNLEN
219 dd038bc6 2021-09-21 thomas.ad AC_CHECK_FUNCS([ \
220 dd038bc6 2021-09-21 thomas.ad dup2 \
221 dd038bc6 2021-09-21 thomas.ad flock \
222 dd038bc6 2021-09-21 thomas.ad getcwd \
223 dd038bc6 2021-09-21 thomas.ad localtime_r \
224 dd038bc6 2021-09-21 thomas.ad memchr \
225 dd038bc6 2021-09-21 thomas.ad memmove \
226 dd038bc6 2021-09-21 thomas.ad memset \
227 4fccd2fe 2023-03-08 thomas mergesort \
228 dd038bc6 2021-09-21 thomas.ad mkdir \
229 dd038bc6 2021-09-21 thomas.ad munmap \
230 dd038bc6 2021-09-21 thomas.ad nl_langinfo \
231 dd038bc6 2021-09-21 thomas.ad realpath \
232 dd038bc6 2021-09-21 thomas.ad regcomp \
233 dd038bc6 2021-09-21 thomas.ad rmdir \
234 dd038bc6 2021-09-21 thomas.ad setlocale \
235 dd038bc6 2021-09-21 thomas.ad socket \
236 683ec58e 2022-07-16 thomas setresgid \
237 683ec58e 2022-07-16 thomas setresuid \
238 c4e2e0d0 2022-07-16 thomas setproctitle \
239 dd038bc6 2021-09-21 thomas.ad strcasecmp \
240 dd038bc6 2021-09-21 thomas.ad strchr \
241 dd038bc6 2021-09-21 thomas.ad strcspn \
242 dd038bc6 2021-09-21 thomas.ad strdup \
243 dd038bc6 2021-09-21 thomas.ad strerror \
244 dd038bc6 2021-09-21 thomas.ad strncasecmp \
245 dd038bc6 2021-09-21 thomas.ad strndup \
246 dd038bc6 2021-09-21 thomas.ad strrchr \
247 dd038bc6 2021-09-21 thomas.ad strspn \
248 dd038bc6 2021-09-21 thomas.ad strstr \
249 dd038bc6 2021-09-21 thomas.ad strtol \
250 dd038bc6 2021-09-21 thomas.ad strtoul \
251 d9b944c7 2023-03-08 thomas sysconf \
252 dd038bc6 2021-09-21 thomas.ad wcwidth \
255 c4e2e0d0 2022-07-16 thomas AM_CONDITIONAL([HAVE_SETPROCTITLE], [test "x$ac_cv_func_setproctitle" = xyes])
257 d9b944c7 2023-03-08 thomas if test "x$ac_cv_func_sysconf" = xyes; then
258 d9b944c7 2023-03-08 thomas AC_DEFINE([HAVE_SYSCONF], [1], [Define to 1 if sysconf() present])
261 ddd12270 2022-04-22 thomas # Siphash support.
262 ddd12270 2022-04-22 thomas AC_CHECK_FUNCS([SipHash])
263 ddd12270 2022-04-22 thomas AM_CONDITIONAL([HAVE_SIPHASH], [test "x$ac_cv_func_SipHash" = xyes])
265 dd038bc6 2021-09-21 thomas.ad # Check for functions with a compatibility implementation.
266 dd038bc6 2021-09-21 thomas.ad AC_REPLACE_FUNCS([ \
267 dd038bc6 2021-09-21 thomas.ad asprintf \
268 dd038bc6 2021-09-21 thomas.ad closefrom \
269 dd038bc6 2021-09-21 thomas.ad explicit_bzero \
270 dd038bc6 2021-09-21 thomas.ad fmt_scaled \
271 dd038bc6 2021-09-21 thomas.ad freezero \
272 dd038bc6 2021-09-21 thomas.ad getdtablecount \
273 dd038bc6 2021-09-21 thomas.ad getline \
274 dd038bc6 2021-09-21 thomas.ad getprogname \
275 dd038bc6 2021-09-21 thomas.ad recallocarray \
276 dd038bc6 2021-09-21 thomas.ad reallocarray \
277 dd038bc6 2021-09-21 thomas.ad strlcat \
278 dd038bc6 2021-09-21 thomas.ad strlcpy \
279 dd038bc6 2021-09-21 thomas.ad strndup \
280 d9b944c7 2023-03-08 thomas strnlen \
281 dd038bc6 2021-09-21 thomas.ad strsep \
282 dd038bc6 2021-09-21 thomas.ad strtonum \
284 4fccd2fe 2023-03-08 thomas AM_CONDITIONAL([HAVE_CLOSEFROM], [test "x$ac_cv_func_closefrom" = xyes])
286 dd038bc6 2021-09-21 thomas.ad # Always use our getopt because 1) glibc's doesn't enforce argument order 2)
287 dd038bc6 2021-09-21 thomas.ad # musl does not set optarg to NULL for flags without arguments (although it is
288 dd038bc6 2021-09-21 thomas.ad # not required to, but it is helpful) 3) there are probably other weird
289 dd038bc6 2021-09-21 thomas.ad # implementations.
290 dd038bc6 2021-09-21 thomas.ad AC_LIBOBJ(getopt)
292 206be139 2023-03-08 thomas # Check for b64_ntop. If we have b64_ntop, we assume b64_pton as well.
293 206be139 2023-03-08 thomas AC_MSG_CHECKING(for b64_ntop)
294 206be139 2023-03-08 thomas AC_LINK_IFELSE([AC_LANG_PROGRAM(
296 206be139 2023-03-08 thomas #include <sys/types.h>
297 206be139 2023-03-08 thomas #include <netinet/in.h>
298 206be139 2023-03-08 thomas #include <resolv.h>
301 206be139 2023-03-08 thomas b64_ntop(NULL, 0, NULL, 0);
303 206be139 2023-03-08 thomas found_b64_ntop=yes,
304 206be139 2023-03-08 thomas found_b64_ntop=no
306 206be139 2023-03-08 thomas AC_MSG_RESULT($found_b64_ntop)
307 206be139 2023-03-08 thomas libresolv_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 -lresolv)
310 206be139 2023-03-08 thomas LIBS="-lresolv"
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"
326 206be139 2023-03-08 thomas if test "x$found_b64_ntop" = xno; then
327 206be139 2023-03-08 thomas AC_MSG_CHECKING(for b64_ntop with -lnetwork)
328 206be139 2023-03-08 thomas LIBS="-lresolv -lnetwork"
329 206be139 2023-03-08 thomas AC_LINK_IFELSE([AC_LANG_PROGRAM(
331 206be139 2023-03-08 thomas #include <sys/types.h>
332 206be139 2023-03-08 thomas #include <netinet/in.h>
333 206be139 2023-03-08 thomas #include <resolv.h>
336 206be139 2023-03-08 thomas b64_ntop(NULL, 0, NULL, 0);
338 206be139 2023-03-08 thomas found_b64_ntop=yes,
339 206be139 2023-03-08 thomas found_b64_ntop=no
341 206be139 2023-03-08 thomas AC_MSG_RESULT($found_b64_ntop)
342 206be139 2023-03-08 thomas libresolv_LIBS="$LIBS"
345 206be139 2023-03-08 thomas AM_CONDITIONAL([HAVE_B64], [test "x$found_b64_ntop" = xyes])
346 206be139 2023-03-08 thomas if test "x$found_b64_ntop" = xyes; then
347 206be139 2023-03-08 thomas AC_DEFINE([HAVE_B64_NTOP], [1], [define if b64_ntop is present])
348 206be139 2023-03-08 thomas AC_SUBST(libresolv_LIBS)
350 206be139 2023-03-08 thomas AC_LIBOBJ(base64)
353 92a9e85d 2021-09-24 thomas # Check the platform we're compiling on.
354 92a9e85d 2021-09-24 thomas AC_MSG_CHECKING(platform)
355 92a9e85d 2021-09-24 thomas case "$host_os" in
357 92a9e85d 2021-09-24 thomas AC_MSG_RESULT(linux)
358 92a9e85d 2021-09-24 thomas PLATFORM=linux
360 92a9e85d 2021-09-24 thomas *freebsd*)
361 92a9e85d 2021-09-24 thomas AC_MSG_RESULT(freebsd)
362 92a9e85d 2021-09-24 thomas PLATFORM=freebsd
364 d24ddaa6 2022-02-26 thomas *darwin*)
365 d24ddaa6 2022-02-26 thomas AC_MSG_RESULT(darwin)
366 d24ddaa6 2022-02-26 thomas PLATFORM=darwin
368 a3732bb6 2022-02-26 thomas *netbsd*)
369 a3732bb6 2022-02-26 thomas AC_MSG_RESULT(netbsd)
370 a3732bb6 2022-02-26 thomas PLATFORM=netbsd
372 01a22331 2023-02-26 thomas *openbsd*)
373 398ba35f 2023-02-26 thomas AC_MSG_RESULT(openbsd)
374 01a22331 2023-02-26 thomas PLATFORM=openbsd
376 b26177ad 2022-03-03 thomas *dragonfly*)
377 b26177ad 2022-03-03 thomas AC_MSG_RESULT(dragonfly)
378 b26177ad 2022-03-03 thomas PLATFORM=dragonflybsd
381 92a9e85d 2021-09-24 thomas AC_MSG_RESULT(unknown)
382 92a9e85d 2021-09-24 thomas PLATFORM=unknown
385 92a9e85d 2021-09-24 thomas AC_SUBST(PLATFORM)
386 92a9e85d 2021-09-24 thomas AM_CONDITIONAL([HOST_FREEBSD], [test "$PLATFORM" = "freebsd"])
387 92a9e85d 2021-09-24 thomas AM_CONDITIONAL([HOST_LINUX], [test "$PLATFORM" = "linux"])
388 d24ddaa6 2022-02-26 thomas AM_CONDITIONAL([HOST_DARWIN], [test "$PLATFORM" = "darwin"])
389 a3732bb6 2022-02-26 thomas AM_CONDITIONAL([HOST_NETBSD], [test "$PLATFORM" = "netbsd"])
390 01a22331 2023-02-26 thomas AM_CONDITIONAL([HOST_OPENBSD], [test "$PLATFORM" = "openbsd"])
391 b26177ad 2022-03-03 thomas AM_CONDITIONAL([HOST_DRAGONFLYBSD], [test "$PLATFORM" = "dragonflybsd"])
393 8cff5e95 2023-03-08 thomas # On OpenBSD, these functions are already defined, yet looking for them in
394 8cff5e95 2023-03-08 thomas # this way on OpenBSD breaks <sha2.h> inclusion.
395 8cff5e95 2023-03-08 thomas # FIXME: this needs addressing.
396 8cff5e95 2023-03-08 thomas if test "x$PLATFORM" != "xopenbsd"; then
397 8cff5e95 2023-03-08 thomas AC_CHECK_FUNCS([ \
398 8cff5e95 2023-03-08 thomas SHA256Update \
399 8cff5e95 2023-03-08 thomas SHA384Update \
400 8cff5e95 2023-03-08 thomas SHA512Update \
404 b29d689b 2023-02-11 thomas # Look for yacc.
405 b29d689b 2023-02-11 thomas if test "YACC_OVERRIDE" = "yes" && test -n "$YACC" \
406 b29d689b 2023-02-11 thomas && ! command -v "$YACC" >/dev/null 2>&1; then
407 b29d689b 2023-02-11 thomas AC_MSG_ERROR("yacc not found: $YACC")
410 51207398 2022-07-21 thomas if test x"$PLATFORM" = "xdarwin"; then
411 5baa5fe2 2022-09-05 thomas # Check for and/or set HOMEBREW_PREFIX. brew is a common way of
412 5baa5fe2 2022-09-05 thomas # installing applications. The other is MacPorts.
414 5baa5fe2 2022-09-05 thomas # Before Apple Silicon existed (M1 onward), the paths for applications
415 5baa5fe2 2022-09-05 thomas # installed via homebrew was typically /usr/local. However, with M1
416 5baa5fe2 2022-09-05 thomas # onward, this changed to a different path.
418 5baa5fe2 2022-09-05 thomas # Rather than hardcode this, check for HOMEBREW_PREFIX in the
419 8e396e19 2022-09-12 thomas # environment if it's already set, and use it. Otherwise, check for
420 5baa5fe2 2022-09-05 thomas # brew(1) and use that. If that fails, default to /usr/local
422 5baa5fe2 2022-09-05 thomas # This also means that MacPorts should continue to work.
424 8e396e19 2022-09-12 thomas # But with MacPorts, we should also check --prefix, and use that if it
425 8e396e19 2022-09-12 thomas # has been supplied.
427 8e396e19 2022-09-12 thomas # In both cases, the variable HOMEBREW_PREFIX is used for both.
428 8e396e19 2022-09-12 thomas HB_PREFIX=""
429 8e396e19 2022-09-12 thomas FOUND_BISON="no"
430 8e396e19 2022-09-12 thomas GNUBISON=""
431 8e396e19 2022-09-12 thomas if test -z "$HOMEBREW_PREFIX" -o "$HOMEBREW_PREFIX" = "NONE"; then
432 5baa5fe2 2022-09-05 thomas # HOMEBREW_PREFIX not set, check for brew(1)
433 8e396e19 2022-09-12 thomas if command -v brew >/dev/null 2>&1; then
434 8e396e19 2022-09-12 thomas AC_MSG_NOTICE("HOMEBREW_PREFIX set via 'brew --prefix'")
435 5baa5fe2 2022-09-05 thomas export HOMEBREW_PREFIX="$(brew --prefix)"
438 8e396e19 2022-09-12 thomas if test -z "$HOMEBREW_PREFIX" -o "$HOMEBREW_PREFIX" = "NONE"
440 5baa5fe2 2022-09-05 thomas # Default.
441 8e396e19 2022-09-12 thomas if test -z "${prefix}" -o "${prefix}" = "NONE"; then
442 8e396e19 2022-09-12 thomas export HOMEBREW_PREFIX="/usr/local"
443 8e396e19 2022-09-12 thomas HB_PREFIX="/usr/local"
444 8e396e19 2022-09-12 thomas AC_MSG_NOTICE("HOMEBREW_PREFIX defaulting to $HB_PREFIX")
446 8e396e19 2022-09-12 thomas HB_PREFIX="$(eval echo ${prefix})"
447 8e396e19 2022-09-12 thomas if test "$HB_PREFIX" = "NONE"; then
448 8e396e19 2022-09-12 thomas HB_PREFIX="/opt/local"
450 8e396e19 2022-09-12 thomas AC_MSG_NOTICE("HOMEBREW_PREFIX using --prefix")
452 8e396e19 2022-09-12 thomas export HOMEBREW_PREFIX="$HB_PREFIX"
457 8e396e19 2022-09-12 thomas AC_MSG_NOTICE("HOMEBREW_PREFIX determined as: $HOMEBREW_PREFIX")
459 b29d689b 2023-02-11 thomas if test "$YACC_OVERRIDE" = "no" && \
460 b29d689b 2023-02-11 thomas ! test -x "${HOMEBREW_PREFIX}/opt/bison/bin/bison"; then
461 8e396e19 2022-09-12 thomas AC_MSG_WARN([
462 8e396e19 2022-09-12 thomas "***********************************************************
463 8e396e19 2022-09-12 thomas GNU Bison not found: ${HOMEBREW_PREFIX}/opt/bison/bin/bison
464 8e396e19 2022-09-12 thomas ***********************************************************
466 8e396e19 2022-09-12 thomas Falling back to checking either /usr/local or \${prefix}"
469 8e396e19 2022-09-12 thomas FOUND_BISON="no"
470 8e396e19 2022-09-12 thomas AC_MSG_WARN("Trying ${HB_PREFIX}/opt/bison/bin/bison")
471 8e396e19 2022-09-12 thomas if test -x "${HB_PREFIX}/opt/bison/bin/bison"; then
472 8e396e19 2022-09-12 thomas export HOMEBREW_PREFIX="/usr/local"
473 8e396e19 2022-09-12 thomas FOUND_BISON="yes"
474 8e396e19 2022-09-12 thomas GNUBISON="${HB_PREFIX}/opt/bison/bin/bison"
477 8e396e19 2022-09-12 thomas if test "$FOUND_BISON" = "no"; then
478 8e396e19 2022-09-12 thomas HB_PREFIX="/opt/local"
479 8e396e19 2022-09-12 thomas AC_MSG_WARN("Trying ${HB_PREFIX}/bin/bison")
481 8e396e19 2022-09-12 thomas if test -x "${HB_PREFIX}/bin/bison"; then
482 8e396e19 2022-09-12 thomas export HOMEBREW_PREFIX="${HB_PREFIX}"
483 8e396e19 2022-09-12 thomas GNUBISON="${HB_PREFIX}/bin/bison"
484 8e396e19 2022-09-12 thomas FOUND_BISON="yes"
488 8e396e19 2022-09-12 thomas FOUND_BISON="yes"
489 8e396e19 2022-09-12 thomas GNUBISON="${HOMEBREW_PREFIX}/opt/bison/bin/bison"
492 b29d689b 2023-02-11 thomas if test "$FOUND_BISON" = "no" && test "$YACC_OVERRIDE" = "no"; then
493 8e396e19 2022-09-12 thomas AC_MSG_ERROR("*** Couldn't find GNU BISON ***")
496 51207398 2022-07-21 thomas # Override YACC here to point to the GNU version of bison.
497 b29d689b 2023-02-11 thomas if test "$YACC_OVERRIDE" = "yes"; then
498 b29d689b 2023-02-11 thomas export YACC="$YACC -y"
500 b29d689b 2023-02-11 thomas AC_MSG_NOTICE("Found GNU Bison as: $GNUBISON")
501 b29d689b 2023-02-11 thomas export YACC="${GNUBISON} -y"
503 8e396e19 2022-09-12 thomas export LDFLAGS="-L${HOMEBREW_PREFIX}/opt/ncurses/lib -L${HOMEBREW_PREFIX}/opt/openssl@3/lib $LDFLAGS"
504 5baa5fe2 2022-09-05 thomas export CPPFLAGS="-I${HOMEBREW_PREFIX}/opt/ncurses/include -I${HOMEBREW_PREFIX}/opt/openssl@3/include $CPPFLAGS"
505 5baa5fe2 2022-09-05 thomas export PKG_CONFIG_PATH="${HOMEBREW_PREFIX}/opt/ncurses/lib/pkgconfig"
506 5baa5fe2 2022-09-05 thomas export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:${HOMEBREW_PREFIX}/opt/openssl@3/lib/pkgconfig"
509 97799ccd 2022-02-06 thomas # Landlock detection.
510 97799ccd 2022-02-06 thomas AC_MSG_CHECKING([for landlock])
511 97799ccd 2022-02-06 thomas AM_CONDITIONAL([HAVE_LINUX_LANDLOCK],
512 97799ccd 2022-02-06 thomas [test "x$ac_cv_header_linux_landlock_h" = "xyes"])
513 97799ccd 2022-02-06 thomas if test "x$ac_cv_header_linux_landlock_h" = "xyes"; then
514 97799ccd 2022-02-06 thomas AC_MSG_RESULT(yes)
516 97799ccd 2022-02-06 thomas AC_MSG_RESULT(no)
519 dd038bc6 2021-09-21 thomas.ad # Clang sanitizers wrap reallocarray even if it isn't available on the target
520 dd038bc6 2021-09-21 thomas.ad # system. When compiled it always returns NULL and crashes the program. To
521 dd038bc6 2021-09-21 thomas.ad # detect this we need a more complicated test.
522 dd038bc6 2021-09-21 thomas.ad AC_MSG_CHECKING([for working reallocarray])
523 dd038bc6 2021-09-21 thomas.ad AC_RUN_IFELSE([AC_LANG_PROGRAM(
524 dd038bc6 2021-09-21 thomas.ad [#include <stdlib.h>],
525 dd038bc6 2021-09-21 thomas.ad [return (reallocarray(NULL, 1, 1) == NULL);]
527 dd038bc6 2021-09-21 thomas.ad AC_MSG_RESULT(yes),
528 7f20c2a8 2022-05-13 op [AC_LIBOBJ(reallocarray) AC_MSG_RESULT([no])],
529 dd038bc6 2021-09-21 thomas.ad [AC_LIBOBJ(reallocarray) AC_MSG_RESULT([no])]
531 dd038bc6 2021-09-21 thomas.ad AC_MSG_CHECKING([for working recallocarray])
532 dd038bc6 2021-09-21 thomas.ad AC_RUN_IFELSE([AC_LANG_PROGRAM(
533 dd038bc6 2021-09-21 thomas.ad [#include <stdlib.h>],
534 dd038bc6 2021-09-21 thomas.ad [return (recallocarray(NULL, 1, 1, 1) == NULL);]
536 dd038bc6 2021-09-21 thomas.ad AC_MSG_RESULT(yes),
537 7f20c2a8 2022-05-13 op [AC_LIBOBJ(recallocarray) AC_MSG_RESULT([no])],
538 dd038bc6 2021-09-21 thomas.ad [AC_LIBOBJ(recallocarray) AC_MSG_RESULT([no])]
541 dd038bc6 2021-09-21 thomas.ad # Look for imsg_init in libutil.
542 dd038bc6 2021-09-21 thomas.ad AC_SEARCH_LIBS(imsg_init, util, found_imsg_init=yes, found_imsg_init=no)
543 f600ad76 2023-01-06 thomas AM_CONDITIONAL([HAVE_IMSG], [test "x$found_imsg_init" = "xyes"])
544 4fccd2fe 2023-03-08 thomas if test "x$found_imsg_init" = "xyes"; then
545 d9b944c7 2023-03-08 thomas AC_DEFINE([HAVE_IMSG], [1], [Define to 1 if imsg is declared in libutil])
546 4fccd2fe 2023-03-08 thomas libutil_LIBS="$ac_cv_search_imsg_init"
547 4fccd2fe 2023-03-08 thomas AC_SUBST(libutil_LIBS)
550 ff36aeea 2022-07-16 thomas # libevent (for gotwebd). Lifted from tmux.
551 ff36aeea 2022-07-16 thomas # Look for libevent. Try libevent_core or libevent with pkg-config first then
552 ff36aeea 2022-07-16 thomas # look for the library.
553 4fccd2fe 2023-03-08 thomas found_libevent=no
554 ff36aeea 2022-07-16 thomas PKG_CHECK_MODULES(
555 ff36aeea 2022-07-16 thomas LIBEVENT_CORE,
556 ff36aeea 2022-07-16 thomas [libevent_core >= 2],
558 4fccd2fe 2023-03-08 thomas libevent_CFLAGS="$LIBEVENT_CORE_CFLAGS"
559 4fccd2fe 2023-03-08 thomas libevent_LIBS="$LIBEVENT_CORE_LIBS"
560 4fccd2fe 2023-03-08 thomas AC_SUBST(libevent_CFLAGS)
561 4fccd2fe 2023-03-08 thomas AC_SUBST(libevent_LIBS)
562 ff36aeea 2022-07-16 thomas found_libevent=yes
564 ff36aeea 2022-07-16 thomas found_libevent=no
566 ff36aeea 2022-07-16 thomas if test x$found_libevent = xno; then
567 ff36aeea 2022-07-16 thomas PKG_CHECK_MODULES(
568 ff36aeea 2022-07-16 thomas LIBEVENT,
569 ff36aeea 2022-07-16 thomas [libevent >= 2],
571 4fccd2fe 2023-03-08 thomas libevent_CFLAGS="$LIBEVENT_CFLAGS"
572 4fccd2fe 2023-03-08 thomas libevent_LIBS="$LIBEVENT_LIBS"
573 4fccd2fe 2023-03-08 thomas AC_SUBST(libevent_CFLAGS)
574 4fccd2fe 2023-03-08 thomas AC_SUBST(libevent_LIBS)
575 ff36aeea 2022-07-16 thomas found_libevent=yes
577 ff36aeea 2022-07-16 thomas found_libevent=no
580 ff36aeea 2022-07-16 thomas if test x$found_libevent = xno; then
581 ff36aeea 2022-07-16 thomas AC_SEARCH_LIBS(
582 ff36aeea 2022-07-16 thomas event_init,
583 ff36aeea 2022-07-16 thomas [event_core event event-1.4],
584 ff36aeea 2022-07-16 thomas found_libevent=yes,
585 ff36aeea 2022-07-16 thomas found_libevent=no
588 4fccd2fe 2023-03-08 thomas if test "x$found_libevent" = "xyes"; then
589 4fccd2fe 2023-03-08 thomas libevent_LIBS="$ac_cv_search_event_init"
590 4fccd2fe 2023-03-08 thomas AC_SUBST(libevent_LIBS)
594 4fccd2fe 2023-03-08 thomas if test x$found_libevent = xno; then
595 ff36aeea 2022-07-16 thomas AC_CHECK_HEADER(
596 ff36aeea 2022-07-16 thomas event2/event.h,
597 47dc83f5 2023-03-08 thomas AC_DEFINE([HAVE_EVENT2_EVENT_H], [1], [libevent2 has event.h]),
599 ff36aeea 2022-07-16 thomas AC_CHECK_HEADER(
601 47dc83f5 2023-03-08 thomas AC_DEFINE([HAVE_EVENT_H], [0], [libevent]),
602 ff36aeea 2022-07-16 thomas found_libevent=no
608 ff36aeea 2022-07-16 thomas if test "x$found_libevent" = xno; then
609 ff36aeea 2022-07-16 thomas AC_MSG_ERROR("libevent not found")
612 4fccd2fe 2023-03-08 thomas AC_CHECK_FUNC([uuid_create], [found_uuid=yes], [found_uuid=no])
614 d24ddaa6 2022-02-26 thomas # Don't define HAVE_BSD_UUID on darwin (Apple) as this breaks the BSD API.
615 d24ddaa6 2022-02-26 thomas # Instead, use the UUID implementation wrapper that's in compat/ plus uuid
617 d24ddaa6 2022-02-26 thomas if test "x$found_uuid" = "xyes" -a "x$PLATFORM" != "darwin"; then
618 47dc83f5 2023-03-08 thomas AC_DEFINE([HAVE_BSD_UUID], [1], [BSD UUID])
620 326237a6 2021-09-25 thomas PKG_CHECK_MODULES(
624 4fccd2fe 2023-03-08 thomas libuuid_CFLAGS="$LIBUUID_CFLAGS"
625 4fccd2fe 2023-03-08 thomas libuuid_LIBS="$LIBUUID_LIBS"
626 4fccd2fe 2023-03-08 thomas AC_SUBST(libuuid_CFLAGS)
627 4fccd2fe 2023-03-08 thomas AC_SUBST(libuuid_LIBS)
628 326237a6 2021-09-25 thomas found_libuuid=yes
631 326237a6 2021-09-25 thomas found_libuuid=no
635 326237a6 2021-09-25 thomas if test "x$found_libuuid" = "xno"; then
636 326237a6 2021-09-25 thomas AC_CHECK_HEADER(
638 326237a6 2021-09-25 thomas found_libuuid=yes,
639 326237a6 2021-09-25 thomas found_libuuid=no)
643 92a9e85d 2021-09-24 thomas if test "x$found_libuuid" = "xno"; then
644 92a9e85d 2021-09-24 thomas AC_MSG_ERROR("*** couldn't find uuid ***")
647 dd038bc6 2021-09-21 thomas.ad PKG_CHECK_MODULES(
651 4fccd2fe 2023-03-08 thomas zlib_CFLAGS="$ZLIB_CFLAGS"
652 4fccd2fe 2023-03-08 thomas zlib_LIBS="$ZLIB_LIBS"
653 4fccd2fe 2023-03-08 thomas AC_SUBST(zlib_CFLAGS)
654 4fccd2fe 2023-03-08 thomas AC_SUBST(zlib_LIBS)
655 dd038bc6 2021-09-21 thomas.ad found_zlib=yes
658 92a9e85d 2021-09-24 thomas found_zlib=no
662 92a9e85d 2021-09-24 thomas if test "x$found_zlib" = "xno"; then
663 92a9e85d 2021-09-24 thomas AC_CHECK_HEADER(
666 92a9e85d 2021-09-24 thomas found_zlib=no)
669 92a9e85d 2021-09-24 thomas if test "x$found_zlib" = "xno"; then
670 92a9e85d 2021-09-24 thomas AC_MSG_ERROR("*** couldn't find zlib ***")
673 92a9e85d 2021-09-24 thomas if test "$PLATFORM" = "linux"; then
674 92a9e85d 2021-09-24 thomas PKG_CHECK_MODULES(
676 92a9e85d 2021-09-24 thomas libbsd-overlay,
678 4fccd2fe 2023-03-08 thomas libbsd_CFLAGS="$LIBBSD_CFLAGS"
679 4fccd2fe 2023-03-08 thomas libbsd_LIBS="$LIBBSD_LIBS"
680 4fccd2fe 2023-03-08 thomas AC_SUBST(libbsd_CFLAGS)
681 4fccd2fe 2023-03-08 thomas AC_SUBST(libbsd_LIBS)
682 47dc83f5 2023-03-08 thomas AC_DEFINE([HAVE_LIBBSD], [1], [BSD UUID])
685 46384c6e 2022-09-13 thomas AC_MSG_ERROR("*** couldn't find libbsd-overlay via pkg-config")
690 4fccd2fe 2023-03-08 thomas # Add LIBBSD_{CFLAGS,LIBS} to the environment here, as libbsd puts its
691 4fccd2fe 2023-03-08 thomas # header files in a non-standard location, which means the overlay for
692 4fccd2fe 2023-03-08 thomas # <sys/tree.h> and <sys/queue.h> won't be found.
693 4fccd2fe 2023-03-08 thomas CFLAGS="$CFLAGS $LIBBSD_CFLAGS"
694 4fccd2fe 2023-03-08 thomas LIBS="$LIBS $LIBBSD_LIBS"
696 5007bd0d 2023-04-14 thomas PKG_CHECK_MODULES(
700 5007bd0d 2023-04-14 thomas libmd_CFLAGS="$LIBMD_CFLAGS"
701 5007bd0d 2023-04-14 thomas libmd_LIBS="$LIBMD_LIBS"
702 5007bd0d 2023-04-14 thomas AC_SUBST(libmd_CFLAGS)
703 5007bd0d 2023-04-14 thomas AC_SUBST(libmd_LIBS)
706 5007bd0d 2023-04-14 thomas CFLAGS="$CFLAGS $LIBMD_CFLAGS"
707 5007bd0d 2023-04-14 thomas LIBS="$LIBS $LIBMD_LIBS"
711 dd038bc6 2021-09-21 thomas.ad # Look for a suitable queue.h. We hope libbsd is enough, but that is missing
712 8dbd2d50 2022-08-12 thomas # some declarations.
713 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
714 dd038bc6 2021-09-21 thomas.ad TAILQ_CONCAT,
715 dd038bc6 2021-09-21 thomas.ad found_queue_h=yes,
716 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
717 8dbd2d50 2022-08-12 thomas [#include <sys/queue.h>]
719 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
720 dd038bc6 2021-09-21 thomas.ad TAILQ_PREV,
722 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
723 8dbd2d50 2022-08-12 thomas [#include <sys/queue.h>]
725 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
726 dd038bc6 2021-09-21 thomas.ad TAILQ_FOREACH_SAFE,
728 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
729 8dbd2d50 2022-08-12 thomas [#include <sys/queue.h>]
732 8dbd2d50 2022-08-12 thomas if test "x$found_queue_h" = xyes; then
733 47dc83f5 2023-03-08 thomas AC_DEFINE([HAVE_QUEUE_H], [1], [sys/queue.h])
735 46384c6e 2022-09-13 thomas AC_MSG_ERROR("*** sys/queue.h missing key defines ***)
738 c59427c5 2022-10-13 thomas AC_CHECK_DECL(
739 c59427c5 2022-10-13 thomas RB_GENERATE_STATIC,
740 c59427c5 2022-10-13 thomas found_sys_tree_h=yes,
741 c59427c5 2022-10-13 thomas found_sys_tree_h=no,
742 c59427c5 2022-10-13 thomas [#include <sys/tree.h>]
745 c59427c5 2022-10-13 thomas if test "x$found_sys_tree_h" = xyes; then
746 47dc83f5 2023-03-08 thomas AC_DEFINE([HAVE_TREE_H], [1], [sys/tree.h])
748 c59427c5 2022-10-13 thomas AC_MSG_NOTICE("Using compat/tree.h")
751 dd038bc6 2021-09-21 thomas.ad # Look for __progname.
752 dd038bc6 2021-09-21 thomas.ad AC_MSG_CHECKING(for __progname)
753 dd038bc6 2021-09-21 thomas.ad AC_LINK_IFELSE([AC_LANG_SOURCE(
755 dd038bc6 2021-09-21 thomas.ad #include <stdio.h>
756 dd038bc6 2021-09-21 thomas.ad #include <stdlib.h>
757 dd038bc6 2021-09-21 thomas.ad extern char *__progname;
758 dd038bc6 2021-09-21 thomas.ad int main(void) {
759 dd038bc6 2021-09-21 thomas.ad const char *cp = __progname;
760 dd038bc6 2021-09-21 thomas.ad printf("%s\n", cp);
761 dd038bc6 2021-09-21 thomas.ad exit(0);
764 47dc83f5 2023-03-08 thomas [AC_DEFINE([HAVE___PROGNAME], [1], [___progname]) AC_MSG_RESULT(yes)],
765 47dc83f5 2023-03-08 thomas [AC_MSG_RESULT(no)]
768 d9e4d43f 2022-03-03 thomas PKG_CHECK_MODULES(
769 d9e4d43f 2022-03-03 thomas LIBPANELW,
771 d3f1e38b 2023-03-08 thomas LIBPANELW_LIBS="$LIBPANELW_LIBS"
772 d9e4d43f 2022-03-03 thomas found_panel=yes,
773 d9e4d43f 2022-03-03 thomas found_panel=no
776 d3f1e38b 2023-03-08 thomas if test "x$found_panel" = "xno"; then
777 d9e4d43f 2022-03-03 thomas PKG_CHECK_MODULES(
778 d9e4d43f 2022-03-03 thomas LIBPANELW,
779 d9e4d43f 2022-03-03 thomas gnupanelw,
781 d3f1e38b 2023-03-08 thomas LIBPANELW_LIBS="$LIBPANELW_LIBS"
782 d3f1e38b 2023-03-08 thomas found_panel=yes
784 d9e4d43f 2022-03-03 thomas found_panel=no
788 d3f1e38b 2023-03-08 thomas if test "x$found_panel" = "xno"; then
789 b26177ad 2022-03-03 thomas PKG_CHECK_MODULES(
790 b26177ad 2022-03-03 thomas LIBPANELW,
793 d3f1e38b 2023-03-08 thomas LIBPANELW_LIBS="$LIBPANELW_LIBS"
794 d3f1e38b 2023-03-08 thomas found_panel=yes
796 b26177ad 2022-03-03 thomas found_panel=no
800 d9e4d43f 2022-03-03 thomas if test "x$found_panel" = "xno"; then
801 947fe78c 2023-01-06 thomas AC_CHECK_LIB(panelw, update_panels, [],
802 947fe78c 2023-01-06 thomas AC_MSG_ERROR([ "*** panelw not found for ncurses. ***"]),
803 947fe78c 2023-01-06 thomas [-lncurses]
808 acf52a76 2021-09-21 thomas.ad PKG_CHECK_MODULES(
809 acf52a76 2021-09-21 thomas.ad LIBNCURSES,
810 acf52a76 2021-09-21 thomas.ad ncursesw,
811 dd038bc6 2021-09-21 thomas.ad found_ncurses=yes,
812 dd038bc6 2021-09-21 thomas.ad found_ncurses=no
814 acf52a76 2021-09-21 thomas.ad if test "x$found_ncurses" = xyes; then
815 4fccd2fe 2023-03-08 thomas libncurses_CFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $LIBPANELW_CFLAGS"
816 4fccd2fe 2023-03-08 thomas libncurses_LIBS="$LIBNCURSES_LIBS $LIBTINFO_LIBS $LIBPANELW_LIBS"
817 4fccd2fe 2023-03-08 thomas AC_SUBST(libncurses_CFLAGS)
818 4fccd2fe 2023-03-08 thomas AC_SUBST(libncurses_LIBS)
820 4fccd2fe 2023-03-08 thomas AC_SEARCH_LIBS(
821 dd038bc6 2021-09-21 thomas.ad setupterm,
822 dd038bc6 2021-09-21 thomas.ad found_ncurses=yes,
823 dd038bc6 2021-09-21 thomas.ad found_ncurses=no
825 dd038bc6 2021-09-21 thomas.ad if test "x$found_ncurses" = xyes; then
826 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADER(
827 dd038bc6 2021-09-21 thomas.ad ncurses.h,
828 4fccd2fe 2023-03-08 thomas libncurses_CFLAGS="$LIBPANELW_CFLAGS $LIBPANEL_CFLAGS"
829 4fccd2fe 2023-03-08 thomas libncurses_LIBS="$LIBPANELW_LIBS -lncursesw"
830 4fccd2fe 2023-03-08 thomas AC_SUBST(libncurses_CFLAGS)
831 4fccd2fe 2023-03-08 thomas AC_SUBST(libncurses_LIBS)
835 dd038bc6 2021-09-21 thomas.ad if test "x$found_ncurses" = xyes; then
836 47dc83f5 2023-03-08 thomas AC_DEFINE([HAVE_NCURSES_H], [1], [NCurses])
838 dd038bc6 2021-09-21 thomas.ad # No ncurses, try curses.
839 4fccd2fe 2023-03-08 thomas AC_CHECK_FUNC(
840 dd038bc6 2021-09-21 thomas.ad setupterm,
841 dd038bc6 2021-09-21 thomas.ad found_curses=yes,
842 dd038bc6 2021-09-21 thomas.ad found_curses=no
844 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADER(
845 dd038bc6 2021-09-21 thomas.ad curses.h,
846 4fccd2fe 2023-03-08 thomas found_curses=yes,
847 dd038bc6 2021-09-21 thomas.ad found_curses=no)
848 dd038bc6 2021-09-21 thomas.ad if test "x$found_curses" = xyes; then
849 4fccd2fe 2023-03-08 thomas libncurses_CFLAGS="$LIBPANELW_CFLAGS $LIBPANEL_CFLAGS"
850 d3f1e38b 2023-03-08 thomas libncurses_LIBS="$LIBPANELW_LIBS -lncursesw -lpanelw"
851 4fccd2fe 2023-03-08 thomas AC_SUBST(libncurses_CFLAGS)
852 4fccd2fe 2023-03-08 thomas AC_SUBST(libncurses_LIBS)
853 47dc83f5 2023-03-08 thomas AC_DEFINE([HAVE_CURSES_H], [1], [Curses_h])
855 dd038bc6 2021-09-21 thomas.ad AC_MSG_ERROR("curses not found")
859 dd038bc6 2021-09-21 thomas.ad # Save our CFLAGS/CPPFLAGS/LDFLAGS for the Makefile and restore the old user
860 dd038bc6 2021-09-21 thomas.ad # variables.
861 dd038bc6 2021-09-21 thomas.ad AC_SUBST(AM_CPPFLAGS)
862 dd038bc6 2021-09-21 thomas.ad CPPFLAGS="$SAVED_CPPFLAGS"
863 dd038bc6 2021-09-21 thomas.ad AC_SUBST(AM_CFLAGS)
864 dd038bc6 2021-09-21 thomas.ad CFLAGS="$SAVED_CFLAGS"
865 dd038bc6 2021-09-21 thomas.ad AC_SUBST(AM_LDFLAGS)
866 dd038bc6 2021-09-21 thomas.ad LDFLAGS="$SAVED_LDFLAGS"
868 943e9ed2 2023-03-08 thomas # LIBS is designed to accumulate library dependencies as checks for them are
869 943e9ed2 2023-03-08 thomas # peformed, so that this can be included directly to ld(1).
871 943e9ed2 2023-03-08 thomas # However, this hinders the splitting up of the library dependencies so that
872 943e9ed2 2023-03-08 thomas # they're targetted just where they're needed. Flatting LIBS here ensures
873 943e9ed2 2023-03-08 thomas # that this happens appropriately.
876 47dc83f5 2023-03-08 thomas AH_BOTTOM([#include "got_compat2.h"])
878 2f1efc18 2023-08-29 thomas AM_CONDITIONAL([GOTD_ENABLED], [test "x$enable_gotd" = xyes])
880 dd038bc6 2021-09-21 thomas.ad AC_CONFIG_FILES([Makefile
881 dd038bc6 2021-09-21 thomas.ad compat/Makefile
882 b7eff127 2023-07-10 thomas cvg/Makefile
883 dd038bc6 2021-09-21 thomas.ad libexec/Makefile
884 dd038bc6 2021-09-21 thomas.ad libexec/got-read-tree/Makefile
885 dd038bc6 2021-09-21 thomas.ad libexec/got-fetch-pack/Makefile
886 dd038bc6 2021-09-21 thomas.ad libexec/got-index-pack/Makefile
887 dd038bc6 2021-09-21 thomas.ad libexec/got-read-blob/Makefile
888 dd038bc6 2021-09-21 thomas.ad libexec/got-read-commit/Makefile
889 dd038bc6 2021-09-21 thomas.ad libexec/got-read-gitconfig/Makefile
890 dd038bc6 2021-09-21 thomas.ad libexec/got-read-gotconfig/Makefile
891 dd038bc6 2021-09-21 thomas.ad libexec/got-read-object/Makefile
892 dd038bc6 2021-09-21 thomas.ad libexec/got-read-pack/Makefile
893 973f3f6e 2022-03-07 thomas libexec/got-read-patch/Makefile
894 dd038bc6 2021-09-21 thomas.ad libexec/got-read-tag/Makefile
895 dd038bc6 2021-09-21 thomas.ad libexec/got-send-pack/Makefile
896 dd038bc6 2021-09-21 thomas.ad got/Makefile
897 2b0eee35 2021-09-21 thomas.ad gotadmin/Makefile
898 ff36aeea 2022-07-16 thomas gotwebd/Makefile
899 d3f2ad5e 2021-09-21 thomas.ad tog/Makefile
900 5a7ef102 2021-10-09 thomas Makefile.common:Makefile.common.in])
902 2f1efc18 2023-08-29 thomas if test "x$enable_gotd" = "xyes"; then
903 2f1efc18 2023-08-29 thomas AC_CONFIG_FILES([gotd/Makefile])
904 52daa6ad 2023-08-29 thomas AC_CONFIG_FILES([gotsh/Makefile])
905 40de210a 2023-08-29 thomas AC_CONFIG_FILES([gotctl/Makefile])
908 dd038bc6 2021-09-21 thomas.ad AC_OUTPUT
910 9ffe20fd 2022-09-10 thomas executables="$(eval echo ${exec_prefix}/bin)"
911 9ffe20fd 2022-09-10 thomas helpers="$(eval echo ${libexecdir})"
912 9ffe20fd 2022-09-10 thomas manpages="$(eval echo ${mandir})"
914 2f1efc18 2023-08-29 thomas if test -z "$enable_gotd"; then
915 2f1efc18 2023-08-29 thomas enable_gotd="no"
919 9ffe20fd 2022-09-10 thomas Configured got-portable with:
921 9ffe20fd 2022-09-10 thomas Version: $VERSION
923 9ffe20fd 2022-09-10 thomas Prefix: ${prefix}
924 9ffe20fd 2022-09-10 thomas Executables: ${executables}
925 b29d689b 2023-02-11 thomas Bison: $YACC
926 4fccd2fe 2023-03-08 thomas CFlags: $CFLAGS
927 2f1efc18 2023-08-29 thomas Gotd: ${enable_gotd}
928 9ffe20fd 2022-09-10 thomas Helpers: ${helpers}
929 9ffe20fd 2022-09-10 thomas Man pages: ${manpages}