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 683ec58e 2022-07-16 thomas setresgid \
113 683ec58e 2022-07-16 thomas setresuid \
114 c4e2e0d0 2022-07-16 thomas setproctitle \
115 dd038bc6 2021-09-21 thomas.ad strcasecmp \
116 dd038bc6 2021-09-21 thomas.ad strchr \
117 dd038bc6 2021-09-21 thomas.ad strcspn \
118 dd038bc6 2021-09-21 thomas.ad strdup \
119 dd038bc6 2021-09-21 thomas.ad strerror \
120 dd038bc6 2021-09-21 thomas.ad strlcpy \
121 dd038bc6 2021-09-21 thomas.ad strncasecmp \
122 dd038bc6 2021-09-21 thomas.ad strndup \
123 dd038bc6 2021-09-21 thomas.ad strrchr \
124 dd038bc6 2021-09-21 thomas.ad strspn \
125 dd038bc6 2021-09-21 thomas.ad strstr \
126 dd038bc6 2021-09-21 thomas.ad strtol \
127 dd038bc6 2021-09-21 thomas.ad strtoul \
128 dd038bc6 2021-09-21 thomas.ad wcwidth \
129 dd038bc6 2021-09-21 thomas.ad ])
130 ddd12270 2022-04-22 thomas
131 c4e2e0d0 2022-07-16 thomas AM_CONDITIONAL([HAVE_SETPROCTITLE], [test "x$ac_cv_func_setproctitle" = xyes])
132 683ec58e 2022-07-16 thomas AM_CONDITIONAL([HAVE_SETRESGID], [test "x$ac_cv_func_setresgid" = xyes])
133 683ec58e 2022-07-16 thomas AM_CONDITIONAL([HAVE_SETRESUID], [test "x$ac_cv_func_setresuid" = xyes])
134 c4e2e0d0 2022-07-16 thomas
135 ddd12270 2022-04-22 thomas # Siphash support.
136 ddd12270 2022-04-22 thomas AC_CHECK_FUNCS([SipHash])
137 ddd12270 2022-04-22 thomas AM_CONDITIONAL([HAVE_SIPHASH], [test "x$ac_cv_func_SipHash" = xyes])
138 dd038bc6 2021-09-21 thomas.ad
139 dd038bc6 2021-09-21 thomas.ad # Check for functions with a compatibility implementation.
140 dd038bc6 2021-09-21 thomas.ad AC_REPLACE_FUNCS([ \
141 dd038bc6 2021-09-21 thomas.ad asprintf \
142 dd038bc6 2021-09-21 thomas.ad closefrom \
143 dd038bc6 2021-09-21 thomas.ad explicit_bzero \
144 dd038bc6 2021-09-21 thomas.ad fmt_scaled \
145 dd038bc6 2021-09-21 thomas.ad freezero \
146 dd038bc6 2021-09-21 thomas.ad getdtablecount \
147 dd038bc6 2021-09-21 thomas.ad getline \
148 dd038bc6 2021-09-21 thomas.ad getprogname \
149 dd038bc6 2021-09-21 thomas.ad recallocarray \
150 dd038bc6 2021-09-21 thomas.ad reallocarray \
151 dd038bc6 2021-09-21 thomas.ad strlcat \
152 dd038bc6 2021-09-21 thomas.ad strlcpy \
153 dd038bc6 2021-09-21 thomas.ad strndup \
154 dd038bc6 2021-09-21 thomas.ad strsep \
155 dd038bc6 2021-09-21 thomas.ad strtonum \
156 dd038bc6 2021-09-21 thomas.ad ])
157 dd038bc6 2021-09-21 thomas.ad
158 dd038bc6 2021-09-21 thomas.ad # Always use our getopt because 1) glibc's doesn't enforce argument order 2)
159 dd038bc6 2021-09-21 thomas.ad # musl does not set optarg to NULL for flags without arguments (although it is
160 dd038bc6 2021-09-21 thomas.ad # not required to, but it is helpful) 3) there are probably other weird
161 dd038bc6 2021-09-21 thomas.ad # implementations.
162 dd038bc6 2021-09-21 thomas.ad AC_LIBOBJ(getopt)
163 dd038bc6 2021-09-21 thomas.ad
164 92a9e85d 2021-09-24 thomas # Check the platform we're compiling on.
165 92a9e85d 2021-09-24 thomas AC_MSG_CHECKING(platform)
166 92a9e85d 2021-09-24 thomas case "$host_os" in
167 92a9e85d 2021-09-24 thomas *linux*)
168 92a9e85d 2021-09-24 thomas AC_MSG_RESULT(linux)
169 92a9e85d 2021-09-24 thomas PLATFORM=linux
170 92a9e85d 2021-09-24 thomas ;;
171 92a9e85d 2021-09-24 thomas *freebsd*)
172 92a9e85d 2021-09-24 thomas AC_MSG_RESULT(freebsd)
173 92a9e85d 2021-09-24 thomas PLATFORM=freebsd
174 d24ddaa6 2022-02-26 thomas ;;
175 d24ddaa6 2022-02-26 thomas *darwin*)
176 d24ddaa6 2022-02-26 thomas AC_MSG_RESULT(darwin)
177 d24ddaa6 2022-02-26 thomas PLATFORM=darwin
178 a3732bb6 2022-02-26 thomas ;;
179 a3732bb6 2022-02-26 thomas *netbsd*)
180 a3732bb6 2022-02-26 thomas AC_MSG_RESULT(netbsd)
181 a3732bb6 2022-02-26 thomas PLATFORM=netbsd
182 92a9e85d 2021-09-24 thomas ;;
183 b26177ad 2022-03-03 thomas *dragonfly*)
184 b26177ad 2022-03-03 thomas AC_MSG_RESULT(dragonfly)
185 b26177ad 2022-03-03 thomas PLATFORM=dragonflybsd
186 b26177ad 2022-03-03 thomas ;;
187 92a9e85d 2021-09-24 thomas *)
188 92a9e85d 2021-09-24 thomas AC_MSG_RESULT(unknown)
189 92a9e85d 2021-09-24 thomas PLATFORM=unknown
190 92a9e85d 2021-09-24 thomas ;;
191 92a9e85d 2021-09-24 thomas esac
192 92a9e85d 2021-09-24 thomas AC_SUBST(PLATFORM)
193 92a9e85d 2021-09-24 thomas AM_CONDITIONAL([HOST_FREEBSD], [test "$PLATFORM" = "freebsd"])
194 92a9e85d 2021-09-24 thomas AM_CONDITIONAL([HOST_LINUX], [test "$PLATFORM" = "linux"])
195 d24ddaa6 2022-02-26 thomas AM_CONDITIONAL([HOST_DARWIN], [test "$PLATFORM" = "darwin"])
196 a3732bb6 2022-02-26 thomas AM_CONDITIONAL([HOST_NETBSD], [test "$PLATFORM" = "netbsd"])
197 b26177ad 2022-03-03 thomas AM_CONDITIONAL([HOST_DRAGONFLYBSD], [test "$PLATFORM" = "dragonflybsd"])
198 92a9e85d 2021-09-24 thomas
199 97799ccd 2022-02-06 thomas # Landlock detection.
200 97799ccd 2022-02-06 thomas AC_MSG_CHECKING([for landlock])
201 97799ccd 2022-02-06 thomas AM_CONDITIONAL([HAVE_LINUX_LANDLOCK],
202 97799ccd 2022-02-06 thomas [test "x$ac_cv_header_linux_landlock_h" = "xyes"])
203 97799ccd 2022-02-06 thomas if test "x$ac_cv_header_linux_landlock_h" = "xyes"; then
204 97799ccd 2022-02-06 thomas AC_MSG_RESULT(yes)
205 97799ccd 2022-02-06 thomas else
206 97799ccd 2022-02-06 thomas AC_MSG_RESULT(no)
207 97799ccd 2022-02-06 thomas fi
208 97799ccd 2022-02-06 thomas
209 dd038bc6 2021-09-21 thomas.ad # Clang sanitizers wrap reallocarray even if it isn't available on the target
210 dd038bc6 2021-09-21 thomas.ad # system. When compiled it always returns NULL and crashes the program. To
211 dd038bc6 2021-09-21 thomas.ad # detect this we need a more complicated test.
212 dd038bc6 2021-09-21 thomas.ad AC_MSG_CHECKING([for working reallocarray])
213 dd038bc6 2021-09-21 thomas.ad AC_RUN_IFELSE([AC_LANG_PROGRAM(
214 dd038bc6 2021-09-21 thomas.ad [#include <stdlib.h>],
215 dd038bc6 2021-09-21 thomas.ad [return (reallocarray(NULL, 1, 1) == NULL);]
216 dd038bc6 2021-09-21 thomas.ad )],
217 dd038bc6 2021-09-21 thomas.ad AC_MSG_RESULT(yes),
218 7f20c2a8 2022-05-13 op [AC_LIBOBJ(reallocarray) AC_MSG_RESULT([no])],
219 dd038bc6 2021-09-21 thomas.ad [AC_LIBOBJ(reallocarray) AC_MSG_RESULT([no])]
220 dd038bc6 2021-09-21 thomas.ad )
221 dd038bc6 2021-09-21 thomas.ad AC_MSG_CHECKING([for working recallocarray])
222 dd038bc6 2021-09-21 thomas.ad AC_RUN_IFELSE([AC_LANG_PROGRAM(
223 dd038bc6 2021-09-21 thomas.ad [#include <stdlib.h>],
224 dd038bc6 2021-09-21 thomas.ad [return (recallocarray(NULL, 1, 1, 1) == NULL);]
225 dd038bc6 2021-09-21 thomas.ad )],
226 dd038bc6 2021-09-21 thomas.ad AC_MSG_RESULT(yes),
227 7f20c2a8 2022-05-13 op [AC_LIBOBJ(recallocarray) AC_MSG_RESULT([no])],
228 dd038bc6 2021-09-21 thomas.ad [AC_LIBOBJ(recallocarray) AC_MSG_RESULT([no])]
229 dd038bc6 2021-09-21 thomas.ad )
230 dd038bc6 2021-09-21 thomas.ad
231 dd038bc6 2021-09-21 thomas.ad # Look for imsg_init in libutil.
232 dd038bc6 2021-09-21 thomas.ad AC_SEARCH_LIBS(imsg_init, util, found_imsg_init=yes, found_imsg_init=no)
233 dd038bc6 2021-09-21 thomas.ad if test "x$found_imsg_init" = xyes; then
234 dd038bc6 2021-09-21 thomas.ad AC_DEFINE(HAVE_IMSG)
235 dd038bc6 2021-09-21 thomas.ad else
236 dd038bc6 2021-09-21 thomas.ad AC_LIBOBJ(imsg)
237 dd038bc6 2021-09-21 thomas.ad AC_LIBOBJ(imsg-buffer)
238 ff36aeea 2022-07-16 thomas fi
239 ff36aeea 2022-07-16 thomas
240 ff36aeea 2022-07-16 thomas # libevent (for gotwebd). Lifted from tmux.
241 ff36aeea 2022-07-16 thomas # Look for libevent. Try libevent_core or libevent with pkg-config first then
242 ff36aeea 2022-07-16 thomas # look for the library.
243 ff36aeea 2022-07-16 thomas PKG_CHECK_MODULES(
244 ff36aeea 2022-07-16 thomas LIBEVENT_CORE,
245 ff36aeea 2022-07-16 thomas [libevent_core >= 2],
246 ff36aeea 2022-07-16 thomas [
247 ff36aeea 2022-07-16 thomas AM_CPPFLAGS="$LIBEVENT_CORE_CFLAGS $AM_CPPFLAGS"
248 ff36aeea 2022-07-16 thomas CPPFLAGS="$AM_CPPFLAGS $SAVED_CPPFLAGS"
249 ff36aeea 2022-07-16 thomas LIBS="$LIBEVENT_CORE_LIBS $LIBS"
250 ff36aeea 2022-07-16 thomas found_libevent=yes
251 ff36aeea 2022-07-16 thomas ],
252 ff36aeea 2022-07-16 thomas found_libevent=no
253 ff36aeea 2022-07-16 thomas )
254 ff36aeea 2022-07-16 thomas if test x$found_libevent = xno; then
255 ff36aeea 2022-07-16 thomas PKG_CHECK_MODULES(
256 ff36aeea 2022-07-16 thomas LIBEVENT,
257 ff36aeea 2022-07-16 thomas [libevent >= 2],
258 ff36aeea 2022-07-16 thomas [
259 ff36aeea 2022-07-16 thomas AM_CPPFLAGS="$LIBEVENT_CFLAGS $AM_CPPFLAGS"
260 ff36aeea 2022-07-16 thomas CPPFLAGS="$AM_CPPFLAGS $SAVED_CPPFLAGS"
261 ff36aeea 2022-07-16 thomas LIBS="$LIBEVENT_LIBS $LIBS"
262 ff36aeea 2022-07-16 thomas found_libevent=yes
263 ff36aeea 2022-07-16 thomas ],
264 ff36aeea 2022-07-16 thomas found_libevent=no
265 ff36aeea 2022-07-16 thomas )
266 ff36aeea 2022-07-16 thomas fi
267 ff36aeea 2022-07-16 thomas if test x$found_libevent = xno; then
268 ff36aeea 2022-07-16 thomas AC_SEARCH_LIBS(
269 ff36aeea 2022-07-16 thomas event_init,
270 ff36aeea 2022-07-16 thomas [event_core event event-1.4],
271 ff36aeea 2022-07-16 thomas found_libevent=yes,
272 ff36aeea 2022-07-16 thomas found_libevent=no
273 ff36aeea 2022-07-16 thomas )
274 ff36aeea 2022-07-16 thomas fi
275 ff36aeea 2022-07-16 thomas AC_CHECK_HEADER(
276 ff36aeea 2022-07-16 thomas event2/event.h,
277 ff36aeea 2022-07-16 thomas AC_DEFINE(HAVE_EVENT2_EVENT_H),
278 ff36aeea 2022-07-16 thomas [
279 ff36aeea 2022-07-16 thomas AC_CHECK_HEADER(
280 ff36aeea 2022-07-16 thomas event.h,
281 ff36aeea 2022-07-16 thomas AC_DEFINE(HAVE_EVENT_H),
282 ff36aeea 2022-07-16 thomas found_libevent=no
283 ff36aeea 2022-07-16 thomas )
284 ff36aeea 2022-07-16 thomas ]
285 ff36aeea 2022-07-16 thomas )
286 ff36aeea 2022-07-16 thomas if test "x$found_libevent" = xno; then
287 ff36aeea 2022-07-16 thomas AC_MSG_ERROR("libevent not found")
288 dd038bc6 2021-09-21 thomas.ad fi
289 dd038bc6 2021-09-21 thomas.ad
290 dd038bc6 2021-09-21 thomas.ad # libcrypto (via libssl for SHA information)
291 dd038bc6 2021-09-21 thomas.ad PKG_CHECK_MODULES(
292 dd038bc6 2021-09-21 thomas.ad LIBCRYPTO,
293 dd038bc6 2021-09-21 thomas.ad libcrypto,
294 dd038bc6 2021-09-21 thomas.ad [
295 839511b2 2021-10-01 stsp AM_CFLAGS="$LIBCRYPTO_CFLAGS $AM_CFLAGS"
296 dd038bc6 2021-09-21 thomas.ad CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
297 dd038bc6 2021-09-21 thomas.ad LIBS="$LIBCRYPTO_LIBS $LIBS"
298 dd038bc6 2021-09-21 thomas.ad found_libcrypto=yes
299 dd038bc6 2021-09-21 thomas.ad ],
300 dd038bc6 2021-09-21 thomas.ad [
301 92a9e85d 2021-09-24 thomas found_libcrypto=no
302 dd038bc6 2021-09-21 thomas.ad ]
303 dd038bc6 2021-09-21 thomas.ad )
304 dd038bc6 2021-09-21 thomas.ad
305 92a9e85d 2021-09-24 thomas if test "x$found_libcrypto" = "xyes"; then
306 92a9e85d 2021-09-24 thomas AC_DEFINE(HAVE_LIBCRYPTO)
307 92a9e85d 2021-09-24 thomas fi
308 92a9e85d 2021-09-24 thomas
309 dd038bc6 2021-09-21 thomas.ad AC_SEARCH_LIBS(uuid_create, , AC_DEFINE(HAVE_BSD_UUID))
310 326237a6 2021-09-25 thomas AC_SEARCH_LIBS(uuid_create, found_uuid=no, found_uuid=yes)
311 dd038bc6 2021-09-21 thomas.ad AC_SEARCH_LIBS(mergesort, , AC_DEFINE(HAVE_BSD_MERGESORT))
312 dd038bc6 2021-09-21 thomas.ad
313 d24ddaa6 2022-02-26 thomas # Don't define HAVE_BSD_UUID on darwin (Apple) as this breaks the BSD API.
314 d24ddaa6 2022-02-26 thomas # Instead, use the UUID implementation wrapper that's in compat/ plus uuid
315 d24ddaa6 2022-02-26 thomas # ossp
316 d24ddaa6 2022-02-26 thomas if test "x$found_uuid" = "xyes" -a "x$PLATFORM" != "darwin"; then
317 326237a6 2021-09-25 thomas AC_DEFINE(HAVE_BSD_UUID)
318 326237a6 2021-09-25 thomas else
319 326237a6 2021-09-25 thomas PKG_CHECK_MODULES(
320 326237a6 2021-09-25 thomas LIBUUID,
321 326237a6 2021-09-25 thomas uuid,
322 326237a6 2021-09-25 thomas [
323 326237a6 2021-09-25 thomas AM_CFLAGS="$LIBUUID_CFLAGS $AM_CFLAGS"
324 326237a6 2021-09-25 thomas CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
325 326237a6 2021-09-25 thomas LIBS="$LIBUUID_LIBS $LIBS"
326 326237a6 2021-09-25 thomas found_libuuid=yes
327 326237a6 2021-09-25 thomas ],
328 326237a6 2021-09-25 thomas [
329 326237a6 2021-09-25 thomas found_libuuid=no
330 326237a6 2021-09-25 thomas ]
331 326237a6 2021-09-25 thomas )
332 dd038bc6 2021-09-21 thomas.ad
333 326237a6 2021-09-25 thomas if test "x$found_libuuid" = "xno"; then
334 326237a6 2021-09-25 thomas AC_CHECK_HEADER(
335 326237a6 2021-09-25 thomas uuid.h,
336 326237a6 2021-09-25 thomas found_libuuid=yes,
337 326237a6 2021-09-25 thomas found_libuuid=no)
338 326237a6 2021-09-25 thomas fi
339 92a9e85d 2021-09-24 thomas fi
340 dd038bc6 2021-09-21 thomas.ad
341 92a9e85d 2021-09-24 thomas if test "x$found_libuuid" = "xno"; then
342 92a9e85d 2021-09-24 thomas AC_MSG_ERROR("*** couldn't find uuid ***")
343 92a9e85d 2021-09-24 thomas fi
344 92a9e85d 2021-09-24 thomas
345 dd038bc6 2021-09-21 thomas.ad PKG_CHECK_MODULES(
346 dd038bc6 2021-09-21 thomas.ad ZLIB,
347 dd038bc6 2021-09-21 thomas.ad zlib,
348 dd038bc6 2021-09-21 thomas.ad [
349 dd038bc6 2021-09-21 thomas.ad AM_CFLAGS="$ZLIB_CFLAGS $AM_CFLAGS"
350 dd038bc6 2021-09-21 thomas.ad CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
351 dd038bc6 2021-09-21 thomas.ad LIBS="$ZLIB_LIBS $LIBS"
352 dd038bc6 2021-09-21 thomas.ad found_zlib=yes
353 dd038bc6 2021-09-21 thomas.ad ],
354 dd038bc6 2021-09-21 thomas.ad [
355 92a9e85d 2021-09-24 thomas found_zlib=no
356 dd038bc6 2021-09-21 thomas.ad ]
357 dd038bc6 2021-09-21 thomas.ad )
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_CHECK_HEADER(
361 92a9e85d 2021-09-24 thomas zlib.h,
362 92a9e85d 2021-09-24 thomas ,
363 92a9e85d 2021-09-24 thomas found_zlib=no)
364 92a9e85d 2021-09-24 thomas fi
365 dd038bc6 2021-09-21 thomas.ad
366 92a9e85d 2021-09-24 thomas if test "x$found_zlib" = "xno"; then
367 92a9e85d 2021-09-24 thomas AC_MSG_ERROR("*** couldn't find zlib ***")
368 92a9e85d 2021-09-24 thomas fi
369 dd038bc6 2021-09-21 thomas.ad
370 92a9e85d 2021-09-24 thomas if test "$PLATFORM" = "linux"; then
371 92a9e85d 2021-09-24 thomas PKG_CHECK_MODULES(
372 92a9e85d 2021-09-24 thomas LIBMD,
373 92a9e85d 2021-09-24 thomas libmd,
374 92a9e85d 2021-09-24 thomas [
375 92a9e85d 2021-09-24 thomas AM_CFLAGS="$LIBMD_CFLAGS $AM_CFLAGS"
376 92a9e85d 2021-09-24 thomas CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
377 92a9e85d 2021-09-24 thomas LIBS="$LIBMD_LIBS $LIBS"
378 92a9e85d 2021-09-24 thomas ],
379 92a9e85d 2021-09-24 thomas [
380 92a9e85d 2021-09-24 thomas AC_MSG_ERROR("*** couldn't find libmd via pkg-config")
381 92a9e85d 2021-09-24 thomas ]
382 92a9e85d 2021-09-24 thomas )
383 92a9e85d 2021-09-24 thomas PKG_CHECK_MODULES(
384 92a9e85d 2021-09-24 thomas LIBBSD,
385 92a9e85d 2021-09-24 thomas libbsd-overlay,
386 92a9e85d 2021-09-24 thomas [
387 92a9e85d 2021-09-24 thomas AM_CFLAGS="$LIBBSD_CFLAGS $AM_CFLAGS"
388 92a9e85d 2021-09-24 thomas CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
389 92a9e85d 2021-09-24 thomas LIBS="$LIBBSD_LIBS $LIBS"
390 92a9e85d 2021-09-24 thomas found_libbsd=yes
391 92a9e85d 2021-09-24 thomas AC_DEFINE(HAVE_LIBBSD)
392 92a9e85d 2021-09-24 thomas ],
393 92a9e85d 2021-09-24 thomas []
394 92a9e85d 2021-09-24 thomas )
395 92a9e85d 2021-09-24 thomas fi
396 92a9e85d 2021-09-24 thomas
397 dd038bc6 2021-09-21 thomas.ad # Look for a suitable queue.h. We hope libbsd is enough, but that is missing
398 dd038bc6 2021-09-21 thomas.ad # SIMPLEQ.
399 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
400 dd038bc6 2021-09-21 thomas.ad SIMPLEQ_INIT,
401 dd038bc6 2021-09-21 thomas.ad found_queue_h=yes,
402 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
403 dd038bc6 2021-09-21 thomas.ad )
404 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
405 dd038bc6 2021-09-21 thomas.ad TAILQ_CONCAT,
406 dd038bc6 2021-09-21 thomas.ad found_queue_h=yes,
407 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
408 dd038bc6 2021-09-21 thomas.ad )
409 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
410 dd038bc6 2021-09-21 thomas.ad TAILQ_PREV,
411 19467d59 2022-07-16 thomas ,
412 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
413 dd038bc6 2021-09-21 thomas.ad )
414 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
415 dd038bc6 2021-09-21 thomas.ad TAILQ_REPLACE,
416 19467d59 2022-07-16 thomas ,
417 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
418 dd038bc6 2021-09-21 thomas.ad )
419 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
420 dd038bc6 2021-09-21 thomas.ad SIMPLEQ_ENTRY,
421 dd038bc6 2021-09-21 thomas.ad ,
422 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
423 dd038bc6 2021-09-21 thomas.ad )
424 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
425 dd038bc6 2021-09-21 thomas.ad TAILQ_FOREACH_SAFE,
426 dd038bc6 2021-09-21 thomas.ad ,
427 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
428 dd038bc6 2021-09-21 thomas.ad )
429 19467d59 2022-07-16 thomas
430 19467d59 2022-07-16 thomas if test "x$found_queue_h" = xyes -o "x$ac_cv_header_sys_queue_h" = xyes; then
431 dd038bc6 2021-09-21 thomas.ad AC_DEFINE(HAVE_QUEUE_H)
432 dd038bc6 2021-09-21 thomas.ad fi
433 dd038bc6 2021-09-21 thomas.ad
434 dd038bc6 2021-09-21 thomas.ad # Look for __progname.
435 dd038bc6 2021-09-21 thomas.ad AC_MSG_CHECKING(for __progname)
436 dd038bc6 2021-09-21 thomas.ad AC_LINK_IFELSE([AC_LANG_SOURCE(
437 dd038bc6 2021-09-21 thomas.ad [
438 dd038bc6 2021-09-21 thomas.ad #include <stdio.h>
439 dd038bc6 2021-09-21 thomas.ad #include <stdlib.h>
440 dd038bc6 2021-09-21 thomas.ad extern char *__progname;
441 dd038bc6 2021-09-21 thomas.ad int main(void) {
442 dd038bc6 2021-09-21 thomas.ad const char *cp = __progname;
443 dd038bc6 2021-09-21 thomas.ad printf("%s\n", cp);
444 dd038bc6 2021-09-21 thomas.ad exit(0);
445 dd038bc6 2021-09-21 thomas.ad }
446 dd038bc6 2021-09-21 thomas.ad ])],
447 dd038bc6 2021-09-21 thomas.ad [AC_DEFINE(HAVE___PROGNAME) AC_MSG_RESULT(yes)],
448 dd038bc6 2021-09-21 thomas.ad AC_MSG_RESULT(no)
449 dd038bc6 2021-09-21 thomas.ad )
450 dd038bc6 2021-09-21 thomas.ad
451 d9e4d43f 2022-03-03 thomas PKG_CHECK_MODULES(
452 d9e4d43f 2022-03-03 thomas LIBPANELW,
453 d9e4d43f 2022-03-03 thomas panelw,
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 d9e4d43f 2022-03-03 thomas PKG_CHECK_MODULES(
459 d9e4d43f 2022-03-03 thomas LIBPANELW,
460 d9e4d43f 2022-03-03 thomas gnupanelw,
461 d9e4d43f 2022-03-03 thomas found_panel=yes,
462 d9e4d43f 2022-03-03 thomas found_panel=no
463 d9e4d43f 2022-03-03 thomas )
464 d9e4d43f 2022-03-03 thomas
465 b26177ad 2022-03-03 thomas PKG_CHECK_MODULES(
466 b26177ad 2022-03-03 thomas LIBPANELW,
467 b26177ad 2022-03-03 thomas panel,
468 b26177ad 2022-03-03 thomas found_panel=yes,
469 b26177ad 2022-03-03 thomas found_panel=no
470 b26177ad 2022-03-03 thomas )
471 d9e4d43f 2022-03-03 thomas if test "x$found_panel" = "xno"; then
472 92a9e85d 2021-09-24 thomas AC_CHECK_LIB(panelw, update_panels,,
473 92a9e85d 2021-09-24 thomas AC_MSG_ERROR([ "*** panelw not found for ncurses. ***"])
474 92a9e85d 2021-09-24 thomas )
475 acf52a76 2021-09-21 thomas.ad
476 92a9e85d 2021-09-24 thomas LIBPANELW_LIBS="-lpanelw"
477 92a9e85d 2021-09-24 thomas fi
478 92a9e85d 2021-09-24 thomas
479 acf52a76 2021-09-21 thomas.ad PKG_CHECK_MODULES(
480 acf52a76 2021-09-21 thomas.ad LIBNCURSES,
481 acf52a76 2021-09-21 thomas.ad ncursesw,
482 dd038bc6 2021-09-21 thomas.ad found_ncurses=yes,
483 dd038bc6 2021-09-21 thomas.ad found_ncurses=no
484 dd038bc6 2021-09-21 thomas.ad )
485 acf52a76 2021-09-21 thomas.ad if test "x$found_ncurses" = xyes; then
486 acf52a76 2021-09-21 thomas.ad AM_CFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $LIBPANELW_CFLAGS $AM_CFLAGS"
487 acf52a76 2021-09-21 thomas.ad CFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $LIBPANELW_CFLAGS $CFLAGS"
488 acf52a76 2021-09-21 thomas.ad LIBS="$LIBNCURSES_LIBS $LIBTINFO_LIBS $LIBPANELW_LIBS $LIBS"
489 dd038bc6 2021-09-21 thomas.ad else
490 dd038bc6 2021-09-21 thomas.ad AC_CHECK_LIB(
491 acf52a76 2021-09-21 thomas.ad ncursesw,
492 dd038bc6 2021-09-21 thomas.ad setupterm,
493 dd038bc6 2021-09-21 thomas.ad found_ncurses=yes,
494 dd038bc6 2021-09-21 thomas.ad found_ncurses=no
495 dd038bc6 2021-09-21 thomas.ad )
496 dd038bc6 2021-09-21 thomas.ad if test "x$found_ncurses" = xyes; then
497 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADER(
498 dd038bc6 2021-09-21 thomas.ad ncurses.h,
499 acf52a76 2021-09-21 thomas.ad AM_CFLAGS="$LIBPANELW_CFLAGS $AM_CFLAGS"
500 acf52a76 2021-09-21 thomas.ad CFLAGS="$LIBPANEL_CFLAGS $CFLAGS"
501 acf52a76 2021-09-21 thomas.ad LIBS="$LIBS -lncursesw $LIBPANELW_LIBS",
502 acf52a76 2021-09-21 thomas.ad found_ncurses=no
503 acf52a76 2021-09-21 thomas.ad )
504 92a9e85d 2021-09-24 thomas fi
505 dd038bc6 2021-09-21 thomas.ad fi
506 dd038bc6 2021-09-21 thomas.ad if test "x$found_ncurses" = xyes; then
507 dd038bc6 2021-09-21 thomas.ad AC_DEFINE(HAVE_NCURSES_H)
508 dd038bc6 2021-09-21 thomas.ad else
509 dd038bc6 2021-09-21 thomas.ad # No ncurses, try curses.
510 dd038bc6 2021-09-21 thomas.ad AC_CHECK_LIB(
511 acf52a76 2021-09-21 thomas.ad cursesw,
512 dd038bc6 2021-09-21 thomas.ad setupterm,
513 dd038bc6 2021-09-21 thomas.ad found_curses=yes,
514 dd038bc6 2021-09-21 thomas.ad found_curses=no
515 dd038bc6 2021-09-21 thomas.ad )
516 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADER(
517 dd038bc6 2021-09-21 thomas.ad curses.h,
518 dd038bc6 2021-09-21 thomas.ad ,
519 dd038bc6 2021-09-21 thomas.ad found_curses=no)
520 dd038bc6 2021-09-21 thomas.ad if test "x$found_curses" = xyes; then
521 acf52a76 2021-09-21 thomas.ad AM_CFLAGS="$LIBPANELW_CFLAGS $AM_CFLAGS"
522 acf52a76 2021-09-21 thomas.ad CFLAGS="$LIBPANEL_CFLAGS $CFLAGS"
523 acf52a76 2021-09-21 thomas.ad LIBS="$LIBS -lcursesw $LIBPANELW_LIBS"
524 dd038bc6 2021-09-21 thomas.ad AC_DEFINE(HAVE_CURSES_H)
525 dd038bc6 2021-09-21 thomas.ad else
526 dd038bc6 2021-09-21 thomas.ad AC_MSG_ERROR("curses not found")
527 dd038bc6 2021-09-21 thomas.ad fi
528 dd038bc6 2021-09-21 thomas.ad fi
529 dd038bc6 2021-09-21 thomas.ad
530 dd038bc6 2021-09-21 thomas.ad # Save our CFLAGS/CPPFLAGS/LDFLAGS for the Makefile and restore the old user
531 dd038bc6 2021-09-21 thomas.ad # variables.
532 dd038bc6 2021-09-21 thomas.ad AC_SUBST(AM_CPPFLAGS)
533 dd038bc6 2021-09-21 thomas.ad CPPFLAGS="$SAVED_CPPFLAGS"
534 dd038bc6 2021-09-21 thomas.ad AC_SUBST(AM_CFLAGS)
535 dd038bc6 2021-09-21 thomas.ad CFLAGS="$SAVED_CFLAGS"
536 dd038bc6 2021-09-21 thomas.ad AC_SUBST(AM_LDFLAGS)
537 dd038bc6 2021-09-21 thomas.ad LDFLAGS="$SAVED_LDFLAGS"
538 dd038bc6 2021-09-21 thomas.ad
539 dd038bc6 2021-09-21 thomas.ad AC_CONFIG_FILES([Makefile
540 dd038bc6 2021-09-21 thomas.ad compat/Makefile
541 dd038bc6 2021-09-21 thomas.ad libexec/Makefile
542 dd038bc6 2021-09-21 thomas.ad libexec/got-read-tree/Makefile
543 dd038bc6 2021-09-21 thomas.ad libexec/got-fetch-pack/Makefile
544 dd038bc6 2021-09-21 thomas.ad libexec/got-index-pack/Makefile
545 dd038bc6 2021-09-21 thomas.ad libexec/got-read-blob/Makefile
546 dd038bc6 2021-09-21 thomas.ad libexec/got-read-commit/Makefile
547 dd038bc6 2021-09-21 thomas.ad libexec/got-read-gitconfig/Makefile
548 dd038bc6 2021-09-21 thomas.ad libexec/got-read-gotconfig/Makefile
549 dd038bc6 2021-09-21 thomas.ad libexec/got-read-object/Makefile
550 dd038bc6 2021-09-21 thomas.ad libexec/got-read-pack/Makefile
551 973f3f6e 2022-03-07 thomas libexec/got-read-patch/Makefile
552 dd038bc6 2021-09-21 thomas.ad libexec/got-read-tag/Makefile
553 dd038bc6 2021-09-21 thomas.ad libexec/got-send-pack/Makefile
554 dd038bc6 2021-09-21 thomas.ad got/Makefile
555 2b0eee35 2021-09-21 thomas.ad gotadmin/Makefile
556 ff36aeea 2022-07-16 thomas gotwebd/Makefile
557 d3f2ad5e 2021-09-21 thomas.ad tog/Makefile
558 5a7ef102 2021-10-09 thomas Makefile.common:Makefile.common.in])
559 dd038bc6 2021-09-21 thomas.ad AC_OUTPUT
560 dd038bc6 2021-09-21 thomas.ad
561 dd038bc6 2021-09-21 thomas.ad # tog/GNUMakefile])
562 dd038bc6 2021-09-21 thomas.ad # regress/GNUMakefile
563 dd038bc6 2021-09-21 thomas.ad # regress/cmdline/GNUMakefile
564 dd038bc6 2021-09-21 thomas.ad # regress/delta/GNUMakefile
565 dd038bc6 2021-09-21 thomas.ad # regress/fetch/GNUMakefile
566 dd038bc6 2021-09-21 thomas.ad # regress/idset/GNUMakefile
567 dd038bc6 2021-09-21 thomas.ad # regress/path/GNUMakefile
568 dd038bc6 2021-09-21 thomas.ad # gotweb/GNUMakefile
569 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/GNUMakefile
570 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-blob/GNUMakefile
571 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-commit/GNUMakefile
572 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-gitconfig/GNUMakefile
573 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-gotconfig/GNUMakefile
574 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-object/GNUMakefile
575 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-pack/GNUMakefile
576 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-tag/GNUMakefile
577 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-tree/GNUMakefile