aftermath of build system update

git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@7850 67ed7778-7388-44ab-90cf-0a291f65f57c
This commit is contained in:
Hans Ulrich Niedermann
2005-04-15 18:09:48 +00:00
parent 829a542cbc
commit dafaba6edd
15 changed files with 49 additions and 377 deletions

12
CHANGES
View File

@@ -1,5 +1,15 @@
----------------------------------------------------------------------------
libgphoto2 CVS HEAD
libgphoto2 CVS HEAD (2.2)
Build system (packagers beware!):
* now requires libltdl
* works with contemporary build tools
* new ./configure parameter set
----------------------------------------------------------------------------
libgphoto2 2.1.6
General libgphoto2 features:

View File

@@ -115,7 +115,7 @@ camera_abilities (CameraAbilitiesList *list)
char *ptr;
int x = 0;
GP_DEBUG(" * camera_abilities()");
/* GP_DEBUG(" * camera_abilities()"); */
ptr = models[x].model;
while (ptr) {

View File

@@ -98,7 +98,7 @@ extern long int timezone;
*/
int camera_id (CameraText *id)
{
GP_DEBUG ("camera_id()");
/* GP_DEBUG ("camera_id()"); */
strcpy (id->text, "canon");
@@ -157,7 +157,7 @@ camera_abilities (CameraAbilitiesList *list)
int i;
CameraAbilities a;
GP_DEBUG ("camera_abilities()");
/* GP_DEBUG ("camera_abilities()"); */
for (i = 0; models[i].id_str; i++) {
memset (&a, 0, sizeof (a));
@@ -565,7 +565,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
GP_DEBUG (_("%s is a file type for which no thumbnail is provided"),canon_path);
return (GP_ERROR_NOT_SUPPORTED);
}
#ifdef HAVE_EXIF
#ifdef HAVE_LIBEXIF
/* Check if we have libexif, it is a jpeg file
* and it is not a PowerShot Pro 70 (which
* does not support EXIF), return not
@@ -579,7 +579,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
return (GP_ERROR_NOT_SUPPORTED);
}
}
#endif /* HAVE_EXIF */
#endif /* HAVE_LIBEXIF */
if (*thumbname == '\0') {
/* file internal thumbnail */
ret = canon_int_get_thumbnail (camera, canon_path, &data,
@@ -592,7 +592,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
break;
case GP_FILE_TYPE_EXIF:
#ifdef HAVE_EXIF
#ifdef HAVE_LIBEXIF
/* the PowerShot Pro 70 does not support EXIF */
if (camera->pl->md->model == CANON_CLASS_2)
return (GP_ERROR_NOT_SUPPORTED);
@@ -616,7 +616,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
#else
GP_DEBUG ("get_file_func: EXIF file type requested but no libexif");
return (GP_ERROR_NOT_SUPPORTED);
#endif /* HAVE_EXIF */
#endif /* HAVE_LIBEXIF */
break;
default:
@@ -687,12 +687,12 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
gp_file_set_data_and_size (file, data, datalen);
gp_file_set_name (file, filename);
break;
#ifdef HAVE_EXIF
#ifdef HAVE_LIBEXIF
case GP_FILE_TYPE_EXIF:
gp_file_set_mime_type (file, GP_MIME_JPEG);
gp_file_set_data_and_size (file, data, datalen);
break;
#endif /* HAVE_EXIF */
#endif /* HAVE_LIBEXIF */
default:
/* this case should've been caught above anyway */
if (data)

View File

@@ -27,7 +27,7 @@
#include <utime.h>
#include <unistd.h>
#ifdef HAVE_EXIF
#ifdef HAVE_LIBEXIF
#include <libexif/exif-data.h>
#endif
@@ -432,11 +432,11 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
#ifdef DEBUG
unsigned int i, id;
#endif
#ifdef HAVE_EXIF
#ifdef HAVE_LIBEXIF
ExifData *data;
unsigned char *buf;
unsigned int buf_len;
#endif /* HAVE_EXIF */
#endif /* HAVE_LIBEXIF */
if (strlen (folder) == 1)
snprintf (path, sizeof (path), "/%s", filename);
@@ -452,7 +452,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
result = gp_file_open (file, path);
break;
#endif
#ifdef HAVE_EXIF
#ifdef HAVE_LIBEXIF
case GP_FILE_TYPE_EXIF:
data = exif_data_new_from_file (path);
if (!data) {
@@ -464,7 +464,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
exif_data_unref (data);
gp_file_set_data_and_size (file, buf, buf_len);
return (GP_OK);
#endif /* HAVE_EXIF */
#endif /* HAVE_LIBEXIF */
default:
return (GP_ERROR_NOT_SUPPORTED);
}

View File

@@ -68,7 +68,7 @@ static struct {
int camera_id (CameraText *id)
{
GP_DEBUG ("* camera_id");
/* GP_DEBUG ("* camera_id"); */
strcpy (id->text, "jamcam");
@@ -81,7 +81,7 @@ int camera_abilities (CameraAbilitiesList *list)
char *ptr;
CameraAbilities a;
GP_DEBUG ("* camera_abilities");
/* GP_DEBUG ("* camera_abilities"); */
ptr = models[x].model;
while (ptr) {

View File

@@ -76,7 +76,7 @@ camera_abilities (CameraAbilitiesList *list)
int i;
CameraAbilities a;
GP_DEBUG("Begin_Abilities");
/* GP_DEBUG("Begin_Abilities"); */
for (i = 0; models[i].name; i++) {
memset (&a, 0, sizeof(a));
@@ -95,7 +95,7 @@ camera_abilities (CameraAbilitiesList *list)
gp_abilities_list_append (list, a);
}
GP_DEBUG("End_Abilities");
/* GP_DEBUG("End_Abilities"); */
return GP_OK;
}

View File

@@ -68,7 +68,7 @@ struct _CameraPrivateLibrary {
int camera_id (CameraText *id)
{
GP_DEBUG ("* camera_id");
/* GP_DEBUG ("* camera_id"); */
strcpy (id->text, "coolshot");
@@ -81,7 +81,7 @@ int camera_abilities (CameraAbilitiesList *list)
char *ptr;
CameraAbilities a;
GP_DEBUG ("* camera_abilities");
/* GP_DEBUG ("* camera_abilities"); */
ptr = coolshot_cameras[x++];
while (*ptr) {

View File

@@ -340,7 +340,7 @@ static int l859_readimageblock(Camera *camera, int block, char *buffer) {
int camera_id (CameraText *id) {
GP_DEBUG ("Camera ID");
/* GP_DEBUG ("Camera ID"); */
strcpy(id->text, "panasonic-l859");

View File

@@ -27,6 +27,8 @@
#ifdef HAVE_LTDL
# include <ltdl.h>
#else
# error libltdl required!
#endif
#include "gphoto2-result.h"
@@ -120,7 +122,6 @@ gp_abilities_list_free (CameraAbilitiesList *list)
return (GP_OK);
}
#ifdef HAVE_LTDL
static int
foreach_func (const char *filename, lt_ptr data)
@@ -133,7 +134,7 @@ foreach_func (const char *filename, lt_ptr data)
return (0);
}
#endif
static int
gp_abilities_list_load_dir (CameraAbilitiesList *list, const char *dir,
@@ -145,23 +146,14 @@ gp_abilities_list_load_dir (CameraAbilitiesList *list, const char *dir,
int x, old_count, new_count;
unsigned int i, p;
const char *filename;
#ifdef HAVE_LTDL
CameraList *flist;
int count;
lt_dlhandle lh;
#else
GP_SYSTEM_DIR d;
GP_SYSTEM_DIRENT de;
char buf[1024];
void *lh;
unsigned int n;
#endif
CHECK_NULL (list && dir);
#ifdef HAVE_LTDL
gp_log (GP_LOG_DEBUG, "gphoto2-abilities-list",
"Using ltdl to load camera libraries in '%s'...", dir);
"Using ltdl to load camera libraries from '%s'...", dir);
CHECK_RESULT (gp_list_new (&flist));
CHECK_RESULT (gp_list_reset (flist));
lt_dlinit ();
@@ -252,137 +244,6 @@ gp_abilities_list_load_dir (CameraAbilitiesList *list, const char *dir,
gp_context_progress_stop (context, p);
lt_dlexit ();
gp_list_free (flist);
#else
gp_log (GP_LOG_DEBUG, "gphoto2-abilities-list",
"Loading camera libraries in '%s' without ltdl...", dir);
gp_log (GP_LOG_DEBUG, "gphoto2-abilities-list",
"Note that failing to load *.a and *.la is NOT an error!");
/* Open the directory */
d = GP_SYSTEM_OPENDIR (dir);
if (!d) {
gp_log (GP_LOG_ERROR, "gphoto2-abilities-list",
_("Could not open '%s'"), dir);
return GP_ERROR_LIBRARY;
}
/* Count the files */
n = 0;
while (GP_SYSTEM_READDIR (d))
n++;
GP_SYSTEM_CLOSEDIR (d);
d = GP_SYSTEM_OPENDIR (dir);
p = gp_context_progress_start (context, n,
_("Loading camera drivers from '%s'..."), dir);
i = 0;
do {
/* Read each entry */
de = GP_SYSTEM_READDIR (d);
if (de) {
/*
* Tell the frontend about our progress and offer the
* possiblility to cancel.
*/
i++;
gp_context_progress_update (context, p, i);
if (gp_context_cancel (context) ==
GP_CONTEXT_FEEDBACK_CANCEL)
return (GP_ERROR_CANCEL);
/* Construct the full path to the file */
filename = GP_SYSTEM_FILENAME (de);
snprintf (buf, sizeof (buf), "%s%c%s", dir,
GP_SYSTEM_DIR_DELIM, filename);
/* Don't try to open ".*" */
if (filename[0] == '.')
continue;
/* Try to open the library */
gp_log (GP_LOG_DEBUG, "gphoto2-abilities-list",
"Trying to load '%s'...", buf);
lh = GP_SYSTEM_DLOPEN (buf);
if (!lh) {
size_t len;
len = strlen(buf);
if ((len >= 3) &&
(buf[len-1] == 'a') &&
((buf[len-2] == '.') ||
((buf[len-2] == 'l') && (buf[len-3] == '.'))
)) {
/* *.la or *.a - we cannot load these, so no error msg */
} else {
gp_log (GP_LOG_DEBUG, "gphoto2-abilities-list",
"Failed to load '%s': %s.", buf,
GP_SYSTEM_DLERROR ());
}
continue;
}
/* camera_id */
id = GP_SYSTEM_DLSYM (lh, "camera_id");
if (!id) {
gp_log (GP_LOG_DEBUG, "gphoto2-abilities-list",
"Library '%s' does not seem to "
"contain a camera_id function: %s",
buf, GP_SYSTEM_DLERROR ());
GP_SYSTEM_DLCLOSE (lh);
continue;
}
/*
* Make sure the camera driver hasn't been
* loaded yet
*/
if (id (&text) != GP_OK) {
GP_SYSTEM_DLCLOSE (lh);
continue;
}
if (gp_abilities_list_lookup_id (list, text.text) >= 0){
GP_SYSTEM_DLCLOSE (lh);
continue;
}
/* camera_abilities */
ab = GP_SYSTEM_DLSYM (lh, "camera_abilities");
if (!ab) {
gp_log (GP_LOG_DEBUG, "gphoto2-abilities-list",
"Library '%s' does not seem to "
"contain a camera_abilities function: "
"%s", buf, GP_SYSTEM_DLERROR ());
GP_SYSTEM_DLCLOSE (lh);
continue;
}
old_count = gp_abilities_list_count (list);
if (old_count < 0) {
GP_SYSTEM_DLCLOSE (lh);
continue;
}
if (ab (list) != GP_OK) {
GP_SYSTEM_DLCLOSE (lh);
continue;
}
GP_SYSTEM_DLCLOSE (lh);
new_count = gp_abilities_list_count (list);
if (new_count < 0)
continue;
/* Copy in the core-specific information */
for (x = old_count; x < new_count; x++) {
strcpy (list->abilities[x].id, text.text);
strcpy (list->abilities[x].library, buf);
}
}
} while (de);
gp_context_progress_stop (context, p);
#endif
return (GP_OK);
}

View File

@@ -31,6 +31,8 @@
#ifdef HAVE_LTDL
# include <ltdl.h>
#else
# error libltdl required!
#endif
#include "gphoto2-context.h"
@@ -237,11 +239,7 @@ struct _CameraPrivateCore {
CameraAbilities a;
/* Library handle */
#ifdef HAVE_LTDL
lt_dlhandle lh;
#else
void *lh;
#endif
char error[2048];
@@ -306,12 +304,8 @@ gp_camera_exit (Camera *camera, GPContext *context)
memset (camera->functions, 0, sizeof (CameraFunctions));
if (camera->pc->lh) {
#ifdef HAVE_LTDL_H
lt_dlclose (camera->pc->lh);
lt_dlexit ();
#else
GP_SYSTEM_DLCLOSE (camera->pc->lh);
#endif
camera->pc->lh = NULL;
}
@@ -727,7 +721,6 @@ gp_camera_init (Camera *camera, GPContext *context)
/* Load the library. */
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) {
@@ -737,28 +730,12 @@ gp_camera_init (Camera *camera, GPContext *context)
lt_dlexit ();
return (GP_ERROR_LIBRARY);
}
#else
camera->pc->lh = GP_SYSTEM_DLOPEN (camera->pc->a.library);
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
init_func = lt_dlsym (camera->pc->lh, "camera_init");
#else
init_func = GP_SYSTEM_DLSYM (camera->pc->lh, "camera_init");
#endif
if (!init_func) {
#ifdef HAVE_LTDL
lt_dlclose (camera->pc->lh);
lt_dlexit ();
#else
GP_SYSTEM_DLCLOSE (camera->pc->lh);
#endif
camera->pc->lh = NULL;
gp_context_error (context, _("Camera driver '%s' is "
"missing the 'camera_init' function."),
@@ -769,12 +746,8 @@ gp_camera_init (Camera *camera, GPContext *context)
if (strcasecmp (camera->pc->a.model, "Directory Browse")) {
result = gp_port_open (camera->port);
if (result < 0) {
#ifdef HAVE_LTDL
lt_dlclose (camera->pc->lh);
lt_dlexit ();
#else
GP_SYSTEM_DLCLOSE (camera->pc->lh);
#endif
camera->pc->lh = NULL;
return (result);
}
@@ -783,12 +756,8 @@ gp_camera_init (Camera *camera, GPContext *context)
result = init_func (camera, context);
if (result < 0) {
gp_port_close (camera->port);
#ifdef HAVE_LTDL
lt_dlclose (camera->pc->lh);
lt_dlexit ();
#else
GP_SYSTEM_DLCLOSE (camera->pc->lh);
#endif
camera->pc->lh = NULL;
memset (camera->functions, 0, sizeof (CameraFunctions));
return (result);

View File

@@ -36,16 +36,11 @@ const char **gp_library_version(GPVersionVerbosity verbose)
#else
"unknown cc",
#endif
#ifdef HAVE_EXIF
#ifdef HAVE_LIBEXIF
"EXIF",
#else
"no EXIF",
#endif
#ifdef HAVE_LTDL
"ltdl",
#else
"no ltdl",
#endif
#ifdef HAVE_PROCMEMINFO
"/proc/meminfo",
#else
@@ -61,16 +56,11 @@ const char **gp_library_version(GPVersionVerbosity verbose)
#else
"unknown (C compiler used)",
#endif
#ifdef HAVE_EXIF
#ifdef HAVE_LIBEXIF
"EXIF (for special handling of EXIF files)",
#else
"no EXIF (for special handling of EXIF files)",
#endif
#ifdef HAVE_LTDL
"ltdl (hopefully with non-buggy libltdl :-)",
#else
"no ltdl (working around buggy libltdl, eh? :-)",
#endif
#ifdef HAVE_PROCMEMINFO
"/proc/meminfo (adapts cache size to memory available)",
#else

View File

@@ -32,6 +32,8 @@
#ifdef HAVE_LTDL
#include <ltdl.h>
#else
#error libltdl required!
#endif
#include <gphoto2-port-result.h>
@@ -163,7 +165,6 @@ gp_port_info_list_append (GPPortInfoList *list, GPPortInfo info)
return (list->count - 1 - generic);
}
#ifdef HAVE_LTDL
static int
foreach_func (const char *filename, lt_ptr data)
@@ -227,7 +228,6 @@ foreach_func (const char *filename, lt_ptr data)
return (0);
}
#endif
/**
* gp_port_info_list_load:
@@ -243,22 +243,9 @@ int
gp_port_info_list_load (GPPortInfoList *list)
{
int result;
#ifndef HAVE_LTDL
int i;
GPPortLibraryType lib_type;
GPPortLibraryList lib_list;
GPPortType type;
unsigned int old_size = list->count;
GP_SYSTEM_DIR d;
GP_SYSTEM_DIRENT de;
char path[1024];
void *lh;
const char *filename;
#endif
CHECK_NULL (list);
#ifdef HAVE_LTDL
gp_log (GP_LOG_DEBUG, "gphoto2-port-info-list", _("Using ltdl to load io-drivers "
"from '%s'..."),IOLIBS);
lt_dlinit ();
@@ -268,95 +255,6 @@ gp_port_info_list_load (GPPortInfoList *list)
if (result < 0)
return (result);
#else
gp_log (GP_LOG_DEBUG, "gphoto2-port-info-list", _("Loading io-drivers "
"from '%s' without ltdl..."),IOLIBS);
d = GP_SYSTEM_OPENDIR (IOLIBS);
if (!d) {
gp_log (GP_LOG_ERROR, "gphoto2-port-info-list",
_("Could not load any io-library because '%s' could "
"not be opened (%m)"), IOLIBS);
return (GP_ERROR_LIBRARY);
}
do {
de = GP_SYSTEM_READDIR (d);
if (!de)
break;
filename = GP_SYSTEM_FILENAME (de);
if (filename[0] == '.')
continue;
#if defined(OS2) || defined(WIN32)
snprintf (path, sizeof (path), "%s\\%s", IOLIBS, filename);
#else
snprintf (path, sizeof (path), "%s/%s", IOLIBS, filename);
#endif
lh = GP_SYSTEM_DLOPEN (path);
if (!lh) {
size_t len;
len = strlen(path);
if ((len >= 3) &&
(path[len-1] == 'a') &&
((path[len-2] == '.') ||
((path[len-2] == 'l') && (path[len-3] == '.'))
)) {
/* *.la or *.a - we cannot load these, so no error msg */
} else {
gp_log (GP_LOG_DEBUG, "gphoto2-port-info-list",
_("'%s' is not a library (%s)"), path,
GP_SYSTEM_DLERROR ());
}
continue;
}
lib_type = GP_SYSTEM_DLSYM (lh, "gp_port_library_type");
lib_list = GP_SYSTEM_DLSYM (lh, "gp_port_library_list");
if (!lib_type || !lib_list) {
gp_log (GP_LOG_DEBUG, "gphoto2-port-info-list",
_("Could not find some functions in '%s' (%s)"),
path, GP_SYSTEM_DLERROR ());
GP_SYSTEM_DLCLOSE (lh);
continue;
}
type = lib_type ();
for (i = 0; i < list->count; i++)
if (list->info[i].type == type)
break;
if (i != list->count) {
gp_log (GP_LOG_DEBUG, "gphoto2-port-info-list",
_("'%s' already loaded"), path);
GP_SYSTEM_DLCLOSE (lh);
continue;
}
result = lib_list (list);
if (result < 0) {
gp_log (GP_LOG_DEBUG, "gphoto2-port-info-list",
_("Could not load list (%s)"),
gp_port_result_as_string (result));
GP_SYSTEM_DLCLOSE (lh);
continue;
}
for (i = old_size; i < list->count; i++){
gp_log (GP_LOG_DEBUG, "gphoto2-port-info-list",
_("Loaded '%s' (%s) from '%s'"),
list->info[i].name, list->info[i].path,
filename);
strcpy (list->info[i].library_filename, path);
}
old_size = list->count;
GP_SYSTEM_DLCLOSE (lh);
} while (1);
GP_SYSTEM_CLOSEDIR (d);
#endif
return (GP_OK);
}

View File

@@ -32,12 +32,6 @@ typedef struct {
/* Sleep functionality */
#define GP_SYSTEM_SLEEP(_ms) Sleep(_ms)
/* Dynamic library functions */
#define GP_SYSTEM_DLOPEN(_filename) LoadLibrary(_filename)
#define GP_SYSTEM_DLSYM(_handle, _funcname) GetProcAddress(_handle, _funcname)
#define GP_SYSTEM_DLCLOSE(_handle) FreeLibrary(_handle)
#define GP_SYSTEM_DLERROR() "Windows Error"
/* Directory-oriented functions */
#define GP_SYSTEM_DIR GPPORTWINDIR *
#define GP_SYSTEM_DIRENT WIN32_FIND_DATA *
@@ -61,17 +55,6 @@ typedef struct {
/* Sleep functionality */
#define GP_SYSTEM_SLEEP(_ms) usleep((_ms)*1000)
/* Dynamic library functions */
#define GP_SYSTEM_DLOPEN(_filename) dlopen(_filename, RTLD_LAZY)
#if defined(__APPLE__) && !defined(HAVE_LTDL)
/* Darwin prepends underscores to symbols, but not with ltdl. */
#define GP_SYSTEM_DLSYM(_handle, _funcname) dlsym(_handle, "_" _funcname)
#else
#define GP_SYSTEM_DLSYM(_handle, _funcname) dlsym(_handle, _funcname)
#endif
#define GP_SYSTEM_DLCLOSE(_handle) dlclose(_handle)
#define GP_SYSTEM_DLERROR() dlerror()
/* Directory-oriented functions */
#define GP_SYSTEM_DIR DIR *
#define GP_SYSTEM_DIRENT struct dirent *

View File

@@ -35,7 +35,7 @@ const char **gp_port_library_version(GPVersionVerbosity verbose)
#else
"unknown cc",
#endif
#ifdef HAVE_USB
#ifdef HAVE_LIBUSB
"USB",
#else
"no USB",
@@ -57,11 +57,6 @@ const char **gp_port_library_version(GPVersionVerbosity verbose)
#else
"no serial",
#endif
#ifdef HAVE_LTDL
"ltdl",
#else
"no ltdl",
#endif
NULL
};
@@ -73,8 +68,10 @@ const char **gp_port_library_version(GPVersionVerbosity verbose)
#else
"unknown (C compiler used)",
#endif
#ifdef HAVE_USB
"USB (for USB cameras)",
#ifdef HAVE_LIBUSB_WIN32
"USB (libusb-win32, for USB cameras)",
#elif defined(HAVE_LIBUSB)
"USB (libusb, for USB cameras)",
#else
"no USB (for USB cameras)",
#endif
@@ -102,11 +99,6 @@ const char **gp_port_library_version(GPVersionVerbosity verbose)
"lockdev (serial port locking)",
#else
"no lockdev (serial port locking)",
#endif
#ifdef HAVE_LTDL
"ltdl (hopefully with non-buggy libltdl :-)",
#else
"no ltdl (working around buggy libltdl, eh? :-)",
#endif
NULL
};

View File

@@ -30,6 +30,8 @@
#ifdef HAVE_LTDL
#include <ltdl.h>
#else
#error libltdl required!
#endif
#include "gphoto2-port-result.h"
@@ -66,11 +68,7 @@ struct _GPPortPrivateCore {
GPPortInfo info;
GPPortOperations *ops;
#ifdef HAVE_LTDL
lt_dlhandle lh;
#else
void *lh; /* Library handle */
#endif
};
/**
@@ -156,15 +154,10 @@ gp_port_set_info (GPPort *port, GPPortInfo info)
port->pc->ops = NULL;
}
if (port->pc->lh) {
#ifdef HAVE_LTDL
lt_dlclose (port->pc->lh);
lt_dlexit ();
#else
GP_SYSTEM_DLCLOSE (port->pc->lh);
#endif
}
#ifdef HAVE_LTDL
lt_dlinit ();
port->pc->lh = lt_dlopenext (info.library_filename);
if (!port->pc->lh) {
@@ -174,35 +167,15 @@ gp_port_set_info (GPPort *port, GPPortInfo info)
lt_dlexit ();
return (GP_ERROR_LIBRARY);
}
#else
port->pc->lh = GP_SYSTEM_DLOPEN (info.library_filename);
if (!port->pc->lh) {
gp_log (GP_LOG_ERROR, "gphoto2-port", _("Could not load "
"'%s' ('%s')"), info.library_filename,
GP_SYSTEM_DLERROR ());
return (GP_ERROR_LIBRARY);
}
#endif
/* Load the operations */
#ifdef HAVE_LTDL
ops_func = lt_dlsym (port->pc->lh, "gp_port_library_operations");
#else
ops_func = GP_SYSTEM_DLSYM (port->pc->lh, "gp_port_library_operations");
#endif
if (!ops_func) {
#ifdef HAVE_LTDL
gp_log (GP_LOG_ERROR, "gphoto2-port", _("Could not find "
"'gp_port_library_operations' in '%s' ('%s')"),
info.library_filename, lt_dlerror ());
lt_dlclose (port->pc->lh);
lt_dlexit ();
#else
gp_log (GP_LOG_ERROR, "gphoto2-port", _("Could not find "
"'gp_port_library_operations' in '%s' ('%s')"),
info.library_filename, GP_SYSTEM_DLERROR ());
GP_SYSTEM_DLCLOSE (port->pc->lh);
#endif
port->pc->lh = NULL;
return (GP_ERROR_LIBRARY);
}
@@ -333,12 +306,8 @@ gp_port_free (GPPort *port)
}
if (port->pc->lh) {
#ifdef HAVE_LTDL
lt_dlclose (port->pc->lh);
lt_dlexit ();
#else
GP_SYSTEM_DLCLOSE (port->pc->lh);
#endif
port->pc->lh = NULL;
}