Diff of /configure.ac [2f024f] .. [213c3f] Maximize Restore

  Switch to side-by-side view

--- a/configure.ac
+++ b/configure.ac
@@ -1,28 +1,21 @@
-AC_INIT([rjags], [0.1])
+AC_INIT([rjags], [0.99.1])
 
 dnl Get location of JAGS library and header files from configure option or 
 dnl environment variable. Failing that, assume it is installed in ${libdir} 
 
-AC_ARG_WITH([jags-home],
-   AC_HELP_STRING([--with-jags-home=JAGS_HOME_PATH], [the location of JAGS]),
-                  [jags_home_path=$withval])
-if test [ -n "$jags_home_path" ] ; then
-   AC_SUBST([JAGS_HOME],["${jags_home_path}"])
-   AC_SUBST([JAGS_MODULES],["${jags_home_path}/modules"])
-   AC_SUBST([CPPFLAGS],["-I${jags_home_path}/include ${CPPFLAGS}"])
-elif test [ -n "${JAGS_HOME}" ] ; then
-   AC_SUBST([JAGS_HOME],["${JAGS_HOME}"])
-   AC_SUBST([JAGS_MODULES],["${JAGS_HOME}/modules"])
-   AC_SUBST([CPPFLAGS],["-I${JAGS_HOME}/include ${CPPFLAGS}"])
-else
-   AC_SUBST([JAGS_HOME],["/usr/local/lib/jags"])
-   AC_SUBST([JAGS_MODULES],["/usr/local/lib/jags/modules"])
-   AC_SUBST([CPPFLAGS],["-I/usr/local/lib/jags/include ${CPPFLAGS}"])
+AC_ARG_WITH([jags],
+   AC_HELP_STRING([--with-jags=JAGS_HOME], [the ocation of the JAGS pkgconfig file]), [JAGS_ROOT=$withval])
+
+if ! test -z "${JAGS_ROOT}"; then
+   export PKG_CONFIG_PATH=${JAGS_ROOT}:$PKG_CONFIG_PATH
 fi
 
-AC_SUBST(CPPFLAGS)
-AC_SUBST(LIBS)
-AC_SUBST(JAGS_HOME)
+PKG_CHECK_MODULES(JAGS, [jags = $PACKAGE_VERSION])
+AC_SUBST(JAGS_CFLAGS)
+AC_SUBST(JAGS_LIBS)
+
+JAGS_MODDIR=`$PKG_CONFIG --variable=moduledir jags`
+AC_SUBST(JAGS_MODDIR)
 
 AC_OUTPUT(src/Makevars)
 AC_OUTPUT(R/zzz.R)