Ralf, Please find attached the minimal project which shows the behavior I am talking about.
Within the unpacked dir: $ ./bootstrap && ./configure --disable-shared && make ............ config.status: executing depfiles commands Making all in source make[1]: Entering directory `/build/work/foo/source' make all-am make[2]: Entering directory `/build/work/foo/source' if /bin/sh ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -MT foo.lo -MD -MP -MF ".deps/foo.Tpo" -c -o foo.lo foo.cpp; then mv -f ".deps/foo.Tpo" ".deps/foo.Plo"; else rm -f ".deps/foo.Tpo"; exit 1; fi g++ -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -MT foo.lo -MD -MP -MF .deps/foo.Tpo -c foo.cpp -o foo.o gcc -g -O2 -c bar.s /bin/sh ../libtool --tag=CXX --mode=link g++ -g -O2 -o libfoo.la -rpath /usr/local/lib -release 0.0.2 foo.lo bar.o mkdir .libs *** Warning: Linking the shared library libfoo.la against the non-libtool *** objects bar.o is not portable! ar cru .libs/libfoo.a foo.o ranlib .libs/libfoo.a creating libfoo.la ..................... However, in a shared library build: $ ./bootstrap && ./configure --enable-shared && make ........................... Making all in source make[1]: Entering directory `/build/work/foo/source' make all-am make[2]: Entering directory `/build/work/foo/source' if /bin/sh ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -MT foo.lo -MD -MP -MF ".deps/foo.Tpo" -c -o foo.lo foo.cpp; then mv -f ".deps/foo.Tpo" ".deps/foo.Plo"; else rm -f ".deps/foo.Tpo"; exit 1; fi mkdir .libs g++ -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -MT foo.lo -MD -MP -MF .deps/foo.Tpo -c foo.cpp -fPIC -DPIC -o .libs/foo.o g++ -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -MT foo.lo -MD -MP -MF .deps/foo.Tpo -c foo.cpp -o foo.o >/dev/null 2>&1 gcc -g -O2 -c bar.s /bin/sh ../libtool --tag=CXX --mode=link g++ -g -O2 -o libfoo.la -rpath /usr/local/lib -release 0.0.2 foo.lo bar.o *** Warning: Linking the shared library libfoo.la against the non-libtool *** objects bar.o is not portable! g++ -shared -nostdlib /usr/lib/gcc-lib/i486-slackware-linux/3.3.4/../../../crti.o /usr/lib/gcc-lib/i486-slackware-linux/3.3.4/crtbeginS.o .libs/foo.o bar.o -Wl,--rpath -Wl,/usr/lib/. -Wl,--rpath -Wl,/usr/lib/. -L/usr/lib/gcc-lib/i486-slackware-linux/../.. -L/usr/lib/gcc-lib/i486-slackware-linux/../../../i486-slackware-linux/lib -L/usr/i486-slackware-linux/lib -L/usr/i486-slackware-linux/bin -L/usr/lib/gcc-lib/i486-slackware-linux/3.3.4 -L/usr/lib/gcc-lib/i486-slackware-linux/3.3.4/../../../../i486-slackware-linux/lib -L/usr/lib/gcc-lib/i486-slackware-linux/3.3.4/../../.. /usr/lib/./libstdc++.so -lm -lc -lgcc_s /usr/lib/gcc-lib/i486-slackware-linux/3.3.4/crtendS.o /usr/lib/gcc-lib/i486-slackware-linux/3.3.4/../../../crtn.o -Wl,-soname -Wl,libfoo-0.0.2.so -o .libs/libfoo-0.0.2.so ................. Please note now how the linking phase links in ".libs/foo.o bar.o". Thanks, Liviu Ralf Wildenhues wrote: > Hi Liviu, > > * Liviu Nicoara wrote on Tue, May 30, 2006 at 06:59:53PM CEST: >> I am trying to conditionally compile [assembly] sources for my archive >> library. I initially tried: >> >> ## Makefile.am: >> >> lib_LTLIBRARIES = libfoo.la >> libfoo_la_SOURCES = main.cpp >> EXTRA_libfoo_la_SOURCES = x86.s x86_64.s power5.s >> libfoo_la_LIBADD = $(MY_EXTRA_SOURCES) >> libfoo_la_DEPENDENCIES = $(MY_EXTRA_SOURCES) > > Remove the last two lines and add $(MY_EXTRA_SOURCES) to > libfoo_la_SOURCES. > >> (I may be wrong about minute details here - I am quoting the code from >> memory.) > > If above hint does not work, then please show the failing code, this > time quoting from, well, the code, rather than memory, please. ;-) > >> The workaround for me was to use AM_CONDITIONALs and that worked pretty >> good. But using AM_CONDITIONALs is not as nice as AC_SUBST'ing from >> autoconf. > > Both should work. FWIW, I don't reckon conditionals as less "nice" than > AC_SUBSTed variables. They allow you to omit the EXTRA_*SOURCES line. > > Cheers, > Ralf >
foo.tgz
Description: application/compressed-tar
_______________________________________________ http://lists.gnu.org/mailman/listinfo/libtool