From mboxrd@z Thu Jan 1 00:00:00 1970 From: Allen Martin Subject: Re: [tegrarcm PATCH] Don't assume cryptopp is system-wide installed Date: Tue, 19 Apr 2016 16:57:45 -0700 Message-ID: <20160419235745.GA28796@nvidia.com> References: <1461097517-21626-1-git-send-email-thomas.petazzoni@free-electrons.com> <5716B20E.8050607@wwwdotorg.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Return-path: In-Reply-To: <5716B20E.8050607-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> Content-Disposition: inline Sender: linux-tegra-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Stephen Warren Cc: Thomas Petazzoni , linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: linux-tegra@vger.kernel.org On Tue, Apr 19, 2016 at 04:32:46PM -0600, Stephen Warren wrote: > On 04/19/2016 02:25 PM, Thomas Petazzoni wrote: > >The current build system adds "-isystem /usr/include/$(CRYPTOLIB)" to > >AM_CPPFLAGS, but this is wrong because cryptopp might not be installed > >in this location. Instead, the build system should simply include > > or and rely on the compiler include > >path. > > > >The tricky part is that it can be or . To > >solve this, we use a solution similar to the one used in > >https://github.com/bingmann/crypto-speedtest/blob/master/m4/cryptopp.m4 > >and > >https://github.com/bingmann/crypto-speedtest/blob/master/src/speedtest_cryptopp.cpp: > >the configure script fills in a variable called > >CRYPTOLIB_HEADER_PREFIX, and we use that in the C++ code to include > >the right header file. > > > >It is worth mentioning that doing #include > > doesn't work, and we have to use an > >intermediate #define'd constant to overcome this C preprocessor > >limitation. > > I think this looks conceptually OK. CC += Allen to double-check > since he wrote the original cryptopp autoconf support. What about the following as an alternative? -- diff --git a/src/Makefile.am b/src/Makefile.am index 3dad0e6d5e72..22410b3f81bf 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,5 +1,6 @@ AM_CFLAGS = -Wall -std=c99 -AM_CPPFLAGS = -isystem /usr/include/$(CRYPTOLIB) $(LIBUSB_CFLAGS) +CRYPTO_PREFIX = $(shell pkg-config --variable=includedir libcrypto++) +AM_CPPFLAGS = -isystem $(CRYPTO_PREFIX)/$(CRYPTOLIB) $(LIBUSB_CFLAGS) bin_PROGRAMS = tegrarcm tegrarcm_SOURCES = \