3 # Set several defaults (optionally specified by the user in
4 # environemnt variables)
8 CXXFLAGS=${CXXFLAGS:-\$(CFLAGS)}
10 XAPIAN_CONFIG=${XAPIAN_CONFIG:-xapian-config-1.1 xapian-config}
12 # We don't allow the EMACS or GZIP Makefile variables inherit values
13 # from the environment as we do with CC and CXX above. The reason is
14 # that these names as environment variables have existing uses other
15 # than the program name that we want. (EMACS is set to 't' when a
16 # shell is running within emacs and GZIP specifies arguments to pass
17 # on the gzip command line).
19 # Set the defaults for values the user can specify with command-line
27 Usage: ./configure [options]...
29 This script configures notmuch to build on your system.
31 It verifies that dependencies are available, determines flags needed
32 to compile and link against various required libraries, and identifies
33 whether various system functions can be used or if locally-provided
34 replacements will be built instead.
36 Finally, it allows you to control various aspects of the build and
39 First, some common variables can specified via environment variables:
41 CC The C compiler to use
42 CFLAGS Flags to pass to the C compiler
43 CXX The C++ compiler to use
44 CXXFLAGS Flags to pass to the C compiler
45 LDFLAGS Flags to pass when linking
47 Each of these values can further be controlled by specifying them
48 later on the "make" command line.
50 Other environment variables can be used to control configure itself,
51 (and for which there is no equivalent build-time control):
53 XAPIAN_CONFIG The program to use to determine flags for
54 compiling and linking against the Xapian
55 library. [$XAPIAN_CONFIG]
57 Additionally, various options can be specified on the configure
60 --prefix=PREFIX Install files in PREFIX [$PREFIX]
62 By default, "make install" will install the resulting program to
63 $PREFIX/bin, documentation to $PREFIX/man, etc. You can
64 specify an installation prefix other than $PREFIX using
65 --prefix, for instance:
67 ./configure --prefix=\$HOME
69 Fine tuning of some installation directories is available:
71 --libdir=DIR Install libraries to DIR [PREFIX/lib]
72 --includedir=DIR Install header files to DIR [PREFIX/include]
73 --mandir=DIR Install man pages to DIR [PREFIX/share/man]
74 --sysconfdir=DIR Read-only single-machine data [PREFIX/etc]
75 --emacslispdir=DIR Emacs code [PREFIX/share/emacs/site-lisp]
77 Additional options are accepted for compatibility with other
78 configure-script calling conventions, but don't do anything yet:
80 --build=<cpu>-<vendor>-<os> Currently ignored
81 --host=<cpu>-<vendor>-<os> Currently ignored
82 --infodir=DIR Currently ignored
83 --datadir=DIR Currently ignored
84 --localstatedir=DIR Currently ignored
85 --libexecdir=DIR Currently ignored
86 --disable-maintainer-mode Currently ignored
87 --disable-dependency-tracking Currently ignored
92 # Parse command-line options
94 if [ "${option}" = '--help' ] ; then
97 elif [ "${option%%=*}" = '--prefix' ] ; then
99 elif [ "${option%%=*}" = '--libdir' ] ; then
100 LIBDIR="${option#*=}"
101 elif [ "${option%%=*}" = '--includedir' ] ; then
102 INCLUDEDIR="${option#*=}"
103 elif [ "${option%%=*}" = '--mandir' ] ; then
104 MANDIR="${option#*=}"
105 elif [ "${option%%=*}" = '--sysconfdir' ] ; then
106 SYSCONFDIR="${option#*=}"
107 elif [ "${option%%=*}" = '--emacslispdir' ] ; then
108 EMACSLISPDIR="${option#*=}"
109 elif [ "${option%%=*}" = '--build' ] ; then
110 build_option="${option#*=}"
111 case ${build_option} in
114 echo "Unrecognized value for --build option: ${build_option}"
115 echo "Should be: <cpu>-<vendor>-<os>"
121 build_cpu=${build_option%%-*}
122 build_option=${build_option#*-}
123 build_vendor=${build_option%%-*}
124 build_os=${build_option#*-}
125 elif [ "${option%%=*}" = '--host' ] ; then
126 host_option="${option#*=}"
127 case ${host_option} in
130 echo "Unrecognized value for --host option: ${host_option}"
131 echo "Should be: <cpu>-<vendor>-<os>"
137 host_cpu=${host_option%%-*}
138 host_option=${host_option#*-}
139 host_vendor=${host_option%%-*}
140 host_os=${host_option#*-}
141 elif [ "${option%%=*}" = '--infodir' ] ; then
143 elif [ "${option%%=*}" = '--datadir' ] ; then
145 elif [ "${option%%=*}" = '--localstatedir' ] ; then
147 elif [ "${option%%=*}" = '--libexecdir' ] ; then
149 elif [ "${option}" = '--disable-maintainer-mode' ] ; then
151 elif [ "${option}" = '--disable-dependency-tracking' ] ; then
154 echo "Unrecognized option: ${option}"
163 Welcome to Notmuch, a system for indexing, searching and tagging your email.
165 We hope that the process of building and installing notmuch is quick
166 and smooth so that you can soon be reading and processing your email
167 more efficiently than ever.
169 If anything goes wrong in the configure process, you can override any
170 decisions it makes by manually editing the Makefile.config file that
171 it creates. Also please do as much as you can to figure out what could
172 be different on your machine compared to those of the notmuch
173 developers. Then, please email those details to the Notmuch list
174 (notmuch@notmuchmail.org) so that we can hopefully make future
175 versions of notmuch easier for you to use.
177 We'll now investigate your system to verify that all required
178 dependencies are available:
184 if pkg-config --version > /dev/null 2>&1; then
190 printf "Checking for Xapian development files... "
192 for xapian_config in ${XAPIAN_CONFIG}; do
193 if ${xapian_config} --version > /dev/null 2>&1; then
194 printf "Yes (%s).\n" $(${xapian_config} --version | sed -e 's/.* //')
196 xapian_cxxflags=$(${xapian_config} --cxxflags)
197 xapian_ldflags=$(${xapian_config} --libs)
201 if [ ${have_xapian} = "0" ]; then
203 errors=$((errors + 1))
206 printf "Checking for GMime development files... "
208 for gmimepc in gmime-2.6 gmime-2.4; do
209 if pkg-config --modversion $gmimepc > /dev/null 2>&1; then
210 printf "Yes ($gmimepc).\n"
212 gmime_cflags=$(pkg-config --cflags $gmimepc)
213 gmime_ldflags=$(pkg-config --libs $gmimepc)
216 if [ "$have_gmime" = "0" ]; then
218 errors=$((errors + 1))
221 printf "Checking for talloc development files... "
222 if pkg-config --modversion talloc > /dev/null 2>&1; then
225 talloc_cflags=$(pkg-config --cflags talloc)
226 talloc_ldflags=$(pkg-config --libs talloc)
231 errors=$((errors + 1))
234 printf "Checking for valgrind development files... "
235 if pkg-config --modversion valgrind > /dev/null 2>&1; then
238 valgrind_cflags=$(pkg-config --cflags valgrind)
240 printf "No (but that's fine).\n"
244 if [ -z "${EMACSLISPDIR}" ]; then
245 if pkg-config --modversion emacs > /dev/null 2>&1; then
246 EMACSLISPDIR=$(pkg-config emacs --variable sitepkglispdir)
248 EMACSLISPDIR='$(prefix)/share/emacs/site-lisp'
252 printf "Checking if emacs is available... "
253 if emacs --quick --batch > /dev/null 2>&1; then
257 printf "No (so will not byte-compile emacs code)\n"
261 printf "Checking for Mac OS X (for shared library)... "
262 if [ `uname` = "Darwin" ] ; then
265 linker_resolves_library_dependencies=0
269 linker_resolves_library_dependencies=1
272 if [ $errors -gt 0 ]; then
275 *** Error: The dependencies of notmuch could not be satisfied. You will
276 need to install the following packages before being able to compile
280 if [ $have_xapian -eq 0 ]; then
281 echo " Xapian library (including development files such as headers)"
282 echo " http://xapian.org/"
284 if [ $have_gmime -eq 0 ]; then
285 echo " GMime 2.4 library (including development files such as headers)"
286 echo " http://spruce.sourceforge.net/gmime/"
288 if [ $have_talloc -eq 0 ]; then
289 echo " The talloc library (including development files such as headers)"
290 echo " http://talloc.samba.org/"
294 With any luck, you're using a modern, package-based operating system
295 that has all of these packages available in the distribution. In that
296 case a simple command will install everything you need. For example:
298 On Debian and similar systems:
300 sudo apt-get install libxapian-dev libgmime-2.4-dev libtalloc-dev
302 Or on Fedora and similar systems:
304 sudo yum install xapian-core-devel gmime-devel libtalloc-devel
306 On other systems, similar commands can be used, but the details of the
307 package names may be different.
310 if [ $have_pkg_config -eq 0 ]; then
312 Note: the pkg-config program is not available. This configure script
313 uses pkg-config to find the compilation flags required to link against
314 the various libraries needed by notmuch. It's possible you simply need
315 to install pkg-config with a command such as:
317 sudo apt-get install pkg-config
319 sudo yum install pkgconfig
321 But if pkg-config is not available for your system, then you will need
322 to modify the configure script to manually set the cflags and ldflags
323 variables to the correct values to link against each library in each
324 case that pkg-config could not be used to determine those values.
329 When you have installed the necessary dependencies, you can run
330 configure again to ensure the packages can be found, or simply run
331 "make" to compile notmuch.
337 printf "Checking for getline... "
338 if ${CC} -o compat/have_getline compat/have_getline.c > /dev/null 2>&1
343 printf "No (will use our own instead).\n"
346 rm -f compat/have_getline
348 printf "Checking for strcasestr... "
349 if ${CC} -o compat/have_strcasestr compat/have_strcasestr.c > /dev/null 2>&1
354 printf "No (will use our own instead).\n"
357 rm -f compat/have_strcasestr
361 All required packages were found. You may now run the following
362 commands to compile and install notmuch:
369 # construct the Makefile.config
370 cat > Makefile.config <<EOF
371 # This Makefile.config was automatically generated by the ./configure
372 # script of notmuch. If the configure script identified anything
373 # incorrectly, then you can edit this file to try to correct things,
374 # but be warned that if configure is run again it will destroy your
375 # changes, (and this could happen by simply calling "make" if the
376 # configure script is updated).
378 # The C compiler to use
381 # The C++ compiler to use
384 # Command to execute emacs from Makefiles
385 EMACS = emacs --quick
387 # Default FLAGS for C compiler (can be overridden by user such as "make CFLAGS=-g")
390 # Default FLAGS for C++ compiler (can be overridden by user such as "make CXXFLAGS=-g")
391 CXXFLAGS = ${CXXFLAGS}
393 # Default FLAGS for the linker (can be overridden by user such as "make LDFLAGS=-znow")
396 # Flags to enable warnings when using the C++ compiler
397 WARN_CXXFLAGS=-Wall -Wextra -Wwrite-strings -Wswitch-enum
399 # Flags to enable warnings when using the C compiler
400 WARN_CFLAGS=\$(WARN_CXXFLAGS) -Wmissing-declarations
402 # The prefix to which notmuch should be installed
405 # The directory to which libraries should be installed
406 libdir = ${LIBDIR:=\$(prefix)/lib}
408 # The directory to which header files should be installed
409 includedir = ${INCLUDEDIR:=\$(prefix)/include}
411 # The directory to which man pages should be installed
412 mandir = ${MANDIR:=\$(prefix)/share/man}
414 # The directory to which read-only (configuration) filesshould be installed
415 sysconfdir = ${SYSCONFDIR:=\$(prefix)/etc}
417 # The directory to which emacs lisp files should be installed
418 emacslispdir=${EMACSLISPDIR}
420 # Whether there's an emacs binary available for byte-compiling
421 HAVE_EMACS = ${have_emacs}
423 # The directory to which desktop files should be installed
424 desktop_dir = \$(prefix)/share/applications
426 # The directory to which bash completions files should be installed
427 bash_completion_dir = \$(sysconfdir)/bash_completion.d
429 # The directory to which zsh completions files should be installed
430 zsh_completion_dir = \$(prefix)/share/zsh/functions/Completion/Unix
432 # Whether the getline function is available (if not, then notmuch will
433 # build its own version)
434 HAVE_GETLINE = ${have_getline}
436 # Whether the strcasestr function is available (if not, then notmuch will
437 # build its own version)
438 HAVE_STRCASESTR = ${have_strcasestr}
440 # Whether we are building on OS X. This will affect how we build the
442 MAC_OS_X = ${mac_os_x}
444 # Whether the linker will automatically resolve the dependency of one
445 # library on another (if not, then linking a binary requires linking
446 # directly against both)
447 LINKER_RESOLVES_LIBRARY_DEPENDENCIES = ${linker_resolves_library_dependencies}
449 # Flags needed to compile and link against Xapian
450 XAPIAN_CXXFLAGS = ${xapian_cxxflags}
451 XAPIAN_LDFLAGS = ${xapian_ldflags}
453 # Flags needed to compile and link against GMime-2.4
454 GMIME_CFLAGS = ${gmime_cflags}
455 GMIME_LDFLAGS = ${gmime_ldflags}
457 # Flags needed to compile and link against talloc
458 TALLOC_CFLAGS = ${talloc_cflags}
459 TALLOC_LDFLAGS = ${talloc_ldflags}
461 # Whether valgrind header files are available
462 HAVE_VALGRIND = ${have_valgrind}
464 # And if so, flags needed at compile time for valgrind macros
465 VALGRIND_CFLAGS = ${valgrind_cflags}
467 # Combined flags for compiling and linking against all of the above
468 CONFIGURE_CFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS) \\
469 \$(TALLOC_CFLAGS) -DHAVE_VALGRIND=\$(HAVE_VALGRIND) \\
470 \$(VALGRIND_CFLAGS) -DHAVE_STRCASESTR=\$(HAVE_STRCASESTR)
471 CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS) \\
472 \$(TALLOC_CFLAGS) -DHAVE_VALGRIND=\$(HAVE_VALGRIND) \\
473 \$(VALGRIND_CFLAGS) \$(XAPIAN_CXXFLAGS) \\
474 -DHAVE_STRCASESTR=\$(HAVE_STRCASESTR)
475 CONFIGURE_LDFLAGS = \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(XAPIAN_LDFLAGS)