summaryrefslogtreecommitdiff
path: root/source4/lib/replace
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/replace')
-rw-r--r--source4/lib/replace/dlfcn.c4
-rw-r--r--source4/lib/replace/dlfcn.m417
-rw-r--r--source4/lib/replace/replace.h4
3 files changed, 19 insertions, 6 deletions
diff --git a/source4/lib/replace/dlfcn.c b/source4/lib/replace/dlfcn.c
index 22f9f8bf79..55b38bb9eb 100644
--- a/source4/lib/replace/dlfcn.c
+++ b/source4/lib/replace/dlfcn.c
@@ -26,7 +26,11 @@
#include "replace.h"
#ifndef HAVE_DLOPEN
+#ifdef DLOPEN_TAKES_UNSIGNED_FLAGS
+void *rep_dlopen(const char *name, unsigned int flags)
+#else
void *rep_dlopen(const char *name, int flags)
+#endif
{
return NULL;
}
diff --git a/source4/lib/replace/dlfcn.m4 b/source4/lib/replace/dlfcn.m4
index d42409ac63..a1b57d10ec 100644
--- a/source4/lib/replace/dlfcn.m4
+++ b/source4/lib/replace/dlfcn.m4
@@ -5,12 +5,17 @@ LIBS=""
libreplace_cv_dlfcn=no
AC_SEARCH_LIBS(dlopen, dl)
-if test x"${ac_cv_search_dlopen}" = x"no"; then
- libreplace_cv_dlfcn=yes
-else
- AC_CHECK_HEADERS(dlfcn.h)
- AC_CHECK_FUNCS([dlopen dlsym dlerror dlclose],[],[libreplace_cv_dlfcn=yes])
-fi
+AC_CHECK_HEADERS(dlfcn.h)
+AC_CHECK_FUNCS([dlopen dlsym dlerror dlclose],[],[libreplace_cv_dlfcn=yes])
+
+AC_VERIFY_C_PROTOTYPE([void *dlopen(const char* filename, unsigned int flags)],
+ [
+ return 0;
+ ],[
+ AC_DEFINE(DLOPEN_TAKES_UNSIGNED_FLAGS, 1, [Whether dlopen takes unsinged int flags])
+ ],[],[
+ #include <dlfcn.h>
+ ])
if test x"${libreplace_cv_dlfcn}" = x"yes";then
LIBREPLACEOBJ="${LIBREPLACEOBJ} dlfcn.o"
diff --git a/source4/lib/replace/replace.h b/source4/lib/replace/replace.h
index 1259400d6f..f584cd42fa 100644
--- a/source4/lib/replace/replace.h
+++ b/source4/lib/replace/replace.h
@@ -228,8 +228,12 @@ char *rep_dlerror(void);
#ifndef HAVE_DLOPEN
#define dlopen rep_dlopen
+#ifdef DLOPEN_TAKES_UNSIGNED_FLAGS
+void *rep_dlopen(const char *name, unsigned int flags);
+#else
void *rep_dlopen(const char *name, int flags);
#endif
+#endif
#ifndef HAVE_DLSYM
#define dlsym rep_dlsym