]> git.notmuchmail.org Git - notmuch/blob - configure
fix debian packaging emacsen installation
[notmuch] / configure
1 #! /bin/sh
2
3 # defaults
4 PREFIX=/usr/local
5
6 # option parsing
7 for option; do
8     if [ "${option%=*}" = '--prefix' ] ; then
9         PREFIX="${option#*=}"
10     fi
11 done
12
13 cat <<EOF
14 Welcome to Notmuch, a system for indexing, searching and tagging your email.
15
16 We hope that the process of building and installing notmuch is quick
17 and smooth so that you can soon be reading and processing your email
18 more efficiently than ever.
19
20 If anything goes wrong in this process, please do as much as you can
21 to figure out what could be different on your machine compared to
22 those of the notmuch developers. Then, please email those details to
23 the Notmuch list (notmuch@notmuchmail.org) so that we can hopefully make
24 future versions of notmuch easier for you to use.
25
26 We'll now investigate your system to find verify that various software
27 components that notmuch relies on are available.
28
29 EOF
30
31 errors=0
32
33 if pkg-config --version > /dev/null 2>&1; then
34     have_pkg_config=1
35 else
36     have_pkg_config=0
37 fi
38
39 if xapian-config --version > /dev/null 2>&1; then
40     echo "Checking for Xapian development files... Yes."
41     have_xapian=1
42 else
43     echo "Checking for Xapian development files... No."
44     have_xapian=0
45     errors=$((errors + 1))
46 fi
47
48 if pkg-config --modversion gmime-2.4 > /dev/null 2>&1; then
49     echo "Checking for GMime 2.4 development files... Yes."
50     have_gmime=1
51 else
52     echo "Checking for GMime 2.4 development files... No."
53     have_gmime=0
54     errors=$((errors + 1))
55 fi
56
57 if pkg-config --modversion talloc > /dev/null 2>&1; then
58     echo "Checking for talloc development files... Yes."
59     have_talloc=1
60 else
61     echo "Checking for talloc development files... No."
62     have_talloc=0
63     errors=$((errors + 1))
64 fi
65
66 if printf 'int main(){return 0;}' | gcc -x c -lz -o /dev/null - > /dev/null 2>&1; then
67     echo "Checking for zlib development files... Yes."
68     have_zlib=1
69 else
70     echo "Checking for zlib development files... No."
71     have_zlib=0
72     errors=$((errors + 1))
73 fi
74
75 if pkg-config --modversion valgrind > /dev/null 2>&1; then
76     echo "Checking for valgrind development files... Yes."
77     have_valgrind=-DHAVE_VALGRIND
78 else
79     echo "Checking for valgrind development files... No."
80     have_valgrind=
81 fi
82
83 if [ $errors -gt 0 ]; then
84     cat <<EOF
85
86 *** Error: The dependencies of notmuch could not be satisfied. You will
87 need to install the following packages before being able to compile
88 notmuch:
89
90 EOF
91     if [ $have_xapian -eq 0 ]; then
92         echo "  Xapian library (including development files such as headers)"
93         echo "  http://xapian.org/"
94     fi
95     if [ $have_gmime -eq 0 ]; then
96         echo "  GMime 2.4 library (including development files such as headers)"
97         echo "  http://spruce.sourceforge.net/gmime/"
98     fi
99     if [ $have_talloc -eq 0 ]; then
100         echo "  The talloc library (including development files such as headers)"
101         echo "  http://talloc.samba.org/"
102     fi
103     if [ $have_zlib -eq 0 ]; then
104         echo "  The zlib library (including development files such as headers)"
105     fi
106     cat <<EOF
107
108 On a modern, package-based operating system such as Debian, you can
109 install all of the dependencies with the following simple command
110 line:
111
112         sudo apt-get install libxapian-dev libgmime-2.4-dev libtalloc-dev libz-dev
113
114 On other systems, a similar command can be used, but the details of the 
115 package names may be different, (such as "devel" in place of "dev").
116
117 EOF
118     if [ $have_pkg_config -eq 0 ]; then
119 cat <<EOF
120 Note: the pkg-config program is not available. Both this configure
121 script and the Makefile of notmuch use pkg-config to find the
122 compilation flags required to link against the various libraries
123 needed by notmuch. It's possible you simply need to install pkg-config
124 with a command such as:
125
126         sudo apt-get install pkg-config
127
128 But if pkg-config is not available for your system, then you will need
129 to manually edit the notmuch Makefile to set NOTMUCH_CFLAGS and
130 NOTMUCH_LDFLAGS to the correct values without calling pkg-config.
131
132 EOF
133     fi
134 cat <<EOF
135 When you have installed the necessary dependencies, you can run
136 configure again to ensure the packages can be found, or simply run
137 "make" to compile notmuch.
138
139 EOF
140     exit 1
141 fi
142
143 cat <<EOF
144
145 All required packages were found. You may now run the following
146 commands to compile and install notmuch:
147
148         make
149         sudo make install
150
151 EOF
152
153 # construct the Makefile.config
154 cat > Makefile.config <<EOF
155 prefix = $PREFIX
156 bash_completion_dir = /etc/bash_completion.d
157 CFLAGS += ${have_valgrind}
158 EOF