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 in LIBDIR [PREFIX/lib]
75 # Parse command-line options
77 if [ "${option}" = '--help' ] ; then
80 elif [ "${option%%=*}" = '--prefix' ] ; then
82 elif [ "${option%%=*}" = '--libdir' ] ; then
85 echo "Unrecognized option: ${option}."
94 Welcome to Notmuch, a system for indexing, searching and tagging your email.
96 We hope that the process of building and installing notmuch is quick
97 and smooth so that you can soon be reading and processing your email
98 more efficiently than ever.
100 If anything goes wrong in the configure process, you can override any
101 decisions it makes by manually editing the Makefile.config file that
102 it creates. Also please do as much as you can to figure out what could
103 be different on your machine compared to those of the notmuch
104 developers. Then, please email those details to the Notmuch list
105 (notmuch@notmuchmail.org) so that we can hopefully make future
106 versions of notmuch easier for you to use.
108 We'll now investigate your system to verify that all required
109 dependencies are available:
115 if pkg-config --version > /dev/null 2>&1; then
121 printf "Checking for Xapian development files... "
123 for xapian_config in ${XAPIAN_CONFIG}; do
124 if ${xapian_config} --version > /dev/null 2>&1; then
127 xapian_cxxflags=$(${xapian_config} --cxxflags)
128 xapian_ldflags=$(${xapian_config} --libs)
132 if [ ${have_xapian} = "0" ]; then
134 errors=$((errors + 1))
137 printf "Checking for GMime 2.4 development files... "
138 if pkg-config --modversion gmime-2.4 > /dev/null 2>&1; then
141 gmime_cflags=$(pkg-config --cflags gmime-2.4)
142 gmime_ldflags=$(pkg-config --libs gmime-2.4)
146 errors=$((errors + 1))
149 printf "Checking for talloc development files... "
150 if pkg-config --modversion talloc > /dev/null 2>&1; then
153 talloc_cflags=$(pkg-config --cflags talloc)
154 talloc_ldflags=$(pkg-config --libs talloc)
159 errors=$((errors + 1))
162 printf "Checking for valgrind development files... "
163 if pkg-config --modversion valgrind > /dev/null 2>&1; then
166 valgrind_cflags=$(pkg-config --cflags valgrind)
168 printf "No (but that's fine).\n"
172 if pkg-config --modversion emacs > /dev/null 2>&1; then
173 emacs_lispdir=$(pkg-config emacs --variable sitepkglispdir)
175 emacs_lispdir='$(prefix)/share/emacs/site-lisp'
178 if [ $errors -gt 0 ]; then
181 *** Error: The dependencies of notmuch could not be satisfied. You will
182 need to install the following packages before being able to compile
186 if [ $have_xapian -eq 0 ]; then
187 echo " Xapian library (including development files such as headers)"
188 echo " http://xapian.org/"
190 if [ $have_gmime -eq 0 ]; then
191 echo " GMime 2.4 library (including development files such as headers)"
192 echo " http://spruce.sourceforge.net/gmime/"
194 if [ $have_talloc -eq 0 ]; then
195 echo " The talloc library (including development files such as headers)"
196 echo " http://talloc.samba.org/"
200 With any luck, you're using a modern, package-based operating system
201 that has all of these packages available in the distribution. In that
202 case a simple command will install everything you need. For example:
204 On Debian and similar systems:
206 sudo apt-get install libxapian-dev libgmime-2.4-dev libtalloc-dev
208 Or on Fedora and similar systems:
210 sudo yum install xapian-core-devel gmime-devel libtalloc-devel
212 On other systems, similar commands can be used, but the details of the
213 package names may be different.
216 if [ $have_pkg_config -eq 0 ]; then
218 Note: the pkg-config program is not available. This configure script
219 uses pkg-config to find the compilation flags required to link against
220 the various libraries needed by notmuch. It's possible you simply need
221 to install pkg-config with a command such as:
223 sudo apt-get install pkg-config
225 sudo yum install pkgconfig
227 But if pkg-config is not available for your system, then you will need
228 to modify the configure script to manually set the cflags and ldflags
229 variables to the correct values to link against each library in each
230 case that pkg-config could not be used to determine those values.
235 When you have installed the necessary dependencies, you can run
236 configure again to ensure the packages can be found, or simply run
237 "make" to compile notmuch.
243 printf "Checking for getline... "
244 if ${CC} -o config/have_getline config/have_getline.c > /dev/null 2>&1
249 printf "No (will use our own instead).\n"
252 rm -f config/have_getline
256 All required packages were found. You may now run the following
257 commands to compile and install notmuch:
264 # construct the Makefile.config
265 cat > Makefile.config <<EOF
266 # This Makefile.config was automatically generated by the ./configure
267 # script of notmuch. If the configure script identified anything
268 # incorrectly, then you can edit this file to try to correct things,
269 # but be warned that if configure is run again it will destroy your
270 # changes, (and this could happen by simply calling "make" if the
271 # configure script is updated).
273 # The C compiler to use
276 # The C++ compiler to use
279 # Command to execute emacs from Makefiles
280 EMACS = emacs --quick
282 # Default FLAGS for C compiler (can be overridden by user such as "make CFLAGS=-g")
285 # Default FLAGS for C++ compiler (can be overridden by user such as "make CXXFLAGS=-g")
286 CXXFLAGS = ${CXXFLAGS}
288 # Flags to enable warnings when using the C++ compiler
289 WARN_CXXFLAGS=-Wall -Wextra -Wwrite-strings -Wswitch-enum
291 # Flags to enable warnings when using the C compiler
292 WARN_CFLAGS=\$(WARN_CXXFLAGS) -Wmissing-declarations
294 # The prefix to which notmuch should be installed
297 # The directory to which notmuch libraries should be installed
298 libdir = ${LIBDIR:=\$(prefix)/lib}
300 # The directory to which emacs lisp files should be installed
301 emacs_lispdir=${emacs_lispdir}
303 # The directory to which desktop files should be installed
304 desktop_dir = \$(prefix)/share/applications
306 # The directory to which bash completions files should be installed
307 bash_completion_dir = /etc/bash_completion.d
309 # The directory to which zsh completions files should be installed
310 zsh_completion_dir = \$(prefix)/share/zsh/functions/Completion/Unix
312 # Whether the getline function is available (if not, then notmuch will
313 # build its own version)
314 HAVE_GETLINE = ${have_getline}
316 # Flags needed to compile and link against Xapian
317 XAPIAN_CXXFLAGS = ${xapian_cxxflags}
318 XAPIAN_LDFLAGS = ${xapian_ldflags}
320 # Flags needed to compile and link against GMime-2.4
321 GMIME_CFLAGS = ${gmime_cflags}
322 GMIME_LDFLAGS = ${gmime_ldflags}
324 # Flags needed to compile and link against talloc
325 TALLOC_CFLAGS = ${talloc_cflags}
326 TALLOC_LDFLAGS = ${talloc_ldflags}
328 # Whether valgrind header files are available
329 HAVE_VALGRIND = ${have_valgrind}
331 # And if so, flags needed at compile time for valgrind macros
332 VALGRIND_CFLAGS = ${valgrind_cflags}
334 # Combined flags for compiling and linking against all of the above
335 CONFIGURE_CFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS) \\
336 \$(TALLOC_CFLAGS) -DHAVE_VALGRIND=\$(HAVE_VALGRIND) \\
338 CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS) \\
339 \$(TALLOC_CFLAGS) -DHAVE_VALGRIND=\$(HAVE_VALGRIND) \\
340 \$(VALGRIND_CFLAGS) \$(XAPIAN_CXXFLAGS)
341 CONFIGURE_LDFLAGS = \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(XAPIAN_LDFLAGS)