build: export major/minor/patchlevel numbers
[lttng-tools.git] / configure.ac
1 AC_INIT([lttng-tools],[2.3.0-rc2],[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 # Compute minor/major/patchlevel version numbers
10 AC_PROG_SED
11 major_version=$(echo AC_PACKAGE_VERSION | sed 's/^\([[0-9]]\)*\.[[0-9]]*\.[[0-9]]*.*$/\1/')
12 minor_version=$(echo AC_PACKAGE_VERSION | sed 's/^[[0-9]]*\.\([[0-9]]*\)\.[[0-9]]*.*$/\1/')
13 patchlevel_version=$(echo AC_PACKAGE_VERSION | sed 's/^[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\).*$/\1/')
14 AC_SUBST([MAJOR_VERSION], [$major_version])
15 AC_SUBST([MINOR_VERSION], [$minor_version])
16 AC_SUBST([PATCHLEVEL_VERSION], [$patchlevel_version])
17 AC_DEFINE_UNQUOTED([VERSION_MAJOR], $major_version, [UST major version number])
18 AC_DEFINE_UNQUOTED([VERSION_MINOR], $minor_version, [UST minor version number])
19 AC_DEFINE_UNQUOTED([VERSION_PATCHLEVEL], $patchlevel_version, [UST patchlevel version number])
20
21 version_name="Dominus Vobiscum"
22 version_description="A very succulent line-up of beers brewed at Microbrasserie Charlevoix. Elaborated starting from special malts and fermented with a Belgian yeast. These beers are refermented in bottle and will make you discover the richness of wheat, amber and triple styles."
23
24 AC_DEFINE_UNQUOTED([VERSION_NAME], ["$version_name"], "")
25 AC_DEFINE_UNQUOTED([VERSION_DESCRIPTION], ["$version_description"], "")
26
27 AC_CONFIG_HEADERS([include/config.h])
28
29 AC_PROG_GREP
30 # libtool link_all_deplibs fixup. See http://bugs.lttng.org/issues/321.
31 AC_ARG_ENABLE(libtool-linkdep-fixup,
32 AS_HELP_STRING([--disable-libtool-linkdep-fixup],
33 [disable the libtool fixup for linking all dependent libraries (link_all_deplibs)]),
34 libtool_fixup=$enableval,
35 libtool_fixup=yes)
36
37 AS_IF([test "x$libtool_fixup" = "xyes"],
38 [
39 libtool_m4="$srcdir/config/libtool.m4"
40 libtool_flag_pattern=".*link_all_deplibs\s*,\s*\$1\s*)"
41 AC_MSG_CHECKING([for occurence(s) of link_all_deplibs = no in $libtool_m4])
42 libtool_flag_pattern_count=$(grep -c "$libtool_flag_pattern\s*=\s*no" $libtool_m4)
43 AS_IF([test $libtool_flag_pattern_count -ne 0],
44 [
45 AC_MSG_RESULT([$libtool_flag_pattern_count])
46 AC_MSG_WARN([the detected libtool will not link all dependencies, forcing link_all_deplibs = unknown])
47 sed -i "s/\($libtool_flag_pattern\)\s*=\s*no/\1=unknown/g" $libtool_m4
48 ],
49 [
50 AC_MSG_RESULT([none])
51 ])
52 ])
53
54 AM_CONDITIONAL([NO_SHARED], [test x$enable_shared = xno])
55
56 AC_CHECK_HEADERS([ \
57 sys/types.h unistd.h fcntl.h string.h pthread.h limits.h \
58 signal.h stdlib.h sys/un.h sys/socket.h stdlib.h stdio.h \
59 getopt.h sys/ipc.h sys/shm.h popt.h grp.h \
60 ])
61
62 # Babeltrace viewer check
63 AC_ARG_WITH([babeltrace-bin],
64 AS_HELP_STRING([--with-babeltrace-bin],
65 [Location of the babeltrace viewer executable (including the filename)]),
66 [BABELTRACE_BIN="$withval"],
67 [BABELTRACE_BIN=''])
68 AC_SUBST([BABELTRACE_BIN])
69
70 # lttv-gui
71 AC_ARG_WITH([lttv-gui-bin],
72 AS_HELP_STRING([--with-lttv-gui-bin],
73 [Location of the lttv GUI viewer executable (including the filename)]),
74 [LTTV_GUI_BIN="$withval"],
75 [LTTV_GUI_BIN=''])
76 AC_SUBST([LTTV_GUI_BIN])
77
78 AC_ARG_WITH([consumerd32-bin],
79 AS_HELP_STRING([--with-consumerd32-bin],
80 [Location of the 32-bit consumerd executable (including the filename)]),
81 [CONSUMERD32_BIN="$withval"],
82 [CONSUMERD32_BIN=''])
83 AC_SUBST([CONSUMERD32_BIN])
84
85 AC_ARG_WITH([consumerd64-bin],
86 AS_HELP_STRING([--with-consumerd64-bin],
87 [Location of the 64-bit consumerd executable (including the filename)]),
88 [CONSUMERD64_BIN="$withval"],
89 [CONSUMERD64_BIN=''])
90 AC_SUBST([CONSUMERD64_BIN])
91
92 AC_ARG_WITH([consumerd32-libdir],
93 AS_HELP_STRING([--with-consumerd32-libdir],
94 [Directory containing the 32-bit consumerd libraries]),
95 [CONSUMERD32_LIBDIR="$withval"],
96 [CONSUMERD32_LIBDIR=''])
97 AC_SUBST([CONSUMERD32_LIBDIR])
98
99 AC_ARG_WITH([consumerd64-libdir],
100 AS_HELP_STRING([--with-consumerd64-libdir],
101 [Directory containing the 64-bit consumerd libraries]),
102 [CONSUMERD64_LIBDIR="$withval"],
103 [CONSUMERD64_LIBDIR=''])
104 AC_SUBST([CONSUMERD64_LIBDIR])
105
106 AC_ARG_WITH([sessiond-bin],
107 AS_HELP_STRING([--with-sessiond-bin],
108 [Location of the sessiond executable (including the filename)]),
109 [SESSIOND_BIN="$withval"],
110 [SESSIOND_BIN=''])
111 AC_SUBST([SESSIOND_BIN])
112
113 AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD32_BIN], "$CONSUMERD32_BIN", [Location of the 32-bit consumerd executable.])
114 AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD64_BIN], "$CONSUMERD64_BIN", [Location of the 64-bit consumerd executable])
115 AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD32_LIBDIR], "$CONSUMERD32_LIBDIR", [Search for consumerd 32-bit libraries in this location.])
116 AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD64_LIBDIR], "$CONSUMERD64_LIBDIR", [Search for consumerd 64-bit libraries in this location.])
117 AC_DEFINE_UNQUOTED([CONFIG_BABELTRACE_BIN], "$BABELTRACE_BIN", [Location of the babeltrace viewer executable.])
118 AC_DEFINE_UNQUOTED([CONFIG_LTTV_GUI_BIN], "$LTTV_GUI_BIN", [Location of the lttv GUI viewer executable.])
119 AC_DEFINE_UNQUOTED([CONFIG_SESSIOND_BIN], "$SESSIOND_BIN", [Location of the sessiond executable.])
120
121 # Check for pthread
122 AC_CHECK_LIB([pthread], [pthread_create], [],
123 [AC_MSG_ERROR([Cannot find libpthread. Use [LDFLAGS]=-Ldir to specify its location.])]
124 )
125
126 # Check libpopt
127 AC_CHECK_LIB([popt], [poptGetContext], [],
128 [AC_MSG_ERROR([Cannot find libpopt. Use [LDFLAGS]=-Ldir to specify its location.])]
129 )
130
131 # Check for libuuid
132 AC_CHECK_LIB([uuid], [uuid_generate],
133 [
134 AC_DEFINE_UNQUOTED([LTTNG_HAVE_LIBUUID], 1, [Has libuuid support.])
135 have_libuuid=yes
136 ],
137 [
138 # libuuid not found, check for uuid_create in libc.
139 AC_CHECK_LIB([c], [uuid_create],
140 [
141 AC_DEFINE_UNQUOTED([LTTNG_HAVE_LIBC_UUID], 1, [Has libc uuid support.])
142 have_libc_uuid=yes
143 ],
144 [
145 AC_MSG_ERROR([Cannot find libuuid uuid_generate nor libc uuid_create. Use [LDFLAGS]=-Ldir to specify their location.])
146 ])
147 ]
148 )
149 AM_CONDITIONAL([LTTNG_BUILD_WITH_LIBUUID], [test "x$have_libuuid" = "xyes"])
150 AM_CONDITIONAL([LTTNG_BUILD_WITH_LIBC_UUID], [test "x$have_libc_uuid" = "xyes"])
151
152 # URCU library version needed or newer
153 liburcu_version=">= 0.7.2"
154
155 # Check liburcu needed function calls
156 AC_CHECK_DECL([cds_list_add], [],
157 [AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu/list.h>]]
158 )
159 AC_CHECK_DECL([cds_wfq_init], [],
160 [AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu/wfqueue.h>]]
161 )
162 AC_CHECK_DECL([cds_wfq_dequeue_blocking], [],
163 [AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu/wfqueue.h>]]
164 )
165 AC_CHECK_DECL([futex_async], [],
166 [AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu/futex.h>]]
167 )
168 AC_CHECK_DECL([rcu_thread_offline], [],
169 [AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu.h>]]
170 )
171 AC_CHECK_DECL([rcu_thread_online], [],
172 [AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu.h>]]
173 )
174 AC_CHECK_DECL([caa_likely], [],
175 [AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu.h>]]
176 )
177 #Function added in urcu 0.7.0
178 AC_CHECK_DECL([cmm_smp_mb__before_uatomic_or], [],
179 [AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu.h>]]
180 )
181
182 AC_ARG_WITH(lttng-ust-prefix,
183 AS_HELP_STRING([--with-lttng-ust-prefix=PATH],
184 [Specify the installation prefix of the lttng-ust library.
185 Headers must be in PATH/include; libraries in PATH/lib.]),
186 [
187 CPPFLAGS="$CPPFLAGS -I${withval}/include"
188 LDFLAGS="$LDFLAGS -L${withval}/lib64 -L${withval}/lib"
189 ])
190
191 # Check liblttng-ust-ctl library
192 AC_ARG_ENABLE(lttng-ust,
193 AS_HELP_STRING([--disable-lttng-ust],[build without LTTng-UST (Userspace Tracing) support]),
194 lttng_ust_support=$enableval, lttng_ust_support=yes)
195
196 AS_IF([test "x$lttng_ust_support" = "xyes"], [
197 AC_CHECK_LIB([lttng-ust-ctl], [ustctl_recv_channel_from_consumer],
198 [
199 AC_DEFINE([HAVE_LIBLTTNG_UST_CTL], [1], [has LTTng-UST control support])
200 lttng_ust_ctl_found=yes
201 ],
202 [AC_MSG_ERROR([Cannot find LTTng-UST >= 2.2.x. Use --with-lttng-ust-prefix=PREFIX to specify its location, or specify --disable-lttng-ust to build lttng-tools without LTTng-UST support.])],
203 [-lurcu-common -lurcu-bp -lurcu-cds -lrt]
204 )
205 ])
206 AM_CONDITIONAL([HAVE_LIBLTTNG_UST_CTL], [test "x$lttng_ust_ctl_found" = xyes])
207 AC_CHECK_FUNCS([sched_getcpu sysconf sync_file_range])
208
209 # check for dlopen
210 AC_CHECK_LIB([dl], [dlopen],
211 [
212 have_libdl=yes
213 ],
214 [
215 #libdl not found, check for dlopen in libc.
216 AC_CHECK_LIB([c], [dlopen],
217 [
218 have_libc_dl=yes
219 ],
220 [
221 AC_MSG_ERROR([Cannot find dlopen in libdl nor libc. Use [LDFLAGS]=-Ldir to specify their location.])
222 ])
223 ])
224 AM_CONDITIONAL([LTTNG_TOOLS_BUILD_WITH_LIBDL], [test "x$have_libdl" = "xyes"])
225 AM_CONDITIONAL([LTTNG_TOOLS_BUILD_WITH_LIBC_DL], [test "x$have_libc_dl" = "xyes"])
226
227 # Check for fmemopen
228 AC_CHECK_LIB([c], [fmemopen],
229 [
230 AC_DEFINE_UNQUOTED([LTTNG_HAVE_FMEMOPEN], 1, [Has fmemopen support.])
231 ]
232 )
233
234 # Check for open_memstream
235 AC_CHECK_LIB([c], [open_memstream],
236 [
237 AC_DEFINE_UNQUOTED([LTTNG_HAVE_OPEN_MEMSTREAM], 1, [Has open_memstream support.])
238 ]
239 )
240
241 # For Python
242 # SWIG version needed or newer:
243 swig_version=2.0.0
244
245 AC_ARG_ENABLE([python-bindings],
246 [AC_HELP_STRING([--enable-python-bindings],
247 [compile Python bindings])],
248 [enable_python=yes], [enable_python=no])
249
250 AM_CONDITIONAL([USE_PYTHON], [test "x${enable_python:-yes}" = xyes])
251
252 if test "x${enable_python:-yes}" = xyes; then
253 AX_PKG_SWIG($swig_version, [], [ AC_MSG_ERROR([SWIG $swig_version or newer is needed]) ])
254 AM_PATH_PYTHON
255
256 AC_ARG_VAR([PYTHON_INCLUDE], [Include flags for python, bypassing python-config])
257 AC_ARG_VAR([PYTHON_CONFIG], [Path to python-config])
258 AS_IF([test -z "$PYTHON_INCLUDE"], [
259 AS_IF([test -z "$PYTHON_CONFIG"], [
260 AC_PATH_PROGS([PYTHON_CONFIG],
261 [python$PYTHON_VERSION-config python-config],
262 [no],
263 [`dirname $PYTHON`])
264 AS_IF([test "$PYTHON_CONFIG" = no], [AC_MSG_ERROR([cannot find python-config for $PYTHON. Do you have python-dev installed?])])
265 ])
266 AC_MSG_CHECKING([python include flags])
267 PYTHON_INCLUDE=`$PYTHON_CONFIG --includes`
268 AC_MSG_RESULT([$PYTHON_INCLUDE])
269 ])
270
271 else
272 AC_MSG_NOTICE([You may configure with --enable-python-bindings ]dnl
273 [if you want Python bindings.])
274
275 fi
276
277 # Option to only build the consumer daemon and its libraries
278 AC_ARG_WITH([consumerd-only],
279 AS_HELP_STRING([--with-consumerd-only],[Only build the consumer daemon [default=no]]),
280 [consumerd_only=$withval],
281 [consumerd_only=no])
282 AM_CONDITIONAL([BUILD_CONSUMERD_ONLY], [test "x$consumerd_only" = "xyes"])
283
284 # Epoll check. If not present, the build will fallback on poll() API
285 AX_HAVE_EPOLL(
286 [AX_CONFIG_FEATURE_ENABLE(epoll)],
287 [AX_CONFIG_FEATURE_DISABLE(epoll)]
288 )
289 AX_CONFIG_FEATURE(
290 [epoll], [This platform supports epoll(7)],
291 [HAVE_EPOLL], [This platform supports epoll(7).],
292 [enable_epoll="yes"], [enable_epoll="no"]
293 )
294 AM_CONDITIONAL([COMPAT_EPOLL], [ test "$enable_epoll" = "yes" ])
295
296 AC_SYS_LARGEFILE
297 AC_PROG_CC
298 LT_INIT
299 AC_PROG_YACC
300 AC_PROG_LEX
301
302 if test ! -f "$srcdir/src/lib/lttng-ctl/filter/filter-parser.h"; then
303 if test x"$YACC" != "xbison -y"; then
304 AC_MSG_ERROR([[bison not found and is required when building from git.
305 Please install bison]])
306 fi
307 fi
308
309 if test ! -f "$srcdir/src/lib/lttng-ctl/filter/filter-lexer.c"; then
310 if test x"$LEX" != "xflex"; then
311 AC_MSG_ERROR([[flex not found and is required when building from git.
312 Please install flex]])
313 fi
314 fi
315
316 CFLAGS="-Wall $CFLAGS -g -fno-strict-aliasing"
317
318 DEFAULT_INCLUDES="-I\$(top_srcdir) -I\$(top_builddir) -I\$(top_builddir)/src -I\$(top_builddir)/include -include config.h"
319
320 lttngincludedir="${includedir}/lttng"
321
322 AC_SUBST(lttngincludedir)
323 AC_SUBST(DEFAULT_INCLUDES)
324
325 lttnglibexecdir="${libdir}/lttng/libexec"
326 AC_SUBST(lttnglibexecdir)
327
328 AC_CONFIG_FILES([
329 Makefile
330 doc/Makefile
331 doc/man/Makefile
332 include/Makefile
333 extras/Makefile
334 extras/bindings/Makefile
335 extras/bindings/swig/Makefile
336 extras/bindings/swig/python/Makefile
337 extras/core-handler/Makefile
338 src/Makefile
339 src/common/Makefile
340 src/common/kernel-ctl/Makefile
341 src/common/kernel-consumer/Makefile
342 src/common/ust-consumer/Makefile
343 src/common/hashtable/Makefile
344 src/common/sessiond-comm/Makefile
345 src/common/compat/Makefile
346 src/common/relayd/Makefile
347 src/common/testpoint/Makefile
348 src/lib/Makefile
349 src/lib/lttng-ctl/Makefile
350 src/lib/lttng-ctl/filter/Makefile
351 src/lib/lttng-ctl/lttng-ctl.pc
352 src/bin/Makefile
353 src/bin/lttng-consumerd/Makefile
354 src/bin/lttng-sessiond/Makefile
355 src/bin/lttng-relayd/Makefile
356 src/bin/lttng/Makefile
357 tests/Makefile
358 tests/regression/Makefile
359 tests/regression/kernel/Makefile
360 tests/regression/tools/Makefile
361 tests/regression/tools/streaming/Makefile
362 tests/regression/tools/filtering/Makefile
363 tests/regression/tools/health/Makefile
364 tests/regression/tools/tracefile-limits/Makefile
365 tests/regression/tools/snapshots/Makefile
366 tests/regression/ust/Makefile
367 tests/regression/ust/nprocesses/Makefile
368 tests/regression/ust/high-throughput/Makefile
369 tests/regression/ust/low-throughput/Makefile
370 tests/regression/ust/before-after/Makefile
371 tests/regression/ust/buffers-uid/Makefile
372 tests/regression/ust/periodical-metadata-flush/Makefile
373 tests/regression/ust/multi-session/Makefile
374 tests/regression/ust/overlap/Makefile
375 tests/regression/ust/overlap/demo/Makefile
376 tests/regression/ust/linking/Makefile
377 tests/regression/ust/daemon/Makefile
378 tests/regression/ust/exit-fast/Makefile
379 tests/regression/ust/fork/Makefile
380 tests/regression/ust/libc-wrapper/Makefile
381 tests/stress/Makefile
382 tests/unit/Makefile
383 tests/utils/Makefile
384 tests/utils/tap/Makefile
385 tests/utils/testapp/Makefile
386 tests/utils/testapp/gen-ust-events/Makefile
387 tests/utils/testapp/gen-ust-nevents/Makefile
388 ])
389
390 AC_OUTPUT
391
392 #
393 # Mini-report on what will be built
394 #
395 AS_ECHO()
396
397 AS_ECHO("Version name: $version_name")
398 AS_ECHO("$version_description")
399
400 AS_ECHO()
401
402 # Target architecture we're building for
403 target_arch=$host_cpu
404 [
405 for f in $CFLAGS; do
406 if test $f = "-m32"; then
407 target_arch="32-bit"
408 elif test $f = "-m64"; then
409 target_arch="64-bit"
410 fi
411 done
412 ]
413 AS_ECHO_N("Target architecture: ")
414 AS_ECHO($target_arch)
415
416 # LTTng-UST enabled/disabled
417 AS_ECHO_N("Lttng-UST support: ")
418 AS_IF([test "x$lttng_ust_support" = "xyes"],[
419 AS_ECHO("Enabled")
420 ],[
421 AS_ECHO("Disabled")
422 ])
423
424 #Python binding enabled/disabled
425 AS_ECHO_N("Python binding: ")
426 AS_IF([test "x${enable_python:-yes}" = xyes], [
427 AS_ECHO("Enabled")
428 ],[
429 AS_ECHO("Disabled")
430 ])
431
432 # Do we build only the consumerd, or everything
433 AS_IF([test "x$consumerd_only" = "xyes"],[
434 AS_ECHO("Only the consumerd daemon will be built.")
435 ],[
436 AS_ECHO("All binaries will be built.")
437 ])
438
439 # Print the bindir and libdir this `make install' will install into.
440 AS_ECHO()
441 AS_ECHO_N("Binaries will be installed in: ")
442 AS_ECHO("`eval eval echo $bindir`")
443 AS_ECHO_N("Libraries will be installed in: ")
444 AS_ECHO("`eval eval echo $libdir`")
445
446 # If we build the sessiond, print the paths it will use
447 AS_IF([test "x$consumerd_only" = "xno"],[
448 AS_ECHO()
449 AS_ECHO_N("The lttng command will look for the lttng-sessiond executable at: ")
450 AS_IF([test "$SESSIOND_BIN" = ""],[
451 AS_ECHO_N("`eval eval echo $bindir`")
452 AS_ECHO("/lttng-sessiond")
453 ],[
454 AS_ECHO("$SESSIOND_BIN")
455 ])
456
457 AS_ECHO()
458 AS_ECHO("The sessiond daemon will look in the following directories: ")
459 AS_ECHO_N("32-bit consumerd executable at: ")
460 AS_IF([test "$CONSUMERD32_BIN" = ""],[
461 AS_ECHO_N("`eval eval echo $lttnglibexecdir`")
462 AS_ECHO("/lttng-consumerd")
463 ],[
464 AS_ECHO("$CONSUMERD32_BIN")
465 ])
466
467 AS_ECHO_N("32-bit consumer libraries in: ")
468 AS_IF([test "$CONSUMERD32_LIBDIR" = ""],[
469 AS_ECHO("`eval eval echo $libdir`")
470 ],[
471 AS_ECHO("$CONSUMERD32_LIBDIR")
472 ])
473
474 AS_ECHO_N("64-bit consumerd executable at: ")
475 AS_IF([test "$CONSUMERD64_BIN" = ""],[
476 AS_ECHO_N("`eval eval echo $lttnglibexecdir`")
477 AS_ECHO("/lttng-consumerd")
478 ],[
479 AS_ECHO("$CONSUMERD64_BIN")
480 ])
481
482 AS_ECHO_N("64-bit consumer libraries in: ")
483 AS_IF([test "$CONSUMERD64_LIBDIR" = ""],[
484 AS_ECHO("`eval eval echo $libdir`")
485 ],[
486 AS_ECHO("$CONSUMERD64_LIBDIR")
487 ])
488 ])
489
490 AS_ECHO()
491
This page took 0.039304 seconds and 5 git commands to generate.