Diff of /configure.ac [bf0707] .. [822f88] Maximize Restore

  Switch to unified view

a/configure.ac b/configure.ac
1
AC_INIT([rjags], [3])
1
AC_INIT([rjags], [4])
2
2
3
if test -z "${R_HOME}"; then
3
if test -z "${R_HOME}"; then
4
   AC_MSG_ERROR("R_HOME is not defined")
4
   AC_MSG_ERROR("R_HOME is not defined")
5
fi
5
fi
6
CC=`"${R_HOME}/bin/R" CMD config CC`
6
CC=`"${R_HOME}/bin/R" CMD config CC`
7
CXX=`"${R_HOME}/bin/R" CMD config CXX`
7
CXX=`"${R_HOME}/bin/R" CMD config CXX`
8
CFLAGS=`"${R_HOME}/bin/R" CMD config CFLAGS`
8
CFLAGS=`"${R_HOME}/bin/R" CMD config CFLAGS`
9
CXXFLAGS=`"${R_HOME}/bin/R" CMD config CXXFLAGS`
9
CXXFLAGS=`"${R_HOME}/bin/R" CMD config CXXFLAGS`
10
CPPFLAGS=`"${R_HOME}/bin/R" CMD config CPPFLAGS`
10
CPPFLAGS=`"${R_HOME}/bin/R" CMD config CPPFLAGS`
11
11
12
# Guess the installation prefix from location of the jags executable
13
12
AC_PREFIX_PROGRAM(jags)
14
AC_PREFIX_PROGRAM(jags)
13
15
14
#Set optional include path with option --with-jags-include or
16
# For installations in a non-standard location, set the prefix
15
#environment variable JAGS_INCLUDE
17
# manually, using either option --with-jags-prefix or environment
18
# variable JAGS_PREFIX. Otherwise we accept the guess from
19
# AC_PREFIX_PROGRAM.
16
20
17
AC_ARG_WITH([jags-include],
21
AC_ARG_WITH([jags-prefix],
18
            AC_HELP_STRING([--with-jags-include=INCLUDE_PATH],
22
            AC_HELP_STRING([--with-jags-prefix=PREFIX_PATH],
19
                           [the location of JAGS header files]),
23
                           [the prefix used when JAGS was installed]),
20
            [jags_include_path=$withval])
24
            [jags_prefix_path=$withval])
21
if test [ -n "$jags_include_path" ] ; then
25
if test [ -n "$jags_prefix_path" ] ; then
22
   JAGS_INCLUDE=${jags_include_path}
26
   JAGS_PREFIX=${jags_prefix_path}
23
else
27
else
24
   if test [ -z "${JAGS_INCLUDE}" ] ; then
28
   if test [ -z "${JAGS_PREFIX}" ] ; then
25
      if test [ "$prefix" = "NONE" ]; then
29
      if test [ "$prefix" = "NONE" ]; then
26
         AC_MSG_ERROR("Location of JAGS headers not defined. Use configure arg '--with-jags-include' or environment variable 'JAGS_INCLUDE'")
30
         AC_MSG_ERROR("Automatic detection of JAGS failed. Please supply the prefix for JAGS with the --with-jags-prefix option. See the README file for details.")
27
      else
31
      else
28
         JAGS_INCLUDE=${prefix}/include/JAGS
32
         JAGS_PREFIX=${prefix}
29
      fi
33
      fi
30
   fi
34
   fi
31
fi
35
fi
32
36
37
# Set include path with option --with-jags-includedir or environment
38
# variable JAGS_INCLUDEDIR. By default, this is determined from
39
# JAGS_PREFIX.
40
41
AC_ARG_WITH([jags-includedir],
42
            AC_HELP_STRING([--with-jags-includedir=INCLUDE_PATH],
43
                           [the value of includedir used when JAGS was installed]),
44
            [jags_include_path=$withval])
45
if test [ -n "$jags_include_path" ] ; then
46
   JAGS_INCLUDEDIR=${jags_include_path}
47
else
48
   if test [ -z "${JAGS_INCLUDEDIR}" ] ; then
49
      JAGS_INCLUDEDIR=${JAGS_PREFIX}/include
50
   fi
51
fi
52
JAGS_PKGINCLUDEDIR=${JAGS_INCLUDEDIR}/JAGS
53
33
AC_LANG_PUSH(C++)
54
AC_LANG_PUSH(C++)
34
OCPPFLAGS=${CPPFLAGS}
55
OCPPFLAGS=${CPPFLAGS}
35
CPPFLAGS=-I${JAGS_INCLUDE}
56
CPPFLAGS=-I${JAGS_PKGINCLUDEDIR}
36
AC_CHECK_HEADER(Console.h, [],
57
AC_CHECK_HEADER(Console.h, [],
37
             [AC_MSG_FAILURE("Problem with header file ${JAGS_INCLUDE}/Console.h ")])
58
             [AC_MSG_ERROR("Cannot find header file ${JAGS_PKGINCLUDEDIR}/Console.h. See the README file for help.")])
38
CPPFLAGS=${OCPPFLAGS}
59
CPPFLAGS=${OCPPFLAGS}
39
AC_LANG_POP()
60
AC_LANG_POP()
40
61
41
62
42
# There is no consensus on where 64- versus 32-bit libraries should be
63
# There is no consensus on where 64- versus 32-bit libraries should be
43
# installed.  We take a hint from R, assuming that if R is installed
64
# installed.  We take a hint from R, assuming that if R is installed
44
# in, say, /usr/LIBnn/R then we can find the jags library in
65
# in, say, /usr/LIBnn/R then we can find the jags library in
45
# ${prefix}/LIBnn.
66
# ${JAGS_PREFIX}/LIBnn.
46
#
67
#
47
# This is a reasonable assumption if both JAGS and R have been
68
# This is a reasonable assumption if both JAGS and R have been
48
# properly packaged, but may not be true if either has been manually
69
# properly packaged, but may not be true if either has been manually
49
# installed. The user can set the environment variable LIBnn to
70
# installed. The user can set the environment variable LIBnn to
50
# override this.
71
# override this.
51
72
52
if test -z "${LIBnn}"; then 
73
if test -z "${LIBnn}"; then 
53
   LIBnn=`"${R_HOME}/bin/R" CMD config LIBnn`
74
   LIBnn=`"${R_HOME}/bin/R" CMD config LIBnn`
54
fi
75
fi
55
76
56
#Set optional library path with option --with-jags-lib or
77
# Set optional library path with option --with-jags-libdir or
57
#environment variable JAGS_LIBS
78
# environment variable JAGS_LIBDIR. By default this is determined by
79
# JAGS_PREFIX and LIBnn.
58
80
59
AC_ARG_WITH([jags-lib],
81
AC_ARG_WITH([jags-libdir],
60
            AC_HELP_STRING([--with-jags-lib=LIB_PATH],
82
            AC_HELP_STRING([--with-jags-libdir=LIB_PATH],
61
                           [the location of the JAGS library]),
83
                           [the value of libdir used when JAGS was installed]),
62
            [jags_lib_path=$withval])
84
            [jags_lib_path=$withval])
63
if test [ -n "$jags_lib_path" ] ; then
85
if test [ -n "$jags_lib_path" ] ; then
64
   JAGS_LIB=$jags_lib_path
86
   JAGS_LIBDIR=$jags_lib_path
65
else
87
else
66
   if test [ -z "${JAGS_LIB}" ] ; then
88
   if test [ -z "${JAGS_LIBDIR}" ] ; then
67
      if test [ "${prefix}" = "NONE" ] ; then 
89
      JAGS_LIBDIR=${JAGS_PREFIX}/${LIBnn}
68
         AC_MSG_ERROR("Location of JAGS library not defined. Use configure arg '--with-jags-lib' or environment variable 'JAGS_LIB'")
69
      else
70
         JAGS_LIB=${prefix}/${LIBnn}
71
      fi
72
   fi
90
   fi
73
fi
91
fi
92
93
94
# Set location of modules
95
96
JAGS_MODDIR=${JAGS_LIBDIR}/JAGS/modules-${PACKAGE_VERSION}
74
97
75
# Support for private installations of JAGS. If the jags library is not
98
# Support for private installations of JAGS. If the jags library is not
76
# on the linker path then it helps to hard-code the location of JAGS into
99
# on the linker path then it helps to hard-code the location of JAGS into
77
# the DSO for rjags. Suggested by Doug Bates, April 2011.
100
# the DSO for rjags. Suggested by Doug Bates, April 2011.
78
101
79
AC_ARG_ENABLE([rpath],
102
AC_ARG_ENABLE([rpath],
80
            AC_HELP_STRING([--enable-rpath],
103
            AC_HELP_STRING([--enable-rpath],
81
                           [Hard link the location of the JAGS library]))
104
                           [Hard link the location of the JAGS library]))
82
if test [ "x$enable_rpath" = "xyes"]; then
105
if test [ "x$enable_rpath" = "xyes"]; then
83
   JAGS_RPATH="-Wl,-rpath ${JAGS_LIB}"
106
   JAGS_RPATH="-Wl,-rpath ${JAGS_LIBDIR}"
84
fi
107
fi
85
108
86
OLDFLAGS=${LDFLAGS}
109
OLDFLAGS=${LDFLAGS}
87
AC_LANG_PUSH(C)
110
AC_LANG_PUSH(C)
88
LDFLAGS="-L${JAGS_LIB}"
111
LDFLAGS="-L${JAGS_LIBDIR}"
89
AC_CHECK_LIB(jags, jags_version, [],
112
AC_CHECK_LIB(jags, jags_version, [],
90
             [AC_MSG_ERROR("Cannot load JAGS library in ${JAGS_LIB}")])
113
             [AC_MSG_ERROR("Cannot load JAGS library in ${JAGS_LIBDIR}. See the README file for help.")])
91
92
AC_LANG_POP()
114
AC_LANG_POP()
93
LDFLAGS=${OLDFLAGS}
115
LDFLAGS=${OLDFLAGS}
94
116
95
#Finally, set optional module directory using --with-jags-modules or
96
#environment variable JAGS_MODULES
97
98
AC_ARG_WITH([jags-modules],
99
            AC_HELP_STRING([--with-jags-modules=MOD_PATH],
100
                           [the location of the JAGS modules]),
101
            [jags_mod_path=$withval])
102
if test [ -n "$jags_mod_path" ] ; then
103
   JAGS_MODULES=$jags_mod_path
104
else
105
   if test [ -z "${JAGS_MODULES}" ] ; then
106
      JAGS_MODULES=${JAGS_LIB}/JAGS/modules-${PACKAGE_VERSION}
107
      if test [! -d ${JAGS_MODULES} ]; then
108
         AC_MSG_ERROR("JAGS module directory ${JAGS_MODULES} does not exist.")
109
      fi
110
   fi
111
fi
112
113
AC_SUBST(JAGS_INCLUDE)
117
AC_SUBST(JAGS_PKGINCLUDEDIR)
114
AC_SUBST(JAGS_LIB)
118
AC_SUBST(JAGS_LIBDIR)
115
AC_SUBST(JAGS_MODULES)
119
AC_SUBST(JAGS_MODDIR)
116
AC_SUBST(JAGS_RPATH)
120
AC_SUBST(JAGS_RPATH)
117
121
118
AC_OUTPUT(src/Makevars)
122
AC_OUTPUT(src/Makevars)
119
AC_OUTPUT(R/unix/zzz.R)
123
AC_OUTPUT(R/unix/zzz.R)