forked from facebook/watchman
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
277 lines (244 loc) · 7.94 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
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
AC_INIT([watchman], [4.3.0], [], [watchman])
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE([dist-bzip2 subdir-objects])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)])
CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE"
case $target_os in
*solaris*)
dnl we really want you to be using 64 hardware and software.
dnl if we don't build 64-bit, our test suite fails when comparing the
dnl results of a 64-bit dev_t from PHP's stat info
CFLAGS="$CFLAGS -m64"
;;
*darwin*)
dnl avoid compilation failure on OS X when building with python
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future
AC_SUBST(ARCHFLAGS)
;;
esac
AC_PROG_CC
AC_PROG_CPP
AC_C_BIGENDIAN
AC_C_INLINE
AC_PROG_RANLIB
AM_PROG_CC_C_O
AM_PROG_AS
dnl Look for "arc" so that we can conditionally enable more pedantry
dnl when building. We prefer that contributors use "arc" but don't
dnl require users to have it to build and use watchman
AC_CHECK_PROG(HAVE_ARC, arc, yes, no)
AM_CONDITIONAL(HAVE_ARC, test "x$HAVE_ARC" = xyes)
dnl I don't care that this is supposed to be sysconfdir; autoconf doesn't
dnl allow it to be evaluated sanely from configure, only via Makefile,
dnl which I don't care about. Just pass the right value to configure.
conffile=/etc/watchman.json
AC_ARG_ENABLE(conffile, [
--enable-conffile=PATH Use PATH as the default configuration file name.
Default is /etc/watchman.json
],[
conffile=$enableval
])
if test "$conffile" != "no" ; then
AC_DEFINE_UNQUOTED(WATCHMAN_CONFIG_FILE, "$conffile",
[system configuration file path])
fi
AC_ARG_WITH(buildinfo, [
--with-buildinfo=TEXT Include some extra build information that will
be reported in the version command output
],[
AC_DEFINE_UNQUOTED(WATCHMAN_BUILD_INFO, "$withval", [build info])
])
xprefix=$prefix
if test "$xprefix" = "NONE"; then
xprefix=$ac_default_prefix
fi
WATCHMAN_STATE_DIR="$xprefix/var/run/watchman"
AC_ARG_ENABLE(statedir, [
--enable-statedir=PATH Use PATH as the default for state, log files
and sockets instead of using your system tempdir
],[
WATCHMAN_STATE_DIR="$enableval"
])
if test "$WATCHMAN_STATE_DIR" != "no"; then
AC_DEFINE_UNQUOTED(WATCHMAN_STATE_DIR,
["$WATCHMAN_STATE_DIR"],
[watchman state directory])
AC_SUBST(WATCHMAN_STATE_DIR)
fi
AM_CONDITIONAL(WATCHMAN_STATE_DIR, [test "$WATCHMAN_STATE_DIR" != "no"])
want_python=yes
AC_ARG_WITH(python, [
--without-python Disable python bindings
],[
want_python="$withval"
])
if test "x$want_python" = "xyes" ; then
AM_PATH_PYTHON(,,[:])
fi
AM_CONDITIONAL(HAVE_PYTHON, [test "$PYTHON" != : -a "x$want_python" = "xyes"])
want_ruby=no
AC_ARG_WITH(ruby, [
--with-ruby Enable ruby bindings (requires ruby, gem, bundler)
],[
want_ruby="$withval"
])
AM_CONDITIONAL(HAVE_RUBY, [test "x$want_ruby" = "xyes"])
AC_ARG_WITH(pcre, [
--without-pcre Don't enable pcre support.
--with-pcre=PATH Enable pcre support. PATH is location of pcre-config.
Default is to enable and look for pcre-config in your
$PATH
],[
pcre_config="$withval"
],[
pcre_config="check"
])
if test "$pcre_config" != "no" ; then
if test "$pcre_config" = "yes" -o "$pcre_config" = "check"; then
AC_PATH_PROG(PCRE_CONFIG_PATH, pcre-config, false)
dnl If --with-pcre was specified but pcre-config not found, fail hard now.
if test "$pcre_config" = "yes" -a "$PCRE_CONFIG_PATH" = "false"; then
AC_MSG_FAILURE([--with-pcre was given, but pcre-config not found in PATH])
fi
else
PCRE_CONFIG_PATH="$pcre_config"
fi
AC_MSG_CHECKING(for PCRE using $PCRE_CONFIG_PATH)
pcre_version=`"$PCRE_CONFIG_PATH" --version 2>/dev/null`
if test $? -ne 0; then
AC_MSG_RESULT(failed)
else
AC_MSG_RESULT($pcre_version)
fi
if test -n "$pcre_version"; then
PCRE_LIBS=`$PCRE_CONFIG_PATH --libs`
LIBS="$LIBS $PCRE_LIBS"
PCRE_CFLAGS=`$PCRE_CONFIG_PATH --cflags`
CFLAGS="$CFLAGS $PCRE_CFLAGS"
CPPFLAGS="$CPPFLAGS $PCRE_CFLAGS"
AC_CHECK_HEADERS(pcre.h, [], [
if test "$pcre_config" != "check"; then
AC_MSG_FAILURE([--with-pcre was given, but pcre not found:
pcre-config --libs=$PCRE_LIBS
pcre-config --cflags=$PCRE_CFLAGS])
fi
])
elif test "$pcre_config" != "check"; then
AC_MSG_FAILURE([$PCRE_CONFIG_PATH failed to run, could not check for PCRE])
fi
fi
gimli=no
AC_ARG_WITH(gimli, [
--with-gimli Enable support for the gimli process monitor
https://bitbucket.org/wez/gimli/
],[
gimli=$withval
])
if test "x$gimli" != "xno" ; then
AC_DEFINE([USE_GIMLI], 1, [Use gimli])
dnl deal with annoying lack of rpath and linux lib64
dirs="/usr/local/lib /usr/lib"
rpath="-R"
case $target_os-$target_cpu in
linux-*64)
dirs="/usr/local/lib64 $libs"
rpath="-Wl,-rpath="
;;
linux*)
rpath="-Wl,-rpath="
;;
esac
save_flags="$LDFLAGS"
save_libs="$LIBS"
gimli_dir=""
MONITOR_PATH="monitor"
for dir in $dirs ; do
LDFLAGS="$save_flags $rpath$dir -L$dir"
LIBS="$save_libs -lgimli"
AC_TRY_LINK([
#include <libgimli.h>
],[gimli_heartbeat_attach();],
[gimli_dir=$dir]
)
if test -n "$gimli_dir" ; then
save_flags="$save_flags $rpath$dir -L$dir"
save_libs="$save_libs -lgimli"
dnl resolve real path to bin dir
MONITOR_PATH="`cd $gimli_dir/../bin ; echo \$PWD`/monitor"
break
fi
done
if test ! -x "$MONITOR_PATH" ; then
MONITOR_PATH="monitor"
fi
AC_DEFINE_UNQUOTED(GIMLI_MONITOR_PATH,
"$MONITOR_PATH",
[path to gimli monitor process])
LDFLAGS="$save_flags"
LIBS="$save_libs"
AC_CHECK_HEADERS(libgimli.h)
fi
lenient=no
AC_ARG_ENABLE(lenient, [
--enable-lenient Turn off more pedantic levels of warnings
and compilation checks
],[
lenient=$enableval
])
stack_protect=no
AC_ARG_ENABLE(stack-protector, [
--enable-stack-protector Enable stack protection in the same
way that rpmbuild does on some systems.
],[
stack_protect=$enableval
])
AC_SEARCH_LIBS([pthread_create], [pthread])
AC_SEARCH_LIBS([socket], [socket])
AC_CHECK_HEADERS(sys/types.h inttypes.h locale.h port.h sys/inotify.h sys/event.h)
AC_CHECK_FUNCS(mkostemp kqueue port_create inotify_init strtoll localeconv statfs)
AC_CHECK_FUNCS(accept4 inotify_init1 getattrlistbulk openat fdopendir)
AC_CHECK_HEADERS(sys/vfs.h sys/param.h sys/mount.h sys/statfs.h sys/statvfs.h, [], [],
[[#ifdef __OpenBSD__
# include <sys/param.h>
#endif
]])
AC_CHECK_HEADERS(valgrind/valgrind.h)
AC_CHECK_HEADERS(execinfo.h sys/resource.h)
AC_CHECK_HEADERS(CoreServices/CoreServices.h, [
LIBS="$LIBS -framework CoreServices"
])
AC_CHECK_FUNCS(backtrace backtrace_symbols backtrace_symbols_fd)
if test -n "$ac_cv_header_sys_statvfs_h"; then
AC_CHECK_MEMBERS([struct statvfs.f_fstypename,struct statvfs.f_basetype],
[AC_DEFINE([STATVFS_HAS_FSTYPE_AS_STRING], [1],[if statvfs holds fstype as string])],[],[[#include <sys/statvfs.h>]])
fi
# Do this after we've looked for functions
if test -n "$GCC" ; then
CFLAGS="$CFLAGS -Wall -Wextra -Wdeclaration-after-statement -g -gdwarf-2 -fno-omit-frame-pointer"
fi
if test -n "$GCC" -a "$stack_protect" = "yes" ; then
CFLAGS="$CFLAGS -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4"
fi
IRONMANCFLAGS=""
if test -n "$GCC" -a "$lenient" = "no" ; then
IRONMANCFLAGS="-Werror"
fi
AC_SUBST(IRONMANCFLAGS)
AC_CONFIG_HEADER([config.h])
AC_CONFIG_FILES([Makefile thirdparty/jansson/jansson_config.h])
AC_OUTPUT
if test "$WATCHMAN_STATE_DIR" != "no"; then
reported_state_directory="$WATCHMAN_STATE_DIR"
else
reported_state_directory="System temporary directory"
fi
cat << EOF
Your build configuration:
CPPFLAGS = $CPPFLAGS
CFLAGS = $CFLAGS
LDFLAGS = $LDFLAGS
prefix: $prefix
version: $VERSION
state directory: $reported_state_directory
EOF
dnl vim:ts=2:sw=2: