Merge in build lp
[m6w6/libmemcached] / m4 / pandora_have_libdl.m4
1 dnl Copyright (C) 2009 Sun Microsystems, Inc.
2 dnl This file is free software; Sun Microsystems, Inc.
3 dnl gives unlimited permission to copy and/or distribute it,
4 dnl with or without modifications, as long as this notice is preserved.
5
6 #--------------------------------------------------------------------
7 # Check for libdl
8 #--------------------------------------------------------------------
9
10
11 AC_DEFUN([_PANDORA_SEARCH_LIBDL],[
12
13 save_LIBS="$LIBS"
14 LIBS=""
15 AC_CHECK_LIB(dl,dlopen)
16 AC_CHECK_FUNCS(dlopen)
17 LIBDL_LIBS="$LIBS"
18 LIBS="${save_LIBS}"
19 AC_SUBST(LIBDL_LIBS)
20
21 AM_CONDITIONAL(HAVE_LIBDL, [test "x${ac_cv_func_dlopen}" = "xyes"])
22 ])
23
24 AC_DEFUN([_PANDORA_HAVE_LIBDL],[
25
26 AC_ARG_ENABLE([libdl],
27 [AS_HELP_STRING([--disable-libdl],
28 [Build with libdl support @<:@default=on@:>@])],
29 [ac_enable_libdl="$enableval"],
30 [ac_enable_libdl="yes"])
31
32 _PANDORA_SEARCH_LIBDL
33 ])
34
35
36 AC_DEFUN([PANDORA_HAVE_LIBDL],[
37 AC_REQUIRE([_PANDORA_HAVE_LIBDL])
38 ])
39
40 AC_DEFUN([_PANDORA_REQUIRE_LIBDL],[
41 ac_enable_libdl="yes"
42 _PANDORA_SEARCH_LIBDL
43
44 AS_IF([test "$ac_cv_func_dlopen" != "yes"],[
45 AC_MSG_ERROR([libdl/dlopen() is required for ${PACKAGE}. On Debian this can be found in libc6-dev. On RedHat this can be found in glibc-devel.])
46 ])
47 ])
48
49 AC_DEFUN([PANDORA_REQUIRE_LIBDL],[
50 AC_REQUIRE([_PANDORA_REQUIRE_LIBDL])
51 ])