Blob


1 AC_INIT([telescope], [0.3], [telescope@omarpolo.com], [telescope], [gemini://telescope.omarpolo.com])
2 AC_CONFIG_LIBOBJ_DIR(compat)
3 AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
4 AC_PROG_CC_C99
5 AC_USE_SYSTEM_EXTENSIONS
6 AC_PROG_YACC
8 PKG_PROG_PKG_CONFIG
10 AC_REPLACE_FUNCS([
11 asprintf \
12 err \
13 freezero \
14 getdtablecount \
15 getdtablesize \
16 getprogname \
17 memmem \
18 recallocarray \
19 strcasestr \
20 strlcat \
21 strlcpy \
22 strsep \
23 strtonum \
24 setproctitle \
25 ])
27 AC_MSG_CHECKING([for sys/queue.h with TAILQ_FOREACH_SAFE])
28 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
29 #include <sys/queue.h>
30 #include <stddef.h>
31 ], [
32 TAILQ_HEAD(tailhead, entry) head;
33 struct entry {
34 TAILQ_ENTRY(entry) entries;
35 } *np, *nt;
36 TAILQ_INIT(&head);
37 TAILQ_FOREACH_SAFE(np, &head, entries, nt) {
38 /* nop */ ;
39 }
40 return 0;
41 ])], [
42 AC_MSG_RESULT(yes)
43 AC_DEFINE([HAVE_QUEUE_H], 1, [QUEUE_H])
44 ], AC_MSG_RESULT(no))
46 AC_CHECK_DECL(PR_SET_NAME, AC_DEFINE([HAVE_PR_SET_NAME], 1, [pr_set_name]), [],
47 [[#include <sys/prctl.h>]])
49 AC_SEARCH_LIBS([initscr], [ncursesw ncurses], [], [
50 AC_MSG_ERROR([requires either ncursesw or ncurses library])
51 ])
53 AC_CHECK_LIB(tls, tls_init, [], [
54 AC_MSG_ERROR([requires libtls])
55 ])
57 AC_CHECK_LIB(event, event_init, [], [
58 AC_MSG_ERROR([requires libevent])
59 ])
61 AC_CHECK_LIB(util, imsg_init, [], [
62 AC_LIBOBJ(imsg)
63 AC_LIBOBJ(imsg-buffer)
64 AC_LIBOBJ(ohash)
65 AC_LIBOBJ(fmt_scaled)
66 ])
68 AC_CHECK_FUNCS([asr_run])
70 # check compiler flags
71 AC_DEFUN([CC_ADD_CHECK_FLAGS], [
72 AC_MSG_CHECKING([if $CC supports $1 flag])
73 old_CFLAGS="$CFLAGS"
74 CFLAGS="$CFLAGS $1"
75 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
76 AC_MSG_RESULT(yes),
77 AC_MSG_RESULT(no)
78 CFLAGS="$old_CFLAGS")
79 ])
80 CC_ADD_CHECK_FLAGS([-Wall])
81 CC_ADD_CHECK_FLAGS([-Wextra])
82 CC_ADD_CHECK_FLAGS([-Wmissing-prototypes])
83 CC_ADD_CHECK_FLAGS([-Wstrict-prototypes])
84 CC_ADD_CHECK_FLAGS([-Wwrite-strings])
85 CC_ADD_CHECK_FLAGS([-Wno-unused-parameter])
87 AC_CONFIG_HEADERS([config.h])
88 AC_CONFIG_FILES([
89 Makefile
90 ])
92 AC_OUTPUT