Changeset 901 for trunk/configure.ac


Ignore:
Timestamp:
Nov 27, 2009, 1:47:36 AM (11 years ago)
Author:
Peter Johansson
Message:

refs #401 fixes #408

Modifications of detection of plplot;

  • detection of plplot will not fail due to absent pkg-config
  • if pkg-config is available and it finds pc file for plplot, then we use it to retrieve compiler/linker flags, otherwise we guess.
  • new AC_DEFINE(HAVE_PLPLOT)
  • configure now accepts --without-plplot (or --with-plplot=no) and tests are skipped (following build will currently not work)
  • added a test linking against plplot library
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure.ac

    r892 r901  
    171171
    172172# PLplot API checks
     173# plplot_found can get values: skip, noheader, old, or nolib if an
     174# error is detected.
    173175plplot_found="yes"
    174176plplot_version=5.9
     
    177179  [AS_HELP_STRING([--with-plplot=DIR],[prefix for plplot developer files])],
    178180  [DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-plplot=$withval"
    179    PKG_CONFIG_PATH=${withval}/lib/pkgconfig${PATH_SEPARATOR}${PKG_CONFIG_PATH}
    180    export PKG_CONFIG_PATH
     181   AS_IF([test "x$withval" = "xno"], [ dnl
     182     plplot_found=skip;
     183   ], [ dnl
     184     # help pkg-config find .pc file
     185     PKG_CONFIG_PATH=${withval}/lib/pkgconfig${PATH_SEPARATOR}${PKG_CONFIG_PATH}
     186     export PKG_CONFIG_PATH
     187   ])
    181188  ])
    182189
    183 # copy flags if pkg-config finds plplot
    184 PKG_CHECK_EXISTS([plplotd-c++], [
    185   YAT_CPP_ADD_FLAG([PLPLOT_CPPFLAGS], [`$PKG_CONFIG plplotd-c++ --cflags`])
    186   YAT_LD_ADD_FLAG([PLPLOT_LDFLAGS], [`$PKG_CONFIG plplotd-c++ --libs-only-L`])
    187   PLPLOT_LIBS="`$PKG_CONFIG plplotd-c++ --libs-only-l --libs-only-other`"
    188 ],[
    189   plplot_found=no-pkg-config
     190use_plplot_pc="no"
     191AS_IF([test "x$plplot_found" = "xyes" && test -n "$PKG_CONFIG"], [
     192  AC_MSG_CHECKING([for plplotd-c++.pc])
     193  AS_IF([$PKG_CONFIG --exists plplotd-c++], [
     194    AC_MSG_RESULT([yes])
     195    use_plplot_pc="yes"
     196  ],[
     197    AC_MSG_RESULT([no])
     198    AC_MSG_WARN([cannot find plplotd-c++;
     199      please use --with-plplot with appropriate argument to get more accurate
     200      configuration.])
     201  ])
     202])
     203
     204AS_IF([test "x$plplot_found" = "xyes"], [
     205  # copy flags if we have found pc file
     206  AS_IF([test "$use_plplot_pc" = "yes"], [
     207    YAT_CPP_ADD_FLAG([PLPLOT_CPPFLAGS], [`$PKG_CONFIG plplotd-c++ --cflags`])
     208    YAT_LD_ADD_FLAG([PLPLOT_LDFLAGS], [`$PKG_CONFIG plplotd-c++ --libs-only-L`])
     209    PLPLOT_LIBS="`$PKG_CONFIG plplotd-c++ --libs-only-l --libs-only-other`"
     210  ],[
     211    # otherwise guess
     212    PLPLOT_LIBS="-lplplotcxxd -lplplotd";
     213    AS_IF([test -n "$with_plplot" && test "x$with_plplot" != "xyes"], [
     214      YAT_CPP_ADD_FLAG([PLPLOT_CPPFLAGS], [$with_plplot/include])
     215      YAT_LD_ADD_FLAG([PLPLOT_LDFLAGS], [$with_plplot/libs])
     216    ])
     217  ])
    190218])
    191219                 
     
    197225])
    198226
    199 AS_IF([test "x$plplot_found" = "xyes"], [
    200   AS_IF([$PKG_CONFIG --atleast-version=$plplot_version plplotd-c++], [],[
    201     plplot_found="nolib"
     227
     228AS_IF([test "x$plplot_found" = "xyes" && test -n "$PKG_CONFIG"], [
     229  AC_MSG_CHECKING([plplot version >= $plplot_version])
     230  AS_IF([$PKG_CONFIG --atleast-version=$plplot_version plplotd-c++], [
     231    AC_MSG_RESULT([yes])
     232  ],[
     233    AC_MSG_RESULT([`$PKG_CONFIG --modversion= plplotd-c++`])
     234    plplot_found="old"
    202235  ])
    203236])
     237
     238AS_IF([test "x$plplot_found" = "xyes" && test -n "$PKG_CONFIG"], [
     239  save_LDFLAGS=$LDFLAGS
     240  LDFLAGS="$PLPLOT_LDFLAGS $LDFLAGS"
     241  save_LIBS=$LIBS
     242  LIBS="$PLPLOT_LIBS $LIBS"
     243  AC_MSG_CHECKING([for library containing plstream])
     244  AC_LINK_IFELSE([AC_LANG_PROGRAM([@%:@include <plplot/plstream.h>],
     245                                  [plstream pls(1,1,"svg", "conftest.svg")])],
     246                 [AC_MSG_RESULT([yes]);
     247                  AC_DEFINE([HAVE_PLPLOT], [1],
     248                            [Define to 1 if you have plplot])],
     249                 [AC_MSG_RESULT([no])
     250                  plplot_found=nolib;])
     251])
    204252# restore variable
     253LDFLAGS=$save_LDFLAGS
     254LIBS=$save_LIBS
    205255export PKG_CONFIG_PATH=$save_PKG_CONFIG_PATH
    206256AC_SUBST(PLPLOT_CPPFLAGS)
     
    212262AM_CONDITIONAL([HAVE_SVN_WC], [test "$wc_found" = "yes"])
    213263AC_SUBST([wc_found])
    214 
    215 # Reset FLAGS
    216 APR_RESTORE_THE_ENVIRONMENT([CPPFLAGS], [DEFAULT_])
    217 APR_RESTORE_THE_ENVIRONMENT([CXXFLAGS], [DEFAULT_])
    218264
    219265# checking if we have test repo
     
    235281dnl maintainer make rukes from yat project
    236282YAT_SVN_RELEASE
     283
     284# Restore FLAGS
     285APR_RESTORE_THE_ENVIRONMENT([CPPFLAGS], [DEFAULT_])
     286APR_RESTORE_THE_ENVIRONMENT([CXXFLAGS], [DEFAULT_])
    237287
    238288AC_CONFIG_FILES([Makefile
     
    304354
    305355# Non-existing PLplot API is fatal -- sub-sequent compilation will fail.
    306 if (test "$plplot_found" = "noheader") ; then
    307   AC_MSG_WARN([PLplot developer files cannot be found. Make sure PLplot
    308   is installed.])
    309   all_reqs_ok="false"
    310 elif (test "$plplot_found" = "nolib") ; then
    311   AC_MSG_WARN([PLplot developer files found but not required API version.
    312   Version at least $plplot_version is required. Please upgrade PLplot.])
    313   all_reqs_ok="false"
    314 elif (test "$plplot_found" = "no-pkg-config") ; then
    315   AC_MSG_WARN([cannot find pkg-config])
    316   all_reqs_ok="false"
    317 fi
     356AS_CASE([$plplot],
     357  [noheader],
     358    [AC_MSG_WARN([
     359    PLplot developer files cannot be found. Make sure PLplot is installed.])
     360    all_reqs_ok="false"],
     361  [old],
     362    [AC_MSG_WARN([
     363    PLplot developer files found but not required API version.
     364    Version at least $plplot_version is required. Please upgrade PLplot.])
     365    all_reqs_ok="false"],
     366  [nolib],
     367    [AC_MSG_WARN([
     368    PLplot developer files found but linking against plplot library failed.])
     369    all_reqs_ok="false"])
    318370
    319371if test $ac_cv_type_long_long_int != yes ; then
Note: See TracChangeset for help on using the changeset viewer.