-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathconfigure.ac
191 lines (162 loc) · 5.65 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.64)
AC_INIT([dbarts],[0.9.23],[[email protected]])
AC_CONFIG_SRCDIR([src/R_interface.cpp])
AC_CONFIG_AUX_DIR([tools/build-aux])
AC_CONFIG_HEADERS([src/config.hpp])
AC_CONFIG_HEADERS([src/dbarts/config.hpp])
AC_CONFIG_HEADERS([src/misc/config.h])
AC_CONFIG_HEADERS([src/external/config.h])
AC_CONFIG_HEADERS([inst/include/dbarts/types.hpp])
AC_CONFIG_HEADERS([src/include/misc/types.h])
m4_include([tools/m4/ax_check_compile_flag.m4])
m4_include([tools/m4/ax_pthread.m4])
m4_include([tools/m4/ax_compiler_vendor.m4])
m4_include([tools/m4/ax_compiler_ext.m4])
m4_include([tools/m4/ax_cxx_namespace_std.m4])
m4_include([tools/m4/ax_snprintf_in_namespace_std.m4])
m4_include([tools/m4/ax_log1p_in_namespace_std.m4])
m4_include([tools/m4/ax_func_posix_memalign.m4])
AC_ARG_ENABLE([match-bayes-tree],
[AS_HELP_STRING([--enable-match-bayes-tree],
[get results identical to BayesTree])],
[match_bayes_tree=-DMATCH_BAYES_TREE],
[unset match_bayes_tree])
AC_SUBST(match_bayes_tree)
AC_ARG_ENABLE([thread-safe-unload],
[AS_HELP_STRING([--enable-thread-safe-unload],
[block when adding/deleting fits for the purposes of package reloading])],
[thread_safe_unload=-DTHREAD_SAFE_UNLOAD],
[unset thread_safe_unload])
AC_SUBST(thread_safe_unload)
AC_ARG_WITH([xint-size],
[AS_HELP_STRING([--with-xint-size=16],
[constrains the number of cutpoints to 2^x-size - 1])],
,
[with_xint_size=no])
case "x$with_xint_size" in
x8)
xint_size=uint8_t
;;
x32)
xint_size=uint32_t
;;
x64)
xint_size=uint64_t
;;
xyes|xno|x16)
xint_size=uint16_t
;;
esac
AC_DEFINE_UNQUOTED(XINT_TYPE, $xint_size, [Define to the integer type used to represent feature map.])
# Checks for programs.
: ${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`
CXX=`"${R_HOME}/bin/R" CMD config CXX`
CFLAGS=`"${R_HOME}/bin/R" CMD config CFLAGS`
CPICFLAGS=`"${R_HOME}/bin/R" CMD config CPICFLAGS`
CPPFLAGS=`"${R_HOME}/bin/R" CMD config CPPFLAGS`
CXXFLAGS=`"${R_HOME}/bin/R" CMD config CXXFLAGS`
CXXPICFLAGS=`"${R_HOME}/bin/R" CMD config CXXPICFLAGS`
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CXX
AC_PROG_CXXCPP
AC_LANG(C)
AC_LANG_PUSH(C++)
AC_C_RESTRICT
AC_LANG_POP(C++)
AC_C_BIGENDIAN
AC_CANONICAL_HOST
AX_COMPILER_VENDOR
AC_SUBST(COMPILER_VENDOR, $ax_cv_c_compiler_vendor)
AX_COMPILER_EXT
# on SOLARIS, need to strip out some hardware flags from the library,
# so we test for those that are explicitly added with intrinsics
# but not supported by the CPU
mapfile_flag=
case $host_os in
solaris*)
case $host_cpu in
i[[3456]]86*|x86_64*|amd64*)
if test "$ax_cv_c_compiler_vendor" = sun; then
m4_include([tools/m4/ax_ext_solaris.m4])
m4_include([tools/m4/ax_gcc_x86_cpuid.m4])
m4_include([tools/m4/ax_gcc_x86_avx_xgetbv.m4])
AX_EXT_SOLARIS
unsupported_isets=
# only test for those that we explicitly add beyond what
# the compiler will come up with on "-xarch=native"
for iset in "avx;AVX" "sse41;SSE4_1" "avx2;AVX2"; do
iset_varname=$(echo $iset | cut -d ";" -f 1)
iset_mapname=$(echo $iset | cut -d ";" -f 2)
# If instruction set is supported by the compiler but not both of the
# OS and CPU, remove it
if test x"$(eval echo \$ax_cv_have_${iset_varname}_ext)" != x"yes"; then
if test x"$(eval echo \$ax_cv_support_${iset_varname}_ext)" = x"yes"; then
unsupported_isets="${unsupported_isets} ${iset_mapname}"
fi
fi
done
if test ! -z "${unsupported_isets}"; then
unsupported_isets=${unsupported_isets##[[:space:]]} # remove leading space
echo "creating mapfile to remove ${unsupported_isets} instruction set(s)"
printf "\$mapfile_version 2\nCAPABILITY {\n HW -= %s;\n};\n" "${unsupported_isets}" > src/mapfile.solaris
mapfile_flag="-M mapfile.solaris"
fi
#HEADER_FILE=
#printf "#include <sys/auxv_386.h>\nint main() { return 0; }\n" > conftest.c
#HEADER_FILE=$(eval $CC -H conftest.c -o conftest 2>&1)
#rm -f conftest conftest.c
#
#if test ! -z "${HEADER_FILE}"; then
# echo "contents of ${HEADER_FILE}:"
# grep 'AV_386_[[^B]]' ${HEADER_FILE}
#else
# echo "could not find aux header file"
#fi
fi
;;
esac
;;
esac
AC_SUBST(MAPFILE_FLAG, $mapfile_flag)
# Checks for libraries.
AX_PTHREAD
AC_SUBST(PTHREAD_CFLAGS)
AC_SUBST(PTHREAD_LIBS)
# Checks for header files.
AC_LANG_PUSH(C++)
AC_CHECK_HEADERS([cstdint])
AC_LANG_POP(C++)
if test "$ac_cv_header_cstdint" == no; then
AC_CHECK_HEADER([stdint.h])
fi
AC_CHECK_HEADERS([sys/time.h])
AC_CHECK_HEADERS([unistd.h])
AC_CHECK_HEADERS([malloc.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_INT64_T
AC_TYPE_UINT64_T
AC_CHECK_SIZEOF([size_t])
AC_CHECK_ALIGNOF([void*])
# Checks for library functions.
AC_CHECK_FUNCS([gettimeofday])
AC_CHECK_FUNCS([clock_gettime])
AC_CHECK_FUNCS([ffs])
AC_FUNC_ALLOCA
AX_FUNC_POSIX_MEMALIGN
AC_LANG_PUSH(C++)
AC_FUNC_STRERROR_R
AC_CHECK_FUNCS([snprintf])
AX_CXX_SNPRINTF_IN_NAMESPACE_STD
AC_CHECK_FUNCS([log1p])
AX_CXX_LOG1P_IN_NAMESPACE_STD
AC_LANG_POP
AC_CONFIG_FILES([src/Makevars])
AC_OUTPUT