Fix: Libtool fails to find dependent libraries when cross-compiling lttng-ust
[lttng-ust.git] / configure.ac
CommitLineData
1304f3df
PMF
1# -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
1a94cf83 4AC_INIT([lttng-ust],[2.0.1],[mathieu dot desnoyers at efficios dot com])
a334646a
MD
5
6# Following the numbering scheme proposed by libtool for the library version
7# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
8AC_SUBST([LTTNG_UST_LIBRARY_VERSION], [0:0:0])
9# note: remember to update tracepoint.h dlopen() to match this version
10# number. TODO: eventually automate by exporting the major number.
11
55355fa5 12AC_CONFIG_AUX_DIR([config])
9441df61
PMF
13AC_CANONICAL_TARGET
14AC_CANONICAL_HOST
50f3dba0 15AC_CONFIG_MACRO_DIR([config])
76ceb8db 16AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip])
50f3dba0 17m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
4318ae1b 18AC_CONFIG_SRCDIR([include/lttng/tracepoint.h])
4846fadc
AM
19
20# Configuration options, which will be installed in the config.h
562c813a
MD
21AC_CONFIG_HEADERS([config.h include/lttng/ust-config.h])
22AH_TEMPLATE([LTTNG_UST_HAVE_EFFICIENT_UNALIGNED_ACCESS], [Use efficient unaligned access.])
02120ddf 23AH_TEMPLATE([LTTNG_UST_HAVE_SDT_INTEGRATION], [SystemTap integration via sdt.h])
23c8854a 24
b728d87e 25# Compute minor/major/patchlevel version numbers
23c8854a 26AC_PROG_SED
2694975d
MD
27major_version=$(echo AC_PACKAGE_VERSION | sed 's/^\([[0-9]]\)*\.[[0-9]]*\.[[0-9]]*.*$/\1/')
28minor_version=$(echo AC_PACKAGE_VERSION | sed 's/^[[0-9]]*\.\([[0-9]]*\)\.[[0-9]]*.*$/\1/')
29patchlevel_version=$(echo AC_PACKAGE_VERSION | sed 's/^[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\).*$/\1/')
161239e0
YB
30AC_SUBST([MAJOR_VERSION], [$major_version])
31AC_SUBST([MINOR_VERSION], [$minor_version])
b728d87e 32AC_SUBST([PATCHLEVEL_VERSION], [$patchlevel_version])
161239e0
YB
33AC_DEFINE_UNQUOTED([VERSION_MAJOR], $major_version, [UST major version number])
34AC_DEFINE_UNQUOTED([VERSION_MINOR], $minor_version, [UST minor version number])
b728d87e 35AC_DEFINE_UNQUOTED([VERSION_PATCHLEVEL], $patchlevel_version, [UST patchlevel version number])
161239e0 36
649282a8
MD
37version_name="Annedd'ale"
38version_description="New type of beer, 100% from Quebec, flavored with sapin beaumier needles, with a touch of hops."
1c59f149
MD
39AC_DEFINE_UNQUOTED([VERSION_NAME], ["$version_name"], [UST version name])
40AC_DEFINE_UNQUOTED([VERSION_DESCRIPTION], ["$version_description"], [UST version description])
1304f3df 41
faebb418
CB
42AC_PROG_GREP
43# libtool link_all_deplibs fixup. See http://bugs.lttng.org/issues/321.
44AC_ARG_ENABLE(libtool-linkdep-fixup,
45 AS_HELP_STRING([--disable-libtool-linkdep-fixup],
46 [disable the libtool fixup for linking all dependent libraries (link_all_deplibs)]),
47 libtool_fixup=$enableval,
48 libtool_fixup=yes)
49
50AS_IF([test "x$libtool_fixup" = "xyes"],
51 [
52 libtool_m4="$srcdir/config/libtool.m4"
53 libtool_flag_pattern=".*link_all_deplibs\s*,\s*\$1\s*)"
54 AC_MSG_CHECKING([for occurence(s) of link_all_deplibs = no in $libtool_m4])
55 libtool_flag_pattern_count=$(grep -c "$libtool_flag_pattern\s*=\s*no" $libtool_m4)
56 AS_IF([test $libtool_flag_pattern_count -ne 0],
57 [
58 AC_MSG_RESULT([$libtool_flag_pattern_count])
59 AC_MSG_WARN([the detected libtool will not link all dependencies, forcing link_all_deplibs = unknown])
60 sed -i "s/\($libtool_flag_pattern\)\s*=\s*no/\1=unknown/g" $libtool_m4
61 ],
62 [
63 AC_MSG_RESULT([none])
64 ])
65 ])
66
1304f3df
PMF
67# Checks for programs.
68AC_PROG_CC
6b79f035 69AC_PROG_CXX
1304f3df 70AC_PROG_MAKE_SET
fa1c6efe 71LT_INIT
1304f3df
PMF
72
73## Checks for libraries.
c6c454ab
MD
74AC_CHECK_LIB([dl], [dlopen],
75[
76 have_libdl=yes
77],
78[
79 #libdl not found, check for dlopen in libc.
80 AC_CHECK_LIB([c], [dlopen],
81 [
82 have_libc_dl=yes
83 ],
84 [
85 AC_MSG_ERROR([Cannot find dlopen in libdl nor libc. Use [LDFLAGS]=-Ldir to specify their location.])
86 ])
87])
88AM_CONDITIONAL([LTTNG_UST_BUILD_WITH_LIBDL], [test "x$have_libdl" = "xyes"])
89AM_CONDITIONAL([LTTNG_UST_BUILD_WITH_LIBC_DL], [test "x$have_libc_dl" = "xyes"])
90
e26c8207 91AC_CHECK_LIB([pthread], [pthread_create])
1304f3df 92
2cb76594 93# Check for libuuid
5e8445c4
MD
94AC_CHECK_LIB([uuid], [uuid_generate],
95[
96 AC_DEFINE_UNQUOTED([LTTNG_UST_HAVE_LIBUUID], 1, [Has libuuid support.])
19d8b1b3 97 have_libuuid=yes
5e8445c4
MD
98],
99[
100 # libuuid not found, check for uuid_create in libc.
101 AC_CHECK_LIB([c], [uuid_create],
102 [
103 AC_DEFINE_UNQUOTED([LTTNG_UST_HAVE_LIBC_UUID], 1, [Has libc uuid support.])
19d8b1b3 104 have_libc_uuid=yes
5e8445c4
MD
105 ],
106 [
c6c454ab 107 AC_MSG_ERROR([Cannot find libuuid uuid_generate nor libc uuid_create. Use [LDFLAGS]=-Ldir to specify their location.])
5e8445c4
MD
108 ])
109]
2cb76594 110)
19d8b1b3
MD
111AM_CONDITIONAL([LTTNG_UST_BUILD_WITH_LIBUUID], [test "x$have_libuuid" = "xyes"])
112AM_CONDITIONAL([LTTNG_UST_BUILD_WITH_LIBC_UUID], [test "x$have_libc_uuid" = "xyes"])
2cb76594 113
1304f3df
PMF
114# Checks for header files.
115#AC_CHECK_HEADERS([fcntl.h stdint.h stdlib.h string.h sys/socket.h sys/time.h unistd.h])
116
117# Checks for typedefs, structures, and compiler characteristics.
118AC_C_INLINE
119#AC_TYPE_INT16_T
120#AC_TYPE_INT32_T
121#AC_TYPE_INT64_T
122#AC_TYPE_INT8_T
123#AC_TYPE_PID_T
124#AC_TYPE_SIZE_T
125#AC_TYPE_SSIZE_T
126#AC_TYPE_UINT16_T
127#AC_TYPE_UINT32_T
128#AC_TYPE_UINT64_T
129#AC_TYPE_UINT8_T
130#AC_CHECK_TYPES([ptrdiff_t])
131
132# Checks for library functions.
133AC_FUNC_MALLOC
e9d165be 134AC_CHECK_FUNCS([gettimeofday munmap socket strerror strtol sched_getcpu sysconf])
1304f3df 135
fbae86d6
MD
136CFLAGS="-Wall $CFLAGS"
137
8624c549
PMF
138# URCU
139
140# urcu - check if we just find the headers it out of the box.
135987a5 141AC_CHECK_HEADERS([urcu-bp.h], [], [AC_MSG_ERROR([Cannot find [URCU] headers (urcu-bp.h). Use [CPPFLAGS]=-Idir to specify their location.
cacb7fbe 142This error can also occur when the liburcu package's configure script has not been run.])])
bf956ec0
MD
143
144# urcu-cds - check that URCU Concurrent Data Structure lib is available to compilation
145# Part of Userspace RCU library 0.7.2 or better.
146AC_CHECK_LIB([urcu-cds], [_cds_lfht_new], [], [AC_MSG_ERROR([Cannot find
147liburcu-cds lib, part of Userspace RCU 0.7 or better. Use [LDFLAGS]=-Ldir to specify its location.])])
8624c549 148
b5a3dfa5 149AC_MSG_CHECKING([caa_likely()])
31b07350 150AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
b5a3dfa5 151#include <urcu/compiler.h>
b5a3dfa5
MD
152void fct(void)
153{
154 if (caa_likely(1)) {
155 }
156}
727bb6cb 157]])],[
b5a3dfa5 158 AC_MSG_RESULT([yes])
727bb6cb 159],[
b5a3dfa5
MD
160 AC_MSG_RESULT([no])
161 AC_MSG_ERROR([Please upgrade your version of liburcu to 0.6.6 or better])
727bb6cb
MD
162
163])
b5a3dfa5 164
8624c549 165# urcu - check that URCU lib is available to compilation
cfa0520d 166AC_CHECK_LIB([urcu-bp], [synchronize_rcu_bp], [], [AC_MSG_ERROR([Cannot find liburcu-bp lib. Use [LDFLAGS]=-Ldir to specify its location.])])
e3073410 167
a6830b14
MD
168# urcu - check that URCU lib is at least version 0.6
169AC_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.])])
e3073410 170
42d054a0 171
8c98245f
PA
172# Check for various supplementary host information (beyond the
173# triplet) which might affect the library format choices. E.g., we
174# can be building with `i686-unknown-linux-gnu-gcc -m64'
175
176case "${host}" in
177changequote(,)dnl
178 i[34567]86-*-linux*)
179changequote([,])dnl
180 AC_CACHE_CHECK([if building for x86-64], [ust_cv_i386_is_x86_64],
181 [save_CPPFLAGS="$CPPFLAGS"
182 CPPFLAGS="$CPPFLAGS $CFLAGS"
183 AC_EGREP_CPP([got it], [
184#if __x86_64__
185got it
186#endif
187 ], [ust_cv_i386_is_x86_64=yes],
188 [ust_cv_i386_is_x86_64=no])
189 CPPFLAGS="$save_CPPFLAGS"])
190 ;;
191esac
192
2e06f3b5
PMF
193AC_MSG_CHECKING([library format for the host system])
194case $host_cpu in
8c98245f
PA
195changequote(,)dnl
196 i[3456]86)
197changequote([,])dnl
198 if test "$ust_cv_i386_is_x86_64" = yes ; then
199 LIBFORMAT="elf64-x86-64"
200 else
201 LIBFORMAT="elf32-i386"
202 fi
203 ;;
9441df61 204 x86_64) LIBFORMAT="elf64-x86-64" ;;
272d715a 205 amd64) LIBFORMAT="elf64-x86-64" ;;
6fa0d97f 206 powerpc) LIBFORMAT="elf32-powerpc" ;;
9441df61 207 ppc64) LIBFORMAT="elf64-powerpc" ;;
7af249f6 208 powerpc64) LIBFORMAT="elf64-powerpc" ;;
9937f480
MD
209 s390) LIBFORMAT="elf32-s390"; NO_UNALIGNED_ACCESS=1 ;;
210 s390x) LIBFORMAT="elf64-s390"; NO_UNALIGNED_ACCESS=1 ;;
2699970a 211 armv5) LIBFORMAT="elf32-littlearm"; NO_UNALIGNED_ACCESS=1 ;;
9937f480
MD
212 arm) LIBFORMAT="elf32-littlearm"; NO_UNALIGNED_ACCESS=1 ;;
213 mips*) LIBFORMAT=""; NO_UNALIGNED_ACCESS=1;;
6fa0d97f 214 *) AC_MSG_ERROR([unable to detect library format (unsupported architecture ($host_cpu)?)]) ;;
9441df61
PMF
215esac
216AC_SUBST(LIBFORMAT)
217AC_MSG_RESULT($LIBFORMAT)
ed452f03 218
2699970a
JW
219if test "x$host_cpu" = "xarm" ; then
220AC_MSG_CHECKING([checking for armv5])
31b07350 221AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
2699970a
JW
222#ifndef __ARM_ARCH_5TEJ__
223#error "no arm5 here"
224#endif
727bb6cb 225]])],[
2699970a
JW
226 AC_MSG_RESULT([yes])
227 NO_UNALIGNED_ACCESS=1
727bb6cb
MD
228
229],[
2699970a 230 AC_MSG_RESULT([no])
727bb6cb
MD
231
232])
2699970a
JW
233fi
234if test x$NO_UNALIGNED_ACCESS = x ; then
562c813a 235AC_DEFINE([LTTNG_UST_HAVE_EFFICIENT_UNALIGNED_ACCESS], [1])
2699970a
JW
236fi
237
2b6f8df9 238# Set compile flags to java include files if given
b2263155
AM
239AC_ARG_WITH([java-jdk],
240 [AS_HELP_STRING([--with-java-jdk=DIR],[use the Java JDK in DIR. Ex : $JAVA_HOME.])],
241 [JAVA_JDK=$withval],
242 [JAVA_JDK=""]
243)
244AS_IF([test $JAVA_JDK],[
245 AS_IF([test -d $JAVA_JDK],[
246 AC_MSG_RESULT([using Java includes in $JAVA_SDK])
247 SUBDIRS=`find $JAVA_JDK/include -type d`
135987a5
MD
248 CPPFLAGS+=" "
249 CPPFLAGS+=`for x in $SUBDIRS; do echo -n "-I$x "; done`
250 CPPFLAGS+=" "
b2263155
AM
251 ],[
252 AC_MSG_ERROR(Unable to find Java include files in $JAVA_JDK)
253 ])
254])
2b6f8df9
MD
255
256# Check for JNI header files if requested
b2263155
AM
257AC_ARG_WITH([jni-interface],
258 [AS_HELP_STRING([--with-jni-interface],[build JNI interface between C and Java. Needs Java include files [default=no]])],
259 [jni_interface=$withval],
260 [jni_interface=no]
261)
2b6f8df9 262
b2263155
AM
263AS_IF([test "x$jni_interface" = "xyes"],[
264 AC_CHECK_HEADERS([jni.h],[],[
265 AC_MSG_ERROR([missing jni.h
266Make sure Sun Java, OpenJDK or GCJ is installed and that this header file exists in the system path.
267Use the --with-java-jdk=DIR flag to point to your Java include files, or disable the JNI interface.])
268 ])
269])
270AM_CONDITIONAL([BUILD_JNI_INTERFACE], [test "x$jni_interface" = "xyes"])
2b6f8df9 271
4846fadc
AM
272# sdt.h integration
273AC_ARG_WITH([sdt],
02120ddf 274 [AS_HELP_STRING([--with-sdt],[provide SystemTap integration via sdt.h [default=no]])],
4846fadc
AM
275 [with_sdt=$withval],
276 [with_sdt="no"]
277)
278
279AS_IF([test "x$with_sdt" = "xyes"],[
491f30fe
MD
280 AC_MSG_CHECKING([STAP_PROBEV()])
281 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
282 #define SDT_USE_VARIADIC
283 #include <sys/sdt.h>
284 void fct(void)
285 {
286 STAP_PROBEV(provider,name,1,2,3,4,5,6,7,8,9,10);
287 }
288 ]])],[
289 AC_MSG_RESULT([yes])
562c813a 290 AC_DEFINE([LTTNG_UST_HAVE_SDT_INTEGRATION], [1])
4846fadc 291 ],[
491f30fe 292 AC_MSG_RESULT([no])
135987a5 293 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])
4846fadc
AM
294 ])
295])
296
36385b6e 297#currently disabled.
36385b6e
MD
298 #tests/hello2/Makefile
299 #tests/basic/Makefile
300 #tests/simple_include/Makefile
301 #tests/snprintf/Makefile
302 #tests/test-nevents/Makefile
303 #tests/test-libustinstr-malloc/Makefile
304 #tests/dlopen/Makefile
305 #tests/same_line_marker/Makefile
306 #tests/trace_event/Makefile
307 #tests/tracepoint/Makefile
308 #tests/tracepoint/benchmark/Makefile
309 #tests/register_test/Makefile
310 #tests/libustctl_function_#tests/Makefile
311 #tests/exit-fast/Makefile
312 #tests/basic_long/Makefile
313
55355fa5
JB
314AC_CONFIG_FILES([
315 Makefile
7ccf75d3
MD
316 doc/Makefile
317 doc/examples/Makefile
69400ac4 318 include/Makefile
b728d87e 319 include/lttng/ust-version.h
69400ac4 320 snprintf/Makefile
4931a13e 321 libringbuffer/Makefile
69400ac4
MD
322 liblttng-ust-comm/Makefile
323 liblttng-ust/Makefile
324 liblttng-ust-ctl/Makefile
325 liblttng-ust-fork/Makefile
326 liblttng-ust-java/Makefile
476037d9 327 liblttng-ust-libc-wrapper/Makefile
b25c5b37 328 tools/Makefile
6dd969b5
PMF
329 tests/Makefile
330 tests/hello/Makefile
246e1625 331 tests/hello-static-lib/Makefile
6b79f035 332 tests/hello.cxx/Makefile
580d134b 333 tests/demo/Makefile
36385b6e 334 tests/fork/Makefile
5810472c 335 tests/ust-basic-tracing/Makefile
f0966704 336 tests/ust-multi-test/Makefile
74a6d87b 337 lttng-ust.pc
55355fa5 338])
1f9eff07 339
1304f3df 340AC_OUTPUT
1f9eff07 341
649282a8
MD
342AS_ECHO()
343AS_ECHO("Version name: $version_name")
344AS_ECHO("$version_description")
345
1f9eff07
AM
346# Report on the configuration options
347AS_ECHO()
348AS_ECHO("LTTng-UST will be built with the following options:")
349AS_ECHO("Library format: $LIBFORMAT")
350
351AS_ECHO()
352AS_ECHO_N("Java support (JNI): ")
353AS_IF([test "x$jni_interface" = "xyes"], [AS_ECHO("Enabled")], [AS_ECHO("Disabled")])
354
355AS_ECHO_N("sdt.h integration: ")
356AS_IF([test "x$with_sdt" = "xyes"], [AS_ECHO("Enabled")], [AS_ECHO("Disabled")])
357
358AS_ECHO()
359AS_ECHO("Type 'make' to compile.")
360
This page took 0.051553 seconds and 4 git commands to generate.