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 1b83b24b 2022-04-29 thomas AC_INIT([got-portable], [0.70], [thomas@xteddy.org])
5 dd038bc6 2021-09-21 thomas.ad AC_CONFIG_AUX_DIR(etc)
6 dd038bc6 2021-09-21 thomas.ad AC_CONFIG_SRCDIR([lib/rcsutil.h])
7 dd038bc6 2021-09-21 thomas.ad AM_INIT_AUTOMAKE([foreign subdir-objects])
8 dd038bc6 2021-09-21 thomas.ad
9 dd038bc6 2021-09-21 thomas.ad GOT_RELEASE=No
10 dd038bc6 2021-09-21 thomas.ad
11 dd038bc6 2021-09-21 thomas.ad AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
12 dd038bc6 2021-09-21 thomas.ad AC_SUBST(VERSION)
13 dd038bc6 2021-09-21 thomas.ad AC_SUBST(GOT_RELEASE)
14 dd038bc6 2021-09-21 thomas.ad
15 dd038bc6 2021-09-21 thomas.ad AC_CANONICAL_HOST
16 dd038bc6 2021-09-21 thomas.ad
17 dd038bc6 2021-09-21 thomas.ad # When CFLAGS isn't set at this stage and gcc is detected by the macro below,
18 dd038bc6 2021-09-21 thomas.ad # autoconf will automatically use CFLAGS="-O2 -g". Prevent that by using an
19 dd038bc6 2021-09-21 thomas.ad # empty default.
20 dd038bc6 2021-09-21 thomas.ad : ${CFLAGS=""}
21 dd038bc6 2021-09-21 thomas.ad
22 dd038bc6 2021-09-21 thomas.ad # Save user CPPFLAGS, CFLAGS and LDFLAGS. We need to change them because
23 dd038bc6 2021-09-21 thomas.ad # AC_CHECK_HEADER doesn't give us any other way to update the include
24 dd038bc6 2021-09-21 thomas.ad # paths. But for Makefile.am we want to use AM_CPPFLAGS and friends.
25 dd038bc6 2021-09-21 thomas.ad SAVED_CFLAGS="$CFLAGS"
26 dd038bc6 2021-09-21 thomas.ad SAVED_CPPFLAGS="$CPPFLAGS"
27 dd038bc6 2021-09-21 thomas.ad SAVED_LDFLAGS="$LDFLAGS"
28 dd038bc6 2021-09-21 thomas.ad
29 dd038bc6 2021-09-21 thomas.ad # Checks for programs.
30 dd038bc6 2021-09-21 thomas.ad AC_PROG_CC
31 dd038bc6 2021-09-21 thomas.ad AC_PROG_CPP
32 dd038bc6 2021-09-21 thomas.ad AC_PROG_INSTALL
33 dd038bc6 2021-09-21 thomas.ad AC_PROG_LN_S
34 dd038bc6 2021-09-21 thomas.ad AC_PROG_MAKE_SET
35 dd038bc6 2021-09-21 thomas.ad AC_PROG_YACC
36 dd038bc6 2021-09-21 thomas.ad AC_PROG_RANLIB
37 dd038bc6 2021-09-21 thomas.ad PKG_PROG_PKG_CONFIG
38 dd038bc6 2021-09-21 thomas.ad AC_USE_SYSTEM_EXTENSIONS
39 dd038bc6 2021-09-21 thomas.ad
40 dd038bc6 2021-09-21 thomas.ad # Checks for header files.
41 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADERS([ \
42 dd038bc6 2021-09-21 thomas.ad fcntl.h \
43 dd038bc6 2021-09-21 thomas.ad langinfo.h \
44 dd038bc6 2021-09-21 thomas.ad limits.h \
45 97799ccd 2022-02-06 thomas linux/landlock.h \
46 dd038bc6 2021-09-21 thomas.ad locale.h \
47 dd038bc6 2021-09-21 thomas.ad netdb.h \
48 dd038bc6 2021-09-21 thomas.ad netinet/in.h \
49 dd038bc6 2021-09-21 thomas.ad paths.h \
50 d24ddaa6 2022-02-26 thomas poll.h \
51 dd038bc6 2021-09-21 thomas.ad stddef.h \
52 dd038bc6 2021-09-21 thomas.ad stdint.h \
53 dd038bc6 2021-09-21 thomas.ad stdlib.h \
54 dd038bc6 2021-09-21 thomas.ad string.h \
55 dd038bc6 2021-09-21 thomas.ad sys/ioctl.h \
56 dd038bc6 2021-09-21 thomas.ad sys/param.h \
57 d24ddaa6 2022-02-26 thomas sys/poll.h \
58 dd038bc6 2021-09-21 thomas.ad sys/socket.h \
59 dd038bc6 2021-09-21 thomas.ad sys/time.h \
60 dd038bc6 2021-09-21 thomas.ad sys/tree.h \
61 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 \
64 dd038bc6 2021-09-21 thomas.ad ])
65 dd038bc6 2021-09-21 thomas.ad
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
79 dd038bc6 2021-09-21 thomas.ad
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)
82 dd038bc6 2021-09-21 thomas.ad
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([ \
93 dd038bc6 2021-09-21 thomas.ad dup2 \
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 \
122 dd038bc6 2021-09-21 thomas.ad ])
123 ddd12270 2022-04-22 thomas
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])
127 dd038bc6 2021-09-21 thomas.ad
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 \
145 dd038bc6 2021-09-21 thomas.ad ])
146 dd038bc6 2021-09-21 thomas.ad
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)
152 dd038bc6 2021-09-21 thomas.ad
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
156 92a9e85d 2021-09-24 thomas *linux*)
157 92a9e85d 2021-09-24 thomas AC_MSG_RESULT(linux)
158 92a9e85d 2021-09-24 thomas PLATFORM=linux
159 92a9e85d 2021-09-24 thomas ;;
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
163 d24ddaa6 2022-02-26 thomas ;;
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
167 a3732bb6 2022-02-26 thomas ;;
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
171 92a9e85d 2021-09-24 thomas ;;
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
175 b26177ad 2022-03-03 thomas ;;
176 92a9e85d 2021-09-24 thomas *)
177 92a9e85d 2021-09-24 thomas AC_MSG_RESULT(unknown)
178 92a9e85d 2021-09-24 thomas PLATFORM=unknown
179 92a9e85d 2021-09-24 thomas ;;
180 92a9e85d 2021-09-24 thomas esac
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"])
187 92a9e85d 2021-09-24 thomas
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)
194 97799ccd 2022-02-06 thomas else
195 97799ccd 2022-02-06 thomas AC_MSG_RESULT(no)
196 97799ccd 2022-02-06 thomas fi
197 97799ccd 2022-02-06 thomas
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);]
205 dd038bc6 2021-09-21 thomas.ad )],
206 dd038bc6 2021-09-21 thomas.ad AC_MSG_RESULT(yes),
207 dd038bc6 2021-09-21 thomas.ad [AC_LIBOBJ(reallocarray) AC_MSG_RESULT([no])]
208 dd038bc6 2021-09-21 thomas.ad )
209 dd038bc6 2021-09-21 thomas.ad AC_MSG_CHECKING([for working recallocarray])
210 dd038bc6 2021-09-21 thomas.ad AC_RUN_IFELSE([AC_LANG_PROGRAM(
211 dd038bc6 2021-09-21 thomas.ad [#include <stdlib.h>],
212 dd038bc6 2021-09-21 thomas.ad [return (recallocarray(NULL, 1, 1, 1) == NULL);]
213 dd038bc6 2021-09-21 thomas.ad )],
214 dd038bc6 2021-09-21 thomas.ad AC_MSG_RESULT(yes),
215 dd038bc6 2021-09-21 thomas.ad [AC_LIBOBJ(recallocarray) AC_MSG_RESULT([no])]
216 dd038bc6 2021-09-21 thomas.ad )
217 dd038bc6 2021-09-21 thomas.ad
218 dd038bc6 2021-09-21 thomas.ad # Look for imsg_init in libutil.
219 dd038bc6 2021-09-21 thomas.ad AC_SEARCH_LIBS(imsg_init, util, found_imsg_init=yes, found_imsg_init=no)
220 dd038bc6 2021-09-21 thomas.ad if test "x$found_imsg_init" = xyes; then
221 dd038bc6 2021-09-21 thomas.ad AC_DEFINE(HAVE_IMSG)
222 dd038bc6 2021-09-21 thomas.ad else
223 dd038bc6 2021-09-21 thomas.ad AC_LIBOBJ(imsg)
224 dd038bc6 2021-09-21 thomas.ad AC_LIBOBJ(imsg-buffer)
225 dd038bc6 2021-09-21 thomas.ad fi
226 dd038bc6 2021-09-21 thomas.ad
227 dd038bc6 2021-09-21 thomas.ad # libcrypto (via libssl for SHA information)
228 dd038bc6 2021-09-21 thomas.ad PKG_CHECK_MODULES(
229 dd038bc6 2021-09-21 thomas.ad LIBCRYPTO,
230 dd038bc6 2021-09-21 thomas.ad libcrypto,
231 dd038bc6 2021-09-21 thomas.ad [
232 839511b2 2021-10-01 stsp AM_CFLAGS="$LIBCRYPTO_CFLAGS $AM_CFLAGS"
233 dd038bc6 2021-09-21 thomas.ad CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
234 dd038bc6 2021-09-21 thomas.ad LIBS="$LIBCRYPTO_LIBS $LIBS"
235 dd038bc6 2021-09-21 thomas.ad found_libcrypto=yes
236 dd038bc6 2021-09-21 thomas.ad ],
237 dd038bc6 2021-09-21 thomas.ad [
238 92a9e85d 2021-09-24 thomas found_libcrypto=no
239 dd038bc6 2021-09-21 thomas.ad ]
240 dd038bc6 2021-09-21 thomas.ad )
241 dd038bc6 2021-09-21 thomas.ad
242 92a9e85d 2021-09-24 thomas if test "x$found_libcrypto" = "xyes"; then
243 92a9e85d 2021-09-24 thomas AC_DEFINE(HAVE_LIBCRYPTO)
244 92a9e85d 2021-09-24 thomas fi
245 92a9e85d 2021-09-24 thomas
246 dd038bc6 2021-09-21 thomas.ad AC_SEARCH_LIBS(uuid_create, , AC_DEFINE(HAVE_BSD_UUID))
247 326237a6 2021-09-25 thomas AC_SEARCH_LIBS(uuid_create, found_uuid=no, found_uuid=yes)
248 dd038bc6 2021-09-21 thomas.ad AC_SEARCH_LIBS(mergesort, , AC_DEFINE(HAVE_BSD_MERGESORT))
249 dd038bc6 2021-09-21 thomas.ad
250 d24ddaa6 2022-02-26 thomas # Don't define HAVE_BSD_UUID on darwin (Apple) as this breaks the BSD API.
251 d24ddaa6 2022-02-26 thomas # Instead, use the UUID implementation wrapper that's in compat/ plus uuid
252 d24ddaa6 2022-02-26 thomas # ossp
253 d24ddaa6 2022-02-26 thomas if test "x$found_uuid" = "xyes" -a "x$PLATFORM" != "darwin"; then
254 326237a6 2021-09-25 thomas AC_DEFINE(HAVE_BSD_UUID)
255 326237a6 2021-09-25 thomas else
256 326237a6 2021-09-25 thomas PKG_CHECK_MODULES(
257 326237a6 2021-09-25 thomas LIBUUID,
258 326237a6 2021-09-25 thomas uuid,
259 326237a6 2021-09-25 thomas [
260 326237a6 2021-09-25 thomas AM_CFLAGS="$LIBUUID_CFLAGS $AM_CFLAGS"
261 326237a6 2021-09-25 thomas CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
262 326237a6 2021-09-25 thomas LIBS="$LIBUUID_LIBS $LIBS"
263 326237a6 2021-09-25 thomas found_libuuid=yes
264 326237a6 2021-09-25 thomas ],
265 326237a6 2021-09-25 thomas [
266 326237a6 2021-09-25 thomas found_libuuid=no
267 326237a6 2021-09-25 thomas ]
268 326237a6 2021-09-25 thomas )
269 dd038bc6 2021-09-21 thomas.ad
270 326237a6 2021-09-25 thomas if test "x$found_libuuid" = "xno"; then
271 326237a6 2021-09-25 thomas AC_CHECK_HEADER(
272 326237a6 2021-09-25 thomas uuid.h,
273 326237a6 2021-09-25 thomas found_libuuid=yes,
274 326237a6 2021-09-25 thomas found_libuuid=no)
275 326237a6 2021-09-25 thomas fi
276 92a9e85d 2021-09-24 thomas fi
277 dd038bc6 2021-09-21 thomas.ad
278 92a9e85d 2021-09-24 thomas if test "x$found_libuuid" = "xno"; then
279 92a9e85d 2021-09-24 thomas AC_MSG_ERROR("*** couldn't find uuid ***")
280 92a9e85d 2021-09-24 thomas fi
281 92a9e85d 2021-09-24 thomas
282 dd038bc6 2021-09-21 thomas.ad PKG_CHECK_MODULES(
283 dd038bc6 2021-09-21 thomas.ad ZLIB,
284 dd038bc6 2021-09-21 thomas.ad zlib,
285 dd038bc6 2021-09-21 thomas.ad [
286 dd038bc6 2021-09-21 thomas.ad AM_CFLAGS="$ZLIB_CFLAGS $AM_CFLAGS"
287 dd038bc6 2021-09-21 thomas.ad CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
288 dd038bc6 2021-09-21 thomas.ad LIBS="$ZLIB_LIBS $LIBS"
289 dd038bc6 2021-09-21 thomas.ad found_zlib=yes
290 dd038bc6 2021-09-21 thomas.ad ],
291 dd038bc6 2021-09-21 thomas.ad [
292 92a9e85d 2021-09-24 thomas found_zlib=no
293 dd038bc6 2021-09-21 thomas.ad ]
294 dd038bc6 2021-09-21 thomas.ad )
295 dd038bc6 2021-09-21 thomas.ad
296 92a9e85d 2021-09-24 thomas if test "x$found_zlib" = "xno"; then
297 92a9e85d 2021-09-24 thomas AC_CHECK_HEADER(
298 92a9e85d 2021-09-24 thomas zlib.h,
299 92a9e85d 2021-09-24 thomas ,
300 92a9e85d 2021-09-24 thomas found_zlib=no)
301 92a9e85d 2021-09-24 thomas fi
302 dd038bc6 2021-09-21 thomas.ad
303 92a9e85d 2021-09-24 thomas if test "x$found_zlib" = "xno"; then
304 92a9e85d 2021-09-24 thomas AC_MSG_ERROR("*** couldn't find zlib ***")
305 92a9e85d 2021-09-24 thomas fi
306 dd038bc6 2021-09-21 thomas.ad
307 92a9e85d 2021-09-24 thomas if test "$PLATFORM" = "linux"; then
308 92a9e85d 2021-09-24 thomas PKG_CHECK_MODULES(
309 92a9e85d 2021-09-24 thomas LIBMD,
310 92a9e85d 2021-09-24 thomas libmd,
311 92a9e85d 2021-09-24 thomas [
312 92a9e85d 2021-09-24 thomas AM_CFLAGS="$LIBMD_CFLAGS $AM_CFLAGS"
313 92a9e85d 2021-09-24 thomas CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
314 92a9e85d 2021-09-24 thomas LIBS="$LIBMD_LIBS $LIBS"
315 92a9e85d 2021-09-24 thomas ],
316 92a9e85d 2021-09-24 thomas [
317 92a9e85d 2021-09-24 thomas AC_MSG_ERROR("*** couldn't find libmd via pkg-config")
318 92a9e85d 2021-09-24 thomas ]
319 92a9e85d 2021-09-24 thomas )
320 92a9e85d 2021-09-24 thomas PKG_CHECK_MODULES(
321 92a9e85d 2021-09-24 thomas LIBBSD,
322 92a9e85d 2021-09-24 thomas libbsd-overlay,
323 92a9e85d 2021-09-24 thomas [
324 92a9e85d 2021-09-24 thomas AM_CFLAGS="$LIBBSD_CFLAGS $AM_CFLAGS"
325 92a9e85d 2021-09-24 thomas CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
326 92a9e85d 2021-09-24 thomas LIBS="$LIBBSD_LIBS $LIBS"
327 92a9e85d 2021-09-24 thomas found_libbsd=yes
328 92a9e85d 2021-09-24 thomas AC_DEFINE(HAVE_LIBBSD)
329 92a9e85d 2021-09-24 thomas ],
330 92a9e85d 2021-09-24 thomas []
331 92a9e85d 2021-09-24 thomas )
332 92a9e85d 2021-09-24 thomas fi
333 92a9e85d 2021-09-24 thomas
334 dd038bc6 2021-09-21 thomas.ad # Look for a suitable queue.h. We hope libbsd is enough, but that is missing
335 dd038bc6 2021-09-21 thomas.ad # SIMPLEQ.
336 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
337 dd038bc6 2021-09-21 thomas.ad SIMPLEQ_INIT,
338 dd038bc6 2021-09-21 thomas.ad found_queue_h=yes,
339 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
340 dd038bc6 2021-09-21 thomas.ad [#include <sys/queue.h>]
341 dd038bc6 2021-09-21 thomas.ad )
342 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
343 dd038bc6 2021-09-21 thomas.ad TAILQ_CONCAT,
344 dd038bc6 2021-09-21 thomas.ad found_queue_h=yes,
345 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
346 dd038bc6 2021-09-21 thomas.ad [#include <sys/queue.h>]
347 dd038bc6 2021-09-21 thomas.ad )
348 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
349 dd038bc6 2021-09-21 thomas.ad TAILQ_PREV,
350 dd038bc6 2021-09-21 thomas.ad found_queue_h=yes,
351 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
352 dd038bc6 2021-09-21 thomas.ad [#include <sys/queue.h>]
353 dd038bc6 2021-09-21 thomas.ad )
354 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
355 dd038bc6 2021-09-21 thomas.ad TAILQ_REPLACE,
356 dd038bc6 2021-09-21 thomas.ad found_queue_h=yes,
357 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
358 dd038bc6 2021-09-21 thomas.ad [#include <sys/queue.h>]
359 dd038bc6 2021-09-21 thomas.ad )
360 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
361 dd038bc6 2021-09-21 thomas.ad SIMPLEQ_ENTRY,
362 dd038bc6 2021-09-21 thomas.ad ,
363 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
364 dd038bc6 2021-09-21 thomas.ad [#include <sys/queue.h>]
365 dd038bc6 2021-09-21 thomas.ad )
366 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
367 dd038bc6 2021-09-21 thomas.ad TAILQ_FOREACH_SAFE,
368 dd038bc6 2021-09-21 thomas.ad ,
369 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
370 dd038bc6 2021-09-21 thomas.ad [#include <sys/queue.h>]
371 dd038bc6 2021-09-21 thomas.ad )
372 dd038bc6 2021-09-21 thomas.ad if test "x$found_queue_h" = xyes; then
373 dd038bc6 2021-09-21 thomas.ad AC_DEFINE(HAVE_QUEUE_H)
374 dd038bc6 2021-09-21 thomas.ad fi
375 dd038bc6 2021-09-21 thomas.ad
376 dd038bc6 2021-09-21 thomas.ad # Look for __progname.
377 dd038bc6 2021-09-21 thomas.ad AC_MSG_CHECKING(for __progname)
378 dd038bc6 2021-09-21 thomas.ad AC_LINK_IFELSE([AC_LANG_SOURCE(
379 dd038bc6 2021-09-21 thomas.ad [
380 dd038bc6 2021-09-21 thomas.ad #include <stdio.h>
381 dd038bc6 2021-09-21 thomas.ad #include <stdlib.h>
382 dd038bc6 2021-09-21 thomas.ad extern char *__progname;
383 dd038bc6 2021-09-21 thomas.ad int main(void) {
384 dd038bc6 2021-09-21 thomas.ad const char *cp = __progname;
385 dd038bc6 2021-09-21 thomas.ad printf("%s\n", cp);
386 dd038bc6 2021-09-21 thomas.ad exit(0);
387 dd038bc6 2021-09-21 thomas.ad }
388 dd038bc6 2021-09-21 thomas.ad ])],
389 dd038bc6 2021-09-21 thomas.ad [AC_DEFINE(HAVE___PROGNAME) AC_MSG_RESULT(yes)],
390 dd038bc6 2021-09-21 thomas.ad AC_MSG_RESULT(no)
391 dd038bc6 2021-09-21 thomas.ad )
392 dd038bc6 2021-09-21 thomas.ad
393 d9e4d43f 2022-03-03 thomas PKG_CHECK_MODULES(
394 d9e4d43f 2022-03-03 thomas LIBPANELW,
395 d9e4d43f 2022-03-03 thomas panelw,
396 d9e4d43f 2022-03-03 thomas found_panel=yes,
397 d9e4d43f 2022-03-03 thomas found_panel=no
398 d9e4d43f 2022-03-03 thomas )
399 d9e4d43f 2022-03-03 thomas
400 d9e4d43f 2022-03-03 thomas PKG_CHECK_MODULES(
401 d9e4d43f 2022-03-03 thomas LIBPANELW,
402 d9e4d43f 2022-03-03 thomas gnupanelw,
403 d9e4d43f 2022-03-03 thomas found_panel=yes,
404 d9e4d43f 2022-03-03 thomas found_panel=no
405 d9e4d43f 2022-03-03 thomas )
406 d9e4d43f 2022-03-03 thomas
407 b26177ad 2022-03-03 thomas PKG_CHECK_MODULES(
408 b26177ad 2022-03-03 thomas LIBPANELW,
409 b26177ad 2022-03-03 thomas panel,
410 b26177ad 2022-03-03 thomas found_panel=yes,
411 b26177ad 2022-03-03 thomas found_panel=no
412 b26177ad 2022-03-03 thomas )
413 d9e4d43f 2022-03-03 thomas if test "x$found_panel" = "xno"; then
414 92a9e85d 2021-09-24 thomas AC_CHECK_LIB(panelw, update_panels,,
415 92a9e85d 2021-09-24 thomas AC_MSG_ERROR([ "*** panelw not found for ncurses. ***"])
416 92a9e85d 2021-09-24 thomas )
417 acf52a76 2021-09-21 thomas.ad
418 92a9e85d 2021-09-24 thomas LIBPANELW_LIBS="-lpanelw"
419 92a9e85d 2021-09-24 thomas fi
420 92a9e85d 2021-09-24 thomas
421 acf52a76 2021-09-21 thomas.ad PKG_CHECK_MODULES(
422 acf52a76 2021-09-21 thomas.ad LIBNCURSES,
423 acf52a76 2021-09-21 thomas.ad ncursesw,
424 dd038bc6 2021-09-21 thomas.ad found_ncurses=yes,
425 dd038bc6 2021-09-21 thomas.ad found_ncurses=no
426 dd038bc6 2021-09-21 thomas.ad )
427 acf52a76 2021-09-21 thomas.ad if test "x$found_ncurses" = xyes; then
428 acf52a76 2021-09-21 thomas.ad AM_CFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $LIBPANELW_CFLAGS $AM_CFLAGS"
429 acf52a76 2021-09-21 thomas.ad CFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $LIBPANELW_CFLAGS $CFLAGS"
430 acf52a76 2021-09-21 thomas.ad LIBS="$LIBNCURSES_LIBS $LIBTINFO_LIBS $LIBPANELW_LIBS $LIBS"
431 dd038bc6 2021-09-21 thomas.ad else
432 dd038bc6 2021-09-21 thomas.ad AC_CHECK_LIB(
433 acf52a76 2021-09-21 thomas.ad ncursesw,
434 dd038bc6 2021-09-21 thomas.ad setupterm,
435 dd038bc6 2021-09-21 thomas.ad found_ncurses=yes,
436 dd038bc6 2021-09-21 thomas.ad found_ncurses=no
437 dd038bc6 2021-09-21 thomas.ad )
438 dd038bc6 2021-09-21 thomas.ad if test "x$found_ncurses" = xyes; then
439 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADER(
440 dd038bc6 2021-09-21 thomas.ad ncurses.h,
441 acf52a76 2021-09-21 thomas.ad AM_CFLAGS="$LIBPANELW_CFLAGS $AM_CFLAGS"
442 acf52a76 2021-09-21 thomas.ad CFLAGS="$LIBPANEL_CFLAGS $CFLAGS"
443 acf52a76 2021-09-21 thomas.ad LIBS="$LIBS -lncursesw $LIBPANELW_LIBS",
444 acf52a76 2021-09-21 thomas.ad found_ncurses=no
445 acf52a76 2021-09-21 thomas.ad )
446 92a9e85d 2021-09-24 thomas fi
447 dd038bc6 2021-09-21 thomas.ad fi
448 dd038bc6 2021-09-21 thomas.ad if test "x$found_ncurses" = xyes; then
449 dd038bc6 2021-09-21 thomas.ad AC_DEFINE(HAVE_NCURSES_H)
450 dd038bc6 2021-09-21 thomas.ad else
451 dd038bc6 2021-09-21 thomas.ad # No ncurses, try curses.
452 dd038bc6 2021-09-21 thomas.ad AC_CHECK_LIB(
453 acf52a76 2021-09-21 thomas.ad cursesw,
454 dd038bc6 2021-09-21 thomas.ad setupterm,
455 dd038bc6 2021-09-21 thomas.ad found_curses=yes,
456 dd038bc6 2021-09-21 thomas.ad found_curses=no
457 dd038bc6 2021-09-21 thomas.ad )
458 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADER(
459 dd038bc6 2021-09-21 thomas.ad curses.h,
460 dd038bc6 2021-09-21 thomas.ad ,
461 dd038bc6 2021-09-21 thomas.ad found_curses=no)
462 dd038bc6 2021-09-21 thomas.ad if test "x$found_curses" = xyes; then
463 acf52a76 2021-09-21 thomas.ad AM_CFLAGS="$LIBPANELW_CFLAGS $AM_CFLAGS"
464 acf52a76 2021-09-21 thomas.ad CFLAGS="$LIBPANEL_CFLAGS $CFLAGS"
465 acf52a76 2021-09-21 thomas.ad LIBS="$LIBS -lcursesw $LIBPANELW_LIBS"
466 dd038bc6 2021-09-21 thomas.ad AC_DEFINE(HAVE_CURSES_H)
467 dd038bc6 2021-09-21 thomas.ad else
468 dd038bc6 2021-09-21 thomas.ad AC_MSG_ERROR("curses not found")
469 dd038bc6 2021-09-21 thomas.ad fi
470 dd038bc6 2021-09-21 thomas.ad fi
471 dd038bc6 2021-09-21 thomas.ad
472 dd038bc6 2021-09-21 thomas.ad # Save our CFLAGS/CPPFLAGS/LDFLAGS for the Makefile and restore the old user
473 dd038bc6 2021-09-21 thomas.ad # variables.
474 dd038bc6 2021-09-21 thomas.ad AC_SUBST(AM_CPPFLAGS)
475 dd038bc6 2021-09-21 thomas.ad CPPFLAGS="$SAVED_CPPFLAGS"
476 dd038bc6 2021-09-21 thomas.ad AC_SUBST(AM_CFLAGS)
477 dd038bc6 2021-09-21 thomas.ad CFLAGS="$SAVED_CFLAGS"
478 dd038bc6 2021-09-21 thomas.ad AC_SUBST(AM_LDFLAGS)
479 dd038bc6 2021-09-21 thomas.ad LDFLAGS="$SAVED_LDFLAGS"
480 dd038bc6 2021-09-21 thomas.ad
481 dd038bc6 2021-09-21 thomas.ad AC_CONFIG_FILES([Makefile
482 dd038bc6 2021-09-21 thomas.ad compat/Makefile
483 dd038bc6 2021-09-21 thomas.ad libexec/Makefile
484 dd038bc6 2021-09-21 thomas.ad libexec/got-read-tree/Makefile
485 dd038bc6 2021-09-21 thomas.ad libexec/got-fetch-pack/Makefile
486 dd038bc6 2021-09-21 thomas.ad libexec/got-index-pack/Makefile
487 dd038bc6 2021-09-21 thomas.ad libexec/got-read-blob/Makefile
488 dd038bc6 2021-09-21 thomas.ad libexec/got-read-commit/Makefile
489 dd038bc6 2021-09-21 thomas.ad libexec/got-read-gitconfig/Makefile
490 dd038bc6 2021-09-21 thomas.ad libexec/got-read-gotconfig/Makefile
491 dd038bc6 2021-09-21 thomas.ad libexec/got-read-object/Makefile
492 dd038bc6 2021-09-21 thomas.ad libexec/got-read-pack/Makefile
493 973f3f6e 2022-03-07 thomas libexec/got-read-patch/Makefile
494 dd038bc6 2021-09-21 thomas.ad libexec/got-read-tag/Makefile
495 dd038bc6 2021-09-21 thomas.ad libexec/got-send-pack/Makefile
496 dd038bc6 2021-09-21 thomas.ad got/Makefile
497 2b0eee35 2021-09-21 thomas.ad gotadmin/Makefile
498 d3f2ad5e 2021-09-21 thomas.ad tog/Makefile
499 5a7ef102 2021-10-09 thomas Makefile.common:Makefile.common.in])
500 dd038bc6 2021-09-21 thomas.ad AC_OUTPUT
501 dd038bc6 2021-09-21 thomas.ad
502 dd038bc6 2021-09-21 thomas.ad # tog/GNUMakefile])
503 dd038bc6 2021-09-21 thomas.ad # regress/GNUMakefile
504 dd038bc6 2021-09-21 thomas.ad # regress/cmdline/GNUMakefile
505 dd038bc6 2021-09-21 thomas.ad # regress/delta/GNUMakefile
506 dd038bc6 2021-09-21 thomas.ad # regress/fetch/GNUMakefile
507 dd038bc6 2021-09-21 thomas.ad # regress/idset/GNUMakefile
508 dd038bc6 2021-09-21 thomas.ad # regress/path/GNUMakefile
509 dd038bc6 2021-09-21 thomas.ad # gotweb/GNUMakefile
510 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/GNUMakefile
511 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-blob/GNUMakefile
512 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-commit/GNUMakefile
513 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-gitconfig/GNUMakefile
514 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-gotconfig/GNUMakefile
515 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-object/GNUMakefile
516 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-pack/GNUMakefile
517 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-tag/GNUMakefile
518 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-tree/GNUMakefile