From: Peter O'Gorman Date: Tue, 26 Aug 2008 17:42:53 +0000 (-0500) Subject: Allow for extensions other than .a for preloaded modules. X-Git-Tag: v2.2.6~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a05d258b4c1c5acfee449e4ae305ac67bffd6f25;p=thirdparty%2Flibtool.git Allow for extensions other than .a for preloaded modules. * libltdl/m4/ltdl.m4 (_LTDL_SETUP): Define LT_LIBEXT. * libltdl/ltdl.c (lt_dladvise_preload): Use it. Reported by Ralf Wildenhues. --- diff --git a/ChangeLog b/ChangeLog index 48b8e5a95..9a67fd50d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-08-26 Peter O'Gorman + + Allow for extensions other than .a for preloaded modules. + * libltdl/m4/ltdl.m4 (_LTDL_SETUP): Define LT_LIBEXT. + * libltdl/ltdl.c (lt_dladvise_preload): Use it. + Reported by Ralf Wildenhues. + 2008-08-26 Peter O'Gorman , Ralf Wildenhues diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c index 5a2656543..6e19599f8 100644 --- a/libltdl/ltdl.c +++ b/libltdl/ltdl.c @@ -50,6 +50,10 @@ or obtained by writing to the Free Software Foundation, Inc., # define LT_FILENAME_MAX 1024 #endif +#if !defined(LT_LIBEXT) +# define LT_LIBEXT "a" +#endif + /* This is the maximum symbol size that won't require malloc/free */ #undef LT_SYMBOL_LENGTH #define LT_SYMBOL_LENGTH 128 @@ -67,6 +71,7 @@ or obtained by writing to the Free Software Foundation, Inc., static const char objdir[] = LT_OBJDIR; static const char archive_ext[] = LT_ARCHIVE_EXT; +static const char libext[] = LT_LIBEXT; #if defined(LT_MODULE_EXT) static const char shlib_ext[] = LT_MODULE_EXT; #endif @@ -1258,7 +1263,8 @@ try_dlopen (lt_dlhandle *phandle, const char *filename, const char *ext, if (vtable) { - archive_name = MALLOC (char, LT_STRLEN (name) + 3); + /* name + "." + libext + NULL */ + archive_name = MALLOC (char, LT_STRLEN (name) + LT_STRLEN (libext) + 2); *phandle = (lt_dlhandle) lt__zalloc (sizeof (struct lt__handle)); if ((*phandle == NULL) || (archive_name == NULL)) @@ -1270,7 +1276,7 @@ try_dlopen (lt_dlhandle *phandle, const char *filename, const char *ext, /* Preloaded modules are always named according to their old archive name. */ - sprintf (archive_name, "%s.a", name); + sprintf (archive_name, "%s.%s", name, libext); if (tryall_dlopen (&newhandle, archive_name, advise, vtable) == 0) { diff --git a/libltdl/m4/ltdl.m4 b/libltdl/m4/ltdl.m4 index 563889e6b..bac721ee5 100644 --- a/libltdl/m4/ltdl.m4 +++ b/libltdl/m4/ltdl.m4 @@ -413,6 +413,8 @@ AC_CHECK_HEADERS([unistd.h dl.h sys/dl.h dld.h mach-o/dyld.h dirent.h], AC_CHECK_FUNCS([closedir opendir readdir], [], [AC_LIBOBJ([lt__dirent])]) AC_CHECK_FUNCS([strlcat strlcpy], [], [AC_LIBOBJ([lt__strl])]) +AC_DEFINE_UNQUOTED([LT_LIBEXT],["$libext"],[The archive extension]) + name=ltdl LTDLOPEN=`eval "\\$ECHO \"$libname_spec\""` AC_SUBST([LTDLOPEN])