Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Jul 2015 19:53:33 -0700
From:      NGie Cooper <yaneurabeya@gmail.com>
To:        Dimitry Andric <dim@freebsd.org>
Cc:        Adrian Chadd <adrian.chadd@gmail.com>, Pedro Giffuni <pfg@freebsd.org>,  Luigi Rizzo <luigi@freebsd.org>,  "src-committers@freebsd.org" <src-committers@freebsd.org>,  "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>,  "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r285284 - head/lib/liblzma
Message-ID:  <CAGHfRMA%2BpybAf=snW_NdjyQ0Amnw%2Bz2aGEp8_F-eVKy9eqGRzg@mail.gmail.com>
In-Reply-To: <F5CD87E5-92B5-4E87-8DAF-18F4510CD113@FreeBSD.org>
References:  <201507081836.t68IacJu069563@repo.freebsd.org> <559D9172.9040305@FreeBSD.org> <CAJ-Vmo=m0Y%2BE0oi5ec5RzyziqObOj=fKY1K-8HzqK8x7D_TcKg@mail.gmail.com> <F5CD87E5-92B5-4E87-8DAF-18F4510CD113@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jul 8, 2015 at 3:18 PM, Dimitry Andric <dim@freebsd.org> wrote:
> Check whether the path starts with /usr/bin, maybe?  Normally, you would
> check for the existence of a random header in a configure script.  But
> from within a C source file, it's not that easy.
>
> That said, immintrin.h is available for all usable versions of clang,
> and should be available in all versions of gcc >= 4.4 (at least, if I
> read gcc's commit history correctly).  And gcc in base is definitely not
> 4.4. :-)

$ cat ~/has_immintrin.c
#include <sys/cdefs.h>

#if __has_include(<immintrin.h>)
#error "I have immintrin.h"
#else
#error "I don't have immintrin.h"
#endif
$ clang -c ~/has_immintrin.c
/home/ngie/has_immintrin.c:4:2: error: "I have immintrin.h"
#error "I have immintrin.h"
 ^
1 error generated.
$ gcc -c ~/has_immintrin.c
/home/ngie/has_immintrin.c:6:2: error: #error "I don't have immintrin.h"

Sadly this macro wasn't added until gcc 5.x:
https://gcc.gnu.org/gcc-5/changes.html

Cheers,
-NGie



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGHfRMA%2BpybAf=snW_NdjyQ0Amnw%2Bz2aGEp8_F-eVKy9eqGRzg>