3 # Set several defaults (optionally specified by the user in
4 # environemnt variables)
8 CXXFLAGS=${CXXFLAGS:-\$(CFLAGS)}
9 XAPIAN_CONFIG=${XAPIAN_CONFIG:-xapian-config-1.1 xapian-config}
11 # We don't allow the EMACS or GZIP Makefile variables inherit values
12 # from the environment as we do with CC and CXX above. The reason is
13 # that these names as environment variables have existing uses other
14 # than the program name that we want. (EMACS is set to 't' when a
15 # shell is running within emacs and GZIP specifies arguments to pass
16 # on the gzip command line).
18 # Set the defaults for values the user can specify with command-line
26 Usage: ./configure [options]...
28 This script configures notmuch to build on your system.
30 It verifies that dependencies are available, determines flags needed
31 to compile and link against various required libraries, and identifies
32 whether various system functions can be used or if locally-provided
33 replacements will be built instead.
35 Finally, it allows you to control various aspects of the build and
38 First, some common variables can specified via environment variables:
40 CC The C compiler to use
41 CFLAGS Flags to pass to the C compiler
42 CXX The C++ compiler to use
43 CXXFLAGS Flags to pass to the C compiler
44 LDFLAGS Flags to pass when linking
46 Each of these values can further be controlled by specifying them
47 later on the "make" command line.
49 Other environment variables can be used to control configure itself,
50 (and for which there is no equivalent build-time control):
52 XAPIAN_CONFIG The program to use to determine flags for
53 compiling and linking against the Xapian
54 library. [$XAPIAN_CONFIG]
56 Additionally, various options can be specified on the configure
59 --prefix=PREFIX Install files in PREFIX [$PREFIX]
61 By default, "make install" will install the resulting program to
62 $PREFIX/bin, documentation to $PREFIX/man, etc. You can
63 specify an installation prefix other than $PREFIX using
64 --prefix, for instance:
66 ./configure --prefix=\$HOME
68 Fine tuning of some installation directories is available:
70 --libdir=DIR Install libraries to DIR [PREFIX/lib]
71 --includedir=DIR Install header files to DIR [PREFIX/include]
72 --mandir=DIR Install man pages to DIR [PREFIX/share/man]
73 --sysconfdir=DIR Read-only single-machine data [PREFIX/etc]
75 Additional options are accepted for compatibility with other
76 configure-script calling conventions, but don't do anything yet:
78 --build=<cpu>-<vendor>-<os> Currently ignored
79 --infodir=DIR Currently ignored
80 --localstatedir=DIR Currently ignored
81 --libexecdir=DIR Currently ignored
82 --disable-maintainer-mode Currently ignored
83 --disable-dependency-tracking Currently ignored
88 # Parse command-line options
90 if [ "${option}" = '--help' ] ; then
93 elif [ "${option%%=*}" = '--prefix' ] ; then
95 elif [ "${option%%=*}" = '--libdir' ] ; then
97 elif [ "${option%%=*}" = '--includedir' ] ; then
98 INCLUDEDIR="${option#*=}"
99 elif [ "${option%%=*}" = '--mandir' ] ; then
100 MANDIR="${option#*=}"
101 elif [ "${option%%=*}" = '--sysconfdir' ] ; then
102 SYSCONFDIR="${option#*=}"
103 elif [ "${option%%=*}" = '--build' ] ; then
104 build_option="${option#*=}"
105 case ${build_option} in
108 echo "Unrecognized value for --build option: ${build_option}"
109 echo "Should be: <cpu>-<vendor>-<os>"
115 build_cpu=${build_option%%-*}
116 build_option=${build_option#*-}
117 build_vendor=${build_option%%-*}
118 build_os=${build_option#*-}
119 elif [ "${option%%=*}" = '--infodir' ] ; then
121 elif [ "${option%%=*}" = '--localstatedir' ] ; then
123 elif [ "${option%%=*}" = '--libexecdir' ] ; then
125 elif [ "${option}" = '--disable-maintainer-mode' ] ; then
127 elif [ "${option}" = '--disable-dependency-tracking' ] ; then
130 echo "Unrecognized option: ${option}"
139 Welcome to Notmuch, a system for indexing, searching and tagging your email.
141 We hope that the process of building and installing notmuch is quick
142 and smooth so that you can soon be reading and processing your email
143 more efficiently than ever.
145 If anything goes wrong in the configure process, you can override any
146 decisions it makes by manually editing the Makefile.config file that
147 it creates. Also please do as much as you can to figure out what could
148 be different on your machine compared to those of the notmuch
149 developers. Then, please email those details to the Notmuch list
150 (notmuch@notmuchmail.org) so that we can hopefully make future
151 versions of notmuch easier for you to use.
153 We'll now investigate your system to verify that all required
154 dependencies are available:
160 if pkg-config --version > /dev/null 2>&1; then
166 printf "Checking for Xapian development files... "
168 for xapian_config in ${XAPIAN_CONFIG}; do
169 if ${xapian_config} --version > /dev/null 2>&1; then
172 xapian_cxxflags=$(${xapian_config} --cxxflags)
173 xapian_ldflags=$(${xapian_config} --libs)
177 if [ ${have_xapian} = "0" ]; then
179 errors=$((errors + 1))
182 printf "Checking for GMime 2.4 development files... "
183 if pkg-config --modversion gmime-2.4 > /dev/null 2>&1; then
186 gmime_cflags=$(pkg-config --cflags gmime-2.4)
187 gmime_ldflags=$(pkg-config --libs gmime-2.4)
191 errors=$((errors + 1))
194 printf "Checking for talloc development files... "
195 if pkg-config --modversion talloc > /dev/null 2>&1; then
198 talloc_cflags=$(pkg-config --cflags talloc)
199 talloc_ldflags=$(pkg-config --libs talloc)
204 errors=$((errors + 1))
207 printf "Checking for valgrind development files... "
208 if pkg-config --modversion valgrind > /dev/null 2>&1; then
211 valgrind_cflags=$(pkg-config --cflags valgrind)
213 printf "No (but that's fine).\n"
217 if pkg-config --modversion emacs > /dev/null 2>&1; then
218 emacs_lispdir=$(pkg-config emacs --variable sitepkglispdir)
220 emacs_lispdir='$(prefix)/share/emacs/site-lisp'
223 printf "Checking if emacs is available... "
224 if emacs --quick --batch > /dev/null 2>&1; then
228 printf "No (so will not byte-compile emacs code)\n"
232 if [ $errors -gt 0 ]; then
235 *** Error: The dependencies of notmuch could not be satisfied. You will
236 need to install the following packages before being able to compile
240 if [ $have_xapian -eq 0 ]; then
241 echo " Xapian library (including development files such as headers)"
242 echo " http://xapian.org/"
244 if [ $have_gmime -eq 0 ]; then
245 echo " GMime 2.4 library (including development files such as headers)"
246 echo " http://spruce.sourceforge.net/gmime/"
248 if [ $have_talloc -eq 0 ]; then
249 echo " The talloc library (including development files such as headers)"
250 echo " http://talloc.samba.org/"
254 With any luck, you're using a modern, package-based operating system
255 that has all of these packages available in the distribution. In that
256 case a simple command will install everything you need. For example:
258 On Debian and similar systems:
260 sudo apt-get install libxapian-dev libgmime-2.4-dev libtalloc-dev
262 Or on Fedora and similar systems:
264 sudo yum install xapian-core-devel gmime-devel libtalloc-devel
266 On other systems, similar commands can be used, but the details of the
267 package names may be different.
270 if [ $have_pkg_config -eq 0 ]; then
272 Note: the pkg-config program is not available. This configure script
273 uses pkg-config to find the compilation flags required to link against
274 the various libraries needed by notmuch. It's possible you simply need
275 to install pkg-config with a command such as:
277 sudo apt-get install pkg-config
279 sudo yum install pkgconfig
281 But if pkg-config is not available for your system, then you will need
282 to modify the configure script to manually set the cflags and ldflags
283 variables to the correct values to link against each library in each
284 case that pkg-config could not be used to determine those values.
289 When you have installed the necessary dependencies, you can run
290 configure again to ensure the packages can be found, or simply run
291 "make" to compile notmuch.
297 printf "Checking for getline... "
298 if ${CC} -o compat/have_getline compat/have_getline.c > /dev/null 2>&1
303 printf "No (will use our own instead).\n"
306 rm -f compat/have_getline
310 All required packages were found. You may now run the following
311 commands to compile and install notmuch:
318 # construct the Makefile.config
319 cat > Makefile.config <<EOF
320 # This Makefile.config was automatically generated by the ./configure
321 # script of notmuch. If the configure script identified anything
322 # incorrectly, then you can edit this file to try to correct things,
323 # but be warned that if configure is run again it will destroy your
324 # changes, (and this could happen by simply calling "make" if the
325 # configure script is updated).
327 # The C compiler to use
330 # The C++ compiler to use
333 # Command to execute emacs from Makefiles
334 EMACS = emacs --quick
336 # Default FLAGS for C compiler (can be overridden by user such as "make CFLAGS=-g")
339 # Default FLAGS for C++ compiler (can be overridden by user such as "make CXXFLAGS=-g")
340 CXXFLAGS = ${CXXFLAGS}
342 # Flags to enable warnings when using the C++ compiler
343 WARN_CXXFLAGS=-Wall -Wextra -Wwrite-strings -Wswitch-enum
345 # Flags to enable warnings when using the C compiler
346 WARN_CFLAGS=\$(WARN_CXXFLAGS) -Wmissing-declarations
348 # The prefix to which notmuch should be installed
351 # The directory to which libraries should be installed
352 libdir = ${LIBDIR:=\$(prefix)/lib}
354 # The directory to which header files should be installed
355 includedir = ${INCLUDEDIR:=\$(prefix)/lib}
357 # The directory to which man pages should be installed
358 mandir = ${MANDIR:=\$(prefix)/share/man}
360 # The directory to which read-only (configuration) filesshould be installed
361 sysconfdir = ${SYSCONFDIR:=\$(prefix)/etc}
363 # The directory to which emacs lisp files should be installed
364 emacs_lispdir=${emacs_lispdir}
366 # Whether there's an emacs binary available for byte-compiling
367 HAVE_EMACS = ${have_emacs}
369 # The directory to which desktop files should be installed
370 desktop_dir = \$(prefix)/share/applications
372 # The directory to which bash completions files should be installed
373 bash_completion_dir = \$(sysconfdir)/bash_completion.d
375 # The directory to which zsh completions files should be installed
376 zsh_completion_dir = \$(prefix)/share/zsh/functions/Completion/Unix
378 # Whether the getline function is available (if not, then notmuch will
379 # build its own version)
380 HAVE_GETLINE = ${have_getline}
382 # Flags needed to compile and link against Xapian
383 XAPIAN_CXXFLAGS = ${xapian_cxxflags}
384 XAPIAN_LDFLAGS = ${xapian_ldflags}
386 # Flags needed to compile and link against GMime-2.4
387 GMIME_CFLAGS = ${gmime_cflags}
388 GMIME_LDFLAGS = ${gmime_ldflags}
390 # Flags needed to compile and link against talloc
391 TALLOC_CFLAGS = ${talloc_cflags}
392 TALLOC_LDFLAGS = ${talloc_ldflags}
394 # Whether valgrind header files are available
395 HAVE_VALGRIND = ${have_valgrind}
397 # And if so, flags needed at compile time for valgrind macros
398 VALGRIND_CFLAGS = ${valgrind_cflags}
400 # Combined flags for compiling and linking against all of the above
401 CONFIGURE_CFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS) \\
402 \$(TALLOC_CFLAGS) -DHAVE_VALGRIND=\$(HAVE_VALGRIND) \\
404 CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS) \\
405 \$(TALLOC_CFLAGS) -DHAVE_VALGRIND=\$(HAVE_VALGRIND) \\
406 \$(VALGRIND_CFLAGS) \$(XAPIAN_CXXFLAGS)
407 CONFIGURE_LDFLAGS = \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(XAPIAN_LDFLAGS)