]> git.notmuchmail.org Git - notmuch/blob - contrib/notmuch-deliver/configure.ac
contrib: pick: add docstring for notmuch-pick-worker
[notmuch] / contrib / notmuch-deliver / configure.ac
1 dnl vim: set sw=4 sts=4 ts=4 noet ft=config foldmethod=marker foldmarker={{{,}}} :
2
3 dnl {{{ Program, version
4 AC_PREREQ(2.59)
5 AC_INIT([src/main.c])
6 AC_CANONICAL_SYSTEM
7
8 VERSION_MAJOR=0
9 VERSION_MINOR=1
10 VERSION_FULL="$VERSION_MAJOR.$VERSION_MINOR"
11 VERSION="$VERSION_FULL"
12
13 AC_SUBST([VERSION_MAJOR])
14 AC_SUBST([VERSION_MINOR])
15 AC_SUBST([VERSION_FULL])
16
17 AM_INIT_AUTOMAKE(notmuch-deliver, [$VERSION_FULL])
18 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
19
20 dnl {{{ Git revision
21 AC_MSG_CHECKING([for git head])
22 if test -d "${GIT_DIR:-${ac_top_srcdir:-./}/.git}" ; then
23         GITHEAD=`git describe 2>/dev/null`
24         if test -z ${GITHEAD} ; then
25                 GITHEAD=`git rev-parse HEAD`
26         fi
27         if test -n "`git diff-index -m --name-only HEAD`" ; then
28                 GITHEAD=${GITHEAD}-dirty
29         fi
30         if test -n "${GITHEAD}" ; then
31                 GITHEAD="-${GITHEAD}"
32         fi
33 fi
34 AC_MSG_RESULT([$GITHEAD])
35 AC_SUBST([GITHEAD])
36 dnl }}}
37 dnl }}}
38
39 dnl {{{ Toolchain checks
40 AC_USE_SYSTEM_EXTENSIONS
41 AC_PROG_CC
42 AC_PROG_CC_C99
43 if test x"$ac_cv_prog_cc_c99" = x"no"; then
44         AC_MSG_ERROR([notmuch-deliver requires a C compiler that supports ISO C99!])
45 fi
46 AC_PROG_LIBTOOL
47 AC_PROG_LN_S
48 AC_PROG_INSTALL
49 AC_PROG_MAKE_SET
50 dnl }}}
51
52 dnl {{{ Check for headers
53 AC_HEADER_DIRENT
54 AC_HEADER_STDC
55 AC_HEADER_TIME
56 AC_HEADER_SYS_WAIT
57 AC_CHECK_HEADERS([sys/stat.h unistd.h sysexits.h utime.h])
58 dnl }}}
59
60 dnl {{{ Check for typedefs, structures and compiler characteristics
61 AC_C_CONST
62 AC_TYPE_OFF_T
63 AC_TYPE_SIZE_T
64 AC_TYPE_UID_T
65 AC_TYPE_PID_T
66 AC_STRUCT_TM
67 dnl }}}
68
69 dnl {{{ Check for library functions
70 AC_CHECK_FUNCS([setgroups initgroups symlink readlink strcasecmp utime utimes splice])
71 dnl }}}
72
73 dnl {{{ gethostname()
74 AC_CACHE_CHECK([for missing gethostname prototype],
75                            maildir_cv_SYS_GETHOSTNAME,
76                            AC_TRY_COMPILE([
77 #ifdef HAVE_UNISTD_H
78 #include        <unistd.h>
79 #endif
80
81 int gethostname(int,int);
82 ],,[maildir_cv_SYS_GETHOSTNAME=yes], [maildir_cv_SYS_GETHOSTNAME=no]))
83
84 if test x"$maildir_cv_SYS_GETHOSTNAME" = x"no" ; then
85         AC_DEFINE_UNQUOTED(HAS_GETHOSTNAME, 1, [Whether gethostname() is prototyped])
86 fi
87 dnl }}}
88
89 dnl {{{ Check for maildir target separator
90 if test "$target_os" = "cygwin" ; then
91         AC_DEFINE_UNQUOTED(MDIRSEP, "!", [Maildir target separator])
92 else
93         AC_DEFINE_UNQUOTED(MDIRSEP, ":", [Maildir target separator])
94 fi
95 dnl }}}
96
97 dnl {{{ Make pkg-config work
98 PKG_PROG_PKG_CONFIG([0.9.0])
99 dnl }}}
100
101 dnl {{{ Check for libraries
102 GLIB_REQUIRED=2.16
103
104 PKG_CHECK_MODULES([glib], [glib-2.0 >= $GLIB_REQUIRED],,
105                                   [AC_MSG_ERROR([notmuch-deliver requires glib-$GLIB_REQUIRED or newer])])
106 AC_CHECK_LIB(notmuch, notmuch_database_create,,
107                          [AC_MSG_ERROR([notmuch-deliver requires notmuch mail indexing library])])
108 dnl }}}
109
110 dnl {{{ Extra CFLAGS
111 NOTMUCH_DELIVER_CFLAGS=
112 WANTED_CFLAGS="-Wall -W -Wextra -Wvla -Wformat=2 -Wformat-security -Wformat-nonliteral -Winit-self -Wfloat-equal -Wno-deprecated-declarations -Wmissing-declarations -Wmissing-noreturn -Wmissing-prototypes -Wredundant-decls  -Wshadow -Wpointer-arith -Wstrict-prototypes -Wcast-qual -Wwrite-strings -pedantic"
113 for flag in $WANTED_CFLAGS ; do
114         AX_CHECK_COMPILER_FLAGS([$flag], [NOTMUCH_DELIVER_CFLAGS="$NOTMUCH_DELIVER_CFLAGS $flag"],)
115 done
116 dnl }}}
117
118 dnl {{{ Profiling
119 AC_MSG_CHECKING([whether gprof symbols are wanted])
120 AC_ARG_ENABLE([gprof],
121                           [AS_HELP_STRING([--enable-gprof],
122                                                           [Add gprof symbols (-pg) (for debugging)])],
123                           PROFILE="$enableval",
124                           PROFILE="no")
125 AC_MSG_RESULT([$PROFILE])
126 if test x"$PROFILE" = x"yes" ; then
127         AX_CHECK_COMPILER_FLAGS([-pg],, AC_MSG_ERROR([Your compiler doesn't support -pg flag]))
128         NOTMUCH_DELIVER_CFLAGS="$NOTMUCH_DELIVER_CFLAGS -pg"
129         LDFLAGS="$LDFLAGS -pg"
130 fi
131 AC_MSG_CHECKING([whether coverage testing should be enabled])
132 AC_ARG_ENABLE([gcov],
133                           [AS_HELP_STRING([--enable-gcov],
134                                                           [add gcov support (for debugging)])],
135                           COVERAGE="$enableval",
136                           COVERAGE="no")
137 AC_MSG_RESULT([$COVERAGE])
138 if test x"$COVERAGE" = x"yes" ; then
139         AX_CHECK_COMPILER_FLAGS([-fprofile-arcs],,
140                                                         AC_MSG_ERROR([Your compiler doesn't support -fprofile-arcs flag]))
141         AX_CHECK_COMPILER_FLAGS([-ftest-coverage],,
142                                                         AC_MSG_ERROR([Your compiler doesn't support -ftest-coverage flag]))
143         NOTMUCH_DELIVER_CFLAGS="$NOTMUCH_DELIVER_CFLAGS -fprofile-arcs -ftest-coverage"
144 fi
145 AC_SUBST([NOTMUCH_DELIVER_CFLAGS])
146 dnl }}}
147
148 dnl {{{ Output
149 AC_CONFIG_HEADERS([config.h])
150 AC_CONFIG_LINKS([maildrop/numlib/config.h:config.h])
151 AC_OUTPUT(
152                   Makefile
153                   maildrop/numlib/Makefile
154                   src/Makefile
155                   )
156 dnl }}}