> Here's a couple of patches that implements support for > -Wl, and -Xlinker for MSVC. The first one > (rename-dashL_envvar-tolinker_envvar.patch) is just a > rename, to reduce confusion, and the second patch > (-Xlinker-msvc.patch) contains the new code... > > Ok for the pr-msvc-support branch?
I'm not sure I'm exercising the patch properly, but here's what I did: - applied the patch $ patch -p1 <rename-dashL_envvar-tolinker_envvar.patch $ patch -p1 <-Xlinker-msvc.patch - re-built libtool $ cd build $ make $ make install Then in one of my modules: $ autoreconf -fvi $ mkdir Debug $ cd Debug $ ../configure CC=cl CFLAGS='-MD -Zi' LD=link NM='dumpbin -symbols' AR=lib STRIP=: RANLIB=: --disable-static So far so good. But, $ ../configure CC=cl CFLAGS='-MD -Zi' LD=link LDFLAGS='-Wl,-DEBUG' NM='dumpbin -symbols' AR=lib STRIP=: RANLIB=: --disable-static checking for a BSD-compatible install... /bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking for gcc... cl checking for C compiler default output file name... configure: error: in `<abs_path_to>/build': configure: error: C compiler cannot create executables See `config.log' for more details. and config.log has: configure:2791: checking for C compiler default output file name configure:2813: cl -MD -Zi -Wl,-DEBUG conftest.c >&5 Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86 Copyright (C) Microsoft Corporation. All rights reserved. cl : Command line error D8021 : invalid numeric argument '/Wl,-DEBUG' configure:2817: $? = 2 configure:2855: result: configure: failed program was: | /* confdefs.h. */ | #define PACKAGE_NAME "foo" | #define PACKAGE_TARNAME "foo" | #define PACKAGE_VERSION "1.0" | #define PACKAGE_STRING "foo 1.0" | #define PACKAGE_BUGREPORT "" | #define PACKAGE "foo" | #define VERSION "1.0" | /* end confdefs.h. */ | | int | main () | { | | ; | return 0; | } configure:2861: error: in `/c/utils/cygwin/home/dbyron/src/ams_svn/AMS_SDK/trunk/final_review/build': configure:2864: error: C compiler cannot create executables If I go back to the working configure invocation, but change my Makefile.am with: libfoo_la_LDFLAGS += -Wl,-DEBUG The resulting library doesn't contain debug symbols. Here's the libtool invocation that creates the library: /bin/sh ./libtool --tag=CC --mode=link cl -MD -Zi -no-undefined -export-symbols symfile -Wl,-DEBUG -o libfoo.la -rpath /usr/loca l/lib libfoo_la-public.lo libfoo_la-private.lo libtool: link: dumpbin -symbols .libs/libfoo_la-public.obj .libs/libfoo_la-private.obj | gawk ' {last_section=section; sectio n=$ 3}; /Section length .*#relocs.*(pick any)/{hide[last_section]=1}; $ 0!~/External *\|/{next}; / 0+ UNDEF /{next}; / U NDEF \([^|]\)*()/{next}; {if(hide[section]) next}; {f=0}; $ 0~/\(\).*\|/{f=1}; {printf f ? "T " : "D "}; {split($ 0, a, /\||\r/); split(a[2], s)}; s[1]~/^...@?]/{print s[1], s[1]; next}; s[1]~prfx {split(s[1],t,"@"); print t[1], substr(t[1],lengt h(prfx))} ' prfx=^_ | /bin/sed -e '/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/' | /bin/sed -e '/^[AITW][ ]/s/.*[ ]//' | sort | uniq > .libs/foo.exp libtool: link: if test "x`/bin/sed 1q .libs/foo.def`" = xEXPORTS; then sed -n -e s/\\\(.*\\\)/-link\ -EXPORT:\\\1/ -e 1\!p < .libs/f oo.def > .libs/foo-0.dll.exp; else sed -e s/\\\(.*\\\)/-link\ -EXPORT:\\\1/ < .libs/foo.def > .libs/foo-0.dll.exp; fi libtool: link: cl -o .libs/foo-0.dll .libs/libfoo_la-public.obj .libs/libfoo_la-private.obj -DEBUG @.libs/foo-0.dll.exp -link -DLL Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86 Copyright (C) Microsoft Corporation. All rights reserved. cl : Command line warning D9035 : option 'o' has been deprecated and will be removed in a future release Microsoft (R) Incremental Linker Version 8.00.50727.762 Copyright (C) Microsoft Corporation. All rights reserved. /out:libfoo_la-public.exe /out:.libs/foo-0.dll -DLL .libs/libfoo_la-public.obj .libs/libfoo_la-private.obj Creating library .libs/foo-0.lib and object .libs/foo-0.exp libtool: link: linknames= libtool: link: rm -f .libs/foo.exp .libs/foo.filter libtool: link: LINK= libtool: link: ( cd ".libs" && rm -f "libfoo.la" && cp -p "../libfoo.la" "libfoo.la" ) Should I be doing something else? -DB