Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Diff of /configure.ac [144049] .. [16c8b4] Maximize Restore

  Switch to side-by-side view

--- a/configure.ac
+++ b/configure.ac
@@ -1,21 +1,63 @@
 AC_INIT([rjags], [1.0.2])
 
-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_PREFIX_PROGRAM(jags)
 
-AC_ARG_WITH([jags],
-   AC_HELP_STRING([--with-jags=JAGS_HOME], [the location of the JAGS pkgconfig file]), [JAGS_ROOT=$withval])
+#Set optional include path with option --with-jags-include or
+#environment variable JAGS_INCLUDE
 
-if ! test -z "${JAGS_ROOT}"; then
-   export PKG_CONFIG_PATH=${JAGS_ROOT}:$PKG_CONFIG_PATH
+AC_ARG_WITH([jags-include],
+            AC_HELP_STRING([--with-jags-include=INCLUDE_PATH],
+                           [the location of JAGS header files]),
+            [jags_include_path=$withval])
+if test [ -n "$jags_include_path" ] ; then
+   JAGS_INCLUDE=${jags_include_path}
+else
+   if test [ -z "${JAGS_INCLUDE}" ] ; then
+      if test [ "$prefix" == "NONE" ]; then
+         AC_MSG_ERROR("JAGS headers not found. Use --with-jags-include configure option")
+      else
+         JAGS_INCLUDE=${prefix}/include/JAGS
+      fi
+   fi
 fi
 
-PKG_CHECK_MODULES(JAGS, [jags = $PACKAGE_VERSION])
-AC_SUBST(JAGS_CFLAGS)
-AC_SUBST(JAGS_LIBS)
+#Set optional library path with option --with-jags-lib or
+#environment variable JAGS_LIBS
 
-JAGS_MODDIR=`$PKG_CONFIG --variable=moduledir jags`
-AC_SUBST(JAGS_MODDIR)
+AC_ARG_WITH([jags-lib],
+            AC_HELP_STRING([--with-jags-lib=LIB_PATH],
+                           [the location of the JAGS library]),
+            [jags_lib_path=$withval])
+if test [ -n "$jags_lib_path" ] ; then
+   JAGS_LIB=$jags_lib_path
+else
+   if test [ -z "${JAGS_LIB}" ] ; then
+      if test [ "${prefix}" == "NONE" ] ; then 
+         AC_MSG_ERROR("JAGS library not found. Use --with-jags-lib configure option")
+      else
+         JAGS_LIB=${prefix}/lib
+      fi
+   fi
+fi
+
+#Finally, set optional module directory using --with-jags-modules or
+#environment variable JAGS_MODULES
+
+AC_ARG_WITH([jags-modules],
+            AC_HELP_STRING([--with-jags-modules=MOD_PATH],
+                           [the location of the JAGS modules]),
+            [jags_mod_path=$withval])
+if test [ -n "$jags_mod_path" ] ; then
+   JAGS_MODULES=$jags_mod_path
+else
+   if test [ -z "${JAGS_MODULES}" ] ; then
+      JAGS_MODULES=${JAGS_LIB}/JAGS/modules
+   fi
+fi
+
+AC_SUBST(JAGS_INCLUDE)
+AC_SUBST(JAGS_LIB)
+AC_SUBST(JAGS_MODULES)
 
 AC_OUTPUT(src/Makevars)
 AC_OUTPUT(R/unix/zzz.R)