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 598139dd 2022-07-22 thomas AC_INIT([got-portable],
5 598139dd 2022-07-22 thomas m4_esyscmd([util/got-portable-ver.sh]),
6 598139dd 2022-07-22 thomas [thomas@xteddy.org])
7 dd038bc6 2021-09-21 thomas.ad AC_CONFIG_AUX_DIR(etc)
8 dd038bc6 2021-09-21 thomas.ad AC_CONFIG_SRCDIR([lib/rcsutil.h])
9 dd038bc6 2021-09-21 thomas.ad AM_INIT_AUTOMAKE([foreign subdir-objects])
10 dd038bc6 2021-09-21 thomas.ad
11 dd038bc6 2021-09-21 thomas.ad GOT_RELEASE=No
12 dd038bc6 2021-09-21 thomas.ad
13 dd038bc6 2021-09-21 thomas.ad AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
14 dd038bc6 2021-09-21 thomas.ad AC_SUBST(VERSION)
15 dd038bc6 2021-09-21 thomas.ad AC_SUBST(GOT_RELEASE)
16 dd038bc6 2021-09-21 thomas.ad
17 dd038bc6 2021-09-21 thomas.ad AC_CANONICAL_HOST
18 dd038bc6 2021-09-21 thomas.ad
19 dd038bc6 2021-09-21 thomas.ad # When CFLAGS isn't set at this stage and gcc is detected by the macro below,
20 dd038bc6 2021-09-21 thomas.ad # autoconf will automatically use CFLAGS="-O2 -g". Prevent that by using an
21 dd038bc6 2021-09-21 thomas.ad # empty default.
22 dd038bc6 2021-09-21 thomas.ad : ${CFLAGS=""}
23 dd038bc6 2021-09-21 thomas.ad
24 dd038bc6 2021-09-21 thomas.ad # Save user CPPFLAGS, CFLAGS and LDFLAGS. We need to change them because
25 dd038bc6 2021-09-21 thomas.ad # AC_CHECK_HEADER doesn't give us any other way to update the include
26 dd038bc6 2021-09-21 thomas.ad # paths. But for Makefile.am we want to use AM_CPPFLAGS and friends.
27 dd038bc6 2021-09-21 thomas.ad SAVED_CFLAGS="$CFLAGS"
28 dd038bc6 2021-09-21 thomas.ad SAVED_CPPFLAGS="$CPPFLAGS"
29 dd038bc6 2021-09-21 thomas.ad SAVED_LDFLAGS="$LDFLAGS"
30 dd038bc6 2021-09-21 thomas.ad
31 dd038bc6 2021-09-21 thomas.ad # Checks for programs.
32 dd038bc6 2021-09-21 thomas.ad AC_PROG_CC
33 dd038bc6 2021-09-21 thomas.ad AC_PROG_CPP
34 dd038bc6 2021-09-21 thomas.ad AC_PROG_INSTALL
35 dd038bc6 2021-09-21 thomas.ad AC_PROG_LN_S
36 dd038bc6 2021-09-21 thomas.ad AC_PROG_MAKE_SET
37 dd038bc6 2021-09-21 thomas.ad AC_PROG_YACC
38 dd038bc6 2021-09-21 thomas.ad AC_PROG_RANLIB
39 dd038bc6 2021-09-21 thomas.ad PKG_PROG_PKG_CONFIG
40 dd038bc6 2021-09-21 thomas.ad AC_USE_SYSTEM_EXTENSIONS
41 dd038bc6 2021-09-21 thomas.ad
42 dd038bc6 2021-09-21 thomas.ad # Checks for header files.
43 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADERS([ \
44 dd038bc6 2021-09-21 thomas.ad fcntl.h \
45 dd038bc6 2021-09-21 thomas.ad langinfo.h \
46 dd038bc6 2021-09-21 thomas.ad limits.h \
47 97799ccd 2022-02-06 thomas linux/landlock.h \
48 dd038bc6 2021-09-21 thomas.ad locale.h \
49 dd038bc6 2021-09-21 thomas.ad netdb.h \
50 dd038bc6 2021-09-21 thomas.ad netinet/in.h \
51 dd038bc6 2021-09-21 thomas.ad paths.h \
52 d24ddaa6 2022-02-26 thomas poll.h \
53 dd038bc6 2021-09-21 thomas.ad stddef.h \
54 dd038bc6 2021-09-21 thomas.ad stdint.h \
55 dd038bc6 2021-09-21 thomas.ad stdlib.h \
56 dd038bc6 2021-09-21 thomas.ad string.h \
57 dd038bc6 2021-09-21 thomas.ad sys/ioctl.h \
58 dd038bc6 2021-09-21 thomas.ad sys/param.h \
59 d24ddaa6 2022-02-26 thomas sys/poll.h \
60 19467d59 2022-07-16 thomas sys/queue.h \
61 dd038bc6 2021-09-21 thomas.ad sys/socket.h \
62 dd038bc6 2021-09-21 thomas.ad sys/time.h \
63 dd038bc6 2021-09-21 thomas.ad sys/tree.h \
64 dd038bc6 2021-09-21 thomas.ad util.h \
65 dd038bc6 2021-09-21 thomas.ad unistd.h \
66 dd038bc6 2021-09-21 thomas.ad wchar.h \
67 dd038bc6 2021-09-21 thomas.ad ])
68 dd038bc6 2021-09-21 thomas.ad
69 dd038bc6 2021-09-21 thomas.ad # Checks for typ edefs, structures, and compiler characteristics.
70 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADER_STDBOOL
71 dd038bc6 2021-09-21 thomas.ad AC_C_INLINE
72 dd038bc6 2021-09-21 thomas.ad AC_TYPE_INT64_T
73 dd038bc6 2021-09-21 thomas.ad AC_TYPE_MODE_T
74 dd038bc6 2021-09-21 thomas.ad AC_TYPE_OFF_T
75 dd038bc6 2021-09-21 thomas.ad AC_TYPE_PID_T
76 dd038bc6 2021-09-21 thomas.ad AC_TYPE_SIZE_T
77 dd038bc6 2021-09-21 thomas.ad AC_TYPE_SSIZE_T
78 dd038bc6 2021-09-21 thomas.ad AC_TYPE_UINT16_T
79 dd038bc6 2021-09-21 thomas.ad AC_TYPE_UINT32_T
80 dd038bc6 2021-09-21 thomas.ad AC_TYPE_UINT64_T
81 dd038bc6 2021-09-21 thomas.ad AC_TYPE_UINT8_T
82 dd038bc6 2021-09-21 thomas.ad
83 ff36aeea 2022-07-16 thomas # Check for ifgroupreq which is only available on BSD.
84 ff36aeea 2022-07-16 thomas AC_CHECK_TYPES([struct ifgroupreq])
85 ff36aeea 2022-07-16 thomas
86 dd038bc6 2021-09-21 thomas.ad # Look for library needed for flock.
87 dd038bc6 2021-09-21 thomas.ad AC_SEARCH_LIBS(flock, bsd)
88 dd038bc6 2021-09-21 thomas.ad
89 dd038bc6 2021-09-21 thomas.ad # Checks for library functions.
90 dd038bc6 2021-09-21 thomas.ad AC_FUNC_FORK
91 dd038bc6 2021-09-21 thomas.ad AC_FUNC_FSEEKO
92 dd038bc6 2021-09-21 thomas.ad AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
93 dd038bc6 2021-09-21 thomas.ad AC_FUNC_MALLOC
94 dd038bc6 2021-09-21 thomas.ad AC_FUNC_MMAP
95 dd038bc6 2021-09-21 thomas.ad AC_FUNC_REALLOC
96 dd038bc6 2021-09-21 thomas.ad AC_FUNC_STRERROR_R
97 dd038bc6 2021-09-21 thomas.ad AC_FUNC_STRNLEN
98 dd038bc6 2021-09-21 thomas.ad AC_CHECK_FUNCS([ \
99 dd038bc6 2021-09-21 thomas.ad dup2 \
100 dd038bc6 2021-09-21 thomas.ad flock \
101 dd038bc6 2021-09-21 thomas.ad getcwd \
102 dd038bc6 2021-09-21 thomas.ad localtime_r \
103 dd038bc6 2021-09-21 thomas.ad memchr \
104 dd038bc6 2021-09-21 thomas.ad memmove \
105 dd038bc6 2021-09-21 thomas.ad memset \
106 dd038bc6 2021-09-21 thomas.ad mkdir \
107 dd038bc6 2021-09-21 thomas.ad munmap \
108 dd038bc6 2021-09-21 thomas.ad nl_langinfo \
109 dd038bc6 2021-09-21 thomas.ad realpath \
110 dd038bc6 2021-09-21 thomas.ad regcomp \
111 dd038bc6 2021-09-21 thomas.ad rmdir \
112 dd038bc6 2021-09-21 thomas.ad setlocale \
113 dd038bc6 2021-09-21 thomas.ad socket \
114 683ec58e 2022-07-16 thomas setresgid \
115 683ec58e 2022-07-16 thomas setresuid \
116 c4e2e0d0 2022-07-16 thomas setproctitle \
117 dd038bc6 2021-09-21 thomas.ad strcasecmp \
118 dd038bc6 2021-09-21 thomas.ad strchr \
119 dd038bc6 2021-09-21 thomas.ad strcspn \
120 dd038bc6 2021-09-21 thomas.ad strdup \
121 dd038bc6 2021-09-21 thomas.ad strerror \
122 dd038bc6 2021-09-21 thomas.ad strlcpy \
123 dd038bc6 2021-09-21 thomas.ad strncasecmp \
124 dd038bc6 2021-09-21 thomas.ad strndup \
125 dd038bc6 2021-09-21 thomas.ad strrchr \
126 dd038bc6 2021-09-21 thomas.ad strspn \
127 dd038bc6 2021-09-21 thomas.ad strstr \
128 dd038bc6 2021-09-21 thomas.ad strtol \
129 dd038bc6 2021-09-21 thomas.ad strtoul \
130 dd038bc6 2021-09-21 thomas.ad wcwidth \
131 dd038bc6 2021-09-21 thomas.ad ])
132 ddd12270 2022-04-22 thomas
133 c4e2e0d0 2022-07-16 thomas AM_CONDITIONAL([HAVE_SETPROCTITLE], [test "x$ac_cv_func_setproctitle" = xyes])
134 683ec58e 2022-07-16 thomas AM_CONDITIONAL([HAVE_SETRESGID], [test "x$ac_cv_func_setresgid" = xyes])
135 683ec58e 2022-07-16 thomas AM_CONDITIONAL([HAVE_SETRESUID], [test "x$ac_cv_func_setresuid" = xyes])
136 c4e2e0d0 2022-07-16 thomas
137 ddd12270 2022-04-22 thomas # Siphash support.
138 ddd12270 2022-04-22 thomas AC_CHECK_FUNCS([SipHash])
139 ddd12270 2022-04-22 thomas AM_CONDITIONAL([HAVE_SIPHASH], [test "x$ac_cv_func_SipHash" = xyes])
140 dd038bc6 2021-09-21 thomas.ad
141 dd038bc6 2021-09-21 thomas.ad # Check for functions with a compatibility implementation.
142 dd038bc6 2021-09-21 thomas.ad AC_REPLACE_FUNCS([ \
143 dd038bc6 2021-09-21 thomas.ad asprintf \
144 dd038bc6 2021-09-21 thomas.ad closefrom \
145 dd038bc6 2021-09-21 thomas.ad explicit_bzero \
146 dd038bc6 2021-09-21 thomas.ad fmt_scaled \
147 dd038bc6 2021-09-21 thomas.ad freezero \
148 dd038bc6 2021-09-21 thomas.ad getdtablecount \
149 dd038bc6 2021-09-21 thomas.ad getline \
150 dd038bc6 2021-09-21 thomas.ad getprogname \
151 dd038bc6 2021-09-21 thomas.ad recallocarray \
152 dd038bc6 2021-09-21 thomas.ad reallocarray \
153 dd038bc6 2021-09-21 thomas.ad strlcat \
154 dd038bc6 2021-09-21 thomas.ad strlcpy \
155 dd038bc6 2021-09-21 thomas.ad strndup \
156 dd038bc6 2021-09-21 thomas.ad strsep \
157 dd038bc6 2021-09-21 thomas.ad strtonum \
158 dd038bc6 2021-09-21 thomas.ad ])
159 dd038bc6 2021-09-21 thomas.ad
160 dd038bc6 2021-09-21 thomas.ad # Always use our getopt because 1) glibc's doesn't enforce argument order 2)
161 dd038bc6 2021-09-21 thomas.ad # musl does not set optarg to NULL for flags without arguments (although it is
162 dd038bc6 2021-09-21 thomas.ad # not required to, but it is helpful) 3) there are probably other weird
163 dd038bc6 2021-09-21 thomas.ad # implementations.
164 dd038bc6 2021-09-21 thomas.ad AC_LIBOBJ(getopt)
165 dd038bc6 2021-09-21 thomas.ad
166 92a9e85d 2021-09-24 thomas # Check the platform we're compiling on.
167 92a9e85d 2021-09-24 thomas AC_MSG_CHECKING(platform)
168 92a9e85d 2021-09-24 thomas case "$host_os" in
169 92a9e85d 2021-09-24 thomas *linux*)
170 92a9e85d 2021-09-24 thomas AC_MSG_RESULT(linux)
171 92a9e85d 2021-09-24 thomas PLATFORM=linux
172 92a9e85d 2021-09-24 thomas ;;
173 92a9e85d 2021-09-24 thomas *freebsd*)
174 92a9e85d 2021-09-24 thomas AC_MSG_RESULT(freebsd)
175 92a9e85d 2021-09-24 thomas PLATFORM=freebsd
176 d24ddaa6 2022-02-26 thomas ;;
177 d24ddaa6 2022-02-26 thomas *darwin*)
178 d24ddaa6 2022-02-26 thomas AC_MSG_RESULT(darwin)
179 d24ddaa6 2022-02-26 thomas PLATFORM=darwin
180 a3732bb6 2022-02-26 thomas ;;
181 a3732bb6 2022-02-26 thomas *netbsd*)
182 a3732bb6 2022-02-26 thomas AC_MSG_RESULT(netbsd)
183 a3732bb6 2022-02-26 thomas PLATFORM=netbsd
184 92a9e85d 2021-09-24 thomas ;;
185 b26177ad 2022-03-03 thomas *dragonfly*)
186 b26177ad 2022-03-03 thomas AC_MSG_RESULT(dragonfly)
187 b26177ad 2022-03-03 thomas PLATFORM=dragonflybsd
188 b26177ad 2022-03-03 thomas ;;
189 92a9e85d 2021-09-24 thomas *)
190 92a9e85d 2021-09-24 thomas AC_MSG_RESULT(unknown)
191 92a9e85d 2021-09-24 thomas PLATFORM=unknown
192 92a9e85d 2021-09-24 thomas ;;
193 92a9e85d 2021-09-24 thomas esac
194 92a9e85d 2021-09-24 thomas AC_SUBST(PLATFORM)
195 92a9e85d 2021-09-24 thomas AM_CONDITIONAL([HOST_FREEBSD], [test "$PLATFORM" = "freebsd"])
196 92a9e85d 2021-09-24 thomas AM_CONDITIONAL([HOST_LINUX], [test "$PLATFORM" = "linux"])
197 d24ddaa6 2022-02-26 thomas AM_CONDITIONAL([HOST_DARWIN], [test "$PLATFORM" = "darwin"])
198 a3732bb6 2022-02-26 thomas AM_CONDITIONAL([HOST_NETBSD], [test "$PLATFORM" = "netbsd"])
199 b26177ad 2022-03-03 thomas AM_CONDITIONAL([HOST_DRAGONFLYBSD], [test "$PLATFORM" = "dragonflybsd"])
200 92a9e85d 2021-09-24 thomas
201 51207398 2022-07-21 thomas if test x"$PLATFORM" = "xdarwin"; then
202 51207398 2022-07-21 thomas if ! test -x "/usr/local/opt/bison/bin/bison"; then
203 51207398 2022-07-21 thomas AC_MSG_ERROR("GNU Bison not found")
204 51207398 2022-07-21 thomas fi
205 51207398 2022-07-21 thomas
206 51207398 2022-07-21 thomas # Override YACC here to point to the GNU version of bison.
207 51207398 2022-07-21 thomas export YACC="/usr/local/opt/bison/bin/bison -y"
208 51207398 2022-07-21 thomas export LDFLAGS="-L/usr/local/opt/ncurses/lib -L/usr/local/opt/openssl@3/lib $LDFLAGS"
209 51207398 2022-07-21 thomas export CPPFLAGS="-I/usr/local/opt/ncurses/include -I/usr/local/opt/openssl@3/include $CPPFLAGS"
210 51207398 2022-07-21 thomas export PKG_CONFIG_PATH="/usr/local/opt/ncurses/lib/pkgconfig"
211 51207398 2022-07-21 thomas export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/openssl@3/lib/pkgconfig"
212 51207398 2022-07-21 thomas fi
213 51207398 2022-07-21 thomas
214 97799ccd 2022-02-06 thomas # Landlock detection.
215 97799ccd 2022-02-06 thomas AC_MSG_CHECKING([for landlock])
216 97799ccd 2022-02-06 thomas AM_CONDITIONAL([HAVE_LINUX_LANDLOCK],
217 97799ccd 2022-02-06 thomas [test "x$ac_cv_header_linux_landlock_h" = "xyes"])
218 97799ccd 2022-02-06 thomas if test "x$ac_cv_header_linux_landlock_h" = "xyes"; then
219 97799ccd 2022-02-06 thomas AC_MSG_RESULT(yes)
220 97799ccd 2022-02-06 thomas else
221 97799ccd 2022-02-06 thomas AC_MSG_RESULT(no)
222 97799ccd 2022-02-06 thomas fi
223 97799ccd 2022-02-06 thomas
224 dd038bc6 2021-09-21 thomas.ad # Clang sanitizers wrap reallocarray even if it isn't available on the target
225 dd038bc6 2021-09-21 thomas.ad # system. When compiled it always returns NULL and crashes the program. To
226 dd038bc6 2021-09-21 thomas.ad # detect this we need a more complicated test.
227 dd038bc6 2021-09-21 thomas.ad AC_MSG_CHECKING([for working reallocarray])
228 dd038bc6 2021-09-21 thomas.ad AC_RUN_IFELSE([AC_LANG_PROGRAM(
229 dd038bc6 2021-09-21 thomas.ad [#include <stdlib.h>],
230 dd038bc6 2021-09-21 thomas.ad [return (reallocarray(NULL, 1, 1) == NULL);]
231 dd038bc6 2021-09-21 thomas.ad )],
232 dd038bc6 2021-09-21 thomas.ad AC_MSG_RESULT(yes),
233 7f20c2a8 2022-05-13 op [AC_LIBOBJ(reallocarray) AC_MSG_RESULT([no])],
234 dd038bc6 2021-09-21 thomas.ad [AC_LIBOBJ(reallocarray) AC_MSG_RESULT([no])]
235 dd038bc6 2021-09-21 thomas.ad )
236 dd038bc6 2021-09-21 thomas.ad AC_MSG_CHECKING([for working recallocarray])
237 dd038bc6 2021-09-21 thomas.ad AC_RUN_IFELSE([AC_LANG_PROGRAM(
238 dd038bc6 2021-09-21 thomas.ad [#include <stdlib.h>],
239 dd038bc6 2021-09-21 thomas.ad [return (recallocarray(NULL, 1, 1, 1) == NULL);]
240 dd038bc6 2021-09-21 thomas.ad )],
241 dd038bc6 2021-09-21 thomas.ad AC_MSG_RESULT(yes),
242 7f20c2a8 2022-05-13 op [AC_LIBOBJ(recallocarray) AC_MSG_RESULT([no])],
243 dd038bc6 2021-09-21 thomas.ad [AC_LIBOBJ(recallocarray) AC_MSG_RESULT([no])]
244 dd038bc6 2021-09-21 thomas.ad )
245 dd038bc6 2021-09-21 thomas.ad
246 dd038bc6 2021-09-21 thomas.ad # Look for imsg_init in libutil.
247 dd038bc6 2021-09-21 thomas.ad AC_SEARCH_LIBS(imsg_init, util, found_imsg_init=yes, found_imsg_init=no)
248 dd038bc6 2021-09-21 thomas.ad if test "x$found_imsg_init" = xyes; then
249 dd038bc6 2021-09-21 thomas.ad AC_DEFINE(HAVE_IMSG)
250 dd038bc6 2021-09-21 thomas.ad else
251 dd038bc6 2021-09-21 thomas.ad AC_LIBOBJ(imsg)
252 dd038bc6 2021-09-21 thomas.ad AC_LIBOBJ(imsg-buffer)
253 ff36aeea 2022-07-16 thomas fi
254 ff36aeea 2022-07-16 thomas
255 ff36aeea 2022-07-16 thomas # libevent (for gotwebd). Lifted from tmux.
256 ff36aeea 2022-07-16 thomas # Look for libevent. Try libevent_core or libevent with pkg-config first then
257 ff36aeea 2022-07-16 thomas # look for the library.
258 ff36aeea 2022-07-16 thomas PKG_CHECK_MODULES(
259 ff36aeea 2022-07-16 thomas LIBEVENT_CORE,
260 ff36aeea 2022-07-16 thomas [libevent_core >= 2],
261 ff36aeea 2022-07-16 thomas [
262 ff36aeea 2022-07-16 thomas AM_CPPFLAGS="$LIBEVENT_CORE_CFLAGS $AM_CPPFLAGS"
263 ff36aeea 2022-07-16 thomas CPPFLAGS="$AM_CPPFLAGS $SAVED_CPPFLAGS"
264 ff36aeea 2022-07-16 thomas LIBS="$LIBEVENT_CORE_LIBS $LIBS"
265 ff36aeea 2022-07-16 thomas found_libevent=yes
266 ff36aeea 2022-07-16 thomas ],
267 ff36aeea 2022-07-16 thomas found_libevent=no
268 ff36aeea 2022-07-16 thomas )
269 ff36aeea 2022-07-16 thomas if test x$found_libevent = xno; then
270 ff36aeea 2022-07-16 thomas PKG_CHECK_MODULES(
271 ff36aeea 2022-07-16 thomas LIBEVENT,
272 ff36aeea 2022-07-16 thomas [libevent >= 2],
273 ff36aeea 2022-07-16 thomas [
274 ff36aeea 2022-07-16 thomas AM_CPPFLAGS="$LIBEVENT_CFLAGS $AM_CPPFLAGS"
275 ff36aeea 2022-07-16 thomas CPPFLAGS="$AM_CPPFLAGS $SAVED_CPPFLAGS"
276 ff36aeea 2022-07-16 thomas LIBS="$LIBEVENT_LIBS $LIBS"
277 ff36aeea 2022-07-16 thomas found_libevent=yes
278 ff36aeea 2022-07-16 thomas ],
279 ff36aeea 2022-07-16 thomas found_libevent=no
280 ff36aeea 2022-07-16 thomas )
281 ff36aeea 2022-07-16 thomas fi
282 ff36aeea 2022-07-16 thomas if test x$found_libevent = xno; then
283 ff36aeea 2022-07-16 thomas AC_SEARCH_LIBS(
284 ff36aeea 2022-07-16 thomas event_init,
285 ff36aeea 2022-07-16 thomas [event_core event event-1.4],
286 ff36aeea 2022-07-16 thomas found_libevent=yes,
287 ff36aeea 2022-07-16 thomas found_libevent=no
288 ff36aeea 2022-07-16 thomas )
289 ff36aeea 2022-07-16 thomas fi
290 ff36aeea 2022-07-16 thomas AC_CHECK_HEADER(
291 ff36aeea 2022-07-16 thomas event2/event.h,
292 ff36aeea 2022-07-16 thomas AC_DEFINE(HAVE_EVENT2_EVENT_H),
293 ff36aeea 2022-07-16 thomas [
294 ff36aeea 2022-07-16 thomas AC_CHECK_HEADER(
295 ff36aeea 2022-07-16 thomas event.h,
296 ff36aeea 2022-07-16 thomas AC_DEFINE(HAVE_EVENT_H),
297 ff36aeea 2022-07-16 thomas found_libevent=no
298 ff36aeea 2022-07-16 thomas )
299 ff36aeea 2022-07-16 thomas ]
300 ff36aeea 2022-07-16 thomas )
301 ff36aeea 2022-07-16 thomas if test "x$found_libevent" = xno; then
302 ff36aeea 2022-07-16 thomas AC_MSG_ERROR("libevent not found")
303 dd038bc6 2021-09-21 thomas.ad fi
304 dd038bc6 2021-09-21 thomas.ad
305 dd038bc6 2021-09-21 thomas.ad # libcrypto (via libssl for SHA information)
306 dd038bc6 2021-09-21 thomas.ad PKG_CHECK_MODULES(
307 dd038bc6 2021-09-21 thomas.ad LIBCRYPTO,
308 dd038bc6 2021-09-21 thomas.ad libcrypto,
309 dd038bc6 2021-09-21 thomas.ad [
310 839511b2 2021-10-01 stsp AM_CFLAGS="$LIBCRYPTO_CFLAGS $AM_CFLAGS"
311 dd038bc6 2021-09-21 thomas.ad CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
312 dd038bc6 2021-09-21 thomas.ad LIBS="$LIBCRYPTO_LIBS $LIBS"
313 dd038bc6 2021-09-21 thomas.ad found_libcrypto=yes
314 dd038bc6 2021-09-21 thomas.ad ],
315 dd038bc6 2021-09-21 thomas.ad [
316 92a9e85d 2021-09-24 thomas found_libcrypto=no
317 dd038bc6 2021-09-21 thomas.ad ]
318 dd038bc6 2021-09-21 thomas.ad )
319 dd038bc6 2021-09-21 thomas.ad
320 92a9e85d 2021-09-24 thomas if test "x$found_libcrypto" = "xyes"; then
321 92a9e85d 2021-09-24 thomas AC_DEFINE(HAVE_LIBCRYPTO)
322 92a9e85d 2021-09-24 thomas fi
323 92a9e85d 2021-09-24 thomas
324 dd038bc6 2021-09-21 thomas.ad AC_SEARCH_LIBS(uuid_create, , AC_DEFINE(HAVE_BSD_UUID))
325 326237a6 2021-09-25 thomas AC_SEARCH_LIBS(uuid_create, found_uuid=no, found_uuid=yes)
326 dd038bc6 2021-09-21 thomas.ad AC_SEARCH_LIBS(mergesort, , AC_DEFINE(HAVE_BSD_MERGESORT))
327 dd038bc6 2021-09-21 thomas.ad
328 d24ddaa6 2022-02-26 thomas # Don't define HAVE_BSD_UUID on darwin (Apple) as this breaks the BSD API.
329 d24ddaa6 2022-02-26 thomas # Instead, use the UUID implementation wrapper that's in compat/ plus uuid
330 d24ddaa6 2022-02-26 thomas # ossp
331 d24ddaa6 2022-02-26 thomas if test "x$found_uuid" = "xyes" -a "x$PLATFORM" != "darwin"; then
332 326237a6 2021-09-25 thomas AC_DEFINE(HAVE_BSD_UUID)
333 326237a6 2021-09-25 thomas else
334 326237a6 2021-09-25 thomas PKG_CHECK_MODULES(
335 326237a6 2021-09-25 thomas LIBUUID,
336 326237a6 2021-09-25 thomas uuid,
337 326237a6 2021-09-25 thomas [
338 326237a6 2021-09-25 thomas AM_CFLAGS="$LIBUUID_CFLAGS $AM_CFLAGS"
339 326237a6 2021-09-25 thomas CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
340 326237a6 2021-09-25 thomas LIBS="$LIBUUID_LIBS $LIBS"
341 326237a6 2021-09-25 thomas found_libuuid=yes
342 326237a6 2021-09-25 thomas ],
343 326237a6 2021-09-25 thomas [
344 326237a6 2021-09-25 thomas found_libuuid=no
345 326237a6 2021-09-25 thomas ]
346 326237a6 2021-09-25 thomas )
347 dd038bc6 2021-09-21 thomas.ad
348 326237a6 2021-09-25 thomas if test "x$found_libuuid" = "xno"; then
349 326237a6 2021-09-25 thomas AC_CHECK_HEADER(
350 326237a6 2021-09-25 thomas uuid.h,
351 326237a6 2021-09-25 thomas found_libuuid=yes,
352 326237a6 2021-09-25 thomas found_libuuid=no)
353 326237a6 2021-09-25 thomas fi
354 92a9e85d 2021-09-24 thomas fi
355 dd038bc6 2021-09-21 thomas.ad
356 92a9e85d 2021-09-24 thomas if test "x$found_libuuid" = "xno"; then
357 92a9e85d 2021-09-24 thomas AC_MSG_ERROR("*** couldn't find uuid ***")
358 92a9e85d 2021-09-24 thomas fi
359 92a9e85d 2021-09-24 thomas
360 dd038bc6 2021-09-21 thomas.ad PKG_CHECK_MODULES(
361 dd038bc6 2021-09-21 thomas.ad ZLIB,
362 dd038bc6 2021-09-21 thomas.ad zlib,
363 dd038bc6 2021-09-21 thomas.ad [
364 dd038bc6 2021-09-21 thomas.ad AM_CFLAGS="$ZLIB_CFLAGS $AM_CFLAGS"
365 dd038bc6 2021-09-21 thomas.ad CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
366 dd038bc6 2021-09-21 thomas.ad LIBS="$ZLIB_LIBS $LIBS"
367 dd038bc6 2021-09-21 thomas.ad found_zlib=yes
368 dd038bc6 2021-09-21 thomas.ad ],
369 dd038bc6 2021-09-21 thomas.ad [
370 92a9e85d 2021-09-24 thomas found_zlib=no
371 dd038bc6 2021-09-21 thomas.ad ]
372 dd038bc6 2021-09-21 thomas.ad )
373 dd038bc6 2021-09-21 thomas.ad
374 92a9e85d 2021-09-24 thomas if test "x$found_zlib" = "xno"; then
375 92a9e85d 2021-09-24 thomas AC_CHECK_HEADER(
376 92a9e85d 2021-09-24 thomas zlib.h,
377 92a9e85d 2021-09-24 thomas ,
378 92a9e85d 2021-09-24 thomas found_zlib=no)
379 92a9e85d 2021-09-24 thomas fi
380 dd038bc6 2021-09-21 thomas.ad
381 92a9e85d 2021-09-24 thomas if test "x$found_zlib" = "xno"; then
382 92a9e85d 2021-09-24 thomas AC_MSG_ERROR("*** couldn't find zlib ***")
383 92a9e85d 2021-09-24 thomas fi
384 dd038bc6 2021-09-21 thomas.ad
385 92a9e85d 2021-09-24 thomas if test "$PLATFORM" = "linux"; then
386 92a9e85d 2021-09-24 thomas PKG_CHECK_MODULES(
387 92a9e85d 2021-09-24 thomas LIBMD,
388 92a9e85d 2021-09-24 thomas libmd,
389 92a9e85d 2021-09-24 thomas [
390 92a9e85d 2021-09-24 thomas AM_CFLAGS="$LIBMD_CFLAGS $AM_CFLAGS"
391 92a9e85d 2021-09-24 thomas CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
392 92a9e85d 2021-09-24 thomas LIBS="$LIBMD_LIBS $LIBS"
393 92a9e85d 2021-09-24 thomas ],
394 92a9e85d 2021-09-24 thomas [
395 92a9e85d 2021-09-24 thomas AC_MSG_ERROR("*** couldn't find libmd via pkg-config")
396 92a9e85d 2021-09-24 thomas ]
397 92a9e85d 2021-09-24 thomas )
398 92a9e85d 2021-09-24 thomas PKG_CHECK_MODULES(
399 92a9e85d 2021-09-24 thomas LIBBSD,
400 92a9e85d 2021-09-24 thomas libbsd-overlay,
401 92a9e85d 2021-09-24 thomas [
402 92a9e85d 2021-09-24 thomas AM_CFLAGS="$LIBBSD_CFLAGS $AM_CFLAGS"
403 92a9e85d 2021-09-24 thomas CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
404 92a9e85d 2021-09-24 thomas LIBS="$LIBBSD_LIBS $LIBS"
405 92a9e85d 2021-09-24 thomas found_libbsd=yes
406 92a9e85d 2021-09-24 thomas AC_DEFINE(HAVE_LIBBSD)
407 92a9e85d 2021-09-24 thomas ],
408 92a9e85d 2021-09-24 thomas []
409 92a9e85d 2021-09-24 thomas )
410 92a9e85d 2021-09-24 thomas fi
411 92a9e85d 2021-09-24 thomas
412 dd038bc6 2021-09-21 thomas.ad # Look for a suitable queue.h. We hope libbsd is enough, but that is missing
413 dd038bc6 2021-09-21 thomas.ad # SIMPLEQ.
414 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
415 dd038bc6 2021-09-21 thomas.ad SIMPLEQ_INIT,
416 dd038bc6 2021-09-21 thomas.ad found_queue_h=yes,
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 TAILQ_CONCAT,
421 dd038bc6 2021-09-21 thomas.ad found_queue_h=yes,
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_PREV,
426 19467d59 2022-07-16 thomas ,
427 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
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_REPLACE,
431 19467d59 2022-07-16 thomas ,
432 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
433 dd038bc6 2021-09-21 thomas.ad )
434 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
435 dd038bc6 2021-09-21 thomas.ad SIMPLEQ_ENTRY,
436 dd038bc6 2021-09-21 thomas.ad ,
437 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
438 dd038bc6 2021-09-21 thomas.ad )
439 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
440 dd038bc6 2021-09-21 thomas.ad TAILQ_FOREACH_SAFE,
441 dd038bc6 2021-09-21 thomas.ad ,
442 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
443 dd038bc6 2021-09-21 thomas.ad )
444 19467d59 2022-07-16 thomas
445 19467d59 2022-07-16 thomas if test "x$found_queue_h" = xyes -o "x$ac_cv_header_sys_queue_h" = xyes; then
446 dd038bc6 2021-09-21 thomas.ad AC_DEFINE(HAVE_QUEUE_H)
447 dd038bc6 2021-09-21 thomas.ad fi
448 dd038bc6 2021-09-21 thomas.ad
449 dd038bc6 2021-09-21 thomas.ad # Look for __progname.
450 dd038bc6 2021-09-21 thomas.ad AC_MSG_CHECKING(for __progname)
451 dd038bc6 2021-09-21 thomas.ad AC_LINK_IFELSE([AC_LANG_SOURCE(
452 dd038bc6 2021-09-21 thomas.ad [
453 dd038bc6 2021-09-21 thomas.ad #include <stdio.h>
454 dd038bc6 2021-09-21 thomas.ad #include <stdlib.h>
455 dd038bc6 2021-09-21 thomas.ad extern char *__progname;
456 dd038bc6 2021-09-21 thomas.ad int main(void) {
457 dd038bc6 2021-09-21 thomas.ad const char *cp = __progname;
458 dd038bc6 2021-09-21 thomas.ad printf("%s\n", cp);
459 dd038bc6 2021-09-21 thomas.ad exit(0);
460 dd038bc6 2021-09-21 thomas.ad }
461 dd038bc6 2021-09-21 thomas.ad ])],
462 dd038bc6 2021-09-21 thomas.ad [AC_DEFINE(HAVE___PROGNAME) AC_MSG_RESULT(yes)],
463 dd038bc6 2021-09-21 thomas.ad AC_MSG_RESULT(no)
464 dd038bc6 2021-09-21 thomas.ad )
465 dd038bc6 2021-09-21 thomas.ad
466 d9e4d43f 2022-03-03 thomas PKG_CHECK_MODULES(
467 d9e4d43f 2022-03-03 thomas LIBPANELW,
468 d9e4d43f 2022-03-03 thomas panelw,
469 d9e4d43f 2022-03-03 thomas found_panel=yes,
470 d9e4d43f 2022-03-03 thomas found_panel=no
471 d9e4d43f 2022-03-03 thomas )
472 d9e4d43f 2022-03-03 thomas
473 d9e4d43f 2022-03-03 thomas PKG_CHECK_MODULES(
474 d9e4d43f 2022-03-03 thomas LIBPANELW,
475 d9e4d43f 2022-03-03 thomas gnupanelw,
476 d9e4d43f 2022-03-03 thomas found_panel=yes,
477 d9e4d43f 2022-03-03 thomas found_panel=no
478 d9e4d43f 2022-03-03 thomas )
479 d9e4d43f 2022-03-03 thomas
480 b26177ad 2022-03-03 thomas PKG_CHECK_MODULES(
481 b26177ad 2022-03-03 thomas LIBPANELW,
482 b26177ad 2022-03-03 thomas panel,
483 b26177ad 2022-03-03 thomas found_panel=yes,
484 b26177ad 2022-03-03 thomas found_panel=no
485 b26177ad 2022-03-03 thomas )
486 d9e4d43f 2022-03-03 thomas if test "x$found_panel" = "xno"; then
487 92a9e85d 2021-09-24 thomas AC_CHECK_LIB(panelw, update_panels,,
488 92a9e85d 2021-09-24 thomas AC_MSG_ERROR([ "*** panelw not found for ncurses. ***"])
489 92a9e85d 2021-09-24 thomas )
490 acf52a76 2021-09-21 thomas.ad
491 92a9e85d 2021-09-24 thomas LIBPANELW_LIBS="-lpanelw"
492 92a9e85d 2021-09-24 thomas fi
493 92a9e85d 2021-09-24 thomas
494 acf52a76 2021-09-21 thomas.ad PKG_CHECK_MODULES(
495 acf52a76 2021-09-21 thomas.ad LIBNCURSES,
496 acf52a76 2021-09-21 thomas.ad ncursesw,
497 dd038bc6 2021-09-21 thomas.ad found_ncurses=yes,
498 dd038bc6 2021-09-21 thomas.ad found_ncurses=no
499 dd038bc6 2021-09-21 thomas.ad )
500 acf52a76 2021-09-21 thomas.ad if test "x$found_ncurses" = xyes; then
501 acf52a76 2021-09-21 thomas.ad AM_CFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $LIBPANELW_CFLAGS $AM_CFLAGS"
502 acf52a76 2021-09-21 thomas.ad CFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $LIBPANELW_CFLAGS $CFLAGS"
503 acf52a76 2021-09-21 thomas.ad LIBS="$LIBNCURSES_LIBS $LIBTINFO_LIBS $LIBPANELW_LIBS $LIBS"
504 dd038bc6 2021-09-21 thomas.ad else
505 dd038bc6 2021-09-21 thomas.ad AC_CHECK_LIB(
506 acf52a76 2021-09-21 thomas.ad ncursesw,
507 dd038bc6 2021-09-21 thomas.ad setupterm,
508 dd038bc6 2021-09-21 thomas.ad found_ncurses=yes,
509 dd038bc6 2021-09-21 thomas.ad found_ncurses=no
510 dd038bc6 2021-09-21 thomas.ad )
511 dd038bc6 2021-09-21 thomas.ad if test "x$found_ncurses" = xyes; then
512 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADER(
513 dd038bc6 2021-09-21 thomas.ad ncurses.h,
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 -lncursesw $LIBPANELW_LIBS",
517 acf52a76 2021-09-21 thomas.ad found_ncurses=no
518 acf52a76 2021-09-21 thomas.ad )
519 92a9e85d 2021-09-24 thomas fi
520 dd038bc6 2021-09-21 thomas.ad fi
521 dd038bc6 2021-09-21 thomas.ad if test "x$found_ncurses" = xyes; then
522 dd038bc6 2021-09-21 thomas.ad AC_DEFINE(HAVE_NCURSES_H)
523 dd038bc6 2021-09-21 thomas.ad else
524 dd038bc6 2021-09-21 thomas.ad # No ncurses, try curses.
525 dd038bc6 2021-09-21 thomas.ad AC_CHECK_LIB(
526 acf52a76 2021-09-21 thomas.ad cursesw,
527 dd038bc6 2021-09-21 thomas.ad setupterm,
528 dd038bc6 2021-09-21 thomas.ad found_curses=yes,
529 dd038bc6 2021-09-21 thomas.ad found_curses=no
530 dd038bc6 2021-09-21 thomas.ad )
531 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADER(
532 dd038bc6 2021-09-21 thomas.ad curses.h,
533 dd038bc6 2021-09-21 thomas.ad ,
534 dd038bc6 2021-09-21 thomas.ad found_curses=no)
535 dd038bc6 2021-09-21 thomas.ad if test "x$found_curses" = xyes; then
536 acf52a76 2021-09-21 thomas.ad AM_CFLAGS="$LIBPANELW_CFLAGS $AM_CFLAGS"
537 acf52a76 2021-09-21 thomas.ad CFLAGS="$LIBPANEL_CFLAGS $CFLAGS"
538 acf52a76 2021-09-21 thomas.ad LIBS="$LIBS -lcursesw $LIBPANELW_LIBS"
539 dd038bc6 2021-09-21 thomas.ad AC_DEFINE(HAVE_CURSES_H)
540 dd038bc6 2021-09-21 thomas.ad else
541 dd038bc6 2021-09-21 thomas.ad AC_MSG_ERROR("curses not found")
542 dd038bc6 2021-09-21 thomas.ad fi
543 dd038bc6 2021-09-21 thomas.ad fi
544 dd038bc6 2021-09-21 thomas.ad
545 dd038bc6 2021-09-21 thomas.ad # Save our CFLAGS/CPPFLAGS/LDFLAGS for the Makefile and restore the old user
546 dd038bc6 2021-09-21 thomas.ad # variables.
547 dd038bc6 2021-09-21 thomas.ad AC_SUBST(AM_CPPFLAGS)
548 dd038bc6 2021-09-21 thomas.ad CPPFLAGS="$SAVED_CPPFLAGS"
549 dd038bc6 2021-09-21 thomas.ad AC_SUBST(AM_CFLAGS)
550 dd038bc6 2021-09-21 thomas.ad CFLAGS="$SAVED_CFLAGS"
551 dd038bc6 2021-09-21 thomas.ad AC_SUBST(AM_LDFLAGS)
552 dd038bc6 2021-09-21 thomas.ad LDFLAGS="$SAVED_LDFLAGS"
553 dd038bc6 2021-09-21 thomas.ad
554 dd038bc6 2021-09-21 thomas.ad AC_CONFIG_FILES([Makefile
555 dd038bc6 2021-09-21 thomas.ad compat/Makefile
556 dd038bc6 2021-09-21 thomas.ad libexec/Makefile
557 dd038bc6 2021-09-21 thomas.ad libexec/got-read-tree/Makefile
558 dd038bc6 2021-09-21 thomas.ad libexec/got-fetch-pack/Makefile
559 dd038bc6 2021-09-21 thomas.ad libexec/got-index-pack/Makefile
560 dd038bc6 2021-09-21 thomas.ad libexec/got-read-blob/Makefile
561 dd038bc6 2021-09-21 thomas.ad libexec/got-read-commit/Makefile
562 dd038bc6 2021-09-21 thomas.ad libexec/got-read-gitconfig/Makefile
563 dd038bc6 2021-09-21 thomas.ad libexec/got-read-gotconfig/Makefile
564 dd038bc6 2021-09-21 thomas.ad libexec/got-read-object/Makefile
565 dd038bc6 2021-09-21 thomas.ad libexec/got-read-pack/Makefile
566 973f3f6e 2022-03-07 thomas libexec/got-read-patch/Makefile
567 dd038bc6 2021-09-21 thomas.ad libexec/got-read-tag/Makefile
568 dd038bc6 2021-09-21 thomas.ad libexec/got-send-pack/Makefile
569 dd038bc6 2021-09-21 thomas.ad got/Makefile
570 2b0eee35 2021-09-21 thomas.ad gotadmin/Makefile
571 ff36aeea 2022-07-16 thomas gotwebd/Makefile
572 d3f2ad5e 2021-09-21 thomas.ad tog/Makefile
573 5a7ef102 2021-10-09 thomas Makefile.common:Makefile.common.in])
574 dd038bc6 2021-09-21 thomas.ad AC_OUTPUT
575 dd038bc6 2021-09-21 thomas.ad
576 dd038bc6 2021-09-21 thomas.ad # tog/GNUMakefile])
577 dd038bc6 2021-09-21 thomas.ad # regress/GNUMakefile
578 dd038bc6 2021-09-21 thomas.ad # regress/cmdline/GNUMakefile
579 dd038bc6 2021-09-21 thomas.ad # regress/delta/GNUMakefile
580 dd038bc6 2021-09-21 thomas.ad # regress/fetch/GNUMakefile
581 dd038bc6 2021-09-21 thomas.ad # regress/idset/GNUMakefile
582 dd038bc6 2021-09-21 thomas.ad # regress/path/GNUMakefile
583 dd038bc6 2021-09-21 thomas.ad # gotweb/GNUMakefile
584 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/GNUMakefile
585 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-blob/GNUMakefile
586 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-commit/GNUMakefile
587 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-gitconfig/GNUMakefile
588 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-gotconfig/GNUMakefile
589 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-object/GNUMakefile
590 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-pack/GNUMakefile
591 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-tag/GNUMakefile
592 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-tree/GNUMakefile