Blame


1 dd038bc6 2021-09-21 thomas.ad # Process this file with autoconf to produce a configure script.
2 dd038bc6 2021-09-21 thomas.ad
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])
8 dd038bc6 2021-09-21 thomas.ad
9 dd038bc6 2021-09-21 thomas.ad GOT_RELEASE=No
10 dd038bc6 2021-09-21 thomas.ad
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)
14 dd038bc6 2021-09-21 thomas.ad
15 dd038bc6 2021-09-21 thomas.ad AC_CANONICAL_HOST
16 dd038bc6 2021-09-21 thomas.ad
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=""}
21 dd038bc6 2021-09-21 thomas.ad
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"
28 dd038bc6 2021-09-21 thomas.ad
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
39 dd038bc6 2021-09-21 thomas.ad
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 \
50 d24ddaa6 2022-02-26 thomas poll.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 \
65 dd038bc6 2021-09-21 thomas.ad ])
66 dd038bc6 2021-09-21 thomas.ad
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
80 dd038bc6 2021-09-21 thomas.ad
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])
83 ff36aeea 2022-07-16 thomas
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)
86 dd038bc6 2021-09-21 thomas.ad
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([ \
97 dd038bc6 2021-09-21 thomas.ad dup2 \
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 \
126 dd038bc6 2021-09-21 thomas.ad ])
127 ddd12270 2022-04-22 thomas
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])
131 dd038bc6 2021-09-21 thomas.ad
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 \
149 dd038bc6 2021-09-21 thomas.ad ])
150 dd038bc6 2021-09-21 thomas.ad
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)
156 dd038bc6 2021-09-21 thomas.ad
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
160 92a9e85d 2021-09-24 thomas *linux*)
161 92a9e85d 2021-09-24 thomas AC_MSG_RESULT(linux)
162 92a9e85d 2021-09-24 thomas PLATFORM=linux
163 92a9e85d 2021-09-24 thomas ;;
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
167 d24ddaa6 2022-02-26 thomas ;;
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
171 a3732bb6 2022-02-26 thomas ;;
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
175 92a9e85d 2021-09-24 thomas ;;
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
179 b26177ad 2022-03-03 thomas ;;
180 92a9e85d 2021-09-24 thomas *)
181 92a9e85d 2021-09-24 thomas AC_MSG_RESULT(unknown)
182 92a9e85d 2021-09-24 thomas PLATFORM=unknown
183 92a9e85d 2021-09-24 thomas ;;
184 92a9e85d 2021-09-24 thomas esac
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"])
191 92a9e85d 2021-09-24 thomas
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)
198 97799ccd 2022-02-06 thomas else
199 97799ccd 2022-02-06 thomas AC_MSG_RESULT(no)
200 97799ccd 2022-02-06 thomas fi
201 97799ccd 2022-02-06 thomas
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);]
209 dd038bc6 2021-09-21 thomas.ad )],
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])]
213 dd038bc6 2021-09-21 thomas.ad )
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);]
218 dd038bc6 2021-09-21 thomas.ad )],
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])]
222 dd038bc6 2021-09-21 thomas.ad )
223 dd038bc6 2021-09-21 thomas.ad
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)
228 dd038bc6 2021-09-21 thomas.ad else
229 dd038bc6 2021-09-21 thomas.ad AC_LIBOBJ(imsg)
230 dd038bc6 2021-09-21 thomas.ad AC_LIBOBJ(imsg-buffer)
231 ff36aeea 2022-07-16 thomas fi
232 ff36aeea 2022-07-16 thomas
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],
239 ff36aeea 2022-07-16 thomas [
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
244 ff36aeea 2022-07-16 thomas ],
245 ff36aeea 2022-07-16 thomas found_libevent=no
246 ff36aeea 2022-07-16 thomas )
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],
251 ff36aeea 2022-07-16 thomas [
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
256 ff36aeea 2022-07-16 thomas ],
257 ff36aeea 2022-07-16 thomas found_libevent=no
258 ff36aeea 2022-07-16 thomas )
259 ff36aeea 2022-07-16 thomas fi
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
266 ff36aeea 2022-07-16 thomas )
267 ff36aeea 2022-07-16 thomas fi
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),
271 ff36aeea 2022-07-16 thomas [
272 ff36aeea 2022-07-16 thomas AC_CHECK_HEADER(
273 ff36aeea 2022-07-16 thomas event.h,
274 ff36aeea 2022-07-16 thomas AC_DEFINE(HAVE_EVENT_H),
275 ff36aeea 2022-07-16 thomas found_libevent=no
276 ff36aeea 2022-07-16 thomas )
277 ff36aeea 2022-07-16 thomas ]
278 ff36aeea 2022-07-16 thomas )
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")
281 dd038bc6 2021-09-21 thomas.ad fi
282 dd038bc6 2021-09-21 thomas.ad
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,
287 dd038bc6 2021-09-21 thomas.ad [
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
292 dd038bc6 2021-09-21 thomas.ad ],
293 dd038bc6 2021-09-21 thomas.ad [
294 92a9e85d 2021-09-24 thomas found_libcrypto=no
295 dd038bc6 2021-09-21 thomas.ad ]
296 dd038bc6 2021-09-21 thomas.ad )
297 dd038bc6 2021-09-21 thomas.ad
298 92a9e85d 2021-09-24 thomas if test "x$found_libcrypto" = "xyes"; then
299 92a9e85d 2021-09-24 thomas AC_DEFINE(HAVE_LIBCRYPTO)
300 92a9e85d 2021-09-24 thomas fi
301 92a9e85d 2021-09-24 thomas
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))
305 dd038bc6 2021-09-21 thomas.ad
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
308 d24ddaa6 2022-02-26 thomas # ossp
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)
311 326237a6 2021-09-25 thomas else
312 326237a6 2021-09-25 thomas PKG_CHECK_MODULES(
313 326237a6 2021-09-25 thomas LIBUUID,
314 326237a6 2021-09-25 thomas uuid,
315 326237a6 2021-09-25 thomas [
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
320 326237a6 2021-09-25 thomas ],
321 326237a6 2021-09-25 thomas [
322 326237a6 2021-09-25 thomas found_libuuid=no
323 326237a6 2021-09-25 thomas ]
324 326237a6 2021-09-25 thomas )
325 dd038bc6 2021-09-21 thomas.ad
326 326237a6 2021-09-25 thomas if test "x$found_libuuid" = "xno"; then
327 326237a6 2021-09-25 thomas AC_CHECK_HEADER(
328 326237a6 2021-09-25 thomas uuid.h,
329 326237a6 2021-09-25 thomas found_libuuid=yes,
330 326237a6 2021-09-25 thomas found_libuuid=no)
331 326237a6 2021-09-25 thomas fi
332 92a9e85d 2021-09-24 thomas fi
333 dd038bc6 2021-09-21 thomas.ad
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 ***")
336 92a9e85d 2021-09-24 thomas fi
337 92a9e85d 2021-09-24 thomas
338 dd038bc6 2021-09-21 thomas.ad PKG_CHECK_MODULES(
339 dd038bc6 2021-09-21 thomas.ad ZLIB,
340 dd038bc6 2021-09-21 thomas.ad zlib,
341 dd038bc6 2021-09-21 thomas.ad [
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
346 dd038bc6 2021-09-21 thomas.ad ],
347 dd038bc6 2021-09-21 thomas.ad [
348 92a9e85d 2021-09-24 thomas found_zlib=no
349 dd038bc6 2021-09-21 thomas.ad ]
350 dd038bc6 2021-09-21 thomas.ad )
351 dd038bc6 2021-09-21 thomas.ad
352 92a9e85d 2021-09-24 thomas if test "x$found_zlib" = "xno"; then
353 92a9e85d 2021-09-24 thomas AC_CHECK_HEADER(
354 92a9e85d 2021-09-24 thomas zlib.h,
355 92a9e85d 2021-09-24 thomas ,
356 92a9e85d 2021-09-24 thomas found_zlib=no)
357 92a9e85d 2021-09-24 thomas fi
358 dd038bc6 2021-09-21 thomas.ad
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 ***")
361 92a9e85d 2021-09-24 thomas fi
362 dd038bc6 2021-09-21 thomas.ad
363 92a9e85d 2021-09-24 thomas if test "$PLATFORM" = "linux"; then
364 92a9e85d 2021-09-24 thomas PKG_CHECK_MODULES(
365 92a9e85d 2021-09-24 thomas LIBMD,
366 92a9e85d 2021-09-24 thomas libmd,
367 92a9e85d 2021-09-24 thomas [
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"
371 92a9e85d 2021-09-24 thomas ],
372 92a9e85d 2021-09-24 thomas [
373 92a9e85d 2021-09-24 thomas AC_MSG_ERROR("*** couldn't find libmd via pkg-config")
374 92a9e85d 2021-09-24 thomas ]
375 92a9e85d 2021-09-24 thomas )
376 92a9e85d 2021-09-24 thomas PKG_CHECK_MODULES(
377 92a9e85d 2021-09-24 thomas LIBBSD,
378 92a9e85d 2021-09-24 thomas libbsd-overlay,
379 92a9e85d 2021-09-24 thomas [
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)
385 92a9e85d 2021-09-24 thomas ],
386 92a9e85d 2021-09-24 thomas []
387 92a9e85d 2021-09-24 thomas )
388 92a9e85d 2021-09-24 thomas fi
389 92a9e85d 2021-09-24 thomas
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,
396 dd038bc6 2021-09-21 thomas.ad )
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,
401 dd038bc6 2021-09-21 thomas.ad )
402 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
403 dd038bc6 2021-09-21 thomas.ad TAILQ_PREV,
404 19467d59 2022-07-16 thomas ,
405 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
406 dd038bc6 2021-09-21 thomas.ad )
407 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
408 dd038bc6 2021-09-21 thomas.ad TAILQ_REPLACE,
409 19467d59 2022-07-16 thomas ,
410 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
411 dd038bc6 2021-09-21 thomas.ad )
412 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
413 dd038bc6 2021-09-21 thomas.ad SIMPLEQ_ENTRY,
414 dd038bc6 2021-09-21 thomas.ad ,
415 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
416 dd038bc6 2021-09-21 thomas.ad )
417 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
418 dd038bc6 2021-09-21 thomas.ad TAILQ_FOREACH_SAFE,
419 dd038bc6 2021-09-21 thomas.ad ,
420 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
421 dd038bc6 2021-09-21 thomas.ad )
422 19467d59 2022-07-16 thomas
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)
425 dd038bc6 2021-09-21 thomas.ad fi
426 dd038bc6 2021-09-21 thomas.ad
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(
430 dd038bc6 2021-09-21 thomas.ad [
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);
438 dd038bc6 2021-09-21 thomas.ad }
439 dd038bc6 2021-09-21 thomas.ad ])],
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)
442 dd038bc6 2021-09-21 thomas.ad )
443 dd038bc6 2021-09-21 thomas.ad
444 d9e4d43f 2022-03-03 thomas PKG_CHECK_MODULES(
445 d9e4d43f 2022-03-03 thomas LIBPANELW,
446 d9e4d43f 2022-03-03 thomas panelw,
447 d9e4d43f 2022-03-03 thomas found_panel=yes,
448 d9e4d43f 2022-03-03 thomas found_panel=no
449 d9e4d43f 2022-03-03 thomas )
450 d9e4d43f 2022-03-03 thomas
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
456 d9e4d43f 2022-03-03 thomas )
457 d9e4d43f 2022-03-03 thomas
458 b26177ad 2022-03-03 thomas PKG_CHECK_MODULES(
459 b26177ad 2022-03-03 thomas LIBPANELW,
460 b26177ad 2022-03-03 thomas panel,
461 b26177ad 2022-03-03 thomas found_panel=yes,
462 b26177ad 2022-03-03 thomas found_panel=no
463 b26177ad 2022-03-03 thomas )
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. ***"])
467 92a9e85d 2021-09-24 thomas )
468 acf52a76 2021-09-21 thomas.ad
469 92a9e85d 2021-09-24 thomas LIBPANELW_LIBS="-lpanelw"
470 92a9e85d 2021-09-24 thomas fi
471 92a9e85d 2021-09-24 thomas
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
477 dd038bc6 2021-09-21 thomas.ad )
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"
482 dd038bc6 2021-09-21 thomas.ad else
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
488 dd038bc6 2021-09-21 thomas.ad )
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
496 acf52a76 2021-09-21 thomas.ad )
497 92a9e85d 2021-09-24 thomas fi
498 dd038bc6 2021-09-21 thomas.ad fi
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)
501 dd038bc6 2021-09-21 thomas.ad else
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
508 dd038bc6 2021-09-21 thomas.ad )
509 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADER(
510 dd038bc6 2021-09-21 thomas.ad curses.h,
511 dd038bc6 2021-09-21 thomas.ad ,
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)
518 dd038bc6 2021-09-21 thomas.ad else
519 dd038bc6 2021-09-21 thomas.ad AC_MSG_ERROR("curses not found")
520 dd038bc6 2021-09-21 thomas.ad fi
521 dd038bc6 2021-09-21 thomas.ad fi
522 dd038bc6 2021-09-21 thomas.ad
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"
531 dd038bc6 2021-09-21 thomas.ad
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
553 dd038bc6 2021-09-21 thomas.ad
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