Fix: disable JUL event on destroy
[lttng-tools.git] / configure.ac
1 AC_INIT([lttng-tools],[2.1.0],[dgoulet@efficios.com],[],[http://lttng.org])
2 AC_CONFIG_AUX_DIR([config])
3 AC_CANONICAL_TARGET
4 AC_CANONICAL_HOST
5 AC_CONFIG_MACRO_DIR([config])
6 AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip])
7 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
8
9 version_name="Basse Messe"
10 version_description="Light coloured German ale whose style was named after the city Cologne (Koln) where it was first brewed. It is a rather simple beer with lightly fruity aromas and a delicate hoppy fragrance. The beer has a pronounced malty taste with a subtle bitter aftertaste"
11
12 AC_DEFINE_UNQUOTED([VERSION_NAME], ["$version_name"], "")
13 AC_DEFINE_UNQUOTED([VERSION_DESCRIPTION], ["$version_description"], "")
14
15 AC_CONFIG_HEADERS([include/config.h])
16
17 AC_PROG_GREP
18 # libtool link_all_deplibs fixup. See http://bugs.lttng.org/issues/321.
19 AC_ARG_ENABLE(libtool-linkdep-fixup,
20         AS_HELP_STRING([--disable-libtool-linkdep-fixup],
21                         [disable the libtool fixup for linking all dependent libraries (link_all_deplibs)]),
22         libtool_fixup=$enableval,
23         libtool_fixup=yes)
24
25 AS_IF([test "x$libtool_fixup" = "xyes"],
26             [
27             libtool_m4="$srcdir/config/libtool.m4"
28             libtool_flag_pattern=".*link_all_deplibs\s*,\s*\$1\s*)"
29             AC_MSG_CHECKING([for occurence(s) of link_all_deplibs = no in $libtool_m4])
30             libtool_flag_pattern_count=$(grep -c "$libtool_flag_pattern\s*=\s*no" $libtool_m4)
31             AS_IF([test $libtool_flag_pattern_count -ne 0],
32             [
33                   AC_MSG_RESULT([$libtool_flag_pattern_count])
34                   AC_MSG_WARN([the detected libtool will not link all dependencies, forcing link_all_deplibs = unknown])
35                   sed -i "s/\($libtool_flag_pattern\)\s*=\s*no/\1=unknown/g" $libtool_m4
36                   ],
37                   [
38                   AC_MSG_RESULT([none])
39                   ])
40             ])
41
42 AM_CONDITIONAL([NO_SHARED], [test x$enable_shared = xno])
43
44 AC_CHECK_HEADERS([ \
45         sys/types.h unistd.h fcntl.h string.h pthread.h limits.h \
46         signal.h stdlib.h sys/un.h sys/socket.h stdlib.h stdio.h \
47         getopt.h sys/ipc.h sys/shm.h popt.h grp.h \
48 ])
49
50 # Babeltrace viewer check
51 AC_ARG_WITH([babeltrace-bin],
52         AS_HELP_STRING([--with-babeltrace-bin],
53         [Location of the babeltrace viewer executable (including the filename)]),
54         [BABELTRACE_BIN="$withval"],
55         [BABELTRACE_BIN=''])
56 AC_SUBST([BABELTRACE_BIN])
57
58 # lttv-gui
59 AC_ARG_WITH([lttv-gui-bin],
60         AS_HELP_STRING([--with-lttv-gui-bin],
61    [Location of the lttv GUI viewer executable (including the filename)]),
62    [LTTV_GUI_BIN="$withval"],
63    [LTTV_GUI_BIN=''])
64 AC_SUBST([LTTV_GUI_BIN])
65
66 AC_ARG_WITH([consumerd32-bin],
67         AS_HELP_STRING([--with-consumerd32-bin],
68         [Location of the 32-bit consumerd executable (including the filename)]),
69         [CONSUMERD32_BIN="$withval"],
70         [CONSUMERD32_BIN=''])
71 AC_SUBST([CONSUMERD32_BIN])
72
73 AC_ARG_WITH([consumerd64-bin],
74         AS_HELP_STRING([--with-consumerd64-bin],
75         [Location of the 64-bit consumerd executable (including the filename)]),
76         [CONSUMERD64_BIN="$withval"],
77         [CONSUMERD64_BIN=''])
78 AC_SUBST([CONSUMERD64_BIN])
79
80 AC_ARG_WITH([consumerd32-libdir],
81         AS_HELP_STRING([--with-consumerd32-libdir],
82         [Directory containing the 32-bit consumerd libraries]),
83         [CONSUMERD32_LIBDIR="$withval"],
84         [CONSUMERD32_LIBDIR=''])
85 AC_SUBST([CONSUMERD32_LIBDIR])
86
87 AC_ARG_WITH([consumerd64-libdir],
88         AS_HELP_STRING([--with-consumerd64-libdir],
89         [Directory containing the 64-bit consumerd libraries]),
90         [CONSUMERD64_LIBDIR="$withval"],
91         [CONSUMERD64_LIBDIR=''])
92 AC_SUBST([CONSUMERD64_LIBDIR])
93
94 AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD32_BIN], "$CONSUMERD32_BIN", [Location of the 32-bit consumerd executable.])
95 AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD64_BIN], "$CONSUMERD64_BIN", [Location of the 64-bit consumerd executable])
96 AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD32_LIBDIR], "$CONSUMERD32_LIBDIR", [Search for consumerd 32-bit libraries in this location.])
97 AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD64_LIBDIR], "$CONSUMERD64_LIBDIR", [Search for consumerd 64-bit libraries in this location.])
98 AC_DEFINE_UNQUOTED([CONFIG_BABELTRACE_BIN], "$BABELTRACE_BIN", [Location of the babeltrace viewer executable.])
99 AC_DEFINE_UNQUOTED([CONFIG_LTTV_GUI_BIN], "$LTTV_GUI_BIN", [Location of the lttv GUI viewer executable.])
100
101 # Check for pthread
102 AC_CHECK_LIB([pthread], [pthread_create], [],
103         [AC_MSG_ERROR([Cannot find libpthread. Use [LDFLAGS]=-Ldir to specify its location.])]
104 )
105
106 # Check libpopt
107 AC_CHECK_LIB([popt], [poptGetContext], [],
108         [AC_MSG_ERROR([Cannot find libpopt. Use [LDFLAGS]=-Ldir to specify its location.])]
109 )
110
111 # URCU library version needed or newer
112 liburcu_version=">= 0.7.2"
113
114 # Check liburcu needed function calls
115 AC_CHECK_DECL([cds_list_add], [],
116         [AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu/list.h>]]
117 )
118 AC_CHECK_DECL([cds_wfq_init], [],
119         [AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu/wfqueue.h>]]
120 )
121 AC_CHECK_DECL([cds_wfq_dequeue_blocking], [],
122     [AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu/wfqueue.h>]]
123 )
124 AC_CHECK_DECL([futex_async], [],
125         [AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu/futex.h>]]
126 )
127 AC_CHECK_DECL([rcu_thread_offline], [],
128         [AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu.h>]]
129 )
130 AC_CHECK_DECL([rcu_thread_online], [],
131         [AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu.h>]]
132 )
133 AC_CHECK_DECL([caa_likely], [],
134         [AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu.h>]]
135 )
136
137 # Check liblttng-ust-ctl library
138 AC_ARG_ENABLE(lttng-ust,
139         AS_HELP_STRING([--disable-lttng-ust],[build without LTTng-UST (Userspace Tracing) support]),
140         lttng_ust_support=$enableval, lttng_ust_support=yes)
141
142 AS_IF([test "x$lttng_ust_support" = "xyes"], [
143         AC_CHECK_LIB([lttng-ust-ctl], [ustctl_set_filter],
144                 [
145                         AC_DEFINE([HAVE_LIBLTTNG_UST_CTL], [1], [has LTTng-UST control support])
146                         lttng_ust_ctl_found=yes
147                 ],
148                 [AC_MSG_ERROR([Cannot find LTTng-UST 2.1.x. Use [LDFLAGS]=-Ldir to specify its location, or specify --disable-lttng-ust to build lttng-tools without LTTng-UST support.])],
149                 [-lurcu-common -lurcu-bp -lurcu-cds -lrt]
150         )
151 ])
152 AM_CONDITIONAL([HAVE_LIBLTTNG_UST_CTL], [test "x$lttng_ust_ctl_found" = xyes])
153 AC_CHECK_FUNCS([sched_getcpu sysconf sync_file_range])
154
155 # check for dlopen
156 AC_CHECK_LIB([dl], [dlopen],
157 [
158         have_libdl=yes
159 ],
160 [
161         #libdl not found, check for dlopen in libc.
162         AC_CHECK_LIB([c], [dlopen],
163         [
164                 have_libc_dl=yes
165         ],
166         [
167                 AC_MSG_ERROR([Cannot find dlopen in libdl nor libc. Use [LDFLAGS]=-Ldir to specify their location.])
168         ])
169 ])
170 AM_CONDITIONAL([LTTNG_TOOLS_BUILD_WITH_LIBDL], [test "x$have_libdl" = "xyes"])
171 AM_CONDITIONAL([LTTNG_TOOLS_BUILD_WITH_LIBC_DL], [test "x$have_libc_dl" = "xyes"])
172
173 # Check for fmemopen
174 AC_CHECK_LIB([c], [fmemopen],
175 [
176         AC_DEFINE_UNQUOTED([LTTNG_HAVE_FMEMOPEN], 1, [Has fmemopen support.])
177 ]
178 )
179
180 # Check for open_memstream
181 AC_CHECK_LIB([c], [open_memstream],
182 [
183         AC_DEFINE_UNQUOTED([LTTNG_HAVE_OPEN_MEMSTREAM], 1, [Has open_memstream support.])
184 ]
185 )
186
187 # For Python
188 # SWIG version needed or newer:
189 swig_version=2.0.0
190
191 AC_ARG_ENABLE([python-bindings],
192               [AC_HELP_STRING([--enable-python-bindings],
193                               [compile Python bindings])],
194               [enable_python=yes], [enable_python=no])
195
196 AM_CONDITIONAL([USE_PYTHON], [test "x${enable_python:-yes}" = xyes])
197
198 if test "x${enable_python:-yes}" = xyes; then
199   AX_PKG_SWIG($swig_version, [], [ AC_MSG_ERROR([SWIG $swig_version or newer is needed]) ])
200   AM_PATH_PYTHON
201
202   AC_ARG_VAR([PYTHON_INCLUDE], [Include flags for python, bypassing python-config])
203   AC_ARG_VAR([PYTHON_CONFIG], [Path to python-config])
204   AS_IF([test -z "$PYTHON_INCLUDE"], [
205     AS_IF([test -z "$PYTHON_CONFIG"], [
206       AC_PATH_PROGS([PYTHON_CONFIG],
207                     [python$PYTHON_VERSION-config python-config],
208                     [no],
209                     [`dirname $PYTHON`])
210       AS_IF([test "$PYTHON_CONFIG" = no], [AC_MSG_ERROR([cannot find python-config for $PYTHON. Do you have python-dev installed?])])
211     ])
212     AC_MSG_CHECKING([python include flags])
213     PYTHON_INCLUDE=`$PYTHON_CONFIG --includes`
214     AC_MSG_RESULT([$PYTHON_INCLUDE])
215   ])
216
217 else
218     AC_MSG_NOTICE([You may configure with --enable-python-bindings ]dnl
219 [if you want Python bindings.])
220
221 fi
222
223 # Option to only build the consumer daemon and its libraries
224 AC_ARG_WITH([consumerd-only],
225         AS_HELP_STRING([--with-consumerd-only],[Only build the consumer daemon [default=no]]),
226         [consumerd_only=$withval],
227         [consumerd_only=no])
228 AM_CONDITIONAL([BUILD_CONSUMERD_ONLY], [test "x$consumerd_only" = "xyes"])
229
230 # Epoll check. If not present, the build will fallback on poll() API
231 AX_HAVE_EPOLL(
232         [AX_CONFIG_FEATURE_ENABLE(epoll)],
233         [AX_CONFIG_FEATURE_DISABLE(epoll)]
234 )
235 AX_CONFIG_FEATURE(
236         [epoll], [This platform supports epoll(7)],
237         [HAVE_EPOLL], [This platform supports epoll(7).],
238         [enable_epoll="yes"], [enable_epoll="no"]
239 )
240 AM_CONDITIONAL([COMPAT_EPOLL], [ test "$enable_epoll" = "yes" ])
241
242 AC_SYS_LARGEFILE
243 AC_PROG_CC
244 LT_INIT
245 AC_PROG_YACC
246 AC_PROG_LEX
247
248 AC_DEFUN([AC_PROG_BISON], [AC_CHECK_PROGS(BISON, bison, bison)])
249
250 CFLAGS="-Wall $CFLAGS -g -fno-strict-aliasing"
251
252 DEFAULT_INCLUDES="-I\$(top_srcdir) -I\$(top_builddir) -I\$(top_builddir)/src -I\$(top_builddir)/include -include config.h"
253
254 lttngincludedir="${includedir}/lttng"
255
256 AC_SUBST(lttngincludedir)
257 AC_SUBST(DEFAULT_INCLUDES)
258
259 lttnglibexecdir="${libdir}/lttng/libexec"
260 AC_SUBST(lttnglibexecdir)
261
262 AC_CONFIG_FILES([
263         Makefile
264         doc/Makefile
265         doc/man/Makefile
266         include/Makefile
267         extras/Makefile
268         extras/bindings/Makefile
269         extras/bindings/swig/Makefile
270         extras/bindings/swig/python/Makefile
271         src/Makefile
272         src/common/Makefile
273         src/common/kernel-ctl/Makefile
274         src/common/kernel-consumer/Makefile
275         src/common/ust-consumer/Makefile
276         src/common/hashtable/Makefile
277         src/common/sessiond-comm/Makefile
278         src/common/compat/Makefile
279         src/common/relayd/Makefile
280         src/common/testpoint/Makefile
281         src/lib/Makefile
282         src/lib/lttng-ctl/Makefile
283         src/lib/lttng-ctl/filter/Makefile
284         src/lib/lttng-ctl/lttng-ctl.pc
285         src/bin/Makefile
286         src/bin/lttng-consumerd/Makefile
287         src/bin/lttng-sessiond/Makefile
288         src/bin/lttng-relayd/Makefile
289         src/bin/lttng/Makefile
290         tests/Makefile
291         tests/kernel/Makefile
292         tests/tools/Makefile
293         tests/tools/streaming/Makefile
294         tests/tools/filtering/Makefile
295         tests/tools/health/Makefile
296         tests/ust/Makefile
297         tests/ust/nprocesses/Makefile
298         tests/ust/high-throughput/Makefile
299         tests/ust/low-throughput/Makefile
300         tests/ust/before-after/Makefile
301         tests/ust/multi-session/Makefile
302         tests/ust/overlap/Makefile
303         tests/ust/overlap/demo/Makefile
304 ])
305
306 AC_OUTPUT
307
308 #
309 # Mini-report on what will be built
310 #
311 AS_ECHO()
312
313 AS_ECHO("Version name: $version_name")
314 AS_ECHO("$version_description")
315
316 AS_ECHO()
317
318 # Target architecture we're building for
319 target_arch=$host_cpu
320 [
321 for f in $CFLAGS; do
322         if test $f = "-m32"; then
323                         target_arch="32-bit"
324         elif test $f = "-m64"; then
325                         target_arch="64-bit"
326         fi
327 done
328 ]
329 AS_ECHO_N("Target architecture: ")
330 AS_ECHO($target_arch)
331
332 # LTTng-UST enabled/disabled
333 AS_ECHO_N("Lttng-UST support: ")
334 AS_IF([test "x$lttng_ust_support" = "xyes"],[
335         AS_ECHO("Enabled")
336 ],[
337         AS_ECHO("Disabled")
338 ])
339
340 #Python binding enabled/disabled
341 AS_ECHO_N("Python binding: ")
342 AS_IF([test "x${enable_python:-yes}" = xyes], [
343         AS_ECHO("Enabled")
344 ],[
345         AS_ECHO("Disabled")
346 ])
347
348 # Do we build only the consumerd, or everything
349 AS_IF([test "x$consumerd_only" = "xyes"],[
350         AS_ECHO("Only the consumerd daemon will be built.")
351 ],[
352         AS_ECHO("All binaries will be built.")
353 ])
354
355 # Print the bindir and libdir this `make install' will install into.
356 AS_ECHO()
357 AS_ECHO_N("Binaries will be installed in:  ")
358 AS_ECHO("`eval eval echo $bindir`")
359 AS_ECHO_N("Libraries will be installed in: ")
360 AS_ECHO("`eval eval echo $libdir`")
361
362 # If we build the sessiond, print the paths it will use
363 AS_IF([test "x$consumerd_only" = "xno"],[
364         AS_ECHO()
365         AS_ECHO("The sessiond daemon will look in the following directories: ")
366         AS_ECHO_N("32-bit consumerd executable at: ")
367         AS_IF([test "$CONSUMERD32_BIN" = ""],[
368                 AS_ECHO_N("`eval eval echo $lttnglibexecdir`")
369                 AS_ECHO("/lttng-consumerd")
370         ],[
371                 AS_ECHO("$CONSUMERD32_BIN")
372         ])
373
374         AS_ECHO_N("32-bit consumer libraries in:   ")
375         AS_IF([test "$CONSUMERD32_LIBDIR" = ""],[
376                 AS_ECHO("`eval eval echo $libdir`")
377         ],[
378                 AS_ECHO("$CONSUMERD32_LIBDIR")
379         ])
380
381         AS_ECHO_N("64-bit consumerd executable at: ")
382         AS_IF([test "$CONSUMERD64_BIN" = ""],[
383                 AS_ECHO_N("`eval eval echo $lttnglibexecdir`")
384                 AS_ECHO("/lttng-consumerd")
385         ],[
386                 AS_ECHO("$CONSUMERD64_BIN")
387         ])
388
389         AS_ECHO_N("64-bit consumer libraries in:   ")
390         AS_IF([test "$CONSUMERD64_LIBDIR" = ""],[
391                 AS_ECHO("`eval eval echo $libdir`")
392         ],[
393                 AS_ECHO("$CONSUMERD64_LIBDIR")
394         ])
395 ])
396
397 AS_ECHO()
398