configure.ac
96e22bfc
 AC_INIT([NetPathMiner]) dnl package name, version
96c95b02
 AC_CONFIG_SRCDIR(DESCRIPTION) dnl make sure the dir is an R package
96e22bfc
 
 dnl A user-specifiable option
 
 dnl Select an optional include path, from a configure option
 dnl or from an environment variable.
 
 
 
 : ${R_HOME=`R RHOME`}
 if test -z "${R_HOME}"; then
   echo "could not determine R_HOME"
   exit 1
 fi
 
 CC=`"${R_HOME}/bin/R" CMD config CC`
 CPP=`"${R_HOME}/bin/R" CMD config CPP`
 CFLAGS=`"${R_HOME}/bin/R" CMD config CFLAGS`
 CPPFLAGS=`"${R_HOME}/bin/R" CMD config CPPFLAGS`
 AC_PROG_CC
 AC_PROG_CPP
 
 AC_CHECK_LIB(xml2, xmlParseFile,, [XML=false])
 AC_CHECK_LIB(sbml, readSBML, , [SBML=false])
 
 
 #!/bin/sh
 if test -d ./src/boost.tar.gz;
e8bce056
   then
3fdf079f
       echo 'found boost header sources and tar archive;\n using what is there.'
   else
       echo "untarring boost include tree...";
       tar -zxf ./src/boost.tar.gz -C ./src;
96e22bfc
 fi;
 
 AC_DEFUN([CHECK_XML],[
3fdf079f
   AC_PATH_PROGS(XML_CONFIG, xml2-config)
   LIBXML_INCDIR="-DHAVE_XML `${XML_CONFIG} --cflags`"
   XML_LIBS=`${XML_CONFIG} --libs`
96e22bfc
 ])
 
 PKG_LIBS="${LIBS}"
 
 
 if ${SBML}
3fdf079f
   then
e8bce056
     echo 'libSBML found, finding configuration...';
     if type "pkg-config" > /dev/null
3fdf079f
       then
           PKG_CONFIG="pkg-config"
           echo "pkg-config tool found"
       else
         AC_PATH_PROG(PKG_CONFIG, pkg-config)
     fi;
e8bce056
 
3fdf079f
     SBMLPC="libsbml"
     if test -z `${PKG_CONFIG} --exists ${SBMLPC}`
       then
e8bce056
         SBMLPC=`locate libsbml.pc 2>/dev/null`
3fdf079f
     fi;
e8bce056
 
3fdf079f
     if test -n "${SBMLPC}"
       then
e8bce056
         echo "libsbml.pc found. Using pkg-config to extract it."
3fdf079f
         SBML_INCDIR="-DHAVE_SBML `${PKG_CONFIG} --cflags ${SBMLPC}`"
         SBML_LIBS=`${PKG_CONFIG} --libs ${SBMLPC}`
       else
         echo "Couldn't find libsbml.pc. Searching for libsbml in candidate directories."
         if test -d /usr/include/sbml
           then SBML_INCDIR="-DHAVE_SBML -I/usr/include/"
e8bce056
           else
3fdf079f
             if test -d /usr/local/include/sbml
               then SBML_INCDIR="-DHAVE_SBML -I/usr/local/include/"
             fi;
e8bce056
         fi;
3fdf079f
     fi;
e8bce056
     CHECK_XML()
572c4aad
         SBML_INCDIR="$LIBXML_INCDIR $SBML_INCDIR"
         SBML_LIBS="$XML_LIBS"
3fdf079f
     CPPFLAGS="${CPPFLAGS} ${SBML_INCDIR}"
     PKG_LIBS="${PKG_LIBS} ${SBML_LIBS} -lsbml"
e8bce056
 
3fdf079f
   else
     echo 'SBML not found.';
 
   if ${XML}
     then
       echo 'libXML2 found'
       CHECK_XML()
       CPPFLAGS="${CPPFLAGS} ${LIBXML_INCDIR}"
       PKG_LIBS="${PKG_LIBS} ${XML_LIBS}"
     else
       echo 'XML not found.';
   fi;
96e22bfc
 fi;
 
 
 dnl subsutitute varialbles in makevars
 AC_SUBST(CPPFLAGS)
 AC_SUBST(PKG_LIBS)
 
 AC_OUTPUT(src/Makevars)
 
 dnl cleanup after configure
 mv src/Makevars.in src/_Makevars.in_;
 rm config.*