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 dd038bc6 2021-09-21 thomas.ad sys/socket.h \
59 dd038bc6 2021-09-21 thomas.ad sys/time.h \
60 dd038bc6 2021-09-21 thomas.ad sys/tree.h \
61 117843e4 2022-07-15 thomas tls.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 d7cad54e 2022-07-14 thomas # Check for ifgroupreq which is only available on BSD.
82 d7cad54e 2022-07-14 thomas AC_CHECK_TYPES([struct ifgroupreq])
83 d7cad54e 2022-07-14 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 b7ec5831 2022-07-15 thomas setresgid \
113 b7ec5831 2022-07-15 thomas setresuid \
114 685f4593 2022-07-15 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 685f4593 2022-07-15 thomas AM_CONDITIONAL([HAVE_SETPROCTITLE], [test "x$ac_cv_func_setproctitle" = xyes])
132 b7ec5831 2022-07-15 thomas AM_CONDITIONAL([HAVE_SETRESGID], [test "x$ac_cv_func_setresgid" = xyes])
133 b7ec5831 2022-07-15 thomas AM_CONDITIONAL([HAVE_SETRESUID], [test "x$ac_cv_func_setresuid" = xyes])
134 685f4593 2022-07-15 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 d7cad54e 2022-07-14 thomas fi
239 d7cad54e 2022-07-14 thomas
240 d7cad54e 2022-07-14 thomas # libevent (for gotwebd). Lifted from tmux.
241 d7cad54e 2022-07-14 thomas # Look for libevent. Try libevent_core or libevent with pkg-config first then
242 d7cad54e 2022-07-14 thomas # look for the library.
243 d7cad54e 2022-07-14 thomas PKG_CHECK_MODULES(
244 d7cad54e 2022-07-14 thomas LIBEVENT_CORE,
245 d7cad54e 2022-07-14 thomas [libevent_core >= 2],
246 d7cad54e 2022-07-14 thomas [
247 d7cad54e 2022-07-14 thomas AM_CPPFLAGS="$LIBEVENT_CORE_CFLAGS $AM_CPPFLAGS"
248 d7cad54e 2022-07-14 thomas CPPFLAGS="$AM_CPPFLAGS $SAVED_CPPFLAGS"
249 d7cad54e 2022-07-14 thomas LIBS="$LIBEVENT_CORE_LIBS $LIBS"
250 d7cad54e 2022-07-14 thomas found_libevent=yes
251 d7cad54e 2022-07-14 thomas ],
252 d7cad54e 2022-07-14 thomas found_libevent=no
253 d7cad54e 2022-07-14 thomas )
254 d7cad54e 2022-07-14 thomas if test x$found_libevent = xno; then
255 d7cad54e 2022-07-14 thomas PKG_CHECK_MODULES(
256 d7cad54e 2022-07-14 thomas LIBEVENT,
257 d7cad54e 2022-07-14 thomas [libevent >= 2],
258 d7cad54e 2022-07-14 thomas [
259 d7cad54e 2022-07-14 thomas AM_CPPFLAGS="$LIBEVENT_CFLAGS $AM_CPPFLAGS"
260 d7cad54e 2022-07-14 thomas CPPFLAGS="$AM_CPPFLAGS $SAVED_CPPFLAGS"
261 d7cad54e 2022-07-14 thomas LIBS="$LIBEVENT_LIBS $LIBS"
262 d7cad54e 2022-07-14 thomas found_libevent=yes
263 d7cad54e 2022-07-14 thomas ],
264 d7cad54e 2022-07-14 thomas found_libevent=no
265 d7cad54e 2022-07-14 thomas )
266 d7cad54e 2022-07-14 thomas fi
267 d7cad54e 2022-07-14 thomas if test x$found_libevent = xno; then
268 d7cad54e 2022-07-14 thomas AC_SEARCH_LIBS(
269 d7cad54e 2022-07-14 thomas event_init,
270 d7cad54e 2022-07-14 thomas [event_core event event-1.4],
271 d7cad54e 2022-07-14 thomas found_libevent=yes,
272 d7cad54e 2022-07-14 thomas found_libevent=no
273 d7cad54e 2022-07-14 thomas )
274 d7cad54e 2022-07-14 thomas fi
275 d7cad54e 2022-07-14 thomas AC_CHECK_HEADER(
276 d7cad54e 2022-07-14 thomas event2/event.h,
277 d7cad54e 2022-07-14 thomas AC_DEFINE(HAVE_EVENT2_EVENT_H),
278 d7cad54e 2022-07-14 thomas [
279 d7cad54e 2022-07-14 thomas AC_CHECK_HEADER(
280 d7cad54e 2022-07-14 thomas event.h,
281 d7cad54e 2022-07-14 thomas AC_DEFINE(HAVE_EVENT_H),
282 d7cad54e 2022-07-14 thomas found_libevent=no
283 d7cad54e 2022-07-14 thomas )
284 d7cad54e 2022-07-14 thomas ]
285 d7cad54e 2022-07-14 thomas )
286 d7cad54e 2022-07-14 thomas if test "x$found_libevent" = xno; then
287 d7cad54e 2022-07-14 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 [#include <sys/queue.h>]
404 dd038bc6 2021-09-21 thomas.ad )
405 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
406 dd038bc6 2021-09-21 thomas.ad TAILQ_CONCAT,
407 dd038bc6 2021-09-21 thomas.ad found_queue_h=yes,
408 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
409 dd038bc6 2021-09-21 thomas.ad [#include <sys/queue.h>]
410 dd038bc6 2021-09-21 thomas.ad )
411 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
412 dd038bc6 2021-09-21 thomas.ad TAILQ_PREV,
413 dd038bc6 2021-09-21 thomas.ad found_queue_h=yes,
414 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
415 dd038bc6 2021-09-21 thomas.ad [#include <sys/queue.h>]
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_REPLACE,
419 dd038bc6 2021-09-21 thomas.ad found_queue_h=yes,
420 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
421 dd038bc6 2021-09-21 thomas.ad [#include <sys/queue.h>]
422 dd038bc6 2021-09-21 thomas.ad )
423 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
424 dd038bc6 2021-09-21 thomas.ad SIMPLEQ_ENTRY,
425 dd038bc6 2021-09-21 thomas.ad ,
426 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
427 dd038bc6 2021-09-21 thomas.ad [#include <sys/queue.h>]
428 dd038bc6 2021-09-21 thomas.ad )
429 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
430 dd038bc6 2021-09-21 thomas.ad TAILQ_FOREACH_SAFE,
431 dd038bc6 2021-09-21 thomas.ad ,
432 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
433 dd038bc6 2021-09-21 thomas.ad [#include <sys/queue.h>]
434 dd038bc6 2021-09-21 thomas.ad )
435 dd038bc6 2021-09-21 thomas.ad if test "x$found_queue_h" = xyes; then
436 dd038bc6 2021-09-21 thomas.ad AC_DEFINE(HAVE_QUEUE_H)
437 dd038bc6 2021-09-21 thomas.ad fi
438 dd038bc6 2021-09-21 thomas.ad
439 dd038bc6 2021-09-21 thomas.ad # Look for __progname.
440 dd038bc6 2021-09-21 thomas.ad AC_MSG_CHECKING(for __progname)
441 dd038bc6 2021-09-21 thomas.ad AC_LINK_IFELSE([AC_LANG_SOURCE(
442 dd038bc6 2021-09-21 thomas.ad [
443 dd038bc6 2021-09-21 thomas.ad #include <stdio.h>
444 dd038bc6 2021-09-21 thomas.ad #include <stdlib.h>
445 dd038bc6 2021-09-21 thomas.ad extern char *__progname;
446 dd038bc6 2021-09-21 thomas.ad int main(void) {
447 dd038bc6 2021-09-21 thomas.ad const char *cp = __progname;
448 dd038bc6 2021-09-21 thomas.ad printf("%s\n", cp);
449 dd038bc6 2021-09-21 thomas.ad exit(0);
450 dd038bc6 2021-09-21 thomas.ad }
451 dd038bc6 2021-09-21 thomas.ad ])],
452 dd038bc6 2021-09-21 thomas.ad [AC_DEFINE(HAVE___PROGNAME) AC_MSG_RESULT(yes)],
453 dd038bc6 2021-09-21 thomas.ad AC_MSG_RESULT(no)
454 dd038bc6 2021-09-21 thomas.ad )
455 dd038bc6 2021-09-21 thomas.ad
456 d9e4d43f 2022-03-03 thomas PKG_CHECK_MODULES(
457 d9e4d43f 2022-03-03 thomas LIBPANELW,
458 d9e4d43f 2022-03-03 thomas panelw,
459 d9e4d43f 2022-03-03 thomas found_panel=yes,
460 d9e4d43f 2022-03-03 thomas found_panel=no
461 d9e4d43f 2022-03-03 thomas )
462 d9e4d43f 2022-03-03 thomas
463 d9e4d43f 2022-03-03 thomas PKG_CHECK_MODULES(
464 d9e4d43f 2022-03-03 thomas LIBPANELW,
465 d9e4d43f 2022-03-03 thomas gnupanelw,
466 d9e4d43f 2022-03-03 thomas found_panel=yes,
467 d9e4d43f 2022-03-03 thomas found_panel=no
468 d9e4d43f 2022-03-03 thomas )
469 d9e4d43f 2022-03-03 thomas
470 b26177ad 2022-03-03 thomas PKG_CHECK_MODULES(
471 b26177ad 2022-03-03 thomas LIBPANELW,
472 b26177ad 2022-03-03 thomas panel,
473 b26177ad 2022-03-03 thomas found_panel=yes,
474 b26177ad 2022-03-03 thomas found_panel=no
475 b26177ad 2022-03-03 thomas )
476 d9e4d43f 2022-03-03 thomas if test "x$found_panel" = "xno"; then
477 92a9e85d 2021-09-24 thomas AC_CHECK_LIB(panelw, update_panels,,
478 92a9e85d 2021-09-24 thomas AC_MSG_ERROR([ "*** panelw not found for ncurses. ***"])
479 92a9e85d 2021-09-24 thomas )
480 acf52a76 2021-09-21 thomas.ad
481 92a9e85d 2021-09-24 thomas LIBPANELW_LIBS="-lpanelw"
482 92a9e85d 2021-09-24 thomas fi
483 92a9e85d 2021-09-24 thomas
484 acf52a76 2021-09-21 thomas.ad PKG_CHECK_MODULES(
485 acf52a76 2021-09-21 thomas.ad LIBNCURSES,
486 acf52a76 2021-09-21 thomas.ad ncursesw,
487 dd038bc6 2021-09-21 thomas.ad found_ncurses=yes,
488 dd038bc6 2021-09-21 thomas.ad found_ncurses=no
489 dd038bc6 2021-09-21 thomas.ad )
490 acf52a76 2021-09-21 thomas.ad if test "x$found_ncurses" = xyes; then
491 acf52a76 2021-09-21 thomas.ad AM_CFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $LIBPANELW_CFLAGS $AM_CFLAGS"
492 acf52a76 2021-09-21 thomas.ad CFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $LIBPANELW_CFLAGS $CFLAGS"
493 acf52a76 2021-09-21 thomas.ad LIBS="$LIBNCURSES_LIBS $LIBTINFO_LIBS $LIBPANELW_LIBS $LIBS"
494 dd038bc6 2021-09-21 thomas.ad else
495 dd038bc6 2021-09-21 thomas.ad AC_CHECK_LIB(
496 acf52a76 2021-09-21 thomas.ad ncursesw,
497 dd038bc6 2021-09-21 thomas.ad setupterm,
498 dd038bc6 2021-09-21 thomas.ad found_ncurses=yes,
499 dd038bc6 2021-09-21 thomas.ad found_ncurses=no
500 dd038bc6 2021-09-21 thomas.ad )
501 dd038bc6 2021-09-21 thomas.ad if test "x$found_ncurses" = xyes; then
502 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADER(
503 dd038bc6 2021-09-21 thomas.ad ncurses.h,
504 acf52a76 2021-09-21 thomas.ad AM_CFLAGS="$LIBPANELW_CFLAGS $AM_CFLAGS"
505 acf52a76 2021-09-21 thomas.ad CFLAGS="$LIBPANEL_CFLAGS $CFLAGS"
506 acf52a76 2021-09-21 thomas.ad LIBS="$LIBS -lncursesw $LIBPANELW_LIBS",
507 acf52a76 2021-09-21 thomas.ad found_ncurses=no
508 acf52a76 2021-09-21 thomas.ad )
509 92a9e85d 2021-09-24 thomas fi
510 dd038bc6 2021-09-21 thomas.ad fi
511 dd038bc6 2021-09-21 thomas.ad if test "x$found_ncurses" = xyes; then
512 dd038bc6 2021-09-21 thomas.ad AC_DEFINE(HAVE_NCURSES_H)
513 dd038bc6 2021-09-21 thomas.ad else
514 dd038bc6 2021-09-21 thomas.ad # No ncurses, try curses.
515 dd038bc6 2021-09-21 thomas.ad AC_CHECK_LIB(
516 acf52a76 2021-09-21 thomas.ad cursesw,
517 dd038bc6 2021-09-21 thomas.ad setupterm,
518 dd038bc6 2021-09-21 thomas.ad found_curses=yes,
519 dd038bc6 2021-09-21 thomas.ad found_curses=no
520 dd038bc6 2021-09-21 thomas.ad )
521 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADER(
522 dd038bc6 2021-09-21 thomas.ad curses.h,
523 dd038bc6 2021-09-21 thomas.ad ,
524 dd038bc6 2021-09-21 thomas.ad found_curses=no)
525 dd038bc6 2021-09-21 thomas.ad if test "x$found_curses" = xyes; then
526 acf52a76 2021-09-21 thomas.ad AM_CFLAGS="$LIBPANELW_CFLAGS $AM_CFLAGS"
527 acf52a76 2021-09-21 thomas.ad CFLAGS="$LIBPANEL_CFLAGS $CFLAGS"
528 acf52a76 2021-09-21 thomas.ad LIBS="$LIBS -lcursesw $LIBPANELW_LIBS"
529 dd038bc6 2021-09-21 thomas.ad AC_DEFINE(HAVE_CURSES_H)
530 dd038bc6 2021-09-21 thomas.ad else
531 dd038bc6 2021-09-21 thomas.ad AC_MSG_ERROR("curses not found")
532 dd038bc6 2021-09-21 thomas.ad fi
533 dd038bc6 2021-09-21 thomas.ad fi
534 dd038bc6 2021-09-21 thomas.ad
535 dd038bc6 2021-09-21 thomas.ad # Save our CFLAGS/CPPFLAGS/LDFLAGS for the Makefile and restore the old user
536 dd038bc6 2021-09-21 thomas.ad # variables.
537 dd038bc6 2021-09-21 thomas.ad AC_SUBST(AM_CPPFLAGS)
538 dd038bc6 2021-09-21 thomas.ad CPPFLAGS="$SAVED_CPPFLAGS"
539 dd038bc6 2021-09-21 thomas.ad AC_SUBST(AM_CFLAGS)
540 dd038bc6 2021-09-21 thomas.ad CFLAGS="$SAVED_CFLAGS"
541 dd038bc6 2021-09-21 thomas.ad AC_SUBST(AM_LDFLAGS)
542 dd038bc6 2021-09-21 thomas.ad LDFLAGS="$SAVED_LDFLAGS"
543 dd038bc6 2021-09-21 thomas.ad
544 dd038bc6 2021-09-21 thomas.ad AC_CONFIG_FILES([Makefile
545 dd038bc6 2021-09-21 thomas.ad compat/Makefile
546 dd038bc6 2021-09-21 thomas.ad libexec/Makefile
547 dd038bc6 2021-09-21 thomas.ad libexec/got-read-tree/Makefile
548 dd038bc6 2021-09-21 thomas.ad libexec/got-fetch-pack/Makefile
549 dd038bc6 2021-09-21 thomas.ad libexec/got-index-pack/Makefile
550 dd038bc6 2021-09-21 thomas.ad libexec/got-read-blob/Makefile
551 dd038bc6 2021-09-21 thomas.ad libexec/got-read-commit/Makefile
552 dd038bc6 2021-09-21 thomas.ad libexec/got-read-gitconfig/Makefile
553 dd038bc6 2021-09-21 thomas.ad libexec/got-read-gotconfig/Makefile
554 dd038bc6 2021-09-21 thomas.ad libexec/got-read-object/Makefile
555 dd038bc6 2021-09-21 thomas.ad libexec/got-read-pack/Makefile
556 973f3f6e 2022-03-07 thomas libexec/got-read-patch/Makefile
557 dd038bc6 2021-09-21 thomas.ad libexec/got-read-tag/Makefile
558 dd038bc6 2021-09-21 thomas.ad libexec/got-send-pack/Makefile
559 dd038bc6 2021-09-21 thomas.ad got/Makefile
560 2b0eee35 2021-09-21 thomas.ad gotadmin/Makefile
561 d7cad54e 2022-07-14 thomas gotwebd/Makefile
562 d3f2ad5e 2021-09-21 thomas.ad tog/Makefile
563 5a7ef102 2021-10-09 thomas Makefile.common:Makefile.common.in])
564 dd038bc6 2021-09-21 thomas.ad AC_OUTPUT
565 dd038bc6 2021-09-21 thomas.ad
566 dd038bc6 2021-09-21 thomas.ad # tog/GNUMakefile])
567 dd038bc6 2021-09-21 thomas.ad # regress/GNUMakefile
568 dd038bc6 2021-09-21 thomas.ad # regress/cmdline/GNUMakefile
569 dd038bc6 2021-09-21 thomas.ad # regress/delta/GNUMakefile
570 dd038bc6 2021-09-21 thomas.ad # regress/fetch/GNUMakefile
571 dd038bc6 2021-09-21 thomas.ad # regress/idset/GNUMakefile
572 dd038bc6 2021-09-21 thomas.ad # regress/path/GNUMakefile
573 dd038bc6 2021-09-21 thomas.ad # gotweb/GNUMakefile
574 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/GNUMakefile
575 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-blob/GNUMakefile
576 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-commit/GNUMakefile
577 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-gitconfig/GNUMakefile
578 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-gotconfig/GNUMakefile
579 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-object/GNUMakefile
580 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-pack/GNUMakefile
581 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-tag/GNUMakefile
582 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-tree/GNUMakefile