[Mesa-dev] [PATCH] configure: check for dladdr via AC_CHECK_FUNC/AC_CHECK_LIB
From: Pali Rohár pali.ro...@gmail.com Use both macros as in some cases using AC_CHECK_FUNCS alone may fail. Thus HAVE_DLADDR will not be defined, and as a result most of the code in megadriver_stub.c will not be compiled. Breakind the backwards compat with between older libGL/xserver(s) and DRI megadrivers. Cc: Jon TURNEY jon.tur...@dronecode.org.uk Cc: 10.2 mesa-sta...@lists.freedesktop.org [Emil Velikov] Commit message. Signed-off-by: Emil Velikov emil.l.veli...@gmail.com --- On the other hand we can replace _mesa_dl*, dl* and util_dl* with a single solution (based on the gallium one). Then we can drop the check altogether, and slim down the DEFINES that we're feeding to everything that we build, and drop the DLOPEN_LIBS :) Perhaps one day... -Emil configure.ac | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index a3b3abd..85f60ed 100644 --- a/configure.ac +++ b/configure.ac @@ -535,10 +535,9 @@ AC_CHECK_FUNC([dlopen], [DEFINES=$DEFINES -DHAVE_DLOPEN], AC_SUBST([DLOPEN_LIBS]) dnl Check if that library also has dladdr -save_LDFLAGS=$LDFLAGS -LDFLAGS=$LDFLAGS $DLOPEN_LIBS -AC_CHECK_FUNCS([dladdr]) -LDFLAGS=$save_LDFLAGS +AC_CHECK_FUNC([dladdr], [DEFINES=$DEFINES -DHAVE_DLADDR], +[AC_CHECK_LIB([dl], [dladdr], + [DEFINES=$DEFINES -DHAVE_DLADDR])]) case $host_os in darwin*|mingw*) -- 2.0.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] configure: check for dladdr via AC_CHECK_FUNC/AC_CHECK_LIB
No idea why this was a problem, but the new code matches the existing dlopen check. Reviewed-by: Matt Turner matts...@gmail.com ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] configure: check for dladdr via AC_CHECK_FUNC/AC_CHECK_LIB
The problem is that AC_CHECK_FUNCS would stick the LDFLAGS before the conftest.c arg while AC_CHECK_LIB sticks the -ldl after conftest.c. This apparently matters with newer gcc's. There's probably some correct autoconf way of dealing with it, but... this works :) On Fri, Aug 8, 2014 at 1:55 PM, Matt Turner matts...@gmail.com wrote: No idea why this was a problem, but the new code matches the existing dlopen check. Reviewed-by: Matt Turner matts...@gmail.com ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] configure: check for dladdr via AC_CHECK_FUNC/AC_CHECK_LIB
On 08/08/2014 18:58, Ilia Mirkin wrote: The problem is that AC_CHECK_FUNCS would stick the LDFLAGS before the conftest.c arg while AC_CHECK_LIB sticks the -ldl after conftest.c. This apparently matters with newer gcc's. There's probably some The key difference seems to be that lto was enabled, which I guess means we can't get away with listing objects in a random order :-) correct autoconf way of dealing with it, but... this works :) I think I have used LDFLAGS here where I should have used LIBS. So the more correct way is something like: diff --git a/configure.ac b/configure.ac index 96a67a3..bba64a0 100644 --- a/configure.ac +++ b/configure.ac @@ -535,9 +535,10 @@ AC_CHECK_FUNC([dlopen], [DEFINES=$DEFINES -DHAVE_DLOPEN], AC_SUBST([DLOPEN_LIBS]) dnl Check if that library also has dladdr -AC_CHECK_FUNC([dladdr], [DEFINES=$DEFINES -DHAVE_DLADDR], -[AC_CHECK_LIB([dl], [dladdr], - [DEFINES=$DEFINES -DHAVE_DLADDR])]) +save_LIBS=$LIBS +LIBS=$LIBS $DLOPEN_LIBS +AC_CHECK_FUNCS([dladdr]) +LIBS=$save_LIBS case $host_os in darwin*|mingw*) ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] configure: check for dladdr via AC_CHECK_FUNC/AC_CHECK_LIB
On 08/08/14 20:09, Jon TURNEY wrote: On 08/08/2014 18:58, Ilia Mirkin wrote: The problem is that AC_CHECK_FUNCS would stick the LDFLAGS before the conftest.c arg while AC_CHECK_LIB sticks the -ldl after conftest.c. This apparently matters with newer gcc's. There's probably some The key difference seems to be that lto was enabled, which I guess means we can't get away with listing objects in a random order :-) correct autoconf way of dealing with it, but... this works :) I think I have used LDFLAGS here where I should have used LIBS. So the more correct way is something like: Ouch... this seems like a trivial typo which we could have been spotted during review. To make it even more inspiring I've pushed Pali's version :\ Feel free to revert and/or commit this patch. -Emil diff --git a/configure.ac b/configure.ac index 96a67a3..bba64a0 100644 --- a/configure.ac +++ b/configure.ac @@ -535,9 +535,10 @@ AC_CHECK_FUNC([dlopen], [DEFINES=$DEFINES -DHAVE_DLOPEN], AC_SUBST([DLOPEN_LIBS]) dnl Check if that library also has dladdr -AC_CHECK_FUNC([dladdr], [DEFINES=$DEFINES -DHAVE_DLADDR], -[AC_CHECK_LIB([dl], [dladdr], - [DEFINES=$DEFINES -DHAVE_DLADDR])]) +save_LIBS=$LIBS +LIBS=$LIBS $DLOPEN_LIBS +AC_CHECK_FUNCS([dladdr]) +LIBS=$save_LIBS case $host_os in darwin*|mingw*) ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] configure: check for dladdr via AC_CHECK_FUNC/AC_CHECK_LIB
This problem happen when gcc is compiled with LTO support (even if is not used). Also in some manpage (I do not remember) is written that it depends on order of arguments for compiler/linker Btw, you can add my Signed-off-by to commit message. On Friday 08 August 2014 19:58:07 Ilia Mirkin wrote: The problem is that AC_CHECK_FUNCS would stick the LDFLAGS before the conftest.c arg while AC_CHECK_LIB sticks the -ldl after conftest.c. This apparently matters with newer gcc's. There's probably some correct autoconf way of dealing with it, but... this works :) On Fri, Aug 8, 2014 at 1:55 PM, Matt Turner matts...@gmail.com wrote: No idea why this was a problem, but the new code matches the existing dlopen check. Reviewed-by: Matt Turner matts...@gmail.com ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev -- Pali Rohár pali.ro...@gmail.com signature.asc Description: This is a digitally signed message part. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev