forked from xoreos/xoreos-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
231 lines (183 loc) · 7.44 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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
dnl xoreos-tools - Tools to help with xoreos development
dnl
dnl xoreos-tools is the legal property of its developers, whose names
dnl can be found in the AUTHORS file distributed with this source
dnl distribution.
dnl
dnl xoreos-tools is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU General Public License
dnl as published by the Free Software Foundation; either version 3
dnl of the License, or (at your option) any later version.
dnl
dnl xoreos-tools is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with xoreos-tools. If not, see <http://www.gnu.org/licenses/>.
AC_PREREQ([2.65])
AC_INIT([xoreos-tools],[0.0.5],[[email protected]],[xoreos-tools],[https://xoreos.org/])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([build-aux])
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE([1.11 foreign -Wall -Wno-portability no-dist-gzip dist-xz subdir-objects])
dnl Support silent build rules. Disable by either passing
dnl --disable-silent-rules to configure or passing V=1 to make
AM_SILENT_RULES([yes])
dnl If AM_PROG_AR exists, call it, to shut up a libtool warning (and make it more portable, I guess?)
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
dnl libtool
LT_PREREQ([2.2])
LT_INIT([disable-shared])
dnl We're C++
AC_PROG_CXX
AC_LANG([C++])
dnl We want a make install
AC_PROG_INSTALL
dnl Standard C++
AC_HEADER_STDC
dnl Endianness
AC_C_BIGENDIAN
dnl Special variables of the size of pointers
AC_TYPE_INTPTR_T
AC_TYPE_UINTPTR_T
dnl Check the sizes of integer types
AC_CHECK_SIZEOF([char])
AC_CHECK_SIZEOF([short])
AC_CHECK_SIZEOF([int])
AC_CHECK_SIZEOF([long])
AC_CHECK_SIZEOF([long long])
AC_CHECK_SIZEOF([void *])
dnl math library and special float functions
AC_CHECK_LIB([m], [cos])
AC_CHECK_FUNCS([fabs])
AC_CHECK_FUNCS([fmin])
AC_CHECK_FUNCS([fmax])
AC_CHECK_FUNCS([fabsf])
AC_CHECK_FUNCS([fminf])
AC_CHECK_FUNCS([fmaxf])
dnl String to integer/float conversion functions
AC_CHECK_FUNCS([strtoll])
AC_CHECK_FUNCS([strtoull])
AC_CHECK_FUNCS([strtof])
dnl Check for -ggdb support
GGDB=""
AX_CHECK_COMPILER_FLAGS_VAR([C++], [GGDB], [-ggdb])
AC_SUBST(GGDB)
dnl --with-werror
AC_ARG_WITH([werror], [AS_HELP_STRING([--with-werror], [Compile with -Werror @<:@default=no@:>@])], [], [with_werror=no])
WERROR=""
if test "x$with_werror" = "xyes"; then
AX_CHECK_COMPILER_FLAGS_VAR([C++], [WERROR], [-Werror])
AX_CHECK_COMPILER_FLAGS_VAR([C++], [WERROR], [-Werror=unused-but-set-variable])
fi
AC_SUBST(WERROR)
dnl Compiler warning flags
AC_ARG_WITH([warnings], [AS_HELP_STRING([--without-warnings], [Compile without extra warnings @<:@default=no@:>@])], [], [with_warnings=yes])
WARN=""
if test "x$with_warnings" = "xyes"; then
WARN="-Wall"
dnl Extra warnings valid for both C and C++
AX_CHECK_COMPILER_FLAGS_VAR([C++], [WARN], [-Wignored-qualifiers])
AX_CHECK_COMPILER_FLAGS_VAR([C++], [WARN], [-Wpointer-arith])
AX_CHECK_COMPILER_FLAGS_VAR([C++], [WARN], [-Wshadow])
AX_CHECK_COMPILER_FLAGS_VAR([C++], [WARN], [-Wsign-compare])
AX_CHECK_COMPILER_FLAGS_VAR([C++], [WARN], [-Wtype-limits])
AX_CHECK_COMPILER_FLAGS_VAR([C++], [WARN], [-Wuninitialized])
AX_CHECK_COMPILER_FLAGS_VAR([C++], [WARN], [-Wunused-parameter])
AX_CHECK_COMPILER_FLAGS_VAR([C++], [WARN], [-Wunused-but-set-parameter])
AX_CHECK_COMPILER_FLAGS_VAR([C++], [WARN], [-Wduplicated-cond])
AX_CHECK_COMPILER_FLAGS_VAR([C++], [WARN], [-Wduplicated-branches])
AX_CHECK_COMPILER_FLAGS_VAR([C++], [WARN], [-Wlogical-op])
AX_CHECK_COMPILER_FLAGS_VAR([C++], [WARN], [-Wshift-negative-value])
AX_CHECK_COMPILER_FLAGS_VAR([C++], [WARN], [-Wshift-overflow=2])
AX_CHECK_COMPILER_FLAGS_VAR([C++], [WARN], [-Wimplicit-fallthrough])
AX_CHECK_COMPILER_FLAGS_VAR([C++], [WARN], [-Wvla])
dnl Extra warnings valid for C++
AX_CHECK_COMPILER_FLAGS_VAR([C++], [WARN], [-Wnon-virtual-dtor])
AX_CHECK_COMPILER_FLAGS_VAR([C++], [WARN], [-Wdeprecated-copy])
AX_CHECK_COMPILER_FLAGS_VAR([C++], [WARN], [-Wdeprecated-copy-dtor])
AX_CHECK_COMPILER_FLAGS_VAR([C++], [WARN], [-Wredundant-move])
fi
dnl Disable warnings about hiding virtual functions from a base class. We don't care
AX_CHECK_COMPILER_FLAGS_VAR([C++], [WARN], [-Woverloaded-virtual], [-Wno-overloaded-virtual])
dnl Disable warnings about the long long type. We need it
AX_CHECK_COMPILER_FLAGS_VAR([C++], [WARN], [-Wlong-long], [-Wno-long-long])
AX_CHECK_COMPILER_FLAGS_VAR([C++], [WARN], [-Wc++11-long-long], [-Wno-c++11-long-long])
dnl clang is far too trigger-happy on this warning, so let's disable it
AX_CHECK_COMPILER_FLAGS_VAR([C++], [WARN], [-Wundefined-var-template], [-Wno-undefined-var-template])
dnl We do not yet mark any of our overrides. Let's disable this for now
AX_CHECK_COMPILER_FLAGS_VAR([C++], [WARN], [-Winconsistent-missing-override], [-Wno-inconsistent-missing-override])
AC_SUBST(WARN)
dnl C++ dialect
AC_ARG_WITH([std], [AS_HELP_STRING([--without-std], [Compile without specifying the C++ standard to follow @<:@default=no@:>@])], [], [with_std=yes])
STD=""
if test "x$with_std" = "xyes"; then
AX_CHECK_COMPILER_FLAGS_VAR([C++], [STD], [-std=c++11])
fi
AC_SUBST(STD)
dnl Link-time optimization
AC_ARG_WITH([lto], [AS_HELP_STRING([--with-lto], [Compile with link-time optimization @<:@default=no@:>@])], [], [with_lto=no])
LTO=""
if test "x$with_lto" = "xyes"; then
AX_CHECK_COMPILER_FLAGS_VAR([C++], [LTO], [-flto])
fi
AC_SUBST(LTO)
dnl Optimize against local CPU
AC_ARG_WITH([native], [AS_HELP_STRING([--with-native], [Pass -march=native to the compiler to optimize directly against the local CPU instead of generating a more generic build @<:@default=no@:>@])], [], [with_native=no])
NATIVE=""
if test "x$with_native" = "xyes"; then
AX_CHECK_COMPILER_FLAGS_VAR([C++], [NATIVE], [-march=native])
fi
AC_SUBST(NATIVE)
dnl Release version number
AC_ARG_WITH([release], [AS_HELP_STRING([--with-release=VER], [Set the version suffix to VER instead of the git revision. If no VER is given, do not add a version suffix at all])], [], [with_release=no])
if test "x$with_release" != "xno"; then
AC_DEFINE([XOREOS_RELEASE], 1, [Define to 1 if we are in release version mode])
if test "x$with_release" != "xyes"; then
AC_DEFINE_UNQUOTED([XOREOS_DISTRO], ["+$with_release"], [Release version suffix])
fi
fi
dnl General purpose libraries
AX_CHECK_ICONV( , AC_MSG_ERROR([No useable iconv() function found!]))
AX_CHECK_ZLIB(1, 2, 3, 0, , AC_MSG_ERROR([zlib(>= 1.2.3) is required and could not be found!]))
AX_CHECK_LZMA(5, 0, 3, 2, , AC_MSG_ERROR([liblzma(>= 5.0.3) is required and could not be found!]))
AX_CHECK_XML2(2, 8, 0, , AC_MSG_ERROR([libxml2(>= 2.8.0) is required and could not be found!]))
dnl Boost
BOOST_REQUIRE(1.53.0)
BOOST_UTILITY
BOOST_STRING_ALGO
BOOST_SYSTEM
BOOST_FILESYSTEM
BOOST_UUID
BOOST_SMART_PTR
BOOST_SCOPE_EXIT
BOOST_LOCALE
dnl pthread
AX_PTHREAD()
AM_CONDITIONAL([HAVE_PTHREAD], [test x"$ax_pthread_ok" = xyes])
dnl Extra flags
case "$target" in
*darwin*)
XOREOSTOOLS_CFLAGS="-DUNIX -DMACOSX"
XOREOSTOOLS_LIBS=""
AM_CONDITIONAL(WIN32, false)
;;
*mingw*)
XOREOSTOOLS_CFLAGS="-mconsole"
XOREOSTOOLS_LIBS=""
AM_CONDITIONAL(WIN32, true)
;;
*)
XOREOSTOOLS_CFLAGS="-DUNIX"
XOREOSTOOLS_LIBS=""
AM_CONDITIONAL(WIN32, false)
;;
esac;
AC_SUBST(XOREOSTOOLS_CFLAGS)
AC_SUBST(XOREOSTOOLS_LIBS)
AC_CONFIG_FILES([Makefile])
AC_OUTPUT