Skip to content

minus I and minus L flags

2 messages · Brian Ripley, Dirk Eddelbuettel

#
[This is getting rather technical, so moved to R-devel.]
On Sun, 20 Feb 2005, Charles Geyer wrote:

            
Configure helps if there is a well-known and exhaustive set of possible 
locations.  Otherwise src/Makevars saying

PKG_CPPFLAGS = -I$(FOO_INCLUDE)
PKG_LIBS = -L$(FOO_LDPATH)

and instructions to the user to set the environment variables FOO_INCLUDE 
amd FOO_LDPATH is a good compromise (except perhaps for the auto-builders 
and auto-testers at CRAN).

I looked at the examples on CRAN, and failed to find one that allowed 
users to specify the paths flexibly.  RQuantian mentioned by Dirk does 
allow the Boost paths to be set, but not the quantlib-config path (at 
least it is not mentioned in RQuantian/configure --help), and it appears 
not be make use of the Boost paths that can be set. (Dirk: surely they 
need to be appended to pkg_cxxflags and pkg_libs?)

Here is a working example planned for RODBC:

src/Makevars.in:
PKG_CPPFLAGS=@CPPFLAGS@
PKG_LIBS=@LIBS@

configure.ac:
AC_INIT(DESCRIPTION)

AC_ARG_WITH([odbc-include],
             AC_HELP_STRING([--with-odbc-include=INCLUDE_PATH],
                            [the location of ODBC header files]),
             [odbc_include_path=$withval])
if test [ -n "$odbc_include_path" ] ; then
    AC_SUBST([CPPFLAGS],["-I${odbc_include_path} ${CPPFLAGS}"])
else
   if test [ -n "${ODBC_INCLUDE}" ] ; then
      AC_SUBST([CPPFLAGS],["-I${ODBC_INCLUDE} ${CPPFLAGS}"])
   fi
fi

AC_ARG_WITH([odbc-lib],
             AC_HELP_STRING([--with-odbc-lib=LIB_PATH],
                            [the location of ODBC libraries]),
             [odbc_lib_path=$withval])
if test [ -n "$odbc_lib_path" ] ; then
    AC_SUBST([LIBS],[" -L${odbc_lib_path} ${LIBS}"])
else
   if test [ -n "${ODBC_LIB}" ] ; then
      AC_SUBST([LIBS],["-I${ODBC_LIB} ${LIBS}"])
   fi
fi

AC_SEARCH_LIBS(SQLTables, odbc odbc32 iodbc,,
 	AC_MSG_ERROR("no ODBC driver manager found"))

AC_SUBST(CPPFLAGS)
AC_SUBST(LIBS)
AC_OUTPUT(src/Makevars)


Then just running 'autoconf' in the top directory makes configure, and

configure --help

lists the options.
#
On 21 February 2005 at 10:17, Prof Brian Ripley wrote:
| [This is getting rather technical, so moved to R-devel.]

Yup.

| I looked at the examples on CRAN, and failed to find one that allowed 
| users to specify the paths flexibly.  RQuantian mentioned by Dirk does 

(Nit: RQuantLib, not RQuantian)

| allow the Boost paths to be set, but not the quantlib-config path (at 
| least it is not mentioned in RQuantian/configure --help), and it appears 

I plead guiltu to ignoring the run-time switches to configure. QuantLib makes
use of configuration helper script quantlib-config, and boost "worked" so far.

| not be make use of the Boost paths that can be set. (Dirk: surely they 
| need to be appended to pkg_cxxflags and pkg_libs?)

I'm a bit puzzled about that:

edd@basebud:~> ldd /usr/lib/R/site-library/RQuantLib/libs/RQuantLib.so
        libQuantLib-0.3.8.so => /usr/lib/libQuantLib-0.3.8.so (0x400d2000)
        libR.so => not found
        libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x40577000)
        libm.so.6 => /lib/libm.so.6 (0x40631000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x40653000)
        libc.so.6 => /lib/libc.so.6 (0x4065c000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)
edd@basebud:~> 

Apparently it doesn't need boost to resolve the .so loaded into R. It does
need the headers to compile. And it runs fine.

But your point is well taken. I should extend the configure.in one day. 

Dirk