From dafaba6edd195138a352cd99a96ea45f99b5620a Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Fri, 15 Apr 2005 18:09:48 +0000 Subject: [PATCH] aftermath of build system update git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@7850 67ed7778-7388-44ab-90cf-0a291f65f57c --- CHANGES | 12 +- camlibs/agfa-cl20/agfa_cl20.c | 2 +- camlibs/canon/library.c | 16 +- camlibs/directory/directory.c | 10 +- camlibs/jamcam/jamcam.c | 4 +- camlibs/kodak/ez200/library.c | 4 +- camlibs/panasonic/coolshot/coolshot.c | 4 +- camlibs/panasonic/l859/l859.c | 2 +- libgphoto2/gphoto2-abilities-list.c | 147 +----------------- libgphoto2/gphoto2-camera.c | 35 +---- libgphoto2/gphoto2-version.c | 14 +- .../libgphoto2_port/gphoto2-port-info-list.c | 106 +------------ .../gphoto2-port-portability.h | 17 -- .../libgphoto2_port/gphoto2-port-version.c | 18 +-- .../libgphoto2_port/gphoto2-port.c | 35 +---- 15 files changed, 49 insertions(+), 377 deletions(-) diff --git a/CHANGES b/CHANGES index 98b9106be..78c435045 100644 --- a/CHANGES +++ b/CHANGES @@ -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: diff --git a/camlibs/agfa-cl20/agfa_cl20.c b/camlibs/agfa-cl20/agfa_cl20.c index e7862a77a..1f92f3e1d 100644 --- a/camlibs/agfa-cl20/agfa_cl20.c +++ b/camlibs/agfa-cl20/agfa_cl20.c @@ -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) { diff --git a/camlibs/canon/library.c b/camlibs/canon/library.c index 32ef01ef8..d60d1a9cc 100644 --- a/camlibs/canon/library.c +++ b/camlibs/canon/library.c @@ -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) diff --git a/camlibs/directory/directory.c b/camlibs/directory/directory.c index dfd9ac7f3..1ea3548e8 100644 --- a/camlibs/directory/directory.c +++ b/camlibs/directory/directory.c @@ -27,7 +27,7 @@ #include #include -#ifdef HAVE_EXIF +#ifdef HAVE_LIBEXIF #include #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); } diff --git a/camlibs/jamcam/jamcam.c b/camlibs/jamcam/jamcam.c index 624ec32e8..34280859f 100644 --- a/camlibs/jamcam/jamcam.c +++ b/camlibs/jamcam/jamcam.c @@ -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) { diff --git a/camlibs/kodak/ez200/library.c b/camlibs/kodak/ez200/library.c index 544e01c01..dc2abf01a 100644 --- a/camlibs/kodak/ez200/library.c +++ b/camlibs/kodak/ez200/library.c @@ -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; } diff --git a/camlibs/panasonic/coolshot/coolshot.c b/camlibs/panasonic/coolshot/coolshot.c index 8bcf61230..5c0d817ec 100644 --- a/camlibs/panasonic/coolshot/coolshot.c +++ b/camlibs/panasonic/coolshot/coolshot.c @@ -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) { diff --git a/camlibs/panasonic/l859/l859.c b/camlibs/panasonic/l859/l859.c index b29fb6f25..4765aac4a 100644 --- a/camlibs/panasonic/l859/l859.c +++ b/camlibs/panasonic/l859/l859.c @@ -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"); diff --git a/libgphoto2/gphoto2-abilities-list.c b/libgphoto2/gphoto2-abilities-list.c index 4e489f9bb..126d6e679 100644 --- a/libgphoto2/gphoto2-abilities-list.c +++ b/libgphoto2/gphoto2-abilities-list.c @@ -27,6 +27,8 @@ #ifdef HAVE_LTDL # include +#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); } diff --git a/libgphoto2/gphoto2-camera.c b/libgphoto2/gphoto2-camera.c index 51b5e0280..63b9792ed 100644 --- a/libgphoto2/gphoto2-camera.c +++ b/libgphoto2/gphoto2-camera.c @@ -31,6 +31,8 @@ #ifdef HAVE_LTDL # include +#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); diff --git a/libgphoto2/gphoto2-version.c b/libgphoto2/gphoto2-version.c index 813b8e65a..357154150 100644 --- a/libgphoto2/gphoto2-version.c +++ b/libgphoto2/gphoto2-version.c @@ -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 diff --git a/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c b/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c index 3ce93fd39..6930b3dc8 100644 --- a/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c +++ b/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c @@ -32,6 +32,8 @@ #ifdef HAVE_LTDL #include +#else +#error libltdl required! #endif #include @@ -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); } diff --git a/libgphoto2_port/libgphoto2_port/gphoto2-port-portability.h b/libgphoto2_port/libgphoto2_port/gphoto2-port-portability.h index f9f16558c..24a47464c 100644 --- a/libgphoto2_port/libgphoto2_port/gphoto2-port-portability.h +++ b/libgphoto2_port/libgphoto2_port/gphoto2-port-portability.h @@ -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 * diff --git a/libgphoto2_port/libgphoto2_port/gphoto2-port-version.c b/libgphoto2_port/libgphoto2_port/gphoto2-port-version.c index e4eb3a714..cbb1b1413 100644 --- a/libgphoto2_port/libgphoto2_port/gphoto2-port-version.c +++ b/libgphoto2_port/libgphoto2_port/gphoto2-port-version.c @@ -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 }; diff --git a/libgphoto2_port/libgphoto2_port/gphoto2-port.c b/libgphoto2_port/libgphoto2_port/gphoto2-port.c index df87addc2..6da85378a 100644 --- a/libgphoto2_port/libgphoto2_port/gphoto2-port.c +++ b/libgphoto2_port/libgphoto2_port/gphoto2-port.c @@ -30,6 +30,8 @@ #ifdef HAVE_LTDL #include +#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; }