1 dnl vim: set sw=4 sts=4 ts=4 noet ft=config foldmethod=marker foldmarker={{{,}}} :
3 dnl {{{ Program, version
10 VERSION_FULL="$VERSION_MAJOR.$VERSION_MINOR"
11 VERSION="$VERSION_FULL"
13 AC_SUBST([VERSION_MAJOR])
14 AC_SUBST([VERSION_MINOR])
15 AC_SUBST([VERSION_FULL])
17 AM_INIT_AUTOMAKE(notmuch-deliver, [$VERSION_FULL])
18 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
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`
27 if test -n "`git diff-index -m --name-only HEAD`" ; then
28 GITHEAD=${GITHEAD}-dirty
30 if test -n "${GITHEAD}" ; then
34 AC_MSG_RESULT([$GITHEAD])
39 dnl {{{ Toolchain checks
40 AC_USE_SYSTEM_EXTENSIONS
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!])
52 dnl {{{ Check for headers
57 AC_CHECK_HEADERS([sys/stat.h unistd.h sysexits.h utime.h])
60 dnl {{{ Check for typedefs, structures and compiler characteristics
69 dnl {{{ Check for library functions
70 AC_CHECK_FUNCS([setgroups initgroups symlink readlink strcasecmp utime utimes splice])
74 AC_CACHE_CHECK([for missing gethostname prototype],
75 maildir_cv_SYS_GETHOSTNAME,
81 int gethostname(int,int);
82 ],,[maildir_cv_SYS_GETHOSTNAME=yes], [maildir_cv_SYS_GETHOSTNAME=no]))
84 if test x"$maildir_cv_SYS_GETHOSTNAME" = x"no" ; then
85 AC_DEFINE_UNQUOTED(HAS_GETHOSTNAME, 1, [Whether gethostname() is prototyped])
89 dnl {{{ Check for maildir target separator
90 if test "$target_os" = "cygwin" ; then
91 AC_DEFINE_UNQUOTED(MDIRSEP, "!", [Maildir target separator])
93 AC_DEFINE_UNQUOTED(MDIRSEP, ":", [Maildir target separator])
97 dnl {{{ Make pkg-config work
98 PKG_PROG_PKG_CONFIG([0.9.0])
101 dnl {{{ Check for libraries
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])])
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"],)
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",
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"
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",
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"
145 AC_SUBST([NOTMUCH_DELIVER_CFLAGS])
149 AM_CONFIG_HEADER(config.h)