2002-06-12 Lutz M�ller <lutz@users.sourceforge.net>
* configure.in:
* libgphoto2/gphoto2-abilities-list.c: Make libgphoto2
use ltdl.h. I needed to introduce a global variable - code is
marked as UGLY_HACK. If you know how to fix it, please tell me.
git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@4640 67ed7778-7388-44ab-90cf-0a291f65f57c
This commit is contained in:
@@ -3,6 +3,13 @@
|
||||
* doc/Makefile.am: no more figures link. install only png files for the
|
||||
user manual.
|
||||
|
||||
2002-06-12 Lutz Müller <lutz@users.sourceforge.net>
|
||||
|
||||
* configure.in:
|
||||
* libgphoto2/gphoto2-abilities-list.c: Make libgphoto2
|
||||
use ltdl.h. I needed to introduce a global variable - code is
|
||||
marked as UGLY_HACK. If you know how to fix it, please tell me.
|
||||
|
||||
2002-06-12 Lutz Müller <lutz@users.sourceforge.net>
|
||||
|
||||
* configure.in:
|
||||
|
||||
@@ -115,10 +115,8 @@ dnl -ldl isn't needed.
|
||||
dnl ---------------------------------------------------------------------------
|
||||
AC_PROG_LIBTOOL
|
||||
have_ltdl=false
|
||||
ltdl_msg="no (default)"
|
||||
dnl For now, we don't use ltdl. It just doesn't work. If you want to fix it,
|
||||
dnl email <lutz@users.sourceforge.net>
|
||||
try_ltdl=false
|
||||
ltdl_msg="no"
|
||||
try_ltdl=true
|
||||
AC_ARG_WITH(ltdl, [ --without-ltdl Don't use ltdl],[
|
||||
if test x$withval = xno; then
|
||||
try_ltdl=false
|
||||
|
||||
@@ -95,10 +95,6 @@ gp_abilities_list_new (CameraAbilitiesList **list)
|
||||
CHECK_MEM (*list = malloc (sizeof (CameraAbilitiesList)));
|
||||
memset (*list, 0, sizeof (CameraAbilitiesList));
|
||||
|
||||
#ifdef HAVE_LTDL
|
||||
lt_dlinit ();
|
||||
#endif
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
@@ -122,14 +118,18 @@ gp_abilities_list_free (CameraAbilitiesList *list)
|
||||
|
||||
free (list);
|
||||
|
||||
#ifdef HAVE_LTDL
|
||||
lt_dlexit ();
|
||||
#endif
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
#define UGLY_HACK /* E-mail <lutz@users.sourceforge.net> for infos. */
|
||||
|
||||
#ifdef HAVE_LTDL
|
||||
|
||||
#ifdef UGLY_HACK
|
||||
static unsigned char first;
|
||||
static CameraList backup;
|
||||
#endif
|
||||
|
||||
static int
|
||||
foreach_func (const char *filename, lt_ptr data)
|
||||
{
|
||||
@@ -139,6 +139,14 @@ foreach_func (const char *filename, lt_ptr data)
|
||||
"Found '%s'.", filename);
|
||||
gp_list_append (list, filename, NULL);
|
||||
|
||||
#ifdef UGLY_HACK
|
||||
if (first) {
|
||||
gp_list_reset (&backup);
|
||||
first = 0;
|
||||
}
|
||||
gp_list_append (&backup, filename, NULL);
|
||||
#endif
|
||||
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
@@ -151,7 +159,7 @@ gp_abilities_list_load_dir (CameraAbilitiesList *list, const char *dir,
|
||||
CameraLibraryAbilitiesFunc ab;
|
||||
CameraText text;
|
||||
int x, old_count, new_count;
|
||||
unsigned int i;
|
||||
unsigned int i, p;
|
||||
const char *filename;
|
||||
#ifdef HAVE_LTDL
|
||||
CameraList flist;
|
||||
@@ -162,7 +170,7 @@ gp_abilities_list_load_dir (CameraAbilitiesList *list, const char *dir,
|
||||
GP_SYSTEM_DIRENT de;
|
||||
char buf[1024];
|
||||
void *lh;
|
||||
unsigned int n, p;
|
||||
unsigned int n;
|
||||
#endif
|
||||
|
||||
CHECK_NULL (list && dir);
|
||||
@@ -176,8 +184,26 @@ gp_abilities_list_load_dir (CameraAbilitiesList *list, const char *dir,
|
||||
|
||||
#ifdef HAVE_LTDL
|
||||
CHECK_RESULT (gp_list_reset (&flist));
|
||||
#ifdef UGLY_HACK
|
||||
first = 1;
|
||||
#endif
|
||||
lt_dlinit ();
|
||||
lt_dladdsearchdir (dir);
|
||||
lt_dlforeachfile (dir, foreach_func, &flist);
|
||||
lt_dlexit ();
|
||||
CHECK_RESULT (count = gp_list_count (&flist));
|
||||
#ifdef UGLY_HACK
|
||||
if (!count && (gp_list_count (&backup) > 0))
|
||||
for (i = 0; i < gp_list_count (&backup); i++)
|
||||
if (gp_list_get_name (&backup, i, &filename) >= 0)
|
||||
gp_list_append (&flist, filename, NULL);
|
||||
CHECK_RESULT (count = gp_list_count (&flist));
|
||||
#endif
|
||||
gp_log (GP_LOG_DEBUG, "gp-abilities-list", "Found %i "
|
||||
"camera drivers.", count);
|
||||
lt_dlinit ();
|
||||
p = gp_context_progress_start (context, count,
|
||||
_("Loading camera drivers from '%s'..."), dir);
|
||||
for (i = 0; i < count; i++) {
|
||||
CHECK_RESULT (gp_list_get_name (&flist, i, &filename));
|
||||
lh = lt_dlopenext (filename);
|
||||
@@ -244,8 +270,16 @@ gp_abilities_list_load_dir (CameraAbilitiesList *list, const char *dir,
|
||||
for (x = old_count; x < new_count; x++) {
|
||||
strcpy (list->abilities[x].id, text.text);
|
||||
strcpy (list->abilities[x].library, filename);
|
||||
}
|
||||
}
|
||||
|
||||
gp_context_progress_update (context, p, i);
|
||||
if (gp_context_cancel (context) == GP_CONTEXT_FEEDBACK_CANCEL) {
|
||||
lt_dlexit ();
|
||||
return (GP_ERROR_CANCEL);
|
||||
}
|
||||
}
|
||||
gp_context_progress_stop (context, p);
|
||||
lt_dlexit ();
|
||||
#else
|
||||
|
||||
/* Open the directory */
|
||||
|
||||
@@ -295,6 +295,7 @@ gp_camera_exit (Camera *camera, GPContext *context)
|
||||
if (camera->pc->lh) {
|
||||
#ifdef HAVE_LTDL_H
|
||||
lt_dlclose (camera->pc->lh);
|
||||
lt_dlexit ();
|
||||
#else
|
||||
GP_SYSTEM_DLCLOSE (camera->pc->lh);
|
||||
#endif
|
||||
@@ -326,10 +327,6 @@ gp_camera_new (Camera **camera)
|
||||
return (GP_ERROR_NO_MEMORY);
|
||||
memset (*camera, 0, sizeof (Camera));
|
||||
|
||||
#ifdef HAVE_LTDL
|
||||
lt_dlinit ();
|
||||
#endif
|
||||
|
||||
(*camera)->functions = malloc(sizeof(CameraFunctions));
|
||||
if (!(*camera)->functions) {
|
||||
gp_camera_free (*camera);
|
||||
@@ -609,10 +606,6 @@ gp_camera_free (Camera *camera)
|
||||
|
||||
free (camera);
|
||||
|
||||
#ifdef HAVE_LTDL
|
||||
lt_dlexit ();
|
||||
#endif
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
@@ -717,15 +710,23 @@ gp_camera_init (Camera *camera, GPContext *context)
|
||||
gp_log (GP_LOG_DEBUG, "gphoto2-camera", "Loading '%s'...",
|
||||
camera->pc->a.library);
|
||||
#ifdef HAVE_LTDL
|
||||
lt_dlinit ();
|
||||
camera->pc->lh = lt_dlopenext (camera->pc->a.library);
|
||||
if (!camera->pc->lh) {
|
||||
gp_context_error (context, _("Could not load required "
|
||||
"camera driver '%s' (%s)."), camera->pc->a.library,
|
||||
lt_dlerror ());
|
||||
lt_dlexit ();
|
||||
return (GP_ERROR_LIBRARY);
|
||||
}
|
||||
#else
|
||||
camera->pc->lh = GP_SYSTEM_DLOPEN (camera->pc->a.library);
|
||||
#endif
|
||||
if (!camera->pc->lh) {
|
||||
gp_context_error (context, _("Could not load required "
|
||||
"camera driver '%s'."), camera->pc->a.library);
|
||||
return (GP_ERROR_LIBRARY);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Initialize the camera */
|
||||
#ifdef HAVE_LTDL
|
||||
@@ -736,6 +737,7 @@ gp_camera_init (Camera *camera, GPContext *context)
|
||||
if (!init_func) {
|
||||
#ifdef HAVE_LTDL
|
||||
lt_dlclose (camera->pc->lh);
|
||||
lt_dlexit ();
|
||||
#else
|
||||
GP_SYSTEM_DLCLOSE (camera->pc->lh);
|
||||
#endif
|
||||
@@ -751,6 +753,7 @@ gp_camera_init (Camera *camera, GPContext *context)
|
||||
if (result < 0) {
|
||||
#ifdef HAVE_LTDL
|
||||
lt_dlclose (camera->pc->lh);
|
||||
lt_dlexit ();
|
||||
#else
|
||||
GP_SYSTEM_DLCLOSE (camera->pc->lh);
|
||||
#endif
|
||||
@@ -764,6 +767,7 @@ gp_camera_init (Camera *camera, GPContext *context)
|
||||
gp_port_close (camera->port);
|
||||
#ifdef HAVE_LTDL
|
||||
lt_dlclose (camera->pc->lh);
|
||||
lt_dlexit ();
|
||||
#else
|
||||
GP_SYSTEM_DLCLOSE (camera->pc->lh);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user