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