r23208: on some HP-UX boxes dlfcn.h is available and use unsigned int flags
authorStefan Metzmacher <metze@samba.org>
Tue, 29 May 2007 15:18:20 +0000 (15:18 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:53:03 +0000 (14:53 -0500)
for dlopen but no library contains the function...

metze

source/lib/replace/dlfcn.c
source/lib/replace/dlfcn.m4
source/lib/replace/replace.h

index 22f9f8bf79b6dfb218a898a8aa6d58f380aded9d..55b38bb9eb70e2e43d6f3d3e080f85fec6ee331f 100644 (file)
 #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;
 }
index d42409ac6301ccdc89eb72e9ee6ff7ff807ff79e..a1b57d10ec473d17298a32c00191a5f3a9ef09b0 100644 (file)
@@ -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"
index 1259400d6fc6787bb9efdd537cfe25355a4ae6ed..f584cd42fabeb1b1ef6c468eff7c091ce1b058a2 100644 (file)
@@ -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