automake
[Top][All Lists]
Advanced

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

problem --enable-shared and --enable-static together


From: Andreas Otto
Subject: problem --enable-shared and --enable-static together
Date: Fri, 4 Dec 2009 09:41:16 +0100
User-agent: KMail/1.10.3 (Linux/2.6.27.39-0.2-default; KDE/4.1.3; x86_64; ; )

Hi,

  I have a project using together the both statements from above to configure.
  This project hase many different parts includig many shared libraries
  and executables.

  Now the problem.

  1. I have libraries which are only useful as "shared" libraries. this
     libraries are language extension used to dl-open by an programming
     language.

  these libraries should "not" build the "static" object files

example:

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><
pkglib_LTLIBRARIES = tclmsgque.la

tclmsgque_la_SOURCES =  context_tcl.c  misc_tcl.c  msgque_tcl.c read_tcl.c 
send_tcl.c \
                          config_tcl.c service_tcl.c msgque_tcl.h slave_tcl.c 
\
                            MqBufferS_tcl.c error_tcl.c

# use this if you want to include the libmsgque files into the tclmsgque 
libraray
tclmsgque_la_CFLAGS = -I$(srcdir)/../libmsgque $(TCL_INCLUDE_SPEC) 
$(TCL_CFLAGS) $(AM_CFLAGS) -DMQ_IGNORE_EXTERN
tclmsgque_la_LIBADD = ../libmsgque/*.lo

tclmsgque_la_LDFLAGS = -shared -module -avoid-version -no-undefined 
$(TCL_LIBADD)
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

the following object files are created
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-rw-rw-r--  1 dev1usr users   1000  4. Dez 09:27 tclmsgque.la
-rw-rw-r--  1 dev1usr users    323  4. Dez 09:27 tclmsgque_la-config_tcl.lo
-rw-rw-r--  1 dev1usr users 154528  4. Dez 09:27 tclmsgque_la-config_tcl.o
-rw-rw-r--  1 dev1usr users    326  4. Dez 09:27 tclmsgque_la-context_tcl.lo
-rw-rw-r--  1 dev1usr users 120656  4. Dez 09:27 tclmsgque_la-context_tcl.o
-rw-rw-r--  1 dev1usr users    320  4. Dez 09:27 tclmsgque_la-error_tcl.lo
-rw-rw-r--  1 dev1usr users  96240  4. Dez 09:27 tclmsgque_la-error_tcl.o
-rw-rw-r--  1 dev1usr users    317  4. Dez 09:27 tclmsgque_la-misc_tcl.lo
-rw-rw-r--  1 dev1usr users  94800  4. Dez 09:27 tclmsgque_la-misc_tcl.o
-rw-rw-r--  1 dev1usr users    332  4. Dez 09:27 tclmsgque_la-MqBufferS_tcl.lo
-rw-rw-r--  1 dev1usr users  97688  4. Dez 09:27 tclmsgque_la-MqBufferS_tcl.o
-rw-rw-r--  1 dev1usr users    323  4. Dez 09:27 tclmsgque_la-msgque_tcl.lo
-rw-rw-r--  1 dev1usr users 103328  4. Dez 09:27 tclmsgque_la-msgque_tcl.o
-rw-rw-r--  1 dev1usr users    317  4. Dez 09:27 tclmsgque_la-read_tcl.lo
-rw-rw-r--  1 dev1usr users 113008  4. Dez 09:27 tclmsgque_la-read_tcl.o
-rw-rw-r--  1 dev1usr users    317  4. Dez 09:27 tclmsgque_la-send_tcl.lo
-rw-rw-r--  1 dev1usr users 122192  4. Dez 09:27 tclmsgque_la-send_tcl.o
-rw-rw-r--  1 dev1usr users    326  4. Dez 09:27 tclmsgque_la-service_tcl.lo
-rw-rw-r--  1 dev1usr users  88400  4. Dez 09:27 tclmsgque_la-service_tcl.o
-rw-rw-r--  1 dev1usr users    320  4. Dez 09:27 tclmsgque_la-slave_tcl.lo
-rw-rw-r--  1 dev1usr users  93392  4. Dez 09:27 tclmsgque_la-slave_tcl.o
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

as you see both *lo and *.o are created. the *.o are useless and just
extend the compiling time

I use "../libmsgque/*.lo" for in-project libraray dependency to avoid to
link to my own shared libraray

Q: what can I do to avoid build static libraries ...


2. executables should build without library dependency. This mean that
if configured with "--enable-static" the static object files should be used
and if configureed without the shared object files should be used.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
brain_SOURCES = brain.c
brain_CFLAGS = -I../theLink/libmsgque -I$(BRAIN_HOME)/include -
DMQ_LINK_WITH_LIBRARY_OBJECT_FILES

if HAS_STATIC
LIBMSQUE = ../theLink/libmsgque/*.o
else
LIBMSQUE = ../theLink/libmsgque/*.lo
endif

brain_LDADD = -lz -lbz2 -lrt -lm -lc $(LIBMSQUE) 
$(BRAIN_HOME)/lib/libtokyocabinet.a
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

I need a HELPER called HAS_STATIC defined in configure.in with
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
AM_CONDITIONAL([HAS_STATIC], [test "$enable_static" = "yes"])
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Q: Is this OK or is something better is possible ?


mfg

  Andreas Otto


reply via email to

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