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