diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | ChangeLog.2009 | 189 | ||||
-rw-r--r-- | Makefile.am | 4 | ||||
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | doc/libtool.texi | 159 | ||||
-rw-r--r-- | libltdl/config/ltmain.m4sh | 221 | ||||
-rw-r--r-- | libltdl/m4/libtool.m4 | 351 | ||||
-rw-r--r-- | tests/archive-in-archive.at | 12 | ||||
-rw-r--r-- | tests/duplicate_conv.at | 4 | ||||
-rw-r--r-- | tests/exeext.at | 53 | ||||
-rw-r--r-- | tests/export.at | 30 | ||||
-rw-r--r-- | tests/link-order.at | 20 | ||||
-rw-r--r-- | tests/nocase.at | 82 | ||||
-rw-r--r-- | tests/static.at | 2 | ||||
-rw-r--r-- | tests/stresstest.at | 49 |
15 files changed, 1081 insertions, 100 deletions
@@ -10,6 +10,7 @@ *.lo *.log *.o +*.obj *.pg *.toc *.tp diff --git a/ChangeLog.2009 b/ChangeLog.2009 index 0a43ab4f..d7d84ac5 100644 --- a/ChangeLog.2009 +++ b/ChangeLog.2009 @@ -874,6 +874,195 @@ not time, for really fresh files. Add sleep 1 call at yet another strategic position. Makes the test pass reliably for MSYS/MinGW. +2009-01-13 Peter Rosin <peda@lysator.liu.se> + + * libltdl/config/ltmain.m4sh (func_mode_ar): New function + implementing new libtool --mode=ar. + (func_mode_help): Describe new ar mode. + * libltdl/m4/libtool.m4 (_LT_PROG_AR): Don't AC_SUBST AR_SEP + and AR_TFLAGS since they are no longer needed outside the + libtool script. Instead AC_SUBST LT_AR and LT_ARFLAGS and set + them so that libtool --mode=ar is invoked if the archiver is + "strange". + * Makefile.am: Don't export AR_SEP to the testsuite, instead + export LT_AR and LT_ARFLAGS. + * tests/archive-in-archive.at: Use "$LT_AR t " instead of + "$AR $AR_TFLAGS$AR_SEP". + * doc/libtool.texi: Document new mode. + +2009-01-13 Peter Rosin <peda@lysator.liu.se> + + * libltdl/m4/libtool.m4 (_LT_LINKER_SHLIBS) + [ cygwin, mingw, cegcc ] <cl*>: @OUTPUT@ may or may not + include a trailing $EXEEXT. If mt fails, make sure libtool + exits with an error. + (_LT_LANG_CXX_CONFIG): Likewise. + * tests/exeext.at: New. Make sure linking with both -o prog + and -o prog$EXEEXT works. + * Makefile.am: Add previous test to testsuite. + +2009-01-13 Peter Rosin <peda@lysator.liu.se> + + * doc/libtool.texi (libtool script contents): Document + new variables introduced by the MSVC port. + +2009-01-13 Peter Rosin <peda@lysator.liu.se> + + * libltdl/m4/libtool.m4 (_LT_LINKER_SHLIBS) + [cygwin, mingw, pw32, cegcc] <cl*>: Indicate that reloadable + objects does not work. + * tests/duplicate_conv.at: Skip last test if reloadable + objects does not work. + * doc/libtool.texi (libtool script contents): Document how to + indicate that reloadable objects do not work. + +2009-01-13 Peter Rosin <peda@lysator.liu.se> + + * .gitignore: Ignore *.obj files for MSVC (and w32). + +2009-01-13 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> + + * libltdl/m4/libtool.m4 (LT_PATH_NM): Move setting of + nm_file_list_spec ... + (_LT_CMD_GLOBAL_SYMBOLS): ... here. Also enable for GNU nm if + supported. + + * tests/static.at (ccache -all-static): Ignore compiler stderr. + Reported by Peter Rosin. + +2009-01-13 Peter Rosin <peda@lysator.liu.se> + + * tests/stresstest.at [MSVC]: dllimport all imported + variables. + +2009-01-13 Peter Rosin <peda@lysator.liu.se> + + * tests/stresstest.at: Link with main.lo when liba is shared + and linking main with -no-install. + +2009-01-13 Peter Rosin <peda@lysator.liu.se> + + * tests/link-order.at [MSVC]: Always dllimport exported + variables. + +2009-01-13 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> + + * libltdl/m4/libtool.m4 (_LT_PROG_AR, LT_PATH_NM): Fix bogus + uses of _LT_TAGVAR. Hide `ar' error message escape from command + line. + +2009-01-13 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> + Peter Rosin <peda@lysator.liu.se> + + Support for response files with $NM. + * libltdl/m4/libtool.m4 (_LT_LINKER_SHLIBS) <nm_file_list_spec>: + New tag variable. + [ cygwin, mingw, cegcc ] <cl*>: Set to '@'. + (_LT_LANG_CXX_CONFIG): Likewise. + * libltdl/config/ltmain.m4sh (func_mode_link): When + nm_file_list_spec is nonempty, use it to avoid skipped_export. + +2009-01-13 Peter Rosin <peda@lysator.liu.se> + + * libltdl/m4/libtool.m4 (_LT_LINKER_SHLIBS) <postlink_cmds>: + New tag variable. + [ cygwin, mingw, cegcc ] <cl*>: Embed the manifest file as a + resource. + (_LT_LANG_CXX_CONFIG): Likewise. + * libltdl/config/ltmain.m4sh (func_mode_link): After linking + a program, replace @OUTPUT@ in $postlink_cmds and then execute + the commands. + +2009-01-13 Peter Rosin <peda@lysator.liu.se> + + * libltdl/m4/libtool.m4 (_LT_CHECK_MAGIC_METHOD): Disable nocase + handling for cross compiles. + +2009-01-13 Peter Rosin <peda@lysator.liu.se> + + * tests/export.at [MSVC]: dllimport all imported variables. + +2009-01-13 Peter Rosin <peda@lysator.liu.se> + + Add MSVC support. + * libltdl/m4/libtool.m4: Add support for Microsoft Visual C. + * NEWS: Add note of the above. + +2009-01-13 Peter Rosin <peda@lysator.liu.se> + + Allow the use of a file listing file if the archiver supports + it. Add hint so that the Microsoft lib archiver uses the file + listing feature. + * libltdl/m4/libtool.m4 (_LT_PROG_AR): Indicate if the + archiver supports a listing file with the new variable + archiver_list_spec. + * libltdl/config/ltmain.m4sh: If the archiver supports + a listing file, use it when max_cmd_len is exceeded. + +2009-01-13 Peter Rosin <peda@lysator.liu.se> + + MSVC doesn't support the -l option, instead it expects the exact + library file name. Retain the -l option as long as possible as + libtool recognizes -l internally. Then, as late as possible + transform the -l option to an exact file name (-lfoo -> + foo.lib). + * libltdl/m4/libtool.m4: Add tag variable dashl_xform which + specifies how to transform -l options for the linker. + * libltdl/config/ltmain.m4sh (func_mode_link): Transform -l + options using dashl_xform right before creating the + program or library. + +2009-01-13 Peter Rosin <peda@lysator.liu.se> + + MSVC needs a hint to force it to compile either as C or C++. + * libltdl/m4/libtool.m4: Add tag variable compile_tag to + enable tag specific compiler options that are bad in the + linking phase. + * libltdl/config/ltmain.m4sh: Add the tag specific options + to the compile command line. + +2009-01-13 Peter Rosin <peda@lysator.liu.se> + + The MSVC linker doesn't have a -L option, and doesn't understand + posix paths. Move paths to an envvar with a prefix (-LIBPATH:). + * libltdl/m4/libtool.m4: Add new tag variables to specify + to what variable (dashL_envvar) -L options should be moved, + and what to prepend to the -L path (dashL_envvar_spec). + * libltdl/config/ltmain.m4sh (func_dashL_to_envvar): New + function that moves -L options to a variable. + * libltdl/config/ltmain.m4sh (func_mode_link): Prior to + linking, call above function if dashL_envvar is set. + +2009-01-13 Peter Rosin <peda@lysator.liu.se> + + On Windows, find potential libs regardless of file name case. + * libltdl/m4/libtool.m4 (_LT_CHECK_MAGIC_METHOD), + libltdl/config/ltmain.m4sh (func_mode_link): On Windows, + find potential libs regardless of file name case. + * tests/nocase.at: New test, to check for regressions + of the above. + * Makefile.am: Add above new test. + +2009-01-13 Peter Rosin <peda@lysator.liu.se> + + Allow Microsoft lib to be used as the archiver. + * libltdl/m4/libtool.m4 (_LT_PROG_AR): New macro, detect the + interface used by the archiver. In particular, add the AR_SEP + variable to allow archivers that does not allow a space between + the options to create an archive and the archive name and the + ar_extract_one_by_one variable which indicates if the archiver + can extract all members in one go. + * libltdl/m4/libtool.m4: Add $AR_SEP between $AR_FLAGS and the + archive file name in all $AR commands. + * libltdl/config/ltmain.m4sh (func_extract_an_archive): Add support + for archivers that only supports extracting one member at a time + and otherwise adjust to the above libtool.m4 changes. Also, add + $AR_SEP to the $AR invocations. + * Makefile.am: Pass AR, AR_FLAGS and AR_SEP through to the + testsuite. + * tests/archive-in-archive.at: Extract archive name from the .la + file instead of hardcoding the name, and allow different archivers. + Continued in ChangeLog.2008 vim:tw=72 diff --git a/Makefile.am b/Makefile.am index a7de46d5..9a9ecfa0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -468,12 +468,14 @@ TESTSUITE_AT = tests/testsuite.at \ tests/search-path.at \ tests/indirect_deps.at \ tests/archive-in-archive.at \ + tests/exeext.at \ tests/execute-mode.at \ tests/bindir.at \ tests/cwrapper.at \ tests/deplib-in-subdir.at \ tests/infer-tag.at \ tests/localization.at \ + tests/nocase.at \ tests/install.at \ tests/versioning.at \ tests/destdir.at \ @@ -513,6 +515,8 @@ EXTRA_DIST += $(srcdir)/$(TESTSUITE) $(TESTSUITE_AT) $(srcdir)/tests/package TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \ CPP="$(CPP)" CPPFLAGS="$(CPPFLAGS)" LD="$(LD)" LDFLAGS="$(LDFLAGS)" \ LIBS="$(LIBS)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \ + AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" \ + LT_AR="$(LT_AR)" LT_ARFLAGS="$(LT_ARFLAGS)" \ STRIP="$(STRIP)" lt_INSTALL="$(INSTALL)" \ OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)" \ SHELL="$(SHELL)" CONFIG_SHELL="$(SHELL)" \ @@ -8,6 +8,10 @@ New in 2.2.9b 2010-??-??: git version 2.2.9a, Libtool team: format path recorded in $libdir of a pseudo-library when looking up the location of the library with the native tools. +* Changes in supported systems or compilers: + + - Initial support for Microsoft Visual C w/o wrapper scripts. + New in 2.2.8 2010-06-05: git version 2.2.7c, Libtool team: * No new features: diff --git a/doc/libtool.texi b/doc/libtool.texi index 051aec34..c0005186 100644 --- a/doc/libtool.texi +++ b/doc/libtool.texi @@ -134,6 +134,7 @@ Invoking @code{libtool} * Finish mode:: Completing a library installation. * Uninstall mode:: Removing installed executables and libraries. * Clean mode:: Removing uninstalled executables and libraries. +* Archive mode:: Portably handle archives. Integrating libtool with your package @@ -1334,6 +1335,7 @@ by programs libtool invokes, rather than libtool itself. * Finish mode:: Completing a library installation. * Uninstall mode:: Removing installed executables and libraries. * Clean mode:: Removing uninstalled executables and libraries. +* Archive mode:: Portably handle archives. @end menu @node Compile mode @@ -1755,6 +1757,64 @@ files (typically @command{/bin/rm}). The remaining @var{mode-args} are either flags for the deletion program (beginning with a @samp{-}), or the names of files to delete. +@node Archive mode +@section Archive mode +@cindex archive mode +@cindex mode, archive + +@dfn{Archive} mode lets you handle archives portably on systems where +the archiver is weird. As an example, the Microsoft LIB.EXE archiver +expects @command{lib -OUT:example.lib some.obj objects.obj}, which is +impossible to fit into the variables @var{AR} and @var{AR_FLAGS} (note +that there is no space between @samp{-OUT:} and @file{example.lib}). +Also, many expect to be able to extract archives with @command{$AR x} +and list archive content with @command{$AR t}. Again using Microsoft +LIB.EXE as an example, archive extraction and listing do not always +work like that (@command{lib -EXTRACT:example.lib} and +@command{lib -LIST example.lib} respectively, note the absent colon +in the listing command). + +Libtool presents the archiver with a limited but common interface + +@var{mode-args} consist of an archiver command, an archive to operate +on and possibly a set of object files. + +The possible archiver command are + +@table @option +@item cru @file{archive-file} @file{object-file}@dots{} +Creates an archive. + +@example +ms$ @kbd{libtool --mode=ar cru example.lib some.obj objects.obj} +libtool: ar: lib -NOLOGO -OUT:example.lib some.obj objects.obj +ms$ +@end example + +@item x @file{archive-file} +Extracts an archive. + +@example +ms$ @kbd{libtool --mode=ar x example.lib} +libtool: ar: (cd . && lib -NOLOGO -EXTRACT:some.obj "example.lib") +libtool: ar: (cd . && lib -NOLOGO -EXTRACT:objects.obj "example.lib") +ms$ +@end example + +@item t @file{archive-file} +Lists the contents of an archive. The libtool option @option{--quiet} is +useful here, to avoid the first disgnostic line. + +@example +ms$ @kbd{libtool --mode=ar x example.lib} +libtool: ar: lib -NOLOGO -LIST example.lib +some.obj +objects.obj +ms$ +@end example + +@end table + @node Integrating libtool @chapter Integrating libtool with your package @@ -5755,7 +5815,7 @@ in cases where it is necessary. @node Archivers @subsection Archivers -On all known systems, building a static library can be accomplished by +On all sane systems, building a static library can be accomplished by running @kbd{ar cru lib@var{name}.a @var{obj1}.o @var{obj2}.o @dots{}}, where the @samp{.a} file is the output library, and each @samp{.o} file is an object file. @@ -5765,6 +5825,17 @@ must be used to ``bless'' the created library before linking against it, with the @kbd{ranlib lib@var{name}.a} command. Some systems, like Irix, use the @code{ar ts} command, instead. +On some not so sane systems (e.g. Windows with MSYS but w/o MinGW @code{ar} +and instead the Microsoft archiver LIB.EXE), @code{ar cru} obviously does +not work. Because of those systems, it is more portable to use +@code{libtool --mode=ar cru} instead. If you only want to go through the +libtool script when it is needed, use @code{$(LT_AR) $(LT_ARFLAGS)} in +Makefile.in, and configure will do the right thing. + +On some systems, it is required that you add more flags, e.g. 64-bit AIX +which needs @code{ar -X64 cru}. Or everything might just be named +differently, e.g some prefer @code{CC -ar -o} on Irix. + @node libtool script contents @section @code{libtool} script contents @cindex implementation of libtool @@ -5798,6 +5869,23 @@ are used within @code{ltmain.sh} (@pxref{Configuring}): The name of the system library archiver. @end defvar +@defvar AR_FLAGS +Flags to create an archive. +@end defvar + +@defvar AR_TFLAGS +Flags to list archive content. +@end defvar + +@defvar AR_XFLAGS +Flags to extract files (or a single file, see @var{ar_extract_one_by_one}) +from an archive. +@end defvar + +@defvar AR_SEP +Separator between @var{AR} flags (e.g. @var{AR_TFLAGS}) and @var{AR} files. +@end defvar + @defvar CC The name of the compiler used to configure libtool. This will always contain the compiler for the current language (@pxref{Tags}). @@ -5863,6 +5951,13 @@ using @var{export_symbols_cmds} before linking an archive. Set to @samp{yes} or @samp{no}. Default is @samp{no}. @end defvar +@defvar ar_extract_one_by_one +Extract archive members one by one as listed by @var{AR} using the +option @var{AR_TFLAGS} in case the archiver does not support +extracting all archive members with the @var{AR_XFLAGS} option. +Normally @samp{no}, enable with @samp{yes}. +@end defvar + @defvar archive_cmds @defvarx archive_expsym_cmds @defvarx old_archive_cmds @@ -5893,6 +5988,10 @@ Set to @samp{yes} if the extraction of a static library requires locking the library file. This is required on Darwin. @end defvar +@defvar archiver_list_spec +How to feed a file listing to the archiver. +@end defvar + @defvar build @defvarx build_alias @defvarx build_os @@ -5910,6 +6009,11 @@ Whether libtool should build static libraries on this system. Set to @samp{yes} or @samp{no}. @end defvar +@defvar compile_tag +Add tag specific option for the compiler. Normally disabled (i.e. +@var{compile_tag} is empty). +@end defvar + @defvar compiler_c_o Whether the compiler supports the @option{-c} and @option{-o} options simultaneously. Set to @samp{yes} or @samp{no}. @@ -5922,6 +6026,26 @@ convenience archives or a set of object file names can be passed via linker-specific options or linker scripts. @end defvar +@defvar dashL_envvar +When linking, move all paths specified with @option{-L} options to +this variable, for toolchains where it makes sense to pass the library +search paths in an environment variable. Normally disabled (i.e. +@var{dashL_envvar} empty). +@end defvar + +@defvar dashL_envvar_spec +When moving library search paths with @var{dashL_envvar}, prepend this +to each @option{-L} path that is added to @var{dashL_envvar}. Unused +if @var{dashL_envvar} is empty. +@end defvar + +@defvar dashl_xform +@code{sed} expression for transforming -l options for the linker. The +input to the @code{sed} instance is the original argument to the +@option{-l} option, the output is fed as an arguments to the linker. +Normally disabled (i.e. @var{dashl_xform} empty). +@end defvar + @defvar dlopen_support Whether @code{dlopen} is supported on the platform. Set to @samp{yes} or @samp{no}. @@ -5981,6 +6105,16 @@ and relinking at install time is triggered. This also means that @var{DESTDIR} installation does not work as expected. @end defvar +@defvar file_magic_glob +How to find potential files when @var{deplibs_check_method} is +@samp{file_magic}. @var{file_magic_glob} is a @code{sed} expression, +and the @code{sed} instance is fed potential files, that is +transformed by the @var{file_magic_glob} expression. Useful when the +shell does not support the shell option @code{nocaseglob}, making +@var{want_nocaseglob} inappropriate. Normally disabled (i.e. +@var{file_magic_glob} empty). +@end defvar + @defvar finish_cmds Commands to tell the dynamic linker how to find shared libraries in a specific directory. @@ -6156,6 +6290,10 @@ Whether files must be locked to prevent conflicts when compiling simultaneously. Set to @samp{yes} or @samp{no}. @end defvar +@defvar nm_file_list_spec +Specify filename containing input files for @var{NM}. +@end defvar + @defvar no_builtin_flag Compiler flag to disable builtin functions that conflict with declaring external global symbols as @code{char}. @@ -6189,9 +6327,19 @@ Commands run after installing a shared or static library, respectively. Commands run after uninstalling a shared or static library, respectively. @end defvar +@defvar postlink_cmds +Commands necessary for finishing linking programs. @var{postlink_cmds} +are executed immediately after the program is linked. Any occurance of +the string @code{@@OUTPUT@@} in @var{postlink_cmds} is replaced by the +name of the created executable (i.e. not the wrapper, if a wrapper is +generated) prior to execution. Normally disabled (i.e. +@var{postlink_cmds} empty). +@end defvar + @defvar reload_cmds @defvarx reload_flag -Commands to create a reloadable object. +Commands to create a reloadable object. Set @var{reload_cmds} to +@samp{false} on systems that cannot create reloadable objects. @end defvar @defvar runpath_var @@ -6252,6 +6400,13 @@ The library version numbering type. One of @samp{libtool}, @samp{osf}, @samp{sunos}, @samp{windows}, or @samp{none}. @end defvar +@defvar want_nocaseglob +Find potential files using the shell option @code{nocaseglob} when +@var{deplibs_check_method} is @samp{file_magic}. Normally set to +@samp{no}, set to @samp{yes} to enable the @code{nocaseglob} shell +option when looking for potential files. +@end defvar + @defvar whole_archive_flag_spec Compiler flag to generate shared objects from convenience archives. @end defvar diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh index 9e6646fa..8e9d963b 100644 --- a/libltdl/config/ltmain.m4sh +++ b/libltdl/config/ltmain.m4sh @@ -51,6 +51,7 @@ m4_divert_push([SCRIPT])# @configure_input@ # # MODE must be one of the following: # +# ar handle archives # clean remove files from the build directory # compile compile a source file into a libtool object # execute automatically set library path, then run a program @@ -250,6 +251,9 @@ func_enable_tag () # Shorthand for --mode=foo, only valid as the first argument case $1 in + ar|a) + shift; set dummy --mode ar ${1+"$@"}; shift + ;; clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; @@ -299,6 +303,7 @@ func_enable_tag () --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break case $1 in # Valid mode arguments: + ar) ;; clean) ;; compile) ;; execute) ;; @@ -629,6 +634,36 @@ func_infer_tag () } +# func_dashL_to_envvar deplibs_variable deplibs... +func_dashL_to_envvar () +{ + deplibs_variable=$1 + shift + tmp_libs= + for deplib; do + case $deplib in + -L*) + func_stripname '-L' '' "$deplib" + env_path=$func_stripname_result + case $host_os in + mingw*) + env_path=`cmd \\\\/C echo "$env_path " | $SED -e 's/"\(.*\) " *$/\1/'` + ;; + cygwin*) + env_path=`cygpath -w "$env_path"` + ;; + esac + eval $dashL_envvar="\"\$$dashL_envvar $dashL_envvar_spec$env_path\"" + ;; + *) + tmp_libs="$tmp_libs $deplib" + ;; + esac + done + eval $deplibs_variable="\"$tmp_libs\"" +} + + # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), @@ -855,6 +890,10 @@ func_mode_compile () pic_mode=default fi + if test -n "$compile_tag"; then + base_compile="$base_compile $compile_tag" + fi + # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then @@ -1028,6 +1067,22 @@ func_mode_help () func_help ;; + ar) + $ECHO \ +"Usage: $progname [OPTION]... --mode=ar COMMAND ARCHIVE [OBJECT...] + +Create and extract files from archives. + +This mode accepts the following archiver COMMANDs: + + cru create the ARCHIVE, consisting of the given OBJECTs. + x extract the ARCHIVE + t list the ARCHIVE content + +Note that this mode is not for creating static libtool libraries, it is +a compatibility layer for \"weird\" archivers." + ;; + clean) $ECHO \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... @@ -2229,19 +2284,20 @@ func_extract_an_archive () $opt_debug f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" - if test "$lock_old_archive_extraction" = yes; then - lockfile=$f_ex_an_ar_oldlib.lock - until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do - func_echo "Waiting for $lockfile to be removed" - sleep 2 + if test "X$ar_extract_one_by_one" != "Xyes"; then + func_show_eval "(cd \$f_ex_an_ar_dir && $AR ${AR_XFLAGS}${AR_SEP}\"\$f_ex_an_ar_oldlib\")" \ + 'stat=$?; rm -f "$lockfile"; exit $stat' + else + $AR ${AR_TFLAGS}${AR_SEP}"$f_ex_an_ar_oldlib" | while read name + do + func_show_eval "(cd \$f_ex_an_ar_dir && $AR ${AR_XFLAGS}${AR_SEP}\$name \"\$f_ex_an_ar_oldlib\")" \ + 'stat=$?; rm -f "$lockfile"; exit $stat' done fi - func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ - 'stat=$?; rm -f "$lockfile"; exit $stat' if test "$lock_old_archive_extraction" = yes; then $opt_dry_run || rm -f "$lockfile" fi - if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + if ($AR ${AR_TFLAGS}${AR_SEP}"$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" @@ -5768,6 +5824,13 @@ func_mode_link () *) tmp_libs="$tmp_libs $deplib" ;; esac ;; + -l*) + if test -n "$dashl_xform" -a "$linkmode" = prog; then + func_stripname '-l' '' "$deplib" + deplib=`func_echo_all "$func_stripname_result" | $SED -e $dashl_xform` + fi + tmp_libs="$tmp_libs $deplib" + ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done @@ -6379,8 +6442,20 @@ EOF fi if test -n "$a_deplib" ; then libname=`eval "\\$ECHO \"$libname_spec\""` + if test -n "$file_magic_glob"; then + libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob` + else + libnameglob=$libname + fi + test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + if test "$want_nocaseglob" = yes; then + shopt -s nocaseglob + potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` + $nocaseglob + else + potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` + fi for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | @@ -6403,6 +6478,9 @@ EOF if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then + if test -n "$dashl_xform"; then + a_deplib=`func_echo_all "$name" | $SED -e $dashl_xform` + fi newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 @@ -6733,14 +6811,30 @@ EOF $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do + for cmd1 in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" + eval cmd=\"$cmd1\" func_len " $cmd" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then func_show_eval "$cmd" 'exit $?' skipped_export=false + elif test -n "$nm_file_list_spec"; then + output_la=`$ECHO "X$output" | $Xsed -e "$basename"` + save_libobjs=$libobjs + save_output=$output + output=${output_objdir}/${output_la}.nm + libobjs=$nm_file_list_spec$output + delfiles="$delfiles $output" + func_verbose "creating $NM input file list: $output" + for obj in $save_libobjs; do + $ECHO "$obj" + done > "$output" + eval cmd=\"$cmd1\" + func_show_eval "$cmd" 'exit $?' + output=$save_output + libobjs=$save_libobjs + skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." @@ -7065,6 +7159,19 @@ EOF test "X$libobjs" = "X " && libobjs= fi + case $pass/$dashL_envvar in + link/) ;; + link/*) + # Move all -L options to the environment variable + # specified by $dashL_envvar. + eval save_dashL_envvar="\"\$$dashL_envvar\"" + eval cmds=\"\$cmds~$dashL_envvar="$save_dashL_envvar"\" + + func_dashL_to_envvar deplibs $deplibs + export $dashL_envvar + ;; + esac + save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" @@ -7293,6 +7400,25 @@ EOF compile_deplibs="$new_libs" + case $pass/$dashL_envvar in + link/) ;; + link/*) + # Move all -L options to the environment variable + # specified by $dashL_envvar. + eval save_dashL_envvar="\"\$$dashL_envvar\"" + + func_dashL_to_envvar compile_deplibs $compile_deplibs + eval prepend_dashL_envvar="$dashL_envvar=\\\"\$$dashL_envvar\\\"" + compile_command="$prepend_dashL_envvar $compile_command" + eval $dashL_envvar="\"$save_dashL_envvar\"" + + func_dashL_to_envvar finalize_deplibs $finalize_deplibs + eval prepend_dashL_envvar="$dashL_envvar=\\\"\$$dashL_envvar\\\"" + finalize_command="$prepend_dashL_envvar $finalize_command" + eval $dashL_envvar="\"$save_dashL_envvar\"" + ;; + esac + compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" @@ -7434,6 +7560,11 @@ EOF exit_status=0 func_show_eval "$link_command" 'exit_status=$?' + if test -n "$postlink_cmds"; then + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' @@ -7479,6 +7610,12 @@ EOF $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + exit $EXIT_SUCCESS fi @@ -7512,6 +7649,11 @@ EOF func_show_eval "$link_command" 'exit $?' + if test -n "$postlink_cmds"; then + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + # Now create the wrapper script. func_verbose "creating $output" @@ -7688,6 +7830,15 @@ EOF len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds + elif test -n "$archiver_list_spec"; then + func_verbose "using command file archive linking..." + for obj in $oldobjs; do + $ECHO \""$obj"\" + done > $output_objdir/$libname.libcmd + save_oldobjs="$oldobjs" + oldobjs=" $archiver_list_spec$output_objdir/$libname.libcmd" + eval cmds=\"\$old_archive_cmds\" + oldobjs="$save_oldobjs" else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." @@ -8105,6 +8256,54 @@ func_mode_uninstall () { test "$mode" = uninstall || test "$mode" = clean; } && func_mode_uninstall ${1+"$@"} + +# func_mode_ar arg... +func_mode_ar () +{ + $opt_debug + ar_action="$nonopt" + archive= + files= + + for arg + do + if test -z "$archive"; then + archive=$arg + else + files="$files $arg" + fi + done + + test -z "$archive" && \ + func_fatal_help "you must specify an archive" + + case "$ar_action" in + cru) + test -z "$files" && \ + func_fatal_help "you must specify some objects" + func_show_eval "$AR $AR_FLAGS$AR_SEP$archive $files" 'exit $?' + ;; + x) + if test "x$ar_extract_one_by_one" = xyes; then + func_extract_an_archive . "$archive" + exit $? + else + func_show_eval "$AR $AR_XFLAGS$AR_SEP$archive" 'exit $?' + fi + ;; + t) + func_show_eval "$AR $AR_TFLAGS$AR_SEP$archive" 'exit $?' + ;; + *) + func_fatal_help "bad archive action, either cru, x or t" + ;; + esac + + exit $EXIT_SUCCESS +} + +test "$mode" = ar && func_mode_ar ${1+"$@"} + test -z "$mode" && { help="$generic_help" func_fatal_help "you must specify a MODE" diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4 index 22924a86..f15830d1 100644 --- a/libltdl/m4/libtool.m4 +++ b/libltdl/m4/libtool.m4 @@ -1311,14 +1311,78 @@ need_locks="$enable_libtool_lock" ])# _LT_ENABLE_LOCK +# _LT_PROG_AR +# ----------- +m4_defun([_LT_PROG_AR], +[AC_CHECK_TOOLS(AR, [ar lib "link -lib"], false) +: ${AR=ar} +_LT_DECL([], [AR], [1], [The archiver]) + +AC_CACHE_CHECK([the archiver ($AR) interface],[lt_cv_ar_interface], + [lt_cv_ar_interface="ar" + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval "$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext" >conftest.err 2>&1) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + test $ac_status = 0 && test -f conftest.lib && lt_cv_ar_interface="lib" + rm -f conftest*]) + +case $lt_cv_ar_interface in +ar) + : ${AR_FLAGS=cru} + : ${AR_TFLAGS=t} + : ${AR_XFLAGS=x} + test -z "$AR_SEP" && AR_SEP=' ' + ar_extract_one_by_one=no + archiver_list_spec= + ;; +lib) + : ${AR_FLAGS="-NOLOGO -OUT:"} + : ${AR_TFLAGS="-NOLOGO -LIST "} + : ${AR_XFLAGS="-NOLOGO -EXTRACT:"} + test -z "$AR_SEP" && AR_SEP='' + ar_extract_one_by_one=yes + archiver_list_spec='@' + # Don't use ranlib + : ${RANLIB=:} + ;; +esac + +if test -n "$AR_SEP" && + test "X$AR_TFLAGS" = Xt && + test "X$AR_XFLAGS" = Xx && + test "$ar_extract_one_by_one" = no +then + LT_AR='$(AR)' + LT_ARFLAGS='$(AR_FLAGS)' +else + LT_AR='$(SHELL) $(abs_top_builddir)/libtool --quiet --mode=ar' + LT_ARFLAGS=cru +fi + +_LT_DECL([], [ar_extract_one_by_one], [1], + [Extract archive members one by one]) +_LT_DECL([], [archiver_list_spec], [1], + [How to feed a file listing to the archiver]) + +_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) +_LT_DECL([], [AR_TFLAGS], [1], [Flags to list archive content]) +_LT_DECL([], [AR_XFLAGS], [1], [Flags to extract an archive]) +_LT_DECL([], [AR_SEP], [1], [Separator between AR flags and AR files]) +AC_SUBST([LT_AR]) +AC_SUBST([LT_ARFLAGS]) +AC_SUBST([AR]) +AC_SUBST([AR_FLAGS]) +])# LT_PROG_AR + + # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], -[AC_CHECK_TOOL(AR, ar, false) -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -_LT_DECL([], [AR], [1], [The archiver]) -_LT_DECL([], [AR_FLAGS], [1]) +[_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: @@ -1330,7 +1394,7 @@ _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_archive_cmds='$AR $AR_FLAGS$AR_SEP$oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= @@ -2201,8 +2265,9 @@ cygwin* | mingw* | pw32* | cegcc*) need_version=no need_lib_prefix=no - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) + case $GCC,$cc_basename in + yes,* | yes,* | yes,*) + # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ @@ -2235,13 +2300,42 @@ m4_if([$1], [],[ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}.lib' + sys_lib_search_path_spec="$LIB" + if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' ;; *) + # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' + dynamic_linker='Win32 ld.exe' ;; esac - dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; @@ -2945,6 +3039,11 @@ case $reload_flag in esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + if test "$GCC" != yes; then + reload_cmds=false + fi + ;; darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' @@ -3163,6 +3262,21 @@ tpf*) ;; esac ]) + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + cygwin* | mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` + fi + ;; + esac +fi + file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown @@ -3171,6 +3285,10 @@ _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method == "file_magic"]) +_LT_DECL([], [file_magic_glob], [1], + [How to find potential files when deplibs_check_method == "file_magic"]) +_LT_DECL([], [want_nocaseglob], [1], + [Find potential files using nocaseglob when deplibs_check_method == "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD @@ -3547,6 +3665,13 @@ else AC_MSG_RESULT(ok) fi +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], @@ -3557,6 +3682,8 @@ _LT_DECL([global_symbol_to_c_name_address], _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) +_LT_DECL([], [nm_file_list_spec], [1], + [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS @@ -4229,13 +4356,18 @@ m4_if([$1], [CXX], [ ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" - ;; + ;; cygwin* | mingw* | cegcc*) - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' - ;; + case $cc_basename in + cl*) ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac + ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; + ;; esac _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] ], [ @@ -4379,7 +4511,7 @@ _LT_EOF _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS$AR_SEP$lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; @@ -4609,7 +4741,7 @@ _LT_EOF aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes - _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS$AR_SEP$lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes @@ -4746,7 +4878,7 @@ _LT_EOF fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS$AR_SEP$output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; @@ -4759,7 +4891,7 @@ _LT_EOF _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS$AR_SEP$lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; @@ -4775,20 +4907,68 @@ _LT_EOF # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' - # FIXME: Should let the user specify the lib program. - _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' - _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + case $cc_basename in + cl*) + # Native MSVC + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -link -dll~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs @$output_objdir/$soname.exp -link -DLL~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + case $host_os in + # Not needed on MinGW + cygwin*) _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' ;; + esac + _LT_TAGVAR(dashL_envvar, $1)=LINK + _LT_TAGVAR(dashL_envvar_spec, $1)='-LIBPATH:' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(compile_tag, $1)=-TC + _LT_TAGVAR(dashl_xform, $1)='s/\(.*\)/\1.lib/' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + case "$lt_outputfile" in + *.[[eE][xX][eE]]) ;; + *) lt_outputfile="$lt_outputfile.exe" ;; + esac~ + if test -e "$lt_outputfile.manifest"; then + mt -manifest "$lt_outputfile.manifest" -outputresource:"$lt_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' + _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + esac ;; darwin* | rhapsody*) @@ -5323,8 +5503,18 @@ _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) +_LT_TAGDECL([], [postlink_cmds], [2], + [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) +_LT_TAGDECL([], [dashL_envvar], [1], + [When linking, move all paths specified with -L options to this variable]) +_LT_TAGDECL([], [dashL_envvar_spec], [1], + [When moving paths with dashL_envvar, prepend this to each path]) +_LT_TAGDECL([], [compile_tag], [1], + [Add tag specific option for the compiler]) +_LT_TAGDECL([], [dashl_xform], [1], + [Transform -l options for the linker]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) @@ -5693,7 +5883,7 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared # libraries. - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS$AR_SEP$output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; @@ -5719,29 +5909,78 @@ if test "$_lt_caught_CXX_error" != yes; then ;; cygwin* | mingw* | pw32* | cegcc*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; + case $GXX,$cc_basename in + ,cl* | no,cl*) + # Native MSVC + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -link -dll~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs @$output_objdir/$soname.exp -link -DLL~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + case $host_os in + # Not needed on MinGW + cygwin*) _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' ;; + esac + _LT_TAGVAR(dashL_envvar, $1)=LINK + _LT_TAGVAR(dashL_envvar_spec, $1)='-LIBPATH:' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(compile_tag, $1)=-TP + _LT_TAGVAR(dashl_xform, $1)='s/\(.*\)/\1.lib/' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + case "$lt_outputfile" in + *.[[eE][xX][eE]]) ;; + *) lt_outputfile="$lt_outputfile.exe" ;; + esac~ + if test -e "$lt_outputfile.manifest"; then + mt -manifest "$lt_outputfile.manifest" -outputresource:"$lt_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # g++ + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; @@ -6007,7 +6246,7 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ - $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ + $AR $AR_FLAGS$AR_SEP$oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ diff --git a/tests/archive-in-archive.at b/tests/archive-in-archive.at index a57dfdd9..551e254b 100644 --- a/tests/archive-in-archive.at +++ b/tests/archive-in-archive.at @@ -42,11 +42,15 @@ $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o bar.lo bar.c $LIBTOOL --mode=link --tag=CC --tag=disable-shared $CC $CFLAGS $LDFLAGS \ -o libfoo.la foo.lo -version-info 1:0:0 -rpath $thisdir $LIBTOOL --mode=install cp libfoo.la $thisdir +eval `$EGREP '^(old_library)=' < libfoo.la` +libfoo=$old_library AT_CHECK([$LIBTOOL --mode=link --tag=CC --tag=disable-shared $CC $CFLAGS $LDFLAGS \ - -o libbar.la bar.lo ./libfoo.a -version-info 1:0:0 -rpath $thisdir], + -o libbar.la bar.lo $libfoo -version-info 1:0:0 -rpath $thisdir], [], [ignore], [ignore]) AT_CHECK([$LIBTOOL --mode=install cp libbar.la $thisdir], [], [ignore], [ignore]) -AT_CHECK([ar -t libbar.a | grep libfoo.a],[1],[ignore],[ignore]) -archive_contents=`ar -t libbar.a` -AT_XFAIL_IF([case "$archive_contents" in *"libfoo.a"*) : ;; esac]) +eval `$EGREP '^(old_library)=' < libbar.la` +libbar=$old_library +AT_CHECK([$LT_AR t $libbar | grep $libfoo],[1],[ignore],[ignore]) +archive_contents=`$LT_AR t $libbar` +AT_XFAIL_IF([case "$archive_contents" in *"$libfoo"*) : ;; esac]) AT_CLEANUP diff --git a/tests/duplicate_conv.at b/tests/duplicate_conv.at index 83d51447..77496d0e 100644 --- a/tests/duplicate_conv.at +++ b/tests/duplicate_conv.at @@ -25,6 +25,8 @@ AT_SETUP([duplicate convenience archive names]) AT_KEYWORDS([libtool]) +eval `$LIBTOOL --config | sed -n '/^reload_cmds=/,/^$/p'` + # We create two convenience archives with the same name, and _also_ # containing an object with the same name. This is necessary to detect # the failure with both 1.5.22 and HEAD, since the latter does not (did @@ -75,6 +77,8 @@ AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT LT_AT_EXEC_CHECK([./main],[0],[ignore],[ignore]) $LIBTOOL --mode=clean rm -f libcee.la +AT_CHECK([test "x$reload_cmds" = xfalse && exit 77], [1]) + # Test whether this works with reloadable objects as well. AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o cee.$OBJEXT c.lo a/liba.la b/liba.la], [0], [ignore], [ignore]) diff --git a/tests/exeext.at b/tests/exeext.at new file mode 100644 index 00000000..30a9e4f4 --- /dev/null +++ b/tests/exeext.at @@ -0,0 +1,53 @@ +# exeext.at -- ensure that exeext handling works -*- Autotest -*- +# +# Copyright (C) 2008 Free Software Foundation, Inc. +# Written by Peter Rosin, 2008 +# +# This file is part of GNU Libtool. +# +# GNU Libtool is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# GNU Libtool is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, +# or obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +#### + + +AT_SETUP([both of -o prog and -o prog$EXEEXT work]) +AT_KEYWORDS([libtool]) + +AT_CHECK([test -n "$EXEEXT" || exit 77]) + +bin=`pwd`/bin +binext=`pwd`/binext +mkdir src $bin srcext $binext + +AT_DATA(src/prog.c, +[[ +int main(void) { return 0; } +]]) + +$CC $CPPFLAGS $CFLAGS -c src/prog.c -o src/prog.$OBJEXT + +AT_CHECK($LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o src/prog src/prog.$OBJEXT, + [0], [ignore], [ignore]) +AT_CHECK($LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o srcext/prog$EXEEXT src/prog.$OBJEXT, + [0], [ignore], [ignore]) + +$LIBTOOL --mode=install cp src/prog $bin/prog +$LIBTOOL --mode=install cp srcext/prog$EXEEXT $binext/prog$EXEEXT + +LT_AT_EXEC_CHECK([$bin/prog]) +LT_AT_EXEC_CHECK([$binext/prog$EXEEXT]) + +AT_CLEANUP diff --git a/tests/export.at b/tests/export.at index a330d407..39adfbc3 100644 --- a/tests/export.at +++ b/tests/export.at @@ -93,32 +93,48 @@ v15 AT_DATA(main.c, [[ +/* w32 fun. With GCC, you can have auto-import, which will work for + * functions and non-const variables. With MSVC, you have to explicitly + * import all variables. Depending on the amount of portability, you + * need these annotations: LIBA_SCOPE for GCC, and also LIBA_SCOPE_VAR + * for MSVC. Of course you can merge both to one, this test only avoids + * that in order to expose the auto-import feature on Cygwin. + * + * For users, it's best to realize that they should not provide any + * non-function API at all. + */ #if defined(LIBA_DLL_IMPORT) # if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) # define LIBA_SCOPE extern __declspec(dllimport) +# if defined(_MSC_VER) +# define LIBA_SCOPE_VAR LIBA_SCOPE +# endif # endif #endif #if !defined(LIBA_SCOPE) # define LIBA_SCOPE extern #endif +#if !defined(LIBA_SCOPE_VAR) +# define LIBA_SCOPE_VAR extern +#endif #ifdef __cplusplus extern "C" { #endif -extern int v1; -extern int v3, v4; +LIBA_SCOPE_VAR int v1; +LIBA_SCOPE_VAR int v3, v4; LIBA_SCOPE const int v5, v6; -extern const char* v7; -extern const char v8[]; +LIBA_SCOPE_VAR const char* v7; +LIBA_SCOPE_VAR const char v8[]; extern int v9(void); -extern int (*v10) (void); -extern int (*v11) (void); +LIBA_SCOPE_VAR int (*v10) (void); +LIBA_SCOPE_VAR int (*v11) (void); LIBA_SCOPE int (*const v12) (void); #ifdef __cplusplus } #endif typedef struct { int arr[1000]; } large; -extern large v13, v14, v15; +LIBA_SCOPE_VAR large v13, v14, v15; int main (void) { diff --git a/tests/link-order.at b/tests/link-order.at index 0122a45e..829e549b 100644 --- a/tests/link-order.at +++ b/tests/link-order.at @@ -48,13 +48,29 @@ for i in old new; do mkdir src cat >src/a_$i.c <<EOF -extern int c; +/* w32 fun, MSVC supports dllimport even if importing is not needed (static + * case). gnu has auto import. + */ +#ifdef _MSC_VER +# define LIBCEE_SCOPE __declspec(dllimport) +#else +# define LIBCEE_SCOPE extern +#endif +LIBCEE_SCOPE int c; extern int b_$i(); int a_$i() { return c + b_$i(); } EOF cat >src/b_$i.c <<EOF -extern int c; +/* w32 fun, MSVC supports dllimport even if importing is not needed (static + * case). gnu has auto import. + */ +#ifdef _MSC_VER +# define LIBCEE_SCOPE __declspec(dllimport) +#else +# define LIBCEE_SCOPE extern +#endif +LIBCEE_SCOPE int c; int b_$i() { return 1 + c; } EOF diff --git a/tests/nocase.at b/tests/nocase.at new file mode 100644 index 00000000..3627a8fe --- /dev/null +++ b/tests/nocase.at @@ -0,0 +1,82 @@ +# nocase.at -- test for nocase lib search -*- Autotest -*- +# +# Copyright (C) 2007 Free Software Foundation, Inc. +# Written by Peter Rosin, 2007 +# +# This file is part of GNU Libtool. +# +# GNU Libtool is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# GNU Libtool is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, +# or obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +#### + + +AT_SETUP([nocase library search]) +AT_KEYWORDS([libtool]) + +eval `$LIBTOOL --config | $EGREP '^(want_nocaseglob|file_magic_glob)='` + +AT_CHECK([test "$want_nocaseglob" != yes && ]dnl + [test -z "$file_magic_glob" && exit 77], + [1], [ignore], [ignore]) + +mkdir foo +AT_DATA([foo/Foo.c], +[ +int Foo(void) { return 1; } +]) + +mkdir bar +AT_DATA([bar/bar.c], +[ +extern int Foo(void); +int bar(void) { return Foo(); } +]) + +AT_DATA([main.c], +[ +extern int bar(void); +int main(void) { return bar(); } +]) + +libdir=`pwd`/inst/lib +mkdir inst inst/bin inst/lib + +$LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o foo/Foo.lo foo/Foo.c +AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o foo/libFoo.la foo/Foo.lo ]dnl + [-no-undefined -version-info 1:0:0 -rpath $libdir], + [], [ignore], [ignore]) +AT_CHECK([$LIBTOOL --mode=install cp foo/libFoo.la $libdir], + [], [ignore], [ignore]) + +rm -f $libdir/libFoo.la + +$LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o bar/bar.lo bar/bar.c +AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o bar/libbar.la bar/bar.lo ]dnl + [-L$libdir -lfoo -no-undefined -version-info 1:0:0 -rpath $libdir], + [], [ignore], [ignore]) +AT_CHECK([$LIBTOOL --mode=install cp bar/libbar.la $libdir], + [], [ignore], [ignore]) + +eval `$EGREP '^(old_library)=' < $libdir/libbar.la` +libbar=$old_library +rm -f $libdir/$libbar + +$LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o main.$OBJEXT main.c + +AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main main.$OBJEXT -L$libdir -lbar], + [], [ignore], [ignore]) + +AT_CLEANUP diff --git a/tests/static.at b/tests/static.at index f59b1242..dfa4c42c 100644 --- a/tests/static.at +++ b/tests/static.at @@ -371,7 +371,7 @@ AT_DATA([a.c], [[int main(void) { return 0; } ]]) -AT_CHECK([$CC $CPPFLAGS $CFLAGS -c a.c], [], [ignore]) +AT_CHECK([$CC $CPPFLAGS $CFLAGS -c a.c], [], [ignore], [ignore]) AT_CHECK([$LIBTOOL --mode=link --tag=CC ./ccache $CC $CFLAGS $LDFLAGS -all-static a.$OBJEXT -o a$EXEEXT], [], [ignore], [ignore]) diff --git a/tests/stresstest.at b/tests/stresstest.at index ee5fd293..e71d492d 100644 --- a/tests/stresstest.at +++ b/tests/stresstest.at @@ -93,29 +93,35 @@ AT_DATA(main.c, #if defined(LIBA_DLL_IMPORT) # if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) # define LIBA_SCOPE extern __declspec(dllimport) +# if defined(_MSC_VER) +# define LIBA_SCOPE_VAR LIBA_SCOPE +# endif # endif #endif #if !defined(LIBA_SCOPE) # define LIBA_SCOPE extern #endif +#if !defined(LIBA_SCOPE_VAR) +# define LIBA_SCOPE_VAR extern +#endif #ifdef __cplusplus extern "C" { #endif -extern int v1; -extern int v3, v4; +LIBA_SCOPE_VAR int v1; +LIBA_SCOPE_VAR int v3, v4; LIBA_SCOPE const int v5, v6; -extern const char* v7; -extern const char v8[]; +LIBA_SCOPE_VAR const char* v7; +LIBA_SCOPE_VAR const char v8[]; extern int v9(void); -extern int (*v10) (void); -extern int (*v11) (void); +LIBA_SCOPE_VAR int (*v10) (void); +LIBA_SCOPE_VAR int (*v11) (void); LIBA_SCOPE int (*const v12) (void); #ifdef __cplusplus } #endif typedef struct { int arr[1000]; } large; -extern large v13, v14, v15; +LIBA_SCOPE_VAR large v13, v14, v15; int main(void) { @@ -131,26 +137,32 @@ AT_DATA(dlself.c, #if defined(LIBA_DLL_IMPORT) # if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) # define LIBA_SCOPE extern __declspec(dllimport) +# if defined(_MSC_VER) +# define LIBA_SCOPE_VAR LIBA_SCOPE +# endif # endif #endif #if !defined(LIBA_SCOPE) # define LIBA_SCOPE extern #endif +#if !defined(LIBA_SCOPE_VAR) +# define LIBA_SCOPE_VAR extern +#endif #ifdef __cplusplus extern "C" { #endif -extern int v1; -extern int v3, v4; +LIBA_SCOPE_VAR int v1; +LIBA_SCOPE_VAR int v3, v4; LIBA_SCOPE const int v5, v6; -extern const char* v7; -extern const char v8[]; +LIBA_SCOPE_VAR const char* v7; +LIBA_SCOPE_VAR const char v8[]; extern int v9(void); -extern int (*v10) (void); -extern int (*v11) (void); +LIBA_SCOPE_VAR int (*v10) (void); +LIBA_SCOPE_VAR int (*v11) (void); LIBA_SCOPE int (*const v12) (void); typedef struct { int arr[1000]; } large; -extern large v13, v14, v15; +LIBA_SCOPE_VAR large v13, v14, v15; extern int w1; extern int w3, w4; @@ -252,9 +264,12 @@ do [0],[ignore],[ignore]) for st in '' '-static' '-no-install' do - case $st,$l3 in - ,-rpath*) mst= ;; - *) mst=-static ;; + # if -static is not passed, and the library is shared, then we have + # to use -DLIBA_DLL_IMPORT, thus main.lo (and not main-static.lo). + case $st,$l3 in + -static,*) mst=-static ;; + *,-rpath*) mst= ;; + *) mst=-static ;; esac LT_AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $st -o "$rel"main$EXEEXT "$rel"main$mst.lo "$rel"sub2/liba.la], |