From 63ef4a1d14dcf5ffe4e38348b129a429c1a48ed6 Mon Sep 17 00:00:00 2001 From: Lutz Mueller Date: Wed, 12 Jun 2002 18:11:43 +0000 Subject: [PATCH] =?UTF-8?q?2002-06-12=20=20Lutz=20M=EF=BF=BDller=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * configure.in: * libgphoto2/gphoto2-camera.c: * libgphoto2/gphoto2-abilities-list.c: Fixes for HAVE_LTDL. Still doesn't work. git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@4636 67ed7778-7388-44ab-90cf-0a291f65f57c --- ChangeLog | 7 +++++ configure.in | 40 ++++++++++++++++------------- libgphoto2/gphoto2-abilities-list.c | 19 +++++++++----- 3 files changed, 42 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index 30c24aa09..e296cea18 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2002-06-12 Lutz Müller + + * configure.in: + * libgphoto2/gphoto2-camera.c: + * libgphoto2/gphoto2-abilities-list.c: Fixes for HAVE_LTDL. Still + doesn't work. + 2002-06-12 Christophe Barbé * libgphoto2_port/m4/documentation.m4: Added --with-doc-formats option and diff --git a/configure.in b/configure.in index f75f09ffe..b8102c76d 100644 --- a/configure.in +++ b/configure.in @@ -113,26 +113,29 @@ dnl there running libtool-1.3. For those, we will need dnl dlopen. Note that on some systems (e.g. FreeBSD) dnl -ldl isn't needed. dnl --------------------------------------------------------------------------- -dnl Commented out for now because lt_dlforeachfile will not do anything if it -dnl has already been called before. -dnl AC_PROG_LIBTOOL -no_libtool=true -dnl AC_CHECK_LIB(ltdl, lt_dlforeachfile, -dnl AC_CHECK_HEADER(ltdl.h, -dnl AC_DEFINE(HAVE_LTDL,,[whether we use libltdl]) -dnl LTDL_LIBS="-lltdl" -dnl no_libtool=false -dnl ) -dnl ) -if $no_libtool; then - AC_CHECK_FUNC(dlopen,, - AC_CHECK_LIB(dl, dlopen, - LTDL_LIBS="-ldl", - AC_ERROR([ +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 +try_ltdl=false +AC_ARG_WITH(ltdl, [ --without-ltdl Don't use ltdl],[ + if test x$withval = xno; then + try_ltdl=false + fi]) +if $try_ltdl; then + AC_CHECK_LIB(ltdl, lt_dlforeachfile,[ + AC_CHECK_HEADER(ltdl.h,[ + AC_DEFINE(HAVE_LTDL,,[whether we use libltdl]) + LTDL_LIBS="-lltdl" + ltdl_msg="yes" + have_ltdl=true])]) +fi +if test x$have_ltdl != "xtrue"; then + AC_CHECK_FUNC(dlopen,,[ + AC_CHECK_LIB(dl, dlopen,[LTDL_LIBS="-ldl"],[AC_ERROR([ *** Could not determine how to handle -*** shared libraries! -]))) +*** shared libraries!])])]) fi AC_SUBST(LTDL_LIBS) @@ -544,4 +547,5 @@ Configuration (libgphoto2): EXIF support: $exif_msg readline support: $rl_msg pthread support: $pthread_msg + Use ltdl.h: $ltdl_msg " diff --git a/libgphoto2/gphoto2-abilities-list.c b/libgphoto2/gphoto2-abilities-list.c index f6e115443..101e0efdc 100644 --- a/libgphoto2/gphoto2-abilities-list.c +++ b/libgphoto2/gphoto2-abilities-list.c @@ -26,7 +26,7 @@ #include #ifdef HAVE_LTDL -#include +# include #endif #include "gphoto2-result.h" @@ -95,7 +95,7 @@ gp_abilities_list_new (CameraAbilitiesList **list) CHECK_MEM (*list = malloc (sizeof (CameraAbilitiesList))); memset (*list, 0, sizeof (CameraAbilitiesList)); -#if HAVE_LTDL +#ifdef HAVE_LTDL lt_dlinit (); #endif @@ -135,7 +135,11 @@ foreach_func (const char *filename, lt_ptr data) { CameraList *list = data; - return (gp_list_append (list, filename, NULL)); + gp_log (GP_LOG_DEBUG, "gphoto2-abilities-list", + "Found '%s'.", filename); + gp_list_append (list, filename, NULL); + + return (0); } #endif @@ -147,29 +151,32 @@ gp_abilities_list_load_dir (CameraAbilitiesList *list, const char *dir, CameraLibraryAbilitiesFunc ab; CameraText text; int x, old_count, new_count; - unsigned int i, n, p; + unsigned int i; const char *filename; #ifdef HAVE_LTDL CameraList flist; - int i, count; + int count; lt_dlhandle lh; #else GP_SYSTEM_DIR d; GP_SYSTEM_DIRENT de; char buf[1024]; void *lh; + unsigned int n, p; #endif CHECK_NULL (list && dir); gp_log (GP_LOG_DEBUG, "gphoto2-abilities-list", "Loading camera libraries in '%s'...", dir); +#ifndef HAVE_LTDL gp_log (GP_LOG_DEBUG, "gphoto2-abilities-list", "Note that failing to load *.a and *.la is NOT an error!"); +#endif #ifdef HAVE_LTDL CHECK_RESULT (gp_list_reset (&flist)); - CHECK_RESULT (lt_dlforeachfile (dir, foreach_func, &flist)); + lt_dlforeachfile (dir, foreach_func, &flist); CHECK_RESULT (count = gp_list_count (&flist)); for (i = 0; i < count; i++) { CHECK_RESULT (gp_list_get_name (&flist, i, &filename));