[Mesa-dev] [PATCH] mesa/dlopen: use HAVE_DLOPEN instead of _GNU_SOURCE

Matt Turner mattst88 at gmail.com
Thu Aug 16 11:15:10 PDT 2012


On Thu, Aug 16, 2012 at 3:59 AM, Tapani Pälli <tapani.palli at intel.com> wrote:
> Patches changes mesa to use 'HAVE_DLOPEN' defined by configure and Android.mk
> instead of _GNU_SOURCE for detecting dlopen capability. This makes dlopen to
> work also on Android where _GNU_SOURCE is not defined.
>
> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
> ---
>  Android.common.mk      | 4 +++-
>  configure.ac           | 5 +++--
>  src/mesa/main/dlopen.c | 8 ++++----
>  3 files changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/Android.common.mk b/Android.common.mk
> index e8b9006..1e9f040 100644
> --- a/Android.common.mk
> +++ b/Android.common.mk
> @@ -47,7 +47,9 @@ LOCAL_CFLAGS += \
>  ifeq ($(strip $(MESA_ENABLE_ASM)),true)
>  ifeq ($(TARGET_ARCH),x86)
>  LOCAL_CFLAGS += \
> -       -DUSE_X86_ASM
> +       -DUSE_X86_ASM \
> +       -DHAVE_DLOPEN \
> +
>  endif
>  endif
>
> diff --git a/configure.ac b/configure.ac
> index 0329bad..5174280 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -503,8 +503,9 @@ MESA_PIC_FLAGS
>
>  dnl Check to see if dlopen is in default libraries (like Solaris, which
>  dnl has it in libc), or if libdl is needed to get it.
> -AC_CHECK_FUNC([dlopen], [],
> -    [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
> +AC_CHECK_FUNC([dlopen], [DEFINES="$DEFINES -DHAVE_DLOPEN"],
> +    [AC_CHECK_LIB([dl], [dlopen],
> +       [DEFINES="$DEFINES -DHAVE_DLOPEN"; DLOPEN_LIBS="-ldl"])])
>  AC_SUBST([DLOPEN_LIBS])
>
>  dnl See if posix_memalign is available
> diff --git a/src/mesa/main/dlopen.c b/src/mesa/main/dlopen.c
> index 57a3329..30fcd1d 100644
> --- a/src/mesa/main/dlopen.c
> +++ b/src/mesa/main/dlopen.c
> @@ -31,7 +31,7 @@
>  #include "compiler.h"
>  #include "dlopen.h"
>
> -#if defined(_GNU_SOURCE) && !defined(__MINGW32__) && !defined(__blrts)
> +#if defined(HAVE_DLOPEN) && !defined(__MINGW32__) && !defined(__blrts)

I imagine that __MINGW32__ and __blrts (whatever that is) are
special-cased because they define _GNU_SOURCE, but don't have dlopen.
It'd probably be okay to simplify that to just #if
defined(HAVE_DLOPEN) and let configure.ac decide if dlopen is
available.

Otherwise, seems reasonable.

Acked-by: Matt Turner <mattst88 at gmail.com>

(send an updated patch and I'll commit it for you)


More information about the mesa-dev mailing list