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
#include "compiler.h"
#include "dlopen.h"
-#if defined(_GNU_SOURCE) && !defined(__MINGW32__) && !defined(__blrts)
+#if defined(HAVE_DLOPEN)
#include <dlfcn.h>
#endif
#if defined(_WIN32)
{
#if defined(__blrts)
return NULL;
-#elif defined(_GNU_SOURCE)
+#elif defined(HAVE_DLOPEN)
flags = RTLD_LAZY | RTLD_GLOBAL; /* Overriding flags at this time */
return dlopen(libname, flags);
#elif defined(__MINGW32__)
strncpy(fname2 + 1, fname, 998);
fname2[999] = 0;
u.v = dlsym(handle, fname2);
-#elif defined(_GNU_SOURCE)
+#elif defined(HAVE_DLOPEN)
u.v = dlsym(handle, fname);
#elif defined(__MINGW32__)
u.v = (void *) GetProcAddress(handle, fname);
{
#if defined(__blrts)
(void) handle;
-#elif defined(_GNU_SOURCE)
+#elif defined(HAVE_DLOPEN)
dlclose(handle);
#elif defined(__MINGW32__)
FreeLibrary(handle);