1 dd038bc6 2021-09-21 thomas.ad # Process this file with autoconf to produce a configure script.
3 dd038bc6 2021-09-21 thomas.ad AC_PREREQ([2.69])
4 598139dd 2022-07-22 thomas AC_INIT([got-portable],
5 4b553fec 2022-08-20 thomas m4_esyscmd_s(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])
11 dd038bc6 2021-09-21 thomas.ad AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
12 dd038bc6 2021-09-21 thomas.ad AC_SUBST(VERSION)
13 dd038bc6 2021-09-21 thomas.ad AC_SUBST(GOT_RELEASE)
15 dd038bc6 2021-09-21 thomas.ad AC_CANONICAL_HOST
17 dd038bc6 2021-09-21 thomas.ad # When CFLAGS isn't set at this stage and gcc is detected by the macro below,
18 dd038bc6 2021-09-21 thomas.ad # autoconf will automatically use CFLAGS="-O2 -g". Prevent that by using an
19 dd038bc6 2021-09-21 thomas.ad # empty default.
20 dd038bc6 2021-09-21 thomas.ad : ${CFLAGS=""}
22 dd038bc6 2021-09-21 thomas.ad # Save user CPPFLAGS, CFLAGS and LDFLAGS. We need to change them because
23 dd038bc6 2021-09-21 thomas.ad # AC_CHECK_HEADER doesn't give us any other way to update the include
24 dd038bc6 2021-09-21 thomas.ad # paths. But for Makefile.am we want to use AM_CPPFLAGS and friends.
25 dd038bc6 2021-09-21 thomas.ad SAVED_CFLAGS="$CFLAGS"
26 dd038bc6 2021-09-21 thomas.ad SAVED_CPPFLAGS="$CPPFLAGS"
27 dd038bc6 2021-09-21 thomas.ad SAVED_LDFLAGS="$LDFLAGS"
29 dd038bc6 2021-09-21 thomas.ad # Checks for programs.
30 dd038bc6 2021-09-21 thomas.ad AC_PROG_CC
31 dd038bc6 2021-09-21 thomas.ad AC_PROG_CPP
32 dd038bc6 2021-09-21 thomas.ad AC_PROG_INSTALL
33 dd038bc6 2021-09-21 thomas.ad AC_PROG_LN_S
34 dd038bc6 2021-09-21 thomas.ad AC_PROG_MAKE_SET
35 dd038bc6 2021-09-21 thomas.ad AC_PROG_YACC
36 dd038bc6 2021-09-21 thomas.ad AC_PROG_RANLIB
37 dd038bc6 2021-09-21 thomas.ad PKG_PROG_PKG_CONFIG
38 dd038bc6 2021-09-21 thomas.ad AC_USE_SYSTEM_EXTENSIONS
40 dd038bc6 2021-09-21 thomas.ad # Checks for header files.
41 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADERS([ \
42 dd038bc6 2021-09-21 thomas.ad fcntl.h \
43 dd038bc6 2021-09-21 thomas.ad langinfo.h \
44 dd038bc6 2021-09-21 thomas.ad limits.h \
45 97799ccd 2022-02-06 thomas linux/landlock.h \
46 dd038bc6 2021-09-21 thomas.ad locale.h \
47 dd038bc6 2021-09-21 thomas.ad netdb.h \
48 dd038bc6 2021-09-21 thomas.ad netinet/in.h \
49 dd038bc6 2021-09-21 thomas.ad paths.h \
51 dd038bc6 2021-09-21 thomas.ad stddef.h \
52 dd038bc6 2021-09-21 thomas.ad stdint.h \
53 dd038bc6 2021-09-21 thomas.ad stdlib.h \
54 dd038bc6 2021-09-21 thomas.ad string.h \
55 dd038bc6 2021-09-21 thomas.ad sys/ioctl.h \
56 dd038bc6 2021-09-21 thomas.ad sys/param.h \
57 d24ddaa6 2022-02-26 thomas sys/poll.h \
58 19467d59 2022-07-16 thomas sys/queue.h \
59 dd038bc6 2021-09-21 thomas.ad sys/socket.h \
60 dd038bc6 2021-09-21 thomas.ad sys/time.h \
61 dd038bc6 2021-09-21 thomas.ad sys/tree.h \
62 dd038bc6 2021-09-21 thomas.ad util.h \
63 dd038bc6 2021-09-21 thomas.ad unistd.h \
64 dd038bc6 2021-09-21 thomas.ad wchar.h \
67 dd038bc6 2021-09-21 thomas.ad # Checks for typ edefs, structures, and compiler characteristics.
68 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADER_STDBOOL
69 dd038bc6 2021-09-21 thomas.ad AC_C_INLINE
70 dd038bc6 2021-09-21 thomas.ad AC_TYPE_INT64_T
71 dd038bc6 2021-09-21 thomas.ad AC_TYPE_MODE_T
72 dd038bc6 2021-09-21 thomas.ad AC_TYPE_OFF_T
73 dd038bc6 2021-09-21 thomas.ad AC_TYPE_PID_T
74 dd038bc6 2021-09-21 thomas.ad AC_TYPE_SIZE_T
75 dd038bc6 2021-09-21 thomas.ad AC_TYPE_SSIZE_T
76 dd038bc6 2021-09-21 thomas.ad AC_TYPE_UINT16_T
77 dd038bc6 2021-09-21 thomas.ad AC_TYPE_UINT32_T
78 dd038bc6 2021-09-21 thomas.ad AC_TYPE_UINT64_T
79 dd038bc6 2021-09-21 thomas.ad AC_TYPE_UINT8_T
81 ff36aeea 2022-07-16 thomas # Check for ifgroupreq which is only available on BSD.
82 ff36aeea 2022-07-16 thomas AC_CHECK_TYPES([struct ifgroupreq])
84 75716fd6 2022-08-27 thomas # Check for sockaddr_storage. On some systems, ss_len is filled out, although
85 75716fd6 2022-08-27 thomas # this is not mandated by POSIX, and hence systems such as linux, don't have
87 75716fd6 2022-08-27 thomas AC_CHECK_TYPES([struct sockaddr_storage], [], [], [
88 75716fd6 2022-08-27 thomas #include <sys/types.h>
89 75716fd6 2022-08-27 thomas #include <sys/socket.h>
92 75716fd6 2022-08-27 thomas # Same thing as sockaddr_storage above, only now check if the member exists in
93 75716fd6 2022-08-27 thomas # the struct as well.
94 75716fd6 2022-08-27 thomas AC_CHECK_MEMBERS([struct sockaddr_storage.ss_len], , ,
95 75716fd6 2022-08-27 thomas [ #include <netdb.h>
96 75716fd6 2022-08-27 thomas #include <netinet/in.h>
97 75716fd6 2022-08-27 thomas #include <sys/socket.h> ]
100 75716fd6 2022-08-27 thomas AC_CHECK_MEMBERS([struct sockaddr.sa_len], , ,
101 75716fd6 2022-08-27 thomas [ #include <netdb.h>
102 75716fd6 2022-08-27 thomas #include <netinet/in.h>
103 75716fd6 2022-08-27 thomas #include <sys/socket.h> ]
106 75716fd6 2022-08-27 thomas # Both checks above will result in:
108 75716fd6 2022-08-27 thomas # HAVE_STRUCT_SOCKADDR_AS_LEN
111 75716fd6 2022-08-27 thomas # Either being defined or not.
113 dd038bc6 2021-09-21 thomas.ad # Look for library needed for flock.
114 dd038bc6 2021-09-21 thomas.ad AC_SEARCH_LIBS(flock, bsd)
116 dd038bc6 2021-09-21 thomas.ad # Checks for library functions.
117 dd038bc6 2021-09-21 thomas.ad AC_FUNC_FORK
118 dd038bc6 2021-09-21 thomas.ad AC_FUNC_FSEEKO
119 dd038bc6 2021-09-21 thomas.ad AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
120 dd038bc6 2021-09-21 thomas.ad AC_FUNC_MALLOC
121 dd038bc6 2021-09-21 thomas.ad AC_FUNC_MMAP
122 dd038bc6 2021-09-21 thomas.ad AC_FUNC_REALLOC
123 dd038bc6 2021-09-21 thomas.ad AC_FUNC_STRERROR_R
124 dd038bc6 2021-09-21 thomas.ad AC_FUNC_STRNLEN
125 dd038bc6 2021-09-21 thomas.ad AC_CHECK_FUNCS([ \
126 dd038bc6 2021-09-21 thomas.ad dup2 \
127 dd038bc6 2021-09-21 thomas.ad flock \
128 dd038bc6 2021-09-21 thomas.ad getcwd \
129 dd038bc6 2021-09-21 thomas.ad localtime_r \
130 dd038bc6 2021-09-21 thomas.ad memchr \
131 dd038bc6 2021-09-21 thomas.ad memmove \
132 dd038bc6 2021-09-21 thomas.ad memset \
133 dd038bc6 2021-09-21 thomas.ad mkdir \
134 dd038bc6 2021-09-21 thomas.ad munmap \
135 dd038bc6 2021-09-21 thomas.ad nl_langinfo \
136 dd038bc6 2021-09-21 thomas.ad realpath \
137 dd038bc6 2021-09-21 thomas.ad regcomp \
138 dd038bc6 2021-09-21 thomas.ad rmdir \
139 dd038bc6 2021-09-21 thomas.ad setlocale \
140 dd038bc6 2021-09-21 thomas.ad socket \
141 683ec58e 2022-07-16 thomas setresgid \
142 683ec58e 2022-07-16 thomas setresuid \
143 c4e2e0d0 2022-07-16 thomas setproctitle \
144 dd038bc6 2021-09-21 thomas.ad strcasecmp \
145 dd038bc6 2021-09-21 thomas.ad strchr \
146 dd038bc6 2021-09-21 thomas.ad strcspn \
147 dd038bc6 2021-09-21 thomas.ad strdup \
148 dd038bc6 2021-09-21 thomas.ad strerror \
149 dd038bc6 2021-09-21 thomas.ad strlcpy \
150 dd038bc6 2021-09-21 thomas.ad strncasecmp \
151 dd038bc6 2021-09-21 thomas.ad strndup \
152 dd038bc6 2021-09-21 thomas.ad strrchr \
153 dd038bc6 2021-09-21 thomas.ad strspn \
154 dd038bc6 2021-09-21 thomas.ad strstr \
155 dd038bc6 2021-09-21 thomas.ad strtol \
156 dd038bc6 2021-09-21 thomas.ad strtoul \
157 dd038bc6 2021-09-21 thomas.ad wcwidth \
160 c4e2e0d0 2022-07-16 thomas AM_CONDITIONAL([HAVE_SETPROCTITLE], [test "x$ac_cv_func_setproctitle" = xyes])
161 683ec58e 2022-07-16 thomas AM_CONDITIONAL([HAVE_SETRESGID], [test "x$ac_cv_func_setresgid" = xyes])
162 683ec58e 2022-07-16 thomas AM_CONDITIONAL([HAVE_SETRESUID], [test "x$ac_cv_func_setresuid" = xyes])
164 ddd12270 2022-04-22 thomas # Siphash support.
165 ddd12270 2022-04-22 thomas AC_CHECK_FUNCS([SipHash])
166 ddd12270 2022-04-22 thomas AM_CONDITIONAL([HAVE_SIPHASH], [test "x$ac_cv_func_SipHash" = xyes])
168 dd038bc6 2021-09-21 thomas.ad # Check for functions with a compatibility implementation.
169 dd038bc6 2021-09-21 thomas.ad AC_REPLACE_FUNCS([ \
170 dd038bc6 2021-09-21 thomas.ad asprintf \
171 dd038bc6 2021-09-21 thomas.ad closefrom \
172 dd038bc6 2021-09-21 thomas.ad explicit_bzero \
173 dd038bc6 2021-09-21 thomas.ad fmt_scaled \
174 dd038bc6 2021-09-21 thomas.ad freezero \
175 dd038bc6 2021-09-21 thomas.ad getdtablecount \
176 dd038bc6 2021-09-21 thomas.ad getline \
177 dd038bc6 2021-09-21 thomas.ad getprogname \
178 dd038bc6 2021-09-21 thomas.ad recallocarray \
179 dd038bc6 2021-09-21 thomas.ad reallocarray \
180 dd038bc6 2021-09-21 thomas.ad strlcat \
181 dd038bc6 2021-09-21 thomas.ad strlcpy \
182 dd038bc6 2021-09-21 thomas.ad strndup \
183 dd038bc6 2021-09-21 thomas.ad strsep \
184 dd038bc6 2021-09-21 thomas.ad strtonum \
187 dd038bc6 2021-09-21 thomas.ad # Always use our getopt because 1) glibc's doesn't enforce argument order 2)
188 dd038bc6 2021-09-21 thomas.ad # musl does not set optarg to NULL for flags without arguments (although it is
189 dd038bc6 2021-09-21 thomas.ad # not required to, but it is helpful) 3) there are probably other weird
190 dd038bc6 2021-09-21 thomas.ad # implementations.
191 dd038bc6 2021-09-21 thomas.ad AC_LIBOBJ(getopt)
193 92a9e85d 2021-09-24 thomas # Check the platform we're compiling on.
194 92a9e85d 2021-09-24 thomas AC_MSG_CHECKING(platform)
195 92a9e85d 2021-09-24 thomas case "$host_os" in
197 92a9e85d 2021-09-24 thomas AC_MSG_RESULT(linux)
198 92a9e85d 2021-09-24 thomas PLATFORM=linux
200 92a9e85d 2021-09-24 thomas *freebsd*)
201 92a9e85d 2021-09-24 thomas AC_MSG_RESULT(freebsd)
202 92a9e85d 2021-09-24 thomas PLATFORM=freebsd
204 d24ddaa6 2022-02-26 thomas *darwin*)
205 d24ddaa6 2022-02-26 thomas AC_MSG_RESULT(darwin)
206 d24ddaa6 2022-02-26 thomas PLATFORM=darwin
208 a3732bb6 2022-02-26 thomas *netbsd*)
209 a3732bb6 2022-02-26 thomas AC_MSG_RESULT(netbsd)
210 a3732bb6 2022-02-26 thomas PLATFORM=netbsd
212 b26177ad 2022-03-03 thomas *dragonfly*)
213 b26177ad 2022-03-03 thomas AC_MSG_RESULT(dragonfly)
214 b26177ad 2022-03-03 thomas PLATFORM=dragonflybsd
217 92a9e85d 2021-09-24 thomas AC_MSG_RESULT(unknown)
218 92a9e85d 2021-09-24 thomas PLATFORM=unknown
221 92a9e85d 2021-09-24 thomas AC_SUBST(PLATFORM)
222 92a9e85d 2021-09-24 thomas AM_CONDITIONAL([HOST_FREEBSD], [test "$PLATFORM" = "freebsd"])
223 92a9e85d 2021-09-24 thomas AM_CONDITIONAL([HOST_LINUX], [test "$PLATFORM" = "linux"])
224 d24ddaa6 2022-02-26 thomas AM_CONDITIONAL([HOST_DARWIN], [test "$PLATFORM" = "darwin"])
225 a3732bb6 2022-02-26 thomas AM_CONDITIONAL([HOST_NETBSD], [test "$PLATFORM" = "netbsd"])
226 b26177ad 2022-03-03 thomas AM_CONDITIONAL([HOST_DRAGONFLYBSD], [test "$PLATFORM" = "dragonflybsd"])
228 51207398 2022-07-21 thomas if test x"$PLATFORM" = "xdarwin"; then
229 5baa5fe2 2022-09-05 thomas # Check for and/or set HOMEBREW_PREFIX. brew is a common way of
230 5baa5fe2 2022-09-05 thomas # installing applications. The other is MacPorts.
232 5baa5fe2 2022-09-05 thomas # Before Apple Silicon existed (M1 onward), the paths for applications
233 5baa5fe2 2022-09-05 thomas # installed via homebrew was typically /usr/local. However, with M1
234 5baa5fe2 2022-09-05 thomas # onward, this changed to a different path.
236 5baa5fe2 2022-09-05 thomas # Rather than hardcode this, check for HOMEBREW_PREFIX in the
237 5baa5fe2 2022-09-05 thomas # environment if it's already set, and use it. Otherwise, chec for
238 5baa5fe2 2022-09-05 thomas # brew(1) and use that. If that fails, default to /usr/local
240 5baa5fe2 2022-09-05 thomas # This also means that MacPorts should continue to work.
241 5baa5fe2 2022-09-05 thomas if test -z "$HOMEBREW_PREFIX"; then
242 5baa5fe2 2022-09-05 thomas # HOMEBREW_PREFIX not set, check for brew(1)
243 5baa5fe2 2022-09-05 thomas if test -x command -v brew >/dev/null 2>&1; then
244 5baa5fe2 2022-09-05 thomas export HOMEBREW_PREFIX="$(brew --prefix)"
246 5baa5fe2 2022-09-05 thomas # Default.
247 5baa5fe2 2022-09-05 thomas export HOMEBREW_PREFIX="/usr/local"
251 5baa5fe2 2022-09-05 thomas if ! test -x "${HOMEBREW_PREFIX}/opt/bison/bin/bison"; then
252 51207398 2022-07-21 thomas AC_MSG_ERROR("GNU Bison not found")
255 51207398 2022-07-21 thomas # Override YACC here to point to the GNU version of bison.
256 5baa5fe2 2022-09-05 thomas export YACC="${HOMEBREW_PREFIX}/opt/bison/bin/bison -y"
257 5baa5fe2 2022-09-05 thomas export LDFLAGS="-L${HOMEBREW_PREFIX}/opt/ncurses/lib -L${HOMEBREW_PREFI}/opt/openssl@3/lib $LDFLAGS"
258 5baa5fe2 2022-09-05 thomas export CPPFLAGS="-I${HOMEBREW_PREFIX}/opt/ncurses/include -I${HOMEBREW_PREFIX}/opt/openssl@3/include $CPPFLAGS"
259 5baa5fe2 2022-09-05 thomas export PKG_CONFIG_PATH="${HOMEBREW_PREFIX}/opt/ncurses/lib/pkgconfig"
260 5baa5fe2 2022-09-05 thomas export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:${HOMEBREW_PREFIX}/opt/openssl@3/lib/pkgconfig"
263 97799ccd 2022-02-06 thomas # Landlock detection.
264 97799ccd 2022-02-06 thomas AC_MSG_CHECKING([for landlock])
265 97799ccd 2022-02-06 thomas AM_CONDITIONAL([HAVE_LINUX_LANDLOCK],
266 97799ccd 2022-02-06 thomas [test "x$ac_cv_header_linux_landlock_h" = "xyes"])
267 97799ccd 2022-02-06 thomas if test "x$ac_cv_header_linux_landlock_h" = "xyes"; then
268 97799ccd 2022-02-06 thomas AC_MSG_RESULT(yes)
270 97799ccd 2022-02-06 thomas AC_MSG_RESULT(no)
273 dd038bc6 2021-09-21 thomas.ad # Clang sanitizers wrap reallocarray even if it isn't available on the target
274 dd038bc6 2021-09-21 thomas.ad # system. When compiled it always returns NULL and crashes the program. To
275 dd038bc6 2021-09-21 thomas.ad # detect this we need a more complicated test.
276 dd038bc6 2021-09-21 thomas.ad AC_MSG_CHECKING([for working reallocarray])
277 dd038bc6 2021-09-21 thomas.ad AC_RUN_IFELSE([AC_LANG_PROGRAM(
278 dd038bc6 2021-09-21 thomas.ad [#include <stdlib.h>],
279 dd038bc6 2021-09-21 thomas.ad [return (reallocarray(NULL, 1, 1) == NULL);]
281 dd038bc6 2021-09-21 thomas.ad AC_MSG_RESULT(yes),
282 7f20c2a8 2022-05-13 op [AC_LIBOBJ(reallocarray) AC_MSG_RESULT([no])],
283 dd038bc6 2021-09-21 thomas.ad [AC_LIBOBJ(reallocarray) AC_MSG_RESULT([no])]
285 dd038bc6 2021-09-21 thomas.ad AC_MSG_CHECKING([for working recallocarray])
286 dd038bc6 2021-09-21 thomas.ad AC_RUN_IFELSE([AC_LANG_PROGRAM(
287 dd038bc6 2021-09-21 thomas.ad [#include <stdlib.h>],
288 dd038bc6 2021-09-21 thomas.ad [return (recallocarray(NULL, 1, 1, 1) == NULL);]
290 dd038bc6 2021-09-21 thomas.ad AC_MSG_RESULT(yes),
291 7f20c2a8 2022-05-13 op [AC_LIBOBJ(recallocarray) AC_MSG_RESULT([no])],
292 dd038bc6 2021-09-21 thomas.ad [AC_LIBOBJ(recallocarray) AC_MSG_RESULT([no])]
295 dd038bc6 2021-09-21 thomas.ad # Look for imsg_init in libutil.
296 dd038bc6 2021-09-21 thomas.ad AC_SEARCH_LIBS(imsg_init, util, found_imsg_init=yes, found_imsg_init=no)
297 dd038bc6 2021-09-21 thomas.ad if test "x$found_imsg_init" = xyes; then
298 dd038bc6 2021-09-21 thomas.ad AC_DEFINE(HAVE_IMSG)
300 dd038bc6 2021-09-21 thomas.ad AC_LIBOBJ(imsg)
301 dd038bc6 2021-09-21 thomas.ad AC_LIBOBJ(imsg-buffer)
304 ff36aeea 2022-07-16 thomas # libevent (for gotwebd). Lifted from tmux.
305 ff36aeea 2022-07-16 thomas # Look for libevent. Try libevent_core or libevent with pkg-config first then
306 ff36aeea 2022-07-16 thomas # look for the library.
307 ff36aeea 2022-07-16 thomas PKG_CHECK_MODULES(
308 ff36aeea 2022-07-16 thomas LIBEVENT_CORE,
309 ff36aeea 2022-07-16 thomas [libevent_core >= 2],
311 ff36aeea 2022-07-16 thomas AM_CPPFLAGS="$LIBEVENT_CORE_CFLAGS $AM_CPPFLAGS"
312 ff36aeea 2022-07-16 thomas CPPFLAGS="$AM_CPPFLAGS $SAVED_CPPFLAGS"
313 ff36aeea 2022-07-16 thomas LIBS="$LIBEVENT_CORE_LIBS $LIBS"
314 ff36aeea 2022-07-16 thomas found_libevent=yes
316 ff36aeea 2022-07-16 thomas found_libevent=no
318 ff36aeea 2022-07-16 thomas if test x$found_libevent = xno; then
319 ff36aeea 2022-07-16 thomas PKG_CHECK_MODULES(
320 ff36aeea 2022-07-16 thomas LIBEVENT,
321 ff36aeea 2022-07-16 thomas [libevent >= 2],
323 ff36aeea 2022-07-16 thomas AM_CPPFLAGS="$LIBEVENT_CFLAGS $AM_CPPFLAGS"
324 ff36aeea 2022-07-16 thomas CPPFLAGS="$AM_CPPFLAGS $SAVED_CPPFLAGS"
325 ff36aeea 2022-07-16 thomas LIBS="$LIBEVENT_LIBS $LIBS"
326 ff36aeea 2022-07-16 thomas found_libevent=yes
328 ff36aeea 2022-07-16 thomas found_libevent=no
331 ff36aeea 2022-07-16 thomas if test x$found_libevent = xno; then
332 ff36aeea 2022-07-16 thomas AC_SEARCH_LIBS(
333 ff36aeea 2022-07-16 thomas event_init,
334 ff36aeea 2022-07-16 thomas [event_core event event-1.4],
335 ff36aeea 2022-07-16 thomas found_libevent=yes,
336 ff36aeea 2022-07-16 thomas found_libevent=no
339 ff36aeea 2022-07-16 thomas AC_CHECK_HEADER(
340 ff36aeea 2022-07-16 thomas event2/event.h,
341 ff36aeea 2022-07-16 thomas AC_DEFINE(HAVE_EVENT2_EVENT_H),
343 ff36aeea 2022-07-16 thomas AC_CHECK_HEADER(
345 ff36aeea 2022-07-16 thomas AC_DEFINE(HAVE_EVENT_H),
346 ff36aeea 2022-07-16 thomas found_libevent=no
350 ff36aeea 2022-07-16 thomas if test "x$found_libevent" = xno; then
351 ff36aeea 2022-07-16 thomas AC_MSG_ERROR("libevent not found")
354 dd038bc6 2021-09-21 thomas.ad # libcrypto (via libssl for SHA information)
355 dd038bc6 2021-09-21 thomas.ad PKG_CHECK_MODULES(
356 dd038bc6 2021-09-21 thomas.ad LIBCRYPTO,
357 dd038bc6 2021-09-21 thomas.ad libcrypto,
359 839511b2 2021-10-01 stsp AM_CFLAGS="$LIBCRYPTO_CFLAGS $AM_CFLAGS"
360 dd038bc6 2021-09-21 thomas.ad CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
361 dd038bc6 2021-09-21 thomas.ad LIBS="$LIBCRYPTO_LIBS $LIBS"
362 dd038bc6 2021-09-21 thomas.ad found_libcrypto=yes
365 92a9e85d 2021-09-24 thomas found_libcrypto=no
369 92a9e85d 2021-09-24 thomas if test "x$found_libcrypto" = "xyes"; then
370 92a9e85d 2021-09-24 thomas AC_DEFINE(HAVE_LIBCRYPTO)
373 dd038bc6 2021-09-21 thomas.ad AC_SEARCH_LIBS(uuid_create, , AC_DEFINE(HAVE_BSD_UUID))
374 326237a6 2021-09-25 thomas AC_SEARCH_LIBS(uuid_create, found_uuid=no, found_uuid=yes)
375 dd038bc6 2021-09-21 thomas.ad AC_SEARCH_LIBS(mergesort, , AC_DEFINE(HAVE_BSD_MERGESORT))
377 d24ddaa6 2022-02-26 thomas # Don't define HAVE_BSD_UUID on darwin (Apple) as this breaks the BSD API.
378 d24ddaa6 2022-02-26 thomas # Instead, use the UUID implementation wrapper that's in compat/ plus uuid
380 d24ddaa6 2022-02-26 thomas if test "x$found_uuid" = "xyes" -a "x$PLATFORM" != "darwin"; then
381 326237a6 2021-09-25 thomas AC_DEFINE(HAVE_BSD_UUID)
383 326237a6 2021-09-25 thomas PKG_CHECK_MODULES(
387 326237a6 2021-09-25 thomas AM_CFLAGS="$LIBUUID_CFLAGS $AM_CFLAGS"
388 326237a6 2021-09-25 thomas CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
389 326237a6 2021-09-25 thomas LIBS="$LIBUUID_LIBS $LIBS"
390 326237a6 2021-09-25 thomas found_libuuid=yes
393 326237a6 2021-09-25 thomas found_libuuid=no
397 326237a6 2021-09-25 thomas if test "x$found_libuuid" = "xno"; then
398 326237a6 2021-09-25 thomas AC_CHECK_HEADER(
400 326237a6 2021-09-25 thomas found_libuuid=yes,
401 326237a6 2021-09-25 thomas found_libuuid=no)
405 92a9e85d 2021-09-24 thomas if test "x$found_libuuid" = "xno"; then
406 92a9e85d 2021-09-24 thomas AC_MSG_ERROR("*** couldn't find uuid ***")
409 dd038bc6 2021-09-21 thomas.ad PKG_CHECK_MODULES(
413 dd038bc6 2021-09-21 thomas.ad AM_CFLAGS="$ZLIB_CFLAGS $AM_CFLAGS"
414 dd038bc6 2021-09-21 thomas.ad CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
415 dd038bc6 2021-09-21 thomas.ad LIBS="$ZLIB_LIBS $LIBS"
416 dd038bc6 2021-09-21 thomas.ad found_zlib=yes
419 92a9e85d 2021-09-24 thomas found_zlib=no
423 92a9e85d 2021-09-24 thomas if test "x$found_zlib" = "xno"; then
424 92a9e85d 2021-09-24 thomas AC_CHECK_HEADER(
427 92a9e85d 2021-09-24 thomas found_zlib=no)
430 92a9e85d 2021-09-24 thomas if test "x$found_zlib" = "xno"; then
431 92a9e85d 2021-09-24 thomas AC_MSG_ERROR("*** couldn't find zlib ***")
434 92a9e85d 2021-09-24 thomas if test "$PLATFORM" = "linux"; then
435 92a9e85d 2021-09-24 thomas PKG_CHECK_MODULES(
439 92a9e85d 2021-09-24 thomas AM_CFLAGS="$LIBMD_CFLAGS $AM_CFLAGS"
440 92a9e85d 2021-09-24 thomas CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
441 92a9e85d 2021-09-24 thomas LIBS="$LIBMD_LIBS $LIBS"
444 92a9e85d 2021-09-24 thomas AC_MSG_ERROR("*** couldn't find libmd via pkg-config")
447 92a9e85d 2021-09-24 thomas PKG_CHECK_MODULES(
449 92a9e85d 2021-09-24 thomas libbsd-overlay,
451 92a9e85d 2021-09-24 thomas AM_CFLAGS="$LIBBSD_CFLAGS $AM_CFLAGS"
452 92a9e85d 2021-09-24 thomas CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
453 92a9e85d 2021-09-24 thomas LIBS="$LIBBSD_LIBS $LIBS"
454 92a9e85d 2021-09-24 thomas found_libbsd=yes
455 92a9e85d 2021-09-24 thomas AC_DEFINE(HAVE_LIBBSD)
458 d5c5e467 2022-09-11 thomas AC_MSG_ERROR("*** couldn't find libbsd-overlay via pkg-config")
464 dd038bc6 2021-09-21 thomas.ad # Look for a suitable queue.h. We hope libbsd is enough, but that is missing
465 8dbd2d50 2022-08-12 thomas # some declarations.
466 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
467 dd038bc6 2021-09-21 thomas.ad TAILQ_CONCAT,
468 dd038bc6 2021-09-21 thomas.ad found_queue_h=yes,
469 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
470 8dbd2d50 2022-08-12 thomas [#include <sys/queue.h>]
472 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
473 dd038bc6 2021-09-21 thomas.ad TAILQ_PREV,
475 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
476 8dbd2d50 2022-08-12 thomas [#include <sys/queue.h>]
478 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
479 dd038bc6 2021-09-21 thomas.ad TAILQ_FOREACH_SAFE,
481 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
482 8dbd2d50 2022-08-12 thomas [#include <sys/queue.h>]
485 8dbd2d50 2022-08-12 thomas if test "x$found_queue_h" = xyes; then
486 dd038bc6 2021-09-21 thomas.ad AC_DEFINE(HAVE_QUEUE_H)
488 d5c5e467 2022-09-11 thomas AC_MSG_ERROR("*** sys/queue.h missing key defines ***)
492 dd038bc6 2021-09-21 thomas.ad # Look for __progname.
493 dd038bc6 2021-09-21 thomas.ad AC_MSG_CHECKING(for __progname)
494 dd038bc6 2021-09-21 thomas.ad AC_LINK_IFELSE([AC_LANG_SOURCE(
496 dd038bc6 2021-09-21 thomas.ad #include <stdio.h>
497 dd038bc6 2021-09-21 thomas.ad #include <stdlib.h>
498 dd038bc6 2021-09-21 thomas.ad extern char *__progname;
499 dd038bc6 2021-09-21 thomas.ad int main(void) {
500 dd038bc6 2021-09-21 thomas.ad const char *cp = __progname;
501 dd038bc6 2021-09-21 thomas.ad printf("%s\n", cp);
502 dd038bc6 2021-09-21 thomas.ad exit(0);
505 dd038bc6 2021-09-21 thomas.ad [AC_DEFINE(HAVE___PROGNAME) AC_MSG_RESULT(yes)],
506 dd038bc6 2021-09-21 thomas.ad AC_MSG_RESULT(no)
509 d9e4d43f 2022-03-03 thomas PKG_CHECK_MODULES(
510 d9e4d43f 2022-03-03 thomas LIBPANELW,
512 d9e4d43f 2022-03-03 thomas found_panel=yes,
513 d9e4d43f 2022-03-03 thomas found_panel=no
516 d9e4d43f 2022-03-03 thomas PKG_CHECK_MODULES(
517 d9e4d43f 2022-03-03 thomas LIBPANELW,
518 d9e4d43f 2022-03-03 thomas gnupanelw,
519 d9e4d43f 2022-03-03 thomas found_panel=yes,
520 d9e4d43f 2022-03-03 thomas found_panel=no
523 b26177ad 2022-03-03 thomas PKG_CHECK_MODULES(
524 b26177ad 2022-03-03 thomas LIBPANELW,
526 b26177ad 2022-03-03 thomas found_panel=yes,
527 b26177ad 2022-03-03 thomas found_panel=no
529 d9e4d43f 2022-03-03 thomas if test "x$found_panel" = "xno"; then
530 92a9e85d 2021-09-24 thomas AC_CHECK_LIB(panelw, update_panels,,
531 92a9e85d 2021-09-24 thomas AC_MSG_ERROR([ "*** panelw not found for ncurses. ***"])
534 92a9e85d 2021-09-24 thomas LIBPANELW_LIBS="-lpanelw"
537 acf52a76 2021-09-21 thomas.ad PKG_CHECK_MODULES(
538 acf52a76 2021-09-21 thomas.ad LIBNCURSES,
539 acf52a76 2021-09-21 thomas.ad ncursesw,
540 dd038bc6 2021-09-21 thomas.ad found_ncurses=yes,
541 dd038bc6 2021-09-21 thomas.ad found_ncurses=no
543 acf52a76 2021-09-21 thomas.ad if test "x$found_ncurses" = xyes; then
544 acf52a76 2021-09-21 thomas.ad AM_CFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $LIBPANELW_CFLAGS $AM_CFLAGS"
545 acf52a76 2021-09-21 thomas.ad CFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $LIBPANELW_CFLAGS $CFLAGS"
546 acf52a76 2021-09-21 thomas.ad LIBS="$LIBNCURSES_LIBS $LIBTINFO_LIBS $LIBPANELW_LIBS $LIBS"
548 dd038bc6 2021-09-21 thomas.ad AC_CHECK_LIB(
549 acf52a76 2021-09-21 thomas.ad ncursesw,
550 dd038bc6 2021-09-21 thomas.ad setupterm,
551 dd038bc6 2021-09-21 thomas.ad found_ncurses=yes,
552 dd038bc6 2021-09-21 thomas.ad found_ncurses=no
554 dd038bc6 2021-09-21 thomas.ad if test "x$found_ncurses" = xyes; then
555 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADER(
556 dd038bc6 2021-09-21 thomas.ad ncurses.h,
557 acf52a76 2021-09-21 thomas.ad AM_CFLAGS="$LIBPANELW_CFLAGS $AM_CFLAGS"
558 acf52a76 2021-09-21 thomas.ad CFLAGS="$LIBPANEL_CFLAGS $CFLAGS"
559 acf52a76 2021-09-21 thomas.ad LIBS="$LIBS -lncursesw $LIBPANELW_LIBS",
560 acf52a76 2021-09-21 thomas.ad found_ncurses=no
564 dd038bc6 2021-09-21 thomas.ad if test "x$found_ncurses" = xyes; then
565 dd038bc6 2021-09-21 thomas.ad AC_DEFINE(HAVE_NCURSES_H)
567 dd038bc6 2021-09-21 thomas.ad # No ncurses, try curses.
568 dd038bc6 2021-09-21 thomas.ad AC_CHECK_LIB(
569 acf52a76 2021-09-21 thomas.ad cursesw,
570 dd038bc6 2021-09-21 thomas.ad setupterm,
571 dd038bc6 2021-09-21 thomas.ad found_curses=yes,
572 dd038bc6 2021-09-21 thomas.ad found_curses=no
574 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADER(
575 dd038bc6 2021-09-21 thomas.ad curses.h,
577 dd038bc6 2021-09-21 thomas.ad found_curses=no)
578 dd038bc6 2021-09-21 thomas.ad if test "x$found_curses" = xyes; then
579 acf52a76 2021-09-21 thomas.ad AM_CFLAGS="$LIBPANELW_CFLAGS $AM_CFLAGS"
580 acf52a76 2021-09-21 thomas.ad CFLAGS="$LIBPANEL_CFLAGS $CFLAGS"
581 acf52a76 2021-09-21 thomas.ad LIBS="$LIBS -lcursesw $LIBPANELW_LIBS"
582 dd038bc6 2021-09-21 thomas.ad AC_DEFINE(HAVE_CURSES_H)
584 dd038bc6 2021-09-21 thomas.ad AC_MSG_ERROR("curses not found")
588 dd038bc6 2021-09-21 thomas.ad # Save our CFLAGS/CPPFLAGS/LDFLAGS for the Makefile and restore the old user
589 dd038bc6 2021-09-21 thomas.ad # variables.
590 dd038bc6 2021-09-21 thomas.ad AC_SUBST(AM_CPPFLAGS)
591 dd038bc6 2021-09-21 thomas.ad CPPFLAGS="$SAVED_CPPFLAGS"
592 dd038bc6 2021-09-21 thomas.ad AC_SUBST(AM_CFLAGS)
593 dd038bc6 2021-09-21 thomas.ad CFLAGS="$SAVED_CFLAGS"
594 dd038bc6 2021-09-21 thomas.ad AC_SUBST(AM_LDFLAGS)
595 dd038bc6 2021-09-21 thomas.ad LDFLAGS="$SAVED_LDFLAGS"
597 dd038bc6 2021-09-21 thomas.ad AC_CONFIG_FILES([Makefile
598 dd038bc6 2021-09-21 thomas.ad compat/Makefile
599 dd038bc6 2021-09-21 thomas.ad libexec/Makefile
600 dd038bc6 2021-09-21 thomas.ad libexec/got-read-tree/Makefile
601 dd038bc6 2021-09-21 thomas.ad libexec/got-fetch-pack/Makefile
602 dd038bc6 2021-09-21 thomas.ad libexec/got-index-pack/Makefile
603 dd038bc6 2021-09-21 thomas.ad libexec/got-read-blob/Makefile
604 dd038bc6 2021-09-21 thomas.ad libexec/got-read-commit/Makefile
605 dd038bc6 2021-09-21 thomas.ad libexec/got-read-gitconfig/Makefile
606 dd038bc6 2021-09-21 thomas.ad libexec/got-read-gotconfig/Makefile
607 dd038bc6 2021-09-21 thomas.ad libexec/got-read-object/Makefile
608 dd038bc6 2021-09-21 thomas.ad libexec/got-read-pack/Makefile
609 973f3f6e 2022-03-07 thomas libexec/got-read-patch/Makefile
610 dd038bc6 2021-09-21 thomas.ad libexec/got-read-tag/Makefile
611 dd038bc6 2021-09-21 thomas.ad libexec/got-send-pack/Makefile
612 dd038bc6 2021-09-21 thomas.ad got/Makefile
613 2b0eee35 2021-09-21 thomas.ad gotadmin/Makefile
614 ff36aeea 2022-07-16 thomas gotwebd/Makefile
615 d3f2ad5e 2021-09-21 thomas.ad tog/Makefile
616 5a7ef102 2021-10-09 thomas Makefile.common:Makefile.common.in])
617 dd038bc6 2021-09-21 thomas.ad AC_OUTPUT
619 9ffe20fd 2022-09-10 thomas executables="$(eval echo ${exec_prefix}/bin)"
620 9ffe20fd 2022-09-10 thomas helpers="$(eval echo ${libexecdir})"
621 9ffe20fd 2022-09-10 thomas manpages="$(eval echo ${mandir})"
624 9ffe20fd 2022-09-10 thomas Configured got-portable with:
626 9ffe20fd 2022-09-10 thomas Version: $VERSION
628 9ffe20fd 2022-09-10 thomas Prefix: ${prefix}
629 9ffe20fd 2022-09-10 thomas Executables: ${executables}
630 9ffe20fd 2022-09-10 thomas Helpers: ${helpers}
631 9ffe20fd 2022-09-10 thomas Man pages: ${manpages}