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 which platform we are on... "
262 if [ `uname` = "Darwin" ] ; then
265 linker_resolves_library_dependencies=0
266 elif [ `uname` = "SunOS" ] ; then
269 linker_resolves_library_dependencies=0
270 elif [ `uname` = "Linux" ] ; then
273 linker_resolves_library_dependencies=1
278 *** Warning: Unknown platform. Notmuch might or might not build correctly.
283 if [ $errors -gt 0 ]; then
286 *** Error: The dependencies of notmuch could not be satisfied. You will
287 need to install the following packages before being able to compile
291 if [ $have_xapian -eq 0 ]; then
292 echo " Xapian library (including development files such as headers)"
293 echo " http://xapian.org/"
295 if [ $have_gmime -eq 0 ]; then
296 echo " GMime 2.4 library (including development files such as headers)"
297 echo " http://spruce.sourceforge.net/gmime/"
299 if [ $have_talloc -eq 0 ]; then
300 echo " The talloc library (including development files such as headers)"
301 echo " http://talloc.samba.org/"
305 With any luck, you're using a modern, package-based operating system
306 that has all of these packages available in the distribution. In that
307 case a simple command will install everything you need. For example:
309 On Debian and similar systems:
311 sudo apt-get install libxapian-dev libgmime-2.4-dev libtalloc-dev
313 Or on Fedora and similar systems:
315 sudo yum install xapian-core-devel gmime-devel libtalloc-devel
317 On other systems, similar commands can be used, but the details of the
318 package names may be different.
321 if [ $have_pkg_config -eq 0 ]; then
323 Note: the pkg-config program is not available. This configure script
324 uses pkg-config to find the compilation flags required to link against
325 the various libraries needed by notmuch. It's possible you simply need
326 to install pkg-config with a command such as:
328 sudo apt-get install pkg-config
330 sudo yum install pkgconfig
332 But if pkg-config is not available for your system, then you will need
333 to modify the configure script to manually set the cflags and ldflags
334 variables to the correct values to link against each library in each
335 case that pkg-config could not be used to determine those values.
340 When you have installed the necessary dependencies, you can run
341 configure again to ensure the packages can be found, or simply run
342 "make" to compile notmuch.
348 printf "Checking for getline... "
349 if ${CC} -o compat/have_getline compat/have_getline.c > /dev/null 2>&1
354 printf "No (will use our own instead).\n"
357 rm -f compat/have_getline
359 printf "Checking for strcasestr... "
360 if ${CC} -o compat/have_strcasestr compat/have_strcasestr.c > /dev/null 2>&1
365 printf "No (will use our own instead).\n"
368 rm -f compat/have_strcasestr
372 All required packages were found. You may now run the following
373 commands to compile and install notmuch:
380 # construct the Makefile.config
381 cat > Makefile.config <<EOF
382 # This Makefile.config was automatically generated by the ./configure
383 # script of notmuch. If the configure script identified anything
384 # incorrectly, then you can edit this file to try to correct things,
385 # but be warned that if configure is run again it will destroy your
386 # changes, (and this could happen by simply calling "make" if the
387 # configure script is updated).
389 # The C compiler to use
392 # The C++ compiler to use
395 # Command to execute emacs from Makefiles
396 EMACS = emacs --quick
398 # Default FLAGS for C compiler (can be overridden by user such as "make CFLAGS=-g")
401 # Default FLAGS for C++ compiler (can be overridden by user such as "make CXXFLAGS=-g")
402 CXXFLAGS = ${CXXFLAGS}
404 # Default FLAGS for the linker (can be overridden by user such as "make LDFLAGS=-znow")
407 # Flags to enable warnings when using the C++ compiler
408 WARN_CXXFLAGS=-Wall -Wextra -Wwrite-strings -Wswitch-enum
410 # Flags to enable warnings when using the C compiler
411 WARN_CFLAGS=\$(WARN_CXXFLAGS) -Wmissing-declarations
413 # The prefix to which notmuch should be installed
416 # The directory to which libraries should be installed
417 libdir = ${LIBDIR:=\$(prefix)/lib}
419 # The directory to which header files should be installed
420 includedir = ${INCLUDEDIR:=\$(prefix)/include}
422 # The directory to which man pages should be installed
423 mandir = ${MANDIR:=\$(prefix)/share/man}
425 # The directory to which read-only (configuration) filesshould be installed
426 sysconfdir = ${SYSCONFDIR:=\$(prefix)/etc}
428 # The directory to which emacs lisp files should be installed
429 emacslispdir=${EMACSLISPDIR}
431 # Whether there's an emacs binary available for byte-compiling
432 HAVE_EMACS = ${have_emacs}
434 # The directory to which desktop files should be installed
435 desktop_dir = \$(prefix)/share/applications
437 # The directory to which bash completions files should be installed
438 bash_completion_dir = \$(sysconfdir)/bash_completion.d
440 # The directory to which zsh completions files should be installed
441 zsh_completion_dir = \$(prefix)/share/zsh/functions/Completion/Unix
443 # Whether the getline function is available (if not, then notmuch will
444 # build its own version)
445 HAVE_GETLINE = ${have_getline}
447 # Whether the strcasestr function is available (if not, then notmuch will
448 # build its own version)
449 HAVE_STRCASESTR = ${have_strcasestr}
451 # Supported platforms (so far) are: LINUX, MACOSX, SOLARIS
452 PLATFORM = ${platform}
454 # Whether the linker will automatically resolve the dependency of one
455 # library on another (if not, then linking a binary requires linking
456 # directly against both)
457 LINKER_RESOLVES_LIBRARY_DEPENDENCIES = ${linker_resolves_library_dependencies}
459 # Flags needed to compile and link against Xapian
460 XAPIAN_CXXFLAGS = ${xapian_cxxflags}
461 XAPIAN_LDFLAGS = ${xapian_ldflags}
463 # Flags needed to compile and link against GMime-2.4
464 GMIME_CFLAGS = ${gmime_cflags}
465 GMIME_LDFLAGS = ${gmime_ldflags}
467 # Flags needed to compile and link against talloc
468 TALLOC_CFLAGS = ${talloc_cflags}
469 TALLOC_LDFLAGS = ${talloc_ldflags}
471 # Whether valgrind header files are available
472 HAVE_VALGRIND = ${have_valgrind}
474 # And if so, flags needed at compile time for valgrind macros
475 VALGRIND_CFLAGS = ${valgrind_cflags}
477 # Combined flags for compiling and linking against all of the above
478 CONFIGURE_CFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS) \\
479 \$(TALLOC_CFLAGS) -DHAVE_VALGRIND=\$(HAVE_VALGRIND) \\
480 \$(VALGRIND_CFLAGS) -DHAVE_STRCASESTR=\$(HAVE_STRCASESTR)
481 CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS) \\
482 \$(TALLOC_CFLAGS) -DHAVE_VALGRIND=\$(HAVE_VALGRIND) \\
483 \$(VALGRIND_CFLAGS) \$(XAPIAN_CXXFLAGS) \\
484 -DHAVE_STRCASESTR=\$(HAVE_STRCASESTR)
485 CONFIGURE_LDFLAGS = \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(XAPIAN_LDFLAGS)