automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: dynamic executables for check_PROGRAMS?


From: Daily, Jeff A
Subject: RE: dynamic executables for check_PROGRAMS?
Date: Fri, 25 Feb 2011 10:08:59 -0800

> -----Original Message-----
> From: Daily, Jeff A
> Sent: Friday, February 25, 2011 10:05 AM
> To: 'Ralf Wildenhues'; 'John Calcote'
> Cc: address@hidden
> Subject: RE: dynamic executables for check_PROGRAMS?
> 
> > -----Original Message-----
> > From: Ralf Wildenhues [mailto:address@hidden
> > Sent: Saturday, February 19, 2011 11:57 PM
> > To: Daily, Jeff A
> > Cc: address@hidden
> > Subject: Re: dynamic executables for check_PROGRAMS?
> >
> > Hello Jeff,
> >
> > * Daily, Jeff A wrote on Fri, Feb 18, 2011 at 12:06:13AM CET:
> > > I wrote a profiling layer for my library utilizing weak symbols.  I
> > > thought for starters it would be nice to profile some of my test
> > > programs, to make sure things are working okay.  I'm using autoconf,
> > > automake, and libtool, so I configured using --enable-shared
> > > --disable-static, however, my test programs are not created as
> > > dynamic executables.
> >
> > I'm not sure I understand this.  Programs are typically not created
> > differently based on whether they are check_PROGRAMS or
> bin_PROGRAMS.
> > Maybe you are thinking of uninstalled libraries which those programs
> > depend on and which are noinst_LTLIBRARIES thus only generated as
> > convenience archives?  Here's how you can let them be shared libraries:
> >
> > noinst_LTLIBRARIES = libtesthelper.la
> > libtesthelper_la_LDFLAGS = -rpath /nowhere
> >
> > The actual path you specify is not important, except that it should
> > not be world-accessible because the system might try to find files there.
> >
> > If I have misunderstood your question, the maybe it helps to show a
> > small example?
> 
> I've attached a tiny example.  It consists of three programs: main_bin,
> main_check, main_nofoo_bin.  Here's the Makefile.am:
> 
> ACLOCAL_AMFLAGS = -I m4
> include_HEADERS = foo.h
> nodist_include_HEADERS =
> bin_PROGRAMS = main_bin main_nofoo_bin
> check_PROGRAMS = main_check
> lib_LTLIBRARIES = libfoo.la
> libfoo_la_SOURCES  = foo.c
> main_bin_SOURCES   = main_bin.c
> main_nofoo_bin_SOURCES   = main_nofoo_bin.c
> main_nofoo_bin_LDADD =
> main_check_SOURCES = main_check.c
> LDADD = libfoo.la
> 
> Here are the relevant pieces of configure.ac.  I know some of the automake
> settings don't really apply to this simple test, but they're the ones I use 
> in my
> software package so I hope to reproduce the conditions as completely as
> possible:
> 
> AC_PREREQ([2.67])
> AC_INIT([foo], [1.0], address@hidden)
> AC_CONFIG_AUX_DIR([build-aux])
> AC_CONFIG_SRCDIR([foo.c])
> AC_CONFIG_HEADERS([config.h])
> AC_CONFIG_MACRO_DIR([m4])
> AM_INIT_AUTOMAKE([color-tests foreign parallel-tests silent-rules subdir-
> objects]) AC_PROG_CC LT_INIT
> AC_CONFIG_FILES([Makefile])
> AC_OUTPUT
> 
> When I mkdir bld && cd bld && ../configure --disable-static --enable-shared -
> -prefix=`pwd` && make && make check && make install, I get a main_bin,
> main_check, and main_nofoo_bin in my build directory.  When I run ldd
> main_bin or ldd main_check I get "not a dynamic executable".  When I run
> "ldd main_nofoo_bin" or when I run "ldd bin/main_bin" I get the listing of
> shared libraries as expected, so somehow I get a dynamic executable if I
> don't link to libfoo.la or if I install the program.  But if I link to 
> libfoo.la, prior to
> installing, my binaries are statically linked?

My last email didn't make it through to the mailing list, probably due to my 
attachment of the small sample.  For the benefit of the rest of the community, 
I'm resending it with the inline configure.ac and Makefile.am above so that 
hopefully my sample can be reconstructred by interested readers...



reply via email to

[Prev in Thread] Current Thread [Next in Thread]