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 d1ea27e3 2022-07-14 thomas AC_INIT([got-portable], [0.75], [thomas@xteddy.org])
5 dd038bc6 2021-09-21 thomas.ad AC_CONFIG_AUX_DIR(etc)
6 dd038bc6 2021-09-21 thomas.ad AC_CONFIG_SRCDIR([lib/rcsutil.h])
7 dd038bc6 2021-09-21 thomas.ad AM_INIT_AUTOMAKE([foreign subdir-objects])
9 dd038bc6 2021-09-21 thomas.ad GOT_RELEASE=No
11 dd038bc6 2021-09-21 thomas.ad AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
12 dd038bc6 2021-09-21 thomas.ad AC_SUBST(VERSION)
13 dd038bc6 2021-09-21 thomas.ad AC_SUBST(GOT_RELEASE)
15 dd038bc6 2021-09-21 thomas.ad AC_CANONICAL_HOST
17 dd038bc6 2021-09-21 thomas.ad # When CFLAGS isn't set at this stage and gcc is detected by the macro below,
18 dd038bc6 2021-09-21 thomas.ad # autoconf will automatically use CFLAGS="-O2 -g". Prevent that by using an
19 dd038bc6 2021-09-21 thomas.ad # empty default.
20 dd038bc6 2021-09-21 thomas.ad : ${CFLAGS=""}
22 dd038bc6 2021-09-21 thomas.ad # Save user CPPFLAGS, CFLAGS and LDFLAGS. We need to change them because
23 dd038bc6 2021-09-21 thomas.ad # AC_CHECK_HEADER doesn't give us any other way to update the include
24 dd038bc6 2021-09-21 thomas.ad # paths. But for Makefile.am we want to use AM_CPPFLAGS and friends.
25 dd038bc6 2021-09-21 thomas.ad SAVED_CFLAGS="$CFLAGS"
26 dd038bc6 2021-09-21 thomas.ad SAVED_CPPFLAGS="$CPPFLAGS"
27 dd038bc6 2021-09-21 thomas.ad SAVED_LDFLAGS="$LDFLAGS"
29 dd038bc6 2021-09-21 thomas.ad # Checks for programs.
30 dd038bc6 2021-09-21 thomas.ad AC_PROG_CC
31 dd038bc6 2021-09-21 thomas.ad AC_PROG_CPP
32 dd038bc6 2021-09-21 thomas.ad AC_PROG_INSTALL
33 dd038bc6 2021-09-21 thomas.ad AC_PROG_LN_S
34 dd038bc6 2021-09-21 thomas.ad AC_PROG_MAKE_SET
35 dd038bc6 2021-09-21 thomas.ad AC_PROG_YACC
36 dd038bc6 2021-09-21 thomas.ad AC_PROG_RANLIB
37 dd038bc6 2021-09-21 thomas.ad PKG_PROG_PKG_CONFIG
38 dd038bc6 2021-09-21 thomas.ad AC_USE_SYSTEM_EXTENSIONS
40 dd038bc6 2021-09-21 thomas.ad # Checks for header files.
41 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADERS([ \
42 dd038bc6 2021-09-21 thomas.ad fcntl.h \
43 dd038bc6 2021-09-21 thomas.ad langinfo.h \
44 dd038bc6 2021-09-21 thomas.ad limits.h \
45 97799ccd 2022-02-06 thomas linux/landlock.h \
46 dd038bc6 2021-09-21 thomas.ad locale.h \
47 dd038bc6 2021-09-21 thomas.ad netdb.h \
48 dd038bc6 2021-09-21 thomas.ad netinet/in.h \
49 dd038bc6 2021-09-21 thomas.ad paths.h \
51 dd038bc6 2021-09-21 thomas.ad stddef.h \
52 dd038bc6 2021-09-21 thomas.ad stdint.h \
53 dd038bc6 2021-09-21 thomas.ad stdlib.h \
54 dd038bc6 2021-09-21 thomas.ad string.h \
55 dd038bc6 2021-09-21 thomas.ad sys/ioctl.h \
56 dd038bc6 2021-09-21 thomas.ad sys/param.h \
57 d24ddaa6 2022-02-26 thomas sys/poll.h \
58 19467d59 2022-07-16 thomas sys/queue.h \
59 dd038bc6 2021-09-21 thomas.ad sys/socket.h \
60 dd038bc6 2021-09-21 thomas.ad sys/time.h \
61 dd038bc6 2021-09-21 thomas.ad sys/tree.h \
62 dd038bc6 2021-09-21 thomas.ad util.h \
63 dd038bc6 2021-09-21 thomas.ad unistd.h \
64 dd038bc6 2021-09-21 thomas.ad wchar.h \
67 dd038bc6 2021-09-21 thomas.ad # Checks for typ edefs, structures, and compiler characteristics.
68 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADER_STDBOOL
69 dd038bc6 2021-09-21 thomas.ad AC_C_INLINE
70 dd038bc6 2021-09-21 thomas.ad AC_TYPE_INT64_T
71 dd038bc6 2021-09-21 thomas.ad AC_TYPE_MODE_T
72 dd038bc6 2021-09-21 thomas.ad AC_TYPE_OFF_T
73 dd038bc6 2021-09-21 thomas.ad AC_TYPE_PID_T
74 dd038bc6 2021-09-21 thomas.ad AC_TYPE_SIZE_T
75 dd038bc6 2021-09-21 thomas.ad AC_TYPE_SSIZE_T
76 dd038bc6 2021-09-21 thomas.ad AC_TYPE_UINT16_T
77 dd038bc6 2021-09-21 thomas.ad AC_TYPE_UINT32_T
78 dd038bc6 2021-09-21 thomas.ad AC_TYPE_UINT64_T
79 dd038bc6 2021-09-21 thomas.ad AC_TYPE_UINT8_T
81 ff36aeea 2022-07-16 thomas # Check for ifgroupreq which is only available on BSD.
82 ff36aeea 2022-07-16 thomas AC_CHECK_TYPES([struct ifgroupreq])
84 dd038bc6 2021-09-21 thomas.ad # Look for library needed for flock.
85 dd038bc6 2021-09-21 thomas.ad AC_SEARCH_LIBS(flock, bsd)
87 dd038bc6 2021-09-21 thomas.ad # Checks for library functions.
88 dd038bc6 2021-09-21 thomas.ad AC_FUNC_FORK
89 dd038bc6 2021-09-21 thomas.ad AC_FUNC_FSEEKO
90 dd038bc6 2021-09-21 thomas.ad AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
91 dd038bc6 2021-09-21 thomas.ad AC_FUNC_MALLOC
92 dd038bc6 2021-09-21 thomas.ad AC_FUNC_MMAP
93 dd038bc6 2021-09-21 thomas.ad AC_FUNC_REALLOC
94 dd038bc6 2021-09-21 thomas.ad AC_FUNC_STRERROR_R
95 dd038bc6 2021-09-21 thomas.ad AC_FUNC_STRNLEN
96 dd038bc6 2021-09-21 thomas.ad AC_CHECK_FUNCS([ \
98 dd038bc6 2021-09-21 thomas.ad flock \
99 dd038bc6 2021-09-21 thomas.ad getcwd \
100 dd038bc6 2021-09-21 thomas.ad localtime_r \
101 dd038bc6 2021-09-21 thomas.ad memchr \
102 dd038bc6 2021-09-21 thomas.ad memmove \
103 dd038bc6 2021-09-21 thomas.ad memset \
104 dd038bc6 2021-09-21 thomas.ad mkdir \
105 dd038bc6 2021-09-21 thomas.ad munmap \
106 dd038bc6 2021-09-21 thomas.ad nl_langinfo \
107 dd038bc6 2021-09-21 thomas.ad realpath \
108 dd038bc6 2021-09-21 thomas.ad regcomp \
109 dd038bc6 2021-09-21 thomas.ad rmdir \
110 dd038bc6 2021-09-21 thomas.ad setlocale \
111 dd038bc6 2021-09-21 thomas.ad socket \
112 dd038bc6 2021-09-21 thomas.ad strcasecmp \
113 dd038bc6 2021-09-21 thomas.ad strchr \
114 dd038bc6 2021-09-21 thomas.ad strcspn \
115 dd038bc6 2021-09-21 thomas.ad strdup \
116 dd038bc6 2021-09-21 thomas.ad strerror \
117 dd038bc6 2021-09-21 thomas.ad strlcpy \
118 dd038bc6 2021-09-21 thomas.ad strncasecmp \
119 dd038bc6 2021-09-21 thomas.ad strndup \
120 dd038bc6 2021-09-21 thomas.ad strrchr \
121 dd038bc6 2021-09-21 thomas.ad strspn \
122 dd038bc6 2021-09-21 thomas.ad strstr \
123 dd038bc6 2021-09-21 thomas.ad strtol \
124 dd038bc6 2021-09-21 thomas.ad strtoul \
125 dd038bc6 2021-09-21 thomas.ad wcwidth \
128 ddd12270 2022-04-22 thomas # Siphash support.
129 ddd12270 2022-04-22 thomas AC_CHECK_FUNCS([SipHash])
130 ddd12270 2022-04-22 thomas AM_CONDITIONAL([HAVE_SIPHASH], [test "x$ac_cv_func_SipHash" = xyes])
132 dd038bc6 2021-09-21 thomas.ad # Check for functions with a compatibility implementation.
133 dd038bc6 2021-09-21 thomas.ad AC_REPLACE_FUNCS([ \
134 dd038bc6 2021-09-21 thomas.ad asprintf \
135 dd038bc6 2021-09-21 thomas.ad closefrom \
136 dd038bc6 2021-09-21 thomas.ad explicit_bzero \
137 dd038bc6 2021-09-21 thomas.ad fmt_scaled \
138 dd038bc6 2021-09-21 thomas.ad freezero \
139 dd038bc6 2021-09-21 thomas.ad getdtablecount \
140 dd038bc6 2021-09-21 thomas.ad getline \
141 dd038bc6 2021-09-21 thomas.ad getprogname \
142 dd038bc6 2021-09-21 thomas.ad recallocarray \
143 dd038bc6 2021-09-21 thomas.ad reallocarray \
144 dd038bc6 2021-09-21 thomas.ad strlcat \
145 dd038bc6 2021-09-21 thomas.ad strlcpy \
146 dd038bc6 2021-09-21 thomas.ad strndup \
147 dd038bc6 2021-09-21 thomas.ad strsep \
148 dd038bc6 2021-09-21 thomas.ad strtonum \
151 dd038bc6 2021-09-21 thomas.ad # Always use our getopt because 1) glibc's doesn't enforce argument order 2)
152 dd038bc6 2021-09-21 thomas.ad # musl does not set optarg to NULL for flags without arguments (although it is
153 dd038bc6 2021-09-21 thomas.ad # not required to, but it is helpful) 3) there are probably other weird
154 dd038bc6 2021-09-21 thomas.ad # implementations.
155 dd038bc6 2021-09-21 thomas.ad AC_LIBOBJ(getopt)
157 92a9e85d 2021-09-24 thomas # Check the platform we're compiling on.
158 92a9e85d 2021-09-24 thomas AC_MSG_CHECKING(platform)
159 92a9e85d 2021-09-24 thomas case "$host_os" in
161 92a9e85d 2021-09-24 thomas AC_MSG_RESULT(linux)
162 92a9e85d 2021-09-24 thomas PLATFORM=linux
164 92a9e85d 2021-09-24 thomas *freebsd*)
165 92a9e85d 2021-09-24 thomas AC_MSG_RESULT(freebsd)
166 92a9e85d 2021-09-24 thomas PLATFORM=freebsd
168 d24ddaa6 2022-02-26 thomas *darwin*)
169 d24ddaa6 2022-02-26 thomas AC_MSG_RESULT(darwin)
170 d24ddaa6 2022-02-26 thomas PLATFORM=darwin
172 a3732bb6 2022-02-26 thomas *netbsd*)
173 a3732bb6 2022-02-26 thomas AC_MSG_RESULT(netbsd)
174 a3732bb6 2022-02-26 thomas PLATFORM=netbsd
176 b26177ad 2022-03-03 thomas *dragonfly*)
177 b26177ad 2022-03-03 thomas AC_MSG_RESULT(dragonfly)
178 b26177ad 2022-03-03 thomas PLATFORM=dragonflybsd
181 92a9e85d 2021-09-24 thomas AC_MSG_RESULT(unknown)
182 92a9e85d 2021-09-24 thomas PLATFORM=unknown
185 92a9e85d 2021-09-24 thomas AC_SUBST(PLATFORM)
186 92a9e85d 2021-09-24 thomas AM_CONDITIONAL([HOST_FREEBSD], [test "$PLATFORM" = "freebsd"])
187 92a9e85d 2021-09-24 thomas AM_CONDITIONAL([HOST_LINUX], [test "$PLATFORM" = "linux"])
188 d24ddaa6 2022-02-26 thomas AM_CONDITIONAL([HOST_DARWIN], [test "$PLATFORM" = "darwin"])
189 a3732bb6 2022-02-26 thomas AM_CONDITIONAL([HOST_NETBSD], [test "$PLATFORM" = "netbsd"])
190 b26177ad 2022-03-03 thomas AM_CONDITIONAL([HOST_DRAGONFLYBSD], [test "$PLATFORM" = "dragonflybsd"])
192 97799ccd 2022-02-06 thomas # Landlock detection.
193 97799ccd 2022-02-06 thomas AC_MSG_CHECKING([for landlock])
194 97799ccd 2022-02-06 thomas AM_CONDITIONAL([HAVE_LINUX_LANDLOCK],
195 97799ccd 2022-02-06 thomas [test "x$ac_cv_header_linux_landlock_h" = "xyes"])
196 97799ccd 2022-02-06 thomas if test "x$ac_cv_header_linux_landlock_h" = "xyes"; then
197 97799ccd 2022-02-06 thomas AC_MSG_RESULT(yes)
199 97799ccd 2022-02-06 thomas AC_MSG_RESULT(no)
202 dd038bc6 2021-09-21 thomas.ad # Clang sanitizers wrap reallocarray even if it isn't available on the target
203 dd038bc6 2021-09-21 thomas.ad # system. When compiled it always returns NULL and crashes the program. To
204 dd038bc6 2021-09-21 thomas.ad # detect this we need a more complicated test.
205 dd038bc6 2021-09-21 thomas.ad AC_MSG_CHECKING([for working reallocarray])
206 dd038bc6 2021-09-21 thomas.ad AC_RUN_IFELSE([AC_LANG_PROGRAM(
207 dd038bc6 2021-09-21 thomas.ad [#include <stdlib.h>],
208 dd038bc6 2021-09-21 thomas.ad [return (reallocarray(NULL, 1, 1) == NULL);]
210 dd038bc6 2021-09-21 thomas.ad AC_MSG_RESULT(yes),
211 7f20c2a8 2022-05-13 op [AC_LIBOBJ(reallocarray) AC_MSG_RESULT([no])],
212 dd038bc6 2021-09-21 thomas.ad [AC_LIBOBJ(reallocarray) AC_MSG_RESULT([no])]
214 dd038bc6 2021-09-21 thomas.ad AC_MSG_CHECKING([for working recallocarray])
215 dd038bc6 2021-09-21 thomas.ad AC_RUN_IFELSE([AC_LANG_PROGRAM(
216 dd038bc6 2021-09-21 thomas.ad [#include <stdlib.h>],
217 dd038bc6 2021-09-21 thomas.ad [return (recallocarray(NULL, 1, 1, 1) == NULL);]
219 dd038bc6 2021-09-21 thomas.ad AC_MSG_RESULT(yes),
220 7f20c2a8 2022-05-13 op [AC_LIBOBJ(recallocarray) AC_MSG_RESULT([no])],
221 dd038bc6 2021-09-21 thomas.ad [AC_LIBOBJ(recallocarray) AC_MSG_RESULT([no])]
224 dd038bc6 2021-09-21 thomas.ad # Look for imsg_init in libutil.
225 dd038bc6 2021-09-21 thomas.ad AC_SEARCH_LIBS(imsg_init, util, found_imsg_init=yes, found_imsg_init=no)
226 dd038bc6 2021-09-21 thomas.ad if test "x$found_imsg_init" = xyes; then
227 dd038bc6 2021-09-21 thomas.ad AC_DEFINE(HAVE_IMSG)
229 dd038bc6 2021-09-21 thomas.ad AC_LIBOBJ(imsg)
230 dd038bc6 2021-09-21 thomas.ad AC_LIBOBJ(imsg-buffer)
233 ff36aeea 2022-07-16 thomas # libevent (for gotwebd). Lifted from tmux.
234 ff36aeea 2022-07-16 thomas # Look for libevent. Try libevent_core or libevent with pkg-config first then
235 ff36aeea 2022-07-16 thomas # look for the library.
236 ff36aeea 2022-07-16 thomas PKG_CHECK_MODULES(
237 ff36aeea 2022-07-16 thomas LIBEVENT_CORE,
238 ff36aeea 2022-07-16 thomas [libevent_core >= 2],
240 ff36aeea 2022-07-16 thomas AM_CPPFLAGS="$LIBEVENT_CORE_CFLAGS $AM_CPPFLAGS"
241 ff36aeea 2022-07-16 thomas CPPFLAGS="$AM_CPPFLAGS $SAVED_CPPFLAGS"
242 ff36aeea 2022-07-16 thomas LIBS="$LIBEVENT_CORE_LIBS $LIBS"
243 ff36aeea 2022-07-16 thomas found_libevent=yes
245 ff36aeea 2022-07-16 thomas found_libevent=no
247 ff36aeea 2022-07-16 thomas if test x$found_libevent = xno; then
248 ff36aeea 2022-07-16 thomas PKG_CHECK_MODULES(
249 ff36aeea 2022-07-16 thomas LIBEVENT,
250 ff36aeea 2022-07-16 thomas [libevent >= 2],
252 ff36aeea 2022-07-16 thomas AM_CPPFLAGS="$LIBEVENT_CFLAGS $AM_CPPFLAGS"
253 ff36aeea 2022-07-16 thomas CPPFLAGS="$AM_CPPFLAGS $SAVED_CPPFLAGS"
254 ff36aeea 2022-07-16 thomas LIBS="$LIBEVENT_LIBS $LIBS"
255 ff36aeea 2022-07-16 thomas found_libevent=yes
257 ff36aeea 2022-07-16 thomas found_libevent=no
260 ff36aeea 2022-07-16 thomas if test x$found_libevent = xno; then
261 ff36aeea 2022-07-16 thomas AC_SEARCH_LIBS(
262 ff36aeea 2022-07-16 thomas event_init,
263 ff36aeea 2022-07-16 thomas [event_core event event-1.4],
264 ff36aeea 2022-07-16 thomas found_libevent=yes,
265 ff36aeea 2022-07-16 thomas found_libevent=no
268 ff36aeea 2022-07-16 thomas AC_CHECK_HEADER(
269 ff36aeea 2022-07-16 thomas event2/event.h,
270 ff36aeea 2022-07-16 thomas AC_DEFINE(HAVE_EVENT2_EVENT_H),
272 ff36aeea 2022-07-16 thomas AC_CHECK_HEADER(
274 ff36aeea 2022-07-16 thomas AC_DEFINE(HAVE_EVENT_H),
275 ff36aeea 2022-07-16 thomas found_libevent=no
279 ff36aeea 2022-07-16 thomas if test "x$found_libevent" = xno; then
280 ff36aeea 2022-07-16 thomas AC_MSG_ERROR("libevent not found")
283 dd038bc6 2021-09-21 thomas.ad # libcrypto (via libssl for SHA information)
284 dd038bc6 2021-09-21 thomas.ad PKG_CHECK_MODULES(
285 dd038bc6 2021-09-21 thomas.ad LIBCRYPTO,
286 dd038bc6 2021-09-21 thomas.ad libcrypto,
288 839511b2 2021-10-01 stsp AM_CFLAGS="$LIBCRYPTO_CFLAGS $AM_CFLAGS"
289 dd038bc6 2021-09-21 thomas.ad CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
290 dd038bc6 2021-09-21 thomas.ad LIBS="$LIBCRYPTO_LIBS $LIBS"
291 dd038bc6 2021-09-21 thomas.ad found_libcrypto=yes
294 92a9e85d 2021-09-24 thomas found_libcrypto=no
298 92a9e85d 2021-09-24 thomas if test "x$found_libcrypto" = "xyes"; then
299 92a9e85d 2021-09-24 thomas AC_DEFINE(HAVE_LIBCRYPTO)
302 dd038bc6 2021-09-21 thomas.ad AC_SEARCH_LIBS(uuid_create, , AC_DEFINE(HAVE_BSD_UUID))
303 326237a6 2021-09-25 thomas AC_SEARCH_LIBS(uuid_create, found_uuid=no, found_uuid=yes)
304 dd038bc6 2021-09-21 thomas.ad AC_SEARCH_LIBS(mergesort, , AC_DEFINE(HAVE_BSD_MERGESORT))
306 d24ddaa6 2022-02-26 thomas # Don't define HAVE_BSD_UUID on darwin (Apple) as this breaks the BSD API.
307 d24ddaa6 2022-02-26 thomas # Instead, use the UUID implementation wrapper that's in compat/ plus uuid
309 d24ddaa6 2022-02-26 thomas if test "x$found_uuid" = "xyes" -a "x$PLATFORM" != "darwin"; then
310 326237a6 2021-09-25 thomas AC_DEFINE(HAVE_BSD_UUID)
312 326237a6 2021-09-25 thomas PKG_CHECK_MODULES(
316 326237a6 2021-09-25 thomas AM_CFLAGS="$LIBUUID_CFLAGS $AM_CFLAGS"
317 326237a6 2021-09-25 thomas CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
318 326237a6 2021-09-25 thomas LIBS="$LIBUUID_LIBS $LIBS"
319 326237a6 2021-09-25 thomas found_libuuid=yes
322 326237a6 2021-09-25 thomas found_libuuid=no
326 326237a6 2021-09-25 thomas if test "x$found_libuuid" = "xno"; then
327 326237a6 2021-09-25 thomas AC_CHECK_HEADER(
329 326237a6 2021-09-25 thomas found_libuuid=yes,
330 326237a6 2021-09-25 thomas found_libuuid=no)
334 92a9e85d 2021-09-24 thomas if test "x$found_libuuid" = "xno"; then
335 92a9e85d 2021-09-24 thomas AC_MSG_ERROR("*** couldn't find uuid ***")
338 dd038bc6 2021-09-21 thomas.ad PKG_CHECK_MODULES(
342 dd038bc6 2021-09-21 thomas.ad AM_CFLAGS="$ZLIB_CFLAGS $AM_CFLAGS"
343 dd038bc6 2021-09-21 thomas.ad CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
344 dd038bc6 2021-09-21 thomas.ad LIBS="$ZLIB_LIBS $LIBS"
345 dd038bc6 2021-09-21 thomas.ad found_zlib=yes
348 92a9e85d 2021-09-24 thomas found_zlib=no
352 92a9e85d 2021-09-24 thomas if test "x$found_zlib" = "xno"; then
353 92a9e85d 2021-09-24 thomas AC_CHECK_HEADER(
356 92a9e85d 2021-09-24 thomas found_zlib=no)
359 92a9e85d 2021-09-24 thomas if test "x$found_zlib" = "xno"; then
360 92a9e85d 2021-09-24 thomas AC_MSG_ERROR("*** couldn't find zlib ***")
363 92a9e85d 2021-09-24 thomas if test "$PLATFORM" = "linux"; then
364 92a9e85d 2021-09-24 thomas PKG_CHECK_MODULES(
368 92a9e85d 2021-09-24 thomas AM_CFLAGS="$LIBMD_CFLAGS $AM_CFLAGS"
369 92a9e85d 2021-09-24 thomas CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
370 92a9e85d 2021-09-24 thomas LIBS="$LIBMD_LIBS $LIBS"
373 92a9e85d 2021-09-24 thomas AC_MSG_ERROR("*** couldn't find libmd via pkg-config")
376 92a9e85d 2021-09-24 thomas PKG_CHECK_MODULES(
378 92a9e85d 2021-09-24 thomas libbsd-overlay,
380 92a9e85d 2021-09-24 thomas AM_CFLAGS="$LIBBSD_CFLAGS $AM_CFLAGS"
381 92a9e85d 2021-09-24 thomas CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
382 92a9e85d 2021-09-24 thomas LIBS="$LIBBSD_LIBS $LIBS"
383 92a9e85d 2021-09-24 thomas found_libbsd=yes
384 92a9e85d 2021-09-24 thomas AC_DEFINE(HAVE_LIBBSD)
390 dd038bc6 2021-09-21 thomas.ad # Look for a suitable queue.h. We hope libbsd is enough, but that is missing
391 dd038bc6 2021-09-21 thomas.ad # SIMPLEQ.
392 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
393 dd038bc6 2021-09-21 thomas.ad SIMPLEQ_INIT,
394 dd038bc6 2021-09-21 thomas.ad found_queue_h=yes,
395 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
397 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
398 dd038bc6 2021-09-21 thomas.ad TAILQ_CONCAT,
399 dd038bc6 2021-09-21 thomas.ad found_queue_h=yes,
400 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
402 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
403 dd038bc6 2021-09-21 thomas.ad TAILQ_PREV,
405 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
407 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
408 dd038bc6 2021-09-21 thomas.ad TAILQ_REPLACE,
410 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
412 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
413 dd038bc6 2021-09-21 thomas.ad SIMPLEQ_ENTRY,
415 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
417 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
418 dd038bc6 2021-09-21 thomas.ad TAILQ_FOREACH_SAFE,
420 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
423 19467d59 2022-07-16 thomas if test "x$found_queue_h" = xyes -o "x$ac_cv_header_sys_queue_h" = xyes; then
424 dd038bc6 2021-09-21 thomas.ad AC_DEFINE(HAVE_QUEUE_H)
427 dd038bc6 2021-09-21 thomas.ad # Look for __progname.
428 dd038bc6 2021-09-21 thomas.ad AC_MSG_CHECKING(for __progname)
429 dd038bc6 2021-09-21 thomas.ad AC_LINK_IFELSE([AC_LANG_SOURCE(
431 dd038bc6 2021-09-21 thomas.ad #include <stdio.h>
432 dd038bc6 2021-09-21 thomas.ad #include <stdlib.h>
433 dd038bc6 2021-09-21 thomas.ad extern char *__progname;
434 dd038bc6 2021-09-21 thomas.ad int main(void) {
435 dd038bc6 2021-09-21 thomas.ad const char *cp = __progname;
436 dd038bc6 2021-09-21 thomas.ad printf("%s\n", cp);
437 dd038bc6 2021-09-21 thomas.ad exit(0);
440 dd038bc6 2021-09-21 thomas.ad [AC_DEFINE(HAVE___PROGNAME) AC_MSG_RESULT(yes)],
441 dd038bc6 2021-09-21 thomas.ad AC_MSG_RESULT(no)
444 d9e4d43f 2022-03-03 thomas PKG_CHECK_MODULES(
445 d9e4d43f 2022-03-03 thomas LIBPANELW,
447 d9e4d43f 2022-03-03 thomas found_panel=yes,
448 d9e4d43f 2022-03-03 thomas found_panel=no
451 d9e4d43f 2022-03-03 thomas PKG_CHECK_MODULES(
452 d9e4d43f 2022-03-03 thomas LIBPANELW,
453 d9e4d43f 2022-03-03 thomas gnupanelw,
454 d9e4d43f 2022-03-03 thomas found_panel=yes,
455 d9e4d43f 2022-03-03 thomas found_panel=no
458 b26177ad 2022-03-03 thomas PKG_CHECK_MODULES(
459 b26177ad 2022-03-03 thomas LIBPANELW,
461 b26177ad 2022-03-03 thomas found_panel=yes,
462 b26177ad 2022-03-03 thomas found_panel=no
464 d9e4d43f 2022-03-03 thomas if test "x$found_panel" = "xno"; then
465 92a9e85d 2021-09-24 thomas AC_CHECK_LIB(panelw, update_panels,,
466 92a9e85d 2021-09-24 thomas AC_MSG_ERROR([ "*** panelw not found for ncurses. ***"])
469 92a9e85d 2021-09-24 thomas LIBPANELW_LIBS="-lpanelw"
472 acf52a76 2021-09-21 thomas.ad PKG_CHECK_MODULES(
473 acf52a76 2021-09-21 thomas.ad LIBNCURSES,
474 acf52a76 2021-09-21 thomas.ad ncursesw,
475 dd038bc6 2021-09-21 thomas.ad found_ncurses=yes,
476 dd038bc6 2021-09-21 thomas.ad found_ncurses=no
478 acf52a76 2021-09-21 thomas.ad if test "x$found_ncurses" = xyes; then
479 acf52a76 2021-09-21 thomas.ad AM_CFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $LIBPANELW_CFLAGS $AM_CFLAGS"
480 acf52a76 2021-09-21 thomas.ad CFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $LIBPANELW_CFLAGS $CFLAGS"
481 acf52a76 2021-09-21 thomas.ad LIBS="$LIBNCURSES_LIBS $LIBTINFO_LIBS $LIBPANELW_LIBS $LIBS"
483 dd038bc6 2021-09-21 thomas.ad AC_CHECK_LIB(
484 acf52a76 2021-09-21 thomas.ad ncursesw,
485 dd038bc6 2021-09-21 thomas.ad setupterm,
486 dd038bc6 2021-09-21 thomas.ad found_ncurses=yes,
487 dd038bc6 2021-09-21 thomas.ad found_ncurses=no
489 dd038bc6 2021-09-21 thomas.ad if test "x$found_ncurses" = xyes; then
490 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADER(
491 dd038bc6 2021-09-21 thomas.ad ncurses.h,
492 acf52a76 2021-09-21 thomas.ad AM_CFLAGS="$LIBPANELW_CFLAGS $AM_CFLAGS"
493 acf52a76 2021-09-21 thomas.ad CFLAGS="$LIBPANEL_CFLAGS $CFLAGS"
494 acf52a76 2021-09-21 thomas.ad LIBS="$LIBS -lncursesw $LIBPANELW_LIBS",
495 acf52a76 2021-09-21 thomas.ad found_ncurses=no
499 dd038bc6 2021-09-21 thomas.ad if test "x$found_ncurses" = xyes; then
500 dd038bc6 2021-09-21 thomas.ad AC_DEFINE(HAVE_NCURSES_H)
502 dd038bc6 2021-09-21 thomas.ad # No ncurses, try curses.
503 dd038bc6 2021-09-21 thomas.ad AC_CHECK_LIB(
504 acf52a76 2021-09-21 thomas.ad cursesw,
505 dd038bc6 2021-09-21 thomas.ad setupterm,
506 dd038bc6 2021-09-21 thomas.ad found_curses=yes,
507 dd038bc6 2021-09-21 thomas.ad found_curses=no
509 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADER(
510 dd038bc6 2021-09-21 thomas.ad curses.h,
512 dd038bc6 2021-09-21 thomas.ad found_curses=no)
513 dd038bc6 2021-09-21 thomas.ad if test "x$found_curses" = xyes; then
514 acf52a76 2021-09-21 thomas.ad AM_CFLAGS="$LIBPANELW_CFLAGS $AM_CFLAGS"
515 acf52a76 2021-09-21 thomas.ad CFLAGS="$LIBPANEL_CFLAGS $CFLAGS"
516 acf52a76 2021-09-21 thomas.ad LIBS="$LIBS -lcursesw $LIBPANELW_LIBS"
517 dd038bc6 2021-09-21 thomas.ad AC_DEFINE(HAVE_CURSES_H)
519 dd038bc6 2021-09-21 thomas.ad AC_MSG_ERROR("curses not found")
523 dd038bc6 2021-09-21 thomas.ad # Save our CFLAGS/CPPFLAGS/LDFLAGS for the Makefile and restore the old user
524 dd038bc6 2021-09-21 thomas.ad # variables.
525 dd038bc6 2021-09-21 thomas.ad AC_SUBST(AM_CPPFLAGS)
526 dd038bc6 2021-09-21 thomas.ad CPPFLAGS="$SAVED_CPPFLAGS"
527 dd038bc6 2021-09-21 thomas.ad AC_SUBST(AM_CFLAGS)
528 dd038bc6 2021-09-21 thomas.ad CFLAGS="$SAVED_CFLAGS"
529 dd038bc6 2021-09-21 thomas.ad AC_SUBST(AM_LDFLAGS)
530 dd038bc6 2021-09-21 thomas.ad LDFLAGS="$SAVED_LDFLAGS"
532 dd038bc6 2021-09-21 thomas.ad AC_CONFIG_FILES([Makefile
533 dd038bc6 2021-09-21 thomas.ad compat/Makefile
534 dd038bc6 2021-09-21 thomas.ad libexec/Makefile
535 dd038bc6 2021-09-21 thomas.ad libexec/got-read-tree/Makefile
536 dd038bc6 2021-09-21 thomas.ad libexec/got-fetch-pack/Makefile
537 dd038bc6 2021-09-21 thomas.ad libexec/got-index-pack/Makefile
538 dd038bc6 2021-09-21 thomas.ad libexec/got-read-blob/Makefile
539 dd038bc6 2021-09-21 thomas.ad libexec/got-read-commit/Makefile
540 dd038bc6 2021-09-21 thomas.ad libexec/got-read-gitconfig/Makefile
541 dd038bc6 2021-09-21 thomas.ad libexec/got-read-gotconfig/Makefile
542 dd038bc6 2021-09-21 thomas.ad libexec/got-read-object/Makefile
543 dd038bc6 2021-09-21 thomas.ad libexec/got-read-pack/Makefile
544 973f3f6e 2022-03-07 thomas libexec/got-read-patch/Makefile
545 dd038bc6 2021-09-21 thomas.ad libexec/got-read-tag/Makefile
546 dd038bc6 2021-09-21 thomas.ad libexec/got-send-pack/Makefile
547 dd038bc6 2021-09-21 thomas.ad got/Makefile
548 2b0eee35 2021-09-21 thomas.ad gotadmin/Makefile
549 ff36aeea 2022-07-16 thomas gotwebd/Makefile
550 d3f2ad5e 2021-09-21 thomas.ad tog/Makefile
551 5a7ef102 2021-10-09 thomas Makefile.common:Makefile.common.in])
552 dd038bc6 2021-09-21 thomas.ad AC_OUTPUT
554 dd038bc6 2021-09-21 thomas.ad # tog/GNUMakefile])
555 dd038bc6 2021-09-21 thomas.ad # regress/GNUMakefile
556 dd038bc6 2021-09-21 thomas.ad # regress/cmdline/GNUMakefile
557 dd038bc6 2021-09-21 thomas.ad # regress/delta/GNUMakefile
558 dd038bc6 2021-09-21 thomas.ad # regress/fetch/GNUMakefile
559 dd038bc6 2021-09-21 thomas.ad # regress/idset/GNUMakefile
560 dd038bc6 2021-09-21 thomas.ad # regress/path/GNUMakefile
561 dd038bc6 2021-09-21 thomas.ad # gotweb/GNUMakefile
562 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/GNUMakefile
563 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-blob/GNUMakefile
564 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-commit/GNUMakefile
565 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-gitconfig/GNUMakefile
566 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-gotconfig/GNUMakefile
567 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-object/GNUMakefile
568 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-pack/GNUMakefile
569 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-tag/GNUMakefile
570 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-tree/GNUMakefile