/
configure.ac
73 lines (60 loc) · 1.73 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
AC_INIT([rayrender])
# Find the compiler and compiler flags used by R.
: ${R_HOME=`R RHOME`}
if test -z "${R_HOME}"; then
echo "could not determine R_HOME"
exit 1
fi
##Fix CRAN note about looking for gcc
CC=`"${R_HOME}/bin/R" CMD config CC`
CFLAGS=`"${R_HOME}/bin/R" CMD config CFLAGS`
CPPFLAGS=`"${R_HOME}/bin/R" CMD config CPPFLAGS`
if test `uname` = "Darwin" ; then
darwin="yes"
## we want the *build* cputype and not the host one.
cmd=`echo $CC $CFLAGS | grep -E 'x86_64|ppc64|-m64'`
if test -n "$cmd"; then
have_64bit="yes"
else
have_64bit="no"
fi
else
darwin="no"
fi
CXX=`"${R_HOME}/bin/R" CMD config CXX17`
CXXFLAGS=`"${R_HOME}/bin/R" CMD config CXX17FLAGS`
CPPFLAGS=`"${R_HOME}/bin/R" CMD config CPPFLAGS`
DEFINES="-D RAY_REPRODUCE_PERLIN -DSTRICT_R_HEADERS"
AC_LANG(C++)
AC_PROG_CPP
AC_PATH_X
if test x$no_x = xyes ; then
AC_MSG_WARN([X11 not found, compiling without render preview capability.])
else
if test -n "${x_includes}"; then
PKG_CPPFLAGS="${PKG_CPPFLAGS} -I${x_includes}"
fi
if test -n "${x_libraries}"; then
LIBS="${LIBS} -L${x_libraries} -lX11"
else
LIBS="${LIBS} -lX11"
fi
DEFINES="${DEFINES} -DRAY_HAS_X11"
if test $darwin = yes; then
PKG_CPPFLAGS="${PKG_CPPFLAGS} -I/opt/X11/include"
fi
fi
# Write the flags into the src/Makevars file.
AC_SUBST([PKG_CPPFLAGS], ["${PKG_CPPFLAGS}"])
AC_SUBST([PKG_LIBS], ["${LIBS} ${PKG_LIBS}"])
AC_SUBST([DEFINES], ["${DEFINES}"])
AC_CONFIG_FILES([src/Makevars])
AC_OUTPUT
echo "
--------------------------------------------------
Configuration for ${PACKAGE_NAME} ${PACKAGE_VERSION}
cppflags: ${CPPFLAGS} ${DEFINES}
libs: ${PKG_LIBS}
includes: ${PKG_CPPFLAGS}
--------------------------------------------------
"