configure.ac: add missing quotes in macro calls
[lttng-ust.git] / configure.ac
1 # -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 dnl Version infos
5 m4_define([V_MAJOR], [2])
6 m4_define([V_MINOR], [8])
7 m4_define([V_PATCH], [0])
8 m4_define([V_EXTRA], [pre])
9 m4_define([V_STRING], [V_MAJOR.V_MINOR.V_PATCH])
10 m4_ifdef([V_EXTRA], [m4_append([V_STRING], [-V_EXTRA])])
11 m4_define([V_NAME], [[Herbe à Détourne]])
12 m4_define([V_DESC], [[Brewed with unrestrained amounts of Citra hop, the Herbe à Détourne is a fantastic New World Tripel brewed by "Dieu du Ciel!". Aromas of mango, cantaloupe melon and passion fruit, combined with a controlled bitter finish, unite in making this smooth golden-orange beer stand apart.]])
13
14 AC_INIT([lttng-ust],V_STRING,[mathieu dot desnoyers at efficios dot com])
15
16 # Following the numbering scheme proposed by libtool for the library version
17 # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
18 # This is the library version of liblttng-ust.
19 AC_SUBST([LTTNG_UST_LIBRARY_VERSION], [0:0:0])
20 # note: remember to update tracepoint.h dlopen() to match this version
21 # number. TODO: eventually automate by exporting the major number.
22
23 # This is the library version of liblttng-ust-ctl, used internally by
24 # liblttng-ust, lttng-sessiond, and lttng-consumerd.
25 AC_SUBST([LTTNG_UST_CTL_LIBRARY_VERSION], [2:0:0])
26
27 AC_CONFIG_AUX_DIR([config])
28 AC_CANONICAL_TARGET
29 AC_CANONICAL_HOST
30 AC_CONFIG_MACRO_DIR([config])
31 AM_INIT_AUTOMAKE([1.9 foreign dist-bzip2 no-dist-gzip tar-ustar])
32 AM_MAINTAINER_MODE([enable])
33 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
34 AC_CONFIG_SRCDIR([include/lttng/tracepoint.h])
35
36 # Configuration options, which will be installed in the config.h
37 AC_CONFIG_HEADERS([config.h include/lttng/ust-config.h])
38 AH_TEMPLATE([LTTNG_UST_HAVE_EFFICIENT_UNALIGNED_ACCESS], [Use efficient unaligned access.])
39 AH_TEMPLATE([LTTNG_UST_HAVE_SDT_INTEGRATION], [SystemTap integration via sdt.h])
40 AH_TEMPLATE([LTTNG_UST_HAVE_PERF_EVENT], [Perf event integration via perf_event.h])
41
42 # Substitute minor/major/patchlevel version numbers
43 AC_PROG_SED
44 AC_SUBST([MAJOR_VERSION], [V_MAJOR])
45 AC_SUBST([MINOR_VERSION], [V_MINOR])
46 AC_SUBST([PATCHLEVEL_VERSION], [V_PATCH])
47
48 AC_PROG_GREP
49 AC_PROG_LN_S
50 # libtool link_all_deplibs fixup. See http://bugs.lttng.org/issues/321.
51 AC_ARG_ENABLE([libtool-linkdep-fixup],
52 AS_HELP_STRING([--disable-libtool-linkdep-fixup],
53 [disable the libtool fixup for linking all dependent libraries (link_all_deplibs)]),
54 [libtool_fixup=$enableval],
55 [libtool_fixup=yes])
56
57 AS_IF([test "x$libtool_fixup" = "xyes"],
58 [
59 libtool_m4="$srcdir/config/libtool.m4"
60 libtool_flag_pattern=".*link_all_deplibs\s*,\s*\$1\s*)"
61 AC_MSG_CHECKING([for occurence(s) of link_all_deplibs = no in $libtool_m4])
62 libtool_flag_pattern_count=$(grep -c "$libtool_flag_pattern\s*=\s*no" $libtool_m4)
63 AS_IF([test $libtool_flag_pattern_count -ne 0],
64 [
65 AC_MSG_RESULT([$libtool_flag_pattern_count])
66 AC_MSG_WARN([the detected libtool will not link all dependencies, forcing link_all_deplibs = unknown])
67 sed -i "s/\($libtool_flag_pattern\)\s*=\s*no/\1=unknown/g" $libtool_m4
68 ],
69 [
70 AC_MSG_RESULT([none])
71 ])
72 ])
73
74 AM_CONDITIONAL([NO_SHARED], [test "x$enable_shared" = "xno"])
75
76 # Checks for programs.
77 AC_PROG_CC
78 AC_PROG_CXX
79 AC_PROG_MAKE_SET
80 LT_INIT
81
82 # rw_PROG_CXX_WORKS
83 # Check whether the C++ compiler works.
84 AC_CACHE_CHECK([whether the C++ compiler works],
85 [rw_cv_prog_cxx_works],
86 [AC_LANG_PUSH([C++])
87 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
88 [check_cxx_designated_initializers=yes],
89 [rw_cv_prog_cxx_works=no])
90 if test "$check_cxx_designated_initializers" = "yes"; then
91 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
92 struct foo { int a; int b; };
93 void fct(void)
94 {
95 struct foo f = { .a = 0, .b = 1 };
96 }
97 ]])],[
98 rw_cv_prog_cxx_works=yes
99 ],[
100 rw_cv_prog_cxx_works=no
101 ])
102 fi
103 AC_LANG_POP([C++])])
104
105 AM_CONDITIONAL([CXX_WORKS], [test "x$rw_cv_prog_cxx_works" = "xyes"])
106
107 # Check if the compiler support weak symbols
108 AX_SYS_WEAK_ALIAS
109
110 if test "x${ax_cv_sys_weak_alias}" = "xno"; then
111 AC_MSG_ERROR([Your platform doesn't support weak symbols.])
112 fi
113
114 ## Checks for libraries.
115 AC_CHECK_LIB([dl], [dlopen],
116 [
117 have_libdl=yes
118 ],
119 [
120 #libdl not found, check for dlopen in libc.
121 AC_CHECK_LIB([c], [dlopen],
122 [
123 have_libc_dl=yes
124 ],
125 [
126 AC_MSG_ERROR([Cannot find dlopen in libdl nor libc. Use [LDFLAGS]=-Ldir to specify their location.])
127 ])
128 ])
129 AM_CONDITIONAL([LTTNG_UST_BUILD_WITH_LIBDL], [test "x$have_libdl" = "xyes"])
130 AM_CONDITIONAL([LTTNG_UST_BUILD_WITH_LIBC_DL], [test "x$have_libc_dl" = "xyes"])
131
132 AC_CHECK_LIB([pthread], [pthread_create])
133
134 # Check for dlfcn.h
135 AC_CHECK_HEADER([dlfcn.h])
136 AS_IF([test "x${ac_cv_header_dlfcn_h}" = "xyes"],
137 [AC_CHECK_DECLS([RTLD_DI_LINKMAP],,,
138 [#define _GNU_SOURCE /* Required on Linux to get GNU extensions */
139 #include <dlfcn.h>])
140 ],
141 [ac_cv_have_decl_RTLD_DI_LINKMAP="no"])
142 AM_CONDITIONAL([HAVE_DLINFO], [test "x${ac_cv_have_decl_RTLD_DI_LINKMAP}" = "xyes"])
143
144 # Checks for header files.
145 #AC_CHECK_HEADERS([fcntl.h stdint.h stdlib.h string.h sys/socket.h sys/time.h unistd.h])
146
147 # Checks for typedefs, structures, and compiler characteristics.
148 AC_C_INLINE
149 #AC_TYPE_INT16_T
150 #AC_TYPE_INT32_T
151 #AC_TYPE_INT64_T
152 #AC_TYPE_INT8_T
153 #AC_TYPE_PID_T
154 #AC_TYPE_SIZE_T
155 #AC_TYPE_SSIZE_T
156 #AC_TYPE_UINT16_T
157 #AC_TYPE_UINT32_T
158 #AC_TYPE_UINT64_T
159 #AC_TYPE_UINT8_T
160 #AC_CHECK_TYPES([ptrdiff_t])
161
162 # Checks for library functions.
163 AC_FUNC_MALLOC
164 AC_CHECK_FUNCS([gettimeofday munmap socket strerror strtol sched_getcpu sysconf])
165
166 CFLAGS="-Wall $CFLAGS"
167
168 # URCU
169
170 # urcu - check if we just find the headers it out of the box.
171 AC_CHECK_HEADERS([urcu-bp.h], [], [AC_MSG_ERROR([Cannot find [URCU] headers (urcu-bp.h). Use [CPPFLAGS]=-Idir to specify their location.
172 This error can also occur when the liburcu package's configure script has not been run.])])
173
174 # urcu-cds - check that URCU Concurrent Data Structure lib is available to compilation
175 # Part of Userspace RCU library 0.7.2 or better.
176 AC_CHECK_LIB([urcu-cds], [_cds_lfht_new], [], [AC_MSG_ERROR([Cannot find
177 liburcu-cds lib, part of Userspace RCU 0.7 or better. Use [LDFLAGS]=-Ldir to specify its location.])])
178
179 AC_MSG_CHECKING([caa_likely()])
180 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
181 #include <urcu/compiler.h>
182 void fct(void)
183 {
184 if (caa_likely(1)) {
185 }
186 }
187 ]])],[
188 AC_MSG_RESULT([yes])
189 ],[
190 AC_MSG_RESULT([no])
191 AC_MSG_ERROR([Please upgrade your version of liburcu to 0.6.6 or better])
192
193 ])
194
195 # urcu - check that URCU lib is available to compilation
196 AC_CHECK_LIB([urcu-bp], [synchronize_rcu_bp], [], [AC_MSG_ERROR([Cannot find liburcu-bp lib. Use [LDFLAGS]=-Ldir to specify its location.])])
197
198 # urcu - check that URCU lib is at least version 0.6
199 AC_CHECK_LIB([urcu-bp], [call_rcu_bp], [], [AC_MSG_ERROR([liburcu 0.6 or newer is needed, please update your version or use [LDFLAGS]=-Ldir to specify the right location.])])
200
201 # optional linux/perf_event.h
202 AC_CHECK_HEADERS([linux/perf_event.h], [have_perf_event=yes], [])
203
204 # Perf event counters are only supported on x86 so far.
205 AC_MSG_CHECKING([UST support for architecture perf event counters])
206 case $host_cpu in
207 changequote(,)dnl
208 i[3456]86)
209 changequote([,])dnl
210 UST_SUPPORT_FOR_ARCH_PERF_EVENT_COUNTERS=yes;;
211 x86_64) UST_SUPPORT_FOR_ARCH_PERF_EVENT_COUNTERS=yes;;
212 amd64) UST_SUPPORT_FOR_ARCH_PERF_EVENT_COUNTERS=yes;;
213 *) UST_SUPPORT_FOR_ARCH_PERF_EVENT_COUNTERS=no;;
214 esac
215 AC_MSG_RESULT([$UST_SUPPORT_FOR_ARCH_PERF_EVENT_COUNTERS])
216
217 AM_CONDITIONAL([HAVE_PERF_EVENT], [test "x$have_perf_event" = "xyes" -a "x$UST_SUPPORT_FOR_ARCH_PERF_EVENT_COUNTERS" = "xyes"])
218
219 if test "x$have_perf_event" = "xyes" -a "x$UST_SUPPORT_FOR_ARCH_PERF_EVENT_COUNTERS" = "xyes"; then
220 AC_DEFINE([LTTNG_UST_HAVE_PERF_EVENT], [1])
221 fi
222
223 AC_MSG_CHECKING([host system alignment requirements])
224 case $host_cpu in
225 changequote(,)dnl
226 i[3456]86)
227 changequote([,])dnl
228 ;;
229 x86_64) ;;
230 amd64) ;;
231 powerpc) ;;
232 ppc64) ;;
233 ppc64le) ;;
234 powerpc64) ;;
235 powerpc64le) ;;
236 s390) NO_UNALIGNED_ACCESS=1 ;;
237 s390x) NO_UNALIGNED_ACCESS=1 ;;
238 arm*) NO_UNALIGNED_ACCESS=1 ;;
239 aarch64) NO_UNALIGNED_ACCESS=1 ;;
240 mips*) NO_UNALIGNED_ACCESS=1 ;;
241 tile*) NO_UNALIGNED_ACCESS=1 ;;
242 *)
243 UNSUPPORTED_ARCH=1
244 NO_UNALIGNED_ACCESS=1
245 ;;
246 esac
247 AC_MSG_RESULT([$host_cpu])
248
249 if test x$NO_UNALIGNED_ACCESS = x ; then
250 AC_DEFINE([LTTNG_UST_HAVE_EFFICIENT_UNALIGNED_ACCESS], [1])
251 fi
252
253 # Check for JNI header files if requested
254 AC_ARG_ENABLE([jni-interface],
255 [AS_HELP_STRING([--enable-jni-interface],[build JNI interface between C and Java. Needs Java include files [default=no]])],
256 [jni_interface=$enableval],
257 [jni_interface=no]
258 )
259
260 AM_CONDITIONAL([BUILD_JNI_INTERFACE], [test "x$jni_interface" = "xyes"])
261
262
263 AC_ARG_ENABLE([java-agent-jul],
264 [AS_HELP_STRING([--enable-java-agent-jul],[build the LTTng UST Java agent with JUL support [default=no]])],
265 [java_agent_jul=$enableval],
266 [java_agent_jul=no]
267 )
268
269 AC_ARG_ENABLE([java-agent-log4j],
270 [AS_HELP_STRING([--enable-java-agent-log4j],[build the LTTng UST Java agent with Log4j support [default=no]])],
271 [java_agent_log4j=$enableval],
272 [java_agent_log4j=no]
273 )
274
275 AC_ARG_ENABLE([java-agent-all],
276 [AS_HELP_STRING([--enable-java-agent-all],[build the LTTng UST Java agent with all supported backends [default=no]])],
277 [java_agent_jul=$enableval
278 java_agent_log4j=$enableval],
279 [:]
280 )
281
282
283 AM_CONDITIONAL([BUILD_JAVA_AGENT], [test "x$java_agent_jul" = "xyes" || test "x$java_agent_log4j" = "xyes"])
284 AM_CONDITIONAL([BUILD_JAVA_AGENT_WITH_JUL], [test "x$java_agent_jul" = "xyes"])
285 AM_CONDITIONAL([BUILD_JAVA_AGENT_WITH_LOG4J], [test "x$java_agent_log4j" = "xyes"])
286
287 if test "x$jni_interface" = "xyes" || test "x$java_agent_jul" = "xyes" || test "x$java_agent_log4j" = "xyes"; then
288 AX_JAVA_OPTIONS
289 AX_PROG_JAVAC
290 AX_PROG_JAVA
291 AX_PROG_JAR
292
293 AX_JNI_INCLUDE_DIR
294 for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS
295 do
296 CPPFLAGS="$CPPFLAGS -I$JNI_INCLUDE_DIR"
297 done
298
299 AX_PROG_JAVAH
300 fi
301
302 if test "x$java_agent_log4j" = "xyes"; then
303 AX_CHECK_CLASSPATH
304
305 AX_CHECK_CLASS([org.apache.log4j.Logger])
306
307 if test "x$ac_cv_class_org_apache_log4j_Logger" = "xno"; then
308 AC_MSG_ERROR([The UST Java agent support for log4j was requested but the Log4j classes were not found. Please specify the location of the Log4j jar via the Java CLASSPATH e.g: export CLASSPATH="/path/to/log4j.jar"])
309 fi
310 fi
311
312 # Option to build the python agent
313 AC_ARG_ENABLE([python-agent],
314 [AS_HELP_STRING([--enable-python-agent],[build the LTTng UST Python agent [default=no]])],
315 [python_agent=$enableval],
316 [:]
317 )
318 AM_CONDITIONAL([BUILD_PYTHON_AGENT], [test "x$python_agent" = "xyes"])
319 if test "x$python_agent" = "xyes"; then
320 AM_PATH_PYTHON([2.7])
321 fi
322
323 # sdt.h integration
324 AC_ARG_WITH([sdt],
325 [AS_HELP_STRING([--with-sdt],[provide SystemTap integration via sdt.h [default=no]])],
326 [with_sdt=$withval],
327 [with_sdt="no"]
328 )
329
330 AS_IF([test "x$with_sdt" = "xyes"],[
331 AC_MSG_CHECKING([STAP_PROBEV()])
332 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
333 #define SDT_USE_VARIADIC
334 #include <sys/sdt.h>
335 void fct(void)
336 {
337 STAP_PROBEV(provider,name,1,2,3,4,5,6,7,8,9,10);
338 }
339 ]])],[
340 AC_MSG_RESULT([yes])
341 AC_DEFINE([LTTNG_UST_HAVE_SDT_INTEGRATION], [1])
342 ],[
343 AC_MSG_RESULT([no])
344 AC_MSG_ERROR([The sdt.h integration was requested but the STAP_PROBEV define cannot be used. Make sure it is installed, and up to date, or use CPPFLAGS=-I/path/ to specify a non-standard path to sys/sdt.h])
345 ])
346 ])
347
348 AC_MSG_CHECKING([whether shared libraries are enabled])
349 AS_IF([test "x$enable_shared" = "xyes"],
350 [
351 AC_MSG_RESULT([yes])
352 ],
353 [
354 AC_MSG_RESULT([no])
355 AC_MSG_ERROR([LTTng-UST requires shared libraries to be enabled])
356 ])
357
358 AC_ARG_WITH([lttng-system-rundir],
359 AS_HELP_STRING([--with-lttng-system-rundir],
360 [Location of the system directory where LTTng-UST expects the system-wide lttng-sessiond runtime files. The default is "/var/run/lttng".]),
361 [lttng_system_rundir="$withval"],
362 [lttng_system_rundir="/var/run/lttng"])
363 AC_DEFINE_UNQUOTED([LTTNG_SYSTEM_RUNDIR], ["$lttng_system_rundir"],
364 [LTTng system runtime directory])
365
366 AC_CHECK_PROG([BUILD_GEN_TP_EXAMPLES],[python],["yes"])
367 AM_CONDITIONAL([BUILD_GEN_TP_EXAMPLES], [test $BUILD_GEN_TP_EXAMPLES], [Build examples requiring lttng-gen-tp])
368
369 AC_CONFIG_FILES([
370 Makefile
371 doc/Makefile
372 doc/examples/Makefile
373 include/Makefile
374 include/lttng/ust-version.h
375 snprintf/Makefile
376 libringbuffer/Makefile
377 liblttng-ust-comm/Makefile
378 liblttng-ust/Makefile
379 liblttng-ust-ctl/Makefile
380 liblttng-ust-fork/Makefile
381 liblttng-ust-dl/Makefile
382 liblttng-ust-java/Makefile
383 liblttng-ust-java-agent/Makefile
384 liblttng-ust-java-agent/java/Makefile
385 liblttng-ust-java-agent/java/lttng-ust-agent-common/Makefile
386 liblttng-ust-java-agent/java/lttng-ust-agent-jul/Makefile
387 liblttng-ust-java-agent/java/lttng-ust-agent-log4j/Makefile
388 liblttng-ust-java-agent/jni/Makefile
389 liblttng-ust-java-agent/jni/common/Makefile
390 liblttng-ust-java-agent/jni/jul/Makefile
391 liblttng-ust-java-agent/jni/log4j/Makefile
392 liblttng-ust-libc-wrapper/Makefile
393 liblttng-ust-cyg-profile/Makefile
394 liblttng-ust-python-agent/Makefile
395 python-lttngust/Makefile
396 python-lttngust/setup.py
397 python-lttngust/lttngust/__init__.py
398 tools/Makefile
399 tests/Makefile
400 tests/ctf-types/Makefile
401 tests/hello/Makefile
402 tests/hello.cxx/Makefile
403 tests/same_line_tracepoint/Makefile
404 tests/snprintf/Makefile
405 tests/ust-elf/Makefile
406 tests/benchmark/Makefile
407 tests/utils/Makefile
408 tests/test-app-ctx/Makefile
409 lttng-ust.pc
410 ])
411
412 # Create link for python agent for the VPATH guru.
413 AC_CONFIG_LINKS([
414 python-lttngust/lttngust/agent.py:python-lttngust/lttngust/agent.py
415 python-lttngust/lttngust/cmd.py:python-lttngust/lttngust/cmd.py
416 python-lttngust/lttngust/debug.py:python-lttngust/lttngust/debug.py
417 python-lttngust/lttngust/loghandler.py:python-lttngust/lttngust/loghandler.py
418 ])
419
420 AC_OUTPUT
421
422 AS_ECHO(["m4_bpatsubst(V_NAME, ["], [\\"])"])
423 AS_ECHO()
424 AS_ECHO(["m4_bpatsubst(V_DESC, ["], [\\"])"])
425
426 # Report on the configuration options
427 AS_ECHO()
428 AS_ECHO(["LTTng-UST will be built with the following options:"])
429
430 AS_ECHO()
431
432 AS_ECHO_N(["Java agent (JUL support): "])
433 AS_IF([test "x$java_agent_jul" = "xyes"], [AS_ECHO(["Enabled"])], [AS_ECHO(["Disabled"])])
434
435 AS_ECHO_N(["Java agent (Log4j support): "])
436 AS_IF([test "x$java_agent_log4j" = "xyes"], [AS_ECHO(["Enabled"])], [AS_ECHO(["Disabled"])])
437
438 AS_ECHO_N(["JNI interface (JNI): "])
439 AS_IF([test "x$jni_interface" = "xyes"], [AS_ECHO(["Enabled"])], [AS_ECHO(["Disabled"])])
440
441 AS_ECHO_N(["Python ($PYTHON) agent: "])
442 AS_IF([test "x$python_agent" = "xyes"], [AS_ECHO(["Enabled"])], [AS_ECHO(["Disabled"])])
443
444 AS_ECHO_N(["sdt.h integration: "])
445 AS_IF([test "x$with_sdt" = "xyes"], [AS_ECHO(["Enabled"])], [AS_ECHO(["Disabled"])])
446
447 AS_ECHO(["Architecture: $host_cpu"])
448 AS_ECHO_N(["Efficient unaligned memory access: "])
449 AS_IF([test "x$NO_UNALIGNED_ACCESS" != "x1"], [AS_ECHO(["yes"])], [AS_IF([test "x$UNSUPPORTED_ARCH" != "x1"], [AS_ECHO(["no"])], [AS_ECHO(["unknown"])])])
450 AS_IF([test "x$UNSUPPORTED_ARCH" = "x1"], [AC_MSG_WARN([Your architecture ($host_cpu) is unsupported, using safe default of no unaligned access])])
451 AS_ECHO()
452
453 AS_ECHO(["Type 'make' to compile."])
454
This page took 0.039054 seconds and 5 git commands to generate.