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]
53 --libdir=LIBDIR Install libraries in LIBDIR [$LIBDIR]
55 By default, "make install" will install the resulting program to
56 $PREFIX/bin, documentation to $PREFIX/share, etc. You can
57 specify an installation prefix other than $PREFIX using
58 --prefix, for instance:
60 ./configure --prefix=\$HOME
65 # Parse command-line options
67 if [ "${option}" = '--help' ] ; then
70 elif [ "${option%%=*}" = '--prefix' ] ; then
72 elif [ "${option%%=*}" = '--libdir' ] ; then
75 echo "Unrecognized option: ${option}."
84 Welcome to Notmuch, a system for indexing, searching and tagging your email.
86 We hope that the process of building and installing notmuch is quick
87 and smooth so that you can soon be reading and processing your email
88 more efficiently than ever.
90 If anything goes wrong in the configure process, you can override any
91 decisions it makes by manually editing the Makefile.config file that
92 it creates. Also please do as much as you can to figure out what could
93 be different on your machine compared to those of the notmuch
94 developers. Then, please email those details to the Notmuch list
95 (notmuch@notmuchmail.org) so that we can hopefully make future
96 versions of notmuch easier for you to use.
98 We'll now investigate your system to verify that all required
99 dependencies are available:
105 if pkg-config --version > /dev/null 2>&1; then
111 printf "Checking for Xapian development files... "
113 for xapian_config in ${XAPIAN_CONFIG}; do
114 if ${xapian_config} --version > /dev/null 2>&1; then
117 xapian_cxxflags=$(${xapian_config} --cxxflags)
118 xapian_ldflags=$(${xapian_config} --libs)
122 if [ ${have_xapian} = "0" ]; then
124 errors=$((errors + 1))
127 printf "Checking for GMime 2.4 development files... "
128 if pkg-config --modversion gmime-2.4 > /dev/null 2>&1; then
131 gmime_cflags=$(pkg-config --cflags gmime-2.4)
132 gmime_ldflags=$(pkg-config --libs gmime-2.4)
136 errors=$((errors + 1))
139 printf "Checking for talloc development files... "
140 if pkg-config --modversion talloc > /dev/null 2>&1; then
143 talloc_cflags=$(pkg-config --cflags talloc)
144 talloc_ldflags=$(pkg-config --libs talloc)
149 errors=$((errors + 1))
152 printf "Checking for valgrind development files... "
153 if pkg-config --modversion valgrind > /dev/null 2>&1; then
156 valgrind_cflags=$(pkg-config --cflags valgrind)
158 printf "No (but that's fine).\n"
162 if pkg-config --modversion emacs > /dev/null 2>&1; then
163 emacs_lispdir=$(pkg-config emacs --variable sitepkglispdir)
165 emacs_lispdir='$(prefix)/share/emacs/site-lisp'
168 if [ $errors -gt 0 ]; then
171 *** Error: The dependencies of notmuch could not be satisfied. You will
172 need to install the following packages before being able to compile
176 if [ $have_xapian -eq 0 ]; then
177 echo " Xapian library (including development files such as headers)"
178 echo " http://xapian.org/"
180 if [ $have_gmime -eq 0 ]; then
181 echo " GMime 2.4 library (including development files such as headers)"
182 echo " http://spruce.sourceforge.net/gmime/"
184 if [ $have_talloc -eq 0 ]; then
185 echo " The talloc library (including development files such as headers)"
186 echo " http://talloc.samba.org/"
190 With any luck, you're using a modern, package-based operating system
191 that has all of these packages available in the distribution. In that
192 case a simple command will install everything you need. For example:
194 On Debian and similar systems:
196 sudo apt-get install libxapian-dev libgmime-2.4-dev libtalloc-dev
198 Or on Fedora and similar systems:
200 sudo yum install xapian-core-devel gmime-devel libtalloc-devel
202 On other systems, similar commands can be used, but the details of the
203 package names may be different.
206 if [ $have_pkg_config -eq 0 ]; then
208 Note: the pkg-config program is not available. This configure script
209 uses pkg-config to find the compilation flags required to link against
210 the various libraries needed by notmuch. It's possible you simply need
211 to install pkg-config with a command such as:
213 sudo apt-get install pkg-config
215 sudo yum install pkgconfig
217 But if pkg-config is not available for your system, then you will need
218 to modify the configure script to manually set the cflags and ldflags
219 variables to the correct values to link against each library in each
220 case that pkg-config could not be used to determine those values.
225 When you have installed the necessary dependencies, you can run
226 configure again to ensure the packages can be found, or simply run
227 "make" to compile notmuch.
233 printf "Checking for getline... "
234 if ${CC} -o config/have_getline config/have_getline.c > /dev/null 2>&1
239 printf "No (will use our own instead).\n"
242 rm -f config/have_getline
246 All required packages were found. You may now run the following
247 commands to compile and install notmuch:
254 # construct the Makefile.config
255 cat > Makefile.config <<EOF
256 # This Makefile.config was automatically generated by the ./configure
257 # script of notmuch. If the configure script identified anything
258 # incorrectly, then you can edit this file to try to correct things,
259 # but be warned that if configure is run again it will destroy your
260 # changes, (and this could happen by simply calling "make" if the
261 # configure script is updated).
263 # The C compiler to use
266 # The C++ compiler to use
269 # Default FLAGS for C compiler (can be overridden by user such as "make CFLAGS=-g")
272 # Default FLAGS for C++ compiler (can be overridden by user such as "make CXXFLAGS=-g")
273 CXXFLAGS = ${CXXFLAGS}
275 # The prefix to which notmuch should be installed
278 # The directory to which notmuch libraries should be installed
281 # The directory to which emacs lisp files should be installed
282 emacs_lispdir=${emacs_lispdir}
284 # The directory to which desktop files should be installed
285 desktop_dir = \${prefix}/share/applications
287 # Whether the getline function is available (if not, then notmuch will
288 # build its own version)
289 HAVE_GETLINE = ${have_getline}
291 # Flags needed to compile and link against Xapian
292 XAPIAN_CXXFLAGS = ${xapian_cxxflags}
293 XAPIAN_LDFLAGS = ${xapian_ldflags}
295 # Flags needed to compile and link against GMime-2.4
296 GMIME_CFLAGS = ${gmime_cflags}
297 GMIME_LDFLAGS = ${gmime_ldflags}
299 # Flags needed to compile and link against talloc
300 TALLOC_CFLAGS = ${talloc_cflags}
301 TALLOC_LDFLAGS = ${talloc_ldflags}
303 # Whether valgrind header files are available
304 HAVE_VALGRIND = ${have_valgrind}
306 # And if so, flags needed at compile time for valgrind macros
307 VALGRIND_CFLAGS = ${valgrind_cflags}
309 # Combined flags for compiling and linking against all of the above
310 CONFIGURE_CFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS) \\
311 \$(TALLOC_CFLAGS) -DHAVE_VALGRIND=\$(HAVE_VALGRIND) \\
313 CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS) \\
314 \$(TALLOC_CFLAGS) -DHAVE_VALGRIND=\$(HAVE_VALGRIND) \\
315 \$(VALGRIND_CFLAGS) \$(XAPIAN_CXXFLAGS)
316 CONFIGURE_LDFLAGS = \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(XAPIAN_LDFLAGS)