-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigure.ac
More file actions
223 lines (181 loc) · 5.77 KB
/
configure.ac
File metadata and controls
223 lines (181 loc) · 5.77 KB
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
###Copyright (C) 2018 Vincent Torri <vincent dot torri at gmail dot com>
###This code is public domain and can be freely used or copied.
dnl defines the version name of the libdwarf.so
m4_define([v_maj], [0])
m4_define([v_min], [1])
m4_define([v_mic], [0])
m4_define([v_ver], [v_maj.v_min.v_mic])
m4_define([v_rel], [])
m4_define([lt_cur], [m4_eval(v_maj + v_min)])
m4_define([lt_rev], [v_mic])
m4_define([lt_age], [v_min])
### Sets the release name.
###m4_define([v_date], [m4_esyscmd_s([date "+%Y%m%d"])])
###Also SET (VERSION ..) in CMakeLists.txt
AC_PREREQ([2.52])
### 2nd arg to AC_INIT is the version 'number'.
AC_INIT([tsearch], [v_ver], [libdwarf-list -at- linuxmail -dot- org])
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIRS([m4])
### Additional options to configure
AC_ARG_ENABLE([sanitize],
[AS_HELP_STRING([--enable-sanitize],
[enable sanitize compiler option @<:@default=no@:>@])],
[
AS_IF(
[test "x${enableval}" = "xyes"],
[enable_sanitize="yes"],
[enable_sanitize="no"])
],
[enable_sanitize="no"])
AC_ARG_ENABLE([wall],
[AS_HELP_STRING([--enable-wall],
[enable -Wall and other options @<:@default=no@:>@])],
[
AS_IF(
[test "x${enableval}" = "xyes"],
[enable_wall="yes"],
[enable_wall="no"])
],
[enable_wall="no"])
### Default options with respect to host
AC_CANONICAL_HOST
have_win32="no"
case "$host_os" in
mingw*)
have_win32="yes"
;;
esac
AM_CONDITIONAL([HAVE_WIN32], [test "x${have_win32}" = "xyes"])
### Checks for programs
AM_PROG_AR
### We don't use dist-xz *.xz output from make dist,
### so don't mention it.
AM_INIT_AUTOMAKE([1.6 dist-xz])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AS_IF(
[test "x${have_win32}" = "xyes"],
[lt_cv_deplibs_check_method=pass_all])
LT_INIT([win32-dll disable-shared static])
AS_IF(
[test "x${have_win32}" = "xyes" && test "x${enable_static}" = "xyes"],
[AC_MSG_ERROR([Static library is not supported on Windows])])
version_info="lt_cur:lt_rev:lt_age"
release_info="v_rel"
AC_SUBST([version_info])
AC_SUBST([release_info])
VMAJ=v_maj
AC_SUBST([VMAJ])
AC_PROG_CC
AC_PROG_CC_C_O
PKG_PROG_PKG_CONFIG
### Checks for libraries
### Checks for header files
AC_CHECK_HEADERS([unistd.h stdint.h search.h])
### for use in casts to uint to avoid 32bit warnings.
### Also needed by C++ cstdint
AC_TYPE_UINTPTR_T
AC_TYPE_INTPTR_T
AC_TYPE_UINT32_T dnl Needed for hash calculation
### Now we know uintptr_t is either in stdint.h or
### is defined in config.h by configure.
CPPFLAGS_save=${CPPFLAGS}
### Checks for compiler characteristics
AC_C_BIGENDIAN
AC_SUBST([DWARF_BIGENDIAN],[${ac_cv_c_bigendian}])
AC_ARG_VAR([DWARF_BIGENDIAN],
[big endian yes/no needed various places])
# gcc accepts even totally bogus -Wno flags. Other compilers..no
# -Wno-long-long suppresses warnings on 'long long'
# -Wno-pedantic-ms-format (which only exists in mingw)
# suppresses warnings about I64 printf format.
c_common_flags="-Wall -Wextra -Wpointer-arith -Wmissing-declarations -Wcomment -Wformat -Wpedantic -Wuninitialized -Wshadow -Werror -Wno-long-long"
AS_IF(
[ test "x$enable_wall" = "xyes" ],
[
cxx_compiler_flags="$c_common_flags -Wno-unused-private-field"
c_compiler_flags="$c_common_flags -Wmissing-prototypes -Wdeclaration-after-statement -Wbad-function-cast -Wmissing-parameter-type -Wnested-externs"
]
)
AS_IF(
[ test "x$have_win32" = "xyes" ],
[
cxx_compiler_flags="$cxx_compiler_flags -Wno-pedantic-ms-format"
c_compiler_flags="$c_compiler_flags -Wno-pedantic-ms-format"
]
)
DWARF_CHECK_C_COMPILER_FLAGS([${c_compiler_flags}])
# unused attribute
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
static unsigned int foo(unsigned int x, __attribute__ ((unused)) int y){
unsigned int x2 = x + 1;
return x2;
}
int goo() {
unsigned int y = 0;
y = foo(12, y);
}
]],
[[
]])
],
[
have_unused="yes"
AC_DEFINE(
[HAVE_UNUSED_ATTRIBUTE], [1],
[Set to 1 if __attribute__ ((unused)) is available.])
],
[have_unused="no"])
AC_MSG_CHECKING([whether "unused" attribute is available])
AC_MSG_RESULT([${have_unused}])
# sanitize
AS_IF(
[test "x${enable_sanitize}" = "xyes"],
[
CFLAGS_save=${CFLAGS}
CFLAGS="${CFLAGS} -fsanitize=address -fsanitize=leak -fsanitize=undefined -fno-omit-frame-pointer"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[]], [[]])],
[
enable_sanitize="yes"
DWARF_CFLAGS="$DWARF_CFLAGS -fsanitize=address -fsanitize=leak -fsanitize=undefined -fno-omit-frame-pointer"
LDFLAGS="$LDFLAGS -fsanitize=address -fsanitize=leak -fsanitize=undefined -fno-omit-frame-pointer"
],
[enable_sanitize="no"])
CFLAGS="${CFLAGS_save} ${DWARF_CFLAGS}"
])
AC_MSG_CHECKING([whether sanitize options are used])
AC_MSG_RESULT([${enable_sanitize}])
### Checks for linker characteristics
### Checks for library functions
### Checks for system services
AC_CONFIG_FILES([
Makefile
src/Makefile
test/Makefile
])
AC_OUTPUT
echo
echo "$PACKAGE $VERSION"
echo
echo "Configuration Options Summary:"
echo
echo " BuildOS..............: ${build_os}"
echo " HostOS...............: ${host_os}"
echo
echo " sanitize support.....: ${enable_sanitize}"
echo " BuildOS-BigEndian....: ${ac_cv_c_bigendian}"
echo
echo "Compilation............: make (or gmake)"
echo " CPPFLAGS.............: $CPPFLAGS"
echo " CFLAGS...............: $CFLAGS ${c_compiler_flags}"
echo " LDFLAGS..............: $LDFLAGS"
echo " LIBS.................: $LIBS"
echo " ZLIB_LIBS............: $ZLIB_LIBS"
echo
echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')"
echo " prefix...............: $prefix"
echo