]> git.notmuchmail.org Git - notmuch/blob - configure
Make search filters handle disjunctive queries.
[notmuch] / configure
1 #! /bin/sh
2
3 CC=${CC:-gcc}
4 CXX=${CXX:-g++}
5
6 cat <<EOF
7 Welcome to Notmuch, a system for indexing, searching and tagging your email.
8
9 We hope that the process of building and installing notmuch is quick
10 and smooth so that you can soon be reading and processing your email
11 more efficiently than ever.
12
13 If anything goes wrong in the configure process, you can override any
14 decisions it makes by manually editing the Makefile.config file that
15 it creates. Also please do as much as you can to figure out what could
16 be different on your machine compared to those of the notmuch
17 developers. Then, please email those details to the Notmuch list
18 (notmuch@notmuchmail.org) so that we can hopefully make future
19 versions of notmuch easier for you to use.
20
21 We'll now investigate your system to verify that all required
22 dependencies are available:
23
24 EOF
25
26 errors=0
27
28 if pkg-config --version > /dev/null 2>&1; then
29     have_pkg_config=1
30 else
31     have_pkg_config=0
32 fi
33
34 printf "Checking for Xapian development files... "
35 if xapian-config --version > /dev/null 2>&1; then
36     printf "Yes.\n"
37     have_xapian=1
38     xapian_cxxflags=$(xapian-config --cxxflags)
39     xapian_ldflags=$(xapian-config --libs)
40 else
41     printf "No.\n"
42     have_xapian=0
43     errors=$((errors + 1))
44 fi
45
46 printf "Checking for GMime 2.4 development files... "
47 if pkg-config --modversion gmime-2.4 > /dev/null 2>&1; then
48     printf "Yes.\n"
49     have_gmime=1
50     gmime_cflags=$(pkg-config --cflags gmime-2.4)
51     gmime_ldflags=$(pkg-config --libs gmime-2.4)
52 else
53     printf "No.\n"
54     have_gmime=0
55     errors=$((errors + 1))
56 fi
57
58 printf "Checking for talloc development files... "
59 if pkg-config --modversion talloc > /dev/null 2>&1; then
60     printf "Yes.\n"
61     have_talloc=1
62     talloc_cflags=$(pkg-config --cflags talloc)
63     talloc_ldflags=$(pkg-config --libs talloc)
64 else
65     printf "No.\n"
66     have_talloc=0
67     talloc_cflags=
68     errors=$((errors + 1))
69 fi
70
71 printf "Checking for valgrind development files... "
72 if pkg-config --modversion valgrind > /dev/null 2>&1; then
73     printf "Yes.\n"
74     have_valgrind=1
75     valgrind_cflags=$(pkg-config --cflags valgrind)
76 else
77     printf "No (but that's fine).\n"
78     have_valgrind=0
79 fi
80
81 if pkg-config --modversion emacs > /dev/null 2>&1; then
82     emacs_lispdir=$(pkg-config emacs --variable sitepkglispdir)
83 else
84     emacs_lispdir='$(prefix)/share/emacs/site-lisp'
85 fi
86
87 if [ $errors -gt 0 ]; then
88     cat <<EOF
89
90 *** Error: The dependencies of notmuch could not be satisfied. You will
91 need to install the following packages before being able to compile
92 notmuch:
93
94 EOF
95     if [ $have_xapian -eq 0 ]; then
96         echo "  Xapian library (including development files such as headers)"
97         echo "  http://xapian.org/"
98     fi
99     if [ $have_gmime -eq 0 ]; then
100         echo "  GMime 2.4 library (including development files such as headers)"
101         echo "  http://spruce.sourceforge.net/gmime/"
102     fi
103     if [ $have_talloc -eq 0 ]; then
104         echo "  The talloc library (including development files such as headers)"
105         echo "  http://talloc.samba.org/"
106     fi
107     cat <<EOF
108
109 With any luck, you're using a modern, package-based operating system
110 that has all of these packages available in the distribution. In that
111 case a simple command will install everything you need. For example:
112
113 On Debian and similar systems:
114
115         sudo apt-get install libxapian-dev libgmime-2.4-dev libtalloc-dev
116
117 Or on Fedora and similar systems:
118
119         sudo yum install xapian-core-devel gmime-devel libtalloc-devel
120
121 On other systems, similar commands can be used, but the details of the
122 package names may be different.
123
124 EOF
125     if [ $have_pkg_config -eq 0 ]; then
126 cat <<EOF
127 Note: the pkg-config program is not available. This configure script
128 uses pkg-config to find the compilation flags required to link against
129 the various libraries needed by notmuch. It's possible you simply need
130 to install pkg-config with a command such as:
131
132         sudo apt-get install pkg-config
133 Or:
134         sudo yum install pkgconfig
135
136 But if pkg-config is not available for your system, then you will need
137 to modify the configure script to manually set the cflags and ldflags
138 variables to the correct values to link against each library in each
139 case that pkg-config could not be used to determine those values.
140
141 EOF
142     fi
143 cat <<EOF
144 When you have installed the necessary dependencies, you can run
145 configure again to ensure the packages can be found, or simply run
146 "make" to compile notmuch.
147
148 EOF
149     exit 1
150 fi
151
152 printf "Checking for getline... "
153 if ${CC} -o config/have_getline config/have_getline.c > /dev/null 2>&1
154 then
155     printf "Yes.\n"
156     have_getline=1
157 else
158     printf "No (will use our own instead).\n"
159     have_getline=0
160 fi
161 rm -f config/have_getline
162
163 cat <<EOF
164
165 All required packages were found. You may now run the following
166 commands to compile and install notmuch:
167
168         make
169         sudo make install
170
171 EOF
172
173 # construct the Makefile.config
174 cat > Makefile.config <<EOF
175 # This Makefile.config was automatically generated by the ./configure
176 # script of notmuch. If the configure script identified anything
177 # incorrectly, then you can edit this file to try to correct things,
178 # but be warned that if configure is run again it will destroy your
179 # changes, (and this could happen by simply calling "make" if the
180 # configure script is updated).
181
182 # The C compiler to use
183 CC = ${CC}
184
185 # The C++ compiler to use
186 CXX = ${CXX}
187
188 # The prefix to which notmuch should be installed
189 prefix = /usr/local
190
191 # The directory to which emacs lisp files should be installed
192 emacs_lispdir=${emacs_lispdir}
193
194 # Whether the getline function is available (if not, then notmuch will
195 # build its own version)
196 HAVE_GETLINE = ${have_getline}
197
198 # Flags needed to compile and link against Xapian
199 XAPIAN_CXXFLAGS = ${xapian_cxxflags}
200 XAPIAN_LDFLAGS = ${xapian_ldflags}
201
202 # Flags needed to compile and link against GMime-2.4
203 GMIME_CFLAGS = ${gmime_cflags}
204 GMIME_LDFLAGS = ${gmime_ldflags}
205
206 # Flags needed to compile and link against talloc
207 TALLOC_CFLAGS = ${talloc_cflags}
208 TALLOC_LDFLAGS = ${talloc_ldflags}
209
210 # Whether valgrind header files are available
211 HAVE_VALGRIND = ${have_valgrind}
212
213 # And if so, flags needed at compile time for valgrind macros
214 VALGRIND_CFLAGS = ${valgrind_cflags}
215
216 # Combined flags for compiling and linking against all of the above
217 override CFLAGS += -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS)      \\
218                    \$(TALLOC_CFLAGS) -DHAVE_VALGRIND=\$(HAVE_VALGRIND)   \\
219                    \$(VALGRIND_CFLAGS)
220 override CXXFLAGS += -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS)    \\
221                      \$(TALLOC_CFLAGS) -DHAVE_VALGRIND=\$(HAVE_VALGRIND) \\
222                      \$(VALGRIND_CFLAGS) \$(XAPIAN_CXXFLAGS)
223 override LDFLAGS += \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(XAPIAN_LDFLAGS)
224 EOF