Re: [Mesa-dev] [Mesa-stable] [PATCH] configure.ac: use pkg-config for libelf

2015-12-06 Thread Michel Dänzer
On 06.12.2015 13:58, Jonathan Gray wrote:
> On Tue, Dec 01, 2015 at 04:56:54PM +, Emil Velikov wrote:
>> Hi Jonathan,
>>
>> On 23 November 2015 at 03:24, Jonathan Gray  wrote:
>>> Use PKG_CHECK_MODULES to get the flags to link libelf.
>>>
>>> Signed-off-by: Jonathan Gray 
>>> Cc: "11.0 11.1" 
>>> ---
>>>  configure.ac   | 4 +---
>>>  src/gallium/drivers/radeon/Makefile.am | 2 +-
>>>  src/gallium/targets/opencl/Makefile.am | 2 +-
>>>  3 files changed, 3 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/configure.ac b/configure.ac
>>> index 72a2ec1..afee3ed 100644
>>> --- a/configure.ac
>>> +++ b/configure.ac
>>> @@ -1712,7 +1712,7 @@ AC_ARG_WITH([clang-libdir],
>>> [CLANG_LIBDIR=''])
>>>
>>>  PKG_CHECK_EXISTS([libclc], [have_libclc=yes], [have_libclc=no])
>>> -AC_CHECK_LIB([elf], [elf_memory], [have_libelf=yes;ELF_LIB=-lelf])
>>> +PKG_CHECK_MODULES([LIBELF], [libelf], [have_libelf=yes], [have_libelf=no])
>>>
>> As suggested can you rework the patch to have the pkg check + the
>> original check_lib as a fall-back.
>> While you're doing this can we also make use of the _CFLAGS in
>> src/gallium/drivers/radeon/ and src/gallium/state_trackers/clover/ ?
> 
> Can someone with a libelf provided by elfutils try this?

I've tested it with both libelf and elfutils.

Reviewed-and-Tested-by: Michel Dänzer 


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [Mesa-stable] [PATCH] configure.ac: use pkg-config for libelf

2015-12-05 Thread Jonathan Gray
On Tue, Dec 01, 2015 at 04:56:54PM +, Emil Velikov wrote:
> Hi Jonathan,
> 
> On 23 November 2015 at 03:24, Jonathan Gray  wrote:
> > Use PKG_CHECK_MODULES to get the flags to link libelf.
> >
> > Signed-off-by: Jonathan Gray 
> > Cc: "11.0 11.1" 
> > ---
> >  configure.ac   | 4 +---
> >  src/gallium/drivers/radeon/Makefile.am | 2 +-
> >  src/gallium/targets/opencl/Makefile.am | 2 +-
> >  3 files changed, 3 insertions(+), 5 deletions(-)
> >
> > diff --git a/configure.ac b/configure.ac
> > index 72a2ec1..afee3ed 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -1712,7 +1712,7 @@ AC_ARG_WITH([clang-libdir],
> > [CLANG_LIBDIR=''])
> >
> >  PKG_CHECK_EXISTS([libclc], [have_libclc=yes], [have_libclc=no])
> > -AC_CHECK_LIB([elf], [elf_memory], [have_libelf=yes;ELF_LIB=-lelf])
> > +PKG_CHECK_MODULES([LIBELF], [libelf], [have_libelf=yes], [have_libelf=no])
> >
> As suggested can you rework the patch to have the pkg check + the
> original check_lib as a fall-back.
> While you're doing this can we also make use of the _CFLAGS in
> src/gallium/drivers/radeon/ and src/gallium/state_trackers/clover/ ?
> 
> Thanks
> Emil

Can someone with a libelf provided by elfutils try this?

diff --git a/configure.ac b/configure.ac
index 71109e2..0374142 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1729,7 +1729,15 @@ AC_ARG_WITH([clang-libdir],
[CLANG_LIBDIR=''])
 
 PKG_CHECK_EXISTS([libclc], [have_libclc=yes], [have_libclc=no])
-AC_CHECK_LIB([elf], [elf_memory], [have_libelf=yes;ELF_LIB=-lelf])
+PKG_CHECK_MODULES([LIBELF], [libelf], [have_libelf=yes], [have_libelf=no])
+
+if test "x$have_libelf" = xno; then
+   LIBELF_LIBS=''
+   LIBELF_CFLAGS=''
+   AC_CHECK_LIB([elf], [elf_memory], [have_libelf=yes;LIBELF_LIBS=-lelf], 
[have_libelf=no])
+   AC_SUBST([LIBELF_LIBS])
+   AC_SUBST([LIBELF_CFLAGS])
+fi
 
 if test "x$enable_opencl" = xyes; then
 if test -z "$with_gallium_drivers"; then
@@ -2310,8 +2318,6 @@ if test "x$USE_VC4_SIMULATOR" = xyes -a 
"x$HAVE_GALLIUM_ILO" = xyes; then
 AC_MSG_ERROR([VC4 simulator on x86 replaces i965 driver build, so ilo must 
be disabled.])
 fi
 
-AC_SUBST([ELF_LIB])
-
 AM_CONDITIONAL(HAVE_LIBDRM, test "x$have_libdrm" = xyes)
 AM_CONDITIONAL(HAVE_X11_DRIVER, test "x$enable_xlib_glx" = xyes)
 AM_CONDITIONAL(HAVE_OSMESA, test "x$enable_osmesa" = xyes)
diff --git a/src/gallium/drivers/radeon/Makefile.am 
b/src/gallium/drivers/radeon/Makefile.am
index 13d8976..a6fc145 100644
--- a/src/gallium/drivers/radeon/Makefile.am
+++ b/src/gallium/drivers/radeon/Makefile.am
@@ -16,7 +16,8 @@ libradeon_la_SOURCES = \
 if NEED_RADEON_LLVM
 
 AM_CFLAGS += \
-   $(LLVM_CFLAGS)
+   $(LLVM_CFLAGS) \
+   $(LIBELF_CFLAGS)
 
 libradeon_la_SOURCES += \
$(LLVM_C_FILES)
@@ -24,7 +25,7 @@ libradeon_la_SOURCES += \
 libradeon_la_LIBADD = \
$(CLOCK_LIB) \
$(LLVM_LIBS) \
-   $(ELF_LIB)
+   $(LIBELF_LIBS)
 
 libradeon_la_LDFLAGS = \
$(LLVM_LDFLAGS)
diff --git a/src/gallium/targets/opencl/Makefile.am 
b/src/gallium/targets/opencl/Makefile.am
index 08f95e8..f3ba1e3 100644
--- a/src/gallium/targets/opencl/Makefile.am
+++ b/src/gallium/targets/opencl/Makefile.am
@@ -2,6 +2,9 @@ include $(top_srcdir)/src/gallium/Automake.inc
 
 lib_LTLIBRARIES = lib@OPENCL_LIBNAME@.la
 
+AM_CPPFLAGS = \
+$(LIBELF_CFLAGS)
+
 lib@OPENCL_LIBNAME@_la_LDFLAGS = \
$(LLVM_LDFLAGS) \
-no-undefined \
@@ -19,7 +22,7 @@ lib@OPENCL_LIBNAME@_la_LIBADD = \
$(top_builddir)/src/gallium/state_trackers/clover/libclover.la \
$(top_builddir)/src/gallium/auxiliary/libgallium.la \
$(top_builddir)/src/util/libmesautil.la \
-   $(ELF_LIB) \
+   $(LIBELF_LIBS) \
$(DLOPEN_LIBS) \
-lclangCodeGen \
-lclangFrontendTool \
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [Mesa-stable] [PATCH] configure.ac: use pkg-config for libelf

2015-12-01 Thread Emil Velikov
Hi Jonathan,

On 23 November 2015 at 03:24, Jonathan Gray  wrote:
> Use PKG_CHECK_MODULES to get the flags to link libelf.
>
> Signed-off-by: Jonathan Gray 
> Cc: "11.0 11.1" 
> ---
>  configure.ac   | 4 +---
>  src/gallium/drivers/radeon/Makefile.am | 2 +-
>  src/gallium/targets/opencl/Makefile.am | 2 +-
>  3 files changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 72a2ec1..afee3ed 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1712,7 +1712,7 @@ AC_ARG_WITH([clang-libdir],
> [CLANG_LIBDIR=''])
>
>  PKG_CHECK_EXISTS([libclc], [have_libclc=yes], [have_libclc=no])
> -AC_CHECK_LIB([elf], [elf_memory], [have_libelf=yes;ELF_LIB=-lelf])
> +PKG_CHECK_MODULES([LIBELF], [libelf], [have_libelf=yes], [have_libelf=no])
>
As suggested can you rework the patch to have the pkg check + the
original check_lib as a fall-back.
While you're doing this can we also make use of the _CFLAGS in
src/gallium/drivers/radeon/ and src/gallium/state_trackers/clover/ ?

Thanks
Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [Mesa-stable] [PATCH] configure.ac: use pkg-config for libelf

2015-11-24 Thread Michel Dänzer
On 23.11.2015 23:06, Emil Velikov wrote:
> On 23 November 2015 at 03:24, Jonathan Gray  wrote:
>> Use PKG_CHECK_MODULES to get the flags to link libelf.
>>
>> Signed-off-by: Jonathan Gray 
>> Cc: "11.0 11.1" 
>> ---
>>  configure.ac   | 4 +---
>>  src/gallium/drivers/radeon/Makefile.am | 2 +-
>>  src/gallium/targets/opencl/Makefile.am | 2 +-
>>  3 files changed, 3 insertions(+), 5 deletions(-)
>>
>> diff --git a/configure.ac b/configure.ac
>> index 72a2ec1..afee3ed 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -1712,7 +1712,7 @@ AC_ARG_WITH([clang-libdir],
>> [CLANG_LIBDIR=''])
>>
>>  PKG_CHECK_EXISTS([libclc], [have_libclc=yes], [have_libclc=no])
>> -AC_CHECK_LIB([elf], [elf_memory], [have_libelf=yes;ELF_LIB=-lelf])
>> +PKG_CHECK_MODULES([LIBELF], [libelf], [have_libelf=yes], [have_libelf=no])
>>
> There are (at least) two providers/projects for libelf one of which
> iirc does not provide a .pc file. We might need to keep the check_lib
> as a fall back. Don't know which one is required/compatible with
> radeon and opencl.

Either works for that, but AFAICT libelf (which ships a .pc file) has
been basically dead upstream for years, whereas elfutils (which doesn't
ship a .pc file) is being actively developed. So I'm afraid we do need
the non-pkg-config path at least as a fallback, at least until somebody
makes elfutils ship a .pc file as well.


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [Mesa-stable] [PATCH] configure.ac: use pkg-config for libelf

2015-11-23 Thread Emil Velikov
On 23 November 2015 at 03:24, Jonathan Gray  wrote:
> Use PKG_CHECK_MODULES to get the flags to link libelf.
>
> Signed-off-by: Jonathan Gray 
> Cc: "11.0 11.1" 
> ---
>  configure.ac   | 4 +---
>  src/gallium/drivers/radeon/Makefile.am | 2 +-
>  src/gallium/targets/opencl/Makefile.am | 2 +-
>  3 files changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 72a2ec1..afee3ed 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1712,7 +1712,7 @@ AC_ARG_WITH([clang-libdir],
> [CLANG_LIBDIR=''])
>
>  PKG_CHECK_EXISTS([libclc], [have_libclc=yes], [have_libclc=no])
> -AC_CHECK_LIB([elf], [elf_memory], [have_libelf=yes;ELF_LIB=-lelf])
> +PKG_CHECK_MODULES([LIBELF], [libelf], [have_libelf=yes], [have_libelf=no])
>
There are (at least) two providers/projects for libelf one of which
iirc does not provide a .pc file. We might need to keep the check_lib
as a fall back. Don't know which one is required/compatible with
radeon and opencl.

Tom, Marek any ideas ?

Thanks
Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev