Changeset 1159 for branches/0.8-stable


Ignore:
Timestamp:
Aug 10, 2010, 3:20:04 PM (9 years ago)
Author:
Peter Johansson
Message:

refs #467. Change how CPPFLAGS, CXXFLAGS and LDFLAGS are picked up
automagically in configure. First, save flag given by user. Second add
flags to e.g. LDFLAGS (based on --with-plplot etc) but add only values
not already in LDFLAGS. Third, calculate difference SVNDIGEST_LDFLAGS

LDFLAGS - LDFLAGS_init and restore LDFLAGS to LDFLAGS_init (given by

user). This implies we avoid multiple identical entries. For example,
before the linker could get 3 copies of '-L/opt/local/lib' because it
got one from APR_LDFLAGS, one from SVN_LDFLAGS, and one from
PLPLOT_LDFLAGS. It also means that if user gives ./configure -L/foo
-L/bar, configure will not add these paths into SVNDIGEST_LDFLAGS and
hence the user is in power of deciding the path order for the
linker/compiler.

Location:
branches/0.8-stable
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/0.8-stable/bin/Makefile.am

    r1119 r1159  
    3434LDADD = $(top_builddir)/lib/libsvndigest.a \
    3535  $(top_builddir)/yat/libyat.a $(SVN_LIBS) $(APR_LIBS) $(PLPLOT_LIBS)
    36 AM_LDFLAGS = $(APR_LDFLAGS) $(SVN_LDFLAGS) $(PLPLOT_LDFLAGS)
     36AM_LDFLAGS = $(SVNDIGEST_LDFLAGS)
    3737
    38 AM_CPPFLAGS  = -I$(top_srcdir) $(DEFAULT_CPPFLAGS) \
    39   $(APR_CPPFLAGS) $(SVN_CPPFLAGS) $(PLPLOT_CPPFLAGS)
    40 AM_CXXFLAGS = $(DEFAULT_CXXFLAGS)
     38AM_CPPFLAGS  = -I$(top_srcdir) $(SVNDIGEST_CPPFLAGS)
     39AM_CXXFLAGS = $(SVNDIGEST_CXXFLAGS)
    4140
    4241##svndigest_LDADD = $(LDADD) $(PLPLOT_LIBS)
  • branches/0.8-stable/configure.ac

    r1139 r1159  
    143143    for i in $apr_link_ld; do
    144144      AS_IF([test ${i:0:2} = "-l"],[APR_LIBS="$i $APR_LIBS"],
    145             [YAT_LD_ADD_FLAG([APR_LDFLAGS], [$i])])
     145            [YAT_LD_ADD_FLAG([LDFLAGS], [$i])])
    146146    done
    147     YAT_CPP_ADD_FLAG([APR_CPPFLAGS],[`$apr_config --includes --cppflags`])
    148     save_CPPFLAGS=$CPPFLAGS
    149     CPPFLAGS="$APR_CPPFLAGS $CPPFLAGS"
     147    YAT_CPP_ADD_FLAG([CPPFLAGS],[`$apr_config --includes --cppflags`])
    150148    AC_CHECK_HEADER([apr_allocator.h],,[apr_found="no"])
    151     CPPFLAGS=$save_CPPFLAGS
    152 fi
    153 AC_SUBST([APR_CPPFLAGS])
    154 AC_SUBST([APR_LDFLAGS])
     149fi
    155150AC_SUBST([APR_LIBS])
    156151
     
    166161    with_svn=`cd $with_svn && pwd`
    167162    DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-svn=$with_svn"
    168     YAT_LD_ADD_FLAG([SVN_LDFLAGS], [-L$with_svn/lib])
    169     YAT_CPP_ADD_FLAG([SVN_CPPFLAGS], [-I$with_svn/include])
     163    YAT_LD_ADD_FLAG([LDFLAGS], [-L$with_svn/lib])
     164    YAT_CPP_ADD_FLAG([CPPFLAGS], [-I$with_svn/include])
    170165  ])
    171166# svn needs needs apr headers
    172 save_CPPFLAGS=$CPPFLAGS
    173 CPPFLAGS="$APR_CPPFLAGS $SVN_CPPFLAGS $CPPFLAGS"
    174167AC_CHECK_HEADER([subversion-1/svn_types.h],,[svn_found="no"])
    175 CPPFLAGS=$save_CPPFLAGS
    176 
    177 save_LDFLAGS=$LDFLAGS
     168
    178169save_LIBS=$LIBS
    179170tmp_LIBS="$APR_LIBS $save_LIBS"
    180171LIBS=""
    181 LDFLAGS="$SVN_LDFLAGS $APR_LDFLAGS"
    182172AC_SEARCH_LIBS([svn_cmdline_setup_auth_baton],[svn_subr-1],
    183173               [], [svn_found="no"], [$tmp_LIBS])
     
    189179SVN_LIBS=$LIBS
    190180LIBS=$save_LIBS
    191 LDFLAGS=$save_LDFLAGS
    192 AC_SUBST([SVN_CPPFLAGS])
    193 AC_SUBST([SVN_LDFLAGS])
    194181AC_SUBST([SVN_LIBS])
    195182
     
    236223  # copy flags if we have found pc file
    237224  AS_IF([test "$use_plplot_pc" = "yes"], [
    238     YAT_LD_ADD_FLAG([PLPLOT_LDFLAGS], [`$PKG_CONFIG plplotd-c++ --libs-only-L`])
     225    YAT_LD_ADD_FLAG([LDFLAGS], [`$PKG_CONFIG plplotd-c++ --libs-only-L`])
    239226    PLPLOT_LIBS="`$PKG_CONFIG plplotd-c++ --libs-only-l --libs-only-other`"
    240227  ],[
     
    242229    PLPLOT_LIBS="-lplplotcxxd -lplplotd";
    243230    AS_IF([test -n "$with_plplot" && test "x$with_plplot" != "xyes"], [
    244       YAT_LD_ADD_FLAG([PLPLOT_LDFLAGS], [-L$with_plplot/libs])
     231      YAT_LD_ADD_FLAG([LDFLAGS], [-L$with_plplot/libs])
    245232    ])
    246233  ])
     
    248235  # `PREFIX/include/plplot' rather than `PREFIX/include'
    249236  AS_IF([test -n "$with_plplot" && test "x$with_plplot" != "xyes"], [
    250     YAT_CPP_ADD_FLAG([PLPLOT_CPPFLAGS], [-I$with_plplot/include])
     237    YAT_CPP_ADD_FLAG([CPPFLAGS], [-I$with_plplot/include])
    251238  ])
    252239])
    253240                 
    254241AS_IF([test "x$plplot_found" = "xyes"], [
    255   save_CPPFLAGS=$CPPFLAGS
    256   CPPFLAGS="$PLPLOT_CPPFLAGS $CPPFLAGS"
    257242  AC_CHECK_HEADER([plplot/plstream.h], [], [plplot_found="noheader"])
    258   CPPFLAGS=$save_CPPFLAGS
    259243])
    260244
     
    271255
    272256AS_IF([test "x$plplot_found" = "xyes"], [
    273   save_CPPFLAGS=$CPPFLAGS
    274   CPPFLAGS="$PLPLOT_CPPFLAGS $CPPFLAGS"
    275   save_LDFLAGS=$LDFLAGS
    276   LDFLAGS="$PLPLOT_LDFLAGS $LDFLAGS"
    277257  save_LIBS=$LIBS
    278258  LIBS="$PLPLOT_LIBS $LIBS"
     
    287267                 [AC_MSG_RESULT([no])
    288268                  plplot_found=nolib;])
    289   CPPFLAGS=$save_CPPFLAGS
    290   LDFLAGS=$save_LDFLAGS
    291269  LIBS=$save_LIBS
    292270])
    293271# restore variable
    294272export PKG_CONFIG_PATH=$save_PKG_CONFIG_PATH
    295 AC_SUBST(PLPLOT_CPPFLAGS)
    296 AC_SUBST(PLPLOT_LDFLAGS)
    297273AC_SUBST(PLPLOT_LIBS)
    298274
     
    320296
    321297# Restore FLAGS
    322 APR_RESTORE_THE_ENVIRONMENT([CPPFLAGS], [DEFAULT_])
    323 APR_RESTORE_THE_ENVIRONMENT([CXXFLAGS], [DEFAULT_])
     298APR_RESTORE_THE_ENVIRONMENT([CPPFLAGS], [SVNDIGEST_])
     299APR_RESTORE_THE_ENVIRONMENT([CXXFLAGS], [SVNDIGEST_])
     300APR_RESTORE_THE_ENVIRONMENT([LDFLAGS], [SVNDIGEST_])
    324301
    325302AC_CONFIG_FILES([Makefile
     
    428405+++++++++++++++++++++++++++++++++++++++++++++++
    429406  Compiler:           $CXX
    430   Preprocessor flags: $SD_CPPFLAGS $CPPFLAGS
    431     CPPFLAGS:         $CPPFLAGS
    432     DEFAULT_CPPFLAGS: $DEFAULT_CPPFLAGS
    433     APR_CPPFLAGS:     $APR_CPPFLAGS
    434     SVN_CPPFLAGS:     $SVN_CPPFLAGS
    435     PLPLOT_CPPFLAGS:  $PLPLOT_CPPFLAGS
     407  Preprocessor flags:
     408    CPPFLAGS:           $CPPFLAGS
     409    SVNDIGEST_CPPFLAGS: $SVNDIGEST_CPPFLAGS
    436410  C++ flags:
    437     CXXFLAGS:         $CXXFLAGS
    438     DEFAULT_CXXFLAGS: $DEFAULT_CXXFLAGS
     411    CXXFLAGS:           $CXXFLAGS
     412    SVNDIGEST_CXXFLAGS: $SVNDIGEST_CXXFLAGS
    439413  Linker flags:
    440     LDFLAGS:          $LDFLAGS
    441     APR_LDFLAGS:      $APR_LDFLAGS
    442     SVN_LDFLAGS:      $SVN_LDFLAGS
    443     PLPLOT_LDFLAGS:   $PLPLOT_LDFLAGS
     414    LDFLAGS:            $LDFLAGS
     415    SVNDIGEST_LDFLAGS:  $SVNDIGEST_LDFLAGS
    444416  Libraries:         
    445     LIBS              $LIBS
    446     APR_LIBS          $APR_LIBS
    447     SVN_LIBS          $SVN_LIBS
    448     PLPLOT_LIBS       $PLPLOT_LIBS
     417    LIBS                $LIBS
     418    APR_LIBS            $APR_LIBS
     419    SVN_LIBS            $SVN_LIBS
     420    PLPLOT_LIBS         $PLPLOT_LIBS
    449421+++++++++++++++++++++++++++++++++++++++++++++++]dnl
    450422)
  • branches/0.8-stable/lib/Makefile.am

    r1119 r1159  
    2525SVN_REVISION = `$(SVNVERSION) $(top_srcdir)`
    2626
    27 AM_CPPFLAGS = -I$(top_srcdir) $(DEFAULT_CPPFLAGS) \
    28   $(APR_CPPFLAGS) $(SVN_CPPFLAGS) $(PLPLOT_CPPFLAGS)
    29 AM_CXXFLAGS = $(DEFAULT_CXXFLAGS)
     27AM_CPPFLAGS = -I$(top_srcdir) $(SVNDIGEST_CPPFLAGS)
     28AM_CXXFLAGS = $(SVNDIGEST_CXXFLAGS)
    3029
    3130noinst_LIBRARIES = libsvndigest.a
  • branches/0.8-stable/test/Makefile.am

    r1119 r1159  
    6060  $(top_builddir)/yat/libyat.a \
    6161  $(SVN_LIBS) $(APR_LIBS) $(PLPLOT_LIBS)
    62 AM_LDFLAGS = $(APR_LDFLAGS) $(SVN_LDFLAGS) $(PLPLOT_LDFLAGS)
     62AM_LDFLAGS = $(SVNDIGEST_LDFLAGS)
    6363
    64 AM_CPPFLAGS = -I$(top_srcdir) $(APR_CPPFLAGS) $(SVN_CPPFLAGS) \
    65   $(DEFAULT_CPPFLAGS) $(PLPLOT_CPPFLAGS)
    66 AM_CXXFLAGS = $(DEFAULT_CXXFLAGS)
     64AM_CPPFLAGS = -I$(top_srcdir) $(SVNDIGEST_CPPFLAGS)
     65AM_CXXFLAGS = $(SVNDIGEST_CXXFLAGS)
    6766
    6867libsvndigesttest_a_SOURCES = Suite.cc
Note: See TracChangeset for help on using the changeset viewer.