Blob


1 AC_INIT([telescope], [0.4.1-dev], [telescope@omarpolo.com], [telescope], [gemini://telescope.omarpolo.com])
2 AC_CONFIG_LIBOBJ_DIR(compat)
3 AC_CANONICAL_HOST
4 AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
5 AC_PROG_CC_C99
6 AC_USE_SYSTEM_EXTENSIONS
7 AC_PROG_YACC
9 PKG_PROG_PKG_CONFIG
11 AC_REPLACE_FUNCS([
12 asprintf \
13 err \
14 explicit_bzero \
15 freezero \
16 getdtablecount \
17 getdtablesize \
18 getprogname \
19 memmem \
20 recallocarray \
21 strcasestr \
22 strlcat \
23 strlcpy \
24 strsep \
25 strtonum \
26 setproctitle \
27 ])
29 AC_MSG_CHECKING([for sys/queue.h with TAILQ_FOREACH_SAFE])
30 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
31 #include <sys/queue.h>
32 #include <stddef.h>
33 ], [
34 TAILQ_HEAD(tailhead, entry) head;
35 struct entry {
36 TAILQ_ENTRY(entry) entries;
37 } *np, *nt;
38 TAILQ_INIT(&head);
39 TAILQ_FOREACH_SAFE(np, &head, entries, nt) {
40 /* nop */ ;
41 }
42 return 0;
43 ])], [
44 AC_MSG_RESULT(yes)
45 AC_DEFINE([HAVE_QUEUE_H], 1, [QUEUE_H])
46 ], AC_MSG_RESULT(no))
48 AC_CHECK_DECL(PR_SET_NAME, AC_DEFINE([HAVE_PR_SET_NAME], 1, [pr_set_name]), [],
49 [[#include <sys/prctl.h>]])
51 AC_SEARCH_LIBS([initscr], [ncursesw ncurses], [], [
52 AC_MSG_ERROR([requires either ncursesw or ncurses library])
53 ])
55 AC_SEARCH_LIBS([keyname], [ncursesw ncurses tinfow tinfo], [], [
56 AC_MSG_ERROR([requires either ncursesw or ncurses library with terminfo support])
57 ])
59 AC_CHECK_LIB(tls, tls_init, [], [
60 AC_MSG_ERROR([requires libtls])
61 ])
63 case "$host_os" in
64 *openbsd*)
65 AC_CHECK_LIB([event], [event_init], [],
66 [AC_MSG_ERROR([requires libevent])])
67 ;;
68 *)
69 PKG_CHECK_MODULES([libevent2], [libevent_core >= 2], [
70 AC_DEFINE([HAVE_EVENT2], 1, [1 if using event2])
71 CFLAGS="$libevent2_CFLAGS $CFLAGS"
72 LIBS="$libevent2_LIBS $LIBS"
73 ], [AC_MSG_ERROR([requires libevent])])
74 ;;
75 esac
77 AC_CHECK_LIB(util, imsg_init, [], [
78 AC_LIBOBJ(imsg)
79 AC_LIBOBJ(imsg-buffer)
80 AC_LIBOBJ(ohash)
81 AC_LIBOBJ(fmt_scaled)
82 ])
84 AC_CHECK_FUNCS([asr_run])
86 # check compiler flags
87 AC_DEFUN([CC_ADD_CHECK_FLAGS], [
88 AC_MSG_CHECKING([if $CC supports $1 flag])
89 old_CFLAGS="$CFLAGS"
90 CFLAGS="$CFLAGS $1"
91 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
92 AC_MSG_RESULT(yes),
93 AC_MSG_RESULT(no)
94 CFLAGS="$old_CFLAGS")
95 ])
96 CC_ADD_CHECK_FLAGS([-Wall])
97 CC_ADD_CHECK_FLAGS([-Wextra])
98 CC_ADD_CHECK_FLAGS([-Wmissing-prototypes])
99 CC_ADD_CHECK_FLAGS([-Wstrict-prototypes])
100 CC_ADD_CHECK_FLAGS([-Wwrite-strings])
101 CC_ADD_CHECK_FLAGS([-Wno-unused-parameter])
103 AC_CONFIG_HEADERS([config.h])
104 AC_CONFIG_FILES([
105 Makefile
106 pages/about_new.gmi
107 pages/about_crash.gmi
108 ])
110 AC_OUTPUT