Anuradha Ratnaweera wrote:

Hi all,

Seems that not doing things is going to solve a lot of problems, for
most of my `improvements' are removing stuff... ;-)

The whole point that autoconf/automake is trying to rid us from doing
specific things.  For example, linking may be done differently in
different systems.  Not necessarily with a -l flag.  So, if we specify
LDFLAGS manually, we are back to the old system and don't use the
advantage of autotools.

The correct way to link libraries is to just check for them using a
function (AC_CHECK_LIB), and autoconf/automake figures out a way to
link them depending on the system we are (may or may not be a -l).

So I removed all the LDFLAGS LDADDs in Makefile.am files, because
LDFLAGS are passed to the linker automatically and also there is no
need to link to cutest manually, as we check for it in configure.ac
once.  See my previous patch to configure.ac and Makefile for cutest.
How about linking axis2c libraries when building tests. Currently axis2c libraries are linked with -L.. -l flags in Makefile.am's in tests. How can we do that in a platform indept way
using AC_CHECK_LIB or whatever. I suppose we can use AC_CHECK_LIB inside
Makefile.am's

thanks
damitha

       Anuradha
--
http://anuradha-ratnaweera.blogspot.com
http://www.linux.lk/~anuradha/
------------------------------------------------------------------------

Index: test/unit/xml/om/Makefile.am
===================================================================
--- test/unit/xml/om/Makefile.am        (revision 354402)
+++ test/unit/xml/om/Makefile.am        (working copy)
@@ -13,9 +13,7 @@

prgbin_PROGRAMS = om_test
om_test_SOURCES = main.c
-om_test_LDADD   =  $(LDFLAGS) libtest_om.la  \
-                     -L$(CUTEST_HOME)/lib \
-                     -lcutest \
+om_test_LDADD   =  libtest_om.la  \
                    -L$(top_builddir)/install/lib \
                    -laxis2_util \
                    -laxis2_context \
Index: test/unit/core/phaseresolver/Makefile.am
===================================================================
--- test/unit/core/phaseresolver/Makefile.am    (revision 354402)
+++ test/unit/core/phaseresolver/Makefile.am    (working copy)
@@ -11,9 +11,7 @@

prgbin_PROGRAMS = phaseresolver_test
phaseresolver_test_SOURCES = main.c
-phaseresolver_test_LDADD   =  $(LDFLAGS) libtest_phaseresolver.la  \
-                     -L$(CUTEST_HOME)/lib \
-                     -lcutest \
+phaseresolver_test_LDADD   =  libtest_phaseresolver.la  \
                    -L$(top_builddir)/install/lib \
                    -laxis2_util \
                    -laxis2_context \
Index: test/unit/core/description/Makefile.am
===================================================================
--- test/unit/core/description/Makefile.am      (revision 354402)
+++ test/unit/core/description/Makefile.am      (working copy)
@@ -12,9 +12,8 @@

prgbin_PROGRAMS = description_test
description_test_SOURCES = main.c
-description_test_LDADD   =  $(LDFLAGS) libtest_description.la  \
+description_test_LDADD   =  libtest_description.la  \
                     -L$(CUTEST_HOME)/lib \
-                     -lcutest \
                    -L$(top_builddir)/install/lib \
                    -laxis2_util \
                    -laxis2_context \
Index: test/unit/core/context/Makefile.am
===================================================================
--- test/unit/core/context/Makefile.am  (revision 354402)
+++ test/unit/core/context/Makefile.am  (working copy)
@@ -12,9 +12,8 @@

prgbin_PROGRAMS = context_test
context_test_SOURCES = main.c
-context_test_LDADD   =  $(LDFLAGS) libtest_context.la  \
+context_test_LDADD   =  libtest_context.la  \
                     -L$(CUTEST_HOME)/lib \
-                     -lcutest \
                    -L$(top_builddir)/install/lib \
                    -laxis2_util \
                    -laxis2_context \
Index: test/unit/core/engine/Makefile.am
===================================================================
--- test/unit/core/engine/Makefile.am   (revision 354402)
+++ test/unit/core/engine/Makefile.am   (working copy)
@@ -11,9 +11,8 @@

prgbin_PROGRAMS = engine_test
engine_test_SOURCES = main.c
-engine_test_LDADD   =  $(LDFLAGS) libtest_engine.la  \
+engine_test_LDADD   =  libtest_engine.la  \
                     -L$(CUTEST_HOME)/lib \
-                     -lcutest \
                    -L$(top_builddir)/install/lib \
                    -laxis2_util \
                    -laxis2_context \
Index: test/unit/Makefile.am
===================================================================
--- test/unit/Makefile.am       (revision 354402)
+++ test/unit/Makefile.am       (working copy)
@@ -4,9 +4,7 @@
AM_CPPFLAGS = $(CPPFLAGS)
main_unit_test_suite_SOURCES = main.c

-main_unit_test_suite_LDADD   =  $(LDFLAGS) \
-                     -L$(CUTEST_HOME)/lib \
-                     -lcutest \
+main_unit_test_suite_LDADD   = -L$(CUTEST_HOME)/lib \
                    -L$(top_builddir)/test/unit/core/description/.libs 
-ltest_description \
                    -L$(top_builddir)/test/unit/core/engine/.libs -ltest_engine 
\
                    -L$(top_builddir)/test/unit/core/context/.libs 
-ltest_context \
Index: test/unit/util/Makefile.am
===================================================================
--- test/unit/util/Makefile.am  (revision 354402)
+++ test/unit/util/Makefile.am  (working copy)
@@ -18,10 +18,7 @@

prgbin_PROGRAMS = util_test
util_test_SOURCES = main.c
-util_test_LDADD   =  $(LDFLAGS) \
-                     -L$(CUTEST_HOME)/lib \
-                     -lcutest \
-                     $(top_builddir)/test/unit/util/libtest_util.la \
+util_test_LDADD   =  $(top_builddir)/test/unit/util/libtest_util.la \
                    -L$(top_builddir)/install/lib \
                    -laxis2_util \
                    -laxis2_context \
Index: test/xml/om/Makefile.am
===================================================================
--- test/xml/om/Makefile.am     (revision 354402)
+++ test/xml/om/Makefile.am     (working copy)
@@ -4,7 +4,7 @@
AM_CPPFLAGS = $(CPPFLAGS) -g -O2 -pthread
test_om_SOURCES = test_om.c

-test_om_LDADD   =  $(LDFLAGS) -L$(top_builddir)/install/lib -laxis2_om \
+test_om_LDADD   =   -L$(top_builddir)/install/lib -laxis2_om \
                    -L$(top_builddir)/install/lib -laxis2_libxml2 -lxml2 \
                    -L$(top_builddir)/install/lib -laxis2_util
Index: test/common/Makefile.am
===================================================================
--- test/common/Makefile.am     (revision 354402)
+++ test/common/Makefile.am     (working copy)
@@ -4,5 +4,5 @@
AM_CPPFLAGS = $(CPPFLAGS)
test_common_SOURCES = test_common.c

-test_common_LDADD   =  $(LDFLAGS) -L$(top_builddir)/install/lib -laxis2_common
+test_common_LDADD   =   -L$(top_builddir)/install/lib -laxis2_common
INCLUDES = -I${CUTEST_HOME}/include -I$(top_builddir)/include
Index: test/core/handlers/Makefile.am
===================================================================
--- test/core/handlers/Makefile.am      (revision 354402)
+++ test/core/handlers/Makefile.am      (working copy)
@@ -4,7 +4,7 @@
AM_CPPFLAGS = $(CPPFLAGS) -g -O2 -pthread
test_handler_SOURCES = test_handler.c

-test_handler_LDADD   =  $(LDFLAGS) -L$(top_builddir)/install/lib -laxis2_util
+test_handler_LDADD   =  -L$(top_builddir)/install/lib -laxis2_util
INCLUDES = -I${CUTEST_HOME}/include -I$(top_builddir)/include \
            -I$(top_builddir)/modules/util/src
Index: test/Makefile.am
===================================================================
--- test/Makefile.am    (revision 354402)
+++ test/Makefile.am    (working copy)
@@ -1 +1 @@
-SUBDIRS = util xml unit core
+SUBDIRS = util xml unit core common
Index: test/util/Makefile.am
===================================================================
--- test/util/Makefile.am       (revision 354402)
+++ test/util/Makefile.am       (working copy)
@@ -4,6 +4,6 @@
AM_CPPFLAGS = $(CPPFLAGS)
test_util_SOURCES = test_util.c

-test_util_LDADD   =  $(LDFLAGS) -L$(top_builddir)/install/lib -laxis2_util
+test_util_LDADD   =  -L$(top_builddir)/install/lib -laxis2_util
INCLUDES = -I${CUTEST_HOME}/include -I$(top_builddir)/include \
            -I$(top_builddir)/modules/util/src
Index: modules/xml/soap/src/Makefile.am
===================================================================
--- modules/xml/soap/src/Makefile.am    (revision 354402)
+++ modules/xml/soap/src/Makefile.am    (working copy)
@@ -2,5 +2,5 @@
AM_CPPFLAGS = $(CPPFLAGS)
libaxis2_soap_la_SOURCES =

-libaxis2_soap_la_LIBADD = $(LDFLAGS)
+# libaxis2_soap_la_LIBADD = $(LDFLAGS)
INCLUDES = -I$(top_builddir)/include -I${CUTEST_HOME}/include
Index: modules/xml/om/src/Makefile.am
===================================================================
--- modules/xml/om/src/Makefile.am      (revision 354402)
+++ modules/xml/om/src/Makefile.am      (working copy)
@@ -13,7 +13,7 @@
axis2_om_stax_builder.c -libaxis2_om_la_LIBADD = $(LDFLAGS) ../../../util/src/libaxis2_util.la +libaxis2_om_la_LIBADD = ../../../util/src/libaxis2_util.la INCLUDES = -I$(top_builddir)/include \
            -I${CUTEST_HOME}/include \
            -I$(top_builddir)/modules/util/src \
Index: modules/xml/parser/guththila/impl/src/Makefile.am
===================================================================
--- modules/xml/parser/guththila/impl/src/Makefile.am   (revision 354402)
+++ modules/xml/parser/guththila/impl/src/Makefile.am   (working copy)
@@ -16,5 +16,5 @@
                            guththila_error.c \
                            guththila_hash.c

-libguththila_la_LIBADD = $(LDFLAGS)
+# libguththila_la_LIBADD = $(LDFLAGS)
INCLUDES = -I$(top_builddir)/include -I${CUTEST_HOME}/include Index: modules/xml/parser/guththila/src/Makefile.am
===================================================================
--- modules/xml/parser/guththila/src/Makefile.am        (revision 354402)
+++ modules/xml/parser/guththila/src/Makefile.am        (working copy)
@@ -3,7 +3,7 @@
libaxis2_guththila_la_SOURCES = guththila_xml_writer_wrapper.c \
guththila_xml_reader_wrapper.c
-libaxis2_guththila_la_LIBADD = $(LDFLAGS)
+# libaxis2_guththila_la_LIBADD = $(LDFLAGS)
INCLUDES = -I$(top_builddir)/include -I${CUTEST_HOME}/include \
            -I$(top_builddir)/modules/util/src \
            -I$(top_builddir)/modules/xml/parser \
Index: modules/xml/parser/libxml2/src/Makefile.am
===================================================================
--- modules/xml/parser/libxml2/src/Makefile.am  (revision 354402)
+++ modules/xml/parser/libxml2/src/Makefile.am  (working copy)
@@ -3,7 +3,7 @@
libaxis2_libxml2_la_SOURCES = axis2_libxml2_reader_wrapper.c \
                              axis2_libxml2_writer_wrapper.c

-libaxis2_libxml2_la_LIBADD = -L${LIBXML2_LIB} -lxml2 $(LDFLAGS)
+libaxis2_libxml2_la_LIBADD = -L${LIBXML2_LIB} -lxml2
INCLUDES = -I$(top_builddir)/include -I${CUTEST_HOME}/include \
            -I$(top_builddir)/modules/util/src \
            -I$(top_builddir)/modules/xml/parser \
Index: modules/xml/parser/Makefile.am
===================================================================
--- modules/xml/parser/Makefile.am      (revision 354402)
+++ modules/xml/parser/Makefile.am      (working copy)
@@ -1 +1 @@
-SUBDIRS = $(PULL_PARSER)
+SUBDIRS = guththila libxml2
Index: modules/common/src/Makefile.am
===================================================================
--- modules/common/src/Makefile.am      (revision 354402)
+++ modules/common/src/Makefile.am      (working copy)
@@ -2,7 +2,7 @@
AM_CPPFLAGS = $(CPPFLAGS)
libaxis2_common_la_SOURCES = axis2.c

-libaxis2_common_la_LIBADD = $(LDFLAGS)
+# libaxis2_common_la_LIBADD = $(LDFLAGS)
INCLUDES = -I${CUTEST_HOME}/include \
            -I$(top_builddir)/modules/util/src \
            -I$(top_builddir)/include
Index: modules/core/deployment/src/Makefile.am
===================================================================
--- modules/core/deployment/src/Makefile.am     (revision 354402)
+++ modules/core/deployment/src/Makefile.am     (working copy)
@@ -2,7 +2,7 @@
AM_CPPFLAGS = $(CPPFLAGS)
libaxis2_deployment_la_SOURCES = phases_info.c
-libaxis2_deployment_la_LIBADD = $(LDFLAGS)
+# libaxis2_deployment_la_LIBADD = $(LDFLAGS)
INCLUDES = -I${CUTEST_HOME}/include -I$(top_builddir)/include \
            -I$(top_builddir)/modules/xml/guththila/src \
            -I$(top_builddir)/modules/util/src \
Index: modules/core/handlers/src/Makefile.am
===================================================================
--- modules/core/handlers/src/Makefile.am       (revision 354402)
+++ modules/core/handlers/src/Makefile.am       (working copy)
@@ -2,7 +2,7 @@
AM_CPPFLAGS = $(CPPFLAGS)
libaxis2_handlers_la_SOURCES =
-libaxis2_handlers_la_LIBADD = $(LDFLAGS)
+# libaxis2_handlers_la_LIBADD = $(LDFLAGS)
INCLUDES = -I${CUTEST_HOME}/include \
            -I$(top_builddir)/include \
            -I$(top_builddir)/modules/util/src
Index: modules/core/phaseresolver/src/Makefile.am
===================================================================
--- modules/core/phaseresolver/src/Makefile.am  (revision 354402)
+++ modules/core/phaseresolver/src/Makefile.am  (working copy)
@@ -3,7 +3,7 @@
libaxis2_phaseresolver_la_SOURCES = phase_holder.c \
                                    phase_resolver.c

-libaxis2_phaseresolver_la_LIBADD = $(LDFLAGS)
+# libaxis2_phaseresolver_la_LIBADD = $(LDFLAGS)
INCLUDES = -I${CUTEST_HOME}/include -I$(top_builddir)/include \
            -I$(top_builddir)/modules/xml/guththila/src \
            -I$(top_builddir)/modules/util/src \
Index: modules/core/description/src/Makefile.am
===================================================================
--- modules/core/description/src/Makefile.am    (revision 354402)
+++ modules/core/description/src/Makefile.am    (working copy)
@@ -13,7 +13,7 @@
                            transport_in_desc.c \
                            transport_out_desc.c

-libaxis2_description_la_LIBADD = $(LDFLAGS)
+# libaxis2_description_la_LIBADD = $(LDFLAGS)
INCLUDES = -I${CUTEST_HOME}/include -I$(top_builddir)/include \
            -I$(top_builddir)/modules/xml/parser \
            -I$(top_builddir)/modules/util/src \
Index: modules/core/context/src/Makefile.am
===================================================================
--- modules/core/context/src/Makefile.am        (revision 354402)
+++ modules/core/context/src/Makefile.am        (working copy)
@@ -2,7 +2,7 @@
AM_CPPFLAGS = $(CPPFLAGS)
libaxis2_context_la_SOURCES = ctx.c msg_ctx.c operation_ctx.c svc_ctx.c 
svc_grp_ctx.c conf_ctx.c

-libaxis2_context_la_LIBADD = $(LDFLAGS)
+#libaxis2_context_la_LIBADD = $(LDFLAGS)
INCLUDES = -I${CUTEST_HOME}/include \
            -I$(top_builddir)/modules/xml/guththila/src \
            -I$(top_builddir)/include \
Index: modules/core/engine/src/Makefile.am
===================================================================
--- modules/core/engine/src/Makefile.am (revision 354402)
+++ modules/core/engine/src/Makefile.am (working copy)
@@ -2,7 +2,7 @@
AM_CPPFLAGS = $(CPPFLAGS)
libaxis2_engine_la_SOURCES = handler.c msg_recv.c engine_config.c phase.c

-libaxis2_engine_la_LIBADD = $(LDFLAGS)
+# libaxis2_engine_la_LIBADD = $(LDFLAGS)
INCLUDES = -I${CUTEST_HOME}/include \
            -I$(top_builddir)/modules/xml/guththila/src \
            -I$(top_builddir)/include \
Index: modules/core/Makefile.am
===================================================================
--- modules/core/Makefile.am    (revision 354402)
+++ modules/core/Makefile.am    (working copy)
@@ -1 +1 @@
-SUBDIRS = context engine handlers phaseresolver transport description 
deployment
+SUBDIRS = addr context engine handlers phaseresolver transport description 
deployment
Index: modules/core/addr/src/Makefile.am
===================================================================
--- modules/core/addr/src/Makefile.am   (revision 354402)
+++ modules/core/addr/src/Makefile.am   (working copy)
@@ -2,7 +2,7 @@
AM_CPPFLAGS = $(CPPFLAGS)
libaxis2_addr_la_SOURCES = relates_to.c svc_name.c any_content_type.c 
endpoint_ref.c

-libaxis2_addr_la_LIBADD = $(LDFLAGS)
+# libaxis2_addr_la_LIBADD = $(LDFLAGS)
INCLUDES = -I${CUTEST_HOME}/include \
            -I$(top_builddir)/include \
            -I$(top_builddir)/modules/util/src
Index: modules/wsdl/src/Makefile.am
===================================================================
--- modules/wsdl/src/Makefile.am        (revision 354402)
+++ modules/wsdl/src/Makefile.am        (working copy)
@@ -17,7 +17,7 @@
                        wsdl_extensible_element.c \
                        wsdl_soap_operation.c

-libaxis2_wsdl_la_LIBADD = $(LDFLAGS)
+# libaxis2_wsdl_la_LIBADD = $(LDFLAGS)
INCLUDES = -I$(top_builddir)/include \
            -I${CUTEST_HOME}/include \
            -I$(top_builddir)/modules/util/src \
Index: modules/util/src/Makefile.am
===================================================================
--- modules/util/src/Makefile.am        (revision 354402)
+++ modules/util/src/Makefile.am        (working copy)
@@ -12,6 +12,6 @@
                        array_list.c \
                        linked_list.c

-libaxis2_util_la_LIBADD = $(LDFLAGS)
+# libaxis2_util_la_LIBADD = $(LDFLAGS)
INCLUDES = -I$(top_builddir)/include -I${CUTEST_HOME}/include \
            -I$(top_builddir)/modules/util/src
Index: Makefile.am
===================================================================
--- Makefile.am (revision 354402)
+++ Makefile.am (working copy)
@@ -1,2 +1,2 @@
-SUBDIRS = modules
+SUBDIRS = modules test
include_HEADERS=$(top_builddir)/include/*.h

Reply via email to