compat: probe for strcasestr more thoroughly Depending on compiler (gcc, g++, clang) and standard options (c99, c11), string.h may or may not include strings.h, leading to possibly missing or conflicting declarations of strcasestr. Include both so that both detection and compilation phases use the same (possibly optimised) implementations. Suggested-by: Thomas Schneider <qsx@chaotikum.eu> Suggested-by: Florian Weimer <fweimer@redhat.com> Suggested-by: Tomi Ollila <tomi.ollila@iki.fi>
compat: rename {,notmuch_}canonicalize_file_name When compat canonicalize_file_name was introduced, it was limited to C code only because it was used by C code only during that time. >From 5ec6fd4d, (lib/open: check for split configuration when creating database., 2021-02-16), lib/open.cc, which is C++, relies on the existent of canonicalize_file_name. However, we can't blindly enable canonicalize_file_name for C++ code, because different implementation has different additional signature for C++ and users can arbitrarily add -DHAVE_CANONICALIZE_FILE_NAME=0 to {C,CXX}FLAGS. Let's move our implementation into a util library. Helped-by: Tomi Ollila <tomi.ollila@iki.fi> Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
emacs: Use makefile-gmake-mode in Makefile*s Use `makefile-gmake-mode' instead of `makefile-mode' because the former also highlights ifdef et al. while the latter does not. "./Makefile.global" and one "Makefile.local" failed to specify any major mode at all but doing so is necessary because Emacs does not automatically figure out that these are Makefiles (of any flavor).
compat: run uncrustify This is the result of running $ uncrustify --replace --config ../devel/uncrustify.cfg *.c *.h in the compat directory
Use rooted paths in .gitignore files A leading / in paths in a .gitignore file matches the beginning of the path, meaning that for patterns without slashes, git will match files only in the current directory as opposed to in any subdirectory. Prefix relevant paths with / in .gitignore files, to prevent accidentally ignoring files in subdirectories and possibly slightly improve the performance of "git status".
compat: don't include compat.h from the feature test source The feature test code should test the build environment, and none of the compat code should interfere with that. Don't include compat.h from the feature test source. There should be no functional changes here, but this is just the right thing to do.
Use https instead of http where possible Many of the external links found in the notmuch source can be resolved using https instead of http. This changeset addresses as many as i could find, without touching the e-mail corpus or expected outputs found in tests.
configure: add workaround for systems without zlib.pc Some systems (e.g. FreeBSD) might not have installed the appropriate pkg-config file as they should. We can workaround the issue by creating the .pc file they should have distributed. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
compat: add canonicalize_file_name the POSIX 2008 behaviour of realpath is not available everywhere so we provide a simple wrapper function. We use (and provide) the gnu extension canonicalize_file_name to make it cleaner to test for the feature we need; otherwise we have to rely on realpath segfaulting if the second argument is null.
new: Detect dirent.d_type support at configure time Support for dirent.d_type is OS-specific. Previously, we used _DIRENT_HAVE_D_TYPE to detect support for this, but this is apparently a glic-ism (FreeBSD, for example, supports d_type, but does not define this). Since there's no cross-platform way to detect support for dirent.d_type, detect it using a test compile at configure time.
timegm: add portable implementation (Solaris support) The timegm(3) function is a non-standard extension to libc which is available in GNU libc and on some BSDs. Although SunOS had this function in its libc, Solaris (unfortunately) removed it. This patch implements a very simple version of timegm() which is good enough for parse-time-string.c. Signed-off-by: Vladimir Marek <vlmarek@volny.cz>
strsep: check for availability (Solaris support) Solaris does not ship a version of the strsep() function. This change adds a check to "configure" to see whether notmuch needs to provide its own implementation, and if so, it uses the new version in "compat/strsep.c" (which was copied from Mutt, and apparently before that from glibc). Signed-off-by: Vladimir Marek <vlmarek@volny.cz>
asctime: check for standards compliance (Solaris support) Add checks to "configure" to see whether _POSIX_PTHREAD_SEMANTICS needs to be defined to get the right number of arguments in the prototypes for asctime_r(). Solaris' default implementation conforms to POSIX.1c Draft 6, rather than the final POSIX.1c spec. The standards-compliant version can be used by defining _POSIX_PTHREAD_SEMANTICS. This change also adds the file "compat/check_asctime.c", which configure uses to perform its check, and modifies compat/compat.h to define _POSIX_PTHREAD_SEMANTICS if configure detected it was needed. Signed-off-by: Vladimir Marek <vlmarek@volny.cz>
getpwuid: check for standards compliance (Solaris support) Add checks to "configure" to see whether _POSIX_PTHREAD_SEMANTICS needs to be defined to get the right number of arguments in the prototypes for getpwuid_r(). Solaris' default implementation conforms to POSIX.1c Draft 6, rather than the final POSIX.1c spec. The standards-compliant version can be used by defining _POSIX_PTHREAD_SEMANTICS. This change also adds the file "compat/check_getpwuid.c", which configure uses to perform its check, and modifies compat/compat.h to define _POSIX_PTHREAD_SEMANTICS if configure detected it was needed. Signed-off-by: Vladimir Marek <vlmarek@volny.cz>
Provide a NORETURN_ATTRIBUTE macro similar to PRINTF_ATTRIBUTE This attribute is understood by gcc since version 2.5. clang provides support for testing for function attributes using __has_attribute. For other compilers this macro evaluates to the empty string. Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
Silence buildbot warnings about unused results This ignores the results of the two writes in sigint handlers even harder than before. While my libc lacks the declarations that trigger these warnings, this can be tested by adding the following to notmuch.h: __attribute__((warn_unused_result)) ssize_t write(int fd, const void *buf, size_t count);