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 7dfae8a2 2021-09-21 thomas.ad AC_INIT([got-portable], [0.60], [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 2c6298d5 2021-09-24 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 dd038bc6 2021-09-21 thomas.ad stddef.h \
51 dd038bc6 2021-09-21 thomas.ad stdint.h \
52 dd038bc6 2021-09-21 thomas.ad stdlib.h \
53 dd038bc6 2021-09-21 thomas.ad string.h \
54 dd038bc6 2021-09-21 thomas.ad sys/ioctl.h \
55 dd038bc6 2021-09-21 thomas.ad sys/param.h \
56 dd038bc6 2021-09-21 thomas.ad sys/socket.h \
57 dd038bc6 2021-09-21 thomas.ad sys/time.h \
58 dd038bc6 2021-09-21 thomas.ad sys/tree.h \
59 dd038bc6 2021-09-21 thomas.ad util.h \
60 dd038bc6 2021-09-21 thomas.ad unistd.h \
61 dd038bc6 2021-09-21 thomas.ad wchar.h \
62 dd038bc6 2021-09-21 thomas.ad ])
63 dd038bc6 2021-09-21 thomas.ad
64 dd038bc6 2021-09-21 thomas.ad # Checks for typ edefs, structures, and compiler characteristics.
65 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADER_STDBOOL
66 dd038bc6 2021-09-21 thomas.ad AC_C_INLINE
67 dd038bc6 2021-09-21 thomas.ad AC_TYPE_INT64_T
68 dd038bc6 2021-09-21 thomas.ad AC_TYPE_MODE_T
69 dd038bc6 2021-09-21 thomas.ad AC_TYPE_OFF_T
70 dd038bc6 2021-09-21 thomas.ad AC_TYPE_PID_T
71 dd038bc6 2021-09-21 thomas.ad AC_TYPE_SIZE_T
72 dd038bc6 2021-09-21 thomas.ad AC_TYPE_SSIZE_T
73 dd038bc6 2021-09-21 thomas.ad AC_TYPE_UINT16_T
74 dd038bc6 2021-09-21 thomas.ad AC_TYPE_UINT32_T
75 dd038bc6 2021-09-21 thomas.ad AC_TYPE_UINT64_T
76 dd038bc6 2021-09-21 thomas.ad AC_TYPE_UINT8_T
77 dd038bc6 2021-09-21 thomas.ad
78 dd038bc6 2021-09-21 thomas.ad # Look for library needed for flock.
79 dd038bc6 2021-09-21 thomas.ad AC_SEARCH_LIBS(flock, bsd)
80 dd038bc6 2021-09-21 thomas.ad
81 dd038bc6 2021-09-21 thomas.ad # Checks for library functions.
82 dd038bc6 2021-09-21 thomas.ad AC_FUNC_FORK
83 dd038bc6 2021-09-21 thomas.ad AC_FUNC_FSEEKO
84 dd038bc6 2021-09-21 thomas.ad AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
85 dd038bc6 2021-09-21 thomas.ad AC_FUNC_MALLOC
86 dd038bc6 2021-09-21 thomas.ad AC_FUNC_MMAP
87 dd038bc6 2021-09-21 thomas.ad AC_FUNC_REALLOC
88 dd038bc6 2021-09-21 thomas.ad AC_FUNC_STRERROR_R
89 dd038bc6 2021-09-21 thomas.ad AC_FUNC_STRNLEN
90 dd038bc6 2021-09-21 thomas.ad AC_CHECK_FUNCS([ \
91 dd038bc6 2021-09-21 thomas.ad dup2 \
92 dd038bc6 2021-09-21 thomas.ad flock \
93 dd038bc6 2021-09-21 thomas.ad getcwd \
94 dd038bc6 2021-09-21 thomas.ad localtime_r \
95 dd038bc6 2021-09-21 thomas.ad memchr \
96 dd038bc6 2021-09-21 thomas.ad memmove \
97 dd038bc6 2021-09-21 thomas.ad memset \
98 dd038bc6 2021-09-21 thomas.ad mkdir \
99 dd038bc6 2021-09-21 thomas.ad munmap \
100 dd038bc6 2021-09-21 thomas.ad nl_langinfo \
101 dd038bc6 2021-09-21 thomas.ad realpath \
102 dd038bc6 2021-09-21 thomas.ad regcomp \
103 dd038bc6 2021-09-21 thomas.ad rmdir \
104 dd038bc6 2021-09-21 thomas.ad setlocale \
105 dd038bc6 2021-09-21 thomas.ad socket \
106 dd038bc6 2021-09-21 thomas.ad strcasecmp \
107 dd038bc6 2021-09-21 thomas.ad strchr \
108 dd038bc6 2021-09-21 thomas.ad strcspn \
109 dd038bc6 2021-09-21 thomas.ad strdup \
110 dd038bc6 2021-09-21 thomas.ad strerror \
111 dd038bc6 2021-09-21 thomas.ad strlcpy \
112 dd038bc6 2021-09-21 thomas.ad strncasecmp \
113 dd038bc6 2021-09-21 thomas.ad strndup \
114 dd038bc6 2021-09-21 thomas.ad strrchr \
115 dd038bc6 2021-09-21 thomas.ad strspn \
116 dd038bc6 2021-09-21 thomas.ad strstr \
117 dd038bc6 2021-09-21 thomas.ad strtol \
118 dd038bc6 2021-09-21 thomas.ad strtoul \
119 dd038bc6 2021-09-21 thomas.ad wcwidth \
120 dd038bc6 2021-09-21 thomas.ad ])
121 dd038bc6 2021-09-21 thomas.ad
122 dd038bc6 2021-09-21 thomas.ad # Check for functions with a compatibility implementation.
123 dd038bc6 2021-09-21 thomas.ad AC_REPLACE_FUNCS([ \
124 dd038bc6 2021-09-21 thomas.ad asprintf \
125 dd038bc6 2021-09-21 thomas.ad closefrom \
126 dd038bc6 2021-09-21 thomas.ad explicit_bzero \
127 dd038bc6 2021-09-21 thomas.ad fmt_scaled \
128 dd038bc6 2021-09-21 thomas.ad freezero \
129 dd038bc6 2021-09-21 thomas.ad getdtablecount \
130 dd038bc6 2021-09-21 thomas.ad getline \
131 dd038bc6 2021-09-21 thomas.ad getprogname \
132 dd038bc6 2021-09-21 thomas.ad recallocarray \
133 dd038bc6 2021-09-21 thomas.ad reallocarray \
134 dd038bc6 2021-09-21 thomas.ad strlcat \
135 dd038bc6 2021-09-21 thomas.ad strlcpy \
136 dd038bc6 2021-09-21 thomas.ad strndup \
137 dd038bc6 2021-09-21 thomas.ad strsep \
138 dd038bc6 2021-09-21 thomas.ad strtonum \
139 dd038bc6 2021-09-21 thomas.ad ])
140 dd038bc6 2021-09-21 thomas.ad
141 dd038bc6 2021-09-21 thomas.ad # Always use our getopt because 1) glibc's doesn't enforce argument order 2)
142 dd038bc6 2021-09-21 thomas.ad # musl does not set optarg to NULL for flags without arguments (although it is
143 dd038bc6 2021-09-21 thomas.ad # not required to, but it is helpful) 3) there are probably other weird
144 dd038bc6 2021-09-21 thomas.ad # implementations.
145 dd038bc6 2021-09-21 thomas.ad AC_LIBOBJ(getopt)
146 dd038bc6 2021-09-21 thomas.ad
147 92a9e85d 2021-09-24 thomas # Check the platform we're compiling on.
148 92a9e85d 2021-09-24 thomas AC_MSG_CHECKING(platform)
149 92a9e85d 2021-09-24 thomas case "$host_os" in
150 92a9e85d 2021-09-24 thomas *linux*)
151 92a9e85d 2021-09-24 thomas AC_MSG_RESULT(linux)
152 92a9e85d 2021-09-24 thomas PLATFORM=linux
153 92a9e85d 2021-09-24 thomas ;;
154 92a9e85d 2021-09-24 thomas *freebsd*)
155 92a9e85d 2021-09-24 thomas AC_MSG_RESULT(freebsd)
156 92a9e85d 2021-09-24 thomas PLATFORM=freebsd
157 92a9e85d 2021-09-24 thomas ;;
158 92a9e85d 2021-09-24 thomas *)
159 92a9e85d 2021-09-24 thomas AC_MSG_RESULT(unknown)
160 92a9e85d 2021-09-24 thomas PLATFORM=unknown
161 92a9e85d 2021-09-24 thomas ;;
162 92a9e85d 2021-09-24 thomas esac
163 92a9e85d 2021-09-24 thomas AC_SUBST(PLATFORM)
164 92a9e85d 2021-09-24 thomas AM_CONDITIONAL([HOST_FREEBSD], [test "$PLATFORM" = "freebsd"])
165 92a9e85d 2021-09-24 thomas AM_CONDITIONAL([HOST_LINUX], [test "$PLATFORM" = "linux"])
166 92a9e85d 2021-09-24 thomas
167 2c6298d5 2021-09-24 thomas # Landlock detection.
168 2c6298d5 2021-09-24 thomas AC_MSG_CHECKING([for landlock])
169 2c6298d5 2021-09-24 thomas AM_CONDITIONAL([HAVE_LINUX_LANDLOCK],
170 2c6298d5 2021-09-24 thomas [test "x$ac_cv_header_linux_landlock_h" = "xyes"])
171 2c6298d5 2021-09-24 thomas if test "x$ac_cv_header_linux_landlock_h" = "xyes"; then
172 2c6298d5 2021-09-24 thomas AC_MSG_RESULT(yes)
173 2c6298d5 2021-09-24 thomas else
174 2c6298d5 2021-09-24 thomas AC_MSG_RESULT(no)
175 2c6298d5 2021-09-24 thomas fi
176 2c6298d5 2021-09-24 thomas
177 dd038bc6 2021-09-21 thomas.ad # Clang sanitizers wrap reallocarray even if it isn't available on the target
178 dd038bc6 2021-09-21 thomas.ad # system. When compiled it always returns NULL and crashes the program. To
179 dd038bc6 2021-09-21 thomas.ad # detect this we need a more complicated test.
180 dd038bc6 2021-09-21 thomas.ad AC_MSG_CHECKING([for working reallocarray])
181 dd038bc6 2021-09-21 thomas.ad AC_RUN_IFELSE([AC_LANG_PROGRAM(
182 dd038bc6 2021-09-21 thomas.ad [#include <stdlib.h>],
183 dd038bc6 2021-09-21 thomas.ad [return (reallocarray(NULL, 1, 1) == NULL);]
184 dd038bc6 2021-09-21 thomas.ad )],
185 dd038bc6 2021-09-21 thomas.ad AC_MSG_RESULT(yes),
186 dd038bc6 2021-09-21 thomas.ad [AC_LIBOBJ(reallocarray) AC_MSG_RESULT([no])]
187 dd038bc6 2021-09-21 thomas.ad )
188 dd038bc6 2021-09-21 thomas.ad AC_MSG_CHECKING([for working recallocarray])
189 dd038bc6 2021-09-21 thomas.ad AC_RUN_IFELSE([AC_LANG_PROGRAM(
190 dd038bc6 2021-09-21 thomas.ad [#include <stdlib.h>],
191 dd038bc6 2021-09-21 thomas.ad [return (recallocarray(NULL, 1, 1, 1) == NULL);]
192 dd038bc6 2021-09-21 thomas.ad )],
193 dd038bc6 2021-09-21 thomas.ad AC_MSG_RESULT(yes),
194 dd038bc6 2021-09-21 thomas.ad [AC_LIBOBJ(recallocarray) AC_MSG_RESULT([no])]
195 dd038bc6 2021-09-21 thomas.ad )
196 dd038bc6 2021-09-21 thomas.ad
197 dd038bc6 2021-09-21 thomas.ad # Look for imsg_init in libutil.
198 dd038bc6 2021-09-21 thomas.ad AC_SEARCH_LIBS(imsg_init, util, found_imsg_init=yes, found_imsg_init=no)
199 dd038bc6 2021-09-21 thomas.ad if test "x$found_imsg_init" = xyes; then
200 dd038bc6 2021-09-21 thomas.ad AC_DEFINE(HAVE_IMSG)
201 dd038bc6 2021-09-21 thomas.ad else
202 dd038bc6 2021-09-21 thomas.ad AC_LIBOBJ(imsg)
203 dd038bc6 2021-09-21 thomas.ad AC_LIBOBJ(imsg-buffer)
204 dd038bc6 2021-09-21 thomas.ad fi
205 dd038bc6 2021-09-21 thomas.ad
206 dd038bc6 2021-09-21 thomas.ad # libcrypto (via libssl for SHA information)
207 dd038bc6 2021-09-21 thomas.ad PKG_CHECK_MODULES(
208 dd038bc6 2021-09-21 thomas.ad LIBCRYPTO,
209 dd038bc6 2021-09-21 thomas.ad libcrypto,
210 dd038bc6 2021-09-21 thomas.ad [
211 dd038bc6 2021-09-21 thomas.ad AM_CFLAGS="$LIBCRYTPO_CFLAGS $AM_CFLAGS"
212 dd038bc6 2021-09-21 thomas.ad CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
213 dd038bc6 2021-09-21 thomas.ad LIBS="$LIBCRYPTO_LIBS $LIBS"
214 dd038bc6 2021-09-21 thomas.ad found_libcrypto=yes
215 dd038bc6 2021-09-21 thomas.ad ],
216 dd038bc6 2021-09-21 thomas.ad [
217 92a9e85d 2021-09-24 thomas found_libcrypto=no
218 dd038bc6 2021-09-21 thomas.ad ]
219 dd038bc6 2021-09-21 thomas.ad )
220 dd038bc6 2021-09-21 thomas.ad
221 92a9e85d 2021-09-24 thomas if test "x$found_libcrypto" = "xyes"; then
222 92a9e85d 2021-09-24 thomas AC_DEFINE(HAVE_LIBCRYPTO)
223 92a9e85d 2021-09-24 thomas fi
224 92a9e85d 2021-09-24 thomas
225 dd038bc6 2021-09-21 thomas.ad AC_SEARCH_LIBS(uuid_create, , AC_DEFINE(HAVE_BSD_UUID))
226 dd038bc6 2021-09-21 thomas.ad AC_SEARCH_LIBS(mergesort, , AC_DEFINE(HAVE_BSD_MERGESORT))
227 dd038bc6 2021-09-21 thomas.ad
228 dd038bc6 2021-09-21 thomas.ad PKG_CHECK_MODULES(
229 dd038bc6 2021-09-21 thomas.ad LIBUUID,
230 dd038bc6 2021-09-21 thomas.ad uuid,
231 dd038bc6 2021-09-21 thomas.ad [
232 dd038bc6 2021-09-21 thomas.ad AM_CFLAGS="$LIBUUID_CFLAGS $AM_CFLAGS"
233 dd038bc6 2021-09-21 thomas.ad CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
234 dd038bc6 2021-09-21 thomas.ad LIBS="$LIBUUID_LIBS $LIBS"
235 dd038bc6 2021-09-21 thomas.ad found_libuuid=yes
236 dd038bc6 2021-09-21 thomas.ad ],
237 dd038bc6 2021-09-21 thomas.ad [
238 92a9e85d 2021-09-24 thomas found_libuuid=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_libuuid" = "xno"; then
243 92a9e85d 2021-09-24 thomas AC_CHECK_HEADER(
244 92a9e85d 2021-09-24 thomas uuid.h,
245 92a9e85d 2021-09-24 thomas found_libuuid=yes,
246 92a9e85d 2021-09-24 thomas found_libuuid=no)
247 92a9e85d 2021-09-24 thomas fi
248 dd038bc6 2021-09-21 thomas.ad
249 92a9e85d 2021-09-24 thomas if test "x$found_libuuid" = "xno"; then
250 92a9e85d 2021-09-24 thomas AC_MSG_ERROR("*** couldn't find uuid ***")
251 92a9e85d 2021-09-24 thomas fi
252 92a9e85d 2021-09-24 thomas
253 dd038bc6 2021-09-21 thomas.ad PKG_CHECK_MODULES(
254 dd038bc6 2021-09-21 thomas.ad ZLIB,
255 dd038bc6 2021-09-21 thomas.ad zlib,
256 dd038bc6 2021-09-21 thomas.ad [
257 dd038bc6 2021-09-21 thomas.ad AM_CFLAGS="$ZLIB_CFLAGS $AM_CFLAGS"
258 dd038bc6 2021-09-21 thomas.ad CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
259 dd038bc6 2021-09-21 thomas.ad LIBS="$ZLIB_LIBS $LIBS"
260 dd038bc6 2021-09-21 thomas.ad found_zlib=yes
261 dd038bc6 2021-09-21 thomas.ad ],
262 dd038bc6 2021-09-21 thomas.ad [
263 92a9e85d 2021-09-24 thomas found_zlib=no
264 dd038bc6 2021-09-21 thomas.ad ]
265 dd038bc6 2021-09-21 thomas.ad )
266 dd038bc6 2021-09-21 thomas.ad
267 92a9e85d 2021-09-24 thomas if test "x$found_zlib" = "xno"; then
268 92a9e85d 2021-09-24 thomas AC_CHECK_HEADER(
269 92a9e85d 2021-09-24 thomas zlib.h,
270 92a9e85d 2021-09-24 thomas ,
271 92a9e85d 2021-09-24 thomas found_zlib=no)
272 92a9e85d 2021-09-24 thomas fi
273 dd038bc6 2021-09-21 thomas.ad
274 92a9e85d 2021-09-24 thomas if test "x$found_zlib" = "xno"; then
275 92a9e85d 2021-09-24 thomas AC_MSG_ERROR("*** couldn't find zlib ***")
276 92a9e85d 2021-09-24 thomas fi
277 dd038bc6 2021-09-21 thomas.ad
278 92a9e85d 2021-09-24 thomas if test "$PLATFORM" = "linux"; then
279 92a9e85d 2021-09-24 thomas PKG_CHECK_MODULES(
280 92a9e85d 2021-09-24 thomas LIBMD,
281 92a9e85d 2021-09-24 thomas libmd,
282 92a9e85d 2021-09-24 thomas [
283 92a9e85d 2021-09-24 thomas AM_CFLAGS="$LIBMD_CFLAGS $AM_CFLAGS"
284 92a9e85d 2021-09-24 thomas CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
285 92a9e85d 2021-09-24 thomas LIBS="$LIBMD_LIBS $LIBS"
286 92a9e85d 2021-09-24 thomas ],
287 92a9e85d 2021-09-24 thomas [
288 92a9e85d 2021-09-24 thomas AC_MSG_ERROR("*** couldn't find libmd via pkg-config")
289 92a9e85d 2021-09-24 thomas ]
290 92a9e85d 2021-09-24 thomas )
291 92a9e85d 2021-09-24 thomas PKG_CHECK_MODULES(
292 92a9e85d 2021-09-24 thomas LIBBSD,
293 92a9e85d 2021-09-24 thomas libbsd-overlay,
294 92a9e85d 2021-09-24 thomas [
295 92a9e85d 2021-09-24 thomas AM_CFLAGS="$LIBBSD_CFLAGS $AM_CFLAGS"
296 92a9e85d 2021-09-24 thomas CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
297 92a9e85d 2021-09-24 thomas LIBS="$LIBBSD_LIBS $LIBS"
298 92a9e85d 2021-09-24 thomas found_libbsd=yes
299 92a9e85d 2021-09-24 thomas AC_DEFINE(HAVE_LIBBSD)
300 92a9e85d 2021-09-24 thomas ],
301 92a9e85d 2021-09-24 thomas []
302 92a9e85d 2021-09-24 thomas )
303 92a9e85d 2021-09-24 thomas fi
304 92a9e85d 2021-09-24 thomas
305 dd038bc6 2021-09-21 thomas.ad # Look for a suitable queue.h. We hope libbsd is enough, but that is missing
306 dd038bc6 2021-09-21 thomas.ad # SIMPLEQ.
307 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
308 dd038bc6 2021-09-21 thomas.ad SIMPLEQ_INIT,
309 dd038bc6 2021-09-21 thomas.ad found_queue_h=yes,
310 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
311 dd038bc6 2021-09-21 thomas.ad [#include <sys/queue.h>]
312 dd038bc6 2021-09-21 thomas.ad )
313 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
314 dd038bc6 2021-09-21 thomas.ad TAILQ_CONCAT,
315 dd038bc6 2021-09-21 thomas.ad found_queue_h=yes,
316 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
317 dd038bc6 2021-09-21 thomas.ad [#include <sys/queue.h>]
318 dd038bc6 2021-09-21 thomas.ad )
319 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
320 dd038bc6 2021-09-21 thomas.ad TAILQ_PREV,
321 dd038bc6 2021-09-21 thomas.ad found_queue_h=yes,
322 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
323 dd038bc6 2021-09-21 thomas.ad [#include <sys/queue.h>]
324 dd038bc6 2021-09-21 thomas.ad )
325 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
326 dd038bc6 2021-09-21 thomas.ad TAILQ_REPLACE,
327 dd038bc6 2021-09-21 thomas.ad found_queue_h=yes,
328 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
329 dd038bc6 2021-09-21 thomas.ad [#include <sys/queue.h>]
330 dd038bc6 2021-09-21 thomas.ad )
331 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
332 dd038bc6 2021-09-21 thomas.ad SIMPLEQ_ENTRY,
333 dd038bc6 2021-09-21 thomas.ad ,
334 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
335 dd038bc6 2021-09-21 thomas.ad [#include <sys/queue.h>]
336 dd038bc6 2021-09-21 thomas.ad )
337 dd038bc6 2021-09-21 thomas.ad AC_CHECK_DECL(
338 dd038bc6 2021-09-21 thomas.ad TAILQ_FOREACH_SAFE,
339 dd038bc6 2021-09-21 thomas.ad ,
340 dd038bc6 2021-09-21 thomas.ad found_queue_h=no,
341 dd038bc6 2021-09-21 thomas.ad [#include <sys/queue.h>]
342 dd038bc6 2021-09-21 thomas.ad )
343 dd038bc6 2021-09-21 thomas.ad if test "x$found_queue_h" = xyes; then
344 dd038bc6 2021-09-21 thomas.ad AC_DEFINE(HAVE_QUEUE_H)
345 dd038bc6 2021-09-21 thomas.ad fi
346 dd038bc6 2021-09-21 thomas.ad
347 dd038bc6 2021-09-21 thomas.ad # Look for __progname.
348 dd038bc6 2021-09-21 thomas.ad AC_MSG_CHECKING(for __progname)
349 dd038bc6 2021-09-21 thomas.ad AC_LINK_IFELSE([AC_LANG_SOURCE(
350 dd038bc6 2021-09-21 thomas.ad [
351 dd038bc6 2021-09-21 thomas.ad #include <stdio.h>
352 dd038bc6 2021-09-21 thomas.ad #include <stdlib.h>
353 dd038bc6 2021-09-21 thomas.ad extern char *__progname;
354 dd038bc6 2021-09-21 thomas.ad int main(void) {
355 dd038bc6 2021-09-21 thomas.ad const char *cp = __progname;
356 dd038bc6 2021-09-21 thomas.ad printf("%s\n", cp);
357 dd038bc6 2021-09-21 thomas.ad exit(0);
358 dd038bc6 2021-09-21 thomas.ad }
359 dd038bc6 2021-09-21 thomas.ad ])],
360 dd038bc6 2021-09-21 thomas.ad [AC_DEFINE(HAVE___PROGNAME) AC_MSG_RESULT(yes)],
361 dd038bc6 2021-09-21 thomas.ad AC_MSG_RESULT(no)
362 dd038bc6 2021-09-21 thomas.ad )
363 dd038bc6 2021-09-21 thomas.ad
364 92a9e85d 2021-09-24 thomas if test "$PLATFORM" = "linux"; then
365 92a9e85d 2021-09-24 thomas PKG_CHECK_MODULES(
366 92a9e85d 2021-09-24 thomas LIBPANELW,
367 92a9e85d 2021-09-24 thomas panelw,
368 92a9e85d 2021-09-24 thomas found_panel=yes,
369 92a9e85d 2021-09-24 thomas AC_MSG_ERROR("*** couldn't find -lpanel from ncurses")
370 92a9e85d 2021-09-24 thomas )
371 92a9e85d 2021-09-24 thomas else
372 92a9e85d 2021-09-24 thomas AC_CHECK_LIB(panelw, update_panels,,
373 92a9e85d 2021-09-24 thomas AC_MSG_ERROR([ "*** panelw not found for ncurses. ***"])
374 92a9e85d 2021-09-24 thomas )
375 acf52a76 2021-09-21 thomas.ad
376 92a9e85d 2021-09-24 thomas LIBPANELW_LIBS="-lpanelw"
377 92a9e85d 2021-09-24 thomas fi
378 92a9e85d 2021-09-24 thomas
379 acf52a76 2021-09-21 thomas.ad PKG_CHECK_MODULES(
380 acf52a76 2021-09-21 thomas.ad LIBNCURSES,
381 acf52a76 2021-09-21 thomas.ad ncursesw,
382 dd038bc6 2021-09-21 thomas.ad found_ncurses=yes,
383 dd038bc6 2021-09-21 thomas.ad found_ncurses=no
384 dd038bc6 2021-09-21 thomas.ad )
385 acf52a76 2021-09-21 thomas.ad if test "x$found_ncurses" = xyes; then
386 acf52a76 2021-09-21 thomas.ad AM_CFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $LIBPANELW_CFLAGS $AM_CFLAGS"
387 acf52a76 2021-09-21 thomas.ad CFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $LIBPANELW_CFLAGS $CFLAGS"
388 acf52a76 2021-09-21 thomas.ad LIBS="$LIBNCURSES_LIBS $LIBTINFO_LIBS $LIBPANELW_LIBS $LIBS"
389 dd038bc6 2021-09-21 thomas.ad else
390 dd038bc6 2021-09-21 thomas.ad AC_CHECK_LIB(
391 acf52a76 2021-09-21 thomas.ad ncursesw,
392 dd038bc6 2021-09-21 thomas.ad setupterm,
393 dd038bc6 2021-09-21 thomas.ad found_ncurses=yes,
394 dd038bc6 2021-09-21 thomas.ad found_ncurses=no
395 dd038bc6 2021-09-21 thomas.ad )
396 dd038bc6 2021-09-21 thomas.ad if test "x$found_ncurses" = xyes; then
397 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADER(
398 dd038bc6 2021-09-21 thomas.ad ncurses.h,
399 acf52a76 2021-09-21 thomas.ad AM_CFLAGS="$LIBPANELW_CFLAGS $AM_CFLAGS"
400 acf52a76 2021-09-21 thomas.ad CFLAGS="$LIBPANEL_CFLAGS $CFLAGS"
401 acf52a76 2021-09-21 thomas.ad LIBS="$LIBS -lncursesw $LIBPANELW_LIBS",
402 acf52a76 2021-09-21 thomas.ad found_ncurses=no
403 acf52a76 2021-09-21 thomas.ad )
404 92a9e85d 2021-09-24 thomas fi
405 dd038bc6 2021-09-21 thomas.ad fi
406 dd038bc6 2021-09-21 thomas.ad if test "x$found_ncurses" = xyes; then
407 dd038bc6 2021-09-21 thomas.ad AC_DEFINE(HAVE_NCURSES_H)
408 dd038bc6 2021-09-21 thomas.ad else
409 dd038bc6 2021-09-21 thomas.ad # No ncurses, try curses.
410 dd038bc6 2021-09-21 thomas.ad AC_CHECK_LIB(
411 acf52a76 2021-09-21 thomas.ad cursesw,
412 dd038bc6 2021-09-21 thomas.ad setupterm,
413 dd038bc6 2021-09-21 thomas.ad found_curses=yes,
414 dd038bc6 2021-09-21 thomas.ad found_curses=no
415 dd038bc6 2021-09-21 thomas.ad )
416 dd038bc6 2021-09-21 thomas.ad AC_CHECK_HEADER(
417 dd038bc6 2021-09-21 thomas.ad curses.h,
418 dd038bc6 2021-09-21 thomas.ad ,
419 dd038bc6 2021-09-21 thomas.ad found_curses=no)
420 dd038bc6 2021-09-21 thomas.ad if test "x$found_curses" = xyes; then
421 acf52a76 2021-09-21 thomas.ad AM_CFLAGS="$LIBPANELW_CFLAGS $AM_CFLAGS"
422 acf52a76 2021-09-21 thomas.ad CFLAGS="$LIBPANEL_CFLAGS $CFLAGS"
423 acf52a76 2021-09-21 thomas.ad LIBS="$LIBS -lcursesw $LIBPANELW_LIBS"
424 dd038bc6 2021-09-21 thomas.ad AC_DEFINE(HAVE_CURSES_H)
425 dd038bc6 2021-09-21 thomas.ad else
426 dd038bc6 2021-09-21 thomas.ad AC_MSG_ERROR("curses not found")
427 dd038bc6 2021-09-21 thomas.ad fi
428 dd038bc6 2021-09-21 thomas.ad fi
429 dd038bc6 2021-09-21 thomas.ad
430 dd038bc6 2021-09-21 thomas.ad # Save our CFLAGS/CPPFLAGS/LDFLAGS for the Makefile and restore the old user
431 dd038bc6 2021-09-21 thomas.ad # variables.
432 dd038bc6 2021-09-21 thomas.ad AC_SUBST(AM_CPPFLAGS)
433 dd038bc6 2021-09-21 thomas.ad CPPFLAGS="$SAVED_CPPFLAGS"
434 dd038bc6 2021-09-21 thomas.ad AC_SUBST(AM_CFLAGS)
435 dd038bc6 2021-09-21 thomas.ad CFLAGS="$SAVED_CFLAGS"
436 dd038bc6 2021-09-21 thomas.ad AC_SUBST(AM_LDFLAGS)
437 dd038bc6 2021-09-21 thomas.ad LDFLAGS="$SAVED_LDFLAGS"
438 dd038bc6 2021-09-21 thomas.ad
439 dd038bc6 2021-09-21 thomas.ad AC_CONFIG_FILES([Makefile
440 dd038bc6 2021-09-21 thomas.ad compat/Makefile
441 dd038bc6 2021-09-21 thomas.ad libexec/Makefile
442 dd038bc6 2021-09-21 thomas.ad libexec/got-read-tree/Makefile
443 dd038bc6 2021-09-21 thomas.ad libexec/got-fetch-pack/Makefile
444 dd038bc6 2021-09-21 thomas.ad libexec/got-index-pack/Makefile
445 dd038bc6 2021-09-21 thomas.ad libexec/got-read-blob/Makefile
446 dd038bc6 2021-09-21 thomas.ad libexec/got-read-commit/Makefile
447 dd038bc6 2021-09-21 thomas.ad libexec/got-read-gitconfig/Makefile
448 dd038bc6 2021-09-21 thomas.ad libexec/got-read-gotconfig/Makefile
449 dd038bc6 2021-09-21 thomas.ad libexec/got-read-object/Makefile
450 dd038bc6 2021-09-21 thomas.ad libexec/got-read-pack/Makefile
451 dd038bc6 2021-09-21 thomas.ad libexec/got-read-tag/Makefile
452 dd038bc6 2021-09-21 thomas.ad libexec/got-send-pack/Makefile
453 dd038bc6 2021-09-21 thomas.ad got/Makefile
454 2b0eee35 2021-09-21 thomas.ad gotadmin/Makefile
455 d3f2ad5e 2021-09-21 thomas.ad tog/Makefile
456 d3f2ad5e 2021-09-21 thomas.ad regress/cmdline/Makefile.linux:regress/cmdline/Makefile.am])
457 dd038bc6 2021-09-21 thomas.ad AC_OUTPUT
458 dd038bc6 2021-09-21 thomas.ad
459 dd038bc6 2021-09-21 thomas.ad # tog/GNUMakefile])
460 dd038bc6 2021-09-21 thomas.ad # regress/GNUMakefile
461 dd038bc6 2021-09-21 thomas.ad # regress/cmdline/GNUMakefile
462 dd038bc6 2021-09-21 thomas.ad # regress/delta/GNUMakefile
463 dd038bc6 2021-09-21 thomas.ad # regress/fetch/GNUMakefile
464 dd038bc6 2021-09-21 thomas.ad # regress/idset/GNUMakefile
465 dd038bc6 2021-09-21 thomas.ad # regress/path/GNUMakefile
466 dd038bc6 2021-09-21 thomas.ad # gotweb/GNUMakefile
467 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/GNUMakefile
468 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-blob/GNUMakefile
469 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-commit/GNUMakefile
470 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-gitconfig/GNUMakefile
471 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-gotconfig/GNUMakefile
472 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-object/GNUMakefile
473 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-pack/GNUMakefile
474 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-tag/GNUMakefile
475 dd038bc6 2021-09-21 thomas.ad # gotweb/libexec/got-read-tree/GNUMakefile