+1999-03-10 Thomas Tanner <tanner@gmx.de>
+
+ * configure.in: fix spacing for --disable-ltdl-install,
+ always configure libltdl, add libltdl/acinclude.m4 to
+ ACINCLUDE_M4_LIST, disable installation of libltdl if necessary
+ * libltdl/Makefile.am: set version info for libltdl.la
+ * libltdl/configure.in: don't check whether
+ enable_ltdl_convenience/install was set so that libltdl
+ can be used as independent package (libltdl.tar.gz) without
+ the need to use --enable-ltdl*
+ * libltdl/ltdl.c: minor cleanups, allocate the line cache
+ dynamically (lt_dlopen)
+
1999-03-10 Alexandre Oliva <oliva@dcc.unicamp.br>
* libltdl/ltdl.c (lt_dlopen): some preprocessors choke if the `#'
AC_PROG_AWK
AC_ARG_ENABLE(ltdl-install,
- [--disable-ltdl-install do not install libltdl])
-if test x"$enable_ltdl_install" != xno; then
- enable_ltdl_install=yes
- ac_configure_args="$ac_configure_args --enable-ltdl-install"
+[ --disable-ltdl-install do not install libltdl])
+if test x"$enable_ltdl_install" = xno; then
+ ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
fi
-dnl Since this is handled by m4, it cannot be made conditional :-(
AC_CONFIG_SUBDIRS(libltdl)
dnl all subdirectories that are configured on demand, but that must be
dnl included in the distribution
-CONF_SUBDIRS="demo mdemo cdemo" # depdemo
+CONF_SUBDIRS="cdemo demo mdemo"
AC_SUBST(CONF_SUBDIRS)
-ACINCLUDE_M4_LIST="${srcdir}/acinclude.m4 "
+ACINCLUDE_M4_LIST="${srcdir}/acinclude.m4 ${srcdir}/libltdl/acinclude.m4 "
DIST_MAKEFILE_LIST=
for dir in $CONF_SUBDIRS; do
ACINCLUDE_M4_LIST="$ACINCLUDE_M4_LIST${srcdir}/$dir/acinclude.m4 "
AC_INIT(ltdl.c)
AM_INIT_AUTOMAKE(libltdl,1.0,-)
AM_CONFIG_HEADER(config.h)
-
AM_MAINTAINER_MODE
-if test -z "$enable_ltdl_install$enable_ltdl_convenience"; then
- AC_MSG_WARN([*** Neither [A""C_LIBLTDL_INSTALLABLE] nor [A""C_LIBLTDL_CONVENIENCE] were used])
- AC_MSG_ERROR([*** in the top-level configure.in; aborting])
-fi
-
-AC_ARG_ENABLE(ltdl-install,
- [--enable-ltdl-install install libltdl])
-
-AM_CONDITIONAL(INSTALL_LTDL, test x"$enable_ltdl_install" != xno)
-AM_CONDITIONAL(CONVENIENCE_LTDL, test x"$enable_ltdl_convenience" != xno)
-
AC_PROG_CC
AC_C_CONST
AC_C_INLINE
AM_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)
+AC_ARG_ENABLE(ltdl-install,
+[ --enable-ltdl-install install libltdl])
+
+AM_CONDITIONAL(INSTALL_LTDL, test x"$enable_ltdl_install" != xno)
+AM_CONDITIONAL(CONVENIENCE_LTDL, test x"$enable_ltdl_convenience" != xno)
+
AC_CACHE_CHECK([which extension is used for shared libraries],
libltdl_cv_shlibext, [dnl
(
const char *old_name;
int installed;
{
+ int error;
+ char *filename;
/* try to open the old library first; if it was dlpreopened,
we want the preopened version of it, even if a dlopenable
module is available */
if (dlname) {
/* try to open the installed module */
if (installed && libdir) {
- int ret;
- char *filename = (char*)
+ filename = (char*)
lt_dlmalloc(strlen(libdir)+1+strlen(dlname)+1);
-
if (!filename) {
last_error = memory_error;
return 1;
strcpy(filename, libdir);
strcat(filename, "/");
strcat(filename, dlname);
- ret = tryall_dlopen(handle, filename) == 0;
+ error = tryall_dlopen(handle, filename) == 0;
lt_dlfree(filename);
- if (ret)
+ if (error)
return 0;
}
/* try to open the not-installed module */
if (!installed) {
- int ret;
- char *filename = (char*)
+ filename = (char*)
lt_dlmalloc((dir ? strlen(dir) : 0)
+ strlen(objdir) + strlen(dlname) + 1);
-
if (!filename) {
last_error = memory_error;
return 1;
strcat(filename, objdir);
strcat(filename, dlname);
- ret = tryall_dlopen(handle, filename) == 0;
+ error = tryall_dlopen(handle, filename) == 0;
lt_dlfree(filename);
- if (ret)
+ if (error)
return 0;
}
- /* hmm, maybe it was moved to another directory.
- Should we really support this? */
+ /* hmm, maybe it was moved to another directory */
{
- int ret;
- char *filename = (char*)
+ filename = (char*)
lt_dlmalloc((dir ? strlen(dir) : 0)
+ strlen(dlname) + 1);
if (dir)
else
*filename = 0;
strcat(filename, dlname);
- ret = tryall_dlopen(handle, filename) == 0;
+ error = tryall_dlopen(handle, filename) == 0;
lt_dlfree(filename);
- if (ret)
+ if (error)
return 0;
}
}
}
static inline int
-trim (dest, s)
+trim (dest, str)
char **dest;
- const char *s;
+ const char *str;
{
+ /* remove the leading and trailing "'" from str
+ and store the result in dest */
char *tmp;
- char *i = strrchr(s, '\'');
- int len = strlen(s);
+ char *end = strrchr(str, '\'');
+ int len = strlen(str);
if (*dest)
lt_dlfree(*dest);
- if (len > 3 && s[0] == '\'') {
- tmp = (char*) lt_dlmalloc(i - s);
+ if (len > 3 && str[0] == '\'') {
+ tmp = (char*) lt_dlmalloc(end - str);
if (!tmp) {
last_error = memory_error;
return 1;
}
- strncpy(tmp, &s[1], (i - s) - 1);
+ strncpy(tmp, &str[1], (end - str) - 1);
tmp[len-3] = '\0';
*dest = tmp;
} else
int i;
char *dlname = 0, *old_name = 0;
char *libdir = 0, *deplibs = 0;
+ char *line;
int error = 0;
/* if we can't find the installed flag, it is probably an
installed libtool archive, produced with an old version
lt_dlfree(dir);
return 0;
}
+ line = (char*) lt_dlmalloc(LTDL_FILENAME_MAX);
+ if (!line) {
+ fclose(file);
+ last_error = memory_error;
+ return 0;
+ }
/* read the .la file */
while (!feof(file)) {
- char line[LTDL_FILENAME_MAX];
-
- if (!fgets(line, sizeof(line), file))
+ if (!fgets(line, LTDL_FILENAME_MAX, file))
break;
if (line[0] == '\n' || line[0] == '#')
continue;
break;
}
fclose(file);
+ lt_dlfree(line);
/* allocate the handle */
handle = (lt_dlhandle) lt_dlmalloc(sizeof(lt_dlhandle_t));
if (!handle || error) {