-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure.ac
203 lines (179 loc) · 4.59 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
192
193
194
195
196
197
198
199
200
201
202
203
# This file is part of the boxes library.
#
# boxes is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
AC_PREREQ([2.64])
AC_INIT([boxes],
[1.0.1],
[],
[boxes],
[https://github.com/SfMResearch/boxes])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([
foreign
1.11
-Wall
-Wno-portability
silent-rules
tar-pax
no-dist-gzip
dist-xz
subdir-objects
])
AM_SILENT_RULES([yes])
LT_PREREQ(2.2)
LT_INIT([disable-static])
AC_PROG_SED
AC_PROG_CC
AC_PROG_CC_C99
AC_PROG_CC_C_O
AC_PROG_CXX
AX_CXX_COMPILE_STDCXX_11([noext], [mandatory])
AC_OPENMP
AC_PATH_PROG([M4], [m4])
CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
-pipe \
-Wall \
-Wextra \
-Wno-inline \
-Wundef \
"-Wformat=2 -Wformat-security -Wformat-nonliteral" \
-Wlogical-op \
-Wsign-compare \
-Wpointer-arith \
-Winit-self \
-Wfloat-equal \
-Wredundant-decls \
-Wmissing-declarations \
-Wmissing-noreturn \
-Wendif-labels \
-Wcast-align \
-Wstrict-aliasing=2 \
-Wwrite-strings \
-Wno-long-long \
-Wno-overlength-strings \
-Wno-unused-parameter \
-Wno-missing-field-initializers \
-Wno-unused-result \
-Werror=overflow \
-ffast-math \
-fno-common \
-fdiagnostics-show-option \
-fdiagnostics-color \
-fno-strict-aliasing \
-ffunction-sections \
-fdata-sections \
-fstack-protector-all \
--param=ssp-buffer-size=4])
AC_SUBST([OUR_CFLAGS], $with_cflags)
AC_SUBST([OUR_CXXFLAGS], $with_cflags)
AS_CASE([$CFLAGS], [*-O[[12345g\ ]]*],
[CC_CHECK_FLAGS_APPEND([with_cppflags], [CPPFLAGS], [\
-Wp,-D_FORTIFY_SOURCE=2])],
[AC_MSG_RESULT([skipping -D_FORTIFY_SOURCE, optimization not enabled])])
AC_SUBST([OUR_CPPFLAGS], $with_cppflags)
CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
-Wl,--as-needed \
-Wl,--no-undefined \
-Wl,--gc-sections \
-Wl,-z,relro \
-Wl,-z,now])
AC_SUBST([OUR_LDFLAGS], $with_ldflags)
# This makes sure pkg.m4 is available.
m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
# Boost
BOOST_REQUIRE([1.49])
BOOST_REGEX([mt])
BOOST_SYSTEM([mt])
# OpenCV
PKG_CHECK_MODULES(OPENCV, [opencv >= 2.4])
AC_LANG_PUSH([C++])
AC_ARG_ENABLE([nonfree],
AS_HELP_STRING([--enable-nonfree], [Use nonfree features from OpenCV]),
[],
[AC_CHECK_HEADERS([opencv2/nonfree/nonfree.hpp], [
enable_nonfree=yes
], [
enable_nonfree=no
])]
)
AC_LANG_POP([C++])
AS_IF([test "x${enable_nonfree}" = "xyes"], [
AC_DEFINE(BOXES_NONFREE, 1, [Define if OpenCV nonfree features are available])
])
# PCL
PKG_CHECK_MODULES(PCL_APPS, [pcl_apps >= 1.6.0], [], [true])
PKG_CHECK_MODULES(PCL_COMMON, [pcl_common >= 1.6.0], [], [
PKG_CHECK_MODULES(PCL_COMMON, [pcl_common-1.7])
])
PKG_CHECK_MODULES(PCL_FEATURES, [pcl_features >= 1.6.0], [], [
PKG_CHECK_MODULES(PCL_FEATURES, [pcl_features-1.7])
])
PKG_CHECK_MODULES(PCL_FILTERS, [pcl_filters >= 1.6.0], [], [
PKG_CHECK_MODULES(PCL_FILTERS, [pcl_filters-1.7])
])
PKG_CHECK_MODULES(PCL_IO, [pcl_io >= 1.6.0], [], [
PKG_CHECK_MODULES(PCL_IO, [pcl_io-1.7])
])
PKG_CHECK_MODULES(PCL_KDTREE, [pcl_kdtree >= 1.6.0], [], [
PKG_CHECK_MODULES(PCL_KDTREE, [pcl_kdtree-1.7])
])
PKG_CHECK_MODULES(PCL_SEARCH, [pcl_search >= 1.6.0], [], [
PKG_CHECK_MODULES(PCL_SEARCH, [pcl_search-1.7])
])
PKG_CHECK_MODULES(PCL_SURFACE, [pcl_surface >= 1.6.0], [], [
PKG_CHECK_MODULES(PCL_SURFACE, [pcl_surface-1.7])
])
PKG_CHECK_MODULES(PCL_VISUALIZATION, [pcl_visualization >= 1.6.0], [], [
PKG_CHECK_MODULES(PCL_VISUALIZATION, [pcl_visualization-1.7])
])
PCL_CFLAGS="\
$PCL_APPS_CFLAGS \
$PCL_COMMON_CFLAGS \
$PCL_FEATURES_CFLAGS \
$PCL_FILTERS_CFLAGS \
$PCL_IO_CFLAGS \
$PCL_KDTREE_CFLAGS \
$PCL_SEARCH_CFLAGS \
$PCL_SURFACE_CFLAGS \
$PCL_VISUALIZATION_CFLAGS \
"
PCL_LIBS="\
$PCL_APPS_LIBS \
$PCL_COMMON_LIBS \
$PCL_FEATURES_LIBS \
$PCL_FILTERS_LIBS \
$PCL_IO_LIBS \
$PCL_KDTREE_LIBS \
$PCL_SEARCH_LIBS \
$PCL_SURFACE_LIBS \
$PCL_VISUALIZATION_LIBS \
"
AC_SUBST(PCL_CFLAGS)
AC_SUBST(PCL_LIBS)
# Workaround because PCL requires headers from VTK.
PCL_CFLAGS+="-I/usr/include/vtk -I/usr/include/vtk-5.8"
#PCL_LIBS+="-L/usr/lib64/vtk -lvtkCommon -lvtkFiltering -lvtkRendering"
PCL_LIBS+="\
-L/usr/lib64/vtk \
-lvtkCommonCore \
-lvtkCommonDataModel \
-lvtkCommonMath \
-lvtkRenderingCore \
"
AC_CONFIG_FILES([
Makefile
tests/Makefile
])
AC_OUTPUT
AC_MSG_RESULT([
$PACKAGE_NAME $VERSION
CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
CXXFLAGS: ${OUR_CXXFLAGS} ${CXXFLAGS}
CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
])