1#! /bin/sh 2 3set -u 4 5# Test whether this shell is capable of parameter substring processing. 6( option='a/b'; : ${option#*/} ) 2>/dev/null || { 7 echo " 8The shell interpreting '$0' is lacking some required features. 9 10To work around this problem you may try to execute: 11 12 ksh $0 $* 13 or 14 bash $0 $* 15" 16 exit 1 17} 18 19# Store original IFS value so it can be changed (and restored) in many places. 20readonly DEFAULT_IFS="$IFS" 21 22# The top-level directory for the source. This ./configure and all Makefiles 23# are good with ${srcdir} usually being relative. Some components (e.g. tests) 24# are executed in subdirectories and for those it is simpler to use 25# ${NOTMUCH_SRCDIR} which holds absolute path to the source. 26srcdir=$(dirname "$0") 27NOTMUCH_SRCDIR=$(cd "$srcdir" && pwd) 28 29case $NOTMUCH_SRCDIR in ( *\'* | *['\"`$']* ) 30 echo "Definitely unsafe characters in source path '$NOTMUCH_SRCDIR'". 31 exit 1 32esac 33 34case $PWD in ( *\'* | *['\"`$']* ) 35 echo "Definitely unsafe characters in current directory '$PWD'". 36 exit 1 37esac 38 39# In case of whitespace, builds may work, tests definitely will not. 40case $NOTMUCH_SRCDIR in ( *["$IFS"]* ) 41 echo "Whitespace in source path '$NOTMUCH_SRCDIR' not supported". 42 exit 1 43esac 44 45case $PWD in ( *["$IFS"]* ) 46 echo "Whitespace in current directory '$PWD' not supported". 47 exit 1 48esac 49 50subdirs="util compat lib parse-time-string completion doc emacs" 51subdirs="${subdirs} performance-test test" 52subdirs="${subdirs} bindings" 53 54# For a non-srcdir configure invocation (such as ../configure), create 55# the directory structure and copy Makefiles. 56if [ "$srcdir" != "." ]; then 57 58 for dir in . ${subdirs}; do 59 mkdir -p "$dir" 60 cp "$srcdir"/"$dir"/Makefile.local "$dir" 61 cp "$srcdir"/"$dir"/Makefile "$dir" 62 done 63 64 # Emacs only likes to generate compiled files next to the .el files 65 # by default so copy these as well (which is not ideal). 66 cp -a "$srcdir"/emacs/*.el emacs 67 68 # We were not able to create fully working Makefile using ruby mkmf.rb 69 # so ruby bindings source files are copied as well (ditto -- not ideal). 70 mkdir bindings/ruby 71 cp -a "$srcdir"/bindings/ruby/*.[ch] bindings/ruby 72 cp -a "$srcdir"/bindings/ruby/extconf.rb bindings/ruby 73 74 # Use the same hack to replicate python-cffi source for 75 # out-of-tree builds (again, not ideal). 76 mkdir bindings/python-cffi 77 cp -a "$srcdir"/bindings/python-cffi/tests \ 78 "$srcdir"/bindings/python-cffi/notmuch2 \ 79 "$srcdir"/bindings/python-cffi/setup.py \ 80 bindings/python-cffi/ 81fi 82 83# Set several defaults (optionally specified by the user in 84# environment variables) 85BASHCMD=${BASHCMD:-bash} 86PERL=${PERL:-perl} 87CC=${CC:-cc} 88CXX=${CXX:-c++} 89CFLAGS=${CFLAGS:--g -O2} 90CPPFLAGS=${CPPFLAGS:-} 91CXXFLAGS_for_sh=${CXXFLAGS:-${CFLAGS}} 92CXXFLAGS=${CXXFLAGS:-\$(CFLAGS)} 93LDFLAGS=${LDFLAGS:-} 94XAPIAN_CONFIG=${XAPIAN_CONFIG:-} 95PYTHON=${PYTHON:-} 96RUBY=${RUBY:-ruby} 97 98# We don't allow the EMACS or GZIP Makefile variables inherit values 99# from the environment as we do with CC and CXX above. The reason is 100# that these names as environment variables have existing uses other 101# than the program name that we want. (EMACS is set to 't' when a 102# shell is running within emacs and GZIP specifies arguments to pass 103# on the gzip command line). 104 105# Set the defaults for values the user can specify with command-line 106# options. 107PREFIX=/usr/local 108LIBDIR= 109WITH_DOCS=1 110WITH_API_DOCS=1 111WITH_PYTHON_DOCS=1 112WITH_EMACS=1 113WITH_DESKTOP=1 114WITH_BASH=1 115WITH_RPATH=1 116WITH_RUBY=1 117WITH_ZSH=1 118WITH_RETRY_LOCK=1 119 120usage () 121{ 122 cat <<EOF 123Usage: ./configure [options]... 124 125This script configures notmuch to build on your system. 126 127It verifies that dependencies are available, determines flags needed 128to compile and link against various required libraries, and identifies 129whether various system functions can be used or if locally-provided 130replacements will be built instead. 131 132Finally, it allows you to control various aspects of the build and 133installation process. 134 135First, some common variables can specified via environment variables: 136 137 CC The C compiler to use 138 CFLAGS Flags to pass to the C compiler 139 CPPFLAGS Flags to pass to the C preprocessor 140 CXX The C++ compiler to use 141 CXXFLAGS Flags to pass to the C compiler 142 LDFLAGS Flags to pass when linking 143 144Each of these values can further be controlled by specifying them 145later on the "make" command line. 146 147Other environment variables can be used to control configure itself, 148(and for which there is no equivalent build-time control): 149 150 XAPIAN_CONFIG The program to use to determine flags for 151 compiling and linking against the Xapian 152 library. [$XAPIAN_CONFIG] 153 PYTHON Name of python command to use in 154 configure and the test suite. 155 RUBY Name of ruby command to use in 156 configure and the test suite. 157 158Additionally, various options can be specified on the configure 159command line. 160 161 --prefix=PREFIX Install files in PREFIX [$PREFIX] 162 163By default, "make install" will install the resulting program to 164$PREFIX/bin, documentation to $PREFIX/man, etc. You can 165specify an installation prefix other than $PREFIX using 166--prefix, for instance: 167 168 ./configure --prefix=\$HOME 169 170Fine tuning of some installation directories is available: 171 172 --libdir=DIR Install libraries to DIR [PREFIX/lib] 173 --includedir=DIR Install header files to DIR [PREFIX/include] 174 --mandir=DIR Install man pages to DIR [PREFIX/share/man] 175 --infodir=DIR Install man pages to DIR [PREFIX/share/man] 176 --sysconfdir=DIR Read-only single-machine data [PREFIX/etc] 177 --emacslispdir=DIR Emacs code [PREFIX/share/emacs/site-lisp] 178 --emacsetcdir=DIR Emacs miscellaneous files [PREFIX/share/emacs/site-lisp] 179 --bashcompletiondir=DIR Bash completions files [PREFIX/share/bash-completion/completions] 180 --zshcompletiondir=DIR Zsh completions files [PREFIX/share/zsh/site-functions] 181 182Some features can be disabled (--with-feature=no is equivalent to 183--without-feature) : 184 185 --without-bash-completion Do not install bash completions files 186 --without-docs Do not install documentation 187 --without-api-docs Do not install API man page 188 --without-emacs Do not install lisp file 189 --without-desktop Do not install desktop file 190 --without-ruby Do not install ruby bindings 191 --without-zsh-completion Do not install zsh completions files 192 --without-retry-lock Do not use blocking xapian opens, even if available 193 194Additional options are accepted for compatibility with other 195configure-script calling conventions, but don't do anything yet: 196 197 --build=<cpu>-<vendor>-<os> Currently ignored 198 --host=<cpu>-<vendor>-<os> Currently ignored 199 --datadir=DIR Currently ignored 200 --localstatedir=DIR Currently ignored 201 --libexecdir=DIR Currently ignored 202 --disable-maintainer-mode Currently ignored 203 --disable-dependency-tracking Currently ignored 204 205EOF 206} 207 208# Parse command-line options 209for option; do 210 if [ "${option}" = '--help' ] ; then 211 usage 212 exit 0 213 elif [ "${option%%=*}" = '--prefix' ] ; then 214 PREFIX="${option#*=}" 215 elif [ "${option%%=*}" = '--libdir' ] ; then 216 LIBDIR="${option#*=}" 217 elif [ "${option%%=*}" = '--includedir' ] ; then 218 INCLUDEDIR="${option#*=}" 219 elif [ "${option%%=*}" = '--mandir' ] ; then 220 MANDIR="${option#*=}" 221 elif [ "${option%%=*}" = '--infodir' ] ; then 222 INFODIR="${option#*=}" 223 elif [ "${option%%=*}" = '--sysconfdir' ] ; then 224 SYSCONFDIR="${option#*=}" 225 elif [ "${option%%=*}" = '--emacslispdir' ] ; then 226 EMACSLISPDIR="${option#*=}" 227 elif [ "${option%%=*}" = '--emacsetcdir' ] ; then 228 EMACSETCDIR="${option#*=}" 229 elif [ "${option%%=*}" = '--bashcompletiondir' ] ; then 230 BASHCOMPLETIONDIR="${option#*=}" 231 elif [ "${option%%=*}" = '--zshcompletiondir' ] ; then 232 ZSHCOMLETIONDIR="${option#*=}" 233 elif [ "${option%%=*}" = '--with-docs' ]; then 234 if [ "${option#*=}" = 'no' ]; then 235 WITH_DOCS=0 236 WITH_API_DOCS=0 237 else 238 WITH_DOCS=1 239 fi 240 elif [ "${option}" = '--without-docs' ] ; then 241 WITH_DOCS=0 242 WITH_API_DOCS=0 243 elif [ "${option%%=*}" = '--with-api-docs' ]; then 244 if [ "${option#*=}" = 'no' ]; then 245 WITH_API_DOCS=0 246 else 247 WITH_API_DOCS=1 248 fi 249 elif [ "${option}" = '--without-api-docs' ] ; then 250 WITH_API_DOCS=0 251 elif [ "${option%%=*}" = '--with-emacs' ]; then 252 if [ "${option#*=}" = 'no' ]; then 253 WITH_EMACS=0 254 else 255 WITH_EMACS=1 256 fi 257 elif [ "${option}" = '--without-emacs' ] ; then 258 WITH_EMACS=0 259 elif [ "${option%%=*}" = '--with-desktop' ]; then 260 if [ "${option#*=}" = 'no' ]; then 261 WITH_DESKTOP=0 262 else 263 WITH_DESKTOP=1 264 fi 265 elif [ "${option}" = '--without-desktop' ] ; then 266 WITH_DESKTOP=0 267 elif [ "${option%%=*}" = '--with-bash-completion' ]; then 268 if [ "${option#*=}" = 'no' ]; then 269 WITH_BASH=0 270 else 271 WITH_BASH=1 272 fi 273 elif [ "${option}" = '--without-bash-completion' ] ; then 274 WITH_BASH=0 275 elif [ "${option%%=*}" = '--with-rpath' ]; then 276 if [ "${option#*=}" = 'no' ]; then 277 WITH_RPATH=0 278 else 279 WITH_RPATH=1 280 fi 281 elif [ "${option}" = '--without-rpath' ] ; then 282 WITH_RPATH=0 283 elif [ "${option%%=*}" = '--with-ruby' ]; then 284 if [ "${option#*=}" = 'no' ]; then 285 WITH_RUBY=0 286 else 287 WITH_RUBY=1 288 fi 289 elif [ "${option}" = '--without-ruby' ] ; then 290 WITH_RUBY=0 291 elif [ "${option%%=*}" = '--with-retry-lock' ]; then 292 if [ "${option#*=}" = 'no' ]; then 293 WITH_RETRY_LOCK=0 294 else 295 WITH_RETRY_LOCK=1 296 fi 297 elif [ "${option}" = '--without-retry-lock' ] ; then 298 WITH_RETRY_LOCK=0 299 elif [ "${option%%=*}" = '--with-zsh-completion' ]; then 300 if [ "${option#*=}" = 'no' ]; then 301 WITH_ZSH=0 302 else 303 WITH_ZSH=1 304 fi 305 elif [ "${option}" = '--without-zsh-completion' ] ; then 306 WITH_ZSH=0 307 elif [ "${option%%=*}" = '--build' ] ; then 308 true 309 elif [ "${option%%=*}" = '--host' ] ; then 310 true 311 elif [ "${option%%=*}" = '--datadir' ] ; then 312 true 313 elif [ "${option%%=*}" = '--localstatedir' ] ; then 314 true 315 elif [ "${option%%=*}" = '--libexecdir' ] ; then 316 true 317 elif [ "${option}" = '--disable-maintainer-mode' ] ; then 318 true 319 elif [ "${option}" = '--disable-dependency-tracking' ] ; then 320 true 321 else 322 echo "Unrecognized option: ${option}" 323 echo "See:" 324 echo " $0 --help" 325 echo "" 326 exit 1 327 fi 328done 329 330# We set this value early, (rather than just while printing the 331# Makefile.config file later like most values), because we need to 332# actually investigate this value compared to the ldconfig_paths value 333# below. 334if [ -z "$LIBDIR" ] ; then 335 libdir_expanded="${PREFIX}/lib" 336else 337 # very non-general variable expansion 338 libdir_expanded=$(printf %s "$LIBDIR" | sed "s|\${prefix}|${PREFIX}|; s|\$prefix\>|${PREFIX}|; s|//*|/|g") 339fi 340 341cat <<EOF 342Welcome to Notmuch, a system for indexing, searching and tagging your email. 343 344We hope that the process of building and installing notmuch is quick 345and smooth so that you can soon be reading and processing your email 346more efficiently than ever. 347 348If anything goes wrong in the configure process, you can override any 349decisions it makes by manually editing the Makefile.config file that 350it creates. Also please do as much as you can to figure out what could 351be different on your machine compared to those of the notmuch 352developers. Then, please email those details to the Notmuch list 353(notmuch@notmuchmail.org) so that we can hopefully make future 354versions of notmuch easier for you to use. 355 356We'll now investigate your system to verify that all required 357dependencies are available: 358 359EOF 360 361errors=0 362printf "int main(void){return 0;}\n" > minimal.c 363 364printf "Sanity checking C compilation environment... " 365test_cmdline="${CC} ${CFLAGS} ${CPPFLAGS} minimal.c ${LDFLAGS} -o minimal" 366if ${test_cmdline} > /dev/null 2>&1 367then 368 printf "OK.\n" 369else 370 printf "Fail.\n" 371 errors=$((errors + 1)) 372 printf Executed:; printf ' %s' ${test_cmdline}; echo 373 ${test_cmdline} 374fi 375 376printf "Sanity checking C++ compilation environment... " 377test_cmdline="${CXX} ${CXXFLAGS_for_sh} ${CPPFLAGS} minimal.c ${LDFLAGS} -o minimal" 378if ${test_cmdline} > /dev/null 2>&1 379then 380 printf "OK.\n" 381else 382 printf "Fail.\n" 383 errors=$((errors + 1)) 384 printf Executed:; printf ' %s' ${test_cmdline}; echo 385 ${test_cmdline} 386fi 387unset test_cmdline 388 389if [ $errors -gt 0 ]; then 390 cat <<EOF 391*** Error: Initial sanity checking of environment failed. Please try 392running configure in a clean environment, and if the problem persists, 393report a bug. 394EOF 395 rm -f minimal minimal.c 396 exit 1 397fi 398 399printf "Reading libnotmuch version from source... " 400cat > _libversion.c <<EOF 401#include <stdio.h> 402#include "lib/notmuch.h" 403int main(void) { 404 printf("libnotmuch_version_major=%d\n", 405 LIBNOTMUCH_MAJOR_VERSION); 406 printf("libnotmuch_version_minor=%d\n", 407 LIBNOTMUCH_MINOR_VERSION); 408 printf("libnotmuch_version_release=%d\n", 409 LIBNOTMUCH_MICRO_VERSION); 410 return 0; 411} 412EOF 413if ${CC} ${CFLAGS} -I"$srcdir" _libversion.c -o _libversion > /dev/null 2>&1 \ 414 && ./_libversion > _libversion.sh && . ./_libversion.sh 415then 416 printf "OK.\n" 417else 418 cat <<EOF 419 420*** Error: Reading lib/notmuch.h failed. 421Please try running configure again in a clean environment, and if the 422problem persists, report a bug. 423EOF 424 rm -f _libversion _libversion.c _libversion.sh 425 exit 1 426fi 427 428if pkg-config --version > /dev/null 2>&1; then 429 have_pkg_config=1 430else 431 have_pkg_config=0 432fi 433 434 435 436printf "Checking for Xapian development files (>= 1.4.0)... " 437have_xapian=0 438for xapian_config in ${XAPIAN_CONFIG} xapian-config; do 439 if ${xapian_config} --version > /dev/null 2>&1; then 440 xapian_version=$(${xapian_config} --version | sed -e 's/.* //') 441 case $xapian_version in 442 1.[4-9]* | 1.[1-9][0-9]* | [2-9]* | [1-9][0-9]*) 443 printf "Yes (%s).\n" ${xapian_version} 444 have_xapian=1 445 xapian_cxxflags=$(${xapian_config} --cxxflags) 446 xapian_ldflags=$(${xapian_config} --libs) 447 ;; 448 *) printf "Xapian $xapian_version not supported... " 449 esac 450 break 451 fi 452done 453if [ ${have_xapian} = "0" ]; then 454 printf "No.\n" 455 errors=$((errors + 1)) 456fi 457 458GMIME_MINVER=3.0.3 459 460printf "Checking for GMime development files (>= $GMIME_MINVER)... " 461if pkg-config --exists "gmime-3.0 >= $GMIME_MINVER"; then 462 printf "Yes.\n" 463 have_gmime=1 464 gmime_cflags=$(pkg-config --cflags gmime-3.0) 465 gmime_ldflags=$(pkg-config --libs gmime-3.0) 466 467 printf "Checking for GMime session key extraction support... " 468 469 cat > _check_session_keys.c <<EOF 470#include <gmime/gmime.h> 471#include <stdio.h> 472 473int main () { 474 GError *error = NULL; 475 GMimeParser *parser = NULL; 476 GMimeMultipartEncrypted *body = NULL; 477 GMimeDecryptResult *decrypt_result = NULL; 478 GMimeObject *output = NULL; 479 480 g_mime_init (); 481 parser = g_mime_parser_new (); 482 g_mime_parser_init_with_stream (parser, g_mime_stream_file_open("$srcdir/test/corpora/crypto/basic-encrypted.eml", "r", &error)); 483 if (error) return !! fprintf (stderr, "failed to instantiate parser with test/corpora/crypto/basic-encrypted.eml\n"); 484 485 body = GMIME_MULTIPART_ENCRYPTED(g_mime_message_get_mime_part (g_mime_parser_construct_message (parser, NULL))); 486 if (body == NULL) return !! fprintf (stderr, "did not find a multipart encrypted message\n"); 487 488 output = g_mime_multipart_encrypted_decrypt (body, GMIME_DECRYPT_EXPORT_SESSION_KEY, NULL, &decrypt_result, &error); 489 if (error || output == NULL) return !! fprintf (stderr, "decryption failed\n"); 490 491 if (decrypt_result == NULL) return !! fprintf (stderr, "no GMimeDecryptResult found\n"); 492 if (decrypt_result->session_key == NULL) return !! fprintf (stderr, "GMimeDecryptResult has no session key\n"); 493 494 printf ("%s\n", decrypt_result->session_key); 495 return 0; 496} 497EOF 498 if ! TEMP_GPG=$(mktemp -d "${TMPDIR:-/tmp}/notmuch.XXXXXX"); then 499 printf 'No.\nCould not make tempdir for testing session-key support.\n' 500 errors=$((errors + 1)) 501 elif ${CC} ${CFLAGS} ${gmime_cflags} _check_session_keys.c ${gmime_ldflags} -o _check_session_keys \ 502 && GNUPGHOME=${TEMP_GPG} gpg --batch --quiet --import < "$srcdir"/test/gnupg-secret-key.asc \ 503 && SESSION_KEY=$(GNUPGHOME=${TEMP_GPG} ./_check_session_keys) \ 504 && [ $SESSION_KEY = 9:0BACD64099D1468AB07C796F0C0AC4851948A658A15B34E803865E9FC635F2F5 ] 505 then 506 printf "OK.\n" 507 else 508 cat <<EOF 509No. 510*** Error: Could not extract session keys from encrypted message. 511 512This is likely due to your GMime having been built against a old 513version of GPGME. 514 515Please try to rebuild your version of GMime against a more recent 516version of GPGME (at least GPGME 1.8.0). 517EOF 518 if command -v gpgme-config >/dev/null; then 519 printf 'Your current GPGME development version is: %s\n' "$(gpgme-config --version)" 520 else 521 printf 'You do not have the GPGME development libraries installed.\n' 522 fi 523 errors=$((errors + 1)) 524 fi 525 if [ -n "$TEMP_GPG" -a -d "$TEMP_GPG" ]; then 526 rm -rf "$TEMP_GPG" 527 fi 528 529 # see https://github.com/jstedfast/gmime/pull/90 530 # should be fixed in GMime in 3.2.7, but some distros might patch 531 printf "Checking for GMime X.509 certificate validity... " 532 533 cat > _check_x509_validity.c <<EOF 534#include <stdio.h> 535#include <gmime/gmime.h> 536 537int main () { 538 GError *error = NULL; 539 GMimeParser *parser = NULL; 540 GMimeApplicationPkcs7Mime *body = NULL; 541 GMimeSignatureList *sig_list = NULL; 542 GMimeSignature *sig = NULL; 543 GMimeCertificate *cert = NULL; 544 GMimeObject *output = NULL; 545 GMimeValidity validity = GMIME_VALIDITY_UNKNOWN; 546 int len; 547 548 g_mime_init (); 549 parser = g_mime_parser_new (); 550 g_mime_parser_init_with_stream (parser, g_mime_stream_file_open("$srcdir/test/corpora/pkcs7/smime-onepart-signed.eml", "r", &error)); 551 if (error) return !! fprintf (stderr, "failed to instantiate parser with test/corpora/pkcs7/smime-onepart-signed.eml\n"); 552 553 body = GMIME_APPLICATION_PKCS7_MIME(g_mime_message_get_mime_part (g_mime_parser_construct_message (parser, NULL))); 554 if (body == NULL) return !! fprintf (stderr, "did not find a application/pkcs7 message\n"); 555 556 sig_list = g_mime_application_pkcs7_mime_verify (body, GMIME_VERIFY_NONE, &output, &error); 557 if (error || output == NULL) return !! fprintf (stderr, "verify failed\n"); 558 559 if (sig_list == NULL) return !! fprintf (stderr, "no GMimeSignatureList found\n"); 560 len = g_mime_signature_list_length (sig_list); 561 if (len != 1) return !! fprintf (stderr, "expected 1 signature, got %d\n", len); 562 sig = g_mime_signature_list_get_signature (sig_list, 0); 563 if (sig == NULL) return !! fprintf (stderr, "no GMimeSignature found at position 0\n"); 564 cert = g_mime_signature_get_certificate (sig); 565 if (cert == NULL) return !! fprintf (stderr, "no GMimeCertificate found\n"); 566 validity = g_mime_certificate_get_id_validity (cert); 567 if (validity != GMIME_VALIDITY_FULL) return !! fprintf (stderr, "Got validity %d, expected %d\n", validity, GMIME_VALIDITY_FULL); 568 569 return 0; 570} 571EOF 572 if ! TEMP_GPG=$(mktemp -d "${TMPDIR:-/tmp}/notmuch.XXXXXX"); then 573 printf 'No.\nCould not make tempdir for testing X.509 certificate validity support.\n' 574 errors=$((errors + 1)) 575 elif ${CC} ${CFLAGS} ${gmime_cflags} _check_x509_validity.c ${gmime_ldflags} -o _check_x509_validity \ 576 && echo disable-crl-checks > "$TEMP_GPG/gpgsm.conf" \ 577 && echo "4D:E0:FF:63:C0:E9:EC:01:29:11:C8:7A:EE:DA:3A:9A:7F:6E:C1:0D S" >> "$TEMP_GPG/trustlist.txt" \ 578 && GNUPGHOME=${TEMP_GPG} gpgsm --batch --quiet --import < "$srcdir"/test/smime/ca.crt 579 then 580 if GNUPGHOME=${TEMP_GPG} ./_check_x509_validity; then 581 gmime_x509_cert_validity=1 582 printf "Yes.\n" 583 else 584 gmime_x509_cert_validity=0 585 printf "No.\n" 586 if pkg-config --exists "gmime-3.0 >= 3.2.7"; then 587 cat <<EOF 588*** Error: GMime fails to calculate X.509 certificate validity, and 589is later than 3.2.7, which should have fixed this issue. 590 591Please follow up on https://github.com/jstedfast/gmime/pull/90 with 592more details. 593EOF 594 errors=$((errors + 1)) 595 fi 596 fi 597 else 598 printf 'No.\nFailed to set up gpgsm for testing X.509 certificate validity support.\n' 599 errors=$((errors + 1)) 600 fi 601 if [ -n "$TEMP_GPG" -a -d "$TEMP_GPG" ]; then 602 rm -rf "$TEMP_GPG" 603 fi 604 605 # see https://dev.gnupg.org/T3464 606 # there are problems verifying signatures when decrypting with session keys with GPGME 1.13.0 and 1.13.1 607 printf "Checking signature verification when decrypting using session keys... " 608 609 cat > _verify_sig_with_session_key.c <<EOF 610#include <stdio.h> 611#include <gmime/gmime.h> 612 613int main () { 614 GError *error = NULL; 615 GMimeParser *parser = NULL; 616 GMimeMultipartEncrypted *body = NULL; 617 GMimeDecryptResult *result = NULL; 618 GMimeSignatureList *sig_list = NULL; 619 GMimeSignature *sig = NULL; 620 GMimeObject *output = NULL; 621 GMimeSignatureStatus status; 622 int len; 623 624 g_mime_init (); 625 parser = g_mime_parser_new (); 626 g_mime_parser_init_with_stream (parser, g_mime_stream_file_open("$srcdir/test/corpora/crypto/encrypted-signed.eml", "r", &error)); 627 if (error) return !! fprintf (stderr, "failed to instantiate parser with test/corpora/pkcs7/smime-onepart-signed.eml\n"); 628 629 body = GMIME_MULTIPART_ENCRYPTED(g_mime_message_get_mime_part (g_mime_parser_construct_message (parser, NULL))); 630 if (body == NULL) return !! fprintf (stderr, "did not find a multipart/encrypted message\n"); 631 632 output = g_mime_multipart_encrypted_decrypt (body, GMIME_DECRYPT_NONE, "9:13607E4217515A70EC8DF9DBC16C5327B94577561D98AD1246FA8756659C7899", &result, &error); 633 if (error || output == NULL) return !! fprintf (stderr, "decrypt failed\n"); 634 635 sig_list = g_mime_decrypt_result_get_signatures (result); 636 if (sig_list == NULL) return !! fprintf (stderr, "sig_list is NULL\n"); 637 638 if (sig_list == NULL) return !! fprintf (stderr, "no GMimeSignatureList found\n"); 639 len = g_mime_signature_list_length (sig_list); 640 if (len != 1) return !! fprintf (stderr, "expected 1 signature, got %d\n", len); 641 sig = g_mime_signature_list_get_signature (sig_list, 0); 642 if (sig == NULL) return !! fprintf (stderr, "no GMimeSignature found at position 0\n"); 643 status = g_mime_signature_get_status (sig); 644 if (status & GMIME_SIGNATURE_STATUS_KEY_MISSING) return !! fprintf (stderr, "signature status contains KEY_MISSING (see https://dev.gnupg.org/T3464)\n"); 645 646 return 0; 647} 648EOF 649 if ! TEMP_GPG=$(mktemp -d "${TMPDIR:-/tmp}/notmuch.XXXXXX"); then 650 printf 'No.\nCould not make tempdir for testing signature verification when decrypting with session keys.\n' 651 errors=$((errors + 1)) 652 elif ${CC} ${CFLAGS} ${gmime_cflags} _verify_sig_with_session_key.c ${gmime_ldflags} -o _verify_sig_with_session_key \ 653 && GNUPGHOME=${TEMP_GPG} gpg --batch --quiet --import < "$srcdir"/test/gnupg-secret-key.asc \ 654 && rm -f ${TEMP_GPG}/private-keys-v1.d/*.key 655 then 656 if GNUPGHOME=${TEMP_GPG} ./_verify_sig_with_session_key; then 657 gmime_verify_with_session_key=1 658 printf "Yes.\n" 659 else 660 gmime_verify_with_session_key=0 661 printf "No.\n" 662 cat <<EOF 663*** Error: GMime fails to verify signatures when decrypting with a session key. 664 665This is most likely due to a buggy version of GPGME, which should be fixed in 1.13.2 or later. 666See https://dev.gnupg.org/T3464 for more details. 667EOF 668 fi 669 else 670 printf 'No.\nFailed to set up gpg for testing signature verification while decrypting with a session key.\n' 671 errors=$((errors + 1)) 672 fi 673 if [ -n "$TEMP_GPG" -a -d "$TEMP_GPG" ]; then 674 rm -rf "$TEMP_GPG" 675 fi 676else 677 have_gmime=0 678 printf "No.\n" 679 errors=$((errors + 1)) 680fi 681 682# GMime already depends on Glib >= 2.12, but we use at least one Glib 683# function that only exists as of 2.22, (g_array_unref) 684printf "Checking for Glib development files (>= 2.22)... " 685have_glib=0 686if pkg-config --exists 'glib-2.0 >= 2.22'; then 687 printf "Yes.\n" 688 have_glib=1 689 # these are included in gmime cflags and ldflags 690 # glib_cflags=$(pkg-config --cflags glib-2.0) 691 # glib_ldflags=$(pkg-config --libs glib-2.0) 692else 693 printf "No.\n" 694 errors=$((errors + 1)) 695fi 696 697if ! pkg-config --exists zlib; then 698 ${CC} -o compat/gen_zlib_pc "$srcdir"/compat/gen_zlib_pc.c >/dev/null 2>&1 && 699 compat/gen_zlib_pc > compat/zlib.pc && 700 PKG_CONFIG_PATH=${PKG_CONFIG_PATH:+$PKG_CONFIG_PATH:}compat && 701 export PKG_CONFIG_PATH 702 rm -f compat/gen_zlib_pc 703fi 704 705printf "Checking for zlib (>= 1.2.5.2)... " 706have_zlib=0 707if pkg-config --atleast-version=1.2.5.2 zlib; then 708 printf "Yes.\n" 709 have_zlib=1 710 zlib_cflags=$(pkg-config --cflags zlib) 711 zlib_ldflags=$(pkg-config --libs zlib) 712else 713 printf "No.\n" 714 errors=$((errors + 1)) 715fi 716 717printf "Checking for talloc development files... " 718if pkg-config --exists talloc; then 719 printf "Yes.\n" 720 have_talloc=1 721 talloc_cflags=$(pkg-config --cflags talloc) 722 talloc_ldflags=$(pkg-config --libs talloc) 723else 724 printf "No.\n" 725 have_talloc=0 726 talloc_cflags= 727 errors=$((errors + 1)) 728fi 729 730printf "Checking for bash... " 731if command -v ${BASHCMD} > /dev/null; then 732 have_bash=1 733 bash_absolute=$(command -v ${BASHCMD}) 734 printf "Yes (%s).\n" "$bash_absolute" 735else 736 have_bash=0 737 bash_absolute= 738 printf "No. (%s not found)\n" "${BASHCMD}" 739fi 740 741printf "Checking for perl... " 742if command -v ${PERL} > /dev/null; then 743 have_perl=1 744 perl_absolute=$(command -v ${PERL}) 745 printf "Yes (%s).\n" "$perl_absolute" 746else 747 have_perl=0 748 perl_absolute= 749 printf "No. (%s not found)\n" "${PERL}" 750fi 751 752printf "Checking for python... " 753have_python=0 754 755for name in ${PYTHON} python3 python python2; do 756 if command -v $name > /dev/null; then 757 have_python=1 758 python=$name 759 printf "Yes (%s).\n" "$name" 760 break 761 fi 762done 763 764if [ $have_python -eq 0 ]; then 765 printf "No.\n" 766 errors=$((errors + 1)) 767fi 768 769have_python3=0 770if [ $have_python -eq 1 ]; then 771 printf "Checking for python3 (>= 3.5)..." 772 if "$python" -c 'import sys, sysconfig; assert sys.version_info >= (3,5)'; >/dev/null 2>&1; then 773 printf "Yes.\n" 774 have_python3=1 775 else 776 printf "No (will not install CFFI-based python bindings).\n" 777 fi 778fi 779 780have_python3_dev=0 781if [ $have_python3 -eq 1 ]; then 782 printf "Checking for python3 version ..." 783 python3_version=$("$python" -c 'import sysconfig; print(sysconfig.get_python_version());') 784 printf "(%s)\n" $python3_version 785 786 printf "Checking for python $python3_version development files..." 787 if pkg-config --exists "python-$python3_version"; then 788 have_python3_dev=1 789 printf "Yes.\n" 790 else 791 have_python3_dev=0 792 printf "No (will not install CFFI-based python bindings).\n" 793 fi 794fi 795 796have_python3_cffi=0 797have_python3_pytest=0 798if [ $have_python3_dev -eq 1 ]; then 799 printf "Checking for python3 cffi and setuptools... " 800 if "$python" -c 'import cffi,setuptools; cffi.FFI().verify()' >/dev/null 2>&1; then 801 printf "Yes.\n" 802 have_python3_cffi=1 803 WITH_PYTHON_DOCS=1 804 else 805 WITH_PYTHON_DOCS=0 806 printf "No (will not install CFFI-based python bindings).\n" 807 fi 808 rm -rf __pycache__ # cffi.FFI().verify() uses this space 809 810 printf "Checking for python3 pytest (>= 3.0)... " 811 conf=$(mktemp) 812 printf "[pytest]\nminversion=3.0\n" > $conf 813 if "$python" -m pytest -c $conf --version >/dev/null 2>&1; then 814 printf "Yes.\n" 815 have_python3_pytest=1 816 else 817 printf "No (will not test CFFI-based python bindings).\n" 818 fi 819 rm -f $conf 820fi 821 822printf "Checking for valgrind development files... " 823if pkg-config --exists valgrind; then 824 printf "Yes.\n" 825 have_valgrind=1 826 valgrind_cflags=$(pkg-config --cflags valgrind) 827else 828 printf "No (but that's fine).\n" 829 have_valgrind=0 830 valgrind_cflags= 831fi 832 833printf "Checking for bash-completion (>= 1.90)... " 834if pkg-config --atleast-version=1.90 bash-completion; then 835 printf "Yes.\n" 836else 837 printf "No (will not install bash completion).\n" 838 WITH_BASH=0 839fi 840 841printf "Checking for sfsexp... " 842if pkg-config --exists sfsexp; then 843 printf "Yes.\n" 844 have_sfsexp=1 845 sfsexp_cflags=$(pkg-config --cflags sfsexp) 846 sfsexp_ldflags=$(pkg-config --libs sfsexp) 847else 848 printf "No (will not enable s-expression queries).\n" 849 have_sfsexp=0 850 sfsexp_cflags= 851 sfsexp_ldflags= 852fi 853 854if [ -z "${EMACSLISPDIR-}" ]; then 855 EMACSLISPDIR="\$(prefix)/share/emacs/site-lisp" 856fi 857 858if [ -z "${EMACSETCDIR-}" ]; then 859 EMACSETCDIR="\$(prefix)/share/emacs/site-lisp" 860fi 861 862if [ $WITH_EMACS = "1" ]; then 863 printf "Checking if emacs (>= 25) is available... " 864 if emacs --quick --batch --eval '(if (< emacs-major-version 25) (kill-emacs 1))' > /dev/null 2>&1; then 865 printf "Yes.\n" 866 else 867 printf "No (disabling emacs related parts of build)\n" 868 WITH_EMACS=0 869 fi 870fi 871 872have_doxygen=0 873if [ $WITH_API_DOCS = "1" ] ; then 874 printf "Checking if doxygen is available... " 875 if command -v doxygen > /dev/null; then 876 printf "Yes.\n" 877 have_doxygen=1 878 else 879 printf "No (so will not install api docs)\n" 880 fi 881fi 882 883have_ruby_dev=0 884if [ $WITH_RUBY = "1" ] ; then 885 printf "Checking for ruby development files... " 886 if ${RUBY} -e "require 'mkmf'"> /dev/null 2>&1; then 887 printf "Yes.\n" 888 have_ruby_dev=1 889 else 890 printf "No (skipping ruby bindings)\n" 891 fi 892fi 893 894have_sphinx=0 895have_makeinfo=0 896have_install_info=0 897if [ $WITH_DOCS = "1" ] ; then 898 printf "Checking if sphinx is available and supports nroff output... " 899 if command -v sphinx-build > /dev/null && ${python} -m sphinx.writers.manpage > /dev/null 2>&1 ; then 900 printf "Yes.\n" 901 have_sphinx=1 902 else 903 printf "No (so will not install man pages).\n" 904 fi 905 printf "Checking if makeinfo is available... " 906 if command -v makeinfo > /dev/null; then 907 printf "Yes.\n" 908 have_makeinfo=1 909 else 910 printf "No (so will not build info pages).\n" 911 fi 912 printf "Checking if install-info is available... " 913 if command -v install-info > /dev/null; then 914 printf "Yes.\n" 915 have_install_info=1 916 else 917 printf "No (so will not install info pages).\n" 918 fi 919fi 920 921if [ $WITH_DESKTOP = "1" ]; then 922 printf "Checking if desktop-file-install is available... " 923 if command -v desktop-file-install > /dev/null; then 924 printf "Yes.\n" 925 else 926 printf "No (so will not install .desktop file).\n" 927 WITH_DESKTOP=0 928 fi 929fi 930 931printf "Checking for cppcheck... " 932if command -v cppcheck > /dev/null; then 933 have_cppcheck=1 934 printf "Yes.\n" 935else 936 have_cppcheck=0 937 printf "No.\n" 938fi 939 940libdir_in_ldconfig=0 941 942printf "Checking which platform we are on... " 943uname=$(uname) 944if [ $uname = "Darwin" ] ; then 945 printf "Mac OS X.\n" 946 platform=MACOSX 947 linker_resolves_library_dependencies=0 948elif [ $uname = "SunOS" ] ; then 949 printf "Solaris.\n" 950 platform=SOLARIS 951 linker_resolves_library_dependencies=0 952elif [ $uname = "FreeBSD" ] ; then 953 printf "FreeBSD.\n" 954 platform=FREEBSD 955 linker_resolves_library_dependencies=0 956elif [ $uname = "OpenBSD" ] ; then 957 printf "OpenBSD.\n" 958 platform=OPENBSD 959 linker_resolves_library_dependencies=0 960elif [ $uname = "Linux" ] || [ $uname = "GNU" ] ; then 961 printf "%s\n" "$uname" 962 platform="$uname" 963 linker_resolves_library_dependencies=1 964 965 printf "Checking for %s in ldconfig... " "$libdir_expanded" 966 ldconfig_paths=$(/sbin/ldconfig -N -X -v 2>/dev/null | sed -n -e 's,^\(/.*\):\( (.*)\)\?$,\1,p') 967 # Separate ldconfig_paths only on newline (not on any potential 968 # embedded space characters in any filenames). Note, we use a 969 # literal newline in the source here rather than something like: 970 # 971 # IFS=$(printf '\n') 972 # 973 # because the shell's command substitution deletes any trailing newlines. 974 IFS=" 975" 976 for path in $ldconfig_paths; do 977 if [ "$path" -ef "$libdir_expanded" ]; then 978 libdir_in_ldconfig=1 979 fi 980 done 981 IFS=$DEFAULT_IFS 982 if [ "$libdir_in_ldconfig" = '0' ]; then 983 printf "No (will set RPATH)\n" 984 else 985 printf "Yes\n" 986 fi 987else 988 printf "Unknown.\n" 989 platform="$uname" 990 linker_resolves_library_dependencies=0 991 cat <<EOF 992 993*** Warning: Unknown platform. Notmuch might or might not build correctly. 994 995EOF 996fi 997 998if [ $errors -gt 0 ]; then 999 cat <<EOF 1000 1001*** Error: The dependencies of notmuch could not be satisfied. You will 1002need to install the following packages before being able to compile 1003notmuch: 1004 1005EOF 1006 if [ $have_python -eq 0 ]; then 1007 echo " python interpreter" 1008 fi 1009 if [ $have_xapian -eq 0 ]; then 1010 echo " Xapian library (>= version 1.4.0, including development files such as headers)" 1011 echo " https://xapian.org/" 1012 fi 1013 if [ $have_zlib -eq 0 ]; then 1014 echo " zlib library (>= version 1.2.5.2, including development files such as headers)" 1015 echo " https://zlib.net/" 1016 echo 1017 fi 1018 if [ $have_gmime -eq 0 ]; then 1019 echo " GMime library >= $GMIME_MINVER" 1020 echo " (including development files such as headers)" 1021 echo " https://github.com/jstedfast/gmime/" 1022 echo 1023 fi 1024 if [ $have_glib -eq 0 ]; then 1025 echo " Glib library >= 2.22 (including development files such as headers)" 1026 echo " https://ftp.gnome.org/pub/gnome/sources/glib/" 1027 echo 1028 fi 1029 if [ $have_talloc -eq 0 ]; then 1030 echo " The talloc library (including development files such as headers)" 1031 echo " https://talloc.samba.org/" 1032 echo 1033 fi 1034 cat <<EOF 1035With any luck, you're using a modern, package-based operating system 1036that has all of these packages available in the distribution. In that 1037case a simple command will install everything you need. For example: 1038 1039On Debian and similar systems: 1040 1041 sudo apt-get install libxapian-dev libgmime-3.0-dev libtalloc-dev zlib1g-dev 1042 1043Or on Fedora and similar systems: 1044 1045 sudo dnf install xapian-core-devel gmime30-devel libtalloc-devel zlib-devel 1046 1047On other systems, similar commands can be used, but the details of the 1048package names may be different. 1049 1050EOF 1051 if [ $have_pkg_config -eq 0 ]; then 1052cat <<EOF 1053Note: the pkg-config program is not available. This configure script 1054uses pkg-config to find the compilation flags required to link against 1055the various libraries needed by notmuch. It's possible you simply need 1056to install pkg-config with a command such as: 1057 1058 sudo apt-get install pkg-config 1059Or: 1060 sudo dnf install pkgconfig 1061 1062But if pkg-config is not available for your system, then you will need 1063to modify the configure script to manually set the cflags and ldflags 1064variables to the correct values to link against each library in each 1065case that pkg-config could not be used to determine those values. 1066 1067EOF 1068 fi 1069cat <<EOF 1070When you have installed the necessary dependencies, you can run 1071configure again to ensure the packages can be found, or simply run 1072"make" to compile notmuch. 1073 1074EOF 1075 exit 1 1076fi 1077 1078printf "Checking for canonicalize_file_name... " 1079if ${CC} -o compat/have_canonicalize_file_name "$srcdir"/compat/have_canonicalize_file_name.c > /dev/null 2>&1 1080then 1081 printf "Yes.\n" 1082 have_canonicalize_file_name=1 1083else 1084 printf "No (will use our own instead).\n" 1085 have_canonicalize_file_name=0 1086fi 1087rm -f compat/have_canonicalize_file_name 1088 1089 1090printf "Checking for getline... " 1091if ${CC} -o compat/have_getline "$srcdir"/compat/have_getline.c > /dev/null 2>&1 1092then 1093 printf "Yes.\n" 1094 have_getline=1 1095else 1096 printf "No (will use our own instead).\n" 1097 have_getline=0 1098fi 1099rm -f compat/have_getline 1100 1101printf "Checking for strcasestr... " 1102if ${CC} -o compat/have_strcasestr "$srcdir"/compat/have_strcasestr.c > /dev/null 2>&1 1103then 1104 printf "Yes.\n" 1105 have_strcasestr=1 1106else 1107 printf "No (will use our own instead).\n" 1108 have_strcasestr=0 1109fi 1110rm -f compat/have_strcasestr 1111 1112printf "Checking for strsep... " 1113if ${CC} -o compat/have_strsep "$srcdir"/compat/have_strsep.c > /dev/null 2>&1 1114then 1115 printf "Yes.\n" 1116 have_strsep="1" 1117else 1118 printf "No (will use our own instead).\n" 1119 have_strsep="0" 1120fi 1121rm -f compat/have_strsep 1122 1123printf "Checking for timegm... " 1124if ${CC} -o compat/have_timegm "$srcdir"/compat/have_timegm.c > /dev/null 2>&1 1125then 1126 printf "Yes.\n" 1127 have_timegm="1" 1128else 1129 printf "No (will use our own instead).\n" 1130 have_timegm="0" 1131fi 1132rm -f compat/have_timegm 1133 1134cat <<EOF > _time_t.c 1135#include <time.h> 1136#include <assert.h> 1137static_assert(sizeof(time_t) >= 8, "sizeof(time_t) < 8"); 1138EOF 1139 1140printf "Checking for 64 bit time_t... " 1141if ${CC} -c _time_t.c -o /dev/null 1142then 1143 printf "Yes.\n" 1144 have_64bit_time_t=1 1145else 1146 printf "No.\n" 1147 have_64bit_time_t=0 1148fi 1149 1150printf "Checking for dirent.d_type... " 1151if ${CC} -o compat/have_d_type "$srcdir"/compat/have_d_type.c > /dev/null 2>&1 1152then 1153 printf "Yes.\n" 1154 have_d_type="1" 1155else 1156 printf "No (will use stat instead).\n" 1157 have_d_type="0" 1158fi 1159rm -f compat/have_d_type 1160 1161printf "Checking for standard version of getpwuid_r... " 1162if ${CC} -o compat/check_getpwuid "$srcdir"/compat/check_getpwuid.c > /dev/null 2>&1 1163then 1164 printf "Yes.\n" 1165 std_getpwuid=1 1166else 1167 printf "No (will define _POSIX_PTHREAD_SEMANTICS to get it).\n" 1168 std_getpwuid=0 1169fi 1170rm -f compat/check_getpwuid 1171 1172printf "Checking for standard version of asctime_r... " 1173if ${CC} -o compat/check_asctime "$srcdir"/compat/check_asctime.c > /dev/null 2>&1 1174then 1175 printf "Yes.\n" 1176 std_asctime=1 1177else 1178 printf "No (will define _POSIX_PTHREAD_SEMANTICS to get it).\n" 1179 std_asctime=0 1180fi 1181rm -f compat/check_asctime 1182 1183printf "Checking for rpath support... " 1184if [ $WITH_RPATH = "1" ] && ${CC} -Wl,--enable-new-dtags -Wl,-rpath,/tmp/ -o minimal minimal.c >/dev/null 2>&1 1185then 1186 printf "Yes.\n" 1187 rpath_ldflags="-Wl,--enable-new-dtags -Wl,-rpath,\$(libdir)" 1188else 1189 printf "No (nothing to worry about).\n" 1190 rpath_ldflags="" 1191fi 1192 1193printf "Checking for -Wl,--as-needed... " 1194if ${CC} -Wl,--as-needed -o minimal minimal.c >/dev/null 2>&1 1195then 1196 printf "Yes.\n" 1197 as_needed_ldflags="-Wl,--as-needed" 1198else 1199 printf "No (nothing to worry about).\n" 1200 as_needed_ldflags="" 1201fi 1202 1203printf "Checking for -Wl,--no-undefined... " 1204if ${CC} -Wl,--no-undefined -o minimal minimal.c >/dev/null 2>&1 1205then 1206 printf "Yes.\n" 1207 no_undefined_ldflags="-Wl,--no-undefined" 1208else 1209 printf "No (nothing to worry about).\n" 1210 no_undefined_ldflags="" 1211fi 1212 1213WARN_CXXFLAGS="" 1214printf "Checking for available C++ compiler warning flags... " 1215for flag in -Wall -Wextra -Wwrite-strings; do 1216 if ${CC} $flag -o minimal minimal.c > /dev/null 2>&1 1217 then 1218 WARN_CXXFLAGS="${WARN_CXXFLAGS}${WARN_CXXFLAGS:+ }${flag}" 1219 fi 1220done 1221printf "\n\t%s\n" "${WARN_CXXFLAGS}" 1222 1223WARN_CFLAGS="${WARN_CXXFLAGS}" 1224printf "Checking for available C compiler warning flags... " 1225for flag in -Wmissing-declarations; do 1226 if ${CC} $flag -o minimal minimal.c > /dev/null 2>&1 1227 then 1228 WARN_CFLAGS="${WARN_CFLAGS}${WARN_CFLAGS:+ }${flag}" 1229 fi 1230done 1231printf "\n\t%s\n" "${WARN_CFLAGS}" 1232 1233rm -f minimal minimal.c _time_t.c _libversion.c _libversion _libversion.sh _check_session_keys.c _check_session_keys _check_x509_validity.c _check_x509_validity \ 1234 _verify_sig_with_session_key.c _verify_sig_with_session_key 1235 1236# construct the Makefile.config 1237cat > Makefile.config <<EOF 1238# This Makefile.config was automatically generated by the ./configure 1239# script of notmuch. If the configure script identified anything 1240# incorrectly, then you can edit this file to try to correct things, 1241# but be warned that if configure is run again it will destroy your 1242# changes, (and this could happen by simply calling "make" if the 1243# configure script is updated). 1244 1245# The top-level directory for the source, (the directory containing 1246# the configure script). This may be different than the build 1247# directory (the current directory at the time configure was run). 1248srcdir = ${srcdir} 1249NOTMUCH_SRCDIR = ${NOTMUCH_SRCDIR} 1250 1251# subdirectories to build 1252subdirs = ${subdirs} 1253 1254configure_options = $@ 1255 1256# We use vpath directives (rather than the VPATH variable) since the 1257# VPATH variable matches targets as well as prerequisites, (which is 1258# not useful since then a target left-over from a srcdir build would 1259# cause a target to not be built in the non-srcdir build). 1260# 1261# Also, we don't use a single "vpath % \$(srcdir)" here because we 1262# don't want the vpath to trigger for our emacs lisp compilation, 1263# (unless we first find a way to convince emacs to build the .elc 1264# target in a directory other than the directory of the .el 1265# prerequisite). In the meantime, we're actually copying in the .el 1266# files, (which is quite ugly). 1267vpath %.c \$(srcdir) 1268vpath %.cc \$(srcdir) 1269vpath Makefile.% \$(srcdir) 1270vpath %.py \$(srcdir) 1271vpath %.rst \$(srcdir) 1272 1273# Library versions (used to make SONAME) 1274# The major version of the library interface. This will control the soname. 1275# As such, this number must be incremented for any incompatible change to 1276# the library interface, (such as the deletion of an API or a major 1277# semantic change that breaks formerly functioning code). 1278# 1279LIBNOTMUCH_VERSION_MAJOR = ${libnotmuch_version_major} 1280 1281# The minor version of the library interface. This should be incremented at 1282# the time of release for any additions to the library interface, 1283# (and when it is incremented, the release version of the library should 1284# be reset to 0). 1285LIBNOTMUCH_VERSION_MINOR = ${libnotmuch_version_minor} 1286 1287# The release version the library interface. This should be incremented at 1288# the time of release if there have been no changes to the interface, (but 1289# simply compatible changes to the implementation). 1290LIBNOTMUCH_VERSION_RELEASE = ${libnotmuch_version_release} 1291 1292# These are derived from the VERSION macros in lib/notmuch.h so 1293# if you have to change them, something is wrong. 1294 1295# The C compiler to use 1296CC = ${CC} 1297 1298# The C++ compiler to use 1299CXX = ${CXX} 1300 1301# Command to execute emacs from Makefiles 1302EMACS = emacs --quick 1303 1304# Default FLAGS for C compiler (can be overridden by user such as "make CFLAGS=-g") 1305CFLAGS = ${CFLAGS} 1306 1307# Default FLAGS for C preprocessor (can be overridden by user such as "make CPPFLAGS=-I/usr/local/include") 1308CPPFLAGS = ${CPPFLAGS} 1309 1310# Default FLAGS for C++ compiler (can be overridden by user such as "make CXXFLAGS=-g") 1311CXXFLAGS = ${CXXFLAGS} 1312 1313# Default FLAGS for the linker (can be overridden by user such as "make LDFLAGS=-znow") 1314LDFLAGS = ${LDFLAGS} 1315 1316# Flags to enable warnings when using the C++ compiler 1317WARN_CXXFLAGS=${WARN_CXXFLAGS} 1318 1319# Flags to enable warnings when using the C compiler 1320WARN_CFLAGS=${WARN_CFLAGS} 1321 1322# Name of python interpreter 1323PYTHON = ${python} 1324 1325# Name of ruby interpreter 1326RUBY = ${RUBY} 1327 1328# The prefix to which notmuch should be installed 1329# Note: If you change this value here, be sure to ensure that the 1330# LIBDIR_IN_LDCONFIG value below is still set correctly. 1331prefix = ${PREFIX} 1332 1333# The directory to which libraries should be installed 1334# Note: If you change this value here, be sure to ensure that the 1335# LIBDIR_IN_LDCONFIG value below is still set correctly. 1336libdir = ${LIBDIR:=\$(prefix)/lib} 1337 1338# Whether libdir is in a path configured into ldconfig 1339LIBDIR_IN_LDCONFIG = ${libdir_in_ldconfig} 1340 1341# The directory to which header files should be installed 1342includedir = ${INCLUDEDIR:=\$(prefix)/include} 1343 1344# The directory to which man pages should be installed 1345mandir = ${MANDIR:=\$(prefix)/share/man} 1346 1347# The directory to which man pages should be installed 1348infodir = ${INFODIR:=\$(prefix)/share/info} 1349 1350# The directory to which read-only (configuration) files should be installed 1351sysconfdir = ${SYSCONFDIR:=\$(prefix)/etc} 1352 1353# The directory to which emacs lisp files should be installed 1354emacslispdir=${EMACSLISPDIR} 1355 1356# The directory to which emacs miscellaneous (machine-independent) files should 1357# be installed 1358emacsetcdir=${EMACSETCDIR} 1359 1360# Whether bash exists, and if so where 1361HAVE_BASH = ${have_bash} 1362BASH_ABSOLUTE = ${bash_absolute} 1363 1364# Whether perl exists, and if so where 1365HAVE_PERL = ${have_perl} 1366PERL_ABSOLUTE = ${perl_absolute} 1367 1368# Whether there's a sphinx-build binary available for building documentation 1369HAVE_SPHINX=${have_sphinx} 1370 1371# Whether there's a makeinfo binary available for building info format documentation 1372HAVE_MAKEINFO=${have_makeinfo} 1373 1374# Whether there's an install-info binary available for installing info format documentation 1375HAVE_INSTALL_INFO=${have_install_info} 1376 1377# Whether there's a doxygen binary available for building api documentation 1378HAVE_DOXYGEN=${have_doxygen} 1379 1380# The directory to which desktop files should be installed 1381desktop_dir = \$(prefix)/share/applications 1382 1383# The directory to which bash completions files should be installed 1384bash_completion_dir = ${BASHCOMPLETIONDIR:=\$(prefix)/share/bash-completion/completions} 1385 1386# The directory to which zsh completions files should be installed 1387zsh_completion_dir = ${ZSHCOMLETIONDIR:=\$(prefix)/share/zsh/site-functions} 1388 1389# Whether the canonicalize_file_name function is available (if not, then notmuch will 1390# build its own version) 1391HAVE_CANONICALIZE_FILE_NAME = ${have_canonicalize_file_name} 1392 1393# Whether the cppcheck static checker is available 1394HAVE_CPPCHECK = ${have_cppcheck} 1395 1396# Whether the getline function is available (if not, then notmuch will 1397# build its own version) 1398HAVE_GETLINE = ${have_getline} 1399 1400# Are the ruby development files (and ruby) available? If not skip 1401# building/testing ruby bindings. 1402HAVE_RUBY_DEV = ${have_ruby_dev} 1403 1404# Is the python cffi package available? 1405HAVE_PYTHON3_CFFI = ${have_python3_cffi} 1406 1407# Is the python pytest package available? 1408HAVE_PYTHON3_PYTEST = ${have_python3_pytest} 1409 1410# Whether the strcasestr function is available (if not, then notmuch will 1411# build its own version) 1412HAVE_STRCASESTR = ${have_strcasestr} 1413 1414# Whether the strsep function is available (if not, then notmuch will 1415# build its own version) 1416HAVE_STRSEP = ${have_strsep} 1417 1418# Whether the timegm function is available (if not, then notmuch will 1419# build its own version) 1420HAVE_TIMEGM = ${have_timegm} 1421 1422# Whether struct dirent has d_type (if not, then notmuch will use stat) 1423HAVE_D_TYPE = ${have_d_type} 1424 1425# Whether to have Xapian retry lock 1426HAVE_XAPIAN_DB_RETRY_LOCK = ${WITH_RETRY_LOCK} 1427 1428# Whether the getpwuid_r function is standards-compliant 1429# (if not, then notmuch will #define _POSIX_PTHREAD_SEMANTICS 1430# to enable the standards-compliant version -- needed for Solaris) 1431STD_GETPWUID = ${std_getpwuid} 1432 1433# Whether the asctime_r function is standards-compliant 1434# (if not, then notmuch will #define _POSIX_PTHREAD_SEMANTICS 1435# to enable the standards-compliant version -- needed for Solaris) 1436STD_ASCTIME = ${std_asctime} 1437 1438# Supported platforms (so far) are: LINUX, MACOSX, SOLARIS, FREEBSD, OPENBSD 1439PLATFORM = ${platform} 1440 1441# Whether the linker will automatically resolve the dependency of one 1442# library on another (if not, then linking a binary requires linking 1443# directly against both) 1444LINKER_RESOLVES_LIBRARY_DEPENDENCIES = ${linker_resolves_library_dependencies} 1445 1446# Flags needed to compile and link against Xapian 1447XAPIAN_CXXFLAGS = ${xapian_cxxflags} 1448XAPIAN_LDFLAGS = ${xapian_ldflags} 1449 1450# Flags needed to compile and link against GMime 1451GMIME_CFLAGS = ${gmime_cflags} 1452GMIME_LDFLAGS = ${gmime_ldflags} 1453 1454# Flags needed to compile and link against zlib 1455ZLIB_CFLAGS = ${zlib_cflags} 1456ZLIB_LDFLAGS = ${zlib_ldflags} 1457 1458# Flags needed to compile and link against talloc 1459TALLOC_CFLAGS = ${talloc_cflags} 1460TALLOC_LDFLAGS = ${talloc_ldflags} 1461 1462# Flags needed to have linker set rpath attribute 1463RPATH_LDFLAGS = ${rpath_ldflags} 1464 1465# Flags needed to have linker link only to necessary libraries 1466AS_NEEDED_LDFLAGS = ${as_needed_ldflags} 1467 1468# Flags to have the linker flag undefined symbols in object files 1469NO_UNDEFINED_LDFLAGS = ${no_undefined_ldflags} 1470 1471# Whether valgrind header files are available 1472HAVE_VALGRIND = ${have_valgrind} 1473 1474# And if so, flags needed at compile time for valgrind macros 1475VALGRIND_CFLAGS = ${valgrind_cflags} 1476 1477# Whether the sfsexp library is available 1478HAVE_SFSEXP = ${have_sfsexp} 1479 1480# And if so, flags needed at compile/link time for sfsexp 1481SFSEXP_CFLAGS = ${sfsexp_cflags} 1482SFSEXP_LDFLAGS = ${sfsexp_ldflags} 1483 1484# Support for emacs 1485WITH_EMACS = ${WITH_EMACS} 1486 1487# Support for desktop file 1488WITH_DESKTOP = ${WITH_DESKTOP} 1489 1490# Support for bash completion 1491WITH_BASH = ${WITH_BASH} 1492 1493# Support for zsh completion 1494WITH_ZSH = ${WITH_ZSH} 1495 1496# Combined flags for compiling and linking against all of the above 1497COMMON_CONFIGURE_CFLAGS = \\ 1498 \$(GMIME_CFLAGS) \$(TALLOC_CFLAGS) \$(ZLIB_CFLAGS) \\ 1499 -DHAVE_VALGRIND=\$(HAVE_VALGRIND) \$(VALGRIND_CFLAGS) \\ 1500 -DHAVE_SFSEXP=\$(HAVE_SFSEXP) \$(SFSEXP_CFLAGS) \\ 1501 -DHAVE_GETLINE=\$(HAVE_GETLINE) \\ 1502 -DWITH_EMACS=\$(WITH_EMACS) \\ 1503 -DHAVE_CANONICALIZE_FILE_NAME=\$(HAVE_CANONICALIZE_FILE_NAME) \\ 1504 -DHAVE_STRCASESTR=\$(HAVE_STRCASESTR) \\ 1505 -DHAVE_STRSEP=\$(HAVE_STRSEP) \\ 1506 -DHAVE_TIMEGM=\$(HAVE_TIMEGM) \\ 1507 -DHAVE_D_TYPE=\$(HAVE_D_TYPE) \\ 1508 -DSTD_GETPWUID=\$(STD_GETPWUID) \\ 1509 -DSTD_ASCTIME=\$(STD_ASCTIME) \\ 1510 -DSILENCE_XAPIAN_DEPRECATION_WARNINGS \\ 1511 -DHAVE_XAPIAN_DB_RETRY_LOCK=\$(HAVE_XAPIAN_DB_RETRY_LOCK) 1512 1513CONFIGURE_CFLAGS = \$(COMMON_CONFIGURE_CFLAGS) 1514 1515CONFIGURE_CXXFLAGS = \$(COMMON_CONFIGURE_CFLAGS) \$(XAPIAN_CXXFLAGS) 1516 1517CONFIGURE_LDFLAGS = \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(ZLIB_LDFLAGS) \$(XAPIAN_LDFLAGS) \$(SFSEXP_LDFLAGS) 1518EOF 1519 1520# construct the sh.config 1521cat > sh.config <<EOF 1522# This sh.config was automatically generated by the ./configure 1523# script of notmuch. 1524 1525NOTMUCH_SRCDIR='${NOTMUCH_SRCDIR}' 1526 1527# Whether to have Xapian retry lock 1528NOTMUCH_HAVE_XAPIAN_DB_RETRY_LOCK=${WITH_RETRY_LOCK} 1529 1530# Whether GMime can verify X.509 certificate validity 1531NOTMUCH_GMIME_X509_CERT_VALIDITY=${gmime_x509_cert_validity} 1532 1533# Whether GMime can verify signatures when decrypting with a session key: 1534NOTMUCH_GMIME_VERIFY_WITH_SESSION_KEY=${gmime_verify_with_session_key} 1535 1536# do we have man pages? 1537NOTMUCH_HAVE_MAN=$((have_sphinx)) 1538 1539# Whether bash exists, and if so where 1540NOTMUCH_HAVE_BASH=${have_bash} 1541NOTMUCH_BASH_ABSOLUTE=${bash_absolute} 1542 1543# Whether time_t is 64 bits (or more) 1544NOTMUCH_HAVE_64BIT_TIME_T=${have_64bit_time_t} 1545 1546# Whether perl exists, and if so where 1547NOTMUCH_HAVE_PERL=${have_perl} 1548NOTMUCH_PERL_ABSOLUTE=${perl_absolute} 1549 1550# Name of python interpreter 1551NOTMUCH_PYTHON=${python} 1552 1553# Name of ruby interpreter 1554NOTMUCH_RUBY=${RUBY} 1555 1556# Are the ruby development files (and ruby) available? If not skip 1557# building/testing ruby bindings. 1558NOTMUCH_HAVE_RUBY_DEV=${have_ruby_dev} 1559 1560# Is the python cffi package available? 1561NOTMUCH_HAVE_PYTHON3_CFFI=${have_python3_cffi} 1562 1563# Is the python pytest package available? 1564NOTMUCH_HAVE_PYTHON3_PYTEST=${have_python3_pytest} 1565 1566# Is the sfsexp library available? 1567NOTMUCH_HAVE_SFSEXP=${have_sfsexp} 1568 1569# Platform we are run on 1570PLATFORM=${platform} 1571EOF 1572 1573{ 1574 echo "# Generated by configure, run from doc/conf.py" 1575 if [ $WITH_EMACS = "1" ]; then 1576 echo "tags.add('WITH_EMACS')" 1577 fi 1578 if [ $WITH_PYTHON_DOCS = "1" ]; then 1579 echo "tags.add('WITH_PYTHON')" 1580 fi 1581 printf "rsti_dir = '%s'\n" "$(cd emacs && pwd -P)" 1582} > sphinx.config 1583 1584# Finally, after everything configured, inform the user how to continue. 1585cat <<EOF 1586 1587All required packages were found. You may now run the following 1588commands to compile and install notmuch: 1589 1590 make 1591 sudo make install 1592 1593EOF 1594