apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wsanc...@apache.org
Subject cvs commit: apr/dso/unix dso.c
Date Thu, 19 Apr 2001 07:18:50 GMT
wsanchez    01/04/19 00:18:49

  Modified:    .        CHANGES acconfig.h configure.in
               dso/unix dso.c
  Log:
  Clean up conditionals in unix DSO code so that we decide based on the
  dynamic loading implementation, which we noticed at configure time,
  instead of by operating system, which should be simpler to maintain.
  
  Revision  Changes    Path
  1.95      +5 -0      apr/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apr/CHANGES,v
  retrieving revision 1.94
  retrieving revision 1.95
  diff -u -r1.94 -r1.95
  --- CHANGES	2001/04/18 17:56:48	1.94
  +++ CHANGES	2001/04/19 07:18:35	1.95
  @@ -1,5 +1,10 @@
   Changes with APR b1  
   
  +  *) Clean up conditionals in unix DSO code so that we decide based on
  +     the dynamic loading implementation, which we noticed at configure
  +     time, instead of by operating system.
  +     [Wilfredo Sanchez]
  +
     *) Add DSO support for dyld platforms (Darwin/Mac OS and OpenStep).
        [Wilfredo Sanchez]
   
  
  
  
  1.42      +4 -0      apr/acconfig.h
  
  Index: acconfig.h
  ===================================================================
  RCS file: /home/cvs/apr/acconfig.h,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- acconfig.h	2001/04/12 07:05:45	1.41
  +++ acconfig.h	2001/04/19 07:18:38	1.42
  @@ -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
  
  
  
  1.293     +9 -4      apr/configure.in
  
  Index: configure.in
  ===================================================================
  RCS file: /home/cvs/apr/configure.in,v
  retrieving revision 1.292
  retrieving revision 1.293
  diff -u -r1.292 -r1.293
  --- configure.in	2001/04/18 17:46:39	1.292
  +++ configure.in	2001/04/19 07:18:39	1.293
  @@ -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
  
  
  
  1.35      +20 -15    apr/dso/unix/dso.c
  
  Index: dso.c
  ===================================================================
  RCS file: /home/cvs/apr/dso/unix/dso.c,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- dso.c	2001/04/18 17:47:10	1.34
  +++ dso.c	2001/04/19 07:18:47	1.35
  @@ -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)
  
  
  

Mime
View raw message