A couple low-level questions

LeeDuke
2007-05-24
2013-03-15
  • LeeDuke
    LeeDuke
    2007-05-24

    I'm trying to use PLplot in a C++ program. I can get the source to compile, but I cannot figure out which libraries to load with the program. So I really have two questions:

    1. What libraries do I load when I'm making an executable that includes PLplot?

    2. What do I add to configure.in and makefile.am to insure that the system can find these libraries automatically?

    Thanks,

    Lee

     
    • LeeDuke
      LeeDuke
      2007-05-24

      Actually, I found what I was looking for "plplot-config"

      Using that I can set up my configure.in file:

          PLPLOTCONFIG=plplot-config
          AC_ARG_WITH(plplot-config,
          [[  --with-plplot-config=""    Use the given path to plplot-config when determining
                                         plplot  configuration; defaults to "plplot-config"]],
          [
              if test "$withval" != "yes" -a "$withval" != ""; then
                  PLPLOTCONFIG=$withval
              fi
          ])

          plplotversion=0

          AC_DEFUN([PLPLOTTEST],
          [
              AC_REQUIRE([AC_PROG_AWK])
              AC_MSG_CHECKING([plplot  version])
              if plplotversion=`$PLPLOTCONFIG --version`; then
                  AC_MSG_RESULT([$plplotversion])
              else
                  AC_MSG_RESULT([not found])
                  AC_MSG_ERROR([plplot  is required. Try --with-plplot-config.])
              fi])

          # Call PLPLOTTEST func
          PLPLOTTEST

          # Verify minimus requires
          vers=`echo $plplotversion | $AWK 'BEGIN { FS = "."; } { printf "% d", ($1 * 1000 + $2) * 1000 + $3;}'`
          if test -n "$vers" && test "$vers" -ge 5006001; then
              PLPLOT_CPPFLAGS="`$PLPLOTCONFIG --cflags`"
              PLPLOT_CXXFLAGS="`$PLPLOTCONFIG --cflags`"
              PLPLOT_LIBS="`$PLPLOTCONFIG --libs --with-c++`"
          else
              AC_MSG_ERROR([plplot  5.6.1 or newer is required])
          fi

          AC_SUBST(PLPLOT_LIBS)

          CPPFLAGS="$CPPFLAGS   $PLPLOT_CPPFLAGS"
          CXXFLAGS="$CXXFLAGS $PLPLOT_CXXFLAGS"

      Then in my "Makefile.am" file I add:

          myprogramname_LDDFLAGS = $(PLPLOT_LIBS)

      And then I have a platform independent configuration. After running
          autoscan
          aclocal
          automake
          autoconf
          ./configure
          make

      I am in business.