Changeset 1892


Ignore:
Timestamp:
Apr 14, 2009, 12:33:37 AM (13 years ago)
Author:
Peter
Message:

Removed dependency to cblas in libyat. There are three new make
variables: YAT_LIBS, YAT_LIBS_WITHOUT_CLAS and YAT_CBLAS_LIB.

  • The variable YAT_LIBS is created as follows: First the LIBS provided

by user is saved (most often empty). Then when detecting libs, they
are added to the variable LIBS and in the end of the configure run
YAT_LIBS is created as the difference between LIBS and the original
LIBS.

  • YAT_CLAS_LIB is detected as before.
  • YAT_LIBS_WITHOUT_CLAS is copied from YAT_LIBS but ignoring YAT_CLAS_LIB

I also changed the name of some variables to make the code clearer (I
hope). The prefix INTERNAL_ is used for flags that should only be used
when building yat and not needed for a user building against
yat. Flags that should be propagated have no prefix, for example,
CPPFLAGS.

In the end of configure these flags are used to create YAT_CPPFLAGS
using the same mechanism as when creating YAT_LIBS.

In the last step variables such as AM_CPPFLAGS is created as the
'union' of YAT_CPPFLAGS and INTERNAL_CPPFLAGS and these are propagated
to the Makefiles where they are used by Automake generated rules.

refs #518

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/build_support/Makefile.am

    r1846 r1892  
    4444  -e 's|@LDFLAGS[@]|$(LDFLAGS)|g' \
    4545  -e 's|@LIBS[@]|$(LIBS)|g' \
    46   -e 's|@EXTRA_CPPFLAGS[@]|$(EXTRA_CPPFLAGS)|g' \
    47   -e 's|@EXTRA_CXXFLAGS[@]|$(EXTRA_CXXFLAGS)|g' \
    48   -e 's|@EXTRA_LDFLAGS[@]|$(EXTRA_LDFLAGS)|g' \
     46  -e 's|@YAT_CBLAS_LIB[@]|$(YAT_CBLAS_LIB)|g' \
     47  -e 's|@YAT_CPPFLAGS[@]|$(YAT_CPPFLAGS)|g' \
     48  -e 's|@YAT_CXXFLAGS[@]|$(YAT_CXXFLAGS)|g' \
     49  -e 's|@YAT_LDFLAGS[@]|$(YAT_LDFLAGS)|g' \
     50  -e 's|@YAT_LIBS[@]|$(YAT_LIBS)|g' \
    4951  -e 's|@PACKAGE[@]|$(PACKAGE)|g' \
    5052  -e 's|@PACKAGE_BUGREPORT[@]|$(PACKAGE_BUGREPORT)|g' \
  • trunk/build_support/yat-config.in

    r1857 r1892  
    3333LDFLAGS="@LDFLAGS@"
    3434LIBS="@LIBS@"
    35 EXTRA_CPPFLAGS="@EXTRA_CPPFLAGS@"
    36 EXTRA_CXXFLAGS="@EXTRA_CXXFLAGS@"
    37 EXTRA_LDFLAGS="@EXTRA_LDFLAGS@"
     35YAT_CPPFLAGS="@YAT_CPPFLAGS@"
     36YAT_CXXFLAGS="@YAT_CXXFLAGS@"
     37YAT_LDFLAGS="@YAT_LDFLAGS@"
     38YAT_LIBS="@YAT_LIBS@"
     39
     40# FIXME, this should honor environment variable
     41YAT_CBLAS_LIB=@YAT_CBLAS_LIB@
    3842
    3943LA_FILE="$libdir/lib@YAT_LIBNAME@.la"
     
    121125       flags="$flags -I@abs_top_srcdir@ -I@abs_top_builddir@"
    122126    fi
    123     flags="$flags $EXTRA_CPPFLAGS $CPPFLAGS"
     127    flags="$flags $YAT_CPPFLAGS $CPPFLAGS"
    124128    ;;
    125129    --cxxflags)
    126     flags="$flags $EXTRA_CXXFLAGS $CXXFLAGS"
     130    flags="$flags $YAT_CXXFLAGS $CXXFLAGS"
    127131    ;;
    128132    --libs)
    129     flags="$flags -l@YAT_LIBNAME@ $LIBS"
     133    flags="$flags -l@YAT_LIBNAME@ $YAT_LIBS $LIBS"
    130134    ;;
    131135    --ldflags)
     
    138142      flags="$flags -L$libdir"
    139143    fi
    140     flags="$flags $EXTRA_LDFLAGS $LDFLAGS"
     144    flags="$flags $YAT_LDFLAGS $LDFLAGS"
    141145    ;;
    142146    --link-libtool)
    143     flags="$flags $LA_FILE"
     147    flags="$flags $LA_FILE $YAT_CBLAS_LIB"
    144148    ;;
    145149    --atleast-version=*)
  • trunk/build_support/yat.pc.in

    r1797 r1892  
    2929Version: @VERSION@
    3030Requires: gsl >= @gsl_version@
    31 Libs: -L${libdir} -l@YAT_LIBNAME@ @EXTRA_LDFLAGS@ @LDFLAGS@
    32 Cflags: @EXTRA_CPPFLAGS@ @EXTRA_CXXFLAGS@ @CPPFLAGS@ @CXXFLAGS@ -I${includedir}
     31Libs: -L${libdir} -l@YAT_LIBNAME@ @YAT_LDFLAGS@ @LDFLAGS@
     32Cflags: @YAT_CPPFLAGS@ @YAT_CXXFLAGS@ @CPPFLAGS@ @CXXFLAGS@ -I${includedir}
  • trunk/configure.ac

    r1842 r1892  
    120120APR_SAVE_THE_ENVIRONMENT(CXXFLAGS)
    121121APR_SAVE_THE_ENVIRONMENT(LDFLAGS)
     122APR_SAVE_THE_ENVIRONMENT(LIBS)
    122123
    123124# Checks for libraries.
     
    138139                   atlas_found="partial",-m64),
    139140      AC_SEARCH_LIBS(cblas_dswap,gslcblas,gslcblas_found="yes"),-m64),)
    140 # CBLAS used in test of GSL
    141 gsl_cblas_lib=-lgslcblas
     141
     142YAT_CBLAS_LIB=-lgslcblas
    142143if test ${cblas_found} = "yes"; then
    143   gsl_cblas_lib=-lcblas
     144  YAT_CBLAS_LIB=-lcblas
    144145fi
    145146if test ${atlas_found} = "yes"; then
    146   YAT_CXX_ADD_FLAG([CXXFLAGS], [-m64])
     147  YAT_CXX_ADD_FLAG([CXXFLAGS], [-m64])
    147148  YAT_LD_ADD_FLAG([LDFLAGS], [-m64])
    148   gsl_cblas_lib=-latlas
    149 fi
    150 export GSL_CBLAS_LIB=${gsl_cblas_lib}
     149  YAT_CBLAS_LIB=-latlas
     150fi
     151# used in test of gsl
     152export GSL_CBLAS_LIB=${YAT_CBLAS_LIB}
     153AC_SUBST(YAT_CBLAS_LIB)
     154
    151155
    152156# GNU Scientific Library, GSL http://www.gnu.org/software/gsl/, checks
     
    159163   LIBS="-lgsl $LIBS"
    160164   # grep words starting with '-L' in other words LDFLAGS
    161   for i in $GSL_LIBS; do
    162     if test ${i:0:2} = "-L"; then
     165  for i in $GSL_LIBS; do
     166    if test ${i:0:2} = "-L"; then
    163167       YAT_LD_ADD_FLAG([LDFLAGS], [$i])
    164168     fi
     
    180184fi
    181185
    182 # we use AM_* for variables that are solely needed for building yat,
    183 # i.e., they are not needed for a user of yat and are not propagated
    184 # to yat-config or yat.m4.
    185 YAT_CXX_ADD_FLAG([AM_CXXFLAGS], [-Wall -pedantic])
    186 YAT_CPP_ADD_FLAG([AM_CPPFLAGS], [-DHAVE_INLINE=1])
     186# we use prefix INTERNAL_ for variables that are solely needed for
     187# building yat, i.e., they are not needed for a user of yat and are
     188# not propagated to yat-config or yat.m4.
     189YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-Wall -pedantic])
     190YAT_CPP_ADD_FLAG([INTERNAL_CPPFLAGS], [-DHAVE_INLINE=1])
    187191AC_ARG_ENABLE([debug],
    188192  [AS_HELP_STRING([--enable-debug],[turn on debug options and code])])
    189193if test "${enable_debug}" = "yes" ; then
    190   YAT_CPP_ADD_FLAG([AM_CPPFLAGS], [-DYAT_DEBUG=1])
    191   YAT_CXX_ADD_FLAG([AM_CXXFLAGS], [-g -O])
     194  YAT_CPP_ADD_FLAG([INTERNAL_CPPFLAGS], [-DYAT_DEBUG=1])
     195  YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-g -O])
    192196else
    193   YAT_CPP_ADD_FLAG([AM_CPPFLAGS], [-DGSL_RANGE_CHECK_OFF -DNDEBUG])
    194   YAT_CXX_ADD_FLAG([AM_CXXFLAGS], [-O3])
     197  YAT_CPP_ADD_FLAG([INTERNAL_CPPFLAGS], [-DGSL_RANGE_CHECK_OFF -DNDEBUG])
     198  YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-O3])
    195199fi
    196200
     
    286290YAT_LIB_LOCATION="yat"
    287291AC_SUBST(YAT_LIBNAME)
    288 AC_SUBST(YAT_LIB)
    289292AC_SUBST(YAT_LIB_LOCATION)
    290293
     
    400403
    401404# Reset flags
    402 APR_RESTORE_THE_ENVIRONMENT(CPPFLAGS, EXTRA_)
    403 APR_RESTORE_THE_ENVIRONMENT(CXXFLAGS, EXTRA_)
    404 APR_RESTORE_THE_ENVIRONMENT(LDFLAGS, EXTRA_)
    405 
    406 AM_CPPFLAGS="-I\$(top_srcdir) $AM_CPPFLAGS $EXTRA_CPPFLAGS"
    407 AM_CXXFLAGS="$AM_CXXFLAGS $EXTRA_CXXFLAGS"
    408 AM_LDFLAGS="$AM_LDFLAGS $EXTRA_LDFLAGS"
     405APR_RESTORE_THE_ENVIRONMENT(CPPFLAGS, YAT_)
     406APR_RESTORE_THE_ENVIRONMENT(CXXFLAGS, YAT_)
     407APR_RESTORE_THE_ENVIRONMENT(LDFLAGS, YAT_)
     408APR_RESTORE_THE_ENVIRONMENT(LIBS, YAT_)
     409
     410# set and AC_SUBST variables that are interpreted by Automake
     411AM_CPPFLAGS="-I\$(top_srcdir) $INTERNAL_CPPFLAGS $YAT_CPPFLAGS"
     412AM_CXXFLAGS="$INTERNAL_CXXFLAGS $YAT_CXXFLAGS"
     413AM_LDFLAGS="$INTERNAL_LDFLAGS $YAT_LDFLAGS"
    409414
    410415AC_SUBST(AM_CPPFLAGS)
    411416AC_SUBST(AM_CXXFLAGS)
    412417AC_SUBST(AM_LDFLAGS)
     418
     419
     420for i in $YAT_LIBS; do
     421  AS_IF([test "x$i" != "x$YAT_CBLAS_LIB"],
     422        [YAT_LIBS_WITHOUT_CBLAS="$YAT_LIBS_WITHOUT_CBLAS $i"])
     423done
     424AC_SUBST(YAT_LIBS_WITHOUT_CBLAS)
    413425
    414426# Create output.
     
    427439AC_MSG_NOTICE([  AM_LDFLAGS=$AM_LDFLAGS])
    428440AC_MSG_NOTICE([  LIBS=$LIBS])
     441AC_MSG_NOTICE([  YAT_LIBS=$YAT_LIBS])
    429442AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
    430443AC_MSG_NOTICE([])
  • trunk/test/Makefile.am

    r1878 r1892  
    8282EXTRA_DIST = $(DISTRIBUTED_TESTS)
    8383
    84 LDADD = $(top_builddir)/$(YAT_LIB_LOCATION)/libyat.la libyattest.la
     84LDADD = $(top_builddir)/$(YAT_LIB_LOCATION)/libyat.la libyattest.la $(YAT_LIBS)
    8585
    8686libyattest_la_SOURCES = Suite.cc
  • trunk/yat/Makefile.am

    r1497 r1892  
    3939  regression/libregression.la \
    4040  statistics/libstatistics.la \
    41   utility/libutility.la
     41  utility/libutility.la \
     42  $(YAT_LIBS_WITHOUT_CBLAS)
Note: See TracChangeset for help on using the changeset viewer.