summaryrefslogtreecommitdiffstats
path: root/configure.ac
blob: d9cf0cdf9ea8bf86f3d03fd41ed795c53b612768 (plain)
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
AC_INIT(mdds, 2.1.1, kohei.yoshida@gmail.com)
AM_INIT_AUTOMAKE([foreign dist-bzip2 dist-xz subdir-objects])
AM_MAINTAINER_MODE

VERSION=AC_PACKAGE_VERSION
API_VERSION=2.1

AC_SUBST(VERSION)
AC_SUBST(API_VERSION)
AC_CONFIG_MACRO_DIRS([m4])

PACKAGE_TARNAME=AC_PACKAGE_TARNAME
AC_SUBST(PACKAGE_TARNAME)

OBJDIR=obj
INCDIR=include
MISCDIR=misc
QUICKCHECKDIR=quickcheck
AC_SUBST(OBJDIR)
AC_SUBST(INCDIR)
AC_SUBST(MISCDIR)
AC_SUBST(QUICKCHECKDIR)

AX_CXX_COMPILE_STDCXX_17([noext], [mandatory])

CPPFLAGS="$CPPFLAGS -Wall -Wshadow -g -pedantic-errors"
CPPFLAGS="$CPPFLAGS -I/usr/include -I/usr/local/include"

AC_CHECK_SIZEOF([void *])
CXXFLAGS="$CXXFLAGS -DSIZEOF_VOID_P=$ac_cv_sizeof_void_p"

AC_ARG_ENABLE(debug-stdcxx,
[
  --enable-debug-stdcxx   Enable libstdc++ debug mode during make check.
]
,debug_stdcxx=yes)

AS_IF([test x"$debug_stdcxx" = "xyes"], [
  CXXFLAGS="$CXXFLAGS -D_GLIBCXX_DEBUG"
])

AC_ARG_ENABLE(release-tests,
[
  --enable-release-tests   Enable release builds for unit tests.
]
,release_tests=yes)

AS_IF([test x"$release_tests" = "xyes"], [
  CXXFLAGS="$CXXFLAGS -DNDEBUG -O2"
])

AC_ARG_ENABLE(gcov,
    AS_HELP_STRING([--enable-gcov], [Enable generation of gcov information.]),
    [enable_gcov="$enableval"],[enable_gcov=no]
)

AC_ARG_ENABLE(loop-unrolling,
    AS_HELP_STRING([--disable-loop-unrolling], [Disable use of loop unrolling.]),
    [enable_loop_unrolling="$enableval"],[enable_loop_unrolling=yes]
)

AS_IF([test x"$enable_loop_unrolling" = "xno"], [
  CXXFLAGS="$CXXFLAGS -DMDDS_LOOP_UNROLLING=0"
])

AS_IF([test x"$enable_gcov" = "xyes"], [
  CXXFLAGS="$CXXFLAGS --coverage -O0"
])

AC_ARG_ENABLE(openmp,
    AS_HELP_STRING([--enable-openmp], [Enable use of OpenMP.]),
    [enable_openmp="$enableval"],[enable_openmp=no]
)

AS_IF([test x"$enable_openmp" = "xyes"], [
  CXXFLAGS="$CXXFLAGS -fopenmp -DMDDS_USE_OPENMP=1"
  LDFLAGS="$LDFLAGS -fopenmp"
])

AC_ARG_ENABLE(sanitizer-coverage,
    AS_HELP_STRING([--enable-sanitizer-coverage], [Enable generation of sanitizer coverage information.]),
    [enable_sanitizer_coverage="$enableval"],[enable_sanitizer_coverage=no]
)

AS_IF([test x"$enable_sanitizer_coverage" = "xyes"], [
  CXXFLAGS="$CXXFLAGS -fprofile-instr-generate -fcoverage-mapping -O0"
])

AC_SUBST(CPPFLAGS)
AC_SUBST(CPPFLAGS_NODEBUG)

AC_PROG_CXX
AC_PATH_PROG([GDB], [gdb])
AC_PATH_PROG([EXPECT], [expect])
AC_PATH_PROG([RUNTEST_BIN], [runtest])

AC_ARG_ENABLE([docs],
  [AS_HELP_STRING([--enable-docs], [Generate docs during build.])],
  [enable_docs=$enableval],
  [enable_docs=no]
)
AS_IF([test "$enable_docs" = yes],
  [
    AC_PATH_PROG([DOXYGEN], [doxygen])
    AS_IF([test -z "$DOXYGEN"], [AC_MSG_ERROR([doxygen not found])])
    AC_PATH_PROG([SPHINX], [sphinx-build])
    AS_IF([test -z "$SPHINX"], [AC_MSG_ERROR([sphinx-build not found])])
  ]
)
AM_CONDITIONAL([BUILD_DOCS], [test "$enable_docs" = yes])

AC_ARG_ENABLE([werror],
	[AS_HELP_STRING([--enable-werror], [Treat all warnings as errors, useful for development])],
	[enable_werror="$enableval"],
	[enable_werror=no]
)
AS_IF([test x"$enable_werror" = "xyes"], [
	CXXFLAGS="$CXXFLAGS -Werror"
])

CXXFLAGS_UNITTESTS="-DMDDS_DEBUG_NODE_BASE -DMDDS_UNIT_TEST"
AC_SUBST(CXXFLAGS_UNITTESTS)

AX_VALGRIND_CHECK()

AC_CONFIG_FILES([
Makefile
include/Makefile
include/mdds/Makefile
include/mdds/multi_type_vector/Makefile
include/mdds/multi_type_vector/aos/Makefile
include/mdds/multi_type_vector/soa/Makefile
example/Makefile
example/multi_type_vector/Makefile
test/Makefile
test/gdb/Makefile
test/gdb/src/Makefile
test/flat_segment_tree/Makefile
test/include/Makefile
test/multi_type_matrix/Makefile
test/multi_type_vector/Makefile
test/multi_type_vector/collection/Makefile
test/multi_type_vector/collection/aos/Makefile
test/multi_type_vector/collection/soa/Makefile
test/multi_type_vector/collection/tc/Makefile
test/multi_type_vector/custom/Makefile
test/multi_type_vector/custom/aos/Makefile
test/multi_type_vector/custom/soa/Makefile
test/multi_type_vector/custom/tc/Makefile
test/multi_type_vector/custom-trait/Makefile
test/multi_type_vector/custom-trait/aos/Makefile
test/multi_type_vector/custom-trait/soa/Makefile
test/multi_type_vector/debug-util/Makefile
test/multi_type_vector/debug-util/soa/Makefile
test/multi_type_vector/default/Makefile
test/multi_type_vector/default/aos/Makefile
test/multi_type_vector/default/soa/Makefile
test/multi_type_vector/default/tc/Makefile
test/multi_type_vector/element-blocks/Makefile
test/multi_type_vector/event/Makefile
test/multi_type_vector/event/aos/Makefile
test/multi_type_vector/event/soa/Makefile
test/multi_type_vector/event/tc/Makefile
test/multi_type_vector/perf/Makefile
test/point_quad_tree/Makefile
test/rtree/Makefile
test/segment_tree/Makefile
test/sorted_string_map/Makefile
test/trie_map/Makefile
tools/Makefile
tools/runtime-env/Makefile
misc/mdds-$API_VERSION.pc:misc/mdds.pc.in
])
AC_OUTPUT

AC_MSG_NOTICE([
==============================================================================
Build configuration:
        gcov                  $enable_gcov
        openmp                $enable_openmp
        sanitizer-coverage    $enable_sanitizer_coverage
        loop-unrolling        $enable_loop_unrolling

        CXXFLAGS              $CXXFLAGS
==============================================================================
])