From 08c47ca6382c4954e6c1e7fbb2c05e85b6434b39 Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Wed, 1 Jan 2014 14:53:24 +0200 Subject: [PATCH] Re: [PATCH] new: Detect dirent.d_type support at configure time --- 67/eba2f0055881e2d9466aebeac92ae191f87126 | 175 ++++++++++++++++++++++ 1 file changed, 175 insertions(+) create mode 100644 67/eba2f0055881e2d9466aebeac92ae191f87126 diff --git a/67/eba2f0055881e2d9466aebeac92ae191f87126 b/67/eba2f0055881e2d9466aebeac92ae191f87126 new file mode 100644 index 000000000..b7b71f58a --- /dev/null +++ b/67/eba2f0055881e2d9466aebeac92ae191f87126 @@ -0,0 +1,175 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 21B13431FC2 + for ; Wed, 1 Jan 2014 04:53:37 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id SqWNCn65enow for ; + Wed, 1 Jan 2014 04:53:28 -0800 (PST) +Received: from mail-ee0-f49.google.com (mail-ee0-f49.google.com + [74.125.83.49]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client + certificate requested) by olra.theworths.org (Postfix) with ESMTPS id + AF948431FC0 for ; Wed, 1 Jan 2014 04:53:28 -0800 + (PST) +Received: by mail-ee0-f49.google.com with SMTP id c41so5834449eek.22 + for ; Wed, 01 Jan 2014 04:53:27 -0800 (PST) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:from:to:cc:subject:in-reply-to:references + :user-agent:date:message-id:mime-version:content-type; + bh=iGyyesHHTOrJIBO9Fade920ByurBe7hOvU44y0IJCww=; + b=dqFWssk5bpPZAwSgpqqmin1DZpHa2k/hdXVzNOdC7pywWt5Id1WeYx0fNlnXYBAwU4 + 6o3BhjK01DUhoHSPG3NsJTtyIXHrfE7qN00N4+MC0Zw+cqyOZ6YaxoiwemUkFr8seM/t + mfD+AHSGius3pWpdfLb6jvEMfOBWp2o8fxjKWLekclL8ZT/8u7/2InUl2sprtiE6e5jc + qCh/tKtwxRF26+bb3lGP29/vU47jYa0ujM5wlwVSRzP8/wY+7uWAwH1Da0WACmt4+iqx + bPXxV/sk9bzXblq5Hf9b7lT+1Z9/Qd277gsWRdioPw+me85PUcuHmYVl2j8sfMqXGjeZ + wSDA== +X-Gm-Message-State: + ALoCoQnu/f+BWKaYlvd4RP+0/Y3K2afcnV6isf3+FEOkEGwdE8BnKBk1BVdWbZqGMKiu1ZHamqfU +X-Received: by 10.15.44.4 with SMTP id y4mr10917893eev.71.1388580807384; + Wed, 01 Jan 2014 04:53:27 -0800 (PST) +Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi. + [88.195.111.91]) by mx.google.com with ESMTPSA id + a45sm126834149eem.6.2014.01.01.04.53.25 for + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Wed, 01 Jan 2014 04:53:26 -0800 (PST) +From: Jani Nikula +To: Austin Clements , notmuch@notmuchmail.org +Subject: Re: [PATCH] new: Detect dirent.d_type support at configure time +In-Reply-To: <1385262952-29240-1-git-send-email-amdragon@mit.edu> +References: <1385262952-29240-1-git-send-email-amdragon@mit.edu> +User-Agent: Notmuch/0.17~rc2+18~g39a67a6 (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-pc-linux-gnu) +Date: Wed, 01 Jan 2014 14:53:24 +0200 +Message-ID: <87txdn2797.fsf@nikula.org> +MIME-Version: 1.0 +Content-Type: text/plain +Cc: pi-notmuch@pihost.us +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Wed, 01 Jan 2014 12:53:37 -0000 + +On Sun, 24 Nov 2013, Austin Clements wrote: +> 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. +> --- +> compat/have_d_type.c | 10 ++++++++++ +> configure | 16 ++++++++++++++++ +> notmuch-new.c | 2 +- +> 3 files changed, 27 insertions(+), 1 deletion(-) +> create mode 100644 compat/have_d_type.c +> +> diff --git a/compat/have_d_type.c b/compat/have_d_type.c +> new file mode 100644 +> index 0000000..9ca6c6e +> --- /dev/null +> +++ b/compat/have_d_type.c +> @@ -0,0 +1,10 @@ +> +#include +> + +> +int main() +> +{ +> + struct dirent ent; +> + +> + (void) ent.d_type; +> + +> + return 0; +> +} +> diff --git a/configure b/configure +> index 1a8e939..d2d193c 100755 +> --- a/configure +> +++ b/configure +> @@ -557,6 +557,17 @@ else +> fi +> rm -f compat/have_timegm +> +> +printf "Checking for dirent.d_type... " +> +if ${CC} -o compat/have_d_type "$srcdir"/compat/have_d_type.c > /dev/null 2>&1 +> +then +> + printf "Yes.\n" +> + have_d_type="1" +> +else +> + printf "No (will use stat instead).\n" +> + have_d_type="0" +> +fi +> +rm -f compat/have_d_type +> + +> printf "Checking for standard version of getpwuid_r... " +> if ${CC} -o compat/check_getpwuid "$srcdir"/compat/check_getpwuid.c > /dev/null 2>&1 +> then +> @@ -745,6 +756,9 @@ HAVE_STRCASESTR = ${have_strcasestr} +> # build its own version) +> HAVE_STRSEP = ${have_strsep} +> +> +# Whether struct dirent has d_type (if not, then notmuch will use stat) +> +HAVE_D_TYPE = ${have_d_type} +> + +> # Whether the Xapian version in use supports compaction +> HAVE_XAPIAN_COMPACT = ${have_xapian_compact} +> +> @@ -805,6 +819,7 @@ CONFIGURE_CFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS) \\ +> \$(VALGRIND_CFLAGS) \\ +> -DHAVE_STRCASESTR=\$(HAVE_STRCASESTR) \\ +> -DHAVE_STRSEP=\$(HAVE_STRSEP) \\ +> + -DHAVE_D_TYPE=\$(HAVE_D_TYPE) \\ +> -DSTD_GETPWUID=\$(STD_GETPWUID) \\ +> -DSTD_ASCTIME=\$(STD_ASCTIME) \\ +> -DHAVE_XAPIAN_COMPACT=\$(HAVE_XAPIAN_COMPACT) +> @@ -813,6 +828,7 @@ CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS) \\ +> \$(VALGRIND_CFLAGS) \$(XAPIAN_CXXFLAGS) \\ +> -DHAVE_STRCASESTR=\$(HAVE_STRCASESTR) \\ +> -DHAVE_STRSEP=\$(HAVE_STRSEP) \\ +> + -DHAVE_D_TYPE=\$(HAVE_D_TYPE) \\ +> -DSTD_GETPWUID=\$(STD_GETPWUID) \\ +> -DSTD_ASCTIME=\$(STD_ASCTIME) \\ +> -DHAVE_XAPIAN_COMPACT=\$(HAVE_XAPIAN_COMPACT) + +The patch looks good, but the above two hunks no longer apply +cleanly. Please repost. + +BR, +Jani. + + + +> diff --git a/notmuch-new.c b/notmuch-new.c +> index ba05cb4..423e188 100644 +> --- a/notmuch-new.c +> +++ b/notmuch-new.c +> @@ -167,7 +167,7 @@ dirent_type (const char *path, const struct dirent *entry) +> char *abspath; +> int err, saved_errno; +> +> -#ifdef _DIRENT_HAVE_D_TYPE +> +#if HAVE_D_TYPE +> /* Mapping from d_type to stat mode_t. We omit DT_LNK so that +> * we'll fall through to stat and get the real file type. */ +> static const mode_t modes[] = { +> -- +> 1.8.4.rc3 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch -- 2.26.2