From: Gary V. Vaughan Date: Wed, 23 Dec 1998 17:30:12 +0000 (+0000) Subject: more improvements for the win32 port X-Git-Tag: automake_1-4~84 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa4ae3b1129aa63e4092af3c4d00e0c9980d1bbb;p=thirdparty%2Flibtool.git more improvements for the win32 port --- diff --git a/ChangeLog b/ChangeLog index 906fa2839..10a74321e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,45 @@ +1998-12-23 Gary V. Vaughan + + * doc/PLATFORMS: added my cygwin32 box (i686-pc-cygwin32). + + * TODO: remind myself of the win32 tasks remaining. + + * ltconfig.in (archive_cmds, archive_sym_cmds, + old_archive_from_new_cmds): Fixed a bug which left an a.exe in the + build directory. Fixed a bug where $soname-def was never deleted. + + * ltconfig.in (file_magic_command): new variable holds the command + (including any args) to run to generate the string to match + against the regex in $file_magic. Use the variable where + necessary. Added to libtool header output. + (deplibs_check_method): use file_magic for win32, but compare the + output of `objdump -f' with the regex (see below). + (archive_cmds, archive_sym_cmds): use compile_dependencylibs for + each $CC invokation (see below). + + * ltmain.in: Set allow_undefined to `no' for win32 variants by + default, otherwise it is impossible to link a dll without forcing + the makefile maintainer to figure out whether to pass + --no-undefined at every libtool invokation. + (compile_dependencylibs): save the list of dependency library + flags needed for a deplib build on win32. + (link_against_libtool_libs): commented out the check for this; if + it is left in, then ltlibs (i.e. *.la files) cannot be deplibs for + subsequent links. + Don't add -lc to the deplibs line for win32 platforms (which don't + have a libc as such). + (file_magic_command): use this to get some output to compare with + the file_magic regex (instead of hardcoding `file' which doesn't + exist on win32. + * doc/libtool.texi (Porting inter-library dependencies): Updated + to document the changes above. + + * ltconfig.in (deplibs_check_method): Changed the file_magic regex + to match more linux variants. This is less lenient than Thomas + Tanner's commit to fix the same problem below. + Reported by Joel Klecker + * THANKS: added Joel Klecker + 1998-12-23 Thomas Tanner * ltconfig.in: fixed file-magic for Linux shared libraries @@ -15,6 +57,12 @@ * libltdl/configure.in: warn if dlopen is not supported * mdemo/Makefile.am (mdemo.debug): use libltdls +1998-12-22 Gary V. Vaughan + + * ltconfig.in: revert Thomas Tanners change to create all + libraries without the `lib' prefix on win32, otherwise `gcc foo.c + -lbar' can't find libbar.a. + 1998-12-22 Alexandre Oliva * Makefile.am (SUBDIRS): prepend `.' to avoid am-recursive @@ -34,7 +82,7 @@ 1998-12-21 Gary V. Vaughan * libtool.m4 (AM_SYS_NM_PARSE): apparently __ptr_t is predefined - on some systems - use lt_ptr_t instead. + on some systems - use lt_ptr_t instead. * ltconfig.in: ditto. * ltmain.in: ditto. @@ -46,7 +94,7 @@ * demo/dlmain.c (main): No need to specialcase underscores in dld_preloaded_symbols - it is fixed by symxfrm above! * libltdl/configure.in: use AM_SYS_SYMBOL_UNDERSCORE from - libtool.m4 rather than reincent the wheel here =)O| + libtool.m4 rather than reinvent the wheel here =)O| * ltmain.in: Fix deplibs methods to not rely on a.out (cygwin uses a.exe!). diff --git a/THANKS b/THANKS index c2a0d959d..0182bef20 100644 --- a/THANKS +++ b/THANKS @@ -17,6 +17,7 @@ Eric Estievenart H.J. Lu Ian Lance Taylor Joel Cannon +Joel Klecker Joel N. Weber II Karl Berry Kenneth Albanowski diff --git a/TODO b/TODO index 0e876c8fe..f14371e61 100644 --- a/TODO +++ b/TODO @@ -48,6 +48,25 @@ char'. Find a workaround. In the future: ************** +* Fix libltdl, demo, mdemo and depdemo (in that order) on win32. +This may require resolving some of the items below. + +* Make the executable wrapper scripts work on win32. +They will need to make sure all of the dll (particularly deplibs) paths are in +$PATH, and probably cd into the .libs subdirectory. + +* Figure out how to use data items in dlls with win32. +The difficult part is compiling each object which will be linked with an +import lib differently than if it will be linked with a static lib. This will +almost definitely require that automake pass some hints about linkage in to +each object compilation line. + +* Resolve the name clash between import libs and static libs on win32. +Probably the best way to do this is to create lib$name-dll.a for the import +library, and continue to use lib$name.a for the static lib. libtool +--mode=link can then favour -dll.a over .a if there is a choice. No point in +doing this until we can export data items (above). + * If not cross-compiling, have the static flag test run the resulting binary to make sure everything works. diff --git a/doc/PLATFORMS b/doc/PLATFORMS index de34556fb..934da41b8 100644 --- a/doc/PLATFORMS +++ b/doc/PLATFORMS @@ -19,6 +19,7 @@ i586-pc-linux-gnulibc1 gcc 1.2c ok i586-pc-linux-gnulibc2 gcc 1.2c ok i586-pc-gnu0.3 gcc 1.2b ok i586-dg-dguxR4.20MU01 gcc 1.2 ok +i686-pc-cygwin32 egcs 1.2e ok m88k-dg-dguxR4.12TMU01** gcc 1.2 ok mips-sgi-irix5.2 gcc 1.2c ok mips-sgi-irix5.3 cc 0.8 ok diff --git a/doc/libtool.texi b/doc/libtool.texi index be07c7f0b..3b3e714ce 100644 --- a/doc/libtool.texi +++ b/doc/libtool.texi @@ -2796,20 +2796,23 @@ Kuratomi @email{badger@@prtr-13.ucsc.edu}. Here's a shortened version of the message that contained his patch: The basic architecture is this: in @file{ltconfig.in}, the person who -writes libtool makes sure @samp{$deplibs} is included in -@samp{$archive_cmds} somewhere and also sets the -@samp{$deplibs_check_method}. @samp{deplibs_check_method} -can be any of five things: +writes libtool makes sure @samp{$deplibs}, or @samp{$compile_dependencylibs} +are included in @samp{$archive_cmds} somewhere and also sets the +@samp{$deplibs_check_method}, and maybe @samp{$file_magic_command} when +@samp{deplibs_check_method} is file_magic. + +@samp{deplibs_check_method} can be one of five things: @table @samp @item file_magic [@var{regex}] @vindex file_magic +@vindex file_magic_command looks in the library link path for libraries that have the right -libname. Then it runs file on the library and checks for a match -against [regex] using expr. I currently have linux-elf looking for the -string: "ELF 32-bit LSB shared object" which seems to work well. (I -don't know whether the "32-bit" would have to change on linux-alpha -though.... change to 'ELF [0-9]+-bit LSB shared object' might work. I -don't know.) This is one that works best I think. +libname. Then it runs @samp{$file_magic_command} on the library and checks +for a match against [regex] using expr. I currently have linux-elf looking +for the string: "ELF [0-9][0-9]*-bit [LM]SB shared object" on the output of +@samp{file}, and some of the win32 ports looking for the string: "file format +pei*-i386.*architecture: i386" on the output of @samp{objdump -f}. +This is option that works best I think. @item file_regex @vindex file_regex diff --git a/ltconfig.in b/ltconfig.in index 786518683..fcc3d45bb 100755 --- a/ltconfig.in +++ b/ltconfig.in @@ -1034,23 +1034,23 @@ DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) return TRUE; } ' > ltdll.c - archive_cmds='$CC -c '"`pwd`"'/ltdll.c~echo EXPORTS > $lib-def~ - $DLLTOOL --export-all --output-def $lib-def $libobjs ltdll.$objext~ - $CC -Wl,--base-file,$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 $libobjs ltdll.$objext~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $lib-def --base-file $soname-base --output-exp $soname-exp~ - $CC -Wl,--base-file,$soname-base $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$deplibs~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $lib-def --base-file $soname-base --output-exp $soname-exp~ - $CC $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$deplibs~ + archive_cmds='$CC -c '"`pwd`"'/ltdll.c~echo EXPORTS > $soname-def~ + $DLLTOOL --export-all --output-def $soname-def $libobjs ltdll.$objext~ + $CC -Wl,--base-file,$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$compile_dependencylibs~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $soname-def --base-file $soname-base --output-exp $soname-exp~ + $CC -Wl,--base-file,$soname-base $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$compile_dependencylibs~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $soname-def --base-file $soname-base --output-exp $soname-exp~ + $CC $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$compile_dependencylibs~ $rm ltdll.$objext $soname-base $soname-exp' - archive_sym_cmds='$CC -c '"`pwd`"'/ltdll.c~echo EXPORTS > $lib-def~ - cat "$export_symbols" >> $lib-def~ - $CC -Wl,--base-file,$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 $libobjs ltdll.$objext~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $lib-def --base-file $soname-base --output-exp $soname-exp~ - $CC -Wl,--base-file,$soname-base $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$deplibs~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $lib-def --base-file $soname-base --output-exp $soname-exp~ - $CC $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$deplibs~ + archive_sym_cmds='$CC -c '"`pwd`"'/ltdll.c~echo EXPORTS > $soname-def~ + cat "$export_symbols" >> $soname-def~ + $CC -Wl,--base-file,$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$compile_dependencylibs~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $soname-def --base-file $soname-base --output-exp $soname-exp~ + $CC -Wl,--base-file,$soname-base $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$compile_dependencylibs~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $soname-def --base-file $soname-base --output-exp $soname-exp~ + $CC $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$compile_dependencylibs~ $rm ltdll.$objext $soname-base $soname-exp' - old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $lib-def --output-lib $objdir/$libname.a~$rm $lib.exp' + old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $soname-def --output-lib $objdir/$libname.a~$rm $soname-def' else # When not using gcc, we currently assume that we are using # Microsoft Visual C++. @@ -1146,23 +1146,23 @@ DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) return TRUE; } ' > ltdll.c - archive_cmds='$CC -c '"`pwd`"'/ltdll.c~echo EXPORTS > $lib-def~ - $DLLTOOL --export-all --output-def $lib-def $libobjs ltdll.$objext~ - $CC -Wl,--base-file,$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 $libobjs ltdll.$objext~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $lib-def --base-file $soname-base --output-exp $soname-exp~ - $CC -Wl,--base-file,$soname-base $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$deplibs~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $lib-def --base-file $soname-base --output-exp $soname-exp~ - $CC $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$deplibs~ - $rm ltdll.$objext $soname-base $soname-exp' - archive_sym_cmds='$CC -c '"`pwd`"'/ltdll.c~echo EXPORTS > $lib-def~ - cat "$export_symbols" >> $lib-def~ - $CC -Wl,--base-file,$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 $libobjs ltdll.$objext~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $lib-def --base-file $soname-base --output-exp $soname-exp~ - $CC -Wl,--base-file,$soname-base $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$deplibs~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $lib-def --base-file $soname-base --output-exp $soname-exp~ - $CC $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$deplibs~ - $rm ltdll.$objext $soname-base $soname-exp' - old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $lib-def --output-lib $objdir/$libname.a~$rm $lib.exp' + archive_cmds='$CC -c '"`pwd`"'/ltdll.c~echo EXPORTS > $soname-def~ + $DLLTOOL --export-all --output-def $soname-def $libobjs ltdll.$objext~ + $CC -Wl,--base-file,$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$compile_dependencylibs~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $soname-def --base-file $soname-base --output-exp $soname-exp~ + $CC -Wl,--base-file,$soname-base $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$compile_dependencylibs~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $soname-def --base-file $soname-base --output-exp $soname-exp~ + $CC $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$compile_dependencylibs~ + $rm ltdll.$objext $soname-base $soname-exp $soname-def' + archive_sym_cmds='$CC -c '"`pwd`"'/ltdll.c~echo EXPORTS > $soname-def~ + cat "$export_symbols" >> $soname-def~ + $CC -Wl,--base-file,$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$compile_dependencylibs~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $soname-def --base-file $soname-base --output-exp $soname-exp~ + $CC -Wl,--base-file,$soname-base $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$compile_dependencylibs~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $soname-def --base-file $soname-base --output-exp $soname-exp~ + $CC $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$compile_dependencylibs~ + $rm ltdll.$objext $soname-base $soname-exp $soname-def' + old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $soname-def --output-lib $objdir/$libname.a~$rm $soname-def' else # When not using gcc, we currently assume that we are using # Microsoft Visual C++. @@ -1556,6 +1556,7 @@ shlibpath_var= version_type=none dynamic_linker="$host_os ld.so" sys_lib_search_path="/lib /usr/lib /usr/local/lib" +file_magic_command= deplibs_check_method='none' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. @@ -1565,11 +1566,10 @@ deplibs_check_method='none' # 'file_regex' -- check by looking for filenames that look like the shared # library in the library path. # 'file_magic [regex]' -- check by looking for files in library path which -# responds to the "file" command with a given regex. This is actually a -# superset of the file_regex command. If you have file on your system, you'll -# want to use this instead. -# Notes: regexes are run through expr. - +# responds to the $file_magic_command with a given regex. This is actually a +# superset of the file_regex command. If you have `file' or equivalent on +# your system, you'll want to use this instead. +# Notes: regexs are run through expr. echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6 case "$host_os" in aix3* | aix4*) @@ -1603,7 +1603,8 @@ cygwin32* | mingw32*) library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' fi dynamic_linker='Win32 ld.exe' - libname_spec='$name' + deplibs_check_method='file_magic file format pei*-i386.*architecture: i386' + file_magic_command='objdump -f' need_lib_prefix=no # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH @@ -1663,7 +1664,8 @@ linux-gnu*) soname_spec='${libname}${release}.so$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH - deplibs_check_method='file_magic ELF .* shared object' + deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' + file_magic_command=file sys_lib_search_path="/lib /usr/lib /usr/local/lib `echo $LD_LIBRARY_PATH | sed -e 's/:/ /g'`" if test -f /lib/ld.so.1; then @@ -1807,7 +1809,7 @@ case "$ltmain" in whole_archive_flag_spec libname_spec library_names_spec soname_spec \ RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ old_postuninstall_cmds archive_cmds archive_sym_cmds postinstall_cmds postuninstall_cmds \ - deplibs_check_method allow_undefined_flag no_undefined_flag \ + file_magic_command deplibs_check_method allow_undefined_flag no_undefined_flag \ finish_cmds finish_eval global_symbol_pipe \ hardcode_libdir_flag_spec hardcode_libdir_separator sys_lib_search_path \ compiler_c_o compiler_o_lo need_locks; do @@ -2025,6 +2027,9 @@ postuninstall_cmds=$postuninstall_cmds # Method to check whether dependent libraries are shared objects. deplibs_check_method=$deplibs_check_method +# Command to use when deplibs_check_method == file_magic +file_magic_command=$file_magic_command + # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$allow_undefined_flag diff --git a/ltmain.in b/ltmain.in index 30ce2874a..bd98e989a 100644 --- a/ltmain.in +++ b/ltmain.in @@ -559,7 +559,18 @@ compiler." modename="$modename: link" C_compiler="$CC" # save it, to compile generated C sources CC="$nonopt" - allow_undefined=yes + case "$host" in + *-*-cygwin32* | *-*-mingw32* | *-*-os2*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # which system we are compiling for in order to pass an extra + # flag for every libtool invokation. + allow_undefined=no + ;; + *) + allow_undefined=yes + ;; + esac compile_command="$CC" finalize_command="$CC" @@ -951,6 +962,11 @@ compiler." immediate | unsupported) if test "$hardcode_direct" = no; then compile_command="$compile_command $dir/$linklib" + case "$host" in + *-*-cygwin32* | *-*-mingw32* | *-*-os2*) + compile_dependencylibs="$compile_dependencylibs -L$dir -l$name" + ;; + esac elif test "$hardcode_minus_L" = no; then case "$host" in *-*-sunos*) @@ -1157,11 +1173,14 @@ compiler." exit 1 fi + # If the following section is uncommented, then it is impossible to + # link with ltlibrary deplibs... + # How the heck are we supposed to write a wrapper for a shared library? - if test -n "$link_against_libtool_libs"; then - $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2 - exit 1 - fi + #if test -n "$link_against_libtool_libs"; then + # $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2 + # exit 1 + #fi if test -n "$dlfiles$dlprefiles"; then $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2 @@ -1328,9 +1347,16 @@ compiler." allow_undefined_flag="$no_undefined_flag" fi - # Add libc to deplibs on all systems. dependency_libs="$deplibs" - deplibs="$deplibs -lc" + case "$host" in + *-*-cygwin32* | *-*-mingw32* | *-*-os2*) + # these systems don't actually have a c library (as such)! + ;; + *) + # Add libc to deplibs on all other systems. + deplibs="$deplibs -lc" + ;; + esac fi # Create the output directory, or remove our outputs if we need to. @@ -1359,7 +1385,7 @@ compiler." ## Gordon: Do you check for the existence of the libraries in deplibs ## on the system? That should maybe be merged in here someplace.... ## Actually: I think test_compile and file_magic do this... file_regex - ## sorta does this. Only pas_all needs to be changed. -Toshio + ## sorta does this. Only pass_all needs to be changed. -Toshio name_save=$name libname_save=$libname release_save=$release @@ -1472,7 +1498,7 @@ EOF # strict. What do you think Gordon? potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do - file_output=`file $potent_lib` + file_output=`eval $file_magic_command $potent_lib` if test `expr "$file_output" : ".*$file_magic_regex"` -ne 0 ; then newdeplibs="$newdeplibs $a_deplib" a_deplib=""