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 9930e719 2022-07-04 thomas AC_INIT([got-portable], [0.74], [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])
9 dd038bc6 2021-09-21 thomas.ad GOT_RELEASE=No
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 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 dd038bc6 2021-09-21 thomas.ad util.h \
62 dd038bc6 2021-09-21 thomas.ad unistd.h \
63 dd038bc6 2021-09-21 thomas.ad wchar.h \
66 dd038bc6 2021-09-21 thomas.ad # Checks for typ edefs, structures, and compiler characteristics.
67 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADER_STDBOOL
68 dd038bc6 2021-09-21 thomas.ad AC_C_INLINE
69 dd038bc6 2021-09-21 thomas.ad AC_TYPE_INT64_T
70 dd038bc6 2021-09-21 thomas.ad AC_TYPE_MODE_T
71 dd038bc6 2021-09-21 thomas.ad AC_TYPE_OFF_T
72 dd038bc6 2021-09-21 thomas.ad AC_TYPE_PID_T
73 dd038bc6 2021-09-21 thomas.ad AC_TYPE_SIZE_T
74 dd038bc6 2021-09-21 thomas.ad AC_TYPE_SSIZE_T
75 dd038bc6 2021-09-21 thomas.ad AC_TYPE_UINT16_T
76 dd038bc6 2021-09-21 thomas.ad AC_TYPE_UINT32_T
77 dd038bc6 2021-09-21 thomas.ad AC_TYPE_UINT64_T
78 dd038bc6 2021-09-21 thomas.ad AC_TYPE_UINT8_T
80 dd038bc6 2021-09-21 thomas.ad # Look for library needed for flock.
81 dd038bc6 2021-09-21 thomas.ad AC_SEARCH_LIBS(flock, bsd)
83 dd038bc6 2021-09-21 thomas.ad # Checks for library functions.
84 dd038bc6 2021-09-21 thomas.ad AC_FUNC_FORK
85 dd038bc6 2021-09-21 thomas.ad AC_FUNC_FSEEKO
86 dd038bc6 2021-09-21 thomas.ad AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
87 dd038bc6 2021-09-21 thomas.ad AC_FUNC_MALLOC
88 dd038bc6 2021-09-21 thomas.ad AC_FUNC_MMAP
89 dd038bc6 2021-09-21 thomas.ad AC_FUNC_REALLOC
90 dd038bc6 2021-09-21 thomas.ad AC_FUNC_STRERROR_R
91 dd038bc6 2021-09-21 thomas.ad AC_FUNC_STRNLEN
92 dd038bc6 2021-09-21 thomas.ad AC_CHECK_FUNCS([ \
94 dd038bc6 2021-09-21 thomas.ad flock \
95 dd038bc6 2021-09-21 thomas.ad getcwd \
96 dd038bc6 2021-09-21 thomas.ad localtime_r \
97 dd038bc6 2021-09-21 thomas.ad memchr \
98 dd038bc6 2021-09-21 thomas.ad memmove \
99 dd038bc6 2021-09-21 thomas.ad memset \
100 dd038bc6 2021-09-21 thomas.ad mkdir \
101 dd038bc6 2021-09-21 thomas.ad munmap \
102 dd038bc6 2021-09-21 thomas.ad nl_langinfo \
103 dd038bc6 2021-09-21 thomas.ad realpath \
104 dd038bc6 2021-09-21 thomas.ad regcomp \
105 dd038bc6 2021-09-21 thomas.ad rmdir \
106 dd038bc6 2021-09-21 thomas.ad setlocale \
107 dd038bc6 2021-09-21 thomas.ad socket \
108 dd038bc6 2021-09-21 thomas.ad strcasecmp \
109 dd038bc6 2021-09-21 thomas.ad strchr \
110 dd038bc6 2021-09-21 thomas.ad strcspn \
111 dd038bc6 2021-09-21 thomas.ad strdup \
112 dd038bc6 2021-09-21 thomas.ad strerror \
113 dd038bc6 2021-09-21 thomas.ad strlcpy \
114 dd038bc6 2021-09-21 thomas.ad strncasecmp \
115 dd038bc6 2021-09-21 thomas.ad strndup \
116 dd038bc6 2021-09-21 thomas.ad strrchr \
117 dd038bc6 2021-09-21 thomas.ad strspn \
118 dd038bc6 2021-09-21 thomas.ad strstr \
119 dd038bc6 2021-09-21 thomas.ad strtol \
120 dd038bc6 2021-09-21 thomas.ad strtoul \
121 dd038bc6 2021-09-21 thomas.ad wcwidth \
124 ddd12270 2022-04-22 thomas # Siphash support.
125 ddd12270 2022-04-22 thomas AC_CHECK_FUNCS([SipHash])
126 ddd12270 2022-04-22 thomas AM_CONDITIONAL([HAVE_SIPHASH], [test "x$ac_cv_func_SipHash" = xyes])
128 dd038bc6 2021-09-21 thomas.ad # Check for functions with a compatibility implementation.
129 dd038bc6 2021-09-21 thomas.ad AC_REPLACE_FUNCS([ \
130 dd038bc6 2021-09-21 thomas.ad asprintf \
131 dd038bc6 2021-09-21 thomas.ad closefrom \
132 dd038bc6 2021-09-21 thomas.ad explicit_bzero \
133 dd038bc6 2021-09-21 thomas.ad fmt_scaled \
134 dd038bc6 2021-09-21 thomas.ad freezero \
135 dd038bc6 2021-09-21 thomas.ad getdtablecount \
136 dd038bc6 2021-09-21 thomas.ad getline \
137 dd038bc6 2021-09-21 thomas.ad getprogname \
138 dd038bc6 2021-09-21 thomas.ad recallocarray \
139 dd038bc6 2021-09-21 thomas.ad reallocarray \
140 dd038bc6 2021-09-21 thomas.ad strlcat \
141 dd038bc6 2021-09-21 thomas.ad strlcpy \
142 dd038bc6 2021-09-21 thomas.ad strndup \
143 dd038bc6 2021-09-21 thomas.ad strsep \
144 dd038bc6 2021-09-21 thomas.ad strtonum \
147 dd038bc6 2021-09-21 thomas.ad # Always use our getopt because 1) glibc's doesn't enforce argument order 2)
148 dd038bc6 2021-09-21 thomas.ad # musl does not set optarg to NULL for flags without arguments (although it is
149 dd038bc6 2021-09-21 thomas.ad # not required to, but it is helpful) 3) there are probably other weird
150 dd038bc6 2021-09-21 thomas.ad # implementations.
151 dd038bc6 2021-09-21 thomas.ad AC_LIBOBJ(getopt)
153 92a9e85d 2021-09-24 thomas # Check the platform we're compiling on.
154 92a9e85d 2021-09-24 thomas AC_MSG_CHECKING(platform)
155 92a9e85d 2021-09-24 thomas case "$host_os" in
157 92a9e85d 2021-09-24 thomas AC_MSG_RESULT(linux)
158 92a9e85d 2021-09-24 thomas PLATFORM=linux
160 92a9e85d 2021-09-24 thomas *freebsd*)
161 92a9e85d 2021-09-24 thomas AC_MSG_RESULT(freebsd)
162 92a9e85d 2021-09-24 thomas PLATFORM=freebsd
164 d24ddaa6 2022-02-26 thomas *darwin*)
165 d24ddaa6 2022-02-26 thomas AC_MSG_RESULT(darwin)
166 d24ddaa6 2022-02-26 thomas PLATFORM=darwin
168 a3732bb6 2022-02-26 thomas *netbsd*)
169 a3732bb6 2022-02-26 thomas AC_MSG_RESULT(netbsd)
170 a3732bb6 2022-02-26 thomas PLATFORM=netbsd
172 b26177ad 2022-03-03 thomas *dragonfly*)
173 b26177ad 2022-03-03 thomas AC_MSG_RESULT(dragonfly)
174 b26177ad 2022-03-03 thomas PLATFORM=dragonflybsd
177 92a9e85d 2021-09-24 thomas AC_MSG_RESULT(unknown)
178 92a9e85d 2021-09-24 thomas PLATFORM=unknown
181 92a9e85d 2021-09-24 thomas AC_SUBST(PLATFORM)
182 92a9e85d 2021-09-24 thomas AM_CONDITIONAL([HOST_FREEBSD], [test "$PLATFORM" = "freebsd"])
183 92a9e85d 2021-09-24 thomas AM_CONDITIONAL([HOST_LINUX], [test "$PLATFORM" = "linux"])
184 d24ddaa6 2022-02-26 thomas AM_CONDITIONAL([HOST_DARWIN], [test "$PLATFORM" = "darwin"])
185 a3732bb6 2022-02-26 thomas AM_CONDITIONAL([HOST_NETBSD], [test "$PLATFORM" = "netbsd"])
186 b26177ad 2022-03-03 thomas AM_CONDITIONAL([HOST_DRAGONFLYBSD], [test "$PLATFORM" = "dragonflybsd"])
188 97799ccd 2022-02-06 thomas # Landlock detection.
189 97799ccd 2022-02-06 thomas AC_MSG_CHECKING([for landlock])
190 97799ccd 2022-02-06 thomas AM_CONDITIONAL([HAVE_LINUX_LANDLOCK],
191 97799ccd 2022-02-06 thomas [test "x$ac_cv_header_linux_landlock_h" = "xyes"])
192 97799ccd 2022-02-06 thomas if test "x$ac_cv_header_linux_landlock_h" = "xyes"; then
193 97799ccd 2022-02-06 thomas AC_MSG_RESULT(yes)
195 97799ccd 2022-02-06 thomas AC_MSG_RESULT(no)
198 dd038bc6 2021-09-21 thomas.ad # Clang sanitizers wrap reallocarray even if it isn't available on the target
199 dd038bc6 2021-09-21 thomas.ad # system. When compiled it always returns NULL and crashes the program. To
200 dd038bc6 2021-09-21 thomas.ad # detect this we need a more complicated test.
201 dd038bc6 2021-09-21 thomas.ad AC_MSG_CHECKING([for working reallocarray])
202 dd038bc6 2021-09-21 thomas.ad AC_RUN_IFELSE([AC_LANG_PROGRAM(
203 dd038bc6 2021-09-21 thomas.ad [#include <stdlib.h>],
204 dd038bc6 2021-09-21 thomas.ad [return (reallocarray(NULL, 1, 1) == NULL);]
206 dd038bc6 2021-09-21 thomas.ad AC_MSG_RESULT(yes),
207 7f20c2a8 2022-05-13 op [AC_LIBOBJ(reallocarray) AC_MSG_RESULT([no])],
208 dd038bc6 2021-09-21 thomas.ad [AC_LIBOBJ(reallocarray) AC_MSG_RESULT([no])]
210 dd038bc6 2021-09-21 thomas.ad AC_MSG_CHECKING([for working recallocarray])
211 dd038bc6 2021-09-21 thomas.ad AC_RUN_IFELSE([AC_LANG_PROGRAM(
212 dd038bc6 2021-09-21 thomas.ad [#include <stdlib.h>],
213 dd038bc6 2021-09-21 thomas.ad [return (recallocarray(NULL, 1, 1, 1) == NULL);]
215 dd038bc6 2021-09-21 thomas.ad AC_MSG_RESULT(yes),
216 7f20c2a8 2022-05-13 op [AC_LIBOBJ(recallocarray) AC_MSG_RESULT([no])],
217 dd038bc6 2021-09-21 thomas.ad [AC_LIBOBJ(recallocarray) AC_MSG_RESULT([no])]
220 dd038bc6 2021-09-21 thomas.ad # Look for imsg_init in libutil.
221 dd038bc6 2021-09-21 thomas.ad AC_SEARCH_LIBS(imsg_init, util, found_imsg_init=yes, found_imsg_init=no)
222 dd038bc6 2021-09-21 thomas.ad if test "x$found_imsg_init" = xyes; then
223 dd038bc6 2021-09-21 thomas.ad AC_DEFINE(HAVE_IMSG)
225 dd038bc6 2021-09-21 thomas.ad AC_LIBOBJ(imsg)
226 dd038bc6 2021-09-21 thomas.ad AC_LIBOBJ(imsg-buffer)
229 dd038bc6 2021-09-21 thomas.ad # libcrypto (via libssl for SHA information)
230 dd038bc6 2021-09-21 thomas.ad PKG_CHECK_MODULES(
231 dd038bc6 2021-09-21 thomas.ad LIBCRYPTO,
232 dd038bc6 2021-09-21 thomas.ad libcrypto,
234 839511b2 2021-10-01 stsp AM_CFLAGS="$LIBCRYPTO_CFLAGS $AM_CFLAGS"
235 dd038bc6 2021-09-21 thomas.ad CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
236 dd038bc6 2021-09-21 thomas.ad LIBS="$LIBCRYPTO_LIBS $LIBS"
237 dd038bc6 2021-09-21 thomas.ad found_libcrypto=yes
240 92a9e85d 2021-09-24 thomas found_libcrypto=no
244 92a9e85d 2021-09-24 thomas if test "x$found_libcrypto" = "xyes"; then
245 92a9e85d 2021-09-24 thomas AC_DEFINE(HAVE_LIBCRYPTO)
248 dd038bc6 2021-09-21 thomas.ad AC_SEARCH_LIBS(uuid_create, , AC_DEFINE(HAVE_BSD_UUID))
249 326237a6 2021-09-25 thomas AC_SEARCH_LIBS(uuid_create, found_uuid=no, found_uuid=yes)
250 dd038bc6 2021-09-21 thomas.ad AC_SEARCH_LIBS(mergesort, , AC_DEFINE(HAVE_BSD_MERGESORT))
252 d24ddaa6 2022-02-26 thomas # Don't define HAVE_BSD_UUID on darwin (Apple) as this breaks the BSD API.
253 d24ddaa6 2022-02-26 thomas # Instead, use the UUID implementation wrapper that's in compat/ plus uuid
255 d24ddaa6 2022-02-26 thomas if test "x$found_uuid" = "xyes" -a "x$PLATFORM" != "darwin"; then
256 326237a6 2021-09-25 thomas AC_DEFINE(HAVE_BSD_UUID)
258 326237a6 2021-09-25 thomas PKG_CHECK_MODULES(
262 326237a6 2021-09-25 thomas AM_CFLAGS="$LIBUUID_CFLAGS $AM_CFLAGS"
263 326237a6 2021-09-25 thomas CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
264 326237a6 2021-09-25 thomas LIBS="$LIBUUID_LIBS $LIBS"
265 326237a6 2021-09-25 thomas found_libuuid=yes
268 326237a6 2021-09-25 thomas found_libuuid=no
272 326237a6 2021-09-25 thomas if test "x$found_libuuid" = "xno"; then
273 326237a6 2021-09-25 thomas AC_CHECK_HEADER(
275 326237a6 2021-09-25 thomas found_libuuid=yes,
276 326237a6 2021-09-25 thomas found_libuuid=no)
280 92a9e85d 2021-09-24 thomas if test "x$found_libuuid" = "xno"; then
281 92a9e85d 2021-09-24 thomas AC_MSG_ERROR("*** couldn't find uuid ***")
284 dd038bc6 2021-09-21 thomas.ad PKG_CHECK_MODULES(
288 dd038bc6 2021-09-21 thomas.ad AM_CFLAGS="$ZLIB_CFLAGS $AM_CFLAGS"
289 dd038bc6 2021-09-21 thomas.ad CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
290 dd038bc6 2021-09-21 thomas.ad LIBS="$ZLIB_LIBS $LIBS"
291 dd038bc6 2021-09-21 thomas.ad found_zlib=yes
294 92a9e85d 2021-09-24 thomas found_zlib=no
298 92a9e85d 2021-09-24 thomas if test "x$found_zlib" = "xno"; then
299 92a9e85d 2021-09-24 thomas AC_CHECK_HEADER(
302 92a9e85d 2021-09-24 thomas found_zlib=no)
305 92a9e85d 2021-09-24 thomas if test "x$found_zlib" = "xno"; then
306 92a9e85d 2021-09-24 thomas AC_MSG_ERROR("*** couldn't find zlib ***")
309 92a9e85d 2021-09-24 thomas if test "$PLATFORM" = "linux"; then
310 92a9e85d 2021-09-24 thomas PKG_CHECK_MODULES(
314 92a9e85d 2021-09-24 thomas AM_CFLAGS="$LIBMD_CFLAGS $AM_CFLAGS"
315 92a9e85d 2021-09-24 thomas CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
316 92a9e85d 2021-09-24 thomas LIBS="$LIBMD_LIBS $LIBS"
319 92a9e85d 2021-09-24 thomas AC_MSG_ERROR("*** couldn't find libmd via pkg-config")
322 92a9e85d 2021-09-24 thomas PKG_CHECK_MODULES(
324 92a9e85d 2021-09-24 thomas libbsd-overlay,
326 92a9e85d 2021-09-24 thomas AM_CFLAGS="$LIBBSD_CFLAGS $AM_CFLAGS"
327 92a9e85d 2021-09-24 thomas CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
328 92a9e85d 2021-09-24 thomas LIBS="$LIBBSD_LIBS $LIBS"
329 92a9e85d 2021-09-24 thomas found_libbsd=yes
330 92a9e85d 2021-09-24 thomas AC_DEFINE(HAVE_LIBBSD)
336 dd038bc6 2021-09-21 thomas.ad # Look for a suitable queue.h. We hope libbsd is enough, but that is missing
337 dd038bc6 2021-09-21 thomas.ad # SIMPLEQ.
338 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
339 dd038bc6 2021-09-21 thomas.ad SIMPLEQ_INIT,
340 dd038bc6 2021-09-21 thomas.ad found_queue_h=yes,
341 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
342 dd038bc6 2021-09-21 thomas.ad [#include <sys/queue.h>]
344 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
345 dd038bc6 2021-09-21 thomas.ad TAILQ_CONCAT,
346 dd038bc6 2021-09-21 thomas.ad found_queue_h=yes,
347 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
348 dd038bc6 2021-09-21 thomas.ad [#include <sys/queue.h>]
350 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
351 dd038bc6 2021-09-21 thomas.ad TAILQ_PREV,
352 dd038bc6 2021-09-21 thomas.ad found_queue_h=yes,
353 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
354 dd038bc6 2021-09-21 thomas.ad [#include <sys/queue.h>]
356 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
357 dd038bc6 2021-09-21 thomas.ad TAILQ_REPLACE,
358 dd038bc6 2021-09-21 thomas.ad found_queue_h=yes,
359 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
360 dd038bc6 2021-09-21 thomas.ad [#include <sys/queue.h>]
362 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
363 dd038bc6 2021-09-21 thomas.ad SIMPLEQ_ENTRY,
365 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
366 dd038bc6 2021-09-21 thomas.ad [#include <sys/queue.h>]
368 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
369 dd038bc6 2021-09-21 thomas.ad TAILQ_FOREACH_SAFE,
371 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
372 dd038bc6 2021-09-21 thomas.ad [#include <sys/queue.h>]
374 dd038bc6 2021-09-21 thomas.ad if test "x$found_queue_h" = xyes; then
375 dd038bc6 2021-09-21 thomas.ad AC_DEFINE(HAVE_QUEUE_H)
378 dd038bc6 2021-09-21 thomas.ad # Look for __progname.
379 dd038bc6 2021-09-21 thomas.ad AC_MSG_CHECKING(for __progname)
380 dd038bc6 2021-09-21 thomas.ad AC_LINK_IFELSE([AC_LANG_SOURCE(
382 dd038bc6 2021-09-21 thomas.ad #include <stdio.h>
383 dd038bc6 2021-09-21 thomas.ad #include <stdlib.h>
384 dd038bc6 2021-09-21 thomas.ad extern char *__progname;
385 dd038bc6 2021-09-21 thomas.ad int main(void) {
386 dd038bc6 2021-09-21 thomas.ad const char *cp = __progname;
387 dd038bc6 2021-09-21 thomas.ad printf("%s\n", cp);
388 dd038bc6 2021-09-21 thomas.ad exit(0);
391 dd038bc6 2021-09-21 thomas.ad [AC_DEFINE(HAVE___PROGNAME) AC_MSG_RESULT(yes)],
392 dd038bc6 2021-09-21 thomas.ad AC_MSG_RESULT(no)
395 d9e4d43f 2022-03-03 thomas PKG_CHECK_MODULES(
396 d9e4d43f 2022-03-03 thomas LIBPANELW,
398 d9e4d43f 2022-03-03 thomas found_panel=yes,
399 d9e4d43f 2022-03-03 thomas found_panel=no
402 d9e4d43f 2022-03-03 thomas PKG_CHECK_MODULES(
403 d9e4d43f 2022-03-03 thomas LIBPANELW,
404 d9e4d43f 2022-03-03 thomas gnupanelw,
405 d9e4d43f 2022-03-03 thomas found_panel=yes,
406 d9e4d43f 2022-03-03 thomas found_panel=no
409 b26177ad 2022-03-03 thomas PKG_CHECK_MODULES(
410 b26177ad 2022-03-03 thomas LIBPANELW,
412 b26177ad 2022-03-03 thomas found_panel=yes,
413 b26177ad 2022-03-03 thomas found_panel=no
415 d9e4d43f 2022-03-03 thomas if test "x$found_panel" = "xno"; then
416 92a9e85d 2021-09-24 thomas AC_CHECK_LIB(panelw, update_panels,,
417 92a9e85d 2021-09-24 thomas AC_MSG_ERROR([ "*** panelw not found for ncurses. ***"])
420 92a9e85d 2021-09-24 thomas LIBPANELW_LIBS="-lpanelw"
423 acf52a76 2021-09-21 thomas.ad PKG_CHECK_MODULES(
424 acf52a76 2021-09-21 thomas.ad LIBNCURSES,
425 acf52a76 2021-09-21 thomas.ad ncursesw,
426 dd038bc6 2021-09-21 thomas.ad found_ncurses=yes,
427 dd038bc6 2021-09-21 thomas.ad found_ncurses=no
429 acf52a76 2021-09-21 thomas.ad if test "x$found_ncurses" = xyes; then
430 acf52a76 2021-09-21 thomas.ad AM_CFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $LIBPANELW_CFLAGS $AM_CFLAGS"
431 acf52a76 2021-09-21 thomas.ad CFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $LIBPANELW_CFLAGS $CFLAGS"
432 acf52a76 2021-09-21 thomas.ad LIBS="$LIBNCURSES_LIBS $LIBTINFO_LIBS $LIBPANELW_LIBS $LIBS"
434 dd038bc6 2021-09-21 thomas.ad AC_CHECK_LIB(
435 acf52a76 2021-09-21 thomas.ad ncursesw,
436 dd038bc6 2021-09-21 thomas.ad setupterm,
437 dd038bc6 2021-09-21 thomas.ad found_ncurses=yes,
438 dd038bc6 2021-09-21 thomas.ad found_ncurses=no
440 dd038bc6 2021-09-21 thomas.ad if test "x$found_ncurses" = xyes; then
441 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADER(
442 dd038bc6 2021-09-21 thomas.ad ncurses.h,
443 acf52a76 2021-09-21 thomas.ad AM_CFLAGS="$LIBPANELW_CFLAGS $AM_CFLAGS"
444 acf52a76 2021-09-21 thomas.ad CFLAGS="$LIBPANEL_CFLAGS $CFLAGS"
445 acf52a76 2021-09-21 thomas.ad LIBS="$LIBS -lncursesw $LIBPANELW_LIBS",
446 acf52a76 2021-09-21 thomas.ad found_ncurses=no
450 dd038bc6 2021-09-21 thomas.ad if test "x$found_ncurses" = xyes; then
451 dd038bc6 2021-09-21 thomas.ad AC_DEFINE(HAVE_NCURSES_H)
453 dd038bc6 2021-09-21 thomas.ad # No ncurses, try curses.
454 dd038bc6 2021-09-21 thomas.ad AC_CHECK_LIB(
455 acf52a76 2021-09-21 thomas.ad cursesw,
456 dd038bc6 2021-09-21 thomas.ad setupterm,
457 dd038bc6 2021-09-21 thomas.ad found_curses=yes,
458 dd038bc6 2021-09-21 thomas.ad found_curses=no
460 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADER(
461 dd038bc6 2021-09-21 thomas.ad curses.h,
463 dd038bc6 2021-09-21 thomas.ad found_curses=no)
464 dd038bc6 2021-09-21 thomas.ad if test "x$found_curses" = xyes; then
465 acf52a76 2021-09-21 thomas.ad AM_CFLAGS="$LIBPANELW_CFLAGS $AM_CFLAGS"
466 acf52a76 2021-09-21 thomas.ad CFLAGS="$LIBPANEL_CFLAGS $CFLAGS"
467 acf52a76 2021-09-21 thomas.ad LIBS="$LIBS -lcursesw $LIBPANELW_LIBS"
468 dd038bc6 2021-09-21 thomas.ad AC_DEFINE(HAVE_CURSES_H)
470 dd038bc6 2021-09-21 thomas.ad AC_MSG_ERROR("curses not found")
474 dd038bc6 2021-09-21 thomas.ad # Save our CFLAGS/CPPFLAGS/LDFLAGS for the Makefile and restore the old user
475 dd038bc6 2021-09-21 thomas.ad # variables.
476 dd038bc6 2021-09-21 thomas.ad AC_SUBST(AM_CPPFLAGS)
477 dd038bc6 2021-09-21 thomas.ad CPPFLAGS="$SAVED_CPPFLAGS"
478 dd038bc6 2021-09-21 thomas.ad AC_SUBST(AM_CFLAGS)
479 dd038bc6 2021-09-21 thomas.ad CFLAGS="$SAVED_CFLAGS"
480 dd038bc6 2021-09-21 thomas.ad AC_SUBST(AM_LDFLAGS)
481 dd038bc6 2021-09-21 thomas.ad LDFLAGS="$SAVED_LDFLAGS"
483 dd038bc6 2021-09-21 thomas.ad AC_CONFIG_FILES([Makefile
484 dd038bc6 2021-09-21 thomas.ad compat/Makefile
485 dd038bc6 2021-09-21 thomas.ad libexec/Makefile
486 dd038bc6 2021-09-21 thomas.ad libexec/got-read-tree/Makefile
487 dd038bc6 2021-09-21 thomas.ad libexec/got-fetch-pack/Makefile
488 dd038bc6 2021-09-21 thomas.ad libexec/got-index-pack/Makefile
489 dd038bc6 2021-09-21 thomas.ad libexec/got-read-blob/Makefile
490 dd038bc6 2021-09-21 thomas.ad libexec/got-read-commit/Makefile
491 dd038bc6 2021-09-21 thomas.ad libexec/got-read-gitconfig/Makefile
492 dd038bc6 2021-09-21 thomas.ad libexec/got-read-gotconfig/Makefile
493 dd038bc6 2021-09-21 thomas.ad libexec/got-read-object/Makefile
494 dd038bc6 2021-09-21 thomas.ad libexec/got-read-pack/Makefile
495 973f3f6e 2022-03-07 thomas libexec/got-read-patch/Makefile
496 dd038bc6 2021-09-21 thomas.ad libexec/got-read-tag/Makefile
497 dd038bc6 2021-09-21 thomas.ad libexec/got-send-pack/Makefile
498 dd038bc6 2021-09-21 thomas.ad got/Makefile
499 2b0eee35 2021-09-21 thomas.ad gotadmin/Makefile
500 d3f2ad5e 2021-09-21 thomas.ad tog/Makefile
501 5a7ef102 2021-10-09 thomas Makefile.common:Makefile.common.in])
502 dd038bc6 2021-09-21 thomas.ad AC_OUTPUT
504 dd038bc6 2021-09-21 thomas.ad # tog/GNUMakefile])
505 dd038bc6 2021-09-21 thomas.ad # regress/GNUMakefile
506 dd038bc6 2021-09-21 thomas.ad # regress/cmdline/GNUMakefile
507 dd038bc6 2021-09-21 thomas.ad # regress/delta/GNUMakefile
508 dd038bc6 2021-09-21 thomas.ad # regress/fetch/GNUMakefile
509 dd038bc6 2021-09-21 thomas.ad # regress/idset/GNUMakefile
510 dd038bc6 2021-09-21 thomas.ad # regress/path/GNUMakefile
511 dd038bc6 2021-09-21 thomas.ad # gotweb/GNUMakefile
512 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/GNUMakefile
513 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-blob/GNUMakefile
514 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-commit/GNUMakefile
515 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-gitconfig/GNUMakefile
516 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-gotconfig/GNUMakefile
517 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-object/GNUMakefile
518 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-pack/GNUMakefile
519 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-tag/GNUMakefile
520 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-tree/GNUMakefile