1## Copyright (C) 2008-2021 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> 2## 3## This program is free software; you can redistribute it and/or modify 4## it under the terms of the GNU General Public License as published by 5## the Free Software Foundation; either version 3 of the License, or 6## (at your option) any later version. 7## 8## This program is distributed in the hope that it will be useful, 9## but WITHOUT ANY WARRANTY; without even the implied warranty of 10## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11## GNU General Public License for more details. 12## 13## You should have received a copy of the GNU General Public License 14## along with this program; if not, write to the Free Software Foundation, 15## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 16 17AC_PREREQ([2.68]) 18AC_INIT([mu],[1.6.4],[https://github.com/djcb/mu/issues],[mu]) 19AC_COPYRIGHT([Copyright (C) 2008-2021 Dirk-Jan C. Binnema]) 20AC_CONFIG_HEADERS([config.h]) 21AC_CONFIG_SRCDIR([mu/mu.cc]) 22# libtoolize wants to put some stuff in here; if you have an old 23# autotools/libtool setup. you can try to comment this out 24AC_CONFIG_MACRO_DIR([m4]) 25AC_CONFIG_AUX_DIR([build-aux]) 26 27AM_INIT_AUTOMAKE([1.14 foreign no-dist-gzip tar-ustar dist-xz]) 28 29# silent build if we have a new enough automake 30m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 31 32AS_IF([test x$prefix = xNONE],[prefix=/usr/local]) 33AC_SUBST(prefix) 34 35# AC_PROG_CXX *before* AC_PROG_CC, otherwise configure won't error out 36# when a c++ compiler is not found. Weird, huh? 37AC_PROG_CXX 38AC_PROG_CC 39AC_PROG_CPP 40AC_PROG_CC_STDC 41AC_PROG_CC_C99 42AC_PROG_INSTALL 43AC_HEADER_STDC 44 45extra_flags="-Wformat-security \ 46 -Wstack-protector \ 47 -Wstack-protector-all \ 48 -Wno-cast-function-type \ 49 -Wno-bad-function-cast" 50 51AX_CXX_COMPILE_STDCXX_14 52AX_COMPILER_FLAGS_CXXFLAGS([],[],[${extra_cflags}]) 53AX_APPEND_COMPILE_FLAGS([-Wno-inline ],[CXXFLAGS]) 54AX_VALGRIND_CHECK 55 56LT_INIT 57 58AX_CODE_COVERAGE 59 60AC_PROG_AWK 61AC_CHECK_PROG(SORT,sort,sort) 62 63AC_CHECK_HEADERS([wordexp.h]) 64 65# use the 64-bit versions 66AC_SYS_LARGEFILE 67 68# asan is somewhat similar to valgrind, but has low enough overhead so it 69# can be used during normal operation. 70AC_ARG_ENABLE([asan],[AS_HELP_STRING([--enable-asan], 71 [Enable Address Sanitizer])], [use_asan=$enableval], [use_asan=no]) 72AS_IF([test "x$use_asan" = "xyes"],[ 73 AC_SUBST(ASAN_CFLAGS, "-fsanitize=address -static-libasan -fno-omit-frame-pointer") 74 AC_SUBST(ASAN_CXXFLAGS,"-fsanitize=address -static-libasan -fno-omit-frame-pointer") 75 AC_SUBST(ASAN_LDFLAGS, "-fsanitize=address -static-libasan -fno-omit-frame-pointer") 76]) 77 78 79# check for makeinfo 80AC_CHECK_PROG(have_makeinfo,makeinfo,yes,no) 81AM_CONDITIONAL(HAVE_MAKEINFO,test "x$have_makeinfo" = "xyes") 82AM_COND_IF(HAVE_MAKEINFO,[],[ 83 # seems build *insists* on trying to makeinfo, erroring out 84 # if it does not exist. Let's work around that. 85 AC_SUBST(MAKEINFO,[true]) 86]) 87 88# we need emacs for byte-compiling mu4e 89build_mu4e=no 90AC_ARG_ENABLE([mu4e], 91 AS_HELP_STRING([--disable-mu4e],[Disable building mu4e])) 92AS_IF([test "x$enable_mu4e" != "xno"], [ 93 AM_PATH_LISPDIR 94 AS_IF([test "x$lispdir" != "xno"], [ 95 emacs_version="$($EMACS --version | head -1)" 96 lispdir="${lispdir}/mu4e/" 97 ]) 98 AS_CASE([$emacs_version], 99 [*25.3*],[build_mu4e=yes], 100 [*26*|*27*|*28*],[build_mu4e=yes], 101 [AC_WARN([emacs is too old to build mu4e (need emacs >= 25.3)])]) 102]) 103AM_CONDITIONAL(BUILD_MU4E, test "x$build_mu4e" = "xyes") 104 105# we need some special tricks for filesystems that don't have d_type; 106# e.g. Solaris. See mu-maildir.c. Explicitly disabling it is for 107# testing purposes only 108AC_ARG_ENABLE([dirent-d-type], 109 AC_HELP_STRING([--disable-dirent-d-type], 110 [Don't use dirent->d_type, even if you have it]), 111 [], [AC_STRUCT_DIRENT_D_TYPE] 112) 113AS_IF([test "x$ac_cv_member_struct_dirent_d_type" != "xyes"], 114 [use_dirent_d_type="no"], [use_dirent_d_type="yes"]) 115 116# support for d_ino (inode) in struct dirent is optional; if it's 117# available we can sort direntries by inode and access them in that 118# order; this is much faster on some file systems (such as extfs3). 119# Explicitly disabling it is for testing purposes only. 120AC_ARG_ENABLE([dirent-d-ino], 121 AC_HELP_STRING([--disable-dirent-d-ino], 122 [Don't use dirent->d_ino, even if you have it]), 123 [], [AC_STRUCT_DIRENT_D_INO] 124) 125AS_IF([test "x$ac_cv_member_struct_dirent_d_ino" != "xyes"], 126 [use_dirent_d_ino="no"], [use_dirent_d_ino="yes"]) 127 128AC_CHECK_FUNCS([memset memcpy realpath setlocale strerror getpass setsid]) 129AC_CHECK_FUNCS([vasprintf strptime]) 130# timegm is no longer used in the source 131# AC_CHECK_FUNC(timegm,[],AC_MSG_ERROR([missing required function timegm])) 132 133# require pkg-config >= 0.28 (release in 2013; should be old enough...) 134# with that version, we don't need the AC_SUBST stuff after PKG_CHECK. 135m4_ifndef([PKG_PROG_PKG_CONFIG], 136 [m4_fatal([please install pkg-config >= 0.28 before running autoconf/autogen])]) 137PKG_PROG_PKG_CONFIG(0.28) # latest version in buildroot 138AS_IF([test -z "$PKG_CONFIG"], 139 AC_MSG_ERROR([ 140 *** pkg-config with version >= 0.28 could not be found. 141 *** 142 *** Make sure it is in your path, or set the PKG_CONFIG environment variable 143 *** to the full path to pkg-config.]) 144) 145 146# glib2? 147PKG_CHECK_MODULES(GLIB,glib-2.0 >= 2.50 gobject-2.0 gio-2.0) 148glib_version="$($PKG_CONFIG --modversion glib-2.0)" 149 150# gmime, version 3.0 or higher 151PKG_CHECK_MODULES(GMIME,gmime-3.0) 152gmime_version="$($PKG_CONFIG --modversion gmime-3.0)" 153 154# xapian checking - we need 1.4 at least 155PKG_CHECK_MODULES(XAPIAN,xapian-core >= 1.4,[ 156 have_xapian=yes 157 xapian_version=$($PKG_CONFIG xapian-core --modversion) 158 AC_SUBST(XAPIAN_CXXFLAGS,${XAPIAN_CFLAGS}) 159],[ 160 # fall back to the xapian-config script. Not sure if there are cases where the 161 # pkgconfig does not work, but xapian-config does, so keep this for now. 162 AC_MSG_NOTICE([falling back to xapian-config]) 163 AC_CHECK_PROG(XAPIAN_CONFIG,xapian-config,xapian-config,no) 164 AS_IF([test "x$XAPIAN_CONFIG" = "xno"],[ 165 AC_MSG_ERROR([ 166 *** xapian could not be found; please install it 167 *** e.g., in debian/ubuntu the package would be 'libxapian-dev' 168 *** If you compiled it yourself, you should ensure that xapian-config 169 *** is in your PATH.])], 170 [xapian_version=$($XAPIAN_CONFIG --version | sed -e 's/.* //')]) 171 172 AS_CASE([$xapian_version], 173 [1.[[4-9]].[[0-9]]*], 174 [AC_MSG_NOTICE([xapian $xapian_version found.])], 175 [AC_MSG_ERROR([*** xapian version >= 1.4 needed, but version $xapian_version found.])]) 176 177 XAPIAN_CXXFLAGS="$($XAPIAN_CONFIG --cxxflags)" 178 XAPIAN_LIBS="$($XAPIAN_CONFIG --libs)" 179 have_xapian="yes" 180 181 AC_SUBST(XAPIAN_CXXFLAGS) 182 AC_SUBST(XAPIAN_LIBS) 183]) 184############################################################################### 185# we set the set the version of the MuStore (Xapian database) layout 186# here; it will become part of the db name, so we can automatically 187# recreate the database when we have incompatible changes. 188# 189# note that MU_STORE_SCHEMA_VERSION does not follow mu versioning, as we 190# hopefully don't have updates for each version; also, this has nothing to do 191# with Xapian's software version 192AC_DEFINE(MU_STORE_SCHEMA_VERSION,["452"],['Schema' version of the database]) 193############################################################################### 194 195############################################################################### 196# we need GTK+3 for some of the graphical tools 197# use --without-gtk to disable it 198AC_ARG_ENABLE([gtk],AS_HELP_STRING([--disable-gtk],[Disable GTK+])) 199AS_IF([test "x$enable_gtk" != "xno"],[ 200 PKG_CHECK_MODULES(GTK,gtk+-3.0,[have_gtk=yes],[have_gtk=no]) 201 gtk_version="$($PKG_CONFIG --modversion gtk+-3.0)" 202]) 203AM_CONDITIONAL(HAVE_GTK,[test "x$have_gtk" = "xyes"]) 204 205# webkit? needed for the fancy web widget 206# use --disable-webkit to disable it, even if you have it 207# 208# and note this is just a toy, not for distribution. 209AC_ARG_ENABLE([webkit],AS_HELP_STRING([--disable-webkit],[Disable webkit])) 210AS_IF([test "x$enable_webkit" != "xno"],[ 211 PKG_CHECK_MODULES(WEBKIT,webkit2gtk-4.0 >= 2.0, [have_webkit=yes],[have_webkit=no]) 212 AS_IF([test "x$have_webkit" = "xyes"],[ 213 webkit_version="$($PKG_CONFIG --modversion webkit2gtk-4.0)"]) 214]) 215AM_CONDITIONAL(HAVE_WEBKIT, [test "x$have_webkit" = "xyes"]) 216AM_CONDITIONAL(BUILD_GUI,[test "x$have_webkit" = "xyes" -a "x$have_gtk" = "xyes"]) 217############################################################################### 218 219################################################################################ 220# should we try to build an emacs dynamic module? 221#AC_CHECK_HEADER([emacs-module.h],[ 222# AC_DEFINE([HAVE_EMACS_MODULE_H],[1], [Whether we have the emacs-module header])], 223# AC_MSG_NOTICE([emacs-module.h not found; not building module]) 224#) 225#AM_CONDITIONAL([BUILD_EMACS_MODULE],[test "x$ac_cv_header_emacs_module_h" != "x"]) 226################################################################################ 227 228############################################################################### 229# build with guile 3.0/2.2 when available and not disabled. 230AC_ARG_ENABLE([guile], AS_HELP_STRING([--disable-guile],[Disable guile])) 231AS_IF([test "x$enable_guile" != "xno"],[ 232 233 PKG_CHECK_MODULES(GUILE, [guile-3.0], [have_guile=yes],[ 234 PKG_CHECK_MODULES(GUILE, [guile-2.2], [have_guile=yes], [have_guile=no])]) 235 AS_IF([test "x$have_guile" = "xyes"],[ 236 GUILE_PKG([3.0 2.2]) 237 GUILE_PROGS 238 GUILE_FLAGS 239 AC_DEFINE_UNQUOTED([GUILE_BINARY],"$GUILE",[guile binary]) 240 vsnarf=guile-snarf${GUILE_EFFECTIVE_VERSION} 241 AC_CHECK_PROGS(GUILE_SNARF,[${vsnarf} guile-snarf], [no]) 242 guile_version=$($PKG_CONFIG guile-$GUILE_EFFECTIVE_VERSION --modversion) 243 ]) 244]) 245 246AM_CONDITIONAL(BUILD_GUILE,[test "x$have_guile" = "xyes" -a \ 247 "x$ac_cv_prog_GUILE_SNARF" != "xno"]) 248AM_COND_IF([BUILD_GUILE],[AC_DEFINE(BUILD_GUILE,[1], [Do we support Guile?])]) 249############################################################################### 250 251############################################################################### 252# optional readline 253AC_ARG_ENABLE([readline], AS_HELP_STRING([--disable-readline],[Disable readline])) 254AS_IF([test "x$enable_readline" != "xno"], [ 255 saved_libs=$LIBS 256 AX_LIB_READLINE 257 AC_SUBST(READLINE_LIBS,${LIBS}) 258 LIBS=$saved_libs 259]) 260############################################################################### 261 262############################################################################### 263# check for makeinfo 264AC_CHECK_PROG(have_makeinfo,makeinfo,yes,no) 265AM_CONDITIONAL(HAVE_MAKEINFO, [test "x$have_makeinfo" = "xyes"]) 266############################################################################### 267 268############################################################################### 269# docdir, so we can use it in mu4e-meta.el.in 270AC_SUBST(MU_DOC_DIR, "${prefix}/share/doc/mu") 271############################################################################### 272 273AC_CONFIG_FILES([ 274Makefile 275mu/Makefile 276lib/Makefile 277lib/doxyfile 278lib/utils/Makefile 279lib/index/Makefile 280mu4e/Makefile 281mu4e/mu4e-meta.el 282guile/Makefile 283guile/mu/Makefile 284guile/examples/Makefile 285guile/tests/Makefile 286guile/scripts/Makefile 287toys/Makefile 288toys/mug/Makefile 289man/Makefile 290m4/Makefile 291contrib/Makefile 292]) 293AC_CONFIG_FILES([mu/mu-memcheck], [chmod +x mu/mu-memcheck]) 294 295AC_OUTPUT 296 297dnl toys/msg2pdf/Makefile 298 299echo 300echo "mu configuration is complete." 301echo "------------------------------------------------" 302 303echo "mu version : $VERSION" 304echo 305echo "Xapian version : $xapian_version" 306echo "GLib version : $glib_version" 307echo "GMime version : $gmime_version" 308 309AM_COND_IF([BUILD_GUI],[ 310echo "GTK+ version : $gtk_version" 311echo "Webkit2/GTK+ version : $webkit_version" 312]) 313 314AM_COND_IF([BUILD_GUILE],[ 315echo "Guile version : $guile_version" 316]) 317 318AS_IF([test "x$build_mu4e" = "xyes"],[ 319echo "Build mu4e : yes" 320echo "Emacs version : $emacs_version" 321#AM_COND_IF([BUILD_EMACS_MODULE],[ 322#echo "Build emacs module : yes"],[ 323#echo "Build emacs module : no" 324#])]) 325 326AM_COND_IF([BUILD_GUI],[ 327echo "Build 'mug' toy-ui (gtk+/webkit) : yes"],[ 328echo "Build 'mug' toy-ui (gtk+/webkit) : no" 329]) 330 331echo 332 333echo "Have direntry->d_ino : $use_dirent_d_ino" 334echo "Have direntry->d_type : $use_dirent_d_type" 335echo "------------------------------------------------" 336echo 337 338# 339# Warnings / notes 340# 341 342# makeinfo 343if test "x$have_makeinfo" != "xyes"; then 344 echo "* You do not seem to have the makeinfo program; if you are building from git" 345 echo " you need that to create documentation for guile and emacs. It is in the" 346 echo " texinfo package in debian/ubuntu/fedora/... " 347 echo 348fi 349 350# gui 351AS_IF([test "x$buildgui" = "xyes"],[ 352 echo "* The demo UI will be built in toys/mug" 353 echo 354]) 355 356# wordexp 357AS_IF([test "x$ac_cv_header_wordexp_h" != "xyes"],[ 358 echo "* Your system does not seem to have the 'wordexp' function." 359 echo " This means that you cannot use shell-like expansion in options and " 360 echo " some other places. So, for example, instead of" 361 echo " --maildir=~/Maildir" 362 echo " you should use the complete path, something like:" 363 echo " --maildir=/home/user/Maildir" 364]) 365 366echo 367echo "Now, type 'make' (or 'gmake') to build mu" 368echo 369