From: Thomas Tanner Date: Wed, 10 Mar 1999 16:16:03 +0000 (+0000) Subject: * configure.in: fix spacing for --disable-ltdl-install, X-Git-Tag: release-1-2f~57 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c7e268df7d01311729fd36d6e477e205d0a9b54c;p=thirdparty%2Flibtool.git * 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) --- diff --git a/ChangeLog b/ChangeLog index 9c51f1702..bf1c6e9ab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +1999-03-10 Thomas Tanner + + * 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 * libltdl/ltdl.c (lt_dlopen): some preprocessors choke if the `#' diff --git a/configure.in b/configure.in index 295598a9b..50756f323 100644 --- a/configure.in +++ b/configure.in @@ -40,20 +40,18 @@ dnl For the `lineno' script (which puts line numbers into `ltconfig'). 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 " diff --git a/libltdl/Makefile.am b/libltdl/Makefile.am index a676d633c..4c2ebd572 100644 --- a/libltdl/Makefile.am +++ b/libltdl/Makefile.am @@ -2,8 +2,6 @@ # AUTOMAKE_OPTIONS = no-dependencies foreign -LTDL_VERSION = -version-info 1:1:1 - if INSTALL_LTDL include_HEADERS = ltdl.h lib_LTLIBRARIES = libltdl.la @@ -16,6 +14,7 @@ noinst_LTLIBRARIES = libltdlc.la endif libltdl_la_SOURCES = ltdl.c +libltdl_la_LDFLAGS = -version-info 1:1:1 libltdl_la_LIBADD = $(LIBADD_DL) libltdlc_la_SOURCES = ltdl.c diff --git a/libltdl/configure.in b/libltdl/configure.in index ed83c4e9e..5b66c1b9a 100644 --- a/libltdl/configure.in +++ b/libltdl/configure.in @@ -3,26 +3,20 @@ dnl Initialize the libltdl package. 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 ( diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c index 8bf16a7cd..7053afb34 100644 --- a/libltdl/ltdl.c +++ b/libltdl/ltdl.c @@ -833,6 +833,8 @@ find_module (handle, dir, libdir, dlname, old_name, installed) 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 */ @@ -842,10 +844,8 @@ find_module (handle, dir, libdir, dlname, old_name, installed) 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; @@ -853,18 +853,16 @@ find_module (handle, dir, libdir, dlname, old_name, installed) 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; @@ -876,16 +874,14 @@ find_module (handle, dir, libdir, dlname, old_name, installed) 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) @@ -893,9 +889,9 @@ find_module (handle, dir, libdir, dlname, old_name, installed) 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; } } @@ -999,23 +995,25 @@ unload_deplibs(handle) } 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 @@ -1092,6 +1090,7 @@ lt_dlopen (filename) 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 @@ -1140,11 +1139,15 @@ lt_dlopen (filename) 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; @@ -1185,6 +1188,7 @@ lt_dlopen (filename) break; } fclose(file); + lt_dlfree(line); /* allocate the handle */ handle = (lt_dlhandle) lt_dlmalloc(sizeof(lt_dlhandle_t)); if (!handle || error) {