forked from jubatus/jubatus-mpio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.in
134 lines (110 loc) · 3.73 KB
/
configure.in
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
# Copyright (C) 2013 Preferred Infrastructure and Nippon Telegraph and Telephone Corporation.
AC_INIT(mpsrc/wavy_kernel.h)
m4_include(m4/ax_check_link_flag.m4)
AC_CONFIG_AUX_DIR(ac)
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE(jubatus_mpio, 0.4.2)
AC_CONFIG_HEADER(config.h)
# Default enabled -O4
AC_ARG_ENABLE(optimized, AS_HELP_STRING([--disable-optimized], [Compile with optimizations -O4 (default is enable)]))
# Check compiler driver can link -O4 generated file(for clang)
AS_IF([test "x$enable_optimized" != "xno"], [
# Use default flag with -O3 -Wall
save_c_flags="$CFLAGS"
save_cxx_flags="$CXXFLAGS"
CFLAGS="-Wall"
CXXFLAGS="-Wall"
AC_LANG_PUSH([C])
AX_CHECK_LINK_FLAG(-O4, [CFLAGS="-O4 $CFLAGS"], [CFLAGS="$CFLAGS $save_c_flags"])
AC_LANG_POP([C])
AC_LANG_PUSH([C++])
AX_CHECK_LINK_FLAG(-O4, [CXXFLAGS="-O4 $CXXFLAGS"], [CXXFLAGS="$CXXFLAGS $save_cxx_flags"])
AC_LANG_POP([C++])
])
AC_PROG_CC
AC_PROG_CXX
AC_PROG_LIBTOOL
AM_PROG_AS
AM_PROG_CC_C_O
AC_CACHE_CHECK([for __sync_* atomic operations], kumofs_cv_atomic_ops, [
AC_TRY_LINK([
int atomic_sub(int i) { return __sync_sub_and_fetch(&i, 1); }
int atomic_add(int i) { return __sync_add_and_fetch(&i, 1); }
int atomic_cas(int i) { return __sync_bool_compare_and_swap(&i, 0, 1); }
], [], kumofs_cv_atomic_ops="yes")
])
if test "$kumofs_cv_atomic_ops" != "yes"; then
AC_MSG_ERROR([__sync_* atomic operations are not supported.
Note that gcc < 4.1 is not supported.
If you are using gcc >= 4.1 and the default target CPU architecture is "i386", try to
add CFLAGS="-march=i686" and CXXFLAGS="-march=i686" options to ./configure as follows:
$ ./configure CFLAGS="-march=i686" CXXFLAGS="-march=i686"
])
fi
AC_CHECK_LIB(stdc++, main)
AC_CHECK_LIB(pthread,pthread_create,,
AC_MSG_ERROR([Can't find pthread library]))
case "$target_os" in
solaris*)
AC_CHECK_LIB(socket,accept,,
AC_MSG_ERROR([Can't find libsocket.]))
AC_CHECK_LIB(nsl,inet_ntop,,
AC_MSG_ERROR([Can't find libnsl.]))
AC_CHECK_LIB(sendfile,sendfile,,
AC_MSG_ERROR([Can't find libsendfile.]))
CXXFLAGS="$CXXFLAGS -D_REENTRANT"
CFLAGS="$CFLAGS -D_REENTRANT"
;;
linux*)
AC_MSG_CHECKING([if timerfd is enabled])
AC_ARG_ENABLE(timerfd,
AS_HELP_STRING([--disable-timerfd],
[use POSIX timer instead of timerfd. (compatility for linux < 2.6.25)]) )
AC_MSG_RESULT($enable_timerfd)
if test "$enable_timerfd" = "no"; then
CXXFLAGS="$CXXFLAGS -DDISABLE_TIMERFD"
CFLAGS="$CFLAGS -DDISABLE_TIMERFD"
AC_CHECK_LIB(rt,timer_create,,
AC_MSG_ERROR([Can't find rt library]))
else
AC_CHECK_HEADER(sys/timerfd.h, [],
AC_MSG_ERROR([sys/timerfd.h is not available.
You can't use timerfd on this system.
It requires linux >= 2.6.25 and glibc >= 2.8.
Add --disable-timerfd option to use POSIX timer instead of timerfd.
]))
fi
AC_MSG_CHECKING([if signalfd is enabled])
AC_ARG_ENABLE(signalfd,
AS_HELP_STRING([--disable-signalfd],
[do not use signalfd. (compatility for linux < 2.6.22)]) )
AC_MSG_RESULT($enable_signalfd)
if test "$enable_signalfd" = "no"; then
CXXFLAGS="$CXXFLAGS -DDISABLE_SIGNALFD"
CFLAGS="$CFLAGS -DDISABLE_SIGNALFD"
else
AC_CHECK_HEADER(sys/signalfd.h, [],
AC_MSG_ERROR([sys/signalfd.h is not available.
You can't use mp::wavy::add_signal on this system.
It requires linux >= 2.6.22 and glibc >= 2.8.
Add --disable-signalfd option to disable mp::wavy::add_signal.
]))
fi
;;
esac
AC_MSG_CHECKING([if debug option is enabled])
AC_ARG_ENABLE(debug,
AS_HELP_STRING([--disable-debug],
[disable assert macros and omit -g option.]) )
if test "$enable_debug" != "no"; then
CXXFLAGS="$CXXFLAGS -g"
CFLAGS="$CFLAGS -g"
else
CXXFLAGS="$CXXFLAGS -DNDEBUG"
CFLAGS="$CFLAGS -DNDEBUG"
fi
AC_MSG_RESULT($enable_debug)
AC_OUTPUT([Makefile
jubatus/mp/Makefile
mpsrc/Makefile
test/Makefile])