Re: dynamic executables for check_PROGRAMS?

2011-02-20 Thread John Calcote
Hi Jeff,

On 02/17/2011 04:06 PM, Daily, Jeff A wrote:
 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.  If I change my 
 check_PROGRAMS to bin_PROGRAMS, they are dynamic executables.  But, I can't 
 do this in production for obvious reasons.

 So, is there any way to create dynamic executables for my check_PROGRAMS?

 Jeff

The --enable/disable-static/shared flags apply only to building shared
or static libraries within your project. These flags don't have anything
to do with how executables are built except to limit or expand the
options available to programs built against internal libraries. To test
this assertion, create a simple project without libtool (don't call
LT_INIT in configure.ac). When you run ./configure --help, you'll see
that these options are missing entirely from the help display.

I assume when you say dynamic executables you're referring to test
programs built to use shared libraries created from within the same
project. If you're noticing that your test binaries are getting linked
against your static libraries, then something strange is happening in
your project: If you're using --disable-static and it's working proper
but your check_PROGRAMS are inclined to link with the (now non-existent)
static libraries then I have to ask: How are these static libraries
getting built? - After all, you disabled them.

Assuming you've got Makefile.am code like this:

   check_PROGRAMS = test1
   test_SOURCES = test1.c
   test_LDADD = ../mylib/mylib.la

Make sure test_LDADD is referring to the correct relative path to your
internally built .la file. If you're specifying mylib.a (or even
mylib.la) without a relative path, you may be picking up a static
version of your library from your environment (/usr/lib or /usr/local/lib).

My assumptions may all be wrong - especially in light of the fact that
bin_PROGRAMS seems to work the way you want it to...

John



Re: dynamic executables for check_PROGRAMS?

2011-02-19 Thread Ralf Wildenhues
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?

Thanks,
Ralf



dynamic executables for check_PROGRAMS?

2011-02-17 Thread Daily, Jeff A
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.  If I change my check_PROGRAMS to 
bin_PROGRAMS, they are dynamic executables.  But, I can't do this in production 
for obvious reasons.

So, is there any way to create dynamic executables for my check_PROGRAMS?

Jeff