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]
74 --emacslispdir=DIR Emacs code [PREFIX/share/emacs/site-lisp]
76 Additional options are accepted for compatibility with other
77 configure-script calling conventions, but don't do anything yet:
79 --build=<cpu>-<vendor>-<os> Currently ignored
80 --infodir=DIR Currently ignored
81 --localstatedir=DIR Currently ignored
82 --libexecdir=DIR Currently ignored
83 --disable-maintainer-mode Currently ignored
84 --disable-dependency-tracking Currently ignored
89 # Parse command-line options
91 if [ "${option}" = '--help' ] ; then
94 elif [ "${option%%=*}" = '--prefix' ] ; then
96 elif [ "${option%%=*}" = '--libdir' ] ; then
98 elif [ "${option%%=*}" = '--includedir' ] ; then
99 INCLUDEDIR="${option#*=}"
100 elif [ "${option%%=*}" = '--mandir' ] ; then
101 MANDIR="${option#*=}"
102 elif [ "${option%%=*}" = '--sysconfdir' ] ; then
103 SYSCONFDIR="${option#*=}"
104 elif [ "${option%%=*}" = '--emacslispdir' ] ; then
105 EMACSLISPDIR="${option#*=}"
106 elif [ "${option%%=*}" = '--build' ] ; then
107 build_option="${option#*=}"
108 case ${build_option} in
111 echo "Unrecognized value for --build option: ${build_option}"
112 echo "Should be: <cpu>-<vendor>-<os>"
118 build_cpu=${build_option%%-*}
119 build_option=${build_option#*-}
120 build_vendor=${build_option%%-*}
121 build_os=${build_option#*-}
122 elif [ "${option%%=*}" = '--infodir' ] ; then
124 elif [ "${option%%=*}" = '--localstatedir' ] ; then
126 elif [ "${option%%=*}" = '--libexecdir' ] ; then
128 elif [ "${option}" = '--disable-maintainer-mode' ] ; then
130 elif [ "${option}" = '--disable-dependency-tracking' ] ; then
133 echo "Unrecognized option: ${option}"
142 Welcome to Notmuch, a system for indexing, searching and tagging your email.
144 We hope that the process of building and installing notmuch is quick
145 and smooth so that you can soon be reading and processing your email
146 more efficiently than ever.
148 If anything goes wrong in the configure process, you can override any
149 decisions it makes by manually editing the Makefile.config file that
150 it creates. Also please do as much as you can to figure out what could
151 be different on your machine compared to those of the notmuch
152 developers. Then, please email those details to the Notmuch list
153 (notmuch@notmuchmail.org) so that we can hopefully make future
154 versions of notmuch easier for you to use.
156 We'll now investigate your system to verify that all required
157 dependencies are available:
163 if pkg-config --version > /dev/null 2>&1; then
169 printf "Checking for Xapian development files... "
171 for xapian_config in ${XAPIAN_CONFIG}; do
172 if ${xapian_config} --version > /dev/null 2>&1; then
173 printf "Yes (%s).\n" $(${xapian_config} --version | sed -e 's/.* //')
175 xapian_cxxflags=$(${xapian_config} --cxxflags)
176 xapian_ldflags=$(${xapian_config} --libs)
180 if [ ${have_xapian} = "0" ]; then
182 errors=$((errors + 1))
185 printf "Checking for GMime development files... "
187 for gmimepc in gmime-2.6 gmime-2.4; do
188 if pkg-config --modversion $gmimepc > /dev/null 2>&1; then
189 printf "Yes ($gmimepc).\n"
191 gmime_cflags=$(pkg-config --cflags $gmimepc)
192 gmime_ldflags=$(pkg-config --libs $gmimepc)
195 if [ "$have_gmime" = "0" ]; then
197 errors=$((errors + 1))
200 printf "Checking for talloc development files... "
201 if pkg-config --modversion talloc > /dev/null 2>&1; then
204 talloc_cflags=$(pkg-config --cflags talloc)
205 talloc_ldflags=$(pkg-config --libs talloc)
210 errors=$((errors + 1))
213 printf "Checking for valgrind development files... "
214 if pkg-config --modversion valgrind > /dev/null 2>&1; then
217 valgrind_cflags=$(pkg-config --cflags valgrind)
219 printf "No (but that's fine).\n"
223 if [ -z "${EMACSLISPDIR}" ]; then
224 if pkg-config --modversion emacs > /dev/null 2>&1; then
225 EMACSLISPDIR=$(pkg-config emacs --variable sitepkglispdir)
227 EMACSLISPDIR='$(prefix)/share/emacs/site-lisp'
231 printf "Checking if emacs is available... "
232 if emacs --quick --batch > /dev/null 2>&1; then
236 printf "No (so will not byte-compile emacs code)\n"
240 printf "Checking for Mac OS X (for shared library)... "
241 if [ `uname` = "Darwin" ] ; then
244 linker_resolves_library_dependencies=0
248 linker_resolves_library_dependencies=1
251 if [ $errors -gt 0 ]; then
254 *** Error: The dependencies of notmuch could not be satisfied. You will
255 need to install the following packages before being able to compile
259 if [ $have_xapian -eq 0 ]; then
260 echo " Xapian library (including development files such as headers)"
261 echo " http://xapian.org/"
263 if [ $have_gmime -eq 0 ]; then
264 echo " GMime 2.4 library (including development files such as headers)"
265 echo " http://spruce.sourceforge.net/gmime/"
267 if [ $have_talloc -eq 0 ]; then
268 echo " The talloc library (including development files such as headers)"
269 echo " http://talloc.samba.org/"
273 With any luck, you're using a modern, package-based operating system
274 that has all of these packages available in the distribution. In that
275 case a simple command will install everything you need. For example:
277 On Debian and similar systems:
279 sudo apt-get install libxapian-dev libgmime-2.4-dev libtalloc-dev
281 Or on Fedora and similar systems:
283 sudo yum install xapian-core-devel gmime-devel libtalloc-devel
285 On other systems, similar commands can be used, but the details of the
286 package names may be different.
289 if [ $have_pkg_config -eq 0 ]; then
291 Note: the pkg-config program is not available. This configure script
292 uses pkg-config to find the compilation flags required to link against
293 the various libraries needed by notmuch. It's possible you simply need
294 to install pkg-config with a command such as:
296 sudo apt-get install pkg-config
298 sudo yum install pkgconfig
300 But if pkg-config is not available for your system, then you will need
301 to modify the configure script to manually set the cflags and ldflags
302 variables to the correct values to link against each library in each
303 case that pkg-config could not be used to determine those values.
308 When you have installed the necessary dependencies, you can run
309 configure again to ensure the packages can be found, or simply run
310 "make" to compile notmuch.
316 printf "Checking for getline... "
317 if ${CC} -o compat/have_getline compat/have_getline.c > /dev/null 2>&1
322 printf "No (will use our own instead).\n"
325 rm -f compat/have_getline
327 printf "Checking for strcasestr... "
328 if ${CC} -o compat/have_strcasestr compat/have_strcasestr.c > /dev/null 2>&1
333 printf "No (will use our own instead).\n"
336 rm -f compat/have_strcasestr
340 All required packages were found. You may now run the following
341 commands to compile and install notmuch:
348 # construct the Makefile.config
349 cat > Makefile.config <<EOF
350 # This Makefile.config was automatically generated by the ./configure
351 # script of notmuch. If the configure script identified anything
352 # incorrectly, then you can edit this file to try to correct things,
353 # but be warned that if configure is run again it will destroy your
354 # changes, (and this could happen by simply calling "make" if the
355 # configure script is updated).
357 # The C compiler to use
360 # The C++ compiler to use
363 # Command to execute emacs from Makefiles
364 EMACS = emacs --quick
366 # Default FLAGS for C compiler (can be overridden by user such as "make CFLAGS=-g")
369 # Default FLAGS for C++ compiler (can be overridden by user such as "make CXXFLAGS=-g")
370 CXXFLAGS = ${CXXFLAGS}
372 # Flags to enable warnings when using the C++ compiler
373 WARN_CXXFLAGS=-Wall -Wextra -Wwrite-strings -Wswitch-enum
375 # Flags to enable warnings when using the C compiler
376 WARN_CFLAGS=\$(WARN_CXXFLAGS) -Wmissing-declarations
378 # The prefix to which notmuch should be installed
381 # The directory to which libraries should be installed
382 libdir = ${LIBDIR:=\$(prefix)/lib}
384 # The directory to which header files should be installed
385 includedir = ${INCLUDEDIR:=\$(prefix)/include}
387 # The directory to which man pages should be installed
388 mandir = ${MANDIR:=\$(prefix)/share/man}
390 # The directory to which read-only (configuration) filesshould be installed
391 sysconfdir = ${SYSCONFDIR:=\$(prefix)/etc}
393 # The directory to which emacs lisp files should be installed
394 emacslispdir=${EMACSLISPDIR}
396 # Whether there's an emacs binary available for byte-compiling
397 HAVE_EMACS = ${have_emacs}
399 # The directory to which desktop files should be installed
400 desktop_dir = \$(prefix)/share/applications
402 # The directory to which bash completions files should be installed
403 bash_completion_dir = \$(sysconfdir)/bash_completion.d
405 # The directory to which zsh completions files should be installed
406 zsh_completion_dir = \$(prefix)/share/zsh/functions/Completion/Unix
408 # Whether the getline function is available (if not, then notmuch will
409 # build its own version)
410 HAVE_GETLINE = ${have_getline}
412 # Whether the strcasestr function is available (if not, then notmuch will
413 # build its own version)
414 HAVE_STRCASESTR = ${have_strcasestr}
416 # Whether we are building on OS X. This will affect how we build the
418 MAC_OS_X = ${mac_os_x}
420 # Whether the linker will automatically resolve the dependency of one
421 # library on another (if not, then linking a binary requires linking
422 # directly against both)
423 LINKER_RESOLVES_LIBRARY_DEPENDENCIES = ${linker_resolves_library_dependencies}
425 # Flags needed to compile and link against Xapian
426 XAPIAN_CXXFLAGS = ${xapian_cxxflags}
427 XAPIAN_LDFLAGS = ${xapian_ldflags}
429 # Flags needed to compile and link against GMime-2.4
430 GMIME_CFLAGS = ${gmime_cflags}
431 GMIME_LDFLAGS = ${gmime_ldflags}
433 # Flags needed to compile and link against talloc
434 TALLOC_CFLAGS = ${talloc_cflags}
435 TALLOC_LDFLAGS = ${talloc_ldflags}
437 # Whether valgrind header files are available
438 HAVE_VALGRIND = ${have_valgrind}
440 # And if so, flags needed at compile time for valgrind macros
441 VALGRIND_CFLAGS = ${valgrind_cflags}
443 # Combined flags for compiling and linking against all of the above
444 CONFIGURE_CFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS) \\
445 \$(TALLOC_CFLAGS) -DHAVE_VALGRIND=\$(HAVE_VALGRIND) \\
446 \$(VALGRIND_CFLAGS) -DHAVE_STRCASESTR=\$(HAVE_STRCASESTR)
447 CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS) \\
448 \$(TALLOC_CFLAGS) -DHAVE_VALGRIND=\$(HAVE_VALGRIND) \\
449 \$(VALGRIND_CFLAGS) \$(XAPIAN_CXXFLAGS) \\
450 -DHAVE_STRCASESTR=\$(HAVE_STRCASESTR)
451 CONFIGURE_LDFLAGS = \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(XAPIAN_LDFLAGS)