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 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])
11 dd038bc6 2021-09-21 thomas.ad GOT_RELEASE=No
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)
17 dd038bc6 2021-09-21 thomas.ad AC_CANONICAL_HOST
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=""}
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"
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
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 \
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 \
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
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])
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)
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([ \
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 \
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])
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])
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 \
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)
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
170 92a9e85d 2021-09-24 thomas AC_MSG_RESULT(linux)
171 92a9e85d 2021-09-24 thomas PLATFORM=linux
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
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
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
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
190 92a9e85d 2021-09-24 thomas AC_MSG_RESULT(unknown)
191 92a9e85d 2021-09-24 thomas PLATFORM=unknown
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"])
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")
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"
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)
221 97799ccd 2022-02-06 thomas AC_MSG_RESULT(no)
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);]
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])]
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);]
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])]
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)
251 dd038bc6 2021-09-21 thomas.ad AC_LIBOBJ(imsg)
252 dd038bc6 2021-09-21 thomas.ad AC_LIBOBJ(imsg-buffer)
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],
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
267 ff36aeea 2022-07-16 thomas found_libevent=no
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],
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
279 ff36aeea 2022-07-16 thomas found_libevent=no
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
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),
294 ff36aeea 2022-07-16 thomas AC_CHECK_HEADER(
296 ff36aeea 2022-07-16 thomas AC_DEFINE(HAVE_EVENT_H),
297 ff36aeea 2022-07-16 thomas found_libevent=no
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")
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,
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
316 92a9e85d 2021-09-24 thomas found_libcrypto=no
320 92a9e85d 2021-09-24 thomas if test "x$found_libcrypto" = "xyes"; then
321 92a9e85d 2021-09-24 thomas AC_DEFINE(HAVE_LIBCRYPTO)
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))
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
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)
334 326237a6 2021-09-25 thomas PKG_CHECK_MODULES(
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
344 326237a6 2021-09-25 thomas found_libuuid=no
348 326237a6 2021-09-25 thomas if test "x$found_libuuid" = "xno"; then
349 326237a6 2021-09-25 thomas AC_CHECK_HEADER(
351 326237a6 2021-09-25 thomas found_libuuid=yes,
352 326237a6 2021-09-25 thomas found_libuuid=no)
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 ***")
360 dd038bc6 2021-09-21 thomas.ad PKG_CHECK_MODULES(
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
370 92a9e85d 2021-09-24 thomas found_zlib=no
374 92a9e85d 2021-09-24 thomas if test "x$found_zlib" = "xno"; then
375 92a9e85d 2021-09-24 thomas AC_CHECK_HEADER(
378 92a9e85d 2021-09-24 thomas found_zlib=no)
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 ***")
385 92a9e85d 2021-09-24 thomas if test "$PLATFORM" = "linux"; then
386 92a9e85d 2021-09-24 thomas PKG_CHECK_MODULES(
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"
395 92a9e85d 2021-09-24 thomas AC_MSG_ERROR("*** couldn't find libmd via pkg-config")
398 92a9e85d 2021-09-24 thomas PKG_CHECK_MODULES(
400 92a9e85d 2021-09-24 thomas libbsd-overlay,
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)
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,
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,
424 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
425 dd038bc6 2021-09-21 thomas.ad TAILQ_PREV,
427 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
429 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
430 dd038bc6 2021-09-21 thomas.ad TAILQ_REPLACE,
432 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
434 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
435 dd038bc6 2021-09-21 thomas.ad SIMPLEQ_ENTRY,
437 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
439 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
440 dd038bc6 2021-09-21 thomas.ad TAILQ_FOREACH_SAFE,
442 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
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)
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(
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);
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)
466 d9e4d43f 2022-03-03 thomas PKG_CHECK_MODULES(
467 d9e4d43f 2022-03-03 thomas LIBPANELW,
469 d9e4d43f 2022-03-03 thomas found_panel=yes,
470 d9e4d43f 2022-03-03 thomas found_panel=no
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
480 b26177ad 2022-03-03 thomas PKG_CHECK_MODULES(
481 b26177ad 2022-03-03 thomas LIBPANELW,
483 b26177ad 2022-03-03 thomas found_panel=yes,
484 b26177ad 2022-03-03 thomas found_panel=no
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. ***"])
491 92a9e85d 2021-09-24 thomas LIBPANELW_LIBS="-lpanelw"
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
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"
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
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
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)
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
531 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADER(
532 dd038bc6 2021-09-21 thomas.ad curses.h,
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)
541 dd038bc6 2021-09-21 thomas.ad AC_MSG_ERROR("curses not found")
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"
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
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