-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
207 lines (176 loc) · 4.81 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
##
# libfastmap Autoconf script
#
# Author: Chris Heller <[email protected]>
#
AC_INIT([Fastmap Library],[0.9.0],[[email protected]],[libfastmap])
# Configure Autoconf
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADERS([fastmap_config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([include/fastmap.h])
# Check for programs
AC_PROG_CC
# Check for system features
AC_C_BIGENDIAN
AC_SYS_LARGEFILE
# Check for headers
AC_HEADER_STDC
AC_CHECK_HEADERS([stdlib.h])
# Lots of automake warnings
AM_INIT_AUTOMAKE([-Wall -Werror subdir-objects])
# *Required when using subdir-objects*
AM_PROG_CC_C_O
# *Required when using -Werror*
AM_PROG_AR
AC_PROG_LIBTOOL
##
# Enable compiler optimizations if desired
use_optimizers=false
AC_ARG_ENABLE(optimization,
[ --enable-optimization Use compiler optimizations during build. ],
[ use_optimizers=true ])
if [[ "x$use_optimizers" = "xtrue" ]]
then
CFLAGS="-Ofast"
else
CFLAGS="-g -ggdb -O0"
fi
AM_CONDITIONAL(USE_OPTIMIZERS, $use_optimizers)
##
# Provide a valgrind test target on request
use_valgrind=false
AC_ARG_ENABLE(valgrind,
[ --enable-valgrind Use valgrind when running test suite. ],
[ use_valgrind=true ])
if [[ "x$use_valgrind" = "xtrue" ]]
then
AC_CHECK_PROG(HAVE_VALGRIND, valgrind, yes, no)
if [[ "x$HAVE_VALGRIND" = "xno" ]]
then
AC_MSG_ERROR([ Valgrind not found in PATH. ])
fi
fi
AM_CONDITIONAL(USE_VALGRIND, $use_valgrind)
##
# Normalize integer types as best as we can
AC_CHECK_HEADERS(inttypes.h stdint.h)
# Check for various integer types
#
AC_CHECK_TYPES([ int8_t, int16_t, int32_t, int64_t]) # C99/BSD signed
AC_CHECK_TYPES([ int8, int16, int32, int64]) # ??? signed
AC_CHECK_TYPES([ uint8_t, uint16_t, uint32_t, uint64_t]) # C99 unsigned
AC_CHECK_TYPES([ uint8, uint16, uint32, uint64]) # ??? unsigned
AC_CHECK_TYPES([u_int8_t, u_int16_t, u_int32_t, u_int64_t]) # BSD unsigned
AC_CHECK_TYPES([long long, unsigned long long, socklen_t]) # misc.
# Check the size of various 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(float)
AC_CHECK_SIZEOF(double)
AC_CHECK_SIZEOF(long double)
AC_CHECK_SIZEOF(void *)
AC_CHECK_SIZEOF(size_t)
AH_VERBATIM([NORMALIZE_SIZED_INTEGERTYPES],
[/* Get the C99 integer types */
#if defined(HAVE_INTTYPES_H)
# include <inttypes.h>
#elif defined(HAVE_STDINT_H)
# include <stdint.h>
#endif
#ifndef HAVE_INT8_T
# if defined(HAVE_INT8)
typedef int8 int8_t;
# elif SIZEOF_CHAR == 1
typedef signed char int8_t;
# else
# error No usable signed 8-bit integer type found
# endif
#endif /* ! HAVE_INT8_T */
#ifndef HAVE_INT16_T
# if defined(HAVE_INT16)
typedef int16 int16_t;
# elif SIZEOF_SHORT == 2
typedef short int16_t;
# else
# error No usable signed 16-bit integer type found
# endif
#endif /* ! HAVE_INT16_T */
#ifndef HAVE_INT32_T
# if defined(HAVE_INT32)
typedef int32 int32_t;
# elif SIZEOF_INT == 4
typedef int int32_t;
# elif SIZEOF_LONG == 4
typedef long int32_t;
# else
# error No usable signed 32-bit integer type found
# endif
#endif /* ! HAVE_INT32_T */
#ifndef HAVE_INT64_T
# if defined(HAVE_INT64)
typedef int64 int64_t;
# elif SIZEOF_LONG == 8
typedef long int64_t;
# elif defined(HAVE_LONG_LONG) && SIZEOF_LONG_LONG == 8
typedef long long int64_t;
# else
# error No usable signed 64-bit integer type found
# endif
#endif /* ! HAVE_INT64_T */
#ifndef HAVE_UINT8_T
# if defined(HAVE_UINT8)
typedef uint8 uint8_t;
# elif defined(HAVE_U_INT8_T)
typedef u_int8_t uint8_t;
# elif SIZEOF_CHAR == 1
typedef unsigned char uint8_t;
# else
# error No usable unsigned 8-bit integer type found
# endif
#endif /* ! HAVE_UINT8_T */
#ifndef HAVE_UINT16_T
# if defined(HAVE_UINT16)
typedef uint16 uint16_t;
# elif defined(HAVE_U_INT16_T)
typedef u_int16_t uint16_t;
# elif SIZEOF_SHORT == 2
typedef unsigned short uint16_t;
# else
# error No usable unsigned 16-bit integer type found
# endif
#endif /* ! HAVE_UINT16_T */
#ifndef HAVE_UINT32_T
# if defined(HAVE_UINT32)
typedef uint32 uint32_t;
# elif defined(HAVE_U_INT32_T)
typedef u_int32_t uint32_t;
# elif SIZEOF_INT == 4
typedef unsigned int uint32_t;
# else
# error No usable unsigned 32-bit integer type found
# endif
#endif /* ! HAVE_UINT32_T */
#ifndef HAVE_UINT64_T
# if defined(HAVE_UINT64)
typedef uint64 uint64_t;
# elif defined(HAVE_U_INT64_T)
typedef u_int64_t uint64_t;
# elif SIZEOF_LONG == 8
typedef unsigned long uint64_t;
# elif defined(HAVE_UNSIGNED_LONG_LONG) && SIZEOF_LONG_LONG == 8
typedef unsigned long long uint64_t;
# else
# error No usable unsigned 64-bit integer type found
# endif
#endif /* ! HAVE_UINT64_T */])
AH_VERBATIM([CONFIG_H_CHECK],
[/* Check that fastmap_config.h is the very first include */
#if defined(__GLIBC__)
# error fastmap_config.h was not the very first #include
#endif])
AC_OUTPUT([Makefile])