File: configure.in

package info (click to toggle)
kyotocabinet 1.2.76-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 8,492 kB
  • ctags: 3,561
  • sloc: cpp: 59,347; ansic: 1,478; makefile: 1,207; ruby: 523; sh: 190; awk: 91; perl: 61
file content (362 lines) | stat: -rw-r--r-- 10,608 bytes parent folder | download | duplicates (2)
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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
# Source of configuration for Kyoto Cabinet



#================================================================
# Generic Settings
#================================================================

# Package name
AC_INIT(kyotocabinet, 1.2.76)

# Package information
MYLIBVER=16
MYLIBREV=13
MYFORMATVER=5

# Targets
MYHEADERFILES="kccommon.h kcutil.h kcthread.h kcfile.h"
MYHEADERFILES="$MYHEADERFILES kccompress.h kccompare.h kcmap.h kcregex.h"
MYHEADERFILES="$MYHEADERFILES kcdb.h kcplantdb.h kcprotodb.h kcstashdb.h kccachedb.h"
MYHEADERFILES="$MYHEADERFILES kchashdb.h kcdirdb.h kctextdb.h kcpolydb.h kcdbext.h kclangc.h"
MYLIBRARYFILES="libkyotocabinet.a"
MYLIBOBJFILES="kcutil.o kcthread.o kcfile.o kccompress.o kccompare.o kcmap.o kcregex.o"
MYLIBOBJFILES="$MYLIBOBJFILES kcdb.o kcplantdb.o kcprotodb.o kcstashdb.o kccachedb.o"
MYLIBOBJFILES="$MYLIBOBJFILES kchashdb.o kcdirdb.o kctextdb.o kcpolydb.o kcdbext.o kclangc.o"
MYCOMMANDFILES="kcutiltest kcutilmgr kcprototest kcstashtest kccachetest kcgrasstest"
MYCOMMANDFILES="$MYCOMMANDFILES kchashtest kchashmgr kctreetest kctreemgr"
MYCOMMANDFILES="$MYCOMMANDFILES kcdirtest kcdirmgr kcforesttest kcforestmgr"
MYCOMMANDFILES="$MYCOMMANDFILES kcpolytest kcpolymgr kclangctest"
MYMAN1FILES="kcutiltest.1 kcutilmgr.1 kcprototest.1 kcstashtest.1 kccachetest.1 kcgrasstest.1"
MYMAN1FILES="$MYMAN1FILES kchashtest.1 kchashmgr.1 kctreetest.1 kctreemgr.1"
MYMAN1FILES="$MYMAN1FILES kcdirtest.1 kcdirmgr.1 kcforesttest.1 kcforestmgr.1"
MYMAN1FILES="$MYMAN1FILES kcpolytest.1 kcpolymgr.1 kclangctest.1"
MYDOCUMENTFILES="COPYING FOSSEXCEPTION ChangeLog doc kyotocabinet.idl"
MYPCFILES="kyotocabinet.pc"

# Building flags
MYCFLAGS="-Wall -ansi -pedantic -fPIC -fsigned-char -g0 -O2"
MYCXXFLAGS="-Wall -fPIC -fsigned-char -g0 -O2"
MYCPPFLAGS="-I. -I\$(INCLUDEDIR) -I/usr/local/include"
MYCPPFLAGS="$MYCPPFLAGS -DNDEBUG -D_GNU_SOURCE=1"
MYCPPFLAGS="$MYCPPFLAGS -D_FILE_OFFSET_BITS=64 -D_REENTRANT -D__EXTENSIONS__"
MYLDFLAGS="-L. -L\$(LIBDIR) -L/usr/local/lib"
MYCMDLDFLAGS=""
MYCMDLIBS=""
MYLDLIBPATH=""
MYLDLIBPATHENV="LD_LIBRARY_PATH"
MYPOSTCMD="true"

# Building paths
PATH=".:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:$PATH"
CPATH=".:/usr/local/include:$CPATH"
LIBRARY_PATH=".:/usr/local/lib:$LIBRARY_PATH"
LD_LIBRARY_PATH=".:/usr/local/lib:$LD_LIBRARY_PATH"
PKG_CONFIG_PATH=".:/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"
export PATH CPATH LIBRARY_PATH LD_LIBRARY_PATH PKG_CONFIG_PATH



#================================================================
# Options
#================================================================

# Internal variables
enables=""
is_static=""

# Debug mode
AC_ARG_ENABLE(debug,
  AC_HELP_STRING([--enable-debug], [build for debugging]))
if test "$enable_debug" = "yes"
then
  MYCFLAGS="-Wall -ansi -pedantic -fPIC -fsigned-char -g -O0"
  MYCXXFLAGS="-Wall -fPIC -fsigned-char -g -O0"
  MYCPPFLAGS="$MYCPPFLAGS -UNDEBUG -D_KCDEBUG"
  is_static="yes"
  enables="$enables (debug)"
fi

# Developping mode
AC_ARG_ENABLE(devel,
  AC_HELP_STRING([--enable-devel], [build for development]))
if test "$enable_devel" = "yes"
then
  MYCFLAGS="-Wall -Wextra -Wno-unused-parameter"
  MYCFLAGS="$MYCFLAGS -ansi -pedantic -fPIC -fsigned-char -O2 -fno-inline -pipe"
  MYCXXFLAGS="-Wall -Wextra -Wno-unused-parameter -Wnon-virtual-dtor"
  MYCXXFLAGS="$MYCXXFLAGS -fPIC -fsigned-char -g -O2 -fno-inline -pipe"
  MYCPPFLAGS="$MYCPPFLAGS -UNDEBUG -D_KCDEBUG"
  enables="$enables (devel)"
fi

# Disable optimization
AC_ARG_ENABLE(opt,
  AC_HELP_STRING([--disable-opt], [build without optimization]))
if test "$enable_opt" = "no"
then
  MYCFLAGS="$MYCFLAGS -O0"
  MYCXXFLAGS="$MYCXXFLAGS -O0"
  enables="$enables (no-opt)"
fi

# Profiling mode
AC_ARG_ENABLE(profile,
  AC_HELP_STRING([--enable-profile], [build for profiling]))
if test "$enable_profile" = "yes"
then
  MYCXXFLAGS="-Wall -fPIC -fsigned-char -g -pg -O2 -fno-inline -pipe"
  enables="$enables (profile)"
fi

# Micro yield mode
AC_ARG_ENABLE(uyield,
  AC_HELP_STRING([--enable-uyield], [build for detecting race conditions]))
if test "$enable_uyield" = "yes"
then
  MYCPPFLAGS="$MYCPPFLAGS -UNDEBUG -D_KCUYIELD"
  enables="$enables (uyield)"
fi

# Static mode
AC_ARG_ENABLE(static,
  AC_HELP_STRING([--enable-static], [build by static linking]))
if test "$enable_static" = "yes"
then
  is_static="yes"
  enables="$enables (static)"
fi

# Disable shared object
AC_ARG_ENABLE(shared,
  AC_HELP_STRING([--disable-shared], [avoid to build shared libraries]))
if test "$enable_shared" = "no"
then
  enables="$enables (no-shared)"
fi

# Disable atomic operations
AC_ARG_ENABLE(atomic,
  AC_HELP_STRING([--disable-atomic], [build without atomic operations]))
if test "$enable_atomic" = "no"
then
  enables="$enables (no-atomic)"
fi

# Disable ZLIB compression
AC_ARG_ENABLE(zlib,
  AC_HELP_STRING([--disable-zlib], [build without ZLIB compression]))
if test "$enable_zlib" = "no"
then
  enables="$enables (no-zlib)"
else
  MYCPPFLAGS="$MYCPPFLAGS -D_MYZLIB"
fi

# Enable LZO compression
AC_ARG_ENABLE(lzo,
  AC_HELP_STRING([--enable-lzo], [build with LZO compression]))
if test "$enable_lzo" = "yes"
then
  MYCPPFLAGS="$MYCPPFLAGS -D_MYLZO"
  enables="$enables (lzo)"
fi

# Enable LZMA compression
AC_ARG_ENABLE(lzma,
  AC_HELP_STRING([--enable-lzma], [build with LZMA compression]))
if test "$enable_lzma" = "yes"
then
  MYCPPFLAGS="$MYCPPFLAGS -D_MYLZMA"
  enables="$enables (lzma)"
fi

# Messages
printf '#================================================================\n'
printf '# Configuring Kyoto Cabinet version %s%s.\n' "$PACKAGE_VERSION" "$enables"
printf '#================================================================\n'



#================================================================
# Checking Commands and Libraries
#================================================================

# C and C++ compilers
AC_PROG_CC
AC_PROG_CXX
AC_LANG(C++)

# Reset variables
if test "$GCC" != "yes"
then
  AC_MSG_WARN([another compiler except for GCC was detected])
  MYCFLAGS=""
  MYCXXFLAGS=""
fi
test -n "$CFLAGS" && MYCFLAGS="$CFLAGS $MYCFLAGS"
test -n "$CXXFLAGS" && MYCXXFLAGS="$CXXFLAGS $MYCXXFLAGS"
test -n "$CPPFLAGS" && MYCPPFLAGS="$CPPFLAGS $MYCPPFLAGS"
test -n "$LDFLAGS" && MYLDFLAGS="$LDFLAGS $MYLDFLAGS"

# Byte order
AC_C_BIGENDIAN(MYCPPFLAGS="$MYCPPFLAGS -D_MYBIGEND")

printf 'checking for useless warnings... '
if printf 'main() {}' | $CC -xc \
  -Wno-unused-but-set-variable -Wno-unused-but-set-parameter -o config.tmp - >config.tmp 2>&1
then
  MYCFLAGS="$MYCFLAGS -Wno-unused-but-set-variable -Wno-unused-but-set-parameter"
  MYCXXFLAGS="$MYCXXFLAGS -Wno-unused-but-set-variable -Wno-unused-but-set-parameter"
  printf 'yes\n'
else
  printf 'no\n'
fi

# Atomic operations
if test "$enable_atomic" != "no"
then
  printf 'checking for 8 byte atomic operations... '
  if printf '
/* Some targets support 4 byte atomics, but not 8 byte atomics,
 * and will fail at link time if they are used.
 *
 * http://gcc.gnu.org/onlinedocs/gcc-4.6.3/gcc/Atomic-Builtins.html
 * http://gcc.gnu.org/wiki/Atomic
 */
#include <stdint.h>
int
main ()
{
uint64_t n = 0xdeadbeaf;
__sync_bool_compare_and_swap(&n, 0xdeadbeaf, 0);
return n;
}' | $CC -xc -o config.tmp - >/dev/null 2>&1
  then
    MYCPPFLAGS="$MYCPPFLAGS -D_MYGCCATOMIC"
    printf 'yes\n'
  else
    printf 'no\n'
  fi
fi

# Underlying libraries
AC_CHECK_LIB(c, main)
AC_CHECK_LIB(m, main)
AC_CHECK_LIB(pthread, main)
AC_CHECK_LIB(rt, main)
AC_CHECK_LIB(stdc++, main)
AC_CHECK_LIB(regex, main)
if test "$enable_zlib" != "no"
then
  AC_CHECK_LIB(z, main)
fi
if test "$enable_lzo" = "yes"
then
  AC_CHECK_LIB(lzo2, main)
fi
if test "$enable_lzma" = "yes"
then
  AC_CHECK_LIB(lzma, main)
fi
AC_CHECK_LIB(kyotocabinet, main, AC_MSG_WARN([old version of Kyoto Cabinet was detected]))
MYLDLIBPATH="$LD_LIBRARY_PATH"

# Necessary headers
AC_CHECK_HEADER(stdlib.h, true, AC_MSG_ERROR([stdlib.h is required]))
AC_CHECK_HEADER(stdint.h, true, AC_MSG_ERROR([stdint.h is required]))
AC_CHECK_HEADER(unistd.h, true, AC_MSG_ERROR([unistd.h is required]))
AC_CHECK_HEADER(fcntl.h, true, AC_MSG_ERROR([fcntl.h is required]))
AC_CHECK_HEADER(dirent.h, true, AC_MSG_ERROR([dirent.h is required]))
AC_CHECK_HEADER(pthread.h, true, AC_MSG_ERROR([pthread.h is required]))
AC_CHECK_HEADER(regex.h, true, AC_MSG_ERROR([regex.h is required]))
if test "$enable_zlib" != "no"
then
  AC_CHECK_HEADER(zlib.h, true, AC_MSG_ERROR([zlib.h is required]))
fi
if test "$enable_lzo" = "yes"
then
  AC_CHECK_HEADER(lzo/lzo1x.h, true, AC_MSG_ERROR([lzo/lzo1x.h is required]))
fi
if test "$enable_lzma" = "yes"
then
  AC_CHECK_HEADER(lzma.h, true, AC_MSG_ERROR([lzma.h is required]))
fi

# Static linking
if test "$is_static" = "yes"
then
  MYCMDLDFLAGS="$MYCMDLDFLAGS -static"
  MYCMDLIBS="$MYCMDLIBS $LIBS"
fi

# As-needed linking
if uname -o | egrep "GNU/Linux|GNU/kFreeBSD" >config.tmp
then
#  MYLDFLAGS="$MYLDFLAGS -Wl,-rpath-link,.:/usr/local/lib:$MYLDLIBPATH"
  MYLDFLAGS="$MYLDFLAGS -Wl,--as-needed"
else
  MYCMDLIBS="$MYCMDLIBS $LIBS"
fi

# Shared libraries
if test "$enable_shared" != "no" && test "$enable_profile" != "yes"
then
  if uname | grep Darwin >config.tmp
  then
    MYLIBRARYFILES="$MYLIBRARYFILES libkyotocabinet.$MYLIBVER.$MYLIBREV.0.dylib"
    MYLIBRARYFILES="$MYLIBRARYFILES libkyotocabinet.$MYLIBVER.dylib"
    MYLIBRARYFILES="$MYLIBRARYFILES libkyotocabinet.dylib"
    MYLDLIBPATHENV="DYLD_LIBRARY_PATH"
  else
    MYLIBRARYFILES="$MYLIBRARYFILES libkyotocabinet.so.$MYLIBVER.$MYLIBREV.0"
    MYLIBRARYFILES="$MYLIBRARYFILES libkyotocabinet.so.$MYLIBVER"
    MYLIBRARYFILES="$MYLIBRARYFILES libkyotocabinet.so"
  fi
fi

# Work around of bugs of some environments
if uname | grep Darwin >config.tmp
then
  MYCFLAGS="$MYCFLAGS -Os"
  MYCXXFLAGS="$MYCXXFLAGS -Os"
fi



#================================================================
# Generic Settings
#================================================================

# Export variables
AC_SUBST(MYLIBVER)
AC_SUBST(MYLIBREV)
AC_SUBST(MYFORMATVER)
AC_SUBST(MYHEADERFILES)
AC_SUBST(MYLIBRARYFILES)
AC_SUBST(MYLIBOBJFILES)
AC_SUBST(MYCOMMANDFILES)
AC_SUBST(MYMAN1FILES)
AC_SUBST(MYDOCUMENTFILES)
AC_SUBST(MYPCFILES)
AC_SUBST(MYCFLAGS)
AC_SUBST(MYCXXFLAGS)
AC_SUBST(MYCPPFLAGS)
AC_SUBST(MYLDFLAGS)
AC_SUBST(MYCMDLDFLAGS)
AC_SUBST(MYCMDLIBS)
AC_SUBST(MYLDLIBPATH)
AC_SUBST(MYLDLIBPATHENV)
AC_SUBST(MYPOSTCMD)

# Targets
AC_OUTPUT(Makefile kyotocabinet.pc)

# Messages
printf '#================================================================\n'
printf '# Ready to make.\n'
printf '#================================================================\n'



# END OF FILE