So here is a patch to define macros for the found support for dynamic loading. I imagine that I picked stupid names for the macros, and would welcome a correction. Otherwise, this seem OK?
-Fred
Index: acconfig.h =================================================================== RCS file: /home/cvs/apr/acconfig.h,v retrieving revision 1.41 diff -w -u -d -r1.41 acconfig.h --- acconfig.h 2001/04/12 07:05:45 1.41 +++ acconfig.h 2001/04/18 21:45:03 @@ -29,6 +29,10 @@ #undef HAVE_GMTOFF #undef USE_THREADS
+#undef DSO_USE_DLFCN +#undef DSO_USE_SHL +#undef DSO_USE_DYLD + #undef SIZEOF_SSIZE_T #undef SIZEOF_SIZE_T #undef SIZEOF_OFF_T Index: configure.in =================================================================== RCS file: /home/cvs/apr/configure.in,v retrieving revision 1.292 diff -w -u -d -r1.292 configure.in --- configure.in 2001/04/18 17:46:39 1.292 +++ configure.in 2001/04/18 21:45:03 @@ -780,19 +780,19 @@ [ --enable-dso Enable dso support ], [ tempdso=$enableval], [ - AC_CHECK_FUNCS(NSLinkModule, [ tempdso="yes" ], [ tempdso="no" ]) + AC_CHECK_FUNCS(NSLinkModule, [ tempdso="dyld" ], [ tempdso="no" ]) if test "$tempdso" = "no"; then - AC_CHECK_LIB(dl, dlopen, [ tempdso="yes" LIBS="$LIBS -ldl" ], + AC_CHECK_LIB(dl, dlopen, [ tempdso="dlfcn" LIBS="$LIBS -ldl" ], tempdso="no") fi if test "$tempdso" = "no"; then - AC_CHECK_FUNCS(dlopen, [ tempdso="yes" ], [ tempdso="no" ]) + AC_CHECK_FUNCS(dlopen, [ tempdso="dlfcn" ], [ tempdso="no" ]) fi if test "$tempdso" = "no"; then AC_CHECK_LIB(root, load_image, tempdso="yes", tempdso="no") fi if test "$tempdso" = "no"; then - AC_CHECK_LIB(dld, shl_load, [ tempdso="yes" LIBS="$LIBS -ldld" ], + AC_CHECK_LIB(dld, shl_load, [ tempdso="shl" LIBS="$LIBS -ldld" ], tempdso="no") fi if test "$tempdso" = "no"; then @@ -807,6 +807,11 @@ if test "$tempdso" = "no"; then aprdso="0" else + case "$tempdso" in + dlfcn) AC_DEFINE(DSO_USE_DLFCN);; + shl) AC_DEFINE(DSO_USE_SHL);; + dyld) AC_DEFINE(DSO_USE_DYLD);; + esac aprdso="1" apr_modules="$apr_modules dso" fi Index: dso/unix/dso.c =================================================================== RCS file: /home/cvs/apr/dso/unix/dso.c,v retrieving revision 1.34 diff -w -u -d -r1.34 dso.c --- dso/unix/dso.c 2001/04/18 17:47:10 1.34 +++ dso/unix/dso.c 2001/04/18 21:45:06 @@ -57,6 +57,10 @@
#if APR_HAS_DSO
+#if !defined(DSO_USE_DLFCN) && !defined(DSO_USE_SHL) && !defined(DSO_USE_DYLD)
+#error No DSO implementation specified.
+#endif
+
#ifdef HAVE_STDDEF_H
#include <stddef.h>
#endif
@@ -71,11 +75,11 @@
if (dso->handle == NULL)
return APR_SUCCESS;
-#if defined(HPUX) || defined(HPUX10) || defined(HPUX11)
+#if defined(DSO_USE_SHL)
shl_unload((shl_t)dso->handle);
-#elif defined(DARWIN)
+#elif defined(DSO_USE_DYLD)
NSUnLinkModule(dso->handle, FALSE);
-#else
+#elif defined(DSO_USE_DLFCN)
if (dlclose(dso->handle) != 0)
return APR_EINIT;
#endif
@@ -87,10 +91,10 @@
APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle,
const char *path, apr_pool_t *ctx)
{
-#if defined(HPUX) || defined(HPUX10) || defined(HPUX11)
+#if defined(DSO_USE_SHL)
shl_t os_handle = shl_load(path, BIND_IMMEDIATE|BIND_VERBOSE|BIND_NOSTART, 0L);
-#elif defined(DARWIN) +#elif defined(DSO_USE_DYLD) NSObjectFileImage image; NSModule os_handle; char* err_msg = NULL; @@ -107,24 +111,26 @@ #endif }
-#elif defined(OSF1) || defined(SEQUENT) || defined(SNI) ||\ +#elif defined(DSO_USE_DLFCN) +#if defined(OSF1) || defined(SEQUENT) || defined(SNI) ||\ (defined(__FreeBSD_version) && (__FreeBSD_version >= 220000)) void *os_handle = dlopen((char *)path, RTLD_NOW | RTLD_GLOBAL);
#else void *os_handle = dlopen(path, RTLD_NOW | RTLD_GLOBAL); #endif +#endif /* DSO_USE_x */
*res_handle = apr_pcalloc(ctx, sizeof(**res_handle));
if(os_handle == NULL) { -#if defined(HPUX) || defined(HPUX10) || defined(HPUX11) +#if defined(DSO_USE_SHL) (*res_handle)->errormsg = strerror(errno); return errno; -#elif defined(DARWIN) +#elif defined(DSO_USE_DYLD) (*res_handle)->errormsg = (err_msg) ? err_msg : "link failed"; return APR_EDSOOPEN; -#else +#elif defined(DSO_USE_DLFCN) (*res_handle)->errormsg = dlerror(); return APR_EDSOOPEN; #endif @@ -148,7 +154,7 @@ apr_dso_handle_t *handle, const char *symname) { -#if defined(HPUX) || defined(HPUX10) || defined(HPUX11) +#if defined(DSO_USE_SHL) void *symaddr = NULL; int status;
@@ -161,7 +167,7 @@ *ressym = symaddr; return APR_SUCCESS;
-#elif defined(DARWIN) +#elif defined(DSO_USE_DYLD) void *retval = NULL; NSSymbol symbol; char *symname2 = (char*)malloc(sizeof(char)*(strlen(symname)+2)); @@ -182,7 +188,7 @@ return APR_EINIT; }
-#else /* use dlsym()/dlerror() */ +#elif defined(DSO_USE_DLFCN)
#if defined(DLSYM_NEEDS_UNDERSCORE) void *retval; @@ -190,12 +196,11 @@ sprintf(symbol, "_%s", symname); retval = dlsym(handle->handle, symbol); free(symbol); - #elif defined(SEQUENT) || defined(SNI) void *retval = dlsym(handle->handle, (char *)symname); #else void *retval = dlsym(handle->handle, symname); -#endif +#endif /* DLSYM_NEEDS_UNDERSCORE */
if (retval == NULL) { handle->errormsg = dlerror(); @@ -205,7 +210,7 @@ *ressym = retval;
return APR_SUCCESS; -#endif /* use dlsym()/dlerror() */ +#endif /* DSO_USE_x */ }
APR_DECLARE(const char *) apr_dso_error(apr_dso_handle_t *dso, char *buffer, apr_size_t buflen)