Commit 78ee7a2c authored by Sam Hocevar's avatar Sam Hocevar

* configure.ac:

    + Better BeOS dynamic loader detection.
  * src/misc/modules.c:
    + Consistency fixes.
parent 80a06d33
dnl Autoconf settings for vlc dnl Autoconf settings for vlc
dnl $Id: configure.ac,v 1.84 2003/10/04 18:55:12 gbazin Exp $ dnl $Id: configure.ac,v 1.85 2003/10/05 21:29:23 sam Exp $
AC_INIT(vlc,0.6.3-cvs) AC_INIT(vlc,0.6.3-cvs)
...@@ -395,13 +395,16 @@ fi ...@@ -395,13 +395,16 @@ fi
if test "${ac_cv_have_plugins}" = "no"; then if test "${ac_cv_have_plugins}" = "no"; then
AC_CHECK_LIB(kernel32, main, AC_CHECK_LIB(kernel32, main,
[AX_ADD_LDFLAGS([vlc],[-lkernel32]) [AX_ADD_LDFLAGS([vlc],[-lkernel32])
AC_DEFINE(HAVE_DL_WINDOWS, 1, [Define if you have Windows' LoadLibrary])
ac_cv_have_plugins=yes]) ac_cv_have_plugins=yes])
fi fi
# BeOS style # BeOS style
if test "${ac_cv_have_plugins}" = "no"; then if test "${ac_cv_have_plugins}" = "no"; then
AC_CHECK_HEADERS(image.h, AC_CHECK_HEADERS(image.h)
[ac_cv_have_plugins=yes]) AC_CHECK_FUNCS(load_add_on,
[AC_DEFINE(HAVE_DL_BEOS, 1, [Define if you have the BeOS dl])
ac_cv_have_plugins=yes])
fi fi
# Only test for dlopen() if the others didn't work # Only test for dlopen() if the others didn't work
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* modules.c : Builtin and plugin modules management functions * modules.c : Builtin and plugin modules management functions
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: modules.c,v 1.135 2003/10/05 15:35:59 sam Exp $ * $Id: modules.c,v 1.136 2003/10/05 21:29:23 sam Exp $
* *
* Authors: Sam Hocevar <sam@zoy.org> * Authors: Sam Hocevar <sam@zoy.org>
* Ethan C. Baldridge <BaldridgeE@cadmus.com> * Ethan C. Baldridge <BaldridgeE@cadmus.com>
...@@ -54,23 +54,25 @@ ...@@ -54,23 +54,25 @@
#endif #endif
#define HAVE_DYNAMIC_PLUGINS #define HAVE_DYNAMIC_PLUGINS
#if defined (HAVE_MACH_O_DYLD_H) #if defined(HAVE_DL_DYLD)
# include <mach-o/dyld.h> # if defined(HAVE_MACH_O_DYLD_H)
#elif defined (HAVE_IMAGE_H) /* BeOS */ # include <mach-o/dyld.h>
# include <image.h> # endif
#elif defined (UNDER_CE) #elif defined(HAVE_DL_BEOS)
# include <windows.h> # if defined(HAVE_IMAGE_H)
#elif defined (WIN32) # include <image.h>
# endif
#elif defined(HAVE_DL_WINDOWS)
# include <windows.h> # include <windows.h>
#elif defined (HAVE_DL_DLOPEN) #elif defined(HAVE_DL_DLOPEN)
# if defined (HAVE_DLFCN_H) /* Linux, BSD, Hurd */ # if defined(HAVE_DLFCN_H) /* Linux, BSD, Hurd */
# include <dlfcn.h> # include <dlfcn.h>
# endif # endif
# if defined (HAVE_SYS_DL_H) # if defined(HAVE_SYS_DL_H)
# include <sys/dl.h> # include <sys/dl.h>
# endif # endif
#elif defined (HAVE_DL_SHL_LOAD) #elif defined(HAVE_DL_SHL_LOAD)
# if defined (HAVE_DL_H) # if defined(HAVE_DL_H)
# include <dl.h> # include <dl.h>
# endif # endif
#else #else
...@@ -139,7 +141,7 @@ static void UndupModule ( module_t * ); ...@@ -139,7 +141,7 @@ static void UndupModule ( module_t * );
static int CallEntry ( module_t * ); static int CallEntry ( module_t * );
static void CloseModule ( module_handle_t ); static void CloseModule ( module_handle_t );
static void * GetSymbol ( module_handle_t, const char * ); static void * GetSymbol ( module_handle_t, const char * );
#if defined(UNDER_CE) || defined(WIN32) #if defined(HAVE_DL_WINDOWS)
static char * GetWindowsError ( void ); static char * GetWindowsError ( void );
#endif #endif
#endif #endif
...@@ -835,7 +837,7 @@ static int AllocatePluginFile( vlc_object_t * p_this, MYCHAR * psz_file ) ...@@ -835,7 +837,7 @@ static int AllocatePluginFile( vlc_object_t * p_this, MYCHAR * psz_file )
/* Destroy our image, we won't need it */ /* Destroy our image, we won't need it */
NSDestroyObjectFileImage( image ); NSDestroyObjectFileImage( image );
#elif defined(HAVE_IMAGE_H) #elif defined(HAVE_DL_BEOS)
handle = load_add_on( psz_file ); handle = load_add_on( psz_file );
if( handle < 0 ) if( handle < 0 )
{ {
...@@ -843,7 +845,7 @@ static int AllocatePluginFile( vlc_object_t * p_this, MYCHAR * psz_file ) ...@@ -843,7 +845,7 @@ static int AllocatePluginFile( vlc_object_t * p_this, MYCHAR * psz_file )
return -1; return -1;
} }
#elif defined(UNDER_CE) #elif defined(HAVE_DL_WINDOWS) && defined(UNDER_CE)
char psz_filename[MAX_PATH]; char psz_filename[MAX_PATH];
WideCharToMultiByte( CP_ACP, WC_DEFAULTCHAR, psz_file, -1, WideCharToMultiByte( CP_ACP, WC_DEFAULTCHAR, psz_file, -1,
psz_filename, MAX_PATH, NULL, NULL ); psz_filename, MAX_PATH, NULL, NULL );
...@@ -856,7 +858,7 @@ static int AllocatePluginFile( vlc_object_t * p_this, MYCHAR * psz_file ) ...@@ -856,7 +858,7 @@ static int AllocatePluginFile( vlc_object_t * p_this, MYCHAR * psz_file )
free( psz_error ); free( psz_error );
} }
#elif defined(WIN32) #elif defined(HAVE_DL_WINDOWS) && defined(WIN32)
handle = LoadLibrary( psz_file ); handle = LoadLibrary( psz_file );
if( handle == NULL ) if( handle == NULL )
{ {
...@@ -906,8 +908,12 @@ static int AllocatePluginFile( vlc_object_t * p_this, MYCHAR * psz_file ) ...@@ -906,8 +908,12 @@ static int AllocatePluginFile( vlc_object_t * p_this, MYCHAR * psz_file )
return -1; return -1;
} }
#elif defined(HAVE_DL_DLOPEN) && defined(DL_LAZY) #elif defined(HAVE_DL_DLOPEN)
# if defined(DL_LAZY)
handle = dlopen( psz_file, DL_LAZY ); handle = dlopen( psz_file, DL_LAZY );
# else
handle = dlopen( psz_file, 0 );
# endif
if( handle == NULL ) if( handle == NULL )
{ {
msg_Warn( p_this, "cannot load module `%s' (%s)", msg_Warn( p_this, "cannot load module `%s' (%s)",
...@@ -1132,10 +1138,10 @@ static int CallEntry( module_t * p_module ) ...@@ -1132,10 +1138,10 @@ static int CallEntry( module_t * p_module )
if( pf_symbol == NULL ) if( pf_symbol == NULL )
{ {
#if defined(HAVE_DL_DYLD) || defined(HAVE_IMAGE_H) #if defined(HAVE_DL_DYLD) || defined(HAVE_DL_BEOS)
msg_Warn( p_module, "cannot find symbol \"%s\" in file `%s'", msg_Warn( p_module, "cannot find symbol \"%s\" in file `%s'",
psz_name, p_module->psz_filename ); psz_name, p_module->psz_filename );
#elif defined(UNDER_CE) || defined(WIN32) #elif defined(HAVE_DL_WINDOWS)
char *psz_error = GetWindowsError(); char *psz_error = GetWindowsError();
msg_Warn( p_module, "cannot find symbol \"%s\" in file `%s' (%s)", msg_Warn( p_module, "cannot find symbol \"%s\" in file `%s' (%s)",
psz_name, p_module->psz_filename, psz_error ); psz_name, p_module->psz_filename, psz_error );
...@@ -1177,10 +1183,10 @@ static void CloseModule( module_handle_t handle ) ...@@ -1177,10 +1183,10 @@ static void CloseModule( module_handle_t handle )
#if defined(HAVE_DL_DYLD) #if defined(HAVE_DL_DYLD)
NSUnLinkModule( handle, FALSE ); NSUnLinkModule( handle, FALSE );
#elif defined(HAVE_IMAGE_H) #elif defined(HAVE_DL_BEOS)
unload_add_on( handle ); unload_add_on( handle );
#elif defined(WIN32) || defined(UNDER_CE) #elif defined(HAVE_DL_WINDOWS)
FreeLibrary( handle ); FreeLibrary( handle );
#elif defined(HAVE_DL_DLOPEN) #elif defined(HAVE_DL_DLOPEN)
...@@ -1229,7 +1235,7 @@ static void * _module_getsymbol( module_handle_t handle, ...@@ -1229,7 +1235,7 @@ static void * _module_getsymbol( module_handle_t handle,
NSSymbol sym = NSLookupSymbolInModule( handle, psz_function ); NSSymbol sym = NSLookupSymbolInModule( handle, psz_function );
return NSAddressOfSymbol( sym ); return NSAddressOfSymbol( sym );
#elif defined(HAVE_IMAGE_H) #elif defined(HAVE_DL_BEOS)
void * p_symbol; void * p_symbol;
if( B_OK == get_image_symbol( handle, psz_function, if( B_OK == get_image_symbol( handle, psz_function,
B_SYMBOL_TYPE_TEXT, &p_symbol ) ) B_SYMBOL_TYPE_TEXT, &p_symbol ) )
...@@ -1241,13 +1247,13 @@ static void * _module_getsymbol( module_handle_t handle, ...@@ -1241,13 +1247,13 @@ static void * _module_getsymbol( module_handle_t handle,
return NULL; return NULL;
} }
#elif defined( UNDER_CE ) #elif defined(HAVE_DL_WINDOWS) && defined(UNDER_CE)
wchar_t psz_real[256]; wchar_t psz_real[256];
MultiByteToWideChar( CP_ACP, 0, psz_function, -1, psz_real, 256 ); MultiByteToWideChar( CP_ACP, 0, psz_function, -1, psz_real, 256 );
return (void *)GetProcAddress( handle, psz_real ); return (void *)GetProcAddress( handle, psz_real );
#elif defined( WIN32 ) #elif defined(HAVE_DL_WINDOWS) && defined(WIN32)
return (void *)GetProcAddress( handle, (MYCHAR*)psz_function ); return (void *)GetProcAddress( handle, (MYCHAR*)psz_function );
#elif defined(HAVE_DL_DLOPEN) #elif defined(HAVE_DL_DLOPEN)
...@@ -1261,7 +1267,7 @@ static void * _module_getsymbol( module_handle_t handle, ...@@ -1261,7 +1267,7 @@ static void * _module_getsymbol( module_handle_t handle,
#endif #endif
} }
#if defined(UNDER_CE) || defined(WIN32) #if defined(HAVE_DL_WINDOWS)
static char * GetWindowsError( void ) static char * GetWindowsError( void )
{ {
#if defined(UNDER_CE) #if defined(UNDER_CE)
...@@ -1305,6 +1311,6 @@ static char * GetWindowsError( void ) ...@@ -1305,6 +1311,6 @@ static char * GetWindowsError( void )
return psz_tmp; return psz_tmp;
#endif #endif
} }
#endif #endif /* HAVE_DL_WINDOWS */
#endif /* HAVE_DYNAMIC_PLUGINS */ #endif /* HAVE_DYNAMIC_PLUGINS */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment