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 # Set the defaults for values the user can specify with command-line
19 Usage: ./configure [options]...
21 This script configures notmuch to build on your system.
23 It verifies that dependencies are available, determines flags needed
24 to compile and link against various required libraries, and identifies
25 whether various system functions can be used or if locally-provided
26 replacements will be built instead.
28 Finally, it allows you to control various aspects of the build and
31 First, some common variables can specified via environment variables:
33 CC The C compiler to use
34 CFLAGS Flags to pass to the C compiler
35 CXX The C++ compiler to use
36 CXXFLAGS Flags to pass to the C compiler
37 LDFLAGS Flags to pass when linking
39 Each of these values can further be controlled by specifying them
40 later on the "make" command line.
42 Other environment variables can be used to control configure itself,
43 (and for which there is no equivalent build-time control):
45 XAPIAN_CONFIG The program to use to determine flags for
46 compiling and linking against the Xapian
47 library. [$XAPIAN_CONFIG]
49 Additionally, various options can be specified on the configure
52 --prefix=PREFIX Install files in PREFIX [$PREFIX]
54 By default, "make install" will install the resulting program to
55 $PREFIX/bin, documentation to $PREFIX/man, etc. You can
56 specify an installation prefix other than $PREFIX using
57 --prefix, for instance:
59 ./configure --prefix=\$HOME
61 Fine tuning of some installation directories is available:
63 --libdir=DIR Install libraries in LIBDIR [PREFIX/lib]
68 # Parse command-line options
70 if [ "${option}" = '--help' ] ; then
73 elif [ "${option%%=*}" = '--prefix' ] ; then
75 elif [ "${option%%=*}" = '--libdir' ] ; then
78 echo "Unrecognized option: ${option}."
87 Welcome to Notmuch, a system for indexing, searching and tagging your email.
89 We hope that the process of building and installing notmuch is quick
90 and smooth so that you can soon be reading and processing your email
91 more efficiently than ever.
93 If anything goes wrong in the configure process, you can override any
94 decisions it makes by manually editing the Makefile.config file that
95 it creates. Also please do as much as you can to figure out what could
96 be different on your machine compared to those of the notmuch
97 developers. Then, please email those details to the Notmuch list
98 (notmuch@notmuchmail.org) so that we can hopefully make future
99 versions of notmuch easier for you to use.
101 We'll now investigate your system to verify that all required
102 dependencies are available:
108 if pkg-config --version > /dev/null 2>&1; then
114 printf "Checking for Xapian development files... "
116 for xapian_config in ${XAPIAN_CONFIG}; do
117 if ${xapian_config} --version > /dev/null 2>&1; then
120 xapian_cxxflags=$(${xapian_config} --cxxflags)
121 xapian_ldflags=$(${xapian_config} --libs)
125 if [ ${have_xapian} = "0" ]; then
127 errors=$((errors + 1))
130 printf "Checking for GMime 2.4 development files... "
131 if pkg-config --modversion gmime-2.4 > /dev/null 2>&1; then
134 gmime_cflags=$(pkg-config --cflags gmime-2.4)
135 gmime_ldflags=$(pkg-config --libs gmime-2.4)
139 errors=$((errors + 1))
142 printf "Checking for talloc development files... "
143 if pkg-config --modversion talloc > /dev/null 2>&1; then
146 talloc_cflags=$(pkg-config --cflags talloc)
147 talloc_ldflags=$(pkg-config --libs talloc)
152 errors=$((errors + 1))
155 printf "Checking for valgrind development files... "
156 if pkg-config --modversion valgrind > /dev/null 2>&1; then
159 valgrind_cflags=$(pkg-config --cflags valgrind)
161 printf "No (but that's fine).\n"
165 if pkg-config --modversion emacs > /dev/null 2>&1; then
166 emacs_lispdir=$(pkg-config emacs --variable sitepkglispdir)
168 emacs_lispdir='$(prefix)/share/emacs/site-lisp'
171 if [ $errors -gt 0 ]; then
174 *** Error: The dependencies of notmuch could not be satisfied. You will
175 need to install the following packages before being able to compile
179 if [ $have_xapian -eq 0 ]; then
180 echo " Xapian library (including development files such as headers)"
181 echo " http://xapian.org/"
183 if [ $have_gmime -eq 0 ]; then
184 echo " GMime 2.4 library (including development files such as headers)"
185 echo " http://spruce.sourceforge.net/gmime/"
187 if [ $have_talloc -eq 0 ]; then
188 echo " The talloc library (including development files such as headers)"
189 echo " http://talloc.samba.org/"
193 With any luck, you're using a modern, package-based operating system
194 that has all of these packages available in the distribution. In that
195 case a simple command will install everything you need. For example:
197 On Debian and similar systems:
199 sudo apt-get install libxapian-dev libgmime-2.4-dev libtalloc-dev
201 Or on Fedora and similar systems:
203 sudo yum install xapian-core-devel gmime-devel libtalloc-devel
205 On other systems, similar commands can be used, but the details of the
206 package names may be different.
209 if [ $have_pkg_config -eq 0 ]; then
211 Note: the pkg-config program is not available. This configure script
212 uses pkg-config to find the compilation flags required to link against
213 the various libraries needed by notmuch. It's possible you simply need
214 to install pkg-config with a command such as:
216 sudo apt-get install pkg-config
218 sudo yum install pkgconfig
220 But if pkg-config is not available for your system, then you will need
221 to modify the configure script to manually set the cflags and ldflags
222 variables to the correct values to link against each library in each
223 case that pkg-config could not be used to determine those values.
228 When you have installed the necessary dependencies, you can run
229 configure again to ensure the packages can be found, or simply run
230 "make" to compile notmuch.
236 printf "Checking for getline... "
237 if ${CC} -o config/have_getline config/have_getline.c > /dev/null 2>&1
242 printf "No (will use our own instead).\n"
245 rm -f config/have_getline
249 All required packages were found. You may now run the following
250 commands to compile and install notmuch:
257 # construct the Makefile.config
258 cat > Makefile.config <<EOF
259 # This Makefile.config was automatically generated by the ./configure
260 # script of notmuch. If the configure script identified anything
261 # incorrectly, then you can edit this file to try to correct things,
262 # but be warned that if configure is run again it will destroy your
263 # changes, (and this could happen by simply calling "make" if the
264 # configure script is updated).
266 # The C compiler to use
269 # The C++ compiler to use
272 # Default FLAGS for C compiler (can be overridden by user such as "make CFLAGS=-g")
275 # Default FLAGS for C++ compiler (can be overridden by user such as "make CXXFLAGS=-g")
276 CXXFLAGS = ${CXXFLAGS}
278 # The prefix to which notmuch should be installed
281 # The directory to which notmuch libraries should be installed
282 libdir = ${LIBDIR:=$PREFIX/lib}
284 # The directory to which emacs lisp files should be installed
285 emacs_lispdir=${emacs_lispdir}
287 # The directory to which desktop files should be installed
288 desktop_dir = \${prefix}/share/applications
290 # Whether the getline function is available (if not, then notmuch will
291 # build its own version)
292 HAVE_GETLINE = ${have_getline}
294 # Flags needed to compile and link against Xapian
295 XAPIAN_CXXFLAGS = ${xapian_cxxflags}
296 XAPIAN_LDFLAGS = ${xapian_ldflags}
298 # Flags needed to compile and link against GMime-2.4
299 GMIME_CFLAGS = ${gmime_cflags}
300 GMIME_LDFLAGS = ${gmime_ldflags}
302 # Flags needed to compile and link against talloc
303 TALLOC_CFLAGS = ${talloc_cflags}
304 TALLOC_LDFLAGS = ${talloc_ldflags}
306 # Whether valgrind header files are available
307 HAVE_VALGRIND = ${have_valgrind}
309 # And if so, flags needed at compile time for valgrind macros
310 VALGRIND_CFLAGS = ${valgrind_cflags}
312 # Combined flags for compiling and linking against all of the above
313 CONFIGURE_CFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS) \\
314 \$(TALLOC_CFLAGS) -DHAVE_VALGRIND=\$(HAVE_VALGRIND) \\
316 CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS) \\
317 \$(TALLOC_CFLAGS) -DHAVE_VALGRIND=\$(HAVE_VALGRIND) \\
318 \$(VALGRIND_CFLAGS) \$(XAPIAN_CXXFLAGS)
319 CONFIGURE_LDFLAGS = \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(XAPIAN_LDFLAGS)