From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Dmitry V. Levin" Subject: Re: [PATCH v3 1/5] drm: Add config for detecting libdrm Date: Sat, 1 Aug 2015 21:22:05 +0300 Message-ID: <20150801182205.GA3973@altlinux.org> References: <1435755168-16207-1-git-send-email-patrik.jakobsson@linux.intel.com> <1435755168-16207-2-git-send-email-patrik.jakobsson@linux.intel.com> <20150723094821.GC1209@vapier> <20150730133052.GA1003@patrik-desktop.isw.intel.com> <20150730140449.GP21252@vapier> <20150731090911.GA30063@patrik-desktop.isw.intel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0427835481==" Return-path: Received: from pegasus3.altlinux.org (pegasus3.altlinux.org [194.107.17.103]) by gabe.freedesktop.org (Postfix) with ESMTP id AD9396E019 for ; Sat, 1 Aug 2015 11:22:08 -0700 (PDT) In-Reply-To: <20150731090911.GA30063@patrik-desktop.isw.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Patrik Jakobsson Cc: intel-gfx@lists.freedesktop.org, strace-devel@lists.sourceforge.net List-Id: intel-gfx@lists.freedesktop.org --===============0427835481== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="X1bOJ3K7DJ5YkBrT" Content-Disposition: inline --X1bOJ3K7DJ5YkBrT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jul 31, 2015 at 11:09:11AM +0200, Patrik Jakobsson wrote: > On Thu, Jul 30, 2015 at 10:04:49AM -0400, Mike Frysinger wrote: > > On 30 Jul 2015 15:30, Patrik Jakobsson wrote: > > > On Thu, Jul 23, 2015 at 05:48:21AM -0400, Mike Frysinger wrote: > > > > On 01 Jul 2015 14:52, Patrik Jakobsson wrote: > > > > > Use pkg-config to try to find libdrm. If that fails use the stand= ard > > > > > include directory for kernel drm headers in /usr/include/drm. > > > > >=20 > > > > > * configure.ac: Use pkg-config to find libdrm > > > > >=20 > > > > > Signed-off-by: Patrik Jakobsson > > > > > --- > > > > > configure.ac | 4 ++++ > > > > > 1 file changed, 4 insertions(+) > > > > >=20 > > > > > diff --git a/configure.ac b/configure.ac > > > > > index bb8bf46..aa63af7 100644 > > > > > --- a/configure.ac > > > > > +++ b/configure.ac > > > > > @@ -844,6 +844,10 @@ fi > > > > > AM_CONDITIONAL([USE_LIBUNWIND], [test "x$use_libunwind" =3D xyes= ]) > > > > > AC_MSG_RESULT([$use_libunwind]) > > > > > =20 > > > > > +PKG_CHECK_MODULES([libdrm], [libdrm], > > > > > + [CPPFLAGS=3D"$CPPFLAGS $libdrm_CFLAGS"], > > > > > + [CPPFLAGS=3D"$CPPFLAGS -I/usr/include/drm"]) > > > >=20 > > > > yikes, no, this is a really really bad idea. it should read: > > > > PKG_CHECK_MODULES([LIBDRM], [libdrm], > > > > [CPPFLAGS=3D"$CPPFLAGS $LIBDRM_CFLAGS"], [:]) > > >=20 > > > I take it you don't want me to fallback on kernel headers and skip > > > compiling with drm support if libdrm is not available? > >=20 > > you cannot hardcode any path at all. if the kernel headers provide all > > of the defines/structs that you need, then just include them directly > > via #include . > > -mike >=20 > The prefered "drm way" is to always use the libdrm headers and never the = kernel > headers. I know this is breaking the rules but it's what we got to work w= ith. > Some distros give you the kernel version and others the libdrm version. T= he > kernel version is wrong and libdrm patches this up since we're not allowe= d to > break the userspace interface. I think the safest way would be to only co= mpile > drm support for strace if libdrm is present and ignore the kernel headers. Unlike most of userspace, strace attempts to show the picture as it's seen =66rom the kernel perspective. Sometimes it forces us to use kernel headers instead of headers provided by libc and other libraries. If kernel itself uses uapi/drm, it should be safe for strace to use it as well. I suppose the check could be written this way: PKG_CHECK_MODULES([LIBDRM], [libdrm], [CPPFLAGS=3D"$CPPFLAGS $LIBDRM_CFLAGS" AC_CHECK_HEADERS([drm.h i915_drm.h])], [AC_CHECK_HEADERS([drm/drm.h drm/i915_drm.h])]) =2E.. #if defined HAVE_DRM_H || defined HAVE_DRM_DRM_H # ifdef HAVE_DRM_H # include # else # include # endif [rest of drm.c] #endif /* HAVE_DRM_H || HAVE_DRM_DRM_H */ --=20 ldv --X1bOJ3K7DJ5YkBrT Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlW9Dk0ACgkQfKvmrJ41Nh5begCgoCyo3u/26hZ5c1wEbGVdhd0V jicAn1KcAw/kOylQzpoiXmJ9aq1BnYB7 =BPQZ -----END PGP SIGNATURE----- --X1bOJ3K7DJ5YkBrT-- --===============0427835481== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHA6Ly9saXN0 cy5mcmVlZGVza3RvcC5vcmcvbWFpbG1hbi9saXN0aW5mby9pbnRlbC1nZngK --===============0427835481==--